chordsheetjs 11.1.2 → 11.2.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
@@ -5361,6 +5361,26 @@ to a key`);
5361
5361
  ...rest
5362
5362
  ].filter((item) => item !== null);
5363
5363
  }
5364
+ function $51ced2cf8b50f946$var$isChordLyricsPair(item) {
5365
+ return typeof item !== "string" && item.type === "chordLyricsPair";
5366
+ }
5367
+ function $51ced2cf8b50f946$var$combinableChordLyricsPairs(itemA, itemB) {
5368
+ return $51ced2cf8b50f946$var$isChordLyricsPair(itemA) && $51ced2cf8b50f946$var$isChordLyricsPair(itemB) && itemA.chords.length > 0 && itemB.chords.length === 0;
5369
+ }
5370
+ function $51ced2cf8b50f946$export$ce8f3be11402ed10(items, chopFirstWord) {
5371
+ if (chopFirstWord !== false) return items;
5372
+ const combinedItems = [];
5373
+ for (let i = 0, { length } = items; i < length; i += 1) if ($51ced2cf8b50f946$var$combinableChordLyricsPairs(items[i], items[i + 1])) {
5374
+ const item = items[i];
5375
+ const nextItem = items[i + 1];
5376
+ combinedItems.push({
5377
+ ...item,
5378
+ lyrics: `${item.lyrics}${nextItem.lyrics}`
5379
+ });
5380
+ i += 1;
5381
+ } else combinedItems.push(items[i]);
5382
+ return combinedItems;
5383
+ }
5364
5384
  function $223a4923d98e43eb$var$peg$padEnd(str, targetLength, padString) {
5365
5385
  padString = padString || " ";
5366
5386
  if (str.length > targetLength) return str;
@@ -5485,7 +5505,7 @@ to a key`);
5485
5505
  chords: "",
5486
5506
  lyrics
5487
5507
  } : null,
5488
- ...tokens.flat(),
5508
+ ...$51ced2cf8b50f946$export$ce8f3be11402ed10(tokens.flat(), options.chopFirstWord),
5489
5509
  chords ? {
5490
5510
  type: "chordLyricsPair",
5491
5511
  chords,
@@ -5495,7 +5515,7 @@ to a key`);
5495
5515
  type: "comment",
5496
5516
  comment
5497
5517
  } : null
5498
- ].filter((x) => x));
5518
+ ].filter((x) => x !== null));
5499
5519
  };
5500
5520
  const peg$c4 = function(lyrics) {
5501
5521
  return $51ced2cf8b50f946$export$bb6f5ab929ea49e7(lyrics);
@@ -10654,6 +10674,8 @@ Or set the song key before changing key:
10654
10674
  * @param {ChordProParserOptions} options Parser options.
10655
10675
  * @param {ChordProParserOptions.softLineBreaks} options.softLineBreaks=false If true, a backslash
10656
10676
  * followed by * a space is treated as a soft line break
10677
+ * @param {ChordProParserOptions.chopFirstWord} options.chopFirstWord=true If true, only the first lyric
10678
+ * word is paired with the chord, the rest of the lyric is put in a separate chord lyric pair
10657
10679
  * @see https://peggyjs.org/documentation.html#using-the-parser
10658
10680
  * @returns {Song} The parsed song
10659
10681
  */
@@ -23151,7 +23173,7 @@ Or set the song key before changing key:
23151
23173
  * @param {ChordsOverWordsParserOptions} options Parser options.
23152
23174
  * @param {ChordsOverWordsParserOptions.softLineBreaks} options.softLineBreaks=false If true, a backslash
23153
23175
  * followed by a space is treated as a soft line break
23154
- * @param {ChordsOverWordsParserOptions.chopFirstWord} options.chopFirstWord=false If true, only the first lyric
23176
+ * @param {ChordsOverWordsParserOptions.chopFirstWord} options.chopFirstWord=true If true, only the first lyric
23155
23177
  * word is paired with the chord, the rest of the lyric is put in a separate chord lyric pair
23156
23178
  * @see https://peggyjs.org/documentation.html#using-the-parser
23157
23179
  * @returns {Song} The parsed song