@tspro/web-music-score 5.1.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 (38) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +4 -4
  3. package/dist/audio/index.d.ts +1 -1
  4. package/dist/audio/index.js +2 -2
  5. package/dist/audio/index.mjs +4 -4
  6. package/dist/audio-cg/index.js +1 -1
  7. package/dist/audio-cg/index.mjs +3 -3
  8. package/dist/audio-synth/index.js +1 -1
  9. package/dist/audio-synth/index.mjs +3 -3
  10. package/dist/{chunk-ROPTZBKD.mjs → chunk-6S5BDSCM.mjs} +2 -2
  11. package/dist/{chunk-2EQHSQWO.mjs → chunk-LC5JMIVF.mjs} +2 -2
  12. package/dist/{chunk-QVYFIK3L.mjs → chunk-XUGM7SCC.mjs} +3 -3
  13. package/dist/core/index.js +2 -2
  14. package/dist/core/index.mjs +3 -3
  15. package/dist/{guitar-CaZJDA05.d.ts → guitar-BsSayRsH.d.ts} +1 -1
  16. package/dist/iife/audio-cg.global.js +9 -2
  17. package/dist/iife/index.global.js +11 -11
  18. package/dist/{music-objects-DTDFSro0.d.mts → music-objects-CB05XryE.d.mts} +3 -9
  19. package/dist/{music-objects-CMdYZeC6.d.ts → music-objects-CwPOlqFi.d.ts} +5 -11
  20. package/dist/{note-eA2xPPiG.d.ts → note-CgCIBwvR.d.ts} +1 -1
  21. package/dist/pieces/index.d.mts +1 -1
  22. package/dist/pieces/index.d.ts +3 -3
  23. package/dist/pieces/index.js +1 -1
  24. package/dist/pieces/index.mjs +2 -2
  25. package/dist/react-ui/index.d.mts +1 -1
  26. package/dist/react-ui/index.d.ts +5 -5
  27. package/dist/react-ui/index.js +1 -1
  28. package/dist/react-ui/index.mjs +2 -2
  29. package/dist/{scale-DGx3tJH4.d.ts → scale-CBW4eTz7.d.ts} +2 -2
  30. package/dist/score/index.d.mts +2 -2
  31. package/dist/score/index.d.ts +5 -5
  32. package/dist/score/index.js +153 -88
  33. package/dist/score/index.mjs +155 -90
  34. package/dist/{tempo-GrstpD9G.d.ts → tempo-DMt3iwz9.d.ts} +1 -1
  35. package/dist/theory/index.d.ts +6 -6
  36. package/dist/theory/index.js +1 -1
  37. package/dist/theory/index.mjs +3 -3
  38. package/package.json +1 -1
