@tspro/web-music-score 5.4.1 → 5.5.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 (49) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +24 -0
  3. package/README.md +13 -6
  4. package/dist/audio/index.d.mts +1 -1
  5. package/dist/audio/index.d.ts +1 -1
  6. package/dist/audio/index.js +1637 -5
  7. package/dist/audio/index.mjs +9 -6
  8. package/dist/audio-cg/index.js +17487 -46
  9. package/dist/audio-cg/index.mjs +7 -5
  10. package/dist/audio-synth/index.js +18434 -32
  11. package/dist/audio-synth/index.mjs +12 -7
  12. package/dist/{chunk-6P4ECBUH.mjs → chunk-2DCCUAGC.mjs} +3 -3
  13. package/dist/{chunk-5I5KENEC.mjs → chunk-2PEB4HWS.mjs} +2 -2
  14. package/dist/{chunk-A5SMODAT.mjs → chunk-33HIE3HR.mjs} +18 -13
  15. package/dist/chunk-BMKUAUSJ.mjs +101 -0
  16. package/dist/chunk-PCQGQM63.mjs +18381 -0
  17. package/dist/chunk-T6TYLAJE.mjs +3766 -0
  18. package/dist/core/index.js +2 -2
  19. package/dist/core/index.mjs +4 -4
  20. package/dist/{guitar-CNOxM4ZK.d.ts → guitar-CarHGDAt.d.ts} +1 -1
  21. package/dist/{guitar-DXlB-9vK.d.mts → guitar-DK18GZ6h.d.mts} +1 -1
  22. package/dist/iife/audio-cg.global.js +1 -1
  23. package/dist/iife/index.global.js +11 -11
  24. package/dist/{music-objects-DYMqx839.d.mts → music-objects-CcJvZxS6.d.mts} +196 -115
  25. package/dist/{music-objects-DumXKWJp.d.ts → music-objects-l5Ai97QA.d.ts} +196 -115
  26. package/dist/{note-RVXvpfyV.d.mts → note-CJuq5aBy.d.mts} +1 -1
  27. package/dist/{note-RVXvpfyV.d.ts → note-CJuq5aBy.d.ts} +1 -1
  28. package/dist/pieces/index.d.mts +14 -8
  29. package/dist/pieces/index.d.ts +14 -8
  30. package/dist/pieces/index.js +25 -13
  31. package/dist/pieces/index.mjs +25 -14
  32. package/dist/react-ui/index.d.mts +5 -5
  33. package/dist/react-ui/index.d.ts +5 -5
  34. package/dist/react-ui/index.js +2163 -22
  35. package/dist/react-ui/index.mjs +18 -15
  36. package/dist/{scale-C8gHC448.d.mts → scale-DWM4RQco.d.mts} +2 -2
  37. package/dist/{scale-CUYFBo-8.d.ts → scale-DulPFco_.d.ts} +2 -2
  38. package/dist/score/index.d.mts +54 -6
  39. package/dist/score/index.d.ts +54 -6
  40. package/dist/score/index.js +5216 -1078
  41. package/dist/score/index.mjs +1743 -1011
  42. package/dist/{tempo-DwuZsv2T.d.ts → tempo-BnUjm25M.d.ts} +1 -1
  43. package/dist/{tempo-BlCGZuYg.d.mts → tempo-Cxu8vusu.d.mts} +1 -1
  44. package/dist/theory/index.d.mts +6 -6
  45. package/dist/theory/index.d.ts +6 -6
  46. package/dist/theory/index.js +2576 -136
  47. package/dist/theory/index.mjs +41 -49
  48. package/package.json +5 -5
  49. package/dist/chunk-U2ACCEHX.mjs +0 -9
@@ -1,6 +1,6 @@
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';
1
+ import { N as Note, A as Accidental } from './note-CJuq5aBy.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-BnUjm25M.js';
3
+ import { AnchoredRect, UniMap, Rect, Vec } from '@tspro/ts-utils-lib';
4
4
 
5
5
  /** Staff preset values for score configuration. */
