chordsheetjs 15.2.1 → 15.3.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/index.js CHANGED
@@ -5607,6 +5607,7 @@ const $287d3e472e1fbd90$export$82f9bd327a40ea54 = {
5607
5607
  key: null,
5608
5608
  metadata: $287d3e472e1fbd90$export$a014e67b549cbef4,
5609
5609
  normalizeChords: true,
5610
+ normalizeChordSuffix: true,
5610
5611
  useUnicodeModifiers: false,
5611
5612
  user: null
5612
5613
  };
@@ -6524,9 +6525,16 @@ class $15f1d40e3d1ed3a0$var$Ternary extends (0, $8e2590a06c021dbf$export$2e2bcd8
6524
6525
  var $15f1d40e3d1ed3a0$export$2e2bcd8739ae039 = $15f1d40e3d1ed3a0$var$Ternary;
6525
6526
 
6526
6527
 
6528
+
6527
6529
  /**
6528
6530
  * Formats a song into a ChordPro chord sheet
6529
6531
  */ class $244a67400187e14e$var$ChordProFormatter extends (0, $ed0d9ddbbe7224cd$export$2e2bcd8739ae039) {
6532
+ getDefaultConfiguration() {
6533
+ return {
6534
+ ...(0, $fe1d3ba9df1ecad5$export$cb4529290f33d264)(),
6535
+ normalizeChordSuffix: false
6536
+ };
6537
+ }
6530
6538
  /**
6531
6539
  * Formats a song into a ChordPro chord sheet.
6532
6540
  * @param {Song} song The song to be formatted
@@ -6652,7 +6660,9 @@ var $15f1d40e3d1ed3a0$export$2e2bcd8739ae039 = $15f1d40e3d1ed3a0$var$Ternary;
6652
6660
  if (chordLyricsPair.chords) {
6653
6661
  const chordObj = chordLyricsPair.chord;
6654
6662
  if (!chordObj) return `[${chordLyricsPair.chords}]`;
6655
- const finalChord = this.configuration.normalizeChords ? chordObj.normalize() : chordObj;
6663
+ const finalChord = this.configuration.normalizeChords ? chordObj.normalize(null, {
6664
+ normalizeSuffix: this.configuration.normalizeChordSuffix
6665
+ }) : chordObj;
6656
6666
  return `[${finalChord}]`;
6657
6667
  }
6658
6668
  if (chordLyricsPair.annotation) return `[*${chordLyricsPair.annotation}]`;
@@ -7620,6 +7630,7 @@ const $e02a17f5a26edf19$var$defaultConstructorOptions = {
7620
7630
  contextKey: null,
7621
7631
  decapo: false,
7622
7632
  normalizeChords: true,
7633
+ normalizeChordSuffix: true,
7623
7634
  renderKey: null,
7624
7635
  songKey: null,
7625
7636
  style: null,
@@ -7635,6 +7646,7 @@ class $e02a17f5a26edf19$var$ChordRenderer {
7635
7646
  this.capo = config.decapo ? config.capo : 0;
7636
7647
  this.contextKey = config.contextKey;
7637
7648
  this.normalizeChords = config.normalizeChords;
7649
+ this.normalizeChordSuffix = config.normalizeChordSuffix;
7638
7650
  this.renderKey = config.renderKey;
7639
7651
  this.songKey = config.songKey;
7640
7652
  this.style = config.style;
@@ -7647,7 +7659,9 @@ class $e02a17f5a26edf19$var$ChordRenderer {
7647
7659
  return (0, $28a2fcb6fb95a147$export$79570e60478bce41)(chord, [
7648
7660
  (c)=>c.transpose(this.effectiveTransposeDistance),
7649
7661
  (c)=>this.accidental ? c.useAccidental(this.accidental) : c,
7650
- (c)=>this.normalizeChords ? c.normalize(this.effectiveKey) : c,
7662
+ (c)=>this.normalizeChords ? c.normalize(this.effectiveKey, {
7663
+ normalizeSuffix: this.normalizeChordSuffix
7664
+ }) : c,
7651
7665
  (c)=>this.changeChordType(c)
7652
7666
  ]).toString({
7653
7667
  useUnicodeModifier: this.useUnicodeModifier
@@ -8047,13 +8061,38 @@ function $2ce1086ce25c9ac0$export$fd31a53e6281557e(transposeKey, songKey) {
8047
8061
  if (/^\d+$/.test(transposeKey)) return parseInt(transposeKey, 10);
8048
8062
  return (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(songKey, transposeKey);
8049
8063
  }
8050
- function $2ce1086ce25c9ac0$export$596ec52955da9472(chordString, line, song, { renderKey: renderKey = null, useUnicodeModifier: useUnicodeModifier = false, normalizeChords: normalizeChords = true, decapo: decapo = false } = {}) {
8064
+ /**
8065
+ * Renders a chord in the context of a line and song and taking into account some options
8066
+ * @param chordString The chord to render
8067
+ * @param line The line the chord is in
8068
+ * @param song The song the line is in
8069
+ * @param renderKey The key to render the chord in. If not provided, the line key will be used,
8070
+ * or the song key if the line key is not provided.
8071
+ * @param useUnicodeModifier Whether to use unicode modifiers ('\u266f'/'\u266d') or plain text ('#'/'b').
8072
+ * Default `false`.
8073
+ * @param normalizeChords Whether to normalize the chord to the key (default `true`)
8074
+ * @param normalizeChordSuffix Whether to normalize the chord suffix (e.g. `sus2` to `2`, `maj7` to `ma7`).
8075
+ * Only takes effect when `normalizeChords` is `true`. Default `true`.
8076
+ * @param decapo Whether to transpose all chords to eliminate the capo (default `false`)
8077
+ */ const $2ce1086ce25c9ac0$var$renderChordDefaults = {
8078
+ renderKey: null,
8079
+ useUnicodeModifier: false,
8080
+ normalizeChords: true,
8081
+ normalizeChordSuffix: true,
8082
+ decapo: false
8083
+ };
8084
+ function $2ce1086ce25c9ac0$export$596ec52955da9472(chordString, line, song, options = {}) {
8085
+ const { renderKey: renderKey, useUnicodeModifier: useUnicodeModifier, normalizeChords: normalizeChords, normalizeChordSuffix: normalizeChordSuffix, decapo: decapo } = {
8086
+ ...$2ce1086ce25c9ac0$var$renderChordDefaults,
8087
+ ...options
8088
+ };
8051
8089
  const capoString = song.metadata.getSingle((0, $d21c5c7a462f3c34$export$866f445d49bad88e));
8052
8090
  return new (0, $e02a17f5a26edf19$export$2e2bcd8739ae039)({
8053
8091
  capo: capoString ? parseInt(capoString, 10) : 0,
8054
8092
  contextKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(line.key || song.key),
8055
8093
  decapo: decapo,
8056
8094
  normalizeChords: normalizeChords,
8095
+ normalizeChordSuffix: normalizeChordSuffix,
8057
8096
  renderKey: renderKey,
8058
8097
  songKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(song.key),
8059
8098
  style: song.metadata.getSingle((0, $d21c5c7a462f3c34$export$d8cbdf44b1f66df1)),
@@ -13989,6 +14028,7 @@ var $f9c5006b26957916$export$2e2bcd8739ae039 = {
13989
14028
  return (0, $2ce1086ce25c9ac0$export$596ec52955da9472)(item.chords, line, this.song, {
13990
14029
  renderKey: this.configuration.key,
13991
14030
  normalizeChords: this.configuration.normalizeChords,
14031
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
13992
14032
  decapo: this.configuration.decapo
13993
14033
  });
13994
14034
  }
@@ -26534,6 +26574,7 @@ var $1408adfd7317f0b6$export$2e2bcd8739ae039 = ({ configuration: configuration,
26534
26574
  renderKey: key,
26535
26575
  useUnicodeModifier: configuration.useUnicodeModifiers,
26536
26576
  normalizeChords: configuration.normalizeChords,
26577
+ normalizeChordSuffix: configuration.normalizeChordSuffix,
26537
26578
  decapo: configuration.decapo
26538
26579
  })}
26539
26580
  </div>
@@ -26733,6 +26774,7 @@ var $396f7048979e89c9$export$2e2bcd8739ae039 = ({ configuration: configuration,
26733
26774
  renderKey: key,
26734
26775
  useUnicodeModifier: configuration.useUnicodeModifiers,
26735
26776
  normalizeChords: configuration.normalizeChords,
26777
+ normalizeChordSuffix: configuration.normalizeChordSuffix,
26736
26778
  decapo: configuration.decapo
26737
26779
  })}</td>
26738
26780
  `;
@@ -27661,6 +27703,7 @@ var $bdd8c6196670168a$export$2e2bcd8739ae039 = $bdd8c6196670168a$var$Condition;
27661
27703
  renderKey: this.configuration.key,
27662
27704
  useUnicodeModifier: this.configuration.useUnicodeModifiers,
27663
27705
  normalizeChords: this.configuration.normalizeChords,
27706
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
27664
27707
  decapo: this.configuration.decapo
27665
27708
  });
27666
27709
  return chords;
@@ -28789,6 +28832,7 @@ class $9c53a1d7fff20a4a$export$e6ce86b8bc39728b {
28789
28832
  renderKey: null,
28790
28833
  useUnicodeModifier: this.config.useUnicodeModifiers,
28791
28834
  normalizeChords: this.config.normalizeChords,
28835
+ normalizeChordSuffix: this.config.normalizeChordSuffix,
28792
28836
  decapo: this.config.decapo
28793
28837
  });
28794
28838
  }
@@ -29865,6 +29909,7 @@ class $7fa32b9e3992eddb$export$12b762d1038ddc6b {
29865
29909
  linePadding: this.configuration.layout.sections.global.linePadding,
29866
29910
  useUnicodeModifiers: this.configuration.useUnicodeModifiers,
29867
29911
  normalizeChords: this.configuration.normalizeChords,
29912
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
29868
29913
  // Column and page layout information
29869
29914
  minY: dimensions.minY,
29870
29915
  columnWidth: dimensions.columnWidth,
@@ -30130,7 +30175,7 @@ const $a5a21ced491ea51f$var$endSectionTags = {
30130
30175
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
30131
30176
 
30132
30177
 
30133
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '15.2.1';
30178
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '15.3.0';
30134
30179
 
30135
30180
 
30136
30181