chordsheetjs 14.3.0 → 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
@@ -38445,13 +38445,21 @@ ${error.stack}`);
38445
38445
  return ($7251dad5f4a4c35f$var$DIRECTIVES_WITH_RENDERABLE_LABEL.includes(this.name) || this.isSectionStart()) && this.hasLabel();
38446
38446
  }
38447
38447
  /**
38448
- * Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`)
38448
+ * Checks whether the tag is a standard meta tag, a custom meta directive (`{x_some_name}`)
38449
+ * or a non-standard meta tag (`{meta: name value}`)
38449
38450
  * @returns {boolean}
38450
38451
  */
38451
38452
  isMetaTag() {
38452
38453
  return this._isMetaTag || $7251dad5f4a4c35f$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name) || $7251dad5f4a4c35f$export$57ecf0dc09effb3.indexOf(this.name) !== -1;
38453
38454
  }
38454
38455
  /**
38456
+ * Checks whether this tag is a standard meta tag or a custom meta directive (`{x_some_name}`)
38457
+ * @returns {boolean}
38458
+ */
38459
+ isStandardOrCustomMetaTag() {
38460
+ return $7251dad5f4a4c35f$export$57ecf0dc09effb3.indexOf(this.name) !== -1 || $7251dad5f4a4c35f$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name);
38461
+ }
38462
+ /**
38455
38463
  * Returns a clone of the tag.
38456
38464
  * @returns {Tag} The cloned tag
38457
38465
  */