6
6
  declare enum StaffPreset {
@@ -32,7 +32,13 @@ type BaseConfig = {
32
32
  voiceId?: VoiceId | VoiceId[];
33
33
  /** @deprecated - Use `voiceId` instead. */
34
34
  voiceIds?: VoiceId | VoiceId[];
35
- /** Staves/tabs with same instrument name a re grouped together with left brace. */
35
+ /**
36
+ * Instrument name for this staf/tab.<br />
37
+ * Consecutive staves/tabs with the same name are grouped together.<br />
38
+ * Hint!<br />
39
+ * `"!Piano"` hides name.<br />
40
+ * `"!{Piano"` hides both name and left brace of the group.
41
+ * */
36
42
  instrument?: string;
37
43
  };
38
44
  /** Staff config to add staff notation line in score configuration. */
@@ -362,14 +368,33 @@ declare class ObjText extends MusicObject {
362
368
  constructor(parent: MusicObject, text: TextProps, anchorX: number, anchorY: number);
363
369
  getMusicInterface(): MText;
364
370
  getText(): string;
365
- updateAnchorX(anchorX: number): void;
366
- updateAnchorY(anchorY: number): void;
367
371
  pick(x: number, y: number): MusicObject[];
368
372
  layout(ctx: RenderContext): void;
369
373
  offset(dx: number, dy: number): void;
370
374
  draw(ctx: RenderContext): void;
371
375
  }
372
376
 
377
+ declare class ObjScoreRowGroup extends MusicObject {
378
+ readonly lines: readonly ObjNotationLine[];
379
+ private space;
380
+ readonly instrument: string;
381
+ readonly hasBrace: boolean;
382
+ private readonly instrText;
383
+ private braceRect;
384
+ readonly mi: MScoreRowGroup;
385
+ constructor(lines: readonly ObjNotationLine[]);
386
+ getMusicInterface(): MScoreRowGroup;
387
+ get row(): ObjScoreRow;
388
+ get hasInstrument(): boolean;
389
+ hasNotationLine(line: ObjNotationLine): boolean;
390
+ pick(x: number, y: number): MusicObject[];
391
+ updateRect(): void;
392
+ layout(ctx: RenderContext): void;
393
+ layoutToNotationLines(): void;
394
+ offset(dx: number, dy: number): void;
395
+ draw(ctx: RenderContext): void;
396
+ }
397
+
373
398
  type NotationLineObject = {
374
399
  getRect: () => AnchoredRect;
375
400
  offset?: (dx: number, dy: number) => void;
@@ -382,6 +407,7 @@ declare abstract class ObjNotationLine extends MusicObject {
382
407
  abstract readonly name: string;
383
408
  private layoutGroups;
384
409
  constructor(row: ObjScoreRow);
410
+ getRowGroup(): ObjScoreRowGroup;
385
411
  addObject(o: NotationLineObject): void;
386
412
  removeObjects(): void;
387
413
  getLayoutGroup(lauoutGroupId: LayoutGroupId): LayoutGroup;
@@ -390,6 +416,7 @@ declare abstract class ObjNotationLine extends MusicObject {
390
416
  private setObjectY;
391
417
  private alignObjectsY;
392
418
  layoutLayoutGroup(ctx: RenderContext, layoutGroup: LayoutGroup, verticalPos: VerticalPos): void;
419
+ drawVerticalLine(ctx: RenderContext, left: number, width: number, isSystemBarLine?: boolean): void;
393
420
  abstract getConfig(): StaffConfig | TabConfig;
394
421
  abstract calcTop(): number;
395
422
  abstract calcBottom(): number;
@@ -403,7 +430,6 @@ declare abstract class ObjNotationLine extends MusicObject {
403
430
  abstract draw(ctx: RenderContext): void;
404
431
  }
405
432
  declare class ObjStaff extends ObjNotationLine {
406
- readonly row: ObjScoreRow;
407
433
  readonly staffConfig: StaffConfig;
408
434
  readonly id: number;
409
435
  readonly clefImageAsset: ImageAsset;
@@ -426,6 +452,8 @@ declare class ObjStaff extends ObjNotationLine {
426
452
  getMiddleLineY(): number;
427
453
  getBottomLineY(): number;
428
454
  joinGrandStaff(staff: ObjStaff): void;
455
+ isGrandTreble(): boolean;
456
+ isGrandBass(): boolean;
429
457
  getLineSpacing(): number;
430
458
  getDiatonicSpacing(): number;
431
459
  containsDiatonicId(diatonicId: number): boolean;
@@ -444,7 +472,6 @@ declare class ObjStaff extends ObjNotationLine {
444
472
  draw(ctx: RenderContext): void;
445
473
  }
446
474
  declare class ObjTab extends ObjNotationLine {
447
- readonly row: ObjScoreRow;
448
475
  readonly tabConfig: TabConfig;
449
476
  readonly id: number;
450
477
  private top;
@@ -583,7 +610,7 @@ declare class ObjNoteGroup extends MusicObject {
583
610
  setStemTipY(staff: ObjStaff, stemTipY: number): void;
584
611
  offset(dx: number, dy: number): void;
585
612
  draw(ctx: RenderContext): void;
586
- getDotVerticalDisplacement(staff: ObjStaff, diatonicId: number, stemDir: Stem): 0 | 1 | -1;
613
+ getDotVerticalDisplacement(staff: ObjStaff, diatonicId: number, stemDir: Stem): 1 | 0 | -1;
587
614
  static hasSameNotes(ng1: ObjNoteGroup, ng2: ObjNoteGroup): boolean;
588
615
  }
589
616
 
@@ -639,7 +666,7 @@ declare class ObjBeamGroup extends MusicObject {
639
666
  getSymbols(): ReadonlyArray<RhythmSymbol>;
640
667
  getFirstSymbol(): RhythmSymbol | undefined;
641
668
  getLastSymbol(): RhythmSymbol | undefined;
642
- get color(): string;
669
+ private get color();
643
670
  layout(ctx: RenderContext): void;
644
671
  updateRect(): void;
645
672
  updateStemTips(): void;
@@ -814,10 +841,11 @@ declare enum BarLineType {
814
841
  EndRepeat = 5,
815
842
  EndStartRepeat = 6
816
843
  }
817
- declare class ObjStaffTabBarLine extends MusicObject {
844
+ declare class ObjStaffBarLine extends MusicObject {
818
845
  readonly barLine: ObjBarLine;
819
846
  readonly line: ObjNotationLine;
820
- verticalLines: {
847
+ readonly rowGroup: ObjScoreRowGroup;
848
+ vlines: {
821
849
  left: number;
822
850
  width: number;
823
851
  }[];
@@ -826,20 +854,22 @@ declare class ObjStaffTabBarLine extends MusicObject {
826
854
  y: number;
827
855
  r: number;
828
856
  }[];
829
- readonly mi: MStaffTabBarLine;
830
- constructor(barLine: ObjBarLine, line: ObjNotationLine);
857
+ readonly mi: MStaffBarLine;
858
+ constructor(barLine: ObjBarLine, line: ObjNotationLine, rowGroup: ObjScoreRowGroup);
831
859
  getMusicInterface(): MusicInterface;
832
860
  pick(x: number, y: number): MusicObject[];
833
- setRect(r: AnchoredRect): void;
861
+ updateRect(): void;
834
862
  offset(dx: number, dy: number): void;
835
863
  }
836
864
  declare abstract class ObjBarLine extends MusicObject {
837
865
  readonly measure: ObjMeasure;
838
- protected staffTabObjects: ObjStaffTabBarLine[];
839
- protected staffTabObjectGroups: ObjStaffTabBarLine[][];
866
+ protected notationLineObjects: ObjStaffBarLine[];
867
+ protected notationLineObjectsByGrp: UniMap<ObjScoreRowGroup, ObjStaffBarLine[]>;
840
868
  protected barLineType: BarLineType;
841
869
  constructor(measure: ObjMeasure);
842
870
  abstract solveBarLineType(): BarLineType;
871
+ get doc(): ObjDocument;
872
+ get row(): ObjScoreRow;
843
873
  pick(x: number, y: number): MusicObject[];
844
874
  layout(ctx: RenderContext): void;
845
875
  updateRect(): void;
@@ -883,6 +913,7 @@ declare class ObjConnective extends MusicObject {
883
913
  constructor(connectiveProps: ConnectiveProps, line: ObjNotationLine, measure: ObjMeasure, leftNoteGroup: ObjNoteGroup, leftNoteId: number, rightNoteGroup: ObjNoteGroup, rightNoteId: number);
884
914
  constructor(connectiveProps: ConnectiveProps, line: ObjNotationLine, measure: ObjMeasure, leftNoteGroup: ObjNoteGroup, leftNoteId: number, tie: TieType);
885
915
  getMusicInterface(): MConnective;
916
+ get doc(): ObjDocument;
886
917
  isInsideMeasure(): boolean;
887
918
  pick(x: number, y: number): MusicObject[];
888
919
  layout(ctx: RenderContext): void;
@@ -890,6 +921,73 @@ declare class ObjConnective extends MusicObject {
890
921
  draw(ctx: RenderContext): void;
891
922
  }
892
923
 
924
+ declare class ObjSpecialText extends MusicObject {
925
+ readonly text: string;
926
+ readonly color: string;
927
+ static toCoda: string;
928
+ static Coda: string;
929
+ static Segno: string;
930
+ private components;
931
+ readonly mi: MSpecialText;
932
+ constructor(parent: MusicObject, text: string, color?: string);
933
+ getMusicInterface(): MSpecialText;
934
+ getText(): string;
935
+ pick(x: number, y: number): MusicObject[];
936
+ layout(ctx: RenderContext): void;
937
+ offset(dx: number, dy: number): void;
938
+ draw(ctx: RenderContext): void;
939
+ }
940
+
941
+ type ExtensionStartObject = ObjText | ObjSpecialText;
942
+ type ExtensionLineLeftObject = ObjBarLineLeft | MusicObject;
943
+ type ExtensionLineRightObject = ObjRhythmColumn | ObjBarLineRight;
944
+ type ExtensionStopObject = ObjBarLineRight | ObjText | ObjSpecialText;
945
+ type ExtensionObjectAll = ExtensionStartObject | ExtensionLineLeftObject | ExtensionLineRightObject | ExtensionStopObject;
946
+ declare class ObjExtensionLine extends MusicObject {
947
+ readonly measure: ObjMeasure;
948
+ readonly line: ObjNotationLine;
949
+ readonly extension: Extension;
950
+ readonly cols: ExtensionObjectAll[];
951
+ readonly mi: MExtensionLine;
952
+ constructor(measure: ObjMeasure, line: ObjNotationLine, extension: Extension, cols: ExtensionObjectAll[]);
953
+ get row(): ObjScoreRow;
954
+ getMusicInterface(): MExtensionLine;
955
+ private getLineLeft;
956
+ private getLineRight;
957
+ layoutFitToMeasure(ctx: RenderContext): void;
958
+ pick(x: number, y: number): MusicObject[];
959
+ layout(ctx: RenderContext): void;
960
+ offset(dx: number, dy: number): void;
961
+ draw(ctx: RenderContext): void;
962
+ }
963
+
964
+ type ExtensionLineStyle = "solid" | "dashed";
965
+ type ExtensionLinePos = "bottom" | "middle";
966
+ declare class ExtensionRange {
967
+ readonly startColumn: ObjRhythmColumn;
968
+ readonly columnRange: ObjRhythmColumn[];
969
+ stopObject?: ExtensionStopObject;
970
+ constructor(startColumn: ObjRhythmColumn);
971
+ get endColumn(): ObjRhythmColumn;
972
+ addColumn(col: ObjRhythmColumn): void;
973
+ setStopObject(obj: ExtensionStopObject): void;
974
+ }
975
+ declare class Extension extends MusicObjectLink {
976
+ readonly headObj: LayoutObjectWrapper;
977
+ private readonly length;
978
+ private readonly visible;
979
+ private readonly lineStyle;
980
+ private readonly linePos;
981
+ private readonly startColumn;
982
+ constructor(headObj: LayoutObjectWrapper, startColumn: ObjRhythmColumn, length: number, visible: boolean, lineStyle: ExtensionLineStyle, linePos: ExtensionLinePos);
983
+ isVisible(): boolean;
984
+ getLineStyle(): ExtensionLineStyle;
985
+ getLinePos(): ExtensionLinePos;
986
+ private static StopNavigations;
987
+ private whatStopped;
988
+ getRange(): ExtensionRange;
989
+ }
990
+
893
991
  declare class ObjMeasure extends MusicObject {
894
992
  readonly row: ObjScoreRow;
895
993
  private readonly options;
@@ -914,7 +1012,7 @@ declare class ObjMeasure extends MusicObject {
914
1012
  private voiceSymbols;
915
1013
  private lastAddedRhythmColumn?;
916
1014
  private lastAddedRhythmSymbol?;
917
- private addExtensionToMusicObjects;
1015
+ private addExtensionTo;
918
1016
  private layoutObjects;
919
1017
  private postMeasureBreakWidth;
920
1018
  private passCount;
@@ -947,6 +1045,8 @@ declare class ObjMeasure extends MusicObject {
947
1045
  getColumn(columnId: number): ObjRhythmColumn | undefined;
948
1046
  isFirstMeasure(): boolean;
949
1047
  isLastMeasure(): boolean;
1048
+ isFirstMeasureInRow(): boolean;
1049
+ isLastMeasureInRow(): boolean;
950
1050
  getNextMeasure(): ObjMeasure | undefined;
951
1051
  getPrevMeasure(): ObjMeasure | undefined;
952
1052
  getKeySignature(): KeySignature;
@@ -1029,26 +1129,41 @@ declare class ObjMeasure extends MusicObject {
1029
1129
  draw(ctx: RenderContext): void;
1030
1130
  }
1031
1131
 
1132
+ declare class ScoreRowRegions {
1133
+ instrWidth: number;
1134
+ staffWidth: number;
1135
+ resetWidths(): void;
1136
+ addRowInstrWidth(w: number): void;
1137
+ addRowstaffWidth(w: number): void;
1138
+ get instrLeft(): number;
1139
+ get instrRight(): number;
1140
+ get staffLeft(): number;
1141
+ get staffRight(): number;
1142
+ get left(): number;
1143
+ get right(): number;
1144
+ get width(): number;
1145
+ }
1032
1146
  declare class ObjScoreRow extends MusicObject {
1033
1147
  readonly doc: ObjDocument;
1034
1148
  private readonly prevRow;
1035
1149
  private readonly scoreConfig;
1036
1150
  private nextRow?;
1037
- private minWidth;
1038
1151
  private readonly notationLines;
1039
- private readonly instrumentLineGroups;
1152
+ private readonly rowGroups;
1040
1153
  private readonly staves;
1041
1154
  private readonly tabs;
1042
- private readonly instrumentNames;
1043
1155
  private readonly measures;
1156
+ private rowGroupByLine;
1044
1157
  private needLayout;
1045
1158
  readonly mi: MScoreRow;
1046
1159
  constructor(doc: ObjDocument, prevRow: ObjScoreRow | undefined, scoreConfig: (StaffConfig | TabConfig)[]);
1047
1160
  getMusicInterface(): MScoreRow;
1048
1161
  private createNotationLines;
1049
1162
  getNotationLines(): ReadonlyArray<ObjNotationLine>;
1050
- getInstrumentLineGroups(): ReadonlyArray<ReadonlyArray<ObjNotationLine>>;
1163
+ getRowGroups(): ReadonlyArray<ObjScoreRowGroup>;
1164
+ getRowGroupByLineId(id: number): ObjScoreRowGroup;
1051
1165
  findMatchingLine(line: ObjNotationLine): ObjNotationLine | undefined;
1166
+ get regions(): ScoreRowRegions;
1052
1167
  getStaves(): ReadonlyArray<ObjStaff>;
1053
1168
  getTabs(): ReadonlyArray<ObjTab>;
1054
1169
  get hasStaff(): boolean;
@@ -1069,33 +1184,23 @@ declare class ObjScoreRow extends MusicObject {
1069
1184
  getNextRow(): ObjScoreRow | undefined;
1070
1185
  getFirstMeasure(): ObjMeasure | undefined;
1071
1186
  getLastMeasure(): ObjMeasure | undefined;
1072
- getMinWidth(): number;
1073
1187
  solveAutoStemDir(symbols: ReadonlyArray<RhythmSymbol>): Stem.Up | Stem.Down;
1074
- getInstrumentNameWidth(ctx: RenderContext): number;
1075
1188
  requestLayout(): void;
1076
1189
  layout(ctx: RenderContext): void;
1077
- layoutWidth(ctx: RenderContext, left: number, right: number): void;
1190
+ layoutStretch(ctx: RenderContext): void;
1078
1191
  updateRect(): void;
1079
1192
  alignStemsToBeams(): void;
1080
1193
  layoutSetNotationLines(ctx: RenderContext): void;
1081
- layoutPadding(ctx: RenderContext): void;
1082
1194
  layoutDone(): void;
1083
1195
  offset(dx: number, dy: number): void;
1196
+ getStaffLineLeft(): number | undefined;
1084
1197
  draw(ctx: RenderContext): void;
1085
1198
  }
1086
1199
 
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
- }
1096
1200
  declare class ObjDocument extends MusicObject {
1097
1201
  private needLayout;
1098
1202
  private ctx?;
1203
+ readonly regions: ScoreRowRegions;
1099
1204
  private readonly rows;
1100
1205
  private readonly measures;
1101
1206
  private measuresPerRow;
@@ -1104,7 +1209,6 @@ declare class ObjDocument extends MusicObject {
1104
1209
  private newRowRequested;
1105
1210
  private allConnectiveProps;
1106
1211
  private staffGroups;
1107
- private instrumentGroupRegions;
1108
1212
  private readonly mi;
1109
1213
  constructor();
1110
1214
  getMusicInterface(): MDocument;
@@ -1133,10 +1237,10 @@ declare class ObjDocument extends MusicObject {
1133
1237
  private forEachMeasure;
1134
1238
  resetMeasures(): void;
1135
1239
  updateCursorRect(cursorRect?: Rect): void;
1136
- getInstrumentGroupRegions(ctx: RenderContext): InstrumentGroupRegions;
1137
1240
  requestLayout(): void;
1138
1241
  requestFullLayout(): void;
1139
1242
  layout(): void;
1243
+ offset(dx: number, dy: number): void;
1140
1244
  drawContent(): void;
1141
1245
  pickStaffPosAt(x: number, y: number): {
1142
1246
  scoreRow: ObjScoreRow;
@@ -1173,8 +1277,9 @@ declare class RenderContext {
1173
1277
  constructor(mi: MRenderContext);
1174
1278
  getMusicInterface(): MRenderContext;
1175
1279
  get doc(): ObjDocument | undefined;
1176
- private finishImageAsset;
1177
- getImageAsset(imageAsset: ImageAsset): HTMLImageElement | undefined;
1280
+ getImageAsset(asset: ImageAsset, color?: string): HTMLImageElement | undefined;
1281
+ private forceDraw;
1282
+ private onImageLoaded;
1178
1283
  setDocument(mdoc?: MDocument): void;
1179
1284
  setCanvas(canvas: HTMLCanvasElement): void;
1180
1285
  setScoreEventListener(fn: ScoreEventListener): void;
@@ -1186,7 +1291,6 @@ declare class RenderContext {
1186
1291
  onMouseMove(e: MouseEvent): void;
1187
1292
  onMouseLeave(e: MouseEvent): void;
1188
1293
  onTouchEnd(e: TouchEvent): void;
1189
- onLoad(): void;
1190
1294
  hilightObject(obj?: MusicObject): void;
1191
1295
  hilightStaffPos(staffPos?: {
1192
1296
  scoreRow: ObjScoreRow;
@@ -1230,20 +1334,23 @@ declare class RenderContext {
1230
1334
  strokeRect(x: number, y: number, w: number, h: number): RenderContext;
1231
1335
  fillText(text: string, x: number, y: number): RenderContext;
1232
1336
  getTextWidth(text: string, font: string): number;
1233
- arc(x: number, y: number, radius: number, startRadians: number, endRadians: number): void;
1234
- fillCircle(x: number, y: number, radius: number): void;
1235
- strokeLine(startX: number, startY: number, endX: number, endY: number): void;
1236
- strokePartialLine(startX: number, startY: number, endX: number, endY: number, startT: number, endT: number): void;
1237
- drawBrace(rect: AnchoredRect, side: "left" | "right"): void;
1337
+ arc(x: number, y: number, radius: number, startRadians: number, endRadians: number): RenderContext;
1338
+ fillCircle(x: number, y: number, radius: number): RenderContext;
1339
+ strokeLine(startX: number, startY: number, endX: number, endY: number): RenderContext;
1340
+ strokePartialLine(startX: number, startY: number, endX: number, endY: number, startT: number, endT: number): RenderContext;
1341
+ /** @deprecated - Use {@link drawBracket} instead. */
1342
+ drawBrace(rect: AnchoredRect, side: "left" | "right"): RenderContext;
1343
+ drawBracket(rect: AnchoredRect, bracket: "(" | ")" | "[" | "]" | "{" | "}" | "<" | ">"): RenderContext;
1238
1344
  }
1239
1345
 
1240
1346
  declare class ObjEnding extends MusicObject {
1241
1347
  readonly measure: ObjMeasure;
1348
+ readonly color: string;
1242
1349
  readonly passages: number[];
1243
1350
  private endingText;
1244
1351
  private shapeRects;
1245
1352
  readonly mi: MEnding;
1246
- constructor(measure: ObjMeasure, passages: number[]);
1353
+ constructor(measure: ObjMeasure, color: string, passages: number[]);
1247
1354
  getMusicInterface(): MEnding;
1248
1355
  getShapeRects(): AnchoredRect[];
1249
1356
  isSingleMeasureEnding(): boolean;
@@ -1258,9 +1365,9 @@ declare class ObjEnding extends MusicObject {
1258
1365
 
1259
1366
  declare class ObjFermata extends MusicObject {
1260
1367
  readonly pos: VerticalPos;
1261
- private color;
1368
+ readonly color: string;
1262
1369
  readonly mi: MFermata;
1263
- constructor(parent: ObjRhythmColumn | ObjBarLineRight, pos: VerticalPos);
1370
+ constructor(parent: ObjRhythmColumn | ObjBarLineRight, pos: VerticalPos, color: string);
1264
1371
  getMusicInterface(): MFermata;
1265
1372
  static getFermataPositions(anchor: ObjRhythmColumn | ObjBarLineRight): VerticalPos[];
1266
1373
  pick(x: number, y: number): MusicObject[];
@@ -1269,66 +1376,6 @@ declare class ObjFermata extends MusicObject {
1269
1376
  draw(ctx: RenderContext): void;
1270
1377
  }
1271
1378
 
1272
- declare class ObjSpecialText extends MusicObject {
1273
- readonly text: string;
1274
- static toCoda: string;
1275
- static Coda: string;
1276
- static Segno: string;
1277
- private components;
1278
- readonly mi: MSpecialText;
1279
- constructor(parent: MusicObject, text: string);
1280
- getMusicInterface(): MSpecialText;
1281
- getText(): string;
1282
- pick(x: number, y: number): MusicObject[];
1283
- layout(ctx: RenderContext): void;
1284
- offset(dx: number, dy: number): void;
1285
- draw(ctx: RenderContext): void;
1286
- }
1287
-
1288
- type ExtensionLineStyle = "solid" | "dashed";
1289
- type ExtensionLinePos = "bottom" | "middle";
1290
- type ExtensionRangeInfo = {
1291
- startColumn: ObjRhythmColumn;
1292
- endColumn: ObjRhythmColumn;
1293
- columnRange: ObjRhythmColumn[];
1294
- extensionBreakText?: string;
1295
- };
1296
- declare class Extension extends MusicObjectLink {
1297
- private readonly length;
1298
- private readonly visible;
1299
- private readonly lineStyle;
1300
- private readonly linePos;
1301
- private readonly startColumn;
1302
- private readonly context;
1303
- constructor(head: MusicObject, startColumn: ObjRhythmColumn, length: number, visible: boolean, lineStyle: ExtensionLineStyle, linePos: ExtensionLinePos);
1304
- isVisible(): boolean;
1305
- getLineStyle(): ExtensionLineStyle;
1306
- getLinePos(): ExtensionLinePos;
1307
- private getSpanBreakText;
1308
- getExtensionRangeInfo(): ExtensionRangeInfo;
1309
- }
1310
-
1311
- type ExtensionLineLeftObj = ObjBarLineLeft | MusicObject;
1312
- type ExtensionLineRightObj = ObjRhythmColumn | ObjBarLineRight;
1313
- declare class ObjExtensionLine extends MusicObject {
1314
- readonly measure: ObjMeasure;
1315
- readonly line: ObjNotationLine;
1316
- readonly extension: Extension;
1317
- readonly leftObj: ExtensionLineLeftObj;
1318
- readonly rightObj: ExtensionLineRightObj;
1319
- readonly mi: MExtensionLine;
1320
- constructor(measure: ObjMeasure, line: ObjNotationLine, extension: Extension, leftObj: ExtensionLineLeftObj, rightObj: ExtensionLineRightObj);
1321
- get row(): ObjScoreRow;
1322
- getMusicInterface(): MExtensionLine;
1323
- private getLineLeft;
1324
- private getLineRight;
1325
- layoutFitToMeasure(ctx: RenderContext): void;
1326
- pick(x: number, y: number): MusicObject[];
1327
- layout(ctx: RenderContext): void;
1328
- offset(dx: number, dy: number): void;
1329
- draw(ctx: RenderContext): void;
1330
- }
1331
-
1332
1379
  declare class ObjTabRhythm extends MusicObject {
1333
1380
  readonly measure: ObjMeasure;
1334
1381
  readonly tab: ObjTab;
@@ -1336,6 +1383,7 @@ declare class ObjTabRhythm extends MusicObject {
1336
1383
  readonly mi: MTabRhythm;
1337
1384
  constructor(measure: ObjMeasure, tab: ObjTab);
1338
1385
  getMusicInterface(): MTabRhythm;
1386
+ get doc(): ObjDocument;
1339
1387
  pick(x: number, y: number): MusicObject[];
1340
1388
  layout(ctx: RenderContext): void;
1341
1389
  private hasTuplets;
@@ -1384,9 +1432,9 @@ declare class LayoutObjectWrapper {
1384
1432
  setPositionResolved(): void;
1385
1433
  isPositionResolved(): boolean;
1386
1434
  resolveClosestToStaffY(ctx: RenderContext): number;
1387
- getTextContent(): string | undefined;
1388
1435
  layout(ctx: RenderContext): void;
1389
1436
  offset(dx: number, dy: number): void;
1437
+ setAnchorY(y: number): void;
1390
1438
  getRect(): AnchoredRect;
1391
1439
  }
1392
1440
  declare class LayoutGroup {
@@ -1416,6 +1464,7 @@ declare abstract class MusicObject {
1416
1464
  protected readonly parent: MusicObject | undefined;
1417
1465
  private anchoredLayoutObjects;
1418
1466
  private link?;
1467
+ readonly userData: Record<string, unknown>;
1419
1468
  constructor(parent: MusicObject | undefined);
1420
1469
  abstract getMusicInterface(): MusicInterface;
1421
1470
  getParent(): MusicObject | undefined;
@@ -1423,7 +1472,21 @@ declare abstract class MusicObject {
1423
1472
  private needRectUpdate;
1424
1473
  requestRectUpdate(): void;
1425
1474
  updateRect(): void;
1475
+ forceRectUpdate(): void;
1426
1476
  getRect(): AnchoredRect;
1477
+ abstract offset(dx: number, dy: number): void;
1478
+ offsetX(dx: number): void;
1479
+ offsetY(dy: number): void;
1480
+ setLeft(x: number): void;
1481
+ setRight(x: number): void;
1482
+ setTop(y: number): void;
1483
+ setBottom(y: number): void;
1484
+ setAnchor(x: number, y: number): void;
1485
+ setAnchorX(x: number): void;
1486
+ setAnchorY(y: number): void;
1487
+ setCenter(x: number, y: number): void;
1488
+ setCenterX(x: number): void;
1489
+ setCenterY(y: number): void;
1427
1490
  /**
1428
1491
  * Most objects are simple rects in shape.
1429
1492
  * Some objects might be more complex consisting of multiple rects.
@@ -1466,6 +1529,7 @@ declare class ObjArpeggio extends MusicObject {
1466
1529
  }
1467
1530
 
1468
1531
  declare class ObjHeader extends MusicObject {
1532
+ readonly doc: ObjDocument;
1469
1533
  readonly title?: string | undefined;
1470
1534
  readonly composer?: string | undefined;
1471
1535
  readonly arranger?: string | undefined;
@@ -1476,7 +1540,7 @@ declare class ObjHeader extends MusicObject {
1476
1540
  constructor(doc: ObjDocument, title?: string | undefined, composer?: string | undefined, arranger?: string | undefined);
1477
1541
  getMusicInterface(): MHeader;
1478
1542
  pick(x: number, y: number): MusicObject[];
1479
- layoutWidth(ctx: RenderContext, left: number, right: number): void;
1543
+ layout(ctx: RenderContext): void;
1480
1544
  offset(dx: number, dy: number): void;
1481
1545
  draw(ctx: RenderContext): void;
1482
1546
  }
@@ -1508,6 +1572,7 @@ declare class ObjStaffSignature extends MusicObject {
1508
1572
  private tempoText?;
1509
1573
  readonly mi: MStaffSignature;
1510
1574
  constructor(measure: ObjMeasure, staff: ObjStaff);
1575
+ get doc(): ObjDocument;
1511
1576
  getMusicInterface(): MStaffSignature;
1512
1577
  updateClefImage(ctx: RenderContext, showClef: boolean): void;
1513
1578
  updateMeasureNumber(showMeasureNumber: boolean): void;
@@ -1530,6 +1595,7 @@ declare class ObjTabSignature extends MusicObject {
1530
1595
  readonly mi: MTabSignature;
1531
1596
  constructor(measure: ObjMeasure, tab: ObjTab);
1532
1597
  getMusicInterface(): MTabSignature;
1598
+ get doc(): ObjDocument;
1533
1599
  updateMeasureNumber(showMeasureNumber: boolean): void;
1534
1600
  updateTimeSignature(showTimeSignature: boolean): void;
1535
1601
  updateTempo(showTempo: boolean): void;
@@ -1976,14 +2042,14 @@ declare class MBarLineLeft extends MusicInterface {
1976
2042
  getMusicObject(): ObjBarLineLeft;
1977
2043
  }
1978
2044
  /** Bar line object for certain staff or tab. */
1979
- declare class MStaffTabBarLine extends MusicInterface {
2045
+ declare class MStaffBarLine extends MusicInterface {
1980
2046
  private readonly obj;
1981
2047
  /** Object name. */
1982
- static readonly Name = "StaffTabBarLine";
2048
+ static readonly Name = "StaffBarLine";
1983
2049
  /** @internal */
1984
- constructor(obj: ObjStaffTabBarLine);
2050
+ constructor(obj: ObjStaffBarLine);
1985
2051
  /** @internal */
1986
- getMusicObject(): ObjStaffTabBarLine;
2052
+ getMusicObject(): ObjStaffBarLine;
1987
2053
  /**
1988
2054
  * Get parent bar line object.
1989
2055
  * @returns - Parent bar line object.
@@ -2193,6 +2259,21 @@ declare class MScoreRow extends MusicInterface {
2193
2259
  */
2194
2260
  getNotationLines(): ReadonlyArray<MStaff | MTab>;
2195
2261
  }
2262
+ /** Score row group object. */
2263
+ declare class MScoreRowGroup extends MusicInterface {
2264
+ private readonly obj;
2265
+ /** Object name. */
2266
+ static readonly Name = "ScoreRowGroup";
2267
+ /** @internal */
2268
+ constructor(obj: ObjScoreRowGroup);
2269
+ /** @internal */
2270
+ getMusicObject(): ObjScoreRowGroup;
2271
+ /**
2272
+ * Get instrument name.
2273
+ * @returns - instrument name.
2274
+ */
2275
+ getInstrument(): string;
2276
+ }
2196
2277
  /** Staff notatio line object. */
2197
2278
  declare class MStaff extends MusicInterface {
2198
2279
  private readonly obj;
@@ -2349,4 +2430,4 @@ declare class MExtensionLine extends MusicInterface {
2349
2430
  getMusicObject(): ObjExtensionLine;
2350
2431
  }
2351
2432
 
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 };
2433
+ export { MStaffSignature 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, MStaffBarLine 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, MScoreRowGroup 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, isVoiceId as ab, validateVoiceId as ac, type StringNumber as ad, getStringNumbers as ae, isStringNumber as af, validateStringNumber as ag, getVerseNumbers as ah, isVerseNumber as ai, validateVerseNumber as aj, Stem as ak, Arpeggio as al, type StaffTabOrGroup as am, LyricsAlign as an, LyricsHyphen as ao, DynamicsAnnotation as ap, TempoAnnotation as aq, PlayState as ar, type PlayStateChangeListener as as, 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 };
@@ -300,7 +300,7 @@ declare class Note {
300
300
  * @param b - Note b.
301
301
  * @returns - -1, 0 or 1.
302
302
  */
303
- static compareFunc(a: Note, b: Note): 1 | 0 | -1;
303
+ static compareFunc(a: Note, b: Note): 1 | -1 | 0;
304
304
  }
305
305
 
306
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 };
@@ -300,7 +300,7 @@ declare class Note {
300
300
  * @param b - Note b.
301
301
  * @returns - -1, 0 or 1.
302
302
  */
303
- static compareFunc(a: Note, b: Note): 1 | 0 | -1;
303
+ static compareFunc(a: Note, b: Note): 1 | -1 | 0;
304
304
  }
305
305
 
306
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,8 +1,15 @@
1
- import { M as MDocument } from '../music-objects-DYMqx839.mjs';
2
- import '../note-RVXvpfyV.mjs';
3
- import '../tempo-BlCGZuYg.mjs';
1
+ import { M as MDocument } from '../music-objects-CcJvZxS6.mjs';
2
+ import '../note-CJuq5aBy.mjs';
3
+ import '../tempo-Cxu8vusu.mjs';
4
4
  import '@tspro/ts-utils-lib';
5
5
 
6
+ /**
7
+ * Create Andante by A. Diabelli music piece.
8
+ *
9
+ * @returns - Music document.
10
+ */
11
+ declare function createAndanteByDiabelli(): MDocument;
12
+
6
13
  /**
7
14
  * Create Canon in D by Pachelbel music piece.<br />
8
15
  * <br />
@@ -31,10 +38,9 @@ declare function createFrereJacques(): MDocument;
31
38
  declare function createGreensleeves(): MDocument;
32
39
 
33
40
  /**
34
- * Create Andante by A. Diabelli music piece.
35
- *
36
- * @returns - Music document.
41
+ * Create all music pieces.
42
+ * @returns - Array of music documents containing all available pieces.
37
43
  */
38
- declare function createAndanteByDiabelli(): MDocument;
44
+ declare function createAll(): readonly MDocument[];
39
45
 
40
- export { createAndanteByDiabelli, createCanonInD, createFrereJacques, createGreensleeves };
46
+ export { createAll, createAndanteByDiabelli, createCanonInD, createFrereJacques, createGreensleeves };