chordsheetjs 15.2.1 → 15.3.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
@@ -5531,6 +5531,7 @@ ${error.stack}`);
5531
5531
  key: null,
5532
5532
  metadata: $287d3e472e1fbd90$export$a014e67b549cbef4,
5533
5533
  normalizeChords: true,
5534
+ normalizeChordSuffix: true,
5534
5535
  useUnicodeModifiers: false,
5535
5536
  user: null
5536
5537
  };
@@ -6278,6 +6279,9 @@ ${error.stack}`);
6278
6279
  * @param {boolean} [configuration.useUnicodeModifiers=false] Whether or not to use unicode flat and sharp
6279
6280
  * symbols.
6280
6281
  * @param {boolean} [configuration.normalizeChords=true] Whether or not to automatically normalize chords
6282
+ * @param {boolean} [configuration.normalizeChordSuffix=true] Whether to normalize chord suffixes (e.g.
6283
+ * `sus2` to `2`, `maj7` to `ma7`). Only takes effect when `normalizeChords` is `true`. Defaults to `false`
6284
+ * for {@link ChordProFormatter} so ChordPro round-trips preserve the user's suffix variant.
6281
6285
  */
6282
6286
  constructor(configuration = {}) {
6283
6287
  const defaultConfig = this.getDefaultConfiguration();
@@ -6414,6 +6418,12 @@ ${error.stack}`);
6414
6418
  };
6415
6419
  var $15f1d40e3d1ed3a0$export$2e2bcd8739ae039 = $15f1d40e3d1ed3a0$var$Ternary;
6416
6420
  var $244a67400187e14e$var$ChordProFormatter = class extends (0, $ed0d9ddbbe7224cd$export$2e2bcd8739ae039) {
6421
+ getDefaultConfiguration() {
6422
+ return {
6423
+ ...(0, $fe1d3ba9df1ecad5$export$cb4529290f33d264)(),
6424
+ normalizeChordSuffix: false
6425
+ };
6426
+ }
6417
6427
  /**
6418
6428
  * Formats a song into a ChordPro chord sheet.
6419
6429
  * @param {Song} song The song to be formatted
@@ -6539,7 +6549,9 @@ ${formattedContentLines}`;
6539
6549
  if (chordLyricsPair.chords) {
6540
6550
  const chordObj = chordLyricsPair.chord;
6541
6551
  if (!chordObj) return `[${chordLyricsPair.chords}]`;
6542
- const finalChord = this.configuration.normalizeChords ? chordObj.normalize() : chordObj;
6552
+ const finalChord = this.configuration.normalizeChords ? chordObj.normalize(null, {
6553
+ normalizeSuffix: this.configuration.normalizeChordSuffix
6554
+ }) : chordObj;
6543
6555
  return `[${finalChord}]`;
6544
6556
  }
6545
6557
  if (chordLyricsPair.annotation) return `[*${chordLyricsPair.annotation}]`;
@@ -7399,6 +7411,7 @@ ${formattedContentLines}`;
7399
7411
  contextKey: null,
7400
7412
  decapo: false,
7401
7413
  normalizeChords: true,
7414
+ normalizeChordSuffix: true,
7402
7415
  renderKey: null,
7403
7416
  songKey: null,
7404
7417
  style: null,
@@ -7414,6 +7427,7 @@ ${formattedContentLines}`;
7414
7427
  this.capo = config.decapo ? config.capo : 0;
7415
7428
  this.contextKey = config.contextKey;
7416
7429
  this.normalizeChords = config.normalizeChords;
7430
+ this.normalizeChordSuffix = config.normalizeChordSuffix;
7417
7431
  this.renderKey = config.renderKey;
7418
7432
  this.songKey = config.songKey;
7419
7433
  this.style = config.style;
@@ -7426,7 +7440,9 @@ ${formattedContentLines}`;
7426
7440
  return (0, $28a2fcb6fb95a147$export$79570e60478bce41)(chord, [
7427
7441
  (c) => c.transpose(this.effectiveTransposeDistance),
7428
7442
  (c) => this.accidental ? c.useAccidental(this.accidental) : c,
7429
- (c) => this.normalizeChords ? c.normalize(this.effectiveKey) : c,
7443
+ (c) => this.normalizeChords ? c.normalize(this.effectiveKey, {
7444
+ normalizeSuffix: this.normalizeChordSuffix
7445
+ }) : c,
7430
7446
  (c) => this.changeChordType(c)
7431
7447
  ]).toString({
7432
7448
  useUnicodeModifier: this.useUnicodeModifier
@@ -7820,13 +7836,25 @@ ${formattedContentLines}`;
7820
7836
  if (/^\d+$/.test(transposeKey)) return parseInt(transposeKey, 10);
7821
7837
  return (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(songKey, transposeKey);
7822
7838
  }
7823
- function $2ce1086ce25c9ac0$export$596ec52955da9472(chordString, line, song, { renderKey = null, useUnicodeModifier = false, normalizeChords = true, decapo = false } = {}) {
7839
+ var $2ce1086ce25c9ac0$var$renderChordDefaults = {
7840
+ renderKey: null,
7841
+ useUnicodeModifier: false,
7842
+ normalizeChords: true,
7843
+ normalizeChordSuffix: true,
7844
+ decapo: false
7845
+ };
7846
+ function $2ce1086ce25c9ac0$export$596ec52955da9472(chordString, line, song, options = {}) {
7847
+ const { renderKey, useUnicodeModifier, normalizeChords, normalizeChordSuffix, decapo } = {
7848
+ ...$2ce1086ce25c9ac0$var$renderChordDefaults,
7849
+ ...options
7850
+ };
7824
7851
  const capoString = song.metadata.getSingle((0, $d21c5c7a462f3c34$export$866f445d49bad88e));
7825
7852
  return new (0, $e02a17f5a26edf19$export$2e2bcd8739ae039)({
7826
7853
  capo: capoString ? parseInt(capoString, 10) : 0,
7827
7854
  contextKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(line.key || song.key),
7828
7855
  decapo,
7829
7856
  normalizeChords,
7857
+ normalizeChordSuffix,
7830
7858
  renderKey,
7831
7859
  songKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(song.key),
7832
7860
  style: song.metadata.getSingle((0, $d21c5c7a462f3c34$export$d8cbdf44b1f66df1)),
@@ -13698,6 +13726,7 @@ Or set the song key before changing key:
13698
13726
  return (0, $2ce1086ce25c9ac0$export$596ec52955da9472)(item.chords, line, this.song, {
13699
13727
  renderKey: this.configuration.key,
13700
13728
  normalizeChords: this.configuration.normalizeChords,
13729
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
13701
13730
  decapo: this.configuration.decapo
13702
13731
  });
13703
13732
  }
@@ -26184,6 +26213,7 @@ Or set the song key before changing key:
26184
26213
  renderKey: key,
26185
26214
  useUnicodeModifier: configuration.useUnicodeModifiers,
26186
26215
  normalizeChords: configuration.normalizeChords,
26216
+ normalizeChordSuffix: configuration.normalizeChordSuffix,
26187
26217
  decapo: configuration.decapo
26188
26218
  })}
26189
26219
  </div>
@@ -26350,6 +26380,7 @@ Or set the song key before changing key:
26350
26380
  renderKey: key,
26351
26381
  useUnicodeModifier: configuration.useUnicodeModifiers,
26352
26382
  normalizeChords: configuration.normalizeChords,
26383
+ normalizeChordSuffix: configuration.normalizeChordSuffix,
26353
26384
  decapo: configuration.decapo
26354
26385
  })}</td>
