chordsheetjs 15.4.0 → 15.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.
package/lib/pdf/main.d.ts CHANGED
@@ -35,14 +35,16 @@ interface PdfDoc {
35
35
  type PdfConstructor = new (options?: jsPDFOptions) => PdfDoc;
36
36
  type ParagraphType = 'abc' | 'bridge' | 'chorus' | 'grid' | 'indeterminate' | 'ly' | 'none' | 'svg' | 'tab' | 'textblock' | 'verse' | 'part' | string;
37
37
  type Accidental = '#' | 'b';
38
- type NoAccidental = 'NM';
39
- type AccidentalMaybe = Accidental | NoAccidental;
40
38
  type ChordType = 'symbol' | 'solfege' | 'numeric' | 'numeral';
41
39
  type FretNumber = number;
42
40
  type OpenFret = 0;
43
41
  type NonSoundingString = '-1' | 'N' | 'x';
44
42
  type Fret = FretNumber | OpenFret | NonSoundingString;
43
+ type Notation = 'german';
45
44
  type ContentType = 'tab' | 'abc' | 'ly' | 'svg' | 'grid' | 'textblock';
45
+ interface ChordParseOptions {
46
+ notation?: Notation | null;
47
+ }
46
48
  interface ChordProperties {
47
49
  root?: Key | null;
48
50
  suffix?: string | null;
@@ -63,6 +65,7 @@ interface ChordConstructorOptions {
63
65
  bass?: Key | null;
64
66
  chordType?: ChordType | null;
65
67
  optional?: boolean;
68
+ notation?: Notation | null;
66
69
  }
67
70
  /**
68
71
  * Represents a Chord, consisting of a root, suffix (quality) and bass
@@ -78,10 +81,14 @@ declare class Chord implements ChordProperties {
78
81
  * Tries to parse a chord string into a chord
79
82
  * Any leading or trailing whitespace is removed first, so a chord like ` \n E/G# \r ` is valid.
80
83
  * @param chordString the chord string, eg `Esus4/G#` or `1sus4/#3`.
84
+ * @param {ChordParseOptions} [options] parse options
85
+ * @param {Notation|null} [options.notation] when `'german'`, `B` is interpreted as B-flat (grade 10)
86
+ * and `H` as B natural (grade 11), and output renders accordingly. Defaults to English semantics where
87
+ * `B` is B natural and `H` is accepted as an alias for it.
81
88
  * @returns {Chord|null}
82
89
  */
83
- static parse(chordString: string): Chord | null;
84
- static parseOrFail(chordString: string): Chord;
90
+ static parse(chordString: string, options?: ChordParseOptions): Chord | null;
91
+ static parseOrFail(chordString: string, options?: ChordParseOptions): Chord;
85
92
  /**
86
93
  * Returns a deep copy of the chord
87
94
  * @returns {Chord}
@@ -823,6 +830,7 @@ interface KeyProperties {
823
830
  referenceKeyMode?: string | null;
824
831
  preferredAccidental?: Accidental | null;
825
832
  explicitAccidental?: boolean;
833
+ preferredNotation?: Notation | null;
826
834
  }
827
835
  interface ConstructorOptions {
828
836
  grade?: number | null;
@@ -835,6 +843,7 @@ interface ConstructorOptions {
835
843
  originalKeyString?: string | null;
836
844
  preferredAccidental: Accidental | null;
837
845
  explicitAccidental?: boolean;
846
+ preferredNotation?: Notation | null;
838
847
  }
839
848
  /**
840
849
  * Represents a key, such as Eb (symbol), #3 (numeric) or VII (numeral).
@@ -859,19 +868,20 @@ declare class Key implements KeyProperties {
859
868
  originalKeyString: string | null;
860
869
  preferredAccidental: Accidental | null;
861
870
  explicitAccidental: boolean;
871
+ preferredNotation: Notation | null;
862
872
  static parse(keyString: string | null): null | Key;
863
873
  static parseAsType(trimmed: string, keyType: ChordType): Key | null;
864
- static resolve({ key, keyType, minor, accidental, }: {
874
+ static resolve({ key, keyType, minor, accidental, preferredNotation, }: {
865
875
  key: string | number;
866
876
  keyType: ChordType;
867
877
  minor: string | boolean;
868
878
  accidental: Accidental | null;
879
+ preferredNotation?: Notation | null;
869
880
  }): Key | null;
870
881
  static getNumberFromKey(keyString: string, keyType: ChordType): number;
871
882
  static keyWithAccidental(key: string, accidental: Accidental | null, type: ChordType): string;
872
883
  /** @deprecated Use keyWithAccidental instead */
873
884
  static keyWithModifier(key: string, accidental: Accidental | null, type: ChordType): string;
874
- static toGrade(key: string, accidental: AccidentalMaybe, type: ChordType, isMinor: boolean): number | null;
875
885
  static isMinor(key: string, keyType: ChordType, minor: string | undefined | boolean): boolean;
876
886
  static parseOrFail(keyString: string | null): Key;
877
887
  static wrap(keyStringOrObject: Key | string | null): Key | null;
@@ -884,7 +894,7 @@ declare class Key implements KeyProperties {
884
894
  * @return {number} the distance in semitones
885
895
  */
886
896
  static distance(oneKey: Key | string, otherKey: Key | string): number;
887
- constructor({ grade, number, minor, type, accidental, referenceKeyGrade, referenceKeyMode, originalKeyString, preferredAccidental, explicitAccidental, }: ConstructorOptions);
897
+ constructor({ grade, number, minor, type, accidental, referenceKeyGrade, referenceKeyMode, originalKeyString, preferredAccidental, explicitAccidental, preferredNotation, }: ConstructorOptions);
888
898
  distanceTo(otherKey: Key | string): number;
889
899
  get effectiveGrade(): number;
890
900
  isMinor(): boolean;