@@ -801,7 +801,7 @@ declare class ObjBeamGroup extends MusicObject {
801
801
  private readonly staffObjects;
802
802
  private constructor();
803
803
  private get showTupletRatio();
804
- static createBeam(noteGroups: ObjNoteGroup[]): void;
804
+ static createBeam(noteGroups: ObjNoteGroup[]): boolean;
805
805
  static createOldStyleTriplet(symbols: RhythmSymbol[]): number;
806
806
  static createTuplet(symbols: RhythmSymbol[], tupletRatio: TupletRatio & TupletOptions): void;
807
807
  getMusicInterface(): MBeamGroup;
@@ -815,6 +815,7 @@ declare class ObjBeamGroup extends MusicObject {
815
815
  getFirstSymbol(): RhythmSymbol | undefined;
816
816
  getLastSymbol(): RhythmSymbol | undefined;
817
817
  get stemDir(): Stem.Up | Stem.Down;
818
+ get color(): string;
818
819
  layout(renderer: Renderer): void;
819
820
  updateRect(): void;
820
821
  updateStemTips(): void;
@@ -912,17 +913,11 @@ type ScorePlayerNote = {
912
913
  slur: undefined | "first" | "slurred";
913
914
  };
914
915
  type RhythmSymbol = ObjNoteGroup | ObjRest;
915
- type LyricsContainerData = {
916
- lyricsContainer: LyricsContainer;
917
- verse: VerseNumber;
918
- line: ObjNotationLine;
919
- vpos: VerticalPos;
920
- };
921
916
  declare class ObjRhythmColumn extends MusicObject {
922
917
  readonly measure: ObjMeasure;
923
918
  readonly positionTicks: number;
924
919
  private readonly voiceSymbol;
925
- private readonly lyricsContainers;
920
+ private readonly lyricsContainerCache;
926
921
  private minDiatonicId?;
927
922
  private maxDiatonicId?;
928
923
  private staffMinDiatonicId;
@@ -958,7 +953,6 @@ declare class ObjRhythmColumn extends MusicObject {
958
953
  getArpeggioDir(): Arpeggio;
959
954
  setVoiceSymbol(voiceId: VoiceId, symbol: RhythmSymbol): void;
960
955
  getVoiceSymbol(voiceId: VoiceId): RhythmSymbol | undefined;
961
- getLyricsContainerDatas(): ReadonlyArray<LyricsContainerData>;
962
956
  getLyricsContainer(verse: VerseNumber, line: ObjNotationLine, vpos: VerticalPos, lyricsLength?: NoteLength): LyricsContainer | undefined;
963
957
  getMinWidth(): number;
964
958
  setupNoteHeadDisplacements(): void;
@@ -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
  /**
@@ -801,7 +801,7 @@ declare class ObjBeamGroup extends MusicObject {
801
801
  private readonly staffObjects;
802
802
  private constructor();
803
803
  private get showTupletRatio();
804
- static createBeam(noteGroups: ObjNoteGroup[]): void;
804
+ static createBeam(noteGroups: ObjNoteGroup[]): boolean;
805
805
  static createOldStyleTriplet(symbols: RhythmSymbol[]): number;
806
806
  static createTuplet(symbols: RhythmSymbol[], tupletRatio: TupletRatio & TupletOptions): void;
807
807
  getMusicInterface(): MBeamGroup;
@@ -815,6 +815,7 @@ declare class ObjBeamGroup extends MusicObject {
815
815
  getFirstSymbol(): RhythmSymbol | undefined;
816
816
  getLastSymbol(): RhythmSymbol | undefined;
817
817
  get stemDir(): Stem.Up | Stem.Down;
818
+ get color(): string;
818
819
  layout(renderer: Renderer): void;
819
820
  updateRect(): void;
820
821
  updateStemTips(): void;
@@ -912,17 +913,11 @@ type ScorePlayerNote = {
912
913
  slur: undefined | "first" | "slurred";
913
914
  };
914
915
  type RhythmSymbol = ObjNoteGroup | ObjRest;
915
- type LyricsContainerData = {
916
- lyricsContainer: LyricsContainer;
917
- verse: VerseNumber;
918
- line: ObjNotationLine;
919
- vpos: VerticalPos;
920
- };
921
916
  declare class ObjRhythmColumn extends MusicObject {
922
917
  readonly measure: ObjMeasure;
923
918
  readonly positionTicks: number;
924
919
  private readonly voiceSymbol;
925
- private readonly lyricsContainers;
920
+ private readonly lyricsContainerCache;
926
921
  private minDiatonicId?;
927
922
  private maxDiatonicId?;
928
923
  private staffMinDiatonicId;
@@ -958,7 +953,6 @@ declare class ObjRhythmColumn extends MusicObject {
958
953
  getArpeggioDir(): Arpeggio;
959
954
  setVoiceSymbol(voiceId: VoiceId, symbol: RhythmSymbol): void;
960
955
  getVoiceSymbol(voiceId: VoiceId): RhythmSymbol | undefined;
961
- getLyricsContainerDatas(): ReadonlyArray<LyricsContainerData>;
962
956
  getLyricsContainer(verse: VerseNumber, line: ObjNotationLine, vpos: VerticalPos, lyricsLength?: NoteLength): LyricsContainer | undefined;
963
957
  getMinWidth(): number;
964
958
  setupNoteHeadDisplacements(): void;
@@ -288,7 +288,7 @@ declare class Note {
288
288
  * @param b - Note b.
289
289
  * @returns - -1, 0 or 1.
290
290
  */
291
- static compareFunc(a: Note, b: Note): 1 | 0 | -1;
291
+ static compareFunc(a: Note, b: Note): 1 | -1 | 0;
292
292
  }
293
293
 
294
294
  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,4 +1,4 @@
1
- import { M as MDocument } from '../music-objects-DTDFSro0.mjs';
1
+ import { M as MDocument } from '../music-objects-CB05XryE.mjs';
2
2
  import '../note-eA2xPPiG.mjs';
3
3
  import '../tempo-dkctPkCS.mjs';
4
4
  import '@tspro/ts-utils-lib';
@@ -1,6 +1,6 @@
1
- import { M as MDocument } from '../music-objects-CMdYZeC6.js';
2
- import '../note-eA2xPPiG.js';
3
- import '../tempo-GrstpD9G.js';
1
+ import { M as MDocument } from '../music-objects-CwPOlqFi.js';
2
+ import '../note-CgCIBwvR.js';
3
+ import '../tempo-DMt3iwz9.js';
4
4
  import '@tspro/ts-utils-lib';
5
5
 
6
6
  /**
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v5.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.2.0 | (c) 2023 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.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
- import "../chunk-2EQHSQWO.mjs";
1
+ /* WebMusicScore v5.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
+ import "../chunk-LC5JMIVF.mjs";
3
3
 
4
4
  // src/pieces/frere-jacques.ts
5
5
  import { DocumentBuilder } from "@tspro/web-music-score/score";
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { c as Scale, S as ScaleType } from '../scale-DQP3b9Zx.mjs';
4
4
  import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-eA2xPPiG.mjs';
5
5
  import { H as Handedness } from '../guitar-DdexKdN6.mjs';
6
- import { D as DivRect, M as MDocument, n as ScoreEventListener, p as MRenderer, q as MPlaybackButtons } from '../music-objects-DTDFSro0.mjs';
6
+ import { D as DivRect, M as MDocument, n as ScoreEventListener, p as MRenderer, q as MPlaybackButtons } from '../music-objects-CB05XryE.mjs';
7
7
  import '../tempo-dkctPkCS.mjs';
8
8
  import '@tspro/ts-utils-lib';
9
9
 
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { c as Scale, S as ScaleType } from '../scale-DGx3tJH4.js';
4
- import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-eA2xPPiG.js';
5
- import { H as Handedness } from '../guitar-CaZJDA05.js';
6
- import { D as DivRect, M as MDocument, n as ScoreEventListener, p as MRenderer, q as MPlaybackButtons } from '../music-objects-CMdYZeC6.js';
7
- import '../tempo-GrstpD9G.js';
3
+ import { c as Scale, S as ScaleType } from '../scale-CBW4eTz7.js';
4
+ import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-CgCIBwvR.js';
5
+ import { H as Handedness } from '../guitar-BsSayRsH.js';
6
+ import { D as DivRect, M as MDocument, n as ScoreEventListener, p as MRenderer, q as MPlaybackButtons } from '../music-objects-CwPOlqFi.js';
7
+ import '../tempo-DMt3iwz9.js';
8
8
  import '@tspro/ts-utils-lib';
9
9
 
10
10
  interface CircleOfFifthsProps {
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v5.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v5.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-2EQHSQWO.mjs";
4
+ } from "../chunk-LC5JMIVF.mjs";
5
5
 
6
6
  // src/react-ui/circle-of-fifths.tsx
7
7
  import * as React from "react";
@@ -1,5 +1,5 @@
1
- import { N as Note, S as SymbolSet } from './note-eA2xPPiG.js';
2
- import { K as KeySignature } from './tempo-GrstpD9G.js';
1
+ import { N as Note, S as SymbolSet } from './note-CgCIBwvR.js';
2
+ import { K as KeySignature } from './tempo-DMt3iwz9.js';
3
3
 
4
4
  /** Interval direction type. */
5
5
  type IntervalDirection = "Unison" | "Ascending" | "Descending";
@@ -1,5 +1,5 @@
1
- import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, b as VerseNumber, L as LyricsOptions, c as StaffTabOrGroups, F as Fermata, d as Navigation, A as AnnotationText, e as Annotation, f as Label, C as Connective, g as TieType, h as NoteAnchor, i as VerticalPosition } from '../music-objects-DTDFSro0.mjs';
2
- export { ad as Arpeggio, a5 as BaseConfig, a4 as Clef, D as DivRect, ah as DynamicsAnnotation, af as LyricsAlign, ag as LyricsHyphen, s as MAccidental, u as MArpeggio, H as MBarLineLeft, G as MBarLineRight, v as MBeamGroup, t as MConnective, x as MEnding, a3 as MExtensionLine, y as MFermata, z as MHeader, B as MImage, a2 as MLyrics, E as MMeasure, J as MNoteGroup, q as MPlaybackButtons, o as MPlayer, p as MRenderer, P as MRest, U as MRhythmColumn, W as MScoreRow, a0 as MSpecialText, X as MStaff, w as MStaffBeamGroup, K as MStaffNoteGroup, Q as MStaffRest, Z as MStaffSignature, I as MStaffTabBarLine, Y as MTab, O as MTabNoteGroup, $ as MTabRhythm, _ as MTabSignature, a1 as MText, r as MusicInterface, aj as PlayState, ak as PlayStateChangeListener, k as ScoreEvent, n as ScoreEventListener, j as ScoreEventType, m as ScoreObjectEvent, l as ScoreStaffPosEvent, a6 as StaffConfig, ae as StaffTabOrGroup, ac as Stem, a9 as StringNumber, a7 as TabConfig, ai as TempoAnnotation, aa as getStringNumbers, ab as getVerseNumbers, a8 as getVoiceIds } from '../music-objects-DTDFSro0.mjs';
1
+ import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, b as VerseNumber, L as LyricsOptions, c as StaffTabOrGroups, F as Fermata, d as Navigation, A as AnnotationText, e as Annotation, f as Label, C as Connective, g as TieType, h as NoteAnchor, i as VerticalPosition } from '../music-objects-CB05XryE.mjs';
2
+ export { ad as Arpeggio, a5 as BaseConfig, a4 as Clef, D as DivRect, ah as DynamicsAnnotation, af as LyricsAlign, ag as LyricsHyphen, s as MAccidental, u as MArpeggio, H as MBarLineLeft, G as MBarLineRight, v as MBeamGroup, t as MConnective, x as MEnding, a3 as MExtensionLine, y as MFermata, z as MHeader, B as MImage, a2 as MLyrics, E as MMeasure, J as MNoteGroup, q as MPlaybackButtons, o as MPlayer, p as MRenderer, P as MRest, U as MRhythmColumn, W as MScoreRow, a0 as MSpecialText, X as MStaff, w as MStaffBeamGroup, K as MStaffNoteGroup, Q as MStaffRest, Z as MStaffSignature, I as MStaffTabBarLine, Y as MTab, O as MTabNoteGroup, $ as MTabRhythm, _ as MTabSignature, a1 as MText, r as MusicInterface, aj as PlayState, ak as PlayStateChangeListener, k as ScoreEvent, n as ScoreEventListener, j as ScoreEventType, m as ScoreObjectEvent, l as ScoreStaffPosEvent, a6 as StaffConfig, ae as StaffTabOrGroup, ac as Stem, a9 as StringNumber, a7 as TabConfig, ai as TempoAnnotation, aa as getStringNumbers, ab as getVerseNumbers, a8 as getVoiceIds } from '../music-objects-CB05XryE.mjs';
3
3
  import { N as Note } from '../note-eA2xPPiG.mjs';
4
4
  import { S as ScaleType, c as Scale } from '../scale-DQP3b9Zx.mjs';
5
5
  import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, k as TupletRatio } from '../tempo-dkctPkCS.mjs';
