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/pdf/index.js CHANGED
@@ -746,6 +746,7 @@ const $8c370f6299188657$export$82f9bd327a40ea54 = {
746
746
  key: null,
747
747
  metadata: $8c370f6299188657$export$a014e67b549cbef4,
748
748
  normalizeChords: true,
749
+ normalizeChordSuffix: true,
749
750
  useUnicodeModifiers: false,
750
751
  user: null
751
752
  };
@@ -13942,6 +13943,7 @@ const $c2be399211dfbcbd$var$defaultConstructorOptions = {
13942
13943
  contextKey: null,
13943
13944
  decapo: false,
13944
13945
  normalizeChords: true,
13946
+ normalizeChordSuffix: true,
13945
13947
  renderKey: null,
13946
13948
  songKey: null,
13947
13949
  style: null,
@@ -13957,6 +13959,7 @@ class $c2be399211dfbcbd$var$ChordRenderer {
13957
13959
  this.capo = config.decapo ? config.capo : 0;
13958
13960
  this.contextKey = config.contextKey;
13959
13961
  this.normalizeChords = config.normalizeChords;
13962
+ this.normalizeChordSuffix = config.normalizeChordSuffix;
13960
13963
  this.renderKey = config.renderKey;
13961
13964
  this.songKey = config.songKey;
13962
13965
  this.style = config.style;
@@ -13969,7 +13972,9 @@ class $c2be399211dfbcbd$var$ChordRenderer {
13969
13972
  return (0, $21a34a464e7bc609$export$79570e60478bce41)(chord, [
13970
13973
  (c)=>c.transpose(this.effectiveTransposeDistance),
13971
13974
  (c)=>this.accidental ? c.useAccidental(this.accidental) : c,
13972
- (c)=>this.normalizeChords ? c.normalize(this.effectiveKey) : c,
13975
+ (c)=>this.normalizeChords ? c.normalize(this.effectiveKey, {
13976
+ normalizeSuffix: this.normalizeChordSuffix
13977
+ }) : c,
13973
13978
  (c)=>this.changeChordType(c)
13974
13979
  ]).toString({
13975
13980
  useUnicodeModifier: this.useUnicodeModifier
@@ -14369,13 +14374,38 @@ function $dfecd32049fa58e9$export$fd31a53e6281557e(transposeKey, songKey) {
14369
14374
  if (/^\d+$/.test(transposeKey)) return parseInt(transposeKey, 10);
14370
14375
  return (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).distance(songKey, transposeKey);
14371
14376
  }
14372
- function $dfecd32049fa58e9$export$596ec52955da9472(chordString, line, song, { renderKey: renderKey = null, useUnicodeModifier: useUnicodeModifier = false, normalizeChords: normalizeChords = true, decapo: decapo = false } = {}) {
14377
+ /**
14378
+ * Renders a chord in the context of a line and song and taking into account some options
14379
+ * @param chordString The chord to render
14380
+ * @param line The line the chord is in
14381
+ * @param song The song the line is in
14382
+ * @param renderKey The key to render the chord in. If not provided, the line key will be used,
14383
+ * or the song key if the line key is not provided.
14384
+ * @param useUnicodeModifier Whether to use unicode modifiers ('\u266f'/'\u266d') or plain text ('#'/'b').
14385
+ * Default `false`.
14386
+ * @param normalizeChords Whether to normalize the chord to the key (default `true`)
14387
+ * @param normalizeChordSuffix Whether to normalize the chord suffix (e.g. `sus2` to `2`, `maj7` to `ma7`).
14388
+ * Only takes effect when `normalizeChords` is `true`. Default `true`.
14389
+ * @param decapo Whether to transpose all chords to eliminate the capo (default `false`)
14390
+ */ const $dfecd32049fa58e9$var$renderChordDefaults = {
14391
+ renderKey: null,
14392
+ useUnicodeModifier: false,
14393
+ normalizeChords: true,
14394
+ normalizeChordSuffix: true,
14395
+ decapo: false
14396
+ };
14397
+ function $dfecd32049fa58e9$export$596ec52955da9472(chordString, line, song, options = {}) {
14398
+ const { renderKey: renderKey, useUnicodeModifier: useUnicodeModifier, normalizeChords: normalizeChords, normalizeChordSuffix: normalizeChordSuffix, decapo: decapo } = {
14399
+ ...$dfecd32049fa58e9$var$renderChordDefaults,
14400
+ ...options
14401
+ };
14373
14402
  const capoString = song.metadata.getSingle((0, $b8d0f3e3723cd084$export$866f445d49bad88e));
14374
14403
  return new (0, $c2be399211dfbcbd$export$2e2bcd8739ae039)({
14375
14404
  capo: capoString ? parseInt(capoString, 10) : 0,
14376
14405
  contextKey: (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(line.key || song.key),
14377
14406
  decapo: decapo,
14378
14407
  normalizeChords: normalizeChords,
14408
+ normalizeChordSuffix: normalizeChordSuffix,
14379
14409
  renderKey: renderKey,
14380
14410
  songKey: (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(song.key),
14381
14411
  style: song.metadata.getSingle((0, $b8d0f3e3723cd084$export$d8cbdf44b1f66df1)),
@@ -21151,9 +21181,16 @@ var $5dfeb7121ee98007$export$2e2bcd8739ae039 = $5dfeb7121ee98007$var$When;
21151
21181
 
21152
21182
 
21153
21183
 
21184
+
21154
21185
  /**
21155
21186
  * Formats a song into a ChordPro chord sheet
21156
21187
  */ class $b601b9602157ea5f$var$ChordProFormatter extends (0, $0055ecb09272ba2d$export$2e2bcd8739ae039) {
21188
+ getDefaultConfiguration() {
21189
+ return {
21190
+ ...(0, $34c988d232665944$export$cb4529290f33d264)(),
21191
+ normalizeChordSuffix: false
21192
+ };
21193
+ }
21157
21194
  /**
21158
21195
  * Formats a song into a ChordPro chord sheet.
21159
21196
  * @param {Song} song The song to be formatted
@@ -21279,7 +21316,9 @@ var $5dfeb7121ee98007$export$2e2bcd8739ae039 = $5dfeb7121ee98007$var$When;
21279
21316
  if (chordLyricsPair.chords) {
21280
21317
  const chordObj = chordLyricsPair.chord;
21281
21318
  if (!chordObj) return `[${chordLyricsPair.chords}]`;
21282
- const finalChord = this.configuration.normalizeChords ? chordObj.normalize() : chordObj;
21319
+ const finalChord = this.configuration.normalizeChords ? chordObj.normalize(null, {
21320
+ normalizeSuffix: this.configuration.normalizeChordSuffix
21321
+ }) : chordObj;
21283
21322
  return `[${finalChord}]`;
21284
21323
  }
21285
21324
  if (chordLyricsPair.annotation) return `[*${chordLyricsPair.annotation}]`;
@@ -21596,6 +21635,7 @@ var $c049675f48c823b2$export$2e2bcd8739ae039 = $c049675f48c823b2$var$ChordSheetP
21596
21635
  return (0, $dfecd32049fa58e9$export$596ec52955da9472)(item.chords, line, this.song, {
21597
21636
  renderKey: this.configuration.key,
21598
21637
  normalizeChords: this.configuration.normalizeChords,
21638
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
21599
21639
  decapo: this.configuration.decapo
21600
21640
  });
21601
21641
  }
@@ -34141,6 +34181,7 @@ var $93f055b77b2d269f$export$2e2bcd8739ae039 = ({ configuration: configuration,
34141
34181
  renderKey: key,
34142
34182
  useUnicodeModifier: configuration.useUnicodeModifiers,
34143
34183
  normalizeChords: configuration.normalizeChords,
34184
+ normalizeChordSuffix: configuration.normalizeChordSuffix,
34144
34185
  decapo: configuration.decapo
34145
34186
  })}
34146
34187
  </div>
@@ -34340,6 +34381,7 @@ var $5381a6b1b90601c7$export$2e2bcd8739ae039 = ({ configuration: configuration,
34340
34381
  renderKey: key,
34341
34382
  useUnicodeModifier: configuration.useUnicodeModifiers,
34342
34383
  normalizeChords: configuration.normalizeChords,
34384
+ normalizeChordSuffix: configuration.normalizeChordSuffix,
34343
34385
  decapo: configuration.decapo
34344
34386
  })}</td>
34345
34387
  `;
@@ -35800,6 +35842,7 @@ class $2f9d0306025b5d6b$export$e6ce86b8bc39728b {
35800
35842
  renderKey: null,
35801
35843
  useUnicodeModifier: this.config.useUnicodeModifiers,
35802
35844
  normalizeChords: this.config.normalizeChords,
35845
+ normalizeChordSuffix: this.config.normalizeChordSuffix,
35803
35846
  decapo: this.config.decapo
35804
35847
  });
35805
35848
  }
@@ -36876,6 +36919,7 @@ class $b507f24a204c2802$export$12b762d1038ddc6b {
36876
36919
  linePadding: this.configuration.layout.sections.global.linePadding,
36877
36920
  useUnicodeModifiers: this.configuration.useUnicodeModifiers,
36878
36921
  normalizeChords: this.configuration.normalizeChords,
36922
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
36879
36923
  // Column and page layout information
36880
36924
  minY: dimensions.minY,
36881
36925
  columnWidth: dimensions.columnWidth,
@@ -37141,7 +37185,7 @@ const $db9c80925e255cd2$var$endSectionTags = {
37141
37185
  var $db9c80925e255cd2$export$2e2bcd8739ae039 = $db9c80925e255cd2$var$UltimateGuitarParser;
37142
37186
 
37143
37187
 
37144
- var $7491059d3a8d9eaa$export$2e2bcd8739ae039 = '15.2.1';
37188
+ var $7491059d3a8d9eaa$export$2e2bcd8739ae039 = '15.3.0';
37145
37189
 
37146
37190
 
37147
37191
 
@@ -37417,6 +37461,7 @@ var $376e205ced98486b$export$2e2bcd8739ae039 = {
37417
37461
  renderKey: this.configuration.key,
37418
37462
  useUnicodeModifier: this.configuration.useUnicodeModifiers,
37419
37463
  normalizeChords: this.configuration.normalizeChords,
37464
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
37420
37465
  decapo: this.configuration.decapo
37421
37466
  });
37422
37467
  return chords;
@@ -37878,6 +37923,7 @@ var $5751ce07ce8c1517$export$2e2bcd8739ae039 = $5751ce07ce8c1517$var$JsPdfRender
37878
37923
  linePadding: this.configuration.layout.sections.global.linePadding,
37879
37924
  useUnicodeModifiers: this.configuration.useUnicodeModifiers,
37880
37925
  normalizeChords: this.configuration.normalizeChords,
37926
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
37881
37927
  // Column and page layout information
37882
37928
  minY: dimensions.minY,
37883
37929
  columnWidth: dimensions.columnWidth,