chordsheetjs 14.6.0 → 14.6.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/module.js CHANGED
@@ -841,6 +841,7 @@ const $0cb401ed3f1d0550$export$40141681ebb03523 = {
841
841
  * @param {Chord | null} chordObj Optional pre-parsed Chord object
842
842
  * @param {boolean} isRhythmSymbol Whether this pair represents a rhythm symbol
843
843
  */ constructor(chords = '', lyrics = null, annotation = null, chordObj = null, isRhythmSymbol = false){
844
+ this.parentLine = null;
844
845
  this._chordObj = null;
845
846
  this.chords = chords || '';
846
847
  this.lyrics = lyrics || '';
@@ -5051,6 +5052,7 @@ var $7494e305d9bdc641$export$2e2bcd8739ae039 = $7494e305d9bdc641$var$ChordDefini
5051
5052
  * Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview
5052
5053
  */ class $acbb1127ce68c11a$var$Comment {
5053
5054
  constructor(content){
5055
+ this.parentLine = null;
5054
5056
  this.content = content;
5055
5057
  }
5056
5058
  /**
@@ -5075,6 +5077,7 @@ var $acbb1127ce68c11a$export$2e2bcd8739ae039 = $acbb1127ce68c11a$var$Comment;
5075
5077
 
5076
5078
  class $9be84d5515dccc21$var$AstComponent {
5077
5079
  constructor(traceInfo = null){
5080
+ this.parentLine = null;
5078
5081
  this.line = null;
5079
5082
  this.column = null;
5080
5083
  this.offset = null;
@@ -6757,7 +6760,11 @@ var $7011f990fc73fda8$export$2e2bcd8739ae039 = $7011f990fc73fda8$var$Font;
6757
6760
  if (item instanceof (0, $b58c551853385714$export$2e2bcd8739ae039)) this.addTag(item);
6758
6761
  else if (item instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) this.addChordLyricsPair(item);
6759
6762
  else if (item instanceof (0, $acbb1127ce68c11a$export$2e2bcd8739ae039)) this.addComment(item);
6760
- else this.items.push(item);
6763
+ else {
6764
+ const addedItem = item;
6765
+ addedItem.parentLine = this;
6766
+ this.items.push(addedItem);
6767
+ }
6761
6768
  }
6762
6769
  /**
6763
6770
  * Indicates whether the line contains items that are renderable
@@ -6826,6 +6833,7 @@ var $7011f990fc73fda8$export$2e2bcd8739ae039 = $7011f990fc73fda8$var$Font;
6826
6833
  addChordLyricsPair(chords = null, lyrics = null) {
6827
6834
  if (chords instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) this.currentChordLyricsPair = chords;
6828
6835
  else this.currentChordLyricsPair = new (0, $0d04ced54ebef610$export$2e2bcd8739ae039)(chords || '', lyrics || '');
6836
+ this.currentChordLyricsPair.parentLine = this;
6829
6837
  this.items.push(this.currentChordLyricsPair);
6830
6838
  return this.currentChordLyricsPair;
6831
6839
  }
@@ -6842,11 +6850,13 @@ var $7011f990fc73fda8$export$2e2bcd8739ae039 = $7011f990fc73fda8$var$Font;
6842
6850
  }
6843
6851
  addTag(nameOrTag, value = null) {
6844
6852
  const tag = nameOrTag instanceof (0, $b58c551853385714$export$2e2bcd8739ae039) ? nameOrTag : new (0, $b58c551853385714$export$2e2bcd8739ae039)(nameOrTag, value);
6853
+ tag.parentLine = this;
6845
6854
  this.items.push(tag);
6846
6855
  return tag;
6847
6856
  }
6848
6857
  addComment(content) {
6849
6858
  const comment = content instanceof (0, $acbb1127ce68c11a$export$2e2bcd8739ae039) ? content : new (0, $acbb1127ce68c11a$export$2e2bcd8739ae039)(content);
6859
+ comment.parentLine = this;
6850
6860
  this.items.push(comment);
6851
6861
  return comment;
6852
6862
  }
@@ -7524,6 +7534,7 @@ var $f548c8fca0a868b3$export$2e2bcd8739ae039 = $f548c8fca0a868b3$var$SongMapper;
7524
7534
 
7525
7535
 
7526
7536
 
7537
+
7527
7538
  const $3d08fc52230ec46a$var$defaultConstructorOptions = {
7528
7539
  capo: 0,
7529
7540
  contextKey: null,
@@ -8220,7 +8231,7 @@ function $05ed9bcf33bcd31b$export$9b09a67f52000acf(configuration) {
8220
8231
  });
8221
8232
  }
8222
8233
  if (item instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) return $962eb86a322c5cfb$var$Song.transposeChordLyricsPair(item, delta, transposedKey, normalizeChordSuffix, accidental);
8223
- if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039)) return $962eb86a322c5cfb$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
8234
+ if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039) && $962eb86a322c5cfb$var$Song.isMusicalSection(item.parentLine)) return $962eb86a322c5cfb$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
8224
8235
  return item;
8225
8236
  });
8226
8237
  }
@@ -8325,10 +8336,18 @@ function $05ed9bcf33bcd31b$export$9b09a67f52000acf(configuration) {
8325
8336
  changeChords(func) {
8326
8337
  return this.mapItems((item)=>{
8327
8338
  if (item instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) return item.changeChord(func);
8328
- if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039)) return $962eb86a322c5cfb$var$Song.mapChordsInLiteral(item, func);
8339
+ if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039) && $962eb86a322c5cfb$var$Song.isMusicalSection(item.parentLine)) return $962eb86a322c5cfb$var$Song.mapChordsInLiteral(item, func);
8329
8340
  return item;
8330
8341
  });
8331
8342
  }
8343
+ static isMusicalSection(line) {
8344
+ return line === null || ![
8345
+ (0, $72b24102c7d826fd$export$92249c36c213e508),
8346
+ (0, $72b24102c7d826fd$export$6a5a2eab72b6e3d),
8347
+ (0, $72b24102c7d826fd$export$13f4b12aafeba5d6),
8348
+ (0, $72b24102c7d826fd$export$5a2cf64ea612936a)
8349
+ ].includes(line.type);
8350
+ }
8332
8351
  static mapChordsInLiteral(item, func) {
8333
8352
  // Handle space-separated chords in grid format (e.g., "|| Am . . | C . |")
8334
8353
  const changedString = item.string.replace(/(\s|^)(\S+)(?=\s|$)/g, (_match, space, token)=>{
@@ -37794,7 +37813,7 @@ const $ecd3f348894bfbde$var$endSectionTags = {
37794
37813
  var $ecd3f348894bfbde$export$2e2bcd8739ae039 = $ecd3f348894bfbde$var$UltimateGuitarParser;
37795
37814
 
37796
37815
 
37797
- var $a91afe1497b28cb4$export$2e2bcd8739ae039 = '14.6.0';
37816
+ var $a91afe1497b28cb4$export$2e2bcd8739ae039 = '14.6.1';
37798
37817
 
37799
37818
 
37800
37819