chordsheetjs 14.3.1 → 14.4.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/bundle.js CHANGED
@@ -45766,6 +45766,76 @@ Or set the song key before changing key:
45766
45766
  }
45767
45767
  };
45768
45768
  var $957f29f677b8d58d$export$2e2bcd8739ae039 = $957f29f677b8d58d$var$ChordProParser;
45769
+ var $2da8d6b3c840ecd4$var$WIDE_RANGES = [
45770
+ [
45771
+ 4352,
45772
+ 4607
45773
+ ],
45774
+ [
45775
+ 11904,
45776
+ 40959
45777
+ ],
45778
+ [
45779
+ 12288,
45780
+ 12351
45781
+ ],
45782
+ [
45783
+ 12352,
45784
+ 12447
45785
+ ],
45786
+ [
45787
+ 12448,
45788
+ 12543
45789
+ ],
45790
+ [
45791
+ 44032,
45792
+ 55215
45793
+ ],
45794
+ [
45795
+ 63744,
45796
+ 64255
45797
+ ],
45798
+ [
45799
+ 65072,
45800
+ 65103
45801
+ ],
45802
+ [
45803
+ 65281,
45804
+ 65519
45805
+ ],
45806
+ [
45807
+ 131072,
45808
+ 195103
45809
+ ]
45810
+ ];
45811
+ function $2da8d6b3c840ecd4$export$e5cd96a5fcc7385e(ch) {
45812
+ const code = ch.charCodeAt(0);
45813
+ return $2da8d6b3c840ecd4$var$WIDE_RANGES.some(([lo, hi]) => code >= lo && code <= hi);
45814
+ }
45815
+ function $2da8d6b3c840ecd4$export$798c10ea30852970(lyricsLine) {
45816
+ const map = [];
45817
+ let visualColumn = 0;
45818
+ for (let characterIndex = 0; characterIndex < lyricsLine.length; characterIndex += 1) {
45819
+ const characterWidth = $2da8d6b3c840ecd4$export$e5cd96a5fcc7385e(lyricsLine[characterIndex]) ? 2 : 1;
45820
+ for (let column = 0; column < characterWidth; column += 1) {
45821
+ map[visualColumn] = characterIndex;
45822
+ visualColumn += 1;
45823
+ }
45824
+ }
45825
+ return map;
45826
+ }
45827
+ function $2da8d6b3c840ecd4$export$9f6ee93f4e2fb3d2(string) {
45828
+ const result = /(\s+)(\S+)/.exec(string);
45829
+ const secondWordPosition = result ? result.index + result[1].length : null;
45830
+ if (secondWordPosition && secondWordPosition !== -1) return [
45831
+ string.substring(0, secondWordPosition).trim(),
45832
+ string.substring(secondWordPosition)
45833
+ ];
45834
+ return [
45835
+ /.+\s+$/.test(string) ? `${string.trim()} ` : string,
45836
+ null
45837
+ ];
45838
+ }
45769
45839
  var $e136d63bbe28a4e0$var$WHITE_SPACE = /\s/;