@@ -1,8 +1,8 @@
1
- import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, b as VerseNumber, L as LyricsOptions, c as StaffTabOrGroups, F as Fermata, d as Navigation, A as AnnotationText, e as Annotation, f as Label, C as Connective, g as TieType, h as NoteAnchor, i as VerticalPosition } from '../music-objects-CMdYZeC6.js';
2
- export { ad as Arpeggio, a5 as BaseConfig, a4 as Clef, D as DivRect, ah as DynamicsAnnotation, af as LyricsAlign, ag as LyricsHyphen, s as MAccidental, u as MArpeggio, H as MBarLineLeft, G as MBarLineRight, v as MBeamGroup, t as MConnective, x as MEnding, a3 as MExtensionLine, y as MFermata, z as MHeader, B as MImage, a2 as MLyrics, E as MMeasure, J as MNoteGroup, q as MPlaybackButtons, o as MPlayer, p as MRenderer, P as MRest, U as MRhythmColumn, W as MScoreRow, a0 as MSpecialText, X as MStaff, w as MStaffBeamGroup, K as MStaffNoteGroup, Q as MStaffRest, Z as MStaffSignature, I as MStaffTabBarLine, Y as MTab, O as MTabNoteGroup, $ as MTabRhythm, _ as MTabSignature, a1 as MText, r as MusicInterface, aj as PlayState, ak as PlayStateChangeListener, k as ScoreEvent, n as ScoreEventListener, j as ScoreEventType, m as ScoreObjectEvent, l as ScoreStaffPosEvent, a6 as StaffConfig, ae as StaffTabOrGroup, ac as Stem, a9 as StringNumber, a7 as TabConfig, ai as TempoAnnotation, aa as getStringNumbers, ab as getVerseNumbers, a8 as getVoiceIds } from '../music-objects-CMdYZeC6.js';
3
- import { N as Note } from '../note-eA2xPPiG.js';
4
- import { S as ScaleType, c as Scale } from '../scale-DGx3tJH4.js';
5
- import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, k as TupletRatio } from '../tempo-GrstpD9G.js';
1
+ import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, b as VerseNumber, L as LyricsOptions, c as StaffTabOrGroups, F as Fermata, d as Navigation, A as AnnotationText, e as Annotation, f as Label, C as Connective, g as TieType, h as NoteAnchor, i as VerticalPosition } from '../music-objects-CwPOlqFi.js';
2
+ export { ad as Arpeggio, a5 as BaseConfig, a4 as Clef, D as DivRect, ah as DynamicsAnnotation, af as LyricsAlign, ag as LyricsHyphen, s as MAccidental, u as MArpeggio, H as MBarLineLeft, G as MBarLineRight, v as MBeamGroup, t as MConnective, x as MEnding, a3 as MExtensionLine, y as MFermata, z as MHeader, B as MImage, a2 as MLyrics, E as MMeasure, J as MNoteGroup, q as MPlaybackButtons, o as MPlayer, p as MRenderer, P as MRest, U as MRhythmColumn, W as MScoreRow, a0 as MSpecialText, X as MStaff, w as MStaffBeamGroup, K as MStaffNoteGroup, Q as MStaffRest, Z as MStaffSignature, I as MStaffTabBarLine, Y as MTab, O as MTabNoteGroup, $ as MTabRhythm, _ as MTabSignature, a1 as MText, r as MusicInterface, aj as PlayState, ak as PlayStateChangeListener, k as ScoreEvent, n as ScoreEventListener, j as ScoreEventType, m as ScoreObjectEvent, l as ScoreStaffPosEvent, a6 as StaffConfig, ae as StaffTabOrGroup, ac as Stem, a9 as StringNumber, a7 as TabConfig, ai as TempoAnnotation, aa as getStringNumbers, ab as getVerseNumbers, a8 as getVoiceIds } from '../music-objects-CwPOlqFi.js';
3
+ import { N as Note } from '../note-CgCIBwvR.js';
4
+ import { S as ScaleType, c as Scale } from '../scale-CBW4eTz7.js';
5
+ import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, k as TupletRatio } from '../tempo-DMt3iwz9.js';
6
6
  import '@tspro/ts-utils-lib';
