chordsheetjs 8.3.1 → 8.4.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/bundle.js CHANGED
@@ -17038,7 +17038,8 @@ var $376e205ced98486b$export$2e2bcd8739ae039 = {
17038
17038
  paragraphClasses: $376e205ced98486b$export$dcd1550c9709312c,
17039
17039
  evaluate: $376e205ced98486b$export$fef61f332f2c0afc,
17040
17040
  fontStyleTag: $376e205ced98486b$export$ca030c9435779e4b,
17041
- renderChord: $dfecd32049fa58e9$export$596ec52955da9472
17041
+ renderChord: $dfecd32049fa58e9$export$596ec52955da9472,
17042
+ hasChordContents: $21a34a464e7bc609$export$d332d76d125f0cbe
17042
17043
  };
17043
17044
 
17044
17045
 
@@ -17133,6 +17134,21 @@ var $8906a355dee27f2c$export$2e2bcd8739ae039 = $8906a355dee27f2c$var$ChordsOverW
17133
17134
 
17134
17135
 
17135
17136
 
17137
+ // eslint-disable-next-line import/prefer-default-export
17138
+ function $9e2fd0525d9e4483$export$9f6ee93f4e2fb3d2(string) {
17139
+ const result = /(\s+)(\S+)/.exec(string);
17140
+ const secondWordPosition = result ? result.index + result[1].length : null;
17141
+ if (secondWordPosition && secondWordPosition !== -1) return [
17142
+ string.substring(0, secondWordPosition).trim(),
17143
+ string.substring(secondWordPosition)
17144
+ ];
17145
+ return [
17146
+ /.+\s+$/.test(string) ? `${string.trim()} ` : string,
17147
+ null
17148
+ ];
17149
+ }
17150
+
17151
+
17136
17152
  // Generated by peggy v. 2.0.1 (ts-pegjs plugin v. 3.1.0 )
17137
17153
  //
17138
17154
  // https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
@@ -17158,29 +17174,28 @@ function $3df1df9cc0f1cab9$var$constructChordLyricsPairs(chords, lyrics) {
17158
17174
  const start = chord.column - 1;
17159
17175
  const end = nextChord ? nextChord.column - 1 : lyrics.length;
17160
17176
  const pairLyrics = lyrics.substring(start, end);
17161
- const secondWordPosition = pairLyrics.search(/(?<=\s+)\S/);
17177
+ const [firstWord, rest] = (0, $9e2fd0525d9e4483$export$9f6ee93f4e2fb3d2)(pairLyrics);
17162
17178
  const chordData = chord.type === "chord" ? {
17163
17179
  chord: chord
17164
17180
  } : {
17165
17181
  chords: chord.value
17166
17182
  };
17167
- if (secondWordPosition !== -1 && secondWordPosition < end) return [
17183
+ if (rest) return [
17168
17184
  {
17169
17185
  type: "chordLyricsPair",
17170
17186
  ...chordData,
17171
- lyrics: `${pairLyrics.substring(0, secondWordPosition).trim()} `
17187
+ lyrics: `${firstWord} `
17172
17188
  },
17173
17189
  {
17174
17190
  type: "chordLyricsPair",
17175
17191
  chords: "",
17176
- lyrics: pairLyrics.substring(secondWordPosition)
17192
+ lyrics: rest
17177
17193
  }
17178
17194
  ];
17179
- const trimmedLyrics = /.+\s+$/.test(pairLyrics) ? `${pairLyrics.trim()} ` : pairLyrics;
17180
17195
  return {
17181
17196
  type: "chordLyricsPair",
17182
17197
  ...chordData,
17183
- lyrics: trimmedLyrics
17198
+ lyrics: firstWord
17184
17199
  };
17185
17200
  }).flat();
17186
17201
  }
@@ -17407,30 +17422,28 @@ function $3df1df9cc0f1cab9$var$peg$parse(input, options) {
17407
17422
  const start = chord.column - 1;
17408
17423
  const end = nextChord ? nextChord.column - 1 : lyrics.length;
17409
17424
  const pairLyrics = lyrics.substring(start, end);
17410
- const result = /(\s+)(\S+)/.exec(pairLyrics);
17411
- const secondWordPosition = result ? result.index + result[1].length : null;
17425
+ const [firstWord, rest] = (0, $9e2fd0525d9e4483$export$9f6ee93f4e2fb3d2)(pairLyrics);
17412
17426
  const chordData = chord.type === "chord" ? {
17413
17427
  chord: chord
17414
17428
  } : {
17415
17429
  chords: chord.value
17416
17430
  };
17417
- if (secondWordPosition && secondWordPosition < end) return [
17431
+ if (rest) return [
17418
17432
  {
17419
17433
  type: "chordLyricsPair",
17420
17434
  ...chordData,
17421
- lyrics: pairLyrics.substring(0, secondWordPosition).trim() + " "
17435
+ lyrics: `${firstWord} `
17422
17436
  },
17423
17437
  {
17424
17438
  type: "chordLyricsPair",
17425
17439
  chords: "",
17426
- lyrics: pairLyrics.substring(secondWordPosition)
17440
+ lyrics: rest
17427
17441
  }
17428
17442
  ];
17429
- const trimmedLyrics = /.+\s+$/.test(pairLyrics) ? pairLyrics.trim() + " " : pairLyrics;
17430
17443
  return {
17431
17444
  type: "chordLyricsPair",
17432
17445
  ...chordData,
17433
- lyrics: trimmedLyrics
17446
+ lyrics: firstWord
17434
17447
  };
17435
17448
  }).flat();
