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/index.js CHANGED
@@ -923,6 +923,7 @@ const $3d106a0ee348cfa8$export$40141681ebb03523 = {
923
923
  * @param {Chord | null} chordObj Optional pre-parsed Chord object
924
924
  * @param {boolean} isRhythmSymbol Whether this pair represents a rhythm symbol
925
925
  */ constructor(chords = '', lyrics = null, annotation = null, chordObj = null, isRhythmSymbol = false){
926
+ this.parentLine = null;
926
927
  this._chordObj = null;
927
928
  this.chords = chords || '';
928
929
  this.lyrics = lyrics || '';
@@ -5133,6 +5134,7 @@ var $6c1ed1378c3b5965$export$2e2bcd8739ae039 = $6c1ed1378c3b5965$var$ChordDefini
5133
5134
  * Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview
5134
5135
  */ class $0bd084786477abba$var$Comment {
5135
5136
  constructor(content){
5137
+ this.parentLine = null;
5136
5138
  this.content = content;
5137
5139
  }
5138
5140
  /**
@@ -5157,6 +5159,7 @@ var $0bd084786477abba$export$2e2bcd8739ae039 = $0bd084786477abba$var$Comment;
5157
5159
 
5158
5160
  class $c5ce4fc4f57fe810$var$AstComponent {
5159
5161
  constructor(traceInfo = null){
5162
+ this.parentLine = null;
5160
5163
  this.line = null;
5161
5164
  this.column = null;
5162
5165
  this.offset = null;
@@ -6839,7 +6842,11 @@ var $3b7d86e1e1307736$export$2e2bcd8739ae039 = $3b7d86e1e1307736$var$Font;
6839
6842
  if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) this.addTag(item);
6840
6843
  else if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) this.addChordLyricsPair(item);
6841
6844
  else if (item instanceof (0, $0bd084786477abba$export$2e2bcd8739ae039)) this.addComment(item);
6842
- else this.items.push(item);
6845
+ else {
6846
+ const addedItem = item;
6847
+ addedItem.parentLine = this;
6848
+ this.items.push(addedItem);
6849
+ }
6843
6850
  }
6844
6851
  /**
6845
6852
  * Indicates whether the line contains items that are renderable
@@ -6908,6 +6915,7 @@ var $3b7d86e1e1307736$export$2e2bcd8739ae039 = $3b7d86e1e1307736$var$Font;
6908
6915
  addChordLyricsPair(chords = null, lyrics = null) {
6909
6916
  if (chords instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) this.currentChordLyricsPair = chords;
6910
6917
  else this.currentChordLyricsPair = new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords || '', lyrics || '');
6918
+ this.currentChordLyricsPair.parentLine = this;
6911
6919
  this.items.push(this.currentChordLyricsPair);
6912
6920
  return this.currentChordLyricsPair;
6913
6921
  }
@@ -6924,11 +6932,13 @@ var $3b7d86e1e1307736$export$2e2bcd8739ae039 = $3b7d86e1e1307736$var$Font;
6924
6932
  }
6925
6933
  addTag(nameOrTag, value = null) {
6926
6934
  const tag = nameOrTag instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) ? nameOrTag : new (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)(nameOrTag, value);
6935
+ tag.parentLine = this;
6927
6936
  this.items.push(tag);
6928
6937
  return tag;
6929
6938
  }
6930
6939
  addComment(content) {
6931
6940
  const comment = content instanceof (0, $0bd084786477abba$export$2e2bcd8739ae039) ? content : new (0, $0bd084786477abba$export$2e2bcd8739ae039)(content);
6941
+ comment.parentLine = this;
6932
6942
  this.items.push(comment);
6933
6943
  return comment;
6934
6944
  }
@@ -7606,6 +7616,7 @@ var $feda9c006f56d800$export$2e2bcd8739ae039 = $feda9c006f56d800$var$SongMapper;
7606
7616
 
7607
7617
 
7608
7618
 
7619
+
7609
7620
  const $e02a17f5a26edf19$var$defaultConstructorOptions = {
7610
7621
  capo: 0,
7611
7622
  contextKey: null,
@@ -8302,7 +8313,7 @@ function $4903bcb4483a26e6$export$9b09a67f52000acf(configuration) {
8302
8313
  });
8303
8314
  }
8304
8315
  if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return $c53141c05fae8382$var$Song.transposeChordLyricsPair(item, delta, transposedKey, normalizeChordSuffix, accidental);
8305
- if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039)) return $c53141c05fae8382$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
8316
+ if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039) && $c53141c05fae8382$var$Song.isMusicalSection(item.parentLine)) return $c53141c05fae8382$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
8306
8317
  return item;
8307
8318
  });
8308
8319
  }
@@ -8407,10 +8418,18 @@ function $4903bcb4483a26e6$export$9b09a67f52000acf(configuration) {
8407
8418
  changeChords(func) {
8408
8419
  return this.mapItems((item)=>{
8409
8420
  if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return item.changeChord(func);
8410
- if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039)) return $c53141c05fae8382$var$Song.mapChordsInLiteral(item, func);
8421
+ if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039) && $c53141c05fae8382$var$Song.isMusicalSection(item.parentLine)) return $c53141c05fae8382$var$Song.mapChordsInLiteral(item, func);
8411
8422
  return item;
8412
8423
  });
8413
8424
  }
8425
+ static isMusicalSection(line) {
8426
+ return line === null || ![
8427
+ (0, $dce48cb70c4120bb$export$92249c36c213e508),
8428
+ (0, $dce48cb70c4120bb$export$6a5a2eab72b6e3d),
8429
+ (0, $dce48cb70c4120bb$export$13f4b12aafeba5d6),
8430
+ (0, $dce48cb70c4120bb$export$5a2cf64ea612936a)
8431
+ ].includes(line.type);
8432
+ }
8414
8433
  static mapChordsInLiteral(item, func) {
8415
8434
  // Handle space-separated chords in grid format (e.g., "|| Am . . | C . |")
8416
8435
  const changedString = item.string.replace(/(\s|^)(\S+)(?=\s|$)/g, (_match, space, token)=>{
@@ -37876,7 +37895,7 @@ const $a5a21ced491ea51f$var$endSectionTags = {
37876
37895
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
37877
37896
 
37878
37897
 
37879
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '14.6.0';
37898
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '14.6.1';
37880
37899
 
37881
37900
 
37882
37901