chordsheetjs 15.5.2 → 15.6.0-canary.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 +200 -34
- package/lib/bundle.min.js +92 -92
- package/lib/index.js +199 -34
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +6 -1
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +199 -34
- package/lib/module.js.map +1 -1
- package/lib/pdf/index.js +199 -34
- package/lib/pdf/index.js.map +1 -1
- package/lib/pdf/main.d.ts +4 -0
- package/lib/pdf/main.d.ts.map +1 -1
- package/lib/pdf/module.js +199 -34
- package/lib/pdf/module.js.map +1 -1
- package/package.json +1 -1
package/lib/bundle.js
CHANGED
|
@@ -5392,17 +5392,25 @@ ${error.stack}`);
|
|
|
5392
5392
|
[$7251dad5f4a4c35f$var$TEXTSIZE_SHORT]: (0, $d21c5c7a462f3c34$export$f0dee7f48597f09a),
|
|
5393
5393
|
[$7251dad5f4a4c35f$var$TITLE_SHORT]: (0, $d21c5c7a462f3c34$export$f1e53f710478ceb4)
|
|
5394
5394
|
};
|
|
5395
|
+
var $7251dad5f4a4c35f$var$SHORT_ALIASES = Object.entries($7251dad5f4a4c35f$var$ALIASES).reduce((acc, [shortName, longName]) => {
|
|
5396
|
+
if (!(longName in acc)) acc[longName] = shortName;
|
|
5397
|
+
return acc;
|
|
5398
|
+
}, {});
|
|
5395
5399
|
var $7251dad5f4a4c35f$var$TAG_REGEX = /^([^:\s]+)(:?\s*(.+))?$/;
|
|
5396
5400
|
var $7251dad5f4a4c35f$var$CUSTOM_META_TAG_NAME_REGEX = /^x_(.+)$/;
|
|
5397
5401
|
function $7251dad5f4a4c35f$export$3ef04055cb4a269a(tagName) {
|
|
5398
5402
|
return $7251dad5f4a4c35f$export$75d737e15c3fab80.includes(tagName);
|
|
5399
5403
|
}
|
|
5400
|
-
var $7251dad5f4a4c35f$
|
|
5404
|
+
var $7251dad5f4a4c35f$export$b1fb291dbbae74dd = (name) => {
|
|
5401
5405
|
if (!name) return name;
|
|
5402
5406
|
const sanitizedName = name.trim();
|
|
5403
5407
|
if (sanitizedName in $7251dad5f4a4c35f$var$ALIASES) return $7251dad5f4a4c35f$var$ALIASES[sanitizedName];
|
|
5404
5408
|
return sanitizedName;
|
|
5405
5409
|
};
|
|
5410
|
+
var $7251dad5f4a4c35f$export$5b25cb93653f4dde = (name) => {
|
|
5411
|
+
const longName = $7251dad5f4a4c35f$export$b1fb291dbbae74dd(name);
|
|
5412
|
+
return $7251dad5f4a4c35f$var$SHORT_ALIASES[longName] || longName;
|
|
5413
|
+
};
|
|
5406
5414
|
var $7251dad5f4a4c35f$var$Tag = class _$7251dad5f4a4c35f$var$Tag extends (0, $c5ce4fc4f57fe810$export$2e2bcd8739ae039) {
|
|
5407
5415
|
static [Symbol.hasInstance](instance) {
|
|
5408
5416
|
return (0, $5d58e7f5804fd974$export$c2feda9b9903876a)(instance, (0, $5d58e7f5804fd974$export$76ece97d1f94609e));
|
|
@@ -5479,7 +5487,7 @@ ${error.stack}`);
|
|
|
5479
5487
|
return this.name === (0, $d21c5c7a462f3c34$export$74f94c628b84d921);
|
|
5480
5488
|
}
|
|
5481
5489
|
set name(name) {
|
|
5482
|
-
this._name = $7251dad5f4a4c35f$
|
|
5490
|
+
this._name = $7251dad5f4a4c35f$export$b1fb291dbbae74dd(name);
|
|
5483
5491
|
this._originalName = name;
|
|
5484
5492
|
}
|
|
5485
5493
|
/**
|
|
@@ -5597,6 +5605,7 @@ ${error.stack}`);
|
|
|
5597
5605
|
var $287d3e472e1fbd90$export$82f9bd327a40ea54 = {
|
|
5598
5606
|
decapo: false,
|
|
5599
5607
|
delegates: $287d3e472e1fbd90$export$7d00225c1398f6c0,
|
|
5608
|
+
directiveNameNormalization: "none",
|
|
5600
5609
|
evaluate: false,
|
|
5601
5610
|
expandChorusDirective: false,
|
|
5602
5611
|
instrument: null,
|
|
@@ -6338,6 +6347,8 @@ ${error.stack}`);
|
|
|
6338
6347
|
/**
|
|
6339
6348
|
* Instantiate
|
|
6340
6349
|
* @param {DeepPartial<T>} [configuration={}] options
|
|
6350
|
+
* @param {'none'|'prefer-long'|'prefer-short'} [configuration.directiveNameNormalization='none'] Whether to
|
|
6351
|
+
* preserve directive names, prefer long directive names, or prefer short aliases where available.
|
|
6341
6352
|
* @param {boolean} [configuration.evaluate=false] Whether or not to evaluate meta expressions.
|
|
6342
6353
|
* For more info about meta expressions, see: https://bit.ly/2SC9c2u
|
|
6343
6354
|
* @param {object} [configuration.metadata={}]
|
|
@@ -6610,9 +6621,21 @@ ${formattedContentLines}`;
|
|
|
6610
6621
|
return "";
|
|
6611
6622
|
}
|
|
6612
6623
|
formatTag(tag) {
|
|
6613
|
-
|
|
6614
|
-
if (tag.
|
|
6615
|
-
return `{${tag.
|
|
6624
|
+
const directiveName = this.formatDirectiveName(tag);
|
|
6625
|
+
if (tag.hasAttributes()) return `{${directiveName}: ${this.formatTagAttributes(tag)}}`;
|
|
6626
|
+
if (tag.hasValue()) return `{${directiveName}: ${tag.value}}`;
|
|
6627
|
+
return `{${directiveName}}`;
|
|
6628
|
+
}
|
|
6629
|
+
formatDirectiveName(tag) {
|
|
6630
|
+
switch (this.configuration.directiveNameNormalization) {
|
|
6631
|
+
case "prefer-long":
|
|
6632
|
+
return (0, $7251dad5f4a4c35f$export$b1fb291dbbae74dd)(tag.name);
|
|
6633
|
+
case "prefer-short":
|
|
6634
|
+
return (0, $7251dad5f4a4c35f$export$5b25cb93653f4dde)(tag.name);
|
|
6635
|
+
case "none":
|
|
6636
|
+
default:
|
|
6637
|
+
return tag.originalName;
|
|
6638
|
+
}
|
|
6616
6639
|
}
|
|
6617
6640
|
formatTagAttributes(tag) {
|
|
6618
6641
|
const keys = Object.keys(tag.attributes);
|
|
@@ -8676,7 +8699,10 @@ Or set the song key before changing key:
|
|
|
8676
8699
|
const eagerChord = this.notation && chordString ? (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(chordString, {
|
|
8677
8700
|
notation: this.notation
|
|
8678
8701
|
}) : null;
|
|
8679
|
-
return new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(eagerChord ? eagerChord.toString() : chordString, lyrics, annotation, eagerChord, isRhythmSymbol ||
|
|
8702
|
+
return new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(eagerChord ? eagerChord.toString() : chordString, lyrics, annotation, eagerChord, isRhythmSymbol || this.isRhythmSymbol(chordString));
|
|
8703
|
+
}
|
|
8704
|
+
isRhythmSymbol(chordString) {
|
|
8705
|
+
return chordString === "|" || chordString === "/";
|
|
8680
8706
|
}
|
|
8681
8707
|
parseTag(astComponent) {
|
|
8682
8708
|
const { name, value, location: { offset = null, line = null, column = null } = {}, chordDefinition, attributes, selector, isNegated } = astComponent;
|
|
@@ -13743,6 +13769,15 @@ Or set the song key before changing key:
|
|
|
13743
13769
|
stripPangoMarkup: $1883202621c13add$export$3dd9b04564de283e,
|
|
13744
13770
|
processMetadata: $f9c5006b26957916$export$5c964b66c4a8abfb
|
|
13745
13771
|
};
|
|
13772
|
+
var $2d92af868d7c705a$var$DIRECTION_KEYWORDS = [
|
|
13773
|
+
"verse",
|
|
13774
|
+
"chorus",
|
|
13775
|
+
"bridge",
|
|
13776
|
+
"tag",
|
|
13777
|
+
"interlude",
|
|
13778
|
+
"instrumental",
|
|
13779
|
+
"intro"
|
|
13780
|
+
];
|
|
13746
13781
|
var $2d92af868d7c705a$var$ChordsOverWordsFormatter = class extends (0, $ed0d9ddbbe7224cd$export$2e2bcd8739ae039) {
|
|
13747
13782
|
/**
|
|
13748
13783
|
* Formats a song into a plain text chord sheet
|
|
@@ -13768,9 +13803,10 @@ Or set the song key before changing key:
|
|
|
13768
13803
|
const songMetadata = this.song.getMetadata(this.configuration);
|
|
13769
13804
|
const orderedMetadata = (0, $f9c5006b26957916$export$5c964b66c4a8abfb)(songMetadata.ownMetadata(), this.configuration.metadata);
|
|
13770
13805
|
const metadata = orderedMetadata.map(([key, value]) => {
|
|
13771
|
-
|
|
13772
|
-
if (
|
|
13773
|
-
return `${
|
|
13806
|
+
const directiveName = this.formatMetadataName(key);
|
|
13807
|
+
if (Array.isArray(value)) return `${directiveName}: ${value.join(",")}`;
|
|
13808
|
+
if (typeof value === "undefined" || value === null || value === "") return `${directiveName}:`;
|
|
13809
|
+
return `${directiveName}: ${value}`;
|
|
13774
13810
|
}).join("\n");
|
|
13775
13811
|
return metadata ? `${metadata}
|
|
13776
13812
|
|
|
@@ -13837,12 +13873,40 @@ Or set the song key before changing key:
|
|
|
13837
13873
|
}
|
|
13838
13874
|
formatItemBottom(item, metadata, line) {
|
|
13839
13875
|
if (typeof item === "string") return item;
|
|
13840
|
-
if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) && item.isRenderable()) return item
|
|
13876
|
+
if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) && item.isRenderable()) return this.formatTag(item);
|
|
13841
13877
|
if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return this.formatChordLyricsPair(item, line);
|
|
13842
13878
|
if ("evaluate" in item) return this.formatEvaluatable(item, metadata);
|
|
13843
13879
|
if (item instanceof (0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039)) return "\\ ";
|
|
13844
13880
|
return "";
|
|
13845
13881
|
}
|
|
13882
|
+
formatTag(item) {
|
|
13883
|
+
if (item.isComment() && !this.isBareCommentLabel(item.label)) return `${this.formatDirectiveName(item)}: ${item.label}`;
|
|
13884
|
+
return item.label;
|
|
13885
|
+
}
|
|
13886
|
+
formatDirectiveName(tag) {
|
|
13887
|
+
return this.formatTagName(tag.name, tag.originalName);
|
|
13888
|
+
}
|
|
13889
|
+
formatMetadataName(name) {
|
|
13890
|
+
return this.formatTagName(name, this.findOriginalMetadataName(name));
|
|
13891
|
+
}
|
|
13892
|
+
formatTagName(name, originalName) {
|
|
13893
|
+
switch (this.configuration.directiveNameNormalization) {
|
|
13894
|
+
case "prefer-long":
|
|
13895
|
+
return (0, $7251dad5f4a4c35f$export$b1fb291dbbae74dd)(name);
|
|
13896
|
+
case "prefer-short":
|
|
13897
|
+
return (0, $7251dad5f4a4c35f$export$5b25cb93653f4dde)(name);
|
|
13898
|
+
case "none":
|
|
13899
|
+
default:
|
|
13900
|
+
return originalName;
|
|
13901
|
+
}
|
|
13902
|
+
}
|
|
13903
|
+
findOriginalMetadataName(name) {
|
|
13904
|
+
const item = this.song.lines.flatMap((line) => line.items).find((lineItem) => lineItem instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) && lineItem.isMetaTag() && lineItem.name === name);
|
|
13905
|
+
return item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) ? item.originalName : name;
|
|
13906
|
+
}
|
|
13907
|
+
isBareCommentLabel(label) {
|
|
13908
|
+
return $2d92af868d7c705a$var$DIRECTION_KEYWORDS.some((keyword) => label.trim().toLowerCase().startsWith(keyword));
|
|
13909
|
+
}
|
|
13846
13910
|
formatEvaluatable(item, metadata) {
|
|
13847
13911
|
return item.evaluate(metadata, this.configuration.metadata.separator);
|
|
13848
13912
|
}
|
|
@@ -28448,7 +28512,7 @@ ${template}
|
|
|
28448
28512
|
const renderedChords = this.renderChordText(chords, line);
|
|
28449
28513
|
const measurements = this.calculateMeasurements(renderedChords, lyrics, nextItem, lyricsOnly);
|
|
28450
28514
|
return {
|
|
28451
|
-
item: new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords, lyrics),
|
|
28515
|
+
item: new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords, lyrics, splitItem.annotation, null, splitItem.isRhythmSymbol),
|
|
28452
28516
|
width: measurements.totalWidth,
|
|
28453
28517
|
chordHeight: measurements.chordHeight
|
|
28454
28518
|
};
|
|
@@ -28560,11 +28624,7 @@ ${template}
|
|
|
28560
28624
|
const firstLyrics = splitLines[0];
|
|
28561
28625
|
const secondLyrics = splitLines.slice(1).join(" ");
|
|
28562
28626
|
return [
|
|
28563
|
-
|
|
28564
|
-
item: new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(item.item.chords, firstLyrics),
|
|
28565
|
-
width: this.measurer.measureTextWidth(firstLyrics, lyricsFont),
|
|
28566
|
-
chordHeight: item.chordHeight
|
|
28567
|
-
},
|
|
28627
|
+
this.createSplitMeasuredItem(item, firstLyrics, item.item.chords, item.item.isRhythmSymbol),
|
|
28568
28628
|
{
|
|
28569
28629
|
item: new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)("", secondLyrics),
|
|
28570
28630
|
width: this.measurer.measureTextWidth(secondLyrics, lyricsFont),
|
|
@@ -28572,6 +28632,14 @@ ${template}
|
|
|
28572
28632
|
}
|
|
28573
28633
|
];
|
|
28574
28634
|
}
|
|
28635
|
+
createSplitMeasuredItem(originalItem, lyrics, chords, isRhythmSymbol) {
|
|
28636
|
+
const annotation = originalItem.item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039) ? originalItem.item.annotation : null;
|
|
28637
|
+
return {
|
|
28638
|
+
item: new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords, lyrics, annotation, null, isRhythmSymbol),
|
|
28639
|
+
width: this.measurer.measureTextWidth(lyrics, this.config.fonts.lyrics),
|
|
28640
|
+
chordHeight: originalItem.chordHeight
|
|
28641
|
+
};
|
|
28642
|
+
}
|
|
28575
28643
|
/**
|
|
28576
28644
|
* Removes hyphens from lyrics for lyrics-only mode
|
|
28577
28645
|
*/
|
|
@@ -28599,11 +28667,11 @@ ${template}
|
|
|
28599
28667
|
items.push(new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)("", adjustedFragment, ""));
|
|
28600
28668
|
}
|
|
28601
28669
|
}
|
|
28602
|
-
if (index === 0 && lyricFragments.length === 1) items.push(new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords, fragment, annotation));
|
|
28670
|
+
if (index === 0 && lyricFragments.length === 1) items.push(new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords, fragment, annotation, null, pair.isRhythmSymbol));
|
|
28603
28671
|
else if (index === 0 && lyricFragments.length > 1) {
|
|
28604
28672
|
let commaAdjustedFragment = fragment;
|
|
28605
28673
|
commaAdjustedFragment += ",";
|
|
28606
|
-
items.push(new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords, commaAdjustedFragment, annotation));
|
|
28674
|
+
items.push(new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords, commaAdjustedFragment, annotation, null, pair.isRhythmSymbol));
|
|
28607
28675
|
}
|
|
28608
28676
|
});
|
|
28609
28677
|
return items;
|
|
@@ -28745,7 +28813,7 @@ ${template}
|
|
|
28745
28813
|
this.layoutFactory.createLineLayout(items, line)
|
|
28746
28814
|
];
|
|
28747
28815
|
if (softBreakIndices.length === 0) return this.handleNoSoftBreaks(items, availableWidth, line);
|
|
28748
|
-
const { firstChunk, secondChunk } = this.splitAtBestSoftBreak(items, softBreakIndices, totalWidth);
|
|
28816
|
+
const { firstChunk, secondChunk } = this.splitAtBestSoftBreak(items, softBreakIndices, totalWidth, availableWidth);
|
|
28749
28817
|
if (firstChunk.length === 0) return this.breakContent(secondChunk, availableWidth, line);
|
|
28750
28818
|
const firstLayout = this.layoutFactory.createLineLayout(firstChunk, line);
|
|
28751
28819
|
return [
|
|
@@ -28762,8 +28830,9 @@ ${template}
|
|
|
28762
28830
|
this.layoutFactory.createLineLayout(items, line)
|
|
28763
28831
|
];
|
|
28764
28832
|
if (breakIndex === 0) return this.handleOversizedFirstItem(items, availableWidth, line);
|
|
28765
|
-
|
|
28766
|
-
|
|
28833
|
+
let firstChunk = items.slice(0, breakIndex);
|
|
28834
|
+
let secondChunk = items.slice(breakIndex);
|
|
28835
|
+
({ firstChunk, secondChunk } = this.avoidLeadingRhythmSymbol(firstChunk, secondChunk, availableWidth));
|
|
28767
28836
|
this.removeTrailingComma(firstChunk);
|
|
28768
28837
|
return [
|
|
28769
28838
|
this.layoutFactory.createLineLayout(firstChunk, line),
|
|
@@ -28822,26 +28891,123 @@ ${template}
|
|
|
28822
28891
|
shouldReturnSingleLayout(totalWidth, availableWidth) {
|
|
28823
28892
|
return totalWidth <= availableWidth;
|
|
28824
28893
|
}
|
|
28825
|
-
splitAtBestSoftBreak(items, softBreakIndices, totalWidth) {
|
|
28894
|
+
splitAtBestSoftBreak(items, softBreakIndices, totalWidth, availableWidth) {
|
|
28895
|
+
const bestBreak = this.findBestSoftBreak(items, softBreakIndices, totalWidth);
|
|
28896
|
+
const softBreak = items[bestBreak.index];
|
|
28897
|
+
let firstChunk = items.slice(0, bestBreak.index);
|
|
28898
|
+
let secondChunk = items.slice(bestBreak.index + 1);
|
|
28899
|
+
({ firstChunk, secondChunk } = this.avoidLeadingRhythmSymbol(firstChunk, secondChunk, availableWidth, softBreak));
|
|
28900
|
+
this.removeTrailingComma(firstChunk);
|
|
28901
|
+
this.capitalizeNextItem(secondChunk, secondChunk, 0);
|
|
28902
|
+
return {
|
|
28903
|
+
firstChunk,
|
|
28904
|
+
secondChunk
|
|
28905
|
+
};
|
|
28906
|
+
}
|
|
28907
|
+
findBestSoftBreak(items, softBreakIndices, totalWidth) {
|
|
28826
28908
|
const targetWidth = totalWidth / 2;
|
|
28827
28909
|
const breakOptions = softBreakIndices.map((idx) => ({
|
|
28828
28910
|
index: idx,
|
|
28829
28911
|
widthUpToBreak: this.getWidthUpToIndex(items, idx)
|
|
28830
28912
|
}));
|
|
28831
|
-
|
|
28832
|
-
|
|
28833
|
-
|
|
28834
|
-
|
|
28835
|
-
|
|
28836
|
-
|
|
28837
|
-
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
|
|
28913
|
+
return breakOptions.reduce((best, current) => this.selectBetterSoftBreak(best, current, targetWidth));
|
|
28914
|
+
}
|
|
28915
|
+
selectBetterSoftBreak(best, current, targetWidth) {
|
|
28916
|
+
const currentDistance = Math.abs(current.widthUpToBreak - targetWidth);
|
|
28917
|
+
const bestDistance = Math.abs(best.widthUpToBreak - targetWidth);
|
|
28918
|
+
if (currentDistance === bestDistance) return current.index > best.index ? current : best;
|
|
28919
|
+
return currentDistance < bestDistance ? current : best;
|
|
28920
|
+
}
|
|
28921
|
+
/**
|
|
28922
|
+
* Avoid wrapping a line so that the next visual line starts with a rhythm symbol.
|
|
28923
|
+
*
|
|
28924
|
+
* Prefer keeping the leading rhythm symbol(s) with the previous line, but only
|
|
28925
|
+
* when the previous line still fits. If they do not fit, break earlier by
|
|
28926
|
+
* moving the nearest preceding non-rhythm chord to the next line. Width checks
|
|
28927
|
+
* are recalculated in the final line context so trailing chord-spacing is not
|
|
28928
|
+
* counted for a line-ending rhythm symbol such as `|`.
|
|
28929
|
+
*/
|
|
28930
|
+
avoidLeadingRhythmSymbol(firstChunk, secondChunk, availableWidth, separator = null) {
|
|
28931
|
+
if (!this.shouldAvoidLeadingRhythmSymbol(secondChunk)) return {
|
|
28932
|
+
firstChunk,
|
|
28933
|
+
secondChunk
|
|
28934
|
+
};
|
|
28935
|
+
return this.tryMoveLeadingRhythmSymbolsToFirstChunk(firstChunk, secondChunk, availableWidth, separator) || this.movePrecedingChordToSecondChunk(firstChunk, secondChunk, separator);
|
|
28936
|
+
}
|
|
28937
|
+
shouldAvoidLeadingRhythmSymbol(secondChunk) {
|
|
28938
|
+
const leadingRhythmSymbolCount = this.countLeadingRhythmSymbols(secondChunk);
|
|
28939
|
+
return this.startsWithRhythmSymbol(secondChunk) && this.hasChordAfterLeadingRhythmSymbols(secondChunk, leadingRhythmSymbolCount);
|
|
28940
|
+
}
|
|
28941
|
+
tryMoveLeadingRhythmSymbolsToFirstChunk(firstChunk, secondChunk, availableWidth, separator) {
|
|
28942
|
+
const leadingRhythmSymbolCount = this.countLeadingRhythmSymbols(secondChunk);
|
|
28943
|
+
const separatorItems = separator ? [
|
|
28944
|
+
separator
|
|
28945
|
+
] : [];
|
|
28946
|
+
const laterFirstChunk = [
|
|
28947
|
+
...firstChunk,
|
|
28948
|
+
...separatorItems,
|
|
28949
|
+
...secondChunk.slice(0, leadingRhythmSymbolCount)
|
|
28950
|
+
];
|
|
28951
|
+
const laterSecondChunk = secondChunk.slice(leadingRhythmSymbolCount);
|
|
28952
|
+
if (this.calculateLineContextWidth(laterFirstChunk) <= availableWidth) return {
|
|
28953
|
+
firstChunk: laterFirstChunk,
|
|
28954
|
+
secondChunk: laterSecondChunk
|
|
28955
|
+
};
|
|
28956
|
+
return null;
|
|
28957
|
+
}
|
|
28958
|
+
movePrecedingChordToSecondChunk(firstChunk, secondChunk, separator) {
|
|
28959
|
+
const precedingChordIndex = this.findLastNonRhythmChordIndex(firstChunk);
|
|
28960
|
+
if (precedingChordIndex <= 0) return {
|
|
28842
28961
|
firstChunk,
|
|
28843
28962
|
secondChunk
|
|
28844
28963
|
};
|
|
28964
|
+
return {
|
|
28965
|
+
firstChunk: firstChunk.slice(0, precedingChordIndex),
|
|
28966
|
+
secondChunk: [
|
|
28967
|
+
...firstChunk.slice(precedingChordIndex),
|
|
28968
|
+
...this.separatorItems(separator),
|
|
28969
|
+
...secondChunk
|
|
28970
|
+
]
|
|
28971
|
+
};
|
|
28972
|
+
}
|
|
28973
|
+
separatorItems(separator) {
|
|
28974
|
+
return separator ? [
|
|
28975
|
+
separator
|
|
28976
|
+
] : [];
|
|
28977
|
+
}
|
|
28978
|
+
startsWithRhythmSymbol(items) {
|
|
28979
|
+
return this.isRhythmSymbolItem(items[0]);
|
|
28980
|
+
}
|
|
28981
|
+
countLeadingRhythmSymbols(items) {
|
|
28982
|
+
let count = 0;
|
|
28983
|
+
while (count < items.length && this.isRhythmSymbolItem(items[count])) count += 1;
|
|
28984
|
+
return count;
|
|
28985
|
+
}
|
|
28986
|
+
hasChordAfterLeadingRhythmSymbols(items, leadingRhythmSymbolCount) {
|
|
28987
|
+
return this.isNonRhythmChordItem(items[leadingRhythmSymbolCount]);
|
|
28988
|
+
}
|
|
28989
|
+
findLastNonRhythmChordIndex(items) {
|
|
28990
|
+
for (let index = items.length - 1; index >= 0; index -= 1) {
|
|
28991
|
+
if (this.isNonRhythmChordItem(items[index])) return index;
|
|
28992
|
+
}
|
|
28993
|
+
return -1;
|
|
28994
|
+
}
|
|
28995
|
+
isRhythmSymbolItem(item) {
|
|
28996
|
+
return item?.item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039) && item.item.isRhythmSymbol;
|
|
28997
|
+
}
|
|
28998
|
+
isNonRhythmChordItem(item) {
|
|
28999
|
+
return item?.item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039) && !item.item.isRhythmSymbol && (item.item.chords || "").trim() !== "";
|
|
29000
|
+
}
|
|
29001
|
+
calculateLineContextWidth(items) {
|
|
29002
|
+
return items.reduce((width, item, index) => {
|
|
29003
|
+
const nextItem = items[index + 1] || null;
|
|
29004
|
+
return width + this.recalculateWidthForLineContext(item, nextItem);
|
|
29005
|
+
}, 0);
|
|
29006
|
+
}
|
|
29007
|
+
recalculateWidthForLineContext(item, nextItem) {
|
|
29008
|
+
if (item.item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return this.recalculateChordLyricWidth(item, nextItem);
|
|
29009
|
+
if (!nextItem && item.item instanceof (0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039)) return 0;
|
|
29010
|
+
return item.width;
|
|
28845
29011
|
}
|
|
28846
29012
|
removeTrailingComma(items) {
|
|
28847
29013
|
const lastItem = items[items.length - 1];
|
|
@@ -29716,7 +29882,7 @@ ${template}
|
|
|
29716
29882
|
}
|
|
29717
29883
|
};
|
|
29718
29884
|
var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
|
|
29719
|
-
var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "15.
|
|
29885
|
+
var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "15.6.0-canary.0";
|
|
29720
29886
|
var $2a7926da41d163b3$export$191a710ad3c9a989 = {
|
|
29721
29887
|
configure: $181068e44290b873$export$8d21e34596265fa2,
|
|
29722
29888
|
getDefaultConfig: $fe1d3ba9df1ecad5$export$ed30944e0fe6ae5c,
|