@tspro/web-music-score 5.0.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +16 -13
  3. package/dist/audio/index.d.mts +15 -2
  4. package/dist/audio/index.d.ts +16 -3
  5. package/dist/audio/index.js +37 -78
  6. package/dist/audio/index.mjs +34 -68
  7. package/dist/audio-cg/index.d.mts +6 -1
  8. package/dist/audio-cg/index.d.ts +6 -1
  9. package/dist/audio-cg/index.js +1 -1
  10. package/dist/audio-cg/index.mjs +3 -3
  11. package/dist/audio-synth/index.d.mts +15 -0
  12. package/dist/audio-synth/index.d.ts +15 -0
  13. package/dist/audio-synth/index.js +95 -0
  14. package/dist/audio-synth/index.mjs +58 -0
  15. package/dist/{chunk-AAL3CMRO.mjs → chunk-6S5BDSCM.mjs} +2 -2
  16. package/dist/{chunk-J3KU3U4W.mjs → chunk-LC5JMIVF.mjs} +2 -2
  17. package/dist/{chunk-EYFT3RWB.mjs → chunk-XUGM7SCC.mjs} +5 -6
  18. package/dist/core/index.js +2 -2
  19. package/dist/core/index.mjs +3 -3
  20. package/dist/{guitar-CaZJDA05.d.ts → guitar-BsSayRsH.d.ts} +1 -1
  21. package/dist/iife/audio-cg.global.js +9 -2
  22. package/dist/iife/index.global.js +11 -11
  23. package/dist/{music-objects-3Hxlkxy6.d.mts → music-objects-CB05XryE.d.mts} +121 -45
  24. package/dist/{music-objects-CI7IjsjE.d.ts → music-objects-CwPOlqFi.d.ts} +123 -47
  25. package/dist/{note-eA2xPPiG.d.ts → note-CgCIBwvR.d.ts} +1 -1
  26. package/dist/pieces/index.d.mts +1 -1
  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 +34 -15
  31. package/dist/react-ui/index.d.ts +38 -19
  32. package/dist/react-ui/index.js +41 -32
  33. package/dist/react-ui/index.mjs +42 -33
  34. package/dist/{scale-DGx3tJH4.d.ts → scale-CBW4eTz7.d.ts} +2 -2
  35. package/dist/score/index.d.mts +2 -2
  36. package/dist/score/index.d.ts +5 -5
  37. package/dist/score/index.js +1951 -1514
  38. package/dist/score/index.mjs +1664 -1226
  39. package/dist/{tempo-GrstpD9G.d.ts → tempo-DMt3iwz9.d.ts} +1 -1
  40. package/dist/theory/index.d.ts +6 -6
  41. package/dist/theory/index.js +3 -4
  42. package/dist/theory/index.mjs +3 -3
  43. package/package.json +12 -2
@@ -225,34 +225,39 @@ declare enum Clef {
225
225
  /** F-clef (bass cleff) */
226
226
  F = "F"
227
227
  }
228
+ /** Base config for staff and tab configs. */
229
+ type BaseConfig = {
230
+ /** Name for this staff/tab config. */
231
+ name?: string;
232
+ /** Voice ids that are presented in this staff/tab. */
233
+ voiceIds?: number[];
234
+ };
228
235
  /** Staff config to add staff notation line in score configuration. */