@@ -39224,6 +39232,7 @@ ${error.stack}`);
39224
39232
  formatMetadataSection(metadataLines) {
39225
39233
  return metadataLines.map((line) => {
39226
39234
  const tag = line.items[0];
39235
+ if (!tag.isStandardOrCustomMetaTag()) return `{meta: ${tag.originalName} ${tag.value}}`;
39227
39236
  return this.formatTag(tag);
39228
39237
  });
39229
39238
  }
@@ -45757,6 +45766,76 @@ Or set the song key before changing key:
45757
45766
  }
45758
45767
  };
45759
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
+ }
45760
45839
  var $e136d63bbe28a4e0$var$WHITE_SPACE = /\s/;
45761
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|$)+/;
45762
45841
  var $e136d63bbe28a4e0$var$ChordSheetParser = class {
@@ -45831,9 +45910,9 @@ Or set the song key before changing key:
45831
45910
  return this.currentLine < this.lineCount;
45832
45911
  }
45833
45912
  parseLyricsWithChords(chordsLine, lyricsLine) {
45834
- this.processCharacters(chordsLine, lyricsLine);
45913
+ const consumedLyrics = this.processCharacters(chordsLine, lyricsLine);
45835
45914
  if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
45836
- this.chordLyricsPair.lyrics += lyricsLine.substring(chordsLine.length);
45915
+ this.chordLyricsPair.lyrics += lyricsLine.substring(consumedLyrics);
45837
45916
  this.chordLyricsPair.chords = this.chordLyricsPair.chords.trim();
45838
45917
  if (this.chordLyricsPair.lyrics) this.chordLyricsPair.lyrics = this.chordLyricsPair.lyrics.trim();
45839
45918
  if (!lyricsLine.trim().length) {
@@ -45842,15 +45921,23 @@ Or set the song key before changing key:
45842
45921
  }
45843
45922
  }
45844
45923
  processCharacters(chordsLine, lyricsLine) {
45924
+ const columnToLyricsIndex = (0, $2da8d6b3c840ecd4$export$798c10ea30852970)(lyricsLine);
45925
+ let lastLyricsIndex = -1;
45845
45926
  for (let c4 = 0, charCount = chordsLine.length; c4 < charCount; c4 += 1) {
45846
- const chr = chordsLine[c4];
45847
- const nextChar = chordsLine[c4 + 1];
45848
- const isWhiteSpace = $e136d63bbe28a4e0$var$WHITE_SPACE.test(chr);
45849
- this.addCharacter(chr, nextChar);
45850
- if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
45851
- this.chordLyricsPair.lyrics += lyricsLine[c4] || "";
45852
- 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]);
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;
45853
45939
  }
45940
+ return lastIndex;
45854
45941
  }
45855
45942
  addCharacter(chr, nextChar) {
45856
45943
  const isWhiteSpace = $e136d63bbe28a4e0$var$WHITE_SPACE.test(chr);
@@ -46303,18 +46390,6 @@ Or set the song key before changing key:
46303
46390
  }
46304
46391
  };
46305
46392
  var $2d92af868d7c705a$export$2e2bcd8739ae039 = $2d92af868d7c705a$var$ChordsOverWordsFormatter;
46306
- function $2da8d6b3c840ecd4$export$9f6ee93f4e2fb3d2(string) {
46307
- const result = /(\s+)(\S+)/.exec(string);
46308
- const secondWordPosition = result ? result.index + result[1].length : null;
46309
- if (secondWordPosition && secondWordPosition !== -1) return [
46310
- string.substring(0, secondWordPosition).trim(),
46311
- string.substring(secondWordPosition)
46312
- ];
46313
- return [
46314
- /.+\s+$/.test(string) ? `${string.trim()} ` : string,
46315
- null
46316
- ];
46317
- }
46318
46393
  function $7270482b3072811c$var$combineChordSheetLines(newLine, lines, trailingLine) {
46319
46394
  const hasEmptyLine = newLine && newLine.length > 0;
46320
46395
  const emptyLines = hasEmptyLine ? [
@@ -69737,23 +69812,22 @@ AjwCRQJ5AAAAAAABAAAAANpTmfAAAAAA0e+yRgAAAADR77JG
69737
69812
  this.applyRepeatNotation();
69738
69813
  }
69739
69814
  parseLyricsWithChords(chordsLine, lyricsLine) {
69740
- this.processCharacters(chordsLine, lyricsLine);
69815
+ const consumedLyrics = this.processCharacters(chordsLine, lyricsLine);
69741
69816
  if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
69742
- this.chordLyricsPair.lyrics += lyricsLine.substring(chordsLine.length);
69817
+ this.chordLyricsPair.lyrics += lyricsLine.substring(consumedLyrics);
69743
69818
  this.chordLyricsPair.chords = this.chordLyricsPair.chords.trim();
69744
69819
  if (this.chordLyricsPair.lyrics) this.chordLyricsPair.lyrics = this.chordLyricsPair.lyrics.trim();
69745
69820
  this.applyRepeatNotation();
69746
69821
  }
69747
69822
  processCharacters(chordsLine, lyricsLine) {
69823
+ const columnToLyricsIndex = (0, $2da8d6b3c840ecd4$export$798c10ea30852970)(lyricsLine);
69824
+ let lastLyricsIndex = -1;
69748
69825
  for (let c4 = 0, charCount = chordsLine.length; c4 < charCount; c4 += 1) {
69749
- const chr = chordsLine[c4];
69750
- const nextChar = chordsLine[c4 + 1];
69751
- const isWhiteSpace = /\s/.test(chr);
69752
- this.addCharacter(chr, nextChar);
69753
- if (!this.chordLyricsPair) throw new Error("Expected this.chordLyricsPair to be present");
69754
- this.chordLyricsPair.lyrics += lyricsLine[c4] || "";
69755
- 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]);
69756
69829
  }
69830
+ return lastLyricsIndex >= 0 ? lastLyricsIndex + 1 : 0;
69757
69831
  }
69758
69832
  addCharacter(chr, nextChar) {
69759
69833
  const isWhiteSpace = /\s/.test(chr);
@@ -69878,7 +69952,7 @@ AjwCRQJ5AAAAAAABAAAAANpTmfAAAAAA0e+yRgAAAADR77JG
69878
69952
  }
69879
69953
  };
69880
69954
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
69881
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "14.3.0";
69955
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "14.4.0";
69882
69956
  var $a3816b486f741c00$exports = {};
69883
69957
  var $892913528e7f60f9$export$2e2bcd8739ae039 = {
69884
69958
  CHORUS: $dce48cb70c4120bb$export$8db6c706fc9142b2,