26355
26386
  `;
@@ -27188,6 +27219,7 @@ Or set the song key before changing key:
27188
27219
  renderKey: this.configuration.key,
27189
27220
  useUnicodeModifier: this.configuration.useUnicodeModifiers,
27190
27221
  normalizeChords: this.configuration.normalizeChords,
27222
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
27191
27223
  decapo: this.configuration.decapo
27192
27224
  });
27193
27225
  return chords;
@@ -28338,6 +28370,7 @@ ${template}
28338
28370
  renderKey: null,
28339
28371
  useUnicodeModifier: this.config.useUnicodeModifiers,
28340
28372
  normalizeChords: this.config.normalizeChords,
28373
+ normalizeChordSuffix: this.config.normalizeChordSuffix,
28341
28374
  decapo: this.config.decapo
28342
28375
  });
28343
28376
  }
@@ -29336,6 +29369,7 @@ ${template}
29336
29369
  linePadding: this.configuration.layout.sections.global.linePadding,
29337
29370
  useUnicodeModifiers: this.configuration.useUnicodeModifiers,
29338
29371
  normalizeChords: this.configuration.normalizeChords,
29372
+ normalizeChordSuffix: this.configuration.normalizeChordSuffix,
29339
29373
  // Column and page layout information
29340
29374
  minY: dimensions.minY,
29341
29375
  columnWidth: dimensions.columnWidth,
@@ -29584,7 +29618,7 @@ ${template}
29584
29618
  }
29585
29619
  };
29586
29620
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
29587
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "15.2.1";
29621
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "15.3.1";
29588
29622
  var $2a7926da41d163b3$export$191a710ad3c9a989 = {
29589
29623
  configure: $181068e44290b873$export$8d21e34596265fa2,
29590
29624
  getDefaultConfig: $fe1d3ba9df1ecad5$export$ed30944e0fe6ae5c,