7
7
 
8
8
  /** Tuplet builder type. */
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v5.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -3126,7 +3126,7 @@ var ObjRhythmColumn = class extends MusicObject {
3126
3126
  this.measure = measure;
3127
3127
  this.positionTicks = positionTicks;
3128
3128
  __publicField(this, "voiceSymbol", []);
3129
- __publicField(this, "lyricsContainers", []);
3129
+ __publicField(this, "lyricsContainerCache", /* @__PURE__ */ new Map());
3130
3130
  __publicField(this, "minDiatonicId");
3131
3131
  __publicField(this, "maxDiatonicId");
3132
3132
  __publicField(this, "staffMinDiatonicId", /* @__PURE__ */ new Map());
@@ -3252,18 +3252,20 @@ var ObjRhythmColumn = class extends MusicObject {
3252
3252
  getVoiceSymbol(voiceId) {
3253
3253
  return this.voiceSymbol[voiceId];
3254
3254
  }
3255
- getLyricsContainerDatas() {
3256
- return this.lyricsContainers;
3257
- }
3258
3255
  getLyricsContainer(verse, line, vpos, lyricsLength) {
3259
- let data = this.lyricsContainers.find((data2) => data2.verse === verse && data2.line === line && data2.vpos === vpos);
3260
- if (data === void 0 && lyricsLength !== void 0) {
3261
- data = { lyricsContainer: new LyricsContainer(this, (0, import_theory5.validateNoteLength)(lyricsLength)), verse, line, vpos };
3262
- this.lyricsContainers.push(data);
3263
- this.requestLayout();
3264
- this.requestRectUpdate();
3256
+ let vposMap = this.lyricsContainerCache.get(line);
3257
+ if (vposMap === void 0) {
3258
+ this.lyricsContainerCache.set(line, vposMap = /* @__PURE__ */ new Map());
3259
+ }
3260
+ let verseMap = vposMap.get(vpos);
3261
+ if (verseMap === void 0) {
3262
+ vposMap.set(vpos, verseMap = /* @__PURE__ */ new Map());
3265
3263
  }
3266
- return data == null ? void 0 : data.lyricsContainer;
3264
+ let lyricsContainer = verseMap.get(verse);
3265
+ if (lyricsContainer === void 0 && lyricsLength !== void 0) {
3266
+ verseMap.set(verse, lyricsContainer = new LyricsContainer(this, (0, import_theory5.validateNoteLength)(lyricsLength)));
3267
+ }
3268
+ return lyricsContainer;
3267
3269
  }
3268
3270
  getMinWidth() {
3269
3271
  let maxNoteSize = Math.max(...this.voiceSymbol.map((s) => s.rhythmProps.noteSize));
@@ -4036,6 +4038,10 @@ var Player = class _Player {
4036
4038
  return;
4037
4039
  }
4038
4040
  const col = this.playerColumnSequence[this.playPos];
4041
+ if (!col) {
4042
+ this.stop();
4043
+ return;
4044
+ }
4039
4045
  const getDuration = (ticks, tempo2) => {
4040
4046
  let seconds = calcTicksDuration(ticks, tempo2);
4041
4047
  return Math.max(0, seconds);
@@ -4120,6 +4126,9 @@ var Player = class _Player {
4120
4126
  return void 0;
4121
4127
  }
4122
4128
  let col = this.playerColumnSequence[this.playPos];
4129
+ if (!col) {
4130
+ return void 0;
4131
+ }
4123
4132
  let measure = col.measure;
4124
4133
  let x = col.getRect().centerX;
4125
4134
  let top = measure.row.getRect().top;
@@ -4498,6 +4507,12 @@ var ObjStaffBeamGroup = class extends MusicObject {
4498
4507
  }
4499
4508
  }
4500
4509
  };
4510
+ var InvalidBeamGroup = class {
4511
+ constructor(beamGroup, message) {
4512
+ this.beamGroup = beamGroup;
4513
+ this.message = message;
4514
+ }
4515
+ };
4501
4516
  var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4502
4517
  constructor(symbols, tupletRatio) {
4503
4518
  super(symbols[0].measure);
@@ -4538,10 +4553,27 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4538
4553
  let first = i === 0;
4539
4554
  let last = i === this.symbols.length - 1;
4540
4555
  if (first && sym.getRightBeamCount() === 0 || last && sym.getLeftBeamCount() === 0 || !first && !last && (sym.getLeftBeamCount() === 0 || sym.getRightBeamCount() === 0)) {
4541
- this.detach();
4556
+ throw new InvalidBeamGroup(this, "Beam has zero left or right beam count!");
4542
4557
  }
4543
4558
  });
4544
4559
  }
4560
+ if (symbols.some((symbol) => symbol.voiceId !== symbols[0].voiceId)) {
4561
+ if (this.type === 0 /* RegularBeam */) {
4562
+ throw new InvalidBeamGroup(this, "Beam symbols have different voiceId.");
4563
+ } else {
4564
+ throw new import_core11.MusicError(import_core11.MusicErrorType.Score, `Tuplet symbols have different voiceId.`);
4565
+ }
4566
+ }
4567
+ symbols[0].row.getStaves().forEach((staff) => {
4568
+ if (staff.getActualStaff(symbols[0].ownDiatonicId) && staff.containsVoiceId(symbols[0].voiceId)) {
4569
+ symbols.forEach((sym) => {
4570
+ let actualStaff = staff.getActualStaff(sym.ownDiatonicId);
4571
+ if (!actualStaff || !actualStaff.containsVoiceId(sym.voiceId)) {
4572
+ throw new InvalidBeamGroup(this, "Some of beam or tuplet symbols are not visible!");
4573
+ }
4574
+ });
4575
+ }
4576
+ });
4545
4577
  }
