chordsheetjs 13.2.0 → 13.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bundle.js CHANGED
@@ -33807,11 +33807,18 @@ var ChordSheetJS = (() => {
33807
33807
  * @param {string} chords The chords
33808
33808
  * @param {string | null} lyrics The lyrics
33809
33809
  * @param {string | null} annotation The annotation
33810
+ * @param {Chord | null} chordObj Optional pre-parsed Chord object
33810
33811
  */
33811
- constructor(chords = "", lyrics = null, annotation = null) {
33812
+ constructor(chords = "", lyrics = null, annotation = null, chordObj = null) {
33813
+ this._chordObj = null;
33812
33814
  this.chords = chords || "";
33813
33815
  this.lyrics = lyrics || "";
33814
33816
  this.annotation = annotation || "";
33817
+ this._chordObj = chordObj;
33818
+ }
33819
+ /** Returns the Chord object if available, otherwise parses from string */
33820
+ get chord() {
33821
+ return this._chordObj || (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(this.chords.trim());
33815
33822
  }
33816
33823
  /**
33817
33824
  * Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets)
@@ -33831,13 +33838,13 @@ var ChordSheetJS = (() => {
33831
33838
  * @returns {ChordLyricsPair}
33832
33839
  */
33833
33840
  clone() {
33834
- return new _$551a223fc13b5c10$var$ChordLyricsPair(this.chords, this.lyrics, this.annotation);
33841
+ return new _$551a223fc13b5c10$var$ChordLyricsPair(this.chords, this.lyrics, this.annotation, this._chordObj?.clone() || null);
33835
33842
  }
33836
33843
  toString() {
33837
33844
  return `ChordLyricsPair(chords=${this.chords}, lyrics=${this.lyrics})`;
33838
33845
  }
33839
- set({ chords, lyrics, annotation }) {
33840
- return new _$551a223fc13b5c10$var$ChordLyricsPair(chords || this.chords, lyrics || this.lyrics, annotation || this.annotation);
33846
+ set({ chords, lyrics, annotation, chordObj }) {
33847
+ return new _$551a223fc13b5c10$var$ChordLyricsPair(chords ?? this.chords, lyrics ?? this.lyrics, annotation ?? this.annotation, chordObj ?? null);
33841
33848
  }
33842
33849
  setLyrics(lyrics) {
33843
33850
  return this.set({
@@ -33875,7 +33882,8 @@ var ChordSheetJS = (() => {
33875
33882
  if (chordObj) {
33876
33883
  const changedChord = func(chordObj);
33877
33884
  return this.set({
33878
- chords: changedChord.toString()
33885
+ chords: changedChord.toString(),
33886
+ chordObj: changedChord
33879
33887
  });
33880
33888
  }
33881
33889
  return this.clone();
@@ -35092,12 +35100,13 @@ ${error.stack}`);
35092
35100
  static distance(oneKey, otherKey) {
35093
35101
  return this.wrapOrFail(oneKey).distanceTo(otherKey);
35094
35102
  }
35095
- constructor({ grade = null, number = null, minor, type, accidental, referenceKeyGrade = null, referenceKeyMode = null, originalKeyString = null, preferredAccidental = null }) {
35103
+ constructor({ grade = null, number = null, minor, type, accidental, referenceKeyGrade = null, referenceKeyMode = null, originalKeyString = null, preferredAccidental = null, explicitAccidental = false }) {
35096
35104
  this.number = null;
35097
35105
  this.minor = false;
35098
35106
  this.referenceKeyGrade = null;
35099
35107
  this.referenceKeyMode = null;
35100
35108
  this.originalKeyString = null;
35109
+ this.explicitAccidental = false;
35101
35110
  this.grade = grade;
35102
35111
  this.number = number;
35103
35112
  this.minor = minor;
@@ -35107,6 +35116,7 @@ ${error.stack}`);
35107
35116
  this.referenceKeyGrade = referenceKeyGrade;
35108
35117
  this.referenceKeyMode = referenceKeyMode;
35109
35118
  this.originalKeyString = originalKeyString;
35119
+ this.explicitAccidental = explicitAccidental;
35110
35120
  }
35111
35121
  distanceTo(otherKey) {
35112
35122
  const otherKeyObj = _$c2d6ab25ad00308f$var$Key.wrapOrFail(otherKey);
@@ -35359,7 +35369,8 @@ ${error.stack}`);
35359
35369
  useAccidental(newAccidental) {
35360
35370
  this.ensureGrade();
35361
35371
  return this.set({
35362
- accidental: newAccidental
35372
+ accidental: newAccidental,
35373
+ explicitAccidental: newAccidental !== null
35363
35374
  });
35364
35375
  }
35365
35376
  /** @deprecated Use useAccidental instead */
@@ -35379,6 +35390,7 @@ ${error.stack}`);
35379
35390
  }
35380
35391
  normalizeEnharmonics(key) {
35381
35392
  if (key) {
35393
+ if (this.explicitAccidental) return this.clone();
35382
35394
  const rootKeyString = _$c2d6ab25ad00308f$var$Key.wrapOrFail(key).toString({
35383
35395
  showMinor: true
35384
35396
  });
@@ -35403,6 +35415,7 @@ ${error.stack}`);
35403
35415
  referenceKeyGrade: this.referenceKeyGrade,
35404
35416
  originalKeyString: this.originalKeyString,
35405
35417
  preferredAccidental: this.preferredAccidental,
35418
+ explicitAccidental: this.explicitAccidental,
35406
35419
  ...overwrite ? attributes : {}
35407
35420
  });
35408
35421
  }
@@ -39212,10 +39225,10 @@ ${formattedContentLines}`;
39212
39225
  }
39213
39226
  formatChordLyricsPairChords(chordLyricsPair) {
39214
39227
  if (chordLyricsPair.chords) {
39215
- const renderedChord = (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(chordLyricsPair.chords);
39216
- if (!renderedChord) return `[${chordLyricsPair.chords}]`;
39217
- const normalizedChord = this.configuration.normalizeChords ? renderedChord.normalize() : renderedChord;
39218
- return `[${normalizedChord}]`;
39228
+ const chordObj = chordLyricsPair.chord;
39229
+ if (!chordObj) return `[${chordLyricsPair.chords}]`;
39230
+ const finalChord = this.configuration.normalizeChords ? chordObj.normalize() : chordObj;
39231
+ return `[${finalChord}]`;
39219
39232
  }
39220
39233
  if (chordLyricsPair.annotation) return `[*${chordLyricsPair.annotation}]`;
39221
39234
  return "";
@@ -68804,7 +68817,7 @@ AjwCRQJ5AAAAAAABAAAAANpTmfAAAAAA0e+yRgAAAADR77JG
68804
68817
  }
68805
68818
  };
68806
68819
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
68807
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "13.2.0";
68820
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "13.2.1";
68808
68821
  var $a3816b486f741c00$exports = {};
68809
68822
  var $892913528e7f60f9$export$2e2bcd8739ae039 = {
68810
68823
  CHORUS: $dce48cb70c4120bb$export$8db6c706fc9142b2,