45770
45840
  var $e136d63bbe28a4e0$var$CHORD_LINE_REGEX = /^\s*((([A-G|Do|Re|Mi|Fa|Sol|La|Si])(#|b)?([^/\s]*)(\/([A-G|Do|Re|Mi|Fa|Sol|La|Si])(#|b)?)?)(\s|$)+)+(\s|$)+/;
45771
45841
  var $e136d63bbe28a4e0$var$ChordSheetParser = class {
@@ -45840,9 +45910,9 @@ Or set the song key before changing key:
45840
45910
  return this.currentLine < this.lineCount;
45841
45911
  }
45842
45912
  parseLyricsWithChords(chordsLine, lyricsLine) {
45843
- this.processCharacters(chordsLine, lyricsLine);
45913
+ const consumedLyrics = this.processCharacters(chordsLine, lyricsLine);
45844
45914
  if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
45845
- this.chordLyricsPair.lyrics += lyricsLine.substring(chordsLine.length);
45915
+ this.chordLyricsPair.lyrics += lyricsLine.substring(consumedLyrics);
45846
45916
  this.chordLyricsPair.chords = this.chordLyricsPair.chords.trim();
45847
45917
  if (this.chordLyricsPair.lyrics) this.chordLyricsPair.lyrics = this.chordLyricsPair.lyrics.trim();
45848
45918
  if (!lyricsLine.trim().length) {
@@ -45851,15 +45921,23 @@ Or set the song key before changing key:
45851
45921
  }
45852
45922
  }
45853
45923
  processCharacters(chordsLine, lyricsLine) {
45924
+ const columnToLyricsIndex = (0, $2da8d6b3c840ecd4$export$798c10ea30852970)(lyricsLine);
45925
+ let lastLyricsIndex = -1;
45854
45926
  for (let c4 = 0, charCount = chordsLine.length; c4 < charCount; c4 += 1) {
45855
- const chr = chordsLine[c4];
45856
- const nextChar = chordsLine[c4 + 1];
45857
- const isWhiteSpace = $e136d63bbe28a4e0$var$WHITE_SPACE.test(chr);
45858
- this.addCharacter(chr, nextChar);
45859
- if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
45860
- this.chordLyricsPair.lyrics += lyricsLine[c4] || "";
45861
- this.processingText = !isWhiteSpace;
45927
+ this.addCharacter(chordsLine[c4], chordsLine[c4 + 1]);
45928
+ lastLyricsIndex = this.mapLyricsCharacter(columnToLyricsIndex, c4, lyricsLine, lastLyricsIndex);
45929
+ this.processingText = !$e136d63bbe28a4e0$var$WHITE_SPACE.test(chordsLine[c4]);
45862
45930
  }
45931
+ return lastLyricsIndex >= 0 ? lastLyricsIndex + 1 : 0;
45932
+ }
45933
+ mapLyricsCharacter(columnMap, column, lyricsLine, lastIndex) {
45934
+ if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
45935
+ const lyricsIndex = columnMap[column];
45936
+ if (lyricsIndex !== void 0 && lyricsIndex !== lastIndex) {
45937
+ this.chordLyricsPair.lyrics += lyricsLine[lyricsIndex];
45938
+ return lyricsIndex;
45939
+ }
45940
+ return lastIndex;
45863
45941
  }
45864
45942
  addCharacter(chr, nextChar) {
45865
45943
  const isWhiteSpace = $e136d63bbe28a4e0$var$WHITE_SPACE.test(chr);
@@ -46312,18 +46390,6 @@ Or set the song key before changing key:
46312
46390
  }
46313
46391
  };
46314
46392
  var $2d92af868d7c705a$export$2e2bcd8739ae039 = $2d92af868d7c705a$var$ChordsOverWordsFormatter;
46315
- function $2da8d6b3c840ecd4$export$9f6ee93f4e2fb3d2(string) {
46316
- const result = /(\s+)(\S+)/.exec(string);
46317
- const secondWordPosition = result ? result.index + result[1].length : null;
46318
- if (secondWordPosition && secondWordPosition !== -1) return [
46319
- string.substring(0, secondWordPosition).trim(),
46320
- string.substring(secondWordPosition)
46321
- ];
46322
- return [
46323
- /.+\s+$/.test(string) ? `${string.trim()} ` : string,
46324
- null
46325
- ];
46326
- }
46327
46393
  function $7270482b3072811c$var$combineChordSheetLines(newLine, lines, trailingLine) {
46328
46394
  const hasEmptyLine = newLine && newLine.length > 0;
46329
46395
  const emptyLines = hasEmptyLine ? [
@@ -69746,23 +69812,22 @@ AjwCRQJ5AAAAAAABAAAAANpTmfAAAAAA0e+yRgAAAADR77JG
69746
69812
  this.applyRepeatNotation();
69747
69813
  }
69748
69814
  parseLyricsWithChords(chordsLine, lyricsLine) {
69749
- this.processCharacters(chordsLine, lyricsLine);
69815
+ const consumedLyrics = this.processCharacters(chordsLine, lyricsLine);
69750
69816
  if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
69751
- this.chordLyricsPair.lyrics += lyricsLine.substring(chordsLine.length);
69817
+ this.chordLyricsPair.lyrics += lyricsLine.substring(consumedLyrics);
69752
69818
  this.chordLyricsPair.chords = this.chordLyricsPair.chords.trim();
69753
69819
  if (this.chordLyricsPair.lyrics) this.chordLyricsPair.lyrics = this.chordLyricsPair.lyrics.trim();
69754
69820
  this.applyRepeatNotation();
69755
69821
  }
69756
69822
  processCharacters(chordsLine, lyricsLine) {
69823
+ const columnToLyricsIndex = (0, $2da8d6b3c840ecd4$export$798c10ea30852970)(lyricsLine);
69824
+ let lastLyricsIndex = -1;
69757
69825
  for (let c4 = 0, charCount = chordsLine.length; c4 < charCount; c4 += 1) {
69758
- const chr = chordsLine[c4];
69759
- const nextChar = chordsLine[c4 + 1];
69760
- const isWhiteSpace = /\s/.test(chr);
69761
- this.addCharacter(chr, nextChar);
69762
- if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
69763
- this.chordLyricsPair.lyrics += lyricsLine[c4] || "";
69764
- this.processingText = !isWhiteSpace;
69826
+ this.addCharacter(chordsLine[c4], chordsLine[c4 + 1]);
69827
+ lastLyricsIndex = this.mapLyricsCharacter(columnToLyricsIndex, c4, lyricsLine, lastLyricsIndex);
69828
+ this.processingText = !/\s/.test(chordsLine[c4]);
69765
69829
  }
69830
+ return lastLyricsIndex >= 0 ? lastLyricsIndex + 1 : 0;
69766
69831
  }
69767
69832
  addCharacter(chr, nextChar) {
69768
69833
  const isWhiteSpace = /\s/.test(chr);
@@ -69887,7 +69952,7 @@ AjwCRQJ5AAAAAAABAAAAANpTmfAAAAAA0e+yRgAAAADR77JG
69887
69952
  }
69888
69953
  };
69889
69954
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
69890
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "14.3.1";
69955
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "14.4.0";
69891
69956
  var $a3816b486f741c00$exports = {};
69892
69957
  var $892913528e7f60f9$export$2e2bcd8739ae039 = {
69893
69958
  CHORUS: $dce48cb70c4120bb$export$8db6c706fc9142b2,