229
- type StaffConfig = {
236
+ type StaffConfig = BaseConfig & {
230
237
  /** Config type, must be "staff" for staff config. */
231
238
  type: "staff";
232
239
  /** G-clef or F-clef for this staff config? */
233
240
  clef: Clef | `${Clef}`;
234
- /** Set name for this staff config. */
235
- name?: string;
236
241
  /** Set octave down with G-clef for guitar treble staff notation line. */
237
242
  isOctaveDown?: boolean;
238
243
  /** Lowest note (e.g. "C2")that can be presented in this staff notation line. */
239
244
  minNote?: string;
240
245
  /** Highest note (e.g. "C6") that can be presented in this staff notation line. */
241
246
  maxNote?: string;
242
- /** Voice ids that are presented in this staff notation line. */
243
- voiceIds?: number[];
244
- /** Set true for two staff configs with G-clef and F-clef to create grand staff. */
247
+ /**
248
+ * To create grand staff: use same `grandId` value (e.g. "grand1") for two
249
+ * consequtive staves, first having G-clef and second having F-clef.
250
+ */
251
+ grandId?: string;
252
+ /** @deprecated - Use `grandId` property instead. */
245
253
  isGrand?: boolean;
246
254
  };
247
255
  /** Tab config to add guitar tab in score configuration. */
248
- type TabConfig = {
256
+ type TabConfig = BaseConfig & {
249
257
  /** Config type, must be "tab" for tab config. */
250
258
  type: "tab";
251
- /** Set name for this tab config. */
252
- name?: string;
259
+ /** Tuning name or array six notes (tune for each string). */
253
260
  tuning?: string | string[];
254
- /** Voice ids that are presented in this guitar tab notation line. */
255
- voiceIds?: number[];
256
261
  };
257
262
  /** Score configuration. */
258
263
  type ScoreConfiguration = StaffConfig | TabConfig | (StaffConfig | TabConfig)[];
@@ -613,7 +618,6 @@ declare class ObjStaff extends ObjNotationLine {
613
618
  isLine(diatonicId: number): boolean;
614
619
  isSpace(diatonicId: number): boolean;
615
620
  containsVoiceId(voiceId: number): boolean;
616
- isGrand(): boolean;
617
621
  calcTop(): number;
618
622
  calcBottom(): number;
619
623
  pick(x: number, y: number): MusicObject[];
@@ -743,6 +747,9 @@ declare class ObjNoteGroup extends MusicObject {
743
747
  hasBeamCount(): boolean;
744
748
  getLeftBeamCount(): number;
745
749
  getRightBeamCount(): number;
750
+ setLeftBeamCount(count: number): void;
751
+ setRightBeamCount(count: number): void;
752
+ hasTuplet(): boolean;
746
753
  isEmpty(): boolean;
747
754
  visibleInStaff(staff: ObjStaff): boolean;
748
755
  getPlayTicks(note: Note): number;
@@ -752,8 +759,6 @@ declare class ObjNoteGroup extends MusicObject {
752
759
  setStemTipY(staff: ObjStaff, stemTipY: number): void;
753
760
  offset(dx: number, dy: number): void;
754
761
  draw(renderer: Renderer): void;
755
- static setBeamCounts(groupNotes: (ObjNoteGroup | undefined)[]): void;
756
- static setTupletBeamCounts(tuplet: ObjBeamGroup): void;
757
762
  getDotVerticalDisplacement(staff: ObjStaff, diatonicId: number, stemDir: Stem): 1 | 0 | -1;
758
763
  static hasSameNotes(ng1: ObjNoteGroup, ng2: ObjNoteGroup): boolean;
759
764
  }
@@ -796,7 +801,7 @@ declare class ObjBeamGroup extends MusicObject {
796
801
  private readonly staffObjects;
797
802
  private constructor();
798
803
  private get showTupletRatio();
799
- static createBeam(noteGroups: ObjNoteGroup[]): void;
804
+ static createBeam(noteGroups: ObjNoteGroup[]): boolean;
800
805
  static createOldStyleTriplet(symbols: RhythmSymbol[]): number;
801
806
  static createTuplet(symbols: RhythmSymbol[], tupletRatio: TupletRatio & TupletOptions): void;
802
807
  getMusicInterface(): MBeamGroup;
@@ -805,15 +810,19 @@ declare class ObjBeamGroup extends MusicObject {
805
810
  pick(x: number, y: number): MusicObject[];
806
811
  getType(): BeamGroupType;
807
812
  isTuplet(): boolean;
813
+ getTupletRatioText(): string;
808
814
  getSymbols(): ReadonlyArray<RhythmSymbol>;
809
815
  getFirstSymbol(): RhythmSymbol | undefined;
810
816
  getLastSymbol(): RhythmSymbol | undefined;
811
817
  get stemDir(): Stem.Up | Stem.Down;
818
+ get color(): string;
812
819
  layout(renderer: Renderer): void;
813
820
  updateRect(): void;
814
821
  updateStemTips(): void;
815
822
  offset(dx: number, dy: number): void;
816
823
  draw(renderer: Renderer): void;
824
+ private setBeamCounts;
825
+ private setTupletBeamCounts;
817
826
  }
818
827
 
819
828
  declare class ObjStaffRest extends MusicObject {
@@ -858,6 +867,7 @@ declare class ObjRest extends MusicObject {
858
867
  y: number;
859
868
  stemHeight: number;
860
869
  } | undefined)[];
870
+ hasTuplet(): boolean;
861
871
  isEmpty(): boolean;
862
872
  visibleInStaff(staff: ObjStaff): boolean;
863
873
  private getRestDotVerticalDisplacement;
@@ -903,17 +913,11 @@ type ScorePlayerNote = {
903
913
  slur: undefined | "first" | "slurred";
904
914
  };
905
915
  type RhythmSymbol = ObjNoteGroup | ObjRest;
906
- type LyricsContainerData = {
907
- lyricsContainer: LyricsContainer;
908
- verse: VerseNumber;
909
- line: ObjNotationLine;
910
- vpos: VerticalPos;
911
- };
912
916
  declare class ObjRhythmColumn extends MusicObject {
913
917
  readonly measure: ObjMeasure;
914
918
  readonly positionTicks: number;
915
919
  private readonly voiceSymbol;
916
- private readonly lyricsContainers;
920
+ private readonly lyricsContainerCache;
917
921
  private minDiatonicId?;
918
922
  private maxDiatonicId?;
919
923
  private staffMinDiatonicId;
@@ -949,7 +953,6 @@ declare class ObjRhythmColumn extends MusicObject {
949
953
  getArpeggioDir(): Arpeggio;
950
954
  setVoiceSymbol(voiceId: VoiceId, symbol: RhythmSymbol): void;
951
955
  getVoiceSymbol(voiceId: VoiceId): RhythmSymbol | undefined;
952
- getLyricsContainerDatas(): ReadonlyArray<LyricsContainerData>;
953
956
  getLyricsContainer(verse: VerseNumber, line: ObjNotationLine, vpos: VerticalPos, lyricsLength?: NoteLength): LyricsContainer | undefined;
954
957
  getMinWidth(): number;
955
958
  setupNoteHeadDisplacements(): void;
@@ -1183,8 +1186,8 @@ declare class ObjMeasure extends MusicObject {
1183
1186
  addBeamGroup(beam: ObjBeamGroup): void;
1184
1187
  requestBeamsUpdate(): void;
1185
1188
  private createOldStyleTriplets;
1189
+ getBeamGroups(): ReadonlyArray<ObjBeamGroup>;
1186
1190
  createBeams(): void;
1187
- private static setupBeamGroup;
1188
1191
  getBarLineLeft(): ObjBarLineLeft;
1189
1192
  getBarLineRight(): ObjBarLineRight;
1190
1193
  getVoiceSymbols(voiceId: VoiceId): ReadonlyArray<RhythmSymbol>;
@@ -1243,7 +1246,7 @@ declare class ObjScoreRow extends MusicObject {
1243
1246
  layoutWidth(renderer: Renderer, width: number): void;
1244
1247
  updateRect(): void;
1245
1248
  alignStemsToBeams(): void;
1246
- layoutPositionLines(renderer: Renderer): void;
1249
+ layoutSetNotationLines(renderer: Renderer): void;
1247
1250
  layoutPadding(renderer: Renderer): void;
1248
1251
  layoutDone(): void;
1249
1252
  offset(dx: number, dy: number): void;
@@ -1364,6 +1367,9 @@ declare class Renderer {
1364
1367
  drawLine(startX: number, startY: number, endX: number, endY: number, color?: string, lineWidth?: number): void;
1365
1368
  drawPartialLine(startX: number, startY: number, endX: number, endY: number, startT: number, endT: number, color?: string, lineWidth?: number): void;
1366
1369
  drawLedgerLines(staff: ObjStaff, diatonicId: number, x: number): void;
1370
+ getRestRect(restSize: number): DivRect;
1371
+ drawRest(restSize: number, x: number, y: number, color: string): void;
1372
+ drawFlag(rect: DivRect, dir: "up" | "down"): void;
1367
1373
  }
1368
1374
 
1369
1375
  declare class ObjEnding extends MusicObject {
@@ -1458,23 +1464,40 @@ declare class ObjExtensionLine extends MusicObject {
1458
1464
  draw(renderer: Renderer): void;
1459
1465
  }
1460
1466
 
1467
+ declare class ObjTabRhythm extends MusicObject {
1468
+ readonly measure: ObjMeasure;
1469
+ readonly tab: ObjTab;
1470
+ private readonly voiceIds;
1471
+ readonly mi: MTabRhythm;
1472
+ constructor(measure: ObjMeasure, tab: ObjTab);
1473
+ getMusicInterface(): MTabRhythm;
1474
+ pick(x: number, y: number): MusicObject[];
1475
+ layout(renderer: Renderer): void;
1476
+ private hasTuplets;
1477
+ layoutFitToMeasure(renderer: Renderer): void;
1478
+ offset(dx: number, dy: number): void;
1479
+ private readonly tupletPartsTextObjMap;
1480
+ draw(renderer: Renderer): void;
1481
+ }
1482
+
1461
1483
  declare enum LayoutGroupId {
1462
- Fermata = 0,
1463
- NoteLabel = 1,
1464
- Navigation = 2,
1465
- Ending = 3,
1466
- TempoAnnotation = 4,
1467
- DynamicsAnnotation = 5,
1468
- ChordLabel = 6,
1469
- LyricsVerse1 = 7,
1470
- LyricsVerse2 = 8,
1471
- LyricsVerse3 = 9
1484
+ TabRhythm = 0,
1485
+ Fermata = 1,
1486
+ NoteLabel = 2,
1487
+ Navigation = 3,
1488
+ Ending = 4,
1489
+ TempoAnnotation = 5,
1490
+ DynamicsAnnotation = 6,
1491
+ ChordLabel = 7,
1492
+ LyricsVerse1 = 8,
1493
+ LyricsVerse2 = 9,
1494
+ LyricsVerse3 = 10
1472
1495
  }
1473
1496
  declare enum VerticalPos {
1474
1497
  Above = 0,
1475
1498
  Below = 1
1476
1499
  }
1477
- type LayoutableMusicObject = ObjText | ObjSpecialText | ObjExtensionLine | ObjFermata | ObjEnding | ObjLyrics;
1500
+ type LayoutableMusicObject = ObjText | ObjSpecialText | ObjExtensionLine | ObjFermata | ObjEnding | ObjLyrics | ObjTabRhythm;
1478
1501
  declare class StaffGroup {
1479
1502
  readonly groupName: string;
1480
1503
  readonly staffsTabsAndGroups: number | string | (number | string)[];
@@ -1605,7 +1628,7 @@ declare class ObjImage extends MusicObject {
1605
1628
  draw(renderer: Renderer): void;
1606
1629
  }
1607
1630
 
1608
- declare class ObjSignature extends MusicObject {
1631
+ declare class ObjStaffSignature extends MusicObject {
1609
1632
  readonly measure: ObjMeasure;
1610
1633
  readonly staff: ObjStaff;
1611
1634
  private clefImage?;
@@ -1616,9 +1639,9 @@ declare class ObjSignature extends MusicObject {
1616
1639
  private beatCountText?;
1617
1640
  private beatSizeText?;
1618
1641
  private tempoText?;
1619
- readonly mi: MSignature;
1642
+ readonly mi: MStaffSignature;
1620
1643
  constructor(measure: ObjMeasure, staff: ObjStaff);
1621
- getMusicInterface(): MSignature;
1644
+ getMusicInterface(): MStaffSignature;
1622
1645
  updateClefImage(renderer: Renderer, showClef: boolean): void;
1623
1646
  updateMeasureNumber(showMeasureNumber: boolean): void;
1624
1647
  updateKeySignature(showKeySignature: boolean): void;
@@ -1630,6 +1653,24 @@ declare class ObjSignature extends MusicObject {
1630
1653
  offset(dx: number, dy: number): void;
1631
1654
  draw(renderer: Renderer): void;
1632
1655
  }
1656
+ declare class ObjTabSignature extends MusicObject {
1657
+ readonly measure: ObjMeasure;
1658
+ readonly tab: ObjTab;
1659
+ private measureNumber?;
1660
+ private beatCountText?;
1661
+ private beatSizeText?;
1662
+ private tempoText?;
1663
+ readonly mi: MTabSignature;
1664
+ constructor(measure: ObjMeasure, tab: ObjTab);
1665
+ getMusicInterface(): MTabSignature;
1666
+ updateMeasureNumber(showMeasureNumber: boolean): void;
1667
+ updateTimeSignature(showTimeSignature: boolean): void;
1668
+ updateTempo(showTempo: boolean): void;
1669
+ pick(x: number, y: number): MusicObject[];
1670
+ layout(renderer: Renderer): void;
1671
+ offset(dx: number, dy: number): void;
1672
+ draw(renderer: Renderer): void;
1673
+ }
1633
1674
 
1634
1675
  /** Score event type. */
1635
1676
  type ScoreEventType = "enter" | "leave" | "click";
@@ -2321,21 +2362,56 @@ declare class MTab extends MusicInterface {
2321
2362
  */
2322
2363
  getRow(): MScoreRow;
2323
2364
  }
2324
- /** Signature object contains clef, key signature, time signature and tempo, all optional depending on measure. */
2325
- declare class MSignature extends MusicInterface {
2365
+ /** Staff signature object contains clef, key signature, time signature, tempo and measure number, all optional depending on measure. */
2366
+ declare class MStaffSignature extends MusicInterface {
2326
2367
  private readonly obj;
2327
2368
  /** Object name. */
2328
- static readonly Name = "Signature";
2369
+ static readonly Name = "StaffSignature";
2329
2370
  /** @internal */
2330
- constructor(obj: ObjSignature);
2371
+ constructor(obj: ObjStaffSignature);
2331
2372
  /** @internal */
2332
- getMusicObject(): ObjSignature;
2373
+ getMusicObject(): ObjStaffSignature;
2333
2374
  /**
2334
2375
  * Get staff notation line this signature is in.
2335
2376
  * @returns - Staff object.
2336
2377
  */
2337
2378
  getStaff(): MStaff;
2338
2379
  }
2380
+ /** Tab signature object contains time signature, tempo and measure number, all optional depending on measure. */
2381
+ declare class MTabSignature extends MusicInterface {
2382
+ private readonly obj;
2383
+ /** Object name. */
2384
+ static readonly Name = "TabSignature";
2385
+ /** @internal */
2386
+ constructor(obj: ObjTabSignature);
2387
+ /** @internal */
2388
+ getMusicObject(): ObjTabSignature;
2389
+ /**
2390
+ * Get tab notation line this signature is in.
2391
+ * @returns - Tab object.
2392
+ */
2393
+ getTab(): MTab;
2394
+ }
2395
+ /** Tab rhythm object. */
2396
+ declare class MTabRhythm extends MusicInterface {
2397
+ private readonly obj;
2398
+ /** Object name. */
2399
+ static readonly Name = "TabRhythm";
2400
+ /** @internal */
2401
+ constructor(obj: ObjTabRhythm);
2402
+ /** @internal */
2403
+ getMusicObject(): ObjTabRhythm;
2404
+ /**
2405
+ * Get measure.
2406
+ * @returns - Measure.
2407
+ */
2408
+ getMeasure(): MMeasure;
2409
+ /**
2410
+ * Get tab.
2411
+ * @returns - Tab.
2412
+ */
2413
+ getTab(): MTab;
2414
+ }
2339
2415
  /** Spacial text object contains text and possibly special symbols (e.g. Segno or Coda). */
2340
2416
  declare class MSpecialText extends MusicInterface {
2341
2417
  private readonly obj;
@@ -2392,4 +2468,4 @@ declare class MExtensionLine extends MusicInterface {
2392
2468
  getMusicObject(): ObjExtensionLine;
2393
2469
  }
2394
2470
 
2395
- export { MText as $, type AnnotationText as A, MImage as B, Connective as C, DivRect as D, MMeasure as E, Fermata as F, MBarLineRight as G, MBarLineLeft as H, MStaffTabBarLine as I, MNoteGroup as J, MStaffNoteGroup as K, type LyricsOptions as L, MDocument as M, type NoteOptions as N, MTabNoteGroup as O, MRest as P, MStaffRest as Q, type RestOptions as R, StaffPreset as S, type TupletOptions as T, MRhythmColumn as U, type VoiceId as V, MScoreRow as W, MStaff as X, MTab as Y, MSignature as Z, MSpecialText as _, type ScoreConfiguration as a, MLyrics as a0, MExtensionLine as a1, Clef as a2, type StaffConfig as a3, type TabConfig as a4, getVoiceIds as a5, type StringNumber as a6, getStringNumbers as a7, getVerseNumbers as a8, Stem as a9, Arpeggio as aa, type StaffTabOrGroup as ab, LyricsAlign as ac, LyricsHyphen as ad, DynamicsAnnotation as ae, TempoAnnotation as af, PlayState as ag, type PlayStateChangeListener as ah, type VerseNumber as b, type StaffTabOrGroups as c, Navigation as d, Annotation as e, Label as f, TieType as g, NoteAnchor as h, VerticalPosition as i, type ScoreEventType as j, ScoreEvent as k, ScoreStaffPosEvent as l, ScoreObjectEvent as m, type ScoreEventListener as n, MPlayer as o, MRenderer as p, MPlaybackButtons as q, MusicInterface as r, MAccidental as s, MConnective as t, MArpeggio as u, MBeamGroup as v, MStaffBeamGroup as w, MEnding as x, MFermata as y, MHeader as z };
2471
+ export { MTabRhythm as $, type AnnotationText as A, MImage as B, Connective as C, DivRect as D, MMeasure as E, Fermata as F, MBarLineRight as G, MBarLineLeft as H, MStaffTabBarLine as I, MNoteGroup as J, MStaffNoteGroup as K, type LyricsOptions as L, MDocument as M, type NoteOptions as N, MTabNoteGroup as O, MRest as P, MStaffRest as Q, type RestOptions as R, StaffPreset as S, type TupletOptions as T, MRhythmColumn as U, type VoiceId as V, MScoreRow as W, MStaff as X, MTab as Y, MStaffSignature as Z, MTabSignature as _, type ScoreConfiguration as a, MSpecialText as a0, MText as a1, MLyrics as a2, MExtensionLine as a3, Clef as a4, type BaseConfig as a5, type StaffConfig as a6, type TabConfig as a7, getVoiceIds as a8, type StringNumber as a9, getStringNumbers as aa, getVerseNumbers as ab, Stem as ac, Arpeggio as ad, type StaffTabOrGroup as ae, LyricsAlign as af, LyricsHyphen as ag, DynamicsAnnotation as ah, TempoAnnotation as ai, PlayState as aj, type PlayStateChangeListener as ak, type VerseNumber as b, type StaffTabOrGroups as c, Navigation as d, Annotation as e, Label as f, TieType as g, NoteAnchor as h, VerticalPosition as i, type ScoreEventType as j, ScoreEvent as k, ScoreStaffPosEvent as l, ScoreObjectEvent as m, type ScoreEventListener as n, MPlayer as o, MRenderer as p, MPlaybackButtons as q, MusicInterface as r, MAccidental as s, MConnective as t, MArpeggio as u, MBeamGroup as v, MStaffBeamGroup as w, MEnding as x, MFermata as y, MHeader as z };
@@ -1,5 +1,5 @@
1
- import { N as Note, A as Accidental } from './note-eA2xPPiG.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-GrstpD9G.js';
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
3
  import { Vec2 } from '@tspro/ts-utils-lib';
4
4
 
5
5
  /**
@@ -225,34 +225,39 @@ declare enum Clef {
225
225
  /** F-clef (bass cleff) */
226
226
  F = "F"
227
227
  }
228
+ /** Base config for staff and tab configs. */
229
+ type BaseConfig = {
230
+ /** Name for this staff/tab config. */
231
+ name?: string;
232
+ /** Voice ids that are presented in this staff/tab. */
233
+ voiceIds?: number[];
234
+ };
228
235
  /** Staff config to add staff notation line in score configuration. */
229
- type StaffConfig = {
236
+ type StaffConfig = BaseConfig & {
230
237
  /** Config type, must be "staff" for staff config. */
231
238
  type: "staff";
232
239
  /** G-clef or F-clef for this staff config? */
233
240
  clef: Clef | `${Clef}`;
234
- /** Set name for this staff config. */
235
- name?: string;
236
241
  /** Set octave down with G-clef for guitar treble staff notation line. */
237
242
  isOctaveDown?: boolean;
238
243
  /** Lowest note (e.g. "C2")that can be presented in this staff notation line. */
239
244
  minNote?: string;
240
245
  /** Highest note (e.g. "C6") that can be presented in this staff notation line. */
241
246
  maxNote?: string;
242
- /** Voice ids that are presented in this staff notation line. */
243
- voiceIds?: number[];
244
- /** Set true for two staff configs with G-clef and F-clef to create grand staff. */
247
+ /**
248
+ * To create grand staff: use same `grandId` value (e.g. "grand1") for two
249
+ * consequtive staves, first having G-clef and second having F-clef.
250
+ */
251
+ grandId?: string;
252
+ /** @deprecated - Use `grandId` property instead. */
245
253
  isGrand?: boolean;
246
254
  };
247
255
  /** Tab config to add guitar tab in score configuration. */
248
- type TabConfig = {
256
+ type TabConfig = BaseConfig & {
249
257
  /** Config type, must be "tab" for tab config. */
250
258
  type: "tab";
251
- /** Set name for this tab config. */
252
- name?: string;
259
+ /** Tuning name or array six notes (tune for each string). */
253
260
  tuning?: string | string[];
254
- /** Voice ids that are presented in this guitar tab notation line. */
255
- voiceIds?: number[];
256
261
  };
257
262
  /** Score configuration. */
258
263
  type ScoreConfiguration = StaffConfig | TabConfig | (StaffConfig | TabConfig)[];
@@ -613,7 +618,6 @@ declare class ObjStaff extends ObjNotationLine {
613
618
  isLine(diatonicId: number): boolean;
614
619
  isSpace(diatonicId: number): boolean;
615
620
  containsVoiceId(voiceId: number): boolean;
616
- isGrand(): boolean;
617
621
  calcTop(): number;
618
622
  calcBottom(): number;
619
623
  pick(x: number, y: number): MusicObject[];
@@ -743,6 +747,9 @@ declare class ObjNoteGroup extends MusicObject {
743
747
  hasBeamCount(): boolean;
744
748
  getLeftBeamCount(): number;
745
749
  getRightBeamCount(): number;
750
+ setLeftBeamCount(count: number): void;
751
+ setRightBeamCount(count: number): void;
752
+ hasTuplet(): boolean;
746
753
  isEmpty(): boolean;
747
754
  visibleInStaff(staff: ObjStaff): boolean;
748
755
  getPlayTicks(note: Note): number;
@@ -752,8 +759,6 @@ declare class ObjNoteGroup extends MusicObject {
752
759
  setStemTipY(staff: ObjStaff, stemTipY: number): void;
753
760
  offset(dx: number, dy: number): void;
754
761
  draw(renderer: Renderer): void;
755
- static setBeamCounts(groupNotes: (ObjNoteGroup | undefined)[]): void;
756
- static setTupletBeamCounts(tuplet: ObjBeamGroup): void;
757
762
  getDotVerticalDisplacement(staff: ObjStaff, diatonicId: number, stemDir: Stem): 1 | 0 | -1;
758
763
  static hasSameNotes(ng1: ObjNoteGroup, ng2: ObjNoteGroup): boolean;
759
764
  }
@@ -796,7 +801,7 @@ declare class ObjBeamGroup extends MusicObject {
796
801
  private readonly staffObjects;
797
802
  private constructor();
798
803
  private get showTupletRatio();
799
- static createBeam(noteGroups: ObjNoteGroup[]): void;
804
+ static createBeam(noteGroups: ObjNoteGroup[]): boolean;
800
805
  static createOldStyleTriplet(symbols: RhythmSymbol[]): number;
801
806
  static createTuplet(symbols: RhythmSymbol[], tupletRatio: TupletRatio & TupletOptions): void;
802
807
  getMusicInterface(): MBeamGroup;
@@ -805,15 +810,19 @@ declare class ObjBeamGroup extends MusicObject {
805
810
  pick(x: number, y: number): MusicObject[];
806
811
  getType(): BeamGroupType;
807
812
  isTuplet(): boolean;
813
+ getTupletRatioText(): string;
808
814
  getSymbols(): ReadonlyArray<RhythmSymbol>;
809
815
  getFirstSymbol(): RhythmSymbol | undefined;
810
816
  getLastSymbol(): RhythmSymbol | undefined;
811
817
  get stemDir(): Stem.Up | Stem.Down;
818
+ get color(): string;
812
819
  layout(renderer: Renderer): void;
813
820
  updateRect(): void;
814
821
  updateStemTips(): void;
815
822
  offset(dx: number, dy: number): void;
816
823
  draw(renderer: Renderer): void;
824
+ private setBeamCounts;
825
+ private setTupletBeamCounts;
817
826
  }
818
827
 
819
828
  declare class ObjStaffRest extends MusicObject {
@@ -858,6 +867,7 @@ declare class ObjRest extends MusicObject {
858
867
  y: number;
859
868
  stemHeight: number;
860
869
  } | undefined)[];
870
+ hasTuplet(): boolean;
861
871
  isEmpty(): boolean;
862
872
  visibleInStaff(staff: ObjStaff): boolean;
863
873
  private getRestDotVerticalDisplacement;
@@ -903,17 +913,11 @@ type ScorePlayerNote = {
903
913
  slur: undefined | "first" | "slurred";
904
914
  };
905
915
  type RhythmSymbol = ObjNoteGroup | ObjRest;
906
- type LyricsContainerData = {
907
- lyricsContainer: LyricsContainer;
908
- verse: VerseNumber;
909
- line: ObjNotationLine;
910
- vpos: VerticalPos;
911
- };
912
916
  declare class ObjRhythmColumn extends MusicObject {
913
917
  readonly measure: ObjMeasure;
914
918
  readonly positionTicks: number;
915
919
  private readonly voiceSymbol;
916
- private readonly lyricsContainers;
920
+ private readonly lyricsContainerCache;
917
921
  private minDiatonicId?;
918
922
  private maxDiatonicId?;
919
923
  private staffMinDiatonicId;
@@ -949,7 +953,6 @@ declare class ObjRhythmColumn extends MusicObject {
949
953
  getArpeggioDir(): Arpeggio;
950
954
  setVoiceSymbol(voiceId: VoiceId, symbol: RhythmSymbol): void;
951
955
  getVoiceSymbol(voiceId: VoiceId): RhythmSymbol | undefined;
952
- getLyricsContainerDatas(): ReadonlyArray<LyricsContainerData>;
953
956
  getLyricsContainer(verse: VerseNumber, line: ObjNotationLine, vpos: VerticalPos, lyricsLength?: NoteLength): LyricsContainer | undefined;
954
957
  getMinWidth(): number;
955
958
  setupNoteHeadDisplacements(): void;
@@ -1183,8 +1186,8 @@ declare class ObjMeasure extends MusicObject {
1183
1186
  addBeamGroup(beam: ObjBeamGroup): void;
1184
1187
  requestBeamsUpdate(): void;
1185
1188
  private createOldStyleTriplets;
1189
+ getBeamGroups(): ReadonlyArray<ObjBeamGroup>;
1186
1190
  createBeams(): void;
1187
- private static setupBeamGroup;
1188
1191
  getBarLineLeft(): ObjBarLineLeft;
1189
1192
  getBarLineRight(): ObjBarLineRight;
1190
1193
  getVoiceSymbols(voiceId: VoiceId): ReadonlyArray<RhythmSymbol>;
@@ -1243,7 +1246,7 @@ declare class ObjScoreRow extends MusicObject {
1243
1246
  layoutWidth(renderer: Renderer, width: number): void;
1244
1247
  updateRect(): void;
1245
1248
  alignStemsToBeams(): void;
1246
- layoutPositionLines(renderer: Renderer): void;
1249
+ layoutSetNotationLines(renderer: Renderer): void;
1247
1250
  layoutPadding(renderer: Renderer): void;
1248
1251
  layoutDone(): void;
1249
1252
  offset(dx: number, dy: number): void;
@@ -1364,6 +1367,9 @@ declare class Renderer {
1364
1367
  drawLine(startX: number, startY: number, endX: number, endY: number, color?: string, lineWidth?: number): void;
1365
1368
  drawPartialLine(startX: number, startY: number, endX: number, endY: number, startT: number, endT: number, color?: string, lineWidth?: number): void;
1366
1369
  drawLedgerLines(staff: ObjStaff, diatonicId: number, x: number): void;
1370
+ getRestRect(restSize: number): DivRect;
1371
+ drawRest(restSize: number, x: number, y: number, color: string): void;
1372
+ drawFlag(rect: DivRect, dir: "up" | "down"): void;
1367
1373
  }
1368
1374
 
1369
1375
  declare class ObjEnding extends MusicObject {
@@ -1458,23 +1464,40 @@ declare class ObjExtensionLine extends MusicObject {
1458
1464
  draw(renderer: Renderer): void;
1459
1465
  }
1460
1466
 
1467
+ declare class ObjTabRhythm extends MusicObject {
1468
+ readonly measure: ObjMeasure;
1469
+ readonly tab: ObjTab;
1470
+ private readonly voiceIds;
1471
+ readonly mi: MTabRhythm;
1472
+ constructor(measure: ObjMeasure, tab: ObjTab);
1473
+ getMusicInterface(): MTabRhythm;
1474
+ pick(x: number, y: number): MusicObject[];
1475
+ layout(renderer: Renderer): void;
1476
+ private hasTuplets;
1477
+ layoutFitToMeasure(renderer: Renderer): void;
1478
+ offset(dx: number, dy: number): void;
1479
+ private readonly tupletPartsTextObjMap;
1480
+ draw(renderer: Renderer): void;
1481
+ }
1482
+
1461
1483
  declare enum LayoutGroupId {
1462
- Fermata = 0,
1463
- NoteLabel = 1,
1464
- Navigation = 2,
1465
- Ending = 3,
1466
- TempoAnnotation = 4,
1467
- DynamicsAnnotation = 5,
1468
- ChordLabel = 6,
1469
- LyricsVerse1 = 7,
1470
- LyricsVerse2 = 8,
1471
- LyricsVerse3 = 9
1484
+ TabRhythm = 0,
1485
+ Fermata = 1,
1486
+ NoteLabel = 2,
1487
+ Navigation = 3,
1488
+ Ending = 4,
1489
+ TempoAnnotation = 5,
1490
+ DynamicsAnnotation = 6,
1491
+ ChordLabel = 7,
1492
+ LyricsVerse1 = 8,
1493
+ LyricsVerse2 = 9,
1494
+ LyricsVerse3 = 10
1472
1495
  }
1473
1496
  declare enum VerticalPos {
1474
1497
  Above = 0,
1475
1498
  Below = 1
1476
1499
  }
1477
- type LayoutableMusicObject = ObjText | ObjSpecialText | ObjExtensionLine | ObjFermata | ObjEnding | ObjLyrics;
1500
+ type LayoutableMusicObject = ObjText | ObjSpecialText | ObjExtensionLine | ObjFermata | ObjEnding | ObjLyrics | ObjTabRhythm;
1478
1501
  declare class StaffGroup {
1479
1502
  readonly groupName: string;
1480
1503
  readonly staffsTabsAndGroups: number | string | (number | string)[];
@@ -1605,7 +1628,7 @@ declare class ObjImage extends MusicObject {
1605
1628
  draw(renderer: Renderer): void;
1606
1629
  }
1607
1630
 
1608
- declare class ObjSignature extends MusicObject {
1631
+ declare class ObjStaffSignature extends MusicObject {
1609
1632
  readonly measure: ObjMeasure;
1610
1633
  readonly staff: ObjStaff;
1611
1634
  private clefImage?;
@@ -1616,9 +1639,9 @@ declare class ObjSignature extends MusicObject {
1616
1639
  private beatCountText?;
1617
1640
  private beatSizeText?;
1618
1641
  private tempoText?;
1619
- readonly mi: MSignature;
1642
+ readonly mi: MStaffSignature;
1620
1643
  constructor(measure: ObjMeasure, staff: ObjStaff);
1621
- getMusicInterface(): MSignature;
1644
+ getMusicInterface(): MStaffSignature;
1622
1645
  updateClefImage(renderer: Renderer, showClef: boolean): void;
1623
1646
  updateMeasureNumber(showMeasureNumber: boolean): void;
1624
1647
  updateKeySignature(showKeySignature: boolean): void;
@@ -1630,6 +1653,24 @@ declare class ObjSignature extends MusicObject {
1630
1653
  offset(dx: number, dy: number): void;
1631
1654
  draw(renderer: Renderer): void;
1632
1655
  }
1656
+ declare class ObjTabSignature extends MusicObject {
1657
+ readonly measure: ObjMeasure;
1658
+ readonly tab: ObjTab;
1659
+ private measureNumber?;
1660
+ private beatCountText?;
1661
+ private beatSizeText?;
1662
+ private tempoText?;
1663
+ readonly mi: MTabSignature;
1664
+ constructor(measure: ObjMeasure, tab: ObjTab);
1665
+ getMusicInterface(): MTabSignature;
1666
+ updateMeasureNumber(showMeasureNumber: boolean): void;
1667
+ updateTimeSignature(showTimeSignature: boolean): void;
1668
+ updateTempo(showTempo: boolean): void;
1669
+ pick(x: number, y: number): MusicObject[];
1670
+ layout(renderer: Renderer): void;
1671
+ offset(dx: number, dy: number): void;
1672
+ draw(renderer: Renderer): void;
1673
+ }
1633
1674
 
1634
1675
  /** Score event type. */
1635
1676
  type ScoreEventType = "enter" | "leave" | "click";
@@ -2321,21 +2362,56 @@ declare class MTab extends MusicInterface {
2321
2362
  */
2322
2363
  getRow(): MScoreRow;
2323
2364
  }
2324
- /** Signature object contains clef, key signature, time signature and tempo, all optional depending on measure. */
2325
- declare class MSignature extends MusicInterface {
2365
+ /** Staff signature object contains clef, key signature, time signature, tempo and measure number, all optional depending on measure. */
2366
+ declare class MStaffSignature extends MusicInterface {
2326
2367
  private readonly obj;
2327
2368
  /** Object name. */
2328
- static readonly Name = "Signature";
2369
+ static readonly Name = "StaffSignature";
2329
2370
  /** @internal */
2330
- constructor(obj: ObjSignature);
2371
+ constructor(obj: ObjStaffSignature);
2331
2372
  /** @internal */
2332
- getMusicObject(): ObjSignature;
2373
+ getMusicObject(): ObjStaffSignature;
2333
2374
  /**
2334
2375
  * Get staff notation line this signature is in.
2335
2376
  * @returns - Staff object.
2336
2377
  */
2337
2378
  getStaff(): MStaff;
2338
2379
  }
2380
+ /** Tab signature object contains time signature, tempo and measure number, all optional depending on measure. */
2381
+ declare class MTabSignature extends MusicInterface {
2382
+ private readonly obj;
2383
+ /** Object name. */
2384
+ static readonly Name = "TabSignature";
2385
+ /** @internal */
2386
+ constructor(obj: ObjTabSignature);
2387
+ /** @internal */
2388
+ getMusicObject(): ObjTabSignature;
2389
+ /**
2390
+ * Get tab notation line this signature is in.
2391
+ * @returns - Tab object.
2392
+ */
2393
+ getTab(): MTab;
2394
+ }
2395
+ /** Tab rhythm object. */
2396
+ declare class MTabRhythm extends MusicInterface {
2397
+ private readonly obj;
2398
+ /** Object name. */
2399
+ static readonly Name = "TabRhythm";
2400
+ /** @internal */
2401
+ constructor(obj: ObjTabRhythm);
2402
+ /** @internal */
2403
+ getMusicObject(): ObjTabRhythm;
2404
+ /**
2405
+ * Get measure.
2406
+ * @returns - Measure.
2407
+ */
2408
+ getMeasure(): MMeasure;
2409
+ /**
2410
+ * Get tab.
2411
+ * @returns - Tab.
2412
+ */
2413
+ getTab(): MTab;
2414
+ }
2339
2415
  /** Spacial text object contains text and possibly special symbols (e.g. Segno or Coda). */
2340
2416
  declare class MSpecialText extends MusicInterface {
2341
2417
  private readonly obj;
@@ -2392,4 +2468,4 @@ declare class MExtensionLine extends MusicInterface {
2392
2468
  getMusicObject(): ObjExtensionLine;
2393
2469
  }
2394
2470
 
2395
- export { MText as $, type AnnotationText as A, MImage as B, Connective as C, DivRect as D, MMeasure as E, Fermata as F, MBarLineRight as G, MBarLineLeft as H, MStaffTabBarLine as I, MNoteGroup as J, MStaffNoteGroup as K, type LyricsOptions as L, MDocument as M, type NoteOptions as N, MTabNoteGroup as O, MRest as P, MStaffRest as Q, type RestOptions as R, StaffPreset as S, type TupletOptions as T, MRhythmColumn as U, type VoiceId as V, MScoreRow as W, MStaff as X, MTab as Y, MSignature as Z, MSpecialText as _, type ScoreConfiguration as a, MLyrics as a0, MExtensionLine as a1, Clef as a2, type StaffConfig as a3, type TabConfig as a4, getVoiceIds as a5, type StringNumber as a6, getStringNumbers as a7, getVerseNumbers as a8, Stem as a9, Arpeggio as aa, type StaffTabOrGroup as ab, LyricsAlign as ac, LyricsHyphen as ad, DynamicsAnnotation as ae, TempoAnnotation as af, PlayState as ag, type PlayStateChangeListener as ah, type VerseNumber as b, type StaffTabOrGroups as c, Navigation as d, Annotation as e, Label as f, TieType as g, NoteAnchor as h, VerticalPosition as i, type ScoreEventType as j, ScoreEvent as k, ScoreStaffPosEvent as l, ScoreObjectEvent as m, type ScoreEventListener as n, MPlayer as o, MRenderer as p, MPlaybackButtons as q, MusicInterface as r, MAccidental as s, MConnective as t, MArpeggio as u, MBeamGroup as v, MStaffBeamGroup as w, MEnding as x, MFermata as y, MHeader as z };
2471
+ export { MTabRhythm as $, type AnnotationText as A, MImage as B, Connective as C, DivRect as D, MMeasure as E, Fermata as F, MBarLineRight as G, MBarLineLeft as H, MStaffTabBarLine as I, MNoteGroup as J, MStaffNoteGroup as K, type LyricsOptions as L, MDocument as M, type NoteOptions as N, MTabNoteGroup as O, MRest as P, MStaffRest as Q, type RestOptions as R, StaffPreset as S, type TupletOptions as T, MRhythmColumn as U, type VoiceId as V, MScoreRow as W, MStaff as X, MTab as Y, MStaffSignature as Z, MTabSignature as _, type ScoreConfiguration as a, MSpecialText as a0, MText as a1, MLyrics as a2, MExtensionLine as a3, Clef as a4, type BaseConfig as a5, type StaffConfig as a6, type TabConfig as a7, getVoiceIds as a8, type StringNumber as a9, getStringNumbers as aa, getVerseNumbers as ab, Stem as ac, Arpeggio as ad, type StaffTabOrGroup as ae, LyricsAlign as af, LyricsHyphen as ag, DynamicsAnnotation as ah, TempoAnnotation as ai, PlayState as aj, type PlayStateChangeListener as ak, type VerseNumber as b, type StaffTabOrGroups as c, Navigation as d, Annotation as e, Label as f, TieType as g, NoteAnchor as h, VerticalPosition as i, type ScoreEventType as j, ScoreEvent as k, ScoreStaffPosEvent as l, ScoreObjectEvent as m, type ScoreEventListener as n, MPlayer as o, MRenderer as p, MPlaybackButtons as q, MusicInterface as r, MAccidental as s, MConnective as t, MArpeggio as u, MBeamGroup as v, MStaffBeamGroup as w, MEnding as x, MFermata as y, MHeader as z };