4546
4578
  get showTupletRatio() {
4547
4579
  var _a;
@@ -4549,26 +4581,54 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4549
4581
  }
4550
4582
  static createBeam(noteGroups) {
4551
4583
  if (noteGroups.length > 1 && noteGroups.every((ng) => !ng.hasTuplet())) {
4552
- new _ObjBeamGroup(noteGroups, void 0);
4584
+ try {
4585
+ new _ObjBeamGroup(noteGroups, void 0);
4586
+ return true;
4587
+ } catch (err) {
4588
+ if (err instanceof InvalidBeamGroup) {
4589
+ err.beamGroup.detach();
4590
+ } else {
4591
+ throw err;
4592
+ }
4593
+ }
4553
4594
  }
4595
+ return false;
4554
4596
  }
4555
4597
  static createOldStyleTriplet(symbols) {
4556
- let s2 = symbols.slice(0, 2);
4557
- let n2 = s2.map((s) => s.rhythmProps.noteSize);
4558
- if (s2.length === 2 && s2.every((s) => s.oldStyleTriplet && s.getBeamGroup() === void 0) && (n2[0] * 2 === n2[1] || n2[1] * 2 === n2[0])) {
4559
- new _ObjBeamGroup(s2, import_theory7.Tuplet.Triplet);
4560
- return 2;
4561
- }
4562
- let s3 = symbols.slice(0, 3);
4563
- let n3 = s3.map((s) => s.rhythmProps.noteSize);
4564
- if (s3.length === 3 && s3.every((s) => s.oldStyleTriplet && s.getBeamGroup() === void 0) && n3.every((n) => n === n3[0])) {
4565
- new _ObjBeamGroup(s3, import_theory7.Tuplet.Triplet);
4566
- return 3;
4598
+ try {
4599
+ let s2 = symbols.slice(0, 2);
4600
+ let n2 = s2.map((s) => s.rhythmProps.noteSize);
4601
+ if (s2.length === 2 && s2.every((s) => s.oldStyleTriplet && s.getBeamGroup() === void 0) && (n2[0] * 2 === n2[1] || n2[1] * 2 === n2[0])) {
4602
+ new _ObjBeamGroup(s2, import_theory7.Tuplet.Triplet);
4603
+ return 2;
4604
+ }
4605
+ let s3 = symbols.slice(0, 3);
4606
+ let n3 = s3.map((s) => s.rhythmProps.noteSize);
4607
+ if (s3.length === 3 && s3.every((s) => s.oldStyleTriplet && s.getBeamGroup() === void 0) && n3.every((n) => n === n3[0])) {
4608
+ new _ObjBeamGroup(s3, import_theory7.Tuplet.Triplet);
4609
+ return 3;
4610
+ }
4611
+ } catch (err) {
4612
+ if (err instanceof InvalidBeamGroup) {
4613
+ console.error(err.message);
4614
+ err.beamGroup.detach();
4615
+ } else {
4616
+ throw err;
4617
+ }
4567
4618
  }
4568
4619
  return 0;
4569
4620
  }
4570
4621
  static createTuplet(symbols, tupletRatio) {
4571
- new _ObjBeamGroup(symbols, tupletRatio);
4622
+ try {
4623
+ new _ObjBeamGroup(symbols, tupletRatio);
4624
+ } catch (err) {
4625
+ if (err instanceof InvalidBeamGroup) {
4626
+ console.error(err.message);
4627
+ err.beamGroup.detach();
4628
+ } else {
4629
+ throw err;
4630
+ }
4631
+ }
4572
4632
  }
4573
4633
  getMusicInterface() {
4574
4634
  return this.mi;
@@ -4613,6 +4673,9 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4613
4673
  get stemDir() {
4614
4674
  return this.symbols[0].ownStemDir;
4615
4675
  }
4676
+ get color() {
4677
+ return this.symbols[0].color;
4678
+ }
4616
4679
  layout(renderer) {
4617
4680
  this.requestRectUpdate();
4618
4681
  this.staffObjects.length = 0;
@@ -4620,12 +4683,8 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4620
4683
  if (symbols.length === 0) {
4621
4684
  return;
4622
4685
  }
4623
- let voiceId = symbols[0].voiceId;
4624
- if (symbols.some((symbol) => symbol.voiceId !== voiceId)) {
4625
- return;
4626
- }
4627
4686
  let { unitSize } = renderer;
4628
- let { stemDir } = this;
4687
+ let { stemDir, type } = this;
4629
4688
  let symbolsBeamCoords = symbols.map((s) => s.getBeamCoords());
4630
4689
  symbolsBeamCoords[0].map((s) => s == null ? void 0 : s.staff).forEach((mainStaff, index) => {
4631
4690
  var _a, _b;
@@ -4661,7 +4720,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4661
4720
  }
4662
4721
  let leftStemHeight = (_a = symbolStemHeight[0]) != null ? _a : 0;
4663
4722
  let rightStemHeight = (_b = symbolStemHeight[symbolStemHeight.length - 1]) != null ? _b : 0;
4664
- if (this.type !== 2 /* TupletGroup */) {
4723
+ if (type !== 2 /* TupletGroup */) {
4665
4724
  let leftDy = leftStemHeight < rightStemHeight ? Math.sqrt(rightStemHeight - leftStemHeight) : 0;
4666
4725
  let rightDy = rightStemHeight < leftStemHeight ? Math.sqrt(leftStemHeight - rightStemHeight) : 0;
4667
4726
  if (stemDir === "up" /* Up */) {
@@ -4699,21 +4758,21 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4699
4758
  rightY += raiseBeamY;
4700
4759
  symbolY = symbolY.map((y) => y === void 0 ? void 0 : y + raiseBeamY);
4701
4760
  let obj = new ObjStaffBeamGroup(mainStaff, this);
4702
- if (this.type === 2 /* TupletGroup */) {
4761
+ if (type === 2 /* TupletGroup */) {
4703
4762
  let ef = unitSize / (rightX - leftX);
4704
4763
  let l = import_ts_utils_lib9.Utils.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, -ef);
4705
4764
  let r = import_ts_utils_lib9.Utils.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, 1 + ef);
4706
4765
  obj.points.push(new BeamPoint(leftStaff, this, leftSymbol, l.x, l.y));
4707
4766
  obj.points.push(new BeamPoint(rightStaff, this, rightSymbol, r.x, r.y));
4708
4767
  obj.tupletNumberOffsetY = 0;
4709
- } else if (this.type === 0 /* RegularBeam */ || this.type === 1 /* TupletBeam */) {
4768
+ } else if (type === 0 /* RegularBeam */ || type === 1 /* TupletBeam */) {
4710
4769
  raiseBeamY *= 0.5;
4711
4770
  let { beamThickness } = renderer;
4712
4771
  const beamHeight = (i) => {
4713
4772
  let sym = symbols[i];
4714
4773
  if (sym instanceof ObjNoteGroup) {
4715
4774
  let beamCount = sym instanceof ObjNoteGroup ? Math.max(sym.getLeftBeamCount(), sym.getRightBeamCount()) : 0;
4716
- return DocumentSettings.BeamSeparation * unitSize * (this.stemDir === "up" /* Up */ ? beamCount - 1 : 0);
4775
+ return DocumentSettings.BeamSeparation * unitSize * (stemDir === "up" /* Up */ ? beamCount - 1 : 0);
4717
4776
  } else {
4718
4777
  return 0;
4719
4778
  }
@@ -4724,8 +4783,16 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4724
4783
  let symY = symbolY[i];
4725
4784
  if (symStaff && symX !== void 0 && symY !== void 0) {
4726
4785
  let pt = new BeamPoint(symStaff, this, sym, symX, symY);
4727
- pt.topBeamsHeight = beamThickness / 2 + (stemDir === "down" /* Down */ ? beamHeight(i) : 0);
4728
- pt.bottomBeamsHeight = beamThickness / 2 + (stemDir === "up" /* Up */ ? beamHeight(i) : 0);
4786
+ switch (stemDir) {
4787
+ case "up" /* Up */:
4788
+ pt.topBeamsHeight = beamThickness / 2;
4789
+ pt.bottomBeamsHeight = beamThickness / 2 + beamHeight(i);
4790
+ break;
4791
+ case "down" /* Down */:
4792
+ pt.topBeamsHeight = beamThickness / 2 + beamHeight(i);
4793
+ pt.bottomBeamsHeight = beamThickness / 2;
4794
+ break;
4795
+ }
4729
4796
  obj.points.push(pt);
4730
4797
  }
4731
4798
  });
@@ -4778,53 +4845,52 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4778
4845
  }
4779
4846
  draw(renderer) {
4780
4847
  let { unitSize, beamThickness, lineWidth } = renderer;
4781
- let color = "black";
4782
- this.staffObjects.forEach((obj) => {
4783
- if (this.type === 2 /* TupletGroup */) {
4784
- let l = obj.points[0];
4785
- let r = obj.points[obj.points.length - 1];
4786
- if (l && r) {
4787
- let tf = obj.tupletNumber ? obj.tupletNumber.getRect().width / (r.x - l.x) * 1.2 : 0;
4788
- let lc = import_ts_utils_lib9.Utils.Math.interpolateCoord(l.x, l.y, r.x, r.y, 0.5 - tf / 2);
4789
- let rc = import_ts_utils_lib9.Utils.Math.interpolateCoord(l.x, l.y, r.x, r.y, 0.5 + tf / 2);
4790
- let tipH = this.stemDir === "up" /* Up */ ? unitSize : -unitSize;
4791
- renderer.drawLine(l.x, l.y, lc.x, lc.y, color, lineWidth);
4792
- renderer.drawLine(rc.x, rc.y, r.x, r.y, color, lineWidth);
4793
- renderer.drawLine(l.x, l.y, l.x, l.y + tipH, color, lineWidth);
4794
- renderer.drawLine(r.x, r.y, r.x, r.y + tipH, color, lineWidth);
4848
+ let { stemDir, color, type } = this;
4849
+ if (type === 2 /* TupletGroup */) {
4850
+ let tipHeight = (stemDir === "up" /* Up */ ? 1 : -1) * unitSize;
4851
+ this.staffObjects.forEach((obj) => {
4852
+ let { x: lx, y: ly } = obj.points[0];
4853
+ let { x: rx, y: ry } = obj.points[obj.points.length - 1];
4854
+ if (obj.tupletNumber) {
4855
+ let tf = obj.tupletNumber.getRect().width / (rx - lx) * 1.2;
4856
+ let lc = import_ts_utils_lib9.Utils.Math.interpolateCoord(lx, ly, rx, ry, 0.5 - tf / 2);
4857
+ let rc = import_ts_utils_lib9.Utils.Math.interpolateCoord(lx, ly, rx, ry, 0.5 + tf / 2);
4858
+ renderer.drawLine(lx, ly, lc.x, lc.y, color, lineWidth);
4859
+ renderer.drawLine(rc.x, rc.y, rx, ry, color, lineWidth);
4860
+ } else {
4861
+ renderer.drawLine(lx, ly, rx, ry, color, lineWidth);
4795
4862
  }
4796
- } else if (this.type === 0 /* RegularBeam */ || this.type === 1 /* TupletBeam */) {
4797
- let beamSeparation = DocumentSettings.BeamSeparation * unitSize * (this.stemDir === "up" /* Up */ ? 1 : -1);
4863
+ renderer.drawLine(lx, ly, lx, ly + tipHeight, color, lineWidth);
4864
+ renderer.drawLine(rx, ry, rx, ry + tipHeight, color, lineWidth);
4865
+ });
4866
+ } else if (type === 0 /* RegularBeam */ || type === 1 /* TupletBeam */) {
4867
+ this.staffObjects.forEach((obj) => {
4798
4868
  let noteGroupPoints = obj.points.filter((p) => p.symbol instanceof ObjNoteGroup);
4869
+ let { x: lx, y: ly } = noteGroupPoints[0];
4870
+ let { x: rx, y: ry } = noteGroupPoints[noteGroupPoints.length - 1];
4871
+ let beamSeparation = DocumentSettings.BeamSeparation * unitSize * (stemDir === "up" /* Up */ ? 1 : -1) * (1 + 0.5 * Math.abs(Math.atan2(ry - ly, rx - lx)));
4799
4872
  for (let i = 0; i < noteGroupPoints.length - 1; i++) {
4800
- let left = noteGroupPoints[i];
4801
- let right = noteGroupPoints[i + 1];
4802
- if (!(left.symbol instanceof ObjNoteGroup && right.symbol instanceof ObjNoteGroup)) {
4803
- continue;
4804
- }
4805
- let leftBeamCount = left.symbol.getRightBeamCount();
4806
- let rightBeamCount = right.symbol.getLeftBeamCount();
4807
- let lx = left.x;
4808
- let ly = left.y;
4809
- let rx = right.x;
4810
- let ry = right.y;
4811
- let dy = beamSeparation * (1 + 0.5 * Math.abs(Math.atan2(ry - ly, rx - lx)));
4873
+ let { x: lx2, y: ly2, symbol: lsymbol } = noteGroupPoints[i];
4874
+ let { x: rx2, y: ry2, symbol: rsymbol } = noteGroupPoints[i + 1];
4875
+ let leftBeamCount = lsymbol.getRightBeamCount();
4876
+ let rightBeamCount = rsymbol.getLeftBeamCount();
4812
4877
  for (let beamId = 0; beamId < Math.max(leftBeamCount, rightBeamCount); beamId++) {
4813
4878
  if (beamId < leftBeamCount && beamId < rightBeamCount) {
4814
- renderer.drawLine(lx, ly, rx, ry, color, beamThickness);
4879
+ renderer.drawLine(lx2, ly2, rx2, ry2, color, beamThickness);
4815
4880
  } else if (leftBeamCount > rightBeamCount) {
4816
- renderer.drawPartialLine(lx, ly, rx, ry, 0, 0.25, color, beamThickness);
4881
+ renderer.drawPartialLine(lx2, ly2, rx2, ry2, 0, 0.25, color, beamThickness);
4817
4882
  } else if (rightBeamCount > leftBeamCount) {
4818
- renderer.drawPartialLine(lx, ly, rx, ry, 0.75, 1, color, beamThickness);
4883
+ renderer.drawPartialLine(lx2, ly2, rx2, ry2, 0.75, 1, color, beamThickness);
4819
4884
  }
4820
- ly += dy;
4821
- ry += dy;
4885
+ ly2 += beamSeparation;
4886
+ ry2 += beamSeparation;
4822
4887
  }
4823
4888
  }
4824
- }
4825
- if (obj.tupletNumber) {
4826
- obj.tupletNumber.draw(renderer);
4827
- }
4889
+ });
4890
+ }
4891
+ this.staffObjects.forEach((obj) => {
4892
+ var _a;
4893
+ return (_a = obj.tupletNumber) == null ? void 0 : _a.draw(renderer);
4828
4894
  });
4829
4895
  }
4830
4896
  setBeamCounts() {
@@ -6249,18 +6315,15 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6249
6315
  getLyricsObjects(line, vpos, verse) {
6250
6316
  let vposMap = this.lyricsObjectsCache.get(line);
6251
6317
  if (vposMap === void 0) {
6252
- vposMap = /* @__PURE__ */ new Map();
6253
- this.lyricsObjectsCache.set(line, vposMap);
6318
+ this.lyricsObjectsCache.set(line, vposMap = /* @__PURE__ */ new Map());
6254
6319
  }
6255
6320
  let verseMap = vposMap.get(vpos);
6256
6321
  if (verseMap === void 0) {
6257
- verseMap = /* @__PURE__ */ new Map();
6258
- vposMap.set(vpos, verseMap);
6322
+ vposMap.set(vpos, verseMap = /* @__PURE__ */ new Map());
6259
6323
  }
6260
6324
  let lyricsArr = verseMap.get(verse);
6261
6325
  if (lyricsArr === void 0) {
6262
- lyricsArr = [];
6263
- verseMap.set(verse, lyricsArr);
6326
+ verseMap.set(verse, lyricsArr = []);
6264
6327
  }
6265
6328
  return lyricsArr;
6266
6329
  }
@@ -6387,22 +6450,24 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6387
6450
  if (beamGroupSize.length > 1) {
6388
6451
  beamGroupSizeList.unshift([import_ts_utils_lib13.Utils.Math.sum(beamGroupSize)]);
6389
6452
  }
6390
- let beamsCreated = false;
6453
+ let beamCreated = false;
6391
6454
  let groupStartTicksSave = groupStartTicks;
6392
- while (beamGroupSizeList.length > 0 && !beamsCreated) {
6455
+ while (beamGroupSizeList.length > 0 && !beamCreated) {
6393
6456
  let beamGroupSize2 = beamGroupSizeList.shift();
6394
6457
  groupStartTicks = groupStartTicksSave;
6395
6458
  beamGroupSize2.forEach((beamGroupSize3) => {
6396
6459
  let beamGroupTicks = beamGroupSize3 * import_theory9.NoteLengthProps.get("8n").ticks;
6460
+ let groupEndTicks = groupStartTicks + beamGroupTicks;
6397
6461
  let groupSymbols = symbols.filter((symbol) => {
6398
6462
  let symbolStartTicks = upBeatStartTicks + symbol.col.positionTicks;
6399
- let symbolTicks = symbol.rhythmProps.ticks;
6400
- return symbolStartTicks >= groupStartTicks && symbolStartTicks + symbolTicks <= groupStartTicks + beamGroupTicks;
6463
+ let symbolEndTicks = symbolStartTicks + symbol.rhythmProps.ticks;
6464
+ return symbolStartTicks >= groupStartTicks && symbolEndTicks <= groupEndTicks;
6401
6465
  });
6402
- let groupNotesTicks = import_ts_utils_lib13.Utils.Math.sum(groupSymbols.map((sym) => sym.rhythmProps.ticks));
6403
- if (groupNotesTicks === beamGroupTicks && groupSymbols.every((n) => n instanceof ObjNoteGroup) && (groupSymbols.every((n) => n.rhythmProps.flagCount === 1) || beamGroupSizeList.length === 0)) {
6404
- ObjBeamGroup.createBeam(groupSymbols);
6405
- beamsCreated = true;
6466
+ let groupSymbolsTicks = import_ts_utils_lib13.Utils.Math.sum(groupSymbols.map((sym) => sym.rhythmProps.ticks));
6467
+ if (groupSymbolsTicks === beamGroupTicks && groupSymbols.every((n) => n instanceof ObjNoteGroup) && (groupSymbols.every((n) => n.rhythmProps.flagCount === 1) || beamGroupSizeList.length === 0)) {
6468
+ if (ObjBeamGroup.createBeam(groupSymbols)) {
6469
+ beamCreated = true;
6470
+ }
6406
6471
  }
6407
6472
  groupStartTicks += beamGroupTicks;
6408
6473
  });