17436
17449
  const firstChord = chords[0];
package/lib/index.js CHANGED
@@ -17037,7 +17037,8 @@ var $376e205ced98486b$export$2e2bcd8739ae039 = {
17037
17037
  paragraphClasses: $376e205ced98486b$export$dcd1550c9709312c,
17038
17038
  evaluate: $376e205ced98486b$export$fef61f332f2c0afc,
17039
17039
  fontStyleTag: $376e205ced98486b$export$ca030c9435779e4b,
17040
- renderChord: $dfecd32049fa58e9$export$596ec52955da9472
17040
+ renderChord: $dfecd32049fa58e9$export$596ec52955da9472,
17041
+ hasChordContents: $21a34a464e7bc609$export$d332d76d125f0cbe
17041
17042
  };
17042
17043
 
17043
17044
 
@@ -17132,6 +17133,21 @@ var $8906a355dee27f2c$export$2e2bcd8739ae039 = $8906a355dee27f2c$var$ChordsOverW
17132
17133
 
17133
17134
 
17134
17135
 
17136
+ // eslint-disable-next-line import/prefer-default-export
17137
+ function $9e2fd0525d9e4483$export$9f6ee93f4e2fb3d2(string) {
17138
+ const result = /(\s+)(\S+)/.exec(string);
17139
+ const secondWordPosition = result ? result.index + result[1].length : null;
17140
+ if (secondWordPosition && secondWordPosition !== -1) return [
17141
+ string.substring(0, secondWordPosition).trim(),
17142
+ string.substring(secondWordPosition)
17143
+ ];
17144
+ return [
17145
+ /.+\s+$/.test(string) ? `${string.trim()} ` : string,
17146
+ null
17147
+ ];
17148
+ }
17149
+
17150
+
17135
17151
  // Generated by peggy v. 2.0.1 (ts-pegjs plugin v. 3.1.0 )
17136
17152
  //
17137
17153
  // https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
@@ -17157,29 +17173,28 @@ function $3df1df9cc0f1cab9$var$constructChordLyricsPairs(chords, lyrics) {
17157
17173
  const start = chord.column - 1;
17158
17174
  const end = nextChord ? nextChord.column - 1 : lyrics.length;
17159
17175
  const pairLyrics = lyrics.substring(start, end);
17160
- const secondWordPosition = pairLyrics.search(/(?<=\s+)\S/);
17176
+ const [firstWord, rest] = (0, $9e2fd0525d9e4483$export$9f6ee93f4e2fb3d2)(pairLyrics);
17161
17177
  const chordData = chord.type === "chord" ? {
17162
17178
  chord: chord
17163
17179
  } : {
17164
17180
  chords: chord.value
17165
17181
  };
17166
- if (secondWordPosition !== -1 && secondWordPosition < end) return [
17182
+ if (rest) return [
17167
17183
  {
17168
17184
  type: "chordLyricsPair",
17169
17185
  ...chordData,
17170
- lyrics: `${pairLyrics.substring(0, secondWordPosition).trim()} `
17186
+ lyrics: `${firstWord} `
17171
17187
  },
17172
17188
  {
17173
17189
  type: "chordLyricsPair",
17174
17190
  chords: "",
17175
- lyrics: pairLyrics.substring(secondWordPosition)
17191
+ lyrics: rest
17176
17192
  }
17177
17193
  ];
17178
- const trimmedLyrics = /.+\s+$/.test(pairLyrics) ? `${pairLyrics.trim()} ` : pairLyrics;
17179
17194
  return {
17180
17195
  type: "chordLyricsPair",
17181
17196
  ...chordData,
17182
- lyrics: trimmedLyrics
17197
+ lyrics: firstWord
17183
17198
  };
17184
17199
  }).flat();
17185
17200
  }
@@ -17406,30 +17421,28 @@ function $3df1df9cc0f1cab9$var$peg$parse(input, options) {
17406
17421
  const start = chord.column - 1;
17407
17422
  const end = nextChord ? nextChord.column - 1 : lyrics.length;
17408
17423
  const pairLyrics = lyrics.substring(start, end);
17409
- const result = /(\s+)(\S+)/.exec(pairLyrics);
17410
- const secondWordPosition = result ? result.index + result[1].length : null;
17424
+ const [firstWord, rest] = (0, $9e2fd0525d9e4483$export$9f6ee93f4e2fb3d2)(pairLyrics);
17411
17425
  const chordData = chord.type === "chord" ? {
17412
17426
  chord: chord
17413
17427
  } : {
17414
17428
  chords: chord.value
17415
17429
  };
17416
- if (secondWordPosition && secondWordPosition < end) return [
17430
+ if (rest) return [
17417
17431
  {
17418
17432
  type: "chordLyricsPair",
17419
17433
  ...chordData,
17420
- lyrics: pairLyrics.substring(0, secondWordPosition).trim() + " "
17434
+ lyrics: `${firstWord} `
17421
17435
  },
17422
17436
  {
17423
17437
  type: "chordLyricsPair",
17424
17438
  chords: "",
17425
- lyrics: pairLyrics.substring(secondWordPosition)
17439
+ lyrics: rest
17426
17440
  }
17427
17441
  ];
17428
- const trimmedLyrics = /.+\s+$/.test(pairLyrics) ? pairLyrics.trim() + " " : pairLyrics;
17429
17442
  return {
17430
17443
  type: "chordLyricsPair",
17431
17444
  ...chordData,
17432
- lyrics: trimmedLyrics
17445
+ lyrics: firstWord
17433
17446
  };
17434
17447
  }).flat();
17435
17448
  const firstChord = chords[0];