chordsheetjs 12.1.2 → 12.1.3
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 +214 -121
- package/lib/bundle.min.js +77 -77
- package/lib/index.js +225 -123
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +6 -8
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +225 -123
- package/lib/module.js.map +1 -1
- package/package.json +6 -7
package/lib/bundle.js
CHANGED
|
@@ -2724,6 +2724,9 @@ var ChordSheetJS = (() => {
|
|
|
2724
2724
|
"": ""
|
|
2725
2725
|
};
|
|
2726
2726
|
var $5f19a6aa6bc347f1$export$2e2bcd8739ae039 = $5f19a6aa6bc347f1$var$mapping;
|
|
2727
|
+
function $28a2fcb6fb95a147$export$79570e60478bce41(value, functions) {
|
|
2728
|
+
return functions.reduce((acc, fn) => fn(acc), value);
|
|
2729
|
+
}
|
|
2727
2730
|
function $28a2fcb6fb95a147$export$d332d76d125f0cbe(line) {
|
|
2728
2731
|
return line.items.some((item) => item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039) && !!item.chords);
|
|
2729
2732
|
}
|
|
@@ -5241,10 +5244,26 @@ to a key`);
|
|
|
5241
5244
|
return line.items.map((item) => this.formatItem(item, metadata)).join("");
|
|
5242
5245
|
}
|
|
5243
5246
|
formatItem(item, metadata) {
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5247
|
+
const handlers = /* @__PURE__ */ new Map([
|
|
5248
|
+
[
|
|
5249
|
+
(0, $7251dad5f4a4c35f$export$2e2bcd8739ae039),
|
|
5250
|
+
(i) => this.formatTag(i)
|
|
5251
|
+
],
|
|
5252
|
+
[
|
|
5253
|
+
(0, $551a223fc13b5c10$export$2e2bcd8739ae039),
|
|
5254
|
+
(i) => this.formatChordLyricsPair(i)
|
|
5255
|
+
],
|
|
5256
|
+
[
|
|
5257
|
+
(0, $0bd084786477abba$export$2e2bcd8739ae039),
|
|
5258
|
+
(i) => this.formatComment(i)
|
|
5259
|
+
],
|
|
5260
|
+
[
|
|
5261
|
+
(0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039),
|
|
5262
|
+
(_i) => "\\ "
|
|
5263
|
+
]
|
|
5264
|
+
]);
|
|
5265
|
+
const handler = handlers.get(item.constructor);
|
|
5266
|
+
if (handler) return handler(item);
|
|
5248
5267
|
if ("evaluate" in item) return this.formatOrEvaluateItem(item, metadata);
|
|
5249
5268
|
throw new Error(`Don't know how to format a ${item}`);
|
|
5250
5269
|
}
|
|
@@ -5397,16 +5416,17 @@ to a key`);
|
|
|
5397
5416
|
function $51ced2cf8b50f946$var$combinableChordLyricsPairs(itemA, itemB) {
|
|
5398
5417
|
return $51ced2cf8b50f946$var$isChordLyricsPair(itemA) && $51ced2cf8b50f946$var$isChordLyricsPair(itemB) && itemA.chords.length > 0 && itemB.chords.length === 0;
|
|
5399
5418
|
}
|
|
5419
|
+
function $51ced2cf8b50f946$var$combineLyrics(pairA, pairB) {
|
|
5420
|
+
return {
|
|
5421
|
+
...pairA,
|
|
5422
|
+
lyrics: `${pairA.lyrics}${pairB.lyrics}`
|
|
5423
|
+
};
|
|
5424
|
+
}
|
|
5400
5425
|
function $51ced2cf8b50f946$export$ce8f3be11402ed10(items, chopFirstWord) {
|
|
5401
5426
|
if (chopFirstWord !== false) return items;
|
|
5402
5427
|
const combinedItems = [];
|
|
5403
5428
|
for (let i = 0, { length } = items; i < length; i += 1) if ($51ced2cf8b50f946$var$combinableChordLyricsPairs(items[i], items[i + 1])) {
|
|
5404
|
-
|
|
5405
|
-
const nextItem = items[i + 1];
|
|
5406
|
-
combinedItems.push({
|
|
5407
|
-
...item,
|
|
5408
|
-
lyrics: `${item.lyrics}${nextItem.lyrics}`
|
|
5409
|
-
});
|
|
5429
|
+
combinedItems.push($51ced2cf8b50f946$var$combineLyrics(items[i], items[i + 1]));
|
|
5410
5430
|
i += 1;
|
|
5411
5431
|
} else combinedItems.push(items[i]);
|
|
5412
5432
|
return combinedItems;
|
|
@@ -9703,6 +9723,9 @@ to a key`);
|
|
|
9703
9723
|
this.metadata[key] = value;
|
|
9704
9724
|
return;
|
|
9705
9725
|
}
|
|
9726
|
+
this.appendValue(key, value);
|
|
9727
|
+
}
|
|
9728
|
+
appendValue(key, value) {
|
|
9706
9729
|
const currentValue = this.metadata[key];
|
|
9707
9730
|
if (currentValue === value) return;
|
|
9708
9731
|
if (currentValue instanceof Array) {
|
|
@@ -10044,64 +10067,88 @@ to a key`);
|
|
|
10044
10067
|
}
|
|
10045
10068
|
};
|
|
10046
10069
|
var $69c885ea9d252cfd$export$2e2bcd8739ae039 = $69c885ea9d252cfd$var$SongBuilder;
|
|
10070
|
+
var $e02a17f5a26edf19$var$ChordRenderer = class {
|
|
10071
|
+
constructor({ capo, contextKey, decapo, normalizeChords, renderKey, songKey, style, transposeKey, useUnicodeModifier } = {
|
|
10072
|
+
capo: 0,
|
|
10073
|
+
contextKey: null,
|
|
10074
|
+
decapo: false,
|
|
10075
|
+
normalizeChords: true,
|
|
10076
|
+
renderKey: null,
|
|
10077
|
+
songKey: null,
|
|
10078
|
+
style: null,
|
|
10079
|
+
transposeKey: null,
|
|
10080
|
+
useUnicodeModifier: false
|
|
10081
|
+
}) {
|
|
10082
|
+
this.capo = decapo ? capo : 0;
|
|
10083
|
+
this.contextKey = contextKey;
|
|
10084
|
+
this.normalizeChords = normalizeChords;
|
|
10085
|
+
this.renderKey = renderKey;
|
|
10086
|
+
this.songKey = songKey;
|
|
10087
|
+
this.style = style;
|
|
10088
|
+
this.transposeKey = transposeKey;
|
|
10089
|
+
this.useUnicodeModifier = useUnicodeModifier;
|
|
10090
|
+
}
|
|
10091
|
+
render(chordString) {
|
|
10092
|
+
const chord = (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(chordString);
|
|
10093
|
+
if (!chord) return chordString;
|
|
10094
|
+
return (0, $28a2fcb6fb95a147$export$79570e60478bce41)(chord, [
|
|
10095
|
+
(c) => c.transpose(this.effectiveTransposeDistance),
|
|
10096
|
+
(c) => this.modifier ? c.useModifier(this.modifier) : c,
|
|
10097
|
+
(c) => this.normalizeChords ? c.normalize(this.effectiveKey) : c,
|
|
10098
|
+
(c) => this.changeChordType(c)
|
|
10099
|
+
]).toString({
|
|
10100
|
+
useUnicodeModifier: this.useUnicodeModifier
|
|
10101
|
+
});
|
|
10102
|
+
}
|
|
10103
|
+
changeChordType(chord) {
|
|
10104
|
+
switch (this.style) {
|
|
10105
|
+
case "symbol":
|
|
10106
|
+
return chord.toChordSymbol(this.effectiveKey);
|
|
10107
|
+
case "solfege":
|
|
10108
|
+
return chord.toChordSolfege(this.effectiveKey);
|
|
10109
|
+
case "numeral":
|
|
10110
|
+
return chord.toNumeral(this.effectiveKey);
|
|
10111
|
+
case "number":
|
|
10112
|
+
return chord.toNumeric(this.effectiveKey);
|
|
10113
|
+
default:
|
|
10114
|
+
return chord;
|
|
10115
|
+
}
|
|
10116
|
+
}
|
|
10117
|
+
get modifier() {
|
|
10118
|
+
return this.renderKey?.modifier || this.contextKey?.modifier || null;
|
|
10119
|
+
}
|
|
10120
|
+
get effectiveKey() {
|
|
10121
|
+
if (this.renderKey) return this.renderKey;
|
|
10122
|
+
if (!this.contextKey) return null;
|
|
10123
|
+
return this.contextKey.transpose(this.effectiveTransposeDistance);
|
|
10124
|
+
}
|
|
10125
|
+
get effectiveTransposeDistance() {
|
|
10126
|
+
let transpose = -1 * this.capo;
|
|
10127
|
+
if (this.songKey) {
|
|
10128
|
+
if (this.transposeKey) transpose += (0, $2ce1086ce25c9ac0$export$fd31a53e6281557e)(this.transposeKey, this.songKey);
|
|
10129
|
+
if (this.renderKey) transpose += (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(this.songKey, this.renderKey);
|
|
10130
|
+
}
|
|
10131
|
+
return transpose;
|
|
10132
|
+
}
|
|
10133
|
+
};
|
|
10134
|
+
var $e02a17f5a26edf19$export$2e2bcd8739ae039 = $e02a17f5a26edf19$var$ChordRenderer;
|
|
10047
10135
|
function $2ce1086ce25c9ac0$export$fd31a53e6281557e(transposeKey, songKey) {
|
|
10048
10136
|
if (/^\d+$/.test(transposeKey)) return parseInt(transposeKey, 10);
|
|
10049
10137
|
return (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(songKey, transposeKey);
|
|
10050
10138
|
}
|
|
10051
|
-
function $2ce1086ce25c9ac0$var$chordTransposeDistance(capo, transposeKey, songKey, renderKey) {
|
|
10052
|
-
let transpose = -1 * (capo || 0);
|
|
10053
|
-
if (songKey) {
|
|
10054
|
-
if (transposeKey) transpose += $2ce1086ce25c9ac0$export$fd31a53e6281557e(transposeKey, songKey);
|
|
10055
|
-
if (renderKey) transpose += (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(songKey, renderKey);
|
|
10056
|
-
}
|
|
10057
|
-
return transpose;
|
|
10058
|
-
}
|
|
10059
|
-
function $2ce1086ce25c9ac0$var$changeChordType(chord, type, referenceKey) {
|
|
10060
|
-
switch (type) {
|
|
10061
|
-
case "symbol":
|
|
10062
|
-
return chord.toChordSymbol(referenceKey);
|
|
10063
|
-
case "solfege":
|
|
10064
|
-
return chord.toChordSolfege(referenceKey);
|
|
10065
|
-
case "numeral":
|
|
10066
|
-
return chord.toNumeral(referenceKey);
|
|
10067
|
-
case "number":
|
|
10068
|
-
return chord.toNumeric(referenceKey);
|
|
10069
|
-
default:
|
|
10070
|
-
return chord;
|
|
10071
|
-
}
|
|
10072
|
-
}
|
|
10073
|
-
function $2ce1086ce25c9ac0$var$effectiveModifier(renderKey, contextKey) {
|
|
10074
|
-
if (renderKey?.modifier) return renderKey.modifier;
|
|
10075
|
-
if (contextKey?.modifier) return contextKey.modifier;
|
|
10076
|
-
return null;
|
|
10077
|
-
}
|
|
10078
|
-
function $2ce1086ce25c9ac0$var$shapeChord({ chord, effectiveTransposeDistance, modifier, normalizeChords, effectiveKey, chordStyle }) {
|
|
10079
|
-
const transposedChord = chord.transpose(effectiveTransposeDistance);
|
|
10080
|
-
const correctedChord = modifier ? transposedChord.useModifier(modifier) : transposedChord;
|
|
10081
|
-
const normalizedChord = normalizeChords ? correctedChord.normalize(effectiveKey) : transposedChord;
|
|
10082
|
-
return $2ce1086ce25c9ac0$var$changeChordType(normalizedChord, chordStyle, effectiveKey);
|
|
10083
|
-
}
|
|
10084
10139
|
function $2ce1086ce25c9ac0$export$596ec52955da9472(chordString, line, song, { renderKey = null, useUnicodeModifier = false, normalizeChords = true, decapo = false } = {}) {
|
|
10085
|
-
const chord = (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(chordString);
|
|
10086
|
-
if (!chord) return chordString;
|
|
10087
|
-
const songKey = song.key;
|
|
10088
10140
|
const capoString = song.metadata.getSingle((0, $d21c5c7a462f3c34$export$866f445d49bad88e));
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
const modifier = $2ce1086ce25c9ac0$var$effectiveModifier(renderKey, contextKey);
|
|
10094
|
-
const effectiveKey = renderKey || contextKey?.transpose(effectiveTransposeDistance) || null;
|
|
10095
|
-
return $2ce1086ce25c9ac0$var$shapeChord({
|
|
10096
|
-
chord,
|
|
10097
|
-
effectiveTransposeDistance,
|
|
10098
|
-
modifier,
|
|
10141
|
+
return new (0, $e02a17f5a26edf19$export$2e2bcd8739ae039)({
|
|
10142
|
+
capo: capoString ? parseInt(capoString, 10) : 0,
|
|
10143
|
+
contextKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(line.key || song.key),
|
|
10144
|
+
decapo,
|
|
10099
10145
|
normalizeChords,
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10146
|
+
renderKey,
|
|
10147
|
+
songKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(song.key),
|
|
10148
|
+
style: song.metadata.getSingle((0, $d21c5c7a462f3c34$export$d8cbdf44b1f66df1)),
|
|
10149
|
+
transposeKey: line.transposeKey,
|
|
10103
10150
|
useUnicodeModifier
|
|
10104
|
-
});
|
|
10151
|
+
}).render(chordString);
|
|
10105
10152
|
}
|
|
10106
10153
|
function $2ce1086ce25c9ac0$export$efb38dd75b8e2957({ selector, isNegated }, { configuration, metadata }) {
|
|
10107
10154
|
if (selector === configuration.instrument?.type) return !isNegated;
|
|
@@ -10143,6 +10190,44 @@ to a key`);
|
|
|
10143
10190
|
}
|
|
10144
10191
|
};
|
|
10145
10192
|
var $4ff43932a550a629$export$2e2bcd8739ae039 = $4ff43932a550a629$var$ChordDefinitionSet;
|
|
10193
|
+
var $cbaaf2a368d4190f$var$LineExpander = class _$cbaaf2a368d4190f$var$LineExpander {
|
|
10194
|
+
static expand(line, song) {
|
|
10195
|
+
return new _$cbaaf2a368d4190f$var$LineExpander(line, song).expand();
|
|
10196
|
+
}
|
|
10197
|
+
constructor(line, song) {
|
|
10198
|
+
this.line = line;
|
|
10199
|
+
this.song = song;
|
|
10200
|
+
}
|
|
10201
|
+
expand() {
|
|
10202
|
+
const expandedLines = this.line.items.flatMap((item) => {
|
|
10203
|
+
if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) && item.name === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2)) return this.getLastChorusBefore(this.line.lineNumber);
|
|
10204
|
+
return [];
|
|
10205
|
+
});
|
|
10206
|
+
return [
|
|
10207
|
+
this.line,
|
|
10208
|
+
...expandedLines
|
|
10209
|
+
];
|
|
10210
|
+
}
|
|
10211
|
+
getLastChorusBefore(lineNumber) {
|
|
10212
|
+
const lines = [];
|
|
10213
|
+
if (!lineNumber) return lines;
|
|
10214
|
+
for (let i = lineNumber - 1; i >= 0; i -= 1) {
|
|
10215
|
+
const line = this.song.lines[i];
|
|
10216
|
+
if (line.type !== (0, $dce48cb70c4120bb$export$8db6c706fc9142b2) && lines.length > 0) break;
|
|
10217
|
+
if (line.type === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2) && (line.isEmpty() || this.lineHasMoreThanChorusDirectives(line))) lines.unshift(line);
|
|
10218
|
+
}
|
|
10219
|
+
return lines;
|
|
10220
|
+
}
|
|
10221
|
+
lineHasMoreThanChorusDirectives(line) {
|
|
10222
|
+
return line.items.some((item) => {
|
|
10223
|
+
if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) {
|
|
10224
|
+
if (item.name === (0, $d21c5c7a462f3c34$export$4f5168acae064e01) || item.name === (0, $d21c5c7a462f3c34$export$473c1a4819e5180b)) return false;
|
|
10225
|
+
}
|
|
10226
|
+
return true;
|
|
10227
|
+
});
|
|
10228
|
+
}
|
|
10229
|
+
};
|
|
10230
|
+
var $cbaaf2a368d4190f$export$2e2bcd8739ae039 = $cbaaf2a368d4190f$var$LineExpander;
|
|
10146
10231
|
var $c53141c05fae8382$var$Song = class _$c53141c05fae8382$var$Song extends (0, $9047ab737bb447ce$export$2e2bcd8739ae039) {
|
|
10147
10232
|
/**
|
|
10148
10233
|
* Creates a new {Song} instance
|
|
@@ -10182,36 +10267,6 @@ to a key`);
|
|
|
10182
10267
|
while (copy.length && !copy[0].hasRenderableItems()) copy.shift();
|
|
10183
10268
|
return copy;
|
|
10184
10269
|
}
|
|
10185
|
-
expandLine(line) {
|
|
10186
|
-
const expandedLines = line.items.flatMap((item) => {
|
|
10187
|
-
if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) && item.name === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2)) return this.getLastChorusBefore(line.lineNumber);
|
|
10188
|
-
return [];
|
|
10189
|
-
});
|
|
10190
|
-
return [
|
|
10191
|
-
line,
|
|
10192
|
-
...expandedLines
|
|
10193
|
-
];
|
|
10194
|
-
}
|
|
10195
|
-
getLastChorusBefore(lineNumber) {
|
|
10196
|
-
const lines = [];
|
|
10197
|
-
if (!lineNumber) return lines;
|
|
10198
|
-
for (let i = lineNumber - 1; i >= 0; i -= 1) {
|
|
10199
|
-
const line = this.lines[i];
|
|
10200
|
-
if (line.type === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2)) {
|
|
10201
|
-
const filteredLine = this.filterChorusStartEndDirectives(line);
|
|
10202
|
-
if (!(line.isNotEmpty() && filteredLine.isEmpty())) lines.unshift(line);
|
|
10203
|
-
} else if (lines.length > 0) break;
|
|
10204
|
-
}
|
|
10205
|
-
return lines;
|
|
10206
|
-
}
|
|
10207
|
-
filterChorusStartEndDirectives(line) {
|
|
10208
|
-
return line.mapItems((item) => {
|
|
10209
|
-
if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) {
|
|
10210
|
-
if (item.name === (0, $d21c5c7a462f3c34$export$4f5168acae064e01) || item.name === (0, $d21c5c7a462f3c34$export$473c1a4819e5180b)) return null;
|
|
10211
|
-
}
|
|
10212
|
-
return item;
|
|
10213
|
-
});
|
|
10214
|
-
}
|
|
10215
10270
|
/**
|
|
10216
10271
|
* The {@link Paragraph} items of which the song consists
|
|
10217
10272
|
* @member {Paragraph[]}
|
|
@@ -10224,7 +10279,7 @@ to a key`);
|
|
|
10224
10279
|
* @type {Paragraph[]}
|
|
10225
10280
|
*/
|
|
10226
10281
|
get expandedBodyParagraphs() {
|
|
10227
|
-
return this.selectRenderableItems(this.linesToParagraphs(this.lines.flatMap((line) =>
|
|
10282
|
+
return this.selectRenderableItems(this.linesToParagraphs(this.lines.flatMap((line) => (0, $cbaaf2a368d4190f$export$2e2bcd8739ae039).expand(line, this))));
|
|
10228
10283
|
}
|
|
10229
10284
|
linesToParagraphs(lines) {
|
|
10230
10285
|
let currentParagraph = new (0, $8906e348466806fd$export$2e2bcd8739ae039)();
|
|
@@ -10309,16 +10364,23 @@ to a key`);
|
|
|
10309
10364
|
value: transposedKey.toString()
|
|
10310
10365
|
});
|
|
10311
10366
|
}
|
|
10312
|
-
if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) {
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
}
|
|
10367
|
+
if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return _$c53141c05fae8382$var$Song.transposeChordLyricsPair({
|
|
10368
|
+
item,
|
|
10369
|
+
delta,
|
|
10370
|
+
transposedKey,
|
|
10371
|
+
normalizeChordSuffix,
|
|
10372
|
+
modifier: modifier || null
|
|
10373
|
+
});
|
|
10319
10374
|
return item;
|
|
10320
10375
|
});
|
|
10321
10376
|
}
|
|
10377
|
+
static transposeChordLyricsPair({ item, delta, transposedKey, normalizeChordSuffix, modifier }) {
|
|
10378
|
+
let chord = item.transpose(delta, transposedKey, {
|
|
10379
|
+
normalizeChordSuffix
|
|
10380
|
+
});
|
|
10381
|
+
if (modifier) chord = chord.useModifier(modifier);
|
|
10382
|
+
return chord;
|
|
10383
|
+
}
|
|
10322
10384
|
/**
|
|
10323
10385
|
* Transposes the song up by one semitone. It will:
|
|
10324
10386
|
* - transpose all chords, see: {@link Chord#transpose}
|
|
@@ -10599,15 +10661,37 @@ Or set the song key before changing key:
|
|
|
10599
10661
|
};
|
|
10600
10662
|
}
|
|
10601
10663
|
serializeItem(item) {
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10664
|
+
const serializers = /* @__PURE__ */ new Map([
|
|
10665
|
+
[
|
|
10666
|
+
(0, $7251dad5f4a4c35f$export$2e2bcd8739ae039),
|
|
10667
|
+
this.serializeTag.bind(this)
|
|
10668
|
+
],
|
|
10669
|
+
[
|
|
10670
|
+
(0, $551a223fc13b5c10$export$2e2bcd8739ae039),
|
|
10671
|
+
this.serializeChordLyricsPair.bind(this)
|
|
10672
|
+
],
|
|
10673
|
+
[
|
|
10674
|
+
(0, $15f1d40e3d1ed3a0$export$2e2bcd8739ae039),
|
|
10675
|
+
this.serializeTernary.bind(this)
|
|
10676
|
+
],
|
|
10677
|
+
[
|
|
10678
|
+
(0, $11953cb6035032a3$export$2e2bcd8739ae039),
|
|
10679
|
+
this.serializeLiteral.bind(this)
|
|
10680
|
+
],
|
|
10681
|
+
[
|
|
10682
|
+
(0, $0bd084786477abba$export$2e2bcd8739ae039),
|
|
10683
|
+
this.serializeComment.bind(this)
|
|
10684
|
+
],
|
|
10685
|
+
[
|
|
10686
|
+
(0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039),
|
|
10687
|
+
() => ({
|
|
10688
|
+
type: $8b93ef43471b6ed2$var$SOFT_LINE_BREAK
|
|
10689
|
+
})
|
|
10690
|
+
]
|
|
10691
|
+
]);
|
|
10692
|
+
const serializer = serializers.get(item.constructor);
|
|
10693
|
+
if (!serializer) throw new Error(`Don't know how to serialize ${item.constructor.name}`);
|
|
10694
|
+
return serializer(item);
|
|
10611
10695
|
}
|
|
10612
10696
|
serializeChordDefinition(chordDefinition) {
|
|
10613
10697
|
return {
|
|
@@ -23708,23 +23792,32 @@ Or set the song key before changing key:
|
|
|
23708
23792
|
}
|
|
23709
23793
|
parseLine(line) {
|
|
23710
23794
|
if (this.isSectionEnd()) this.endSection();
|
|
23711
|
-
if (
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23795
|
+
if (!(this.parseVerseDirective(line) || this.parseChorusDirective(line) || this.parseMetadata(line))) super.parseLine(line);
|
|
23796
|
+
}
|
|
23797
|
+
parseVerseDirective(line) {
|
|
23798
|
+
const match = line.match($a5a21ced491ea51f$var$VERSE_LINE_REGEX);
|
|
23799
|
+
if (!match) return false;
|
|
23800
|
+
this.startNewLine();
|
|
23801
|
+
const label = match[1];
|
|
23802
|
+
this.startSection((0, $dce48cb70c4120bb$export$4b194284baed1659), label);
|
|
23803
|
+
return true;
|
|
23804
|
+
}
|
|
23805
|
+
parseChorusDirective(line) {
|
|
23806
|
+
const match = line.match($a5a21ced491ea51f$var$CHORUS_LINE_REGEX);
|
|
23807
|
+
if (!match) return false;
|
|
23808
|
+
this.startNewLine();
|
|
23809
|
+
const label = match[1];
|
|
23810
|
+
this.startSection((0, $dce48cb70c4120bb$export$8db6c706fc9142b2), label);
|
|
23811
|
+
return true;
|
|
23812
|
+
}
|
|
23813
|
+
parseMetadata(line) {
|
|
23814
|
+
const match = line.match($a5a21ced491ea51f$var$OTHER_METADATA_LINE_REGEX);
|
|
23815
|
+
if (!match) return false;
|
|
23723
23816
|
this.startNewLine();
|
|
23724
23817
|
this.endSection();
|
|
23725
|
-
const comment = line.match($a5a21ced491ea51f$var$OTHER_METADATA_LINE_REGEX)[1];
|
|
23726
23818
|
if (!this.songLine) throw new Error("Expected this.songLine to be present");
|
|
23727
|
-
this.songLine.addTag(new (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)((0, $d21c5c7a462f3c34$export$a29989082612d0d9),
|
|
23819
|
+
this.songLine.addTag(new (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)((0, $d21c5c7a462f3c34$export$a29989082612d0d9), match[1]));
|
|
23820
|
+
return true;
|
|
23728
23821
|
}
|
|
23729
23822
|
isSectionEnd() {
|
|
23730
23823
|
return this.songLine !== null && this.songLine.isEmpty() && this.songBuilder.previousLine !== null && !this.songBuilder.previousLine.isEmpty();
|