chordsheetjs 14.5.1 → 14.6.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 +346 -108
- package/lib/bundle.min.js +110 -110
- package/lib/index.js +349 -109
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +138 -132
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +349 -109
- package/lib/module.js.map +1 -1
- package/package.json +3 -2
package/lib/module.js
CHANGED
|
@@ -841,6 +841,7 @@ const $0cb401ed3f1d0550$export$40141681ebb03523 = {
|
|
|
841
841
|
* @param {Chord | null} chordObj Optional pre-parsed Chord object
|
|
842
842
|
* @param {boolean} isRhythmSymbol Whether this pair represents a rhythm symbol
|
|
843
843
|
*/ constructor(chords = '', lyrics = null, annotation = null, chordObj = null, isRhythmSymbol = false){
|
|
844
|
+
this.parentLine = null;
|
|
844
845
|
this._chordObj = null;
|
|
845
846
|
this.chords = chords || '';
|
|
846
847
|
this.lyrics = lyrics || '';
|
|
@@ -3952,8 +3953,9 @@ const $33f7017b34767c5f$export$98e6a39c04603d36 = $33f7017b34767c5f$var$peg$pars
|
|
|
3952
3953
|
* @returns {string} the chord string
|
|
3953
3954
|
*/ toString({ useUnicodeModifier: useUnicodeModifier = false } = {}) {
|
|
3954
3955
|
let chordString = '';
|
|
3955
|
-
|
|
3956
|
+
let suffix = this.suffix || '';
|
|
3956
3957
|
const showMinor = suffix[0] !== 'm';
|
|
3958
|
+
if (useUnicodeModifier) suffix = suffix.replace(/#(?=\d)/g, '\u266f').replace(/b(?=\d)/g, '\u266d');
|
|
3957
3959
|
if (this.root) chordString = this.root.toString({
|
|
3958
3960
|
showMinor: showMinor,
|
|
3959
3961
|
useUnicodeModifier: useUnicodeModifier
|
|
@@ -5050,6 +5052,7 @@ var $7494e305d9bdc641$export$2e2bcd8739ae039 = $7494e305d9bdc641$var$ChordDefini
|
|
|
5050
5052
|
* Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview
|
|
5051
5053
|
*/ class $acbb1127ce68c11a$var$Comment {
|
|
5052
5054
|
constructor(content){
|
|
5055
|
+
this.parentLine = null;
|
|
5053
5056
|
this.content = content;
|
|
5054
5057
|
}
|
|
5055
5058
|
/**
|
|
@@ -5074,6 +5077,7 @@ var $acbb1127ce68c11a$export$2e2bcd8739ae039 = $acbb1127ce68c11a$var$Comment;
|
|
|
5074
5077
|
|
|
5075
5078
|
class $9be84d5515dccc21$var$AstComponent {
|
|
5076
5079
|
constructor(traceInfo = null){
|
|
5080
|
+
this.parentLine = null;
|
|
5077
5081
|
this.line = null;
|
|
5078
5082
|
this.column = null;
|
|
5079
5083
|
this.offset = null;
|
|
@@ -5580,129 +5584,301 @@ const $152f7db1a9a2d897$export$ccccd344e69710ef = {
|
|
|
5580
5584
|
},
|
|
5581
5585
|
fonts: {
|
|
5582
5586
|
title: {
|
|
5583
|
-
name: '
|
|
5587
|
+
name: 'Arial',
|
|
5584
5588
|
style: 'bold',
|
|
5585
|
-
size:
|
|
5586
|
-
color: '
|
|
5589
|
+
size: 22,
|
|
5590
|
+
color: '#151515'
|
|
5587
5591
|
},
|
|
5588
5592
|
subtitle: {
|
|
5589
|
-
name: '
|
|
5593
|
+
name: 'Arial',
|
|
5590
5594
|
style: 'normal',
|
|
5591
|
-
size:
|
|
5592
|
-
color:
|
|
5595
|
+
size: 11,
|
|
5596
|
+
color: '#6f6f6f'
|
|
5593
5597
|
},
|
|
5594
5598
|
metadata: {
|
|
5595
|
-
name: '
|
|
5599
|
+
name: 'Arial',
|
|
5596
5600
|
style: 'normal',
|
|
5597
5601
|
size: 10,
|
|
5598
|
-
color:
|
|
5602
|
+
color: '#8b8b8b'
|
|
5599
5603
|
},
|
|
5600
5604
|
text: {
|
|
5601
|
-
name: '
|
|
5605
|
+
name: 'Arial',
|
|
5602
5606
|
style: 'normal',
|
|
5603
5607
|
size: 10,
|
|
5604
|
-
color: '
|
|
5608
|
+
color: '#232323'
|
|
5605
5609
|
},
|
|
5606
5610
|
chord: {
|
|
5607
|
-
name: '
|
|
5611
|
+
name: 'Arial',
|
|
5608
5612
|
style: 'bold',
|
|
5609
5613
|
size: 9,
|
|
5610
|
-
color: '
|
|
5614
|
+
color: '#232323'
|
|
5611
5615
|
},
|
|
5612
5616
|
comment: {
|
|
5613
|
-
name: '
|
|
5617
|
+
name: 'Arial',
|
|
5614
5618
|
style: 'bold',
|
|
5615
5619
|
size: 10,
|
|
5616
|
-
color: '
|
|
5620
|
+
color: '#232323'
|
|
5617
5621
|
},
|
|
5618
5622
|
sectionLabel: {
|
|
5619
|
-
name: '
|
|
5623
|
+
name: 'Arial',
|
|
5620
5624
|
style: 'bold',
|
|
5621
5625
|
size: 10,
|
|
5622
|
-
color: '
|
|
5626
|
+
color: '#a1312d'
|
|
5623
5627
|
},
|
|
5624
5628
|
annotation: {
|
|
5625
|
-
name: '
|
|
5629
|
+
name: 'Arial',
|
|
5626
5630
|
style: 'normal',
|
|
5627
5631
|
size: 10,
|
|
5628
|
-
color: '
|
|
5632
|
+
color: '#232323'
|
|
5629
5633
|
}
|
|
5630
5634
|
},
|
|
5631
5635
|
layout: {
|
|
5632
5636
|
global: {
|
|
5633
5637
|
margins: {
|
|
5634
|
-
top:
|
|
5635
|
-
bottom:
|
|
5638
|
+
top: 14,
|
|
5639
|
+
bottom: 12,
|
|
5636
5640
|
left: 45,
|
|
5637
5641
|
right: 45
|
|
5638
5642
|
}
|
|
5639
5643
|
},
|
|
5640
5644
|
header: {
|
|
5641
|
-
height:
|
|
5645
|
+
height: 72,
|
|
5642
5646
|
content: [
|
|
5643
5647
|
{
|
|
5644
5648
|
type: 'text',
|
|
5645
5649
|
template: '%{title}',
|
|
5646
5650
|
style: {
|
|
5647
|
-
name: '
|
|
5651
|
+
name: 'Arial',
|
|
5648
5652
|
style: 'bold',
|
|
5649
|
-
size:
|
|
5650
|
-
color: '
|
|
5653
|
+
size: 19,
|
|
5654
|
+
color: '#151515',
|
|
5655
|
+
weight: 700
|
|
5651
5656
|
},
|
|
5652
5657
|
position: {
|
|
5653
5658
|
x: 'left',
|
|
5654
|
-
y:
|
|
5659
|
+
y: 0,
|
|
5660
|
+
clip: true,
|
|
5661
|
+
ellipsis: true
|
|
5662
|
+
},
|
|
5663
|
+
condition: {
|
|
5664
|
+
page: {
|
|
5665
|
+
first: true
|
|
5666
|
+
}
|
|
5655
5667
|
}
|
|
5656
5668
|
},
|
|
5657
5669
|
{
|
|
5658
5670
|
type: 'text',
|
|
5659
|
-
template: '
|
|
5671
|
+
template: '%{artist}',
|
|
5660
5672
|
style: {
|
|
5661
|
-
name: '
|
|
5673
|
+
name: 'Arial',
|
|
5662
5674
|
style: 'normal',
|
|
5663
|
-
size:
|
|
5664
|
-
color:
|
|
5675
|
+
size: 11,
|
|
5676
|
+
color: '#6f6f6f'
|
|
5665
5677
|
},
|
|
5666
5678
|
position: {
|
|
5667
5679
|
x: 'left',
|
|
5668
|
-
y:
|
|
5680
|
+
y: 25,
|
|
5681
|
+
clip: true,
|
|
5682
|
+
ellipsis: true
|
|
5683
|
+
},
|
|
5684
|
+
condition: {
|
|
5685
|
+
page: {
|
|
5686
|
+
first: true
|
|
5687
|
+
}
|
|
5669
5688
|
}
|
|
5670
5689
|
},
|
|
5671
5690
|
{
|
|
5672
5691
|
type: 'text',
|
|
5673
|
-
template: '
|
|
5692
|
+
template: '%{tempo|%{} BPM}%{time| \u00b7 %{}}%{capo| \u00b7 Capo %{}}',
|
|
5674
5693
|
style: {
|
|
5675
|
-
name: '
|
|
5694
|
+
name: 'Arial',
|
|
5676
5695
|
style: 'normal',
|
|
5677
|
-
size:
|
|
5678
|
-
color:
|
|
5696
|
+
size: 11,
|
|
5697
|
+
color: '#6f6f6f'
|
|
5679
5698
|
},
|
|
5680
5699
|
position: {
|
|
5681
5700
|
x: 'left',
|
|
5682
|
-
y:
|
|
5701
|
+
y: 40,
|
|
5702
|
+
width: 240,
|
|
5703
|
+
clip: true,
|
|
5704
|
+
ellipsis: true
|
|
5705
|
+
},
|
|
5706
|
+
condition: {
|
|
5707
|
+
page: {
|
|
5708
|
+
first: true
|
|
5709
|
+
}
|
|
5683
5710
|
}
|
|
5684
|
-
}
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5711
|
+
},
|
|
5712
|
+
{
|
|
5713
|
+
type: 'line',
|
|
5714
|
+
style: {
|
|
5715
|
+
width: 1,
|
|
5716
|
+
color: '#d7d7d7'
|
|
5717
|
+
},
|
|
5718
|
+
position: {
|
|
5719
|
+
x: 0,
|
|
5720
|
+
y: 60,
|
|
5721
|
+
width: 'auto',
|
|
5722
|
+
height: 0
|
|
5723
|
+
},
|
|
5724
|
+
condition: {
|
|
5725
|
+
page: {
|
|
5726
|
+
first: true
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
},
|
|
5690
5730
|
{
|
|
5691
5731
|
type: 'text',
|
|
5692
|
-
|
|
5732
|
+
template: '%{key}',
|
|
5733
|
+
cssClass: 'measured-html-key-badge',
|
|
5734
|
+
elementStyle: {
|
|
5735
|
+
width: '28px',
|
|
5736
|
+
height: '28px',
|
|
5737
|
+
display: 'flex',
|
|
5738
|
+
alignItems: 'center',
|
|
5739
|
+
justifyContent: 'center',
|
|
5740
|
+
borderRadius: '999px',
|
|
5741
|
+
backgroundColor: '#a1312d',
|
|
5742
|
+
textAlign: 'center',
|
|
5743
|
+
boxSizing: 'border-box'
|
|
5744
|
+
},
|
|
5693
5745
|
style: {
|
|
5694
|
-
name: '
|
|
5746
|
+
name: 'Arial',
|
|
5747
|
+
style: 'bold',
|
|
5748
|
+
size: 12,
|
|
5749
|
+
color: '#ffffff',
|
|
5750
|
+
weight: 700
|
|
5751
|
+
},
|
|
5752
|
+
position: {
|
|
5753
|
+
x: 'right',
|
|
5754
|
+
y: 12,
|
|
5755
|
+
width: 28,
|
|
5756
|
+
offsetX: -2
|
|
5757
|
+
},
|
|
5758
|
+
condition: {
|
|
5759
|
+
and: [
|
|
5760
|
+
{
|
|
5761
|
+
page: {
|
|
5762
|
+
first: true
|
|
5763
|
+
}
|
|
5764
|
+
},
|
|
5765
|
+
{
|
|
5766
|
+
key: {
|
|
5767
|
+
exists: true
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5770
|
+
]
|
|
5771
|
+
}
|
|
5772
|
+
},
|
|
5773
|
+
{
|
|
5774
|
+
type: 'text',
|
|
5775
|
+
template: '%{title}',
|
|
5776
|
+
style: {
|
|
5777
|
+
name: 'Arial',
|
|
5778
|
+
style: 'bold',
|
|
5779
|
+
size: 12,
|
|
5780
|
+
color: '#151515',
|
|
5781
|
+
weight: 700
|
|
5782
|
+
},
|
|
5783
|
+
position: {
|
|
5784
|
+
x: 'left',
|
|
5785
|
+
y: 0,
|
|
5786
|
+
clip: true,
|
|
5787
|
+
ellipsis: true
|
|
5788
|
+
},
|
|
5789
|
+
condition: {
|
|
5790
|
+
page: {
|
|
5791
|
+
greater_than: 1
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
},
|
|
5795
|
+
{
|
|
5796
|
+
type: 'text',
|
|
5797
|
+
template: '%{page}/%{pages}',
|
|
5798
|
+
style: {
|
|
5799
|
+
name: 'Arial',
|
|
5695
5800
|
style: 'normal',
|
|
5696
5801
|
size: 10,
|
|
5697
|
-
color: '
|
|
5802
|
+
color: '#9a9a9a'
|
|
5698
5803
|
},
|
|
5699
5804
|
position: {
|
|
5700
|
-
x: '
|
|
5701
|
-
y:
|
|
5805
|
+
x: 'right',
|
|
5806
|
+
y: 4,
|
|
5807
|
+
offsetX: -38
|
|
5808
|
+
},
|
|
5809
|
+
condition: {
|
|
5810
|
+
page: {
|
|
5811
|
+
greater_than: 1
|
|
5812
|
+
}
|
|
5813
|
+
}
|
|
5814
|
+
},
|
|
5815
|
+
{
|
|
5816
|
+
type: 'text',
|
|
5817
|
+
template: '%{key}',
|
|
5818
|
+
cssClass: 'measured-html-key-badge',
|
|
5819
|
+
elementStyle: {
|
|
5820
|
+
width: '28px',
|
|
5821
|
+
height: '28px',
|
|
5822
|
+
display: 'flex',
|
|
5823
|
+
alignItems: 'center',
|
|
5824
|
+
justifyContent: 'center',
|
|
5825
|
+
borderRadius: '999px',
|
|
5826
|
+
backgroundColor: '#a1312d',
|
|
5827
|
+
textAlign: 'center',
|
|
5828
|
+
boxSizing: 'border-box'
|
|
5829
|
+
},
|
|
5830
|
+
style: {
|
|
5831
|
+
name: 'Arial',
|
|
5832
|
+
style: 'bold',
|
|
5833
|
+
size: 12,
|
|
5834
|
+
color: '#ffffff',
|
|
5835
|
+
weight: 700
|
|
5836
|
+
},
|
|
5837
|
+
position: {
|
|
5838
|
+
x: 'right',
|
|
5839
|
+
y: 2,
|
|
5840
|
+
width: 28,
|
|
5841
|
+
offsetX: -2
|
|
5842
|
+
},
|
|
5843
|
+
condition: {
|
|
5844
|
+
and: [
|
|
5845
|
+
{
|
|
5846
|
+
page: {
|
|
5847
|
+
greater_than: 1
|
|
5848
|
+
}
|
|
5849
|
+
},
|
|
5850
|
+
{
|
|
5851
|
+
key: {
|
|
5852
|
+
exists: true
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
]
|
|
5856
|
+
}
|
|
5857
|
+
},
|
|
5858
|
+
{
|
|
5859
|
+
type: 'line',
|
|
5860
|
+
style: {
|
|
5861
|
+
width: 1,
|
|
5862
|
+
color: '#d7d7d7'
|
|
5863
|
+
},
|
|
5864
|
+
position: {
|
|
5865
|
+
x: 0,
|
|
5866
|
+
y: 32,
|
|
5867
|
+
width: 'auto',
|
|
5868
|
+
height: 0
|
|
5869
|
+
},
|
|
5870
|
+
condition: {
|
|
5871
|
+
page: {
|
|
5872
|
+
greater_than: 1
|
|
5873
|
+
}
|
|
5702
5874
|
}
|
|
5703
5875
|
}
|
|
5704
5876
|
]
|
|
5705
5877
|
},
|
|
5878
|
+
footer: {
|
|
5879
|
+
height: 0,
|
|
5880
|
+
content: []
|
|
5881
|
+
},
|
|
5706
5882
|
sections: {
|
|
5707
5883
|
global: {
|
|
5708
5884
|
paragraphSpacing: 10,
|
|
@@ -5749,22 +5925,22 @@ const $152f7db1a9a2d897$export$ccccd344e69710ef = {
|
|
|
5749
5925
|
},
|
|
5750
5926
|
fonts: {
|
|
5751
5927
|
title: {
|
|
5752
|
-
name: '
|
|
5928
|
+
name: 'Arial',
|
|
5753
5929
|
style: 'bold',
|
|
5754
5930
|
size: 9,
|
|
5755
|
-
color: '
|
|
5931
|
+
color: '#232323'
|
|
5756
5932
|
},
|
|
5757
5933
|
fingerings: {
|
|
5758
|
-
name: '
|
|
5934
|
+
name: 'Arial',
|
|
5759
5935
|
style: 'bold',
|
|
5760
5936
|
size: 6,
|
|
5761
|
-
color: '
|
|
5937
|
+
color: '#232323'
|
|
5762
5938
|
},
|
|
5763
5939
|
baseFret: {
|
|
5764
|
-
name: '
|
|
5940
|
+
name: 'Arial',
|
|
5765
5941
|
style: 'bold',
|
|
5766
5942
|
size: 6,
|
|
5767
|
-
color: '
|
|
5943
|
+
color: '#232323'
|
|
5768
5944
|
}
|
|
5769
5945
|
}
|
|
5770
5946
|
}
|
|
@@ -6584,7 +6760,11 @@ var $7011f990fc73fda8$export$2e2bcd8739ae039 = $7011f990fc73fda8$var$Font;
|
|
|
6584
6760
|
if (item instanceof (0, $b58c551853385714$export$2e2bcd8739ae039)) this.addTag(item);
|
|
6585
6761
|
else if (item instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) this.addChordLyricsPair(item);
|
|
6586
6762
|
else if (item instanceof (0, $acbb1127ce68c11a$export$2e2bcd8739ae039)) this.addComment(item);
|
|
6587
|
-
else
|
|
6763
|
+
else {
|
|
6764
|
+
const addedItem = item;
|
|
6765
|
+
addedItem.parentLine = this;
|
|
6766
|
+
this.items.push(addedItem);
|
|
6767
|
+
}
|
|
6588
6768
|
}
|
|
6589
6769
|
/**
|
|
6590
6770
|
* Indicates whether the line contains items that are renderable
|
|
@@ -6653,6 +6833,7 @@ var $7011f990fc73fda8$export$2e2bcd8739ae039 = $7011f990fc73fda8$var$Font;
|
|
|
6653
6833
|
addChordLyricsPair(chords = null, lyrics = null) {
|
|
6654
6834
|
if (chords instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) this.currentChordLyricsPair = chords;
|
|
6655
6835
|
else this.currentChordLyricsPair = new (0, $0d04ced54ebef610$export$2e2bcd8739ae039)(chords || '', lyrics || '');
|
|
6836
|
+
this.currentChordLyricsPair.parentLine = this;
|
|
6656
6837
|
this.items.push(this.currentChordLyricsPair);
|
|
6657
6838
|
return this.currentChordLyricsPair;
|
|
6658
6839
|
}
|
|
@@ -6669,11 +6850,13 @@ var $7011f990fc73fda8$export$2e2bcd8739ae039 = $7011f990fc73fda8$var$Font;
|
|
|
6669
6850
|
}
|
|
6670
6851
|
addTag(nameOrTag, value = null) {
|
|
6671
6852
|
const tag = nameOrTag instanceof (0, $b58c551853385714$export$2e2bcd8739ae039) ? nameOrTag : new (0, $b58c551853385714$export$2e2bcd8739ae039)(nameOrTag, value);
|
|
6853
|
+
tag.parentLine = this;
|
|
6672
6854
|
this.items.push(tag);
|
|
6673
6855
|
return tag;
|
|
6674
6856
|
}
|
|
6675
6857
|
addComment(content) {
|
|
6676
6858
|
const comment = content instanceof (0, $acbb1127ce68c11a$export$2e2bcd8739ae039) ? content : new (0, $acbb1127ce68c11a$export$2e2bcd8739ae039)(content);
|
|
6859
|
+
comment.parentLine = this;
|
|
6677
6860
|
this.items.push(comment);
|
|
6678
6861
|
return comment;
|
|
6679
6862
|
}
|
|
@@ -7351,6 +7534,7 @@ var $f548c8fca0a868b3$export$2e2bcd8739ae039 = $f548c8fca0a868b3$var$SongMapper;
|
|
|
7351
7534
|
|
|
7352
7535
|
|
|
7353
7536
|
|
|
7537
|
+
|
|
7354
7538
|
const $3d08fc52230ec46a$var$defaultConstructorOptions = {
|
|
7355
7539
|
capo: 0,
|
|
7356
7540
|
contextKey: null,
|
|
@@ -8047,7 +8231,7 @@ function $05ed9bcf33bcd31b$export$9b09a67f52000acf(configuration) {
|
|
|
8047
8231
|
});
|
|
8048
8232
|
}
|
|
8049
8233
|
if (item instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) return $962eb86a322c5cfb$var$Song.transposeChordLyricsPair(item, delta, transposedKey, normalizeChordSuffix, accidental);
|
|
8050
|
-
if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039)) return $962eb86a322c5cfb$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
|
|
8234
|
+
if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039) && $962eb86a322c5cfb$var$Song.isMusicalSection(item.parentLine)) return $962eb86a322c5cfb$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
|
|
8051
8235
|
return item;
|
|
8052
8236
|
});
|
|
8053
8237
|
}
|
|
@@ -8152,10 +8336,18 @@ function $05ed9bcf33bcd31b$export$9b09a67f52000acf(configuration) {
|
|
|
8152
8336
|
changeChords(func) {
|
|
8153
8337
|
return this.mapItems((item)=>{
|
|
8154
8338
|
if (item instanceof (0, $0d04ced54ebef610$export$2e2bcd8739ae039)) return item.changeChord(func);
|
|
8155
|
-
if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039)) return $962eb86a322c5cfb$var$Song.mapChordsInLiteral(item, func);
|
|
8339
|
+
if (item instanceof (0, $34ab5875df061287$export$2e2bcd8739ae039) && $962eb86a322c5cfb$var$Song.isMusicalSection(item.parentLine)) return $962eb86a322c5cfb$var$Song.mapChordsInLiteral(item, func);
|
|
8156
8340
|
return item;
|
|
8157
8341
|
});
|
|
8158
8342
|
}
|
|
8343
|
+
static isMusicalSection(line) {
|
|
8344
|
+
return line === null || ![
|
|
8345
|
+
(0, $72b24102c7d826fd$export$92249c36c213e508),
|
|
8346
|
+
(0, $72b24102c7d826fd$export$6a5a2eab72b6e3d),
|
|
8347
|
+
(0, $72b24102c7d826fd$export$13f4b12aafeba5d6),
|
|
8348
|
+
(0, $72b24102c7d826fd$export$5a2cf64ea612936a)
|
|
8349
|
+
].includes(line.type);
|
|
8350
|
+
}
|
|
8159
8351
|
static mapChordsInLiteral(item, func) {
|
|
8160
8352
|
// Handle space-separated chords in grid format (e.g., "|| Am . . | C . |")
|
|
8161
8353
|
const changedString = item.string.replace(/(\s|^)(\S+)(?=\s|$)/g, (_match, space, token)=>{
|
|
@@ -27080,6 +27272,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27080
27272
|
/**
|
|
27081
27273
|
* Gets conditional CSS styles from font configuration
|
|
27082
27274
|
*/ getConditionalStyles(style) {
|
|
27275
|
+
const normalizedFontStyles = this.getNormalizedFontStyles(style);
|
|
27083
27276
|
return {
|
|
27084
27277
|
...style.name && {
|
|
27085
27278
|
fontFamily: style.name
|
|
@@ -27087,15 +27280,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27087
27280
|
...style.size && {
|
|
27088
27281
|
fontSize: `${style.size}px`
|
|
27089
27282
|
},
|
|
27090
|
-
...
|
|
27091
|
-
fontWeight: style.weight
|
|
27092
|
-
},
|
|
27093
|
-
...style.style && {
|
|
27094
|
-
fontStyle: style.style
|
|
27095
|
-
},
|
|
27096
|
-
...style.color && {
|
|
27097
|
-
color: style.color
|
|
27098
|
-
},
|
|
27283
|
+
...normalizedFontStyles,
|
|
27099
27284
|
...style.underline && {
|
|
27100
27285
|
textDecoration: 'underline'
|
|
27101
27286
|
},
|
|
@@ -27143,6 +27328,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27143
27328
|
/**
|
|
27144
27329
|
* Applies font styles to an HTML element
|
|
27145
27330
|
*/ applyFontStyle(element, style) {
|
|
27331
|
+
const normalizedFontStyles = this.getNormalizedFontStyles(style);
|
|
27146
27332
|
const styles = {
|
|
27147
27333
|
whiteSpace: 'pre',
|
|
27148
27334
|
...style.name && {
|
|
@@ -27151,15 +27337,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27151
27337
|
...style.size && {
|
|
27152
27338
|
fontSize: `${style.size}px`
|
|
27153
27339
|
},
|
|
27154
|
-
...
|
|
27155
|
-
fontWeight: style.weight
|
|
27156
|
-
},
|
|
27157
|
-
...style.style && {
|
|
27158
|
-
fontStyle: style.style
|
|
27159
|
-
},
|
|
27160
|
-
...style.color && {
|
|
27161
|
-
color: style.color
|
|
27162
|
-
},
|
|
27340
|
+
...normalizedFontStyles,
|
|
27163
27341
|
...style.underline && {
|
|
27164
27342
|
textDecoration: 'underline'
|
|
27165
27343
|
},
|
|
@@ -27189,6 +27367,27 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27189
27367
|
*/ getCustomClass(elementType) {
|
|
27190
27368
|
return this.config.cssClasses?.[elementType];
|
|
27191
27369
|
}
|
|
27370
|
+
getNormalizedFontStyles(style) {
|
|
27371
|
+
const fontWeight = style.weight ?? (style.style === 'bold' ? 'bold' : undefined);
|
|
27372
|
+
const fontStyle = style.style && style.style !== 'bold' ? style.style : undefined;
|
|
27373
|
+
const color = this.normalizeColor(style.color);
|
|
27374
|
+
return {
|
|
27375
|
+
...fontWeight && {
|
|
27376
|
+
fontWeight: fontWeight
|
|
27377
|
+
},
|
|
27378
|
+
...fontStyle && {
|
|
27379
|
+
fontStyle: fontStyle
|
|
27380
|
+
},
|
|
27381
|
+
...color && {
|
|
27382
|
+
color: color
|
|
27383
|
+
}
|
|
27384
|
+
};
|
|
27385
|
+
}
|
|
27386
|
+
normalizeColor(color) {
|
|
27387
|
+
if (typeof color === 'number') return `rgb(${color}, ${color}, ${color})`;
|
|
27388
|
+
if (typeof color === 'string' && /^\d+$/.test(color)) return `rgb(${color}, ${color}, ${color})`;
|
|
27389
|
+
return color;
|
|
27390
|
+
}
|
|
27192
27391
|
}
|
|
27193
27392
|
var $51b611548911e213$export$2e2bcd8739ae039 = $51b611548911e213$export$94eb343ca6d26096;
|
|
27194
27393
|
|
|
@@ -27440,7 +27639,14 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27440
27639
|
if (!contentItem.condition) return true;
|
|
27441
27640
|
const { metadata: songMetadata, extraMetadata: extraMetadata } = this.context;
|
|
27442
27641
|
const metadata = new Proxy({}, {
|
|
27443
|
-
get: (_, prop)=>
|
|
27642
|
+
get: (_, prop)=>{
|
|
27643
|
+
const value = extraMetadata?.[prop] ?? songMetadata.get(prop);
|
|
27644
|
+
if ((prop === 'page' || prop === 'pages' || prop === 'renderTime') && typeof value === 'string') {
|
|
27645
|
+
const numericValue = Number(value);
|
|
27646
|
+
if (!Number.isNaN(numericValue)) return numericValue;
|
|
27647
|
+
}
|
|
27648
|
+
return value;
|
|
27649
|
+
}
|
|
27444
27650
|
});
|
|
27445
27651
|
return new (0, $fb708a54a5f79aab$export$2e2bcd8739ae039)(contentItem.condition, metadata).evaluate();
|
|
27446
27652
|
}
|
|
@@ -27454,15 +27660,18 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27454
27660
|
this.backend.setFontStyle(style);
|
|
27455
27661
|
const availableWidth = position.width || this.getAvailableWidth();
|
|
27456
27662
|
const y = sectionY + position.y;
|
|
27457
|
-
if (position.clip) this.renderClippedText(textValue,
|
|
27458
|
-
else this.renderMultilineText(textValue,
|
|
27663
|
+
if (position.clip) this.renderClippedText(textValue, textItem, availableWidth, y, style);
|
|
27664
|
+
else this.renderMultilineText(textValue, textItem, availableWidth, y, style);
|
|
27459
27665
|
}
|
|
27460
27666
|
/**
|
|
27461
27667
|
* Renders clipped text with optional ellipsis
|
|
27462
|
-
*/ renderClippedText(textValue,
|
|
27668
|
+
*/ renderClippedText(textValue, textItem, availableWidth, y, style) {
|
|
27669
|
+
const { position: position } = textItem;
|
|
27463
27670
|
const clippedText = position.ellipsis ? this.clipTextWithEllipsis(textValue, availableWidth, style) : this.clipText(textValue, availableWidth, style);
|
|
27464
27671
|
const textWidth = this.backend.getTextWidth(clippedText, style);
|
|
27465
|
-
const
|
|
27672
|
+
const alignmentWidth = position.width ?? textWidth;
|
|
27673
|
+
this.backend.setTextItem?.(textItem);
|
|
27674
|
+
const x = this.calculateX(position.x, alignmentWidth, position.offsetX);
|
|
27466
27675
|
this.backend.text(clippedText, x, y);
|
|
27467
27676
|
}
|
|
27468
27677
|
/**
|
|
@@ -27481,12 +27690,15 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27481
27690
|
}
|
|
27482
27691
|
/**
|
|
27483
27692
|
* Renders multiline text
|
|
27484
|
-
*/ renderMultilineText(textValue,
|
|
27693
|
+
*/ renderMultilineText(textValue, textItem, availableWidth, y, style) {
|
|
27694
|
+
const { position: position } = textItem;
|
|
27485
27695
|
const lines = this.backend.splitTextToSize(textValue, availableWidth, style);
|
|
27486
27696
|
let tempY = y;
|
|
27487
27697
|
lines.forEach((line)=>{
|
|
27488
27698
|
const lineWidth = this.backend.getTextWidth(line, style);
|
|
27489
|
-
const
|
|
27699
|
+
const alignmentWidth = position.width ?? lineWidth;
|
|
27700
|
+
this.backend.setTextItem?.(textItem);
|
|
27701
|
+
const x = this.calculateX(position.x, alignmentWidth, position.offsetX);
|
|
27490
27702
|
this.backend.text(line, x, tempY);
|
|
27491
27703
|
tempY += style.size * (style.lineHeight ?? 1.2);
|
|
27492
27704
|
});
|
|
@@ -27495,7 +27707,7 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27495
27707
|
* Renders an image
|
|
27496
27708
|
*/ renderImage(imageItem, sectionY) {
|
|
27497
27709
|
const { src: src, position: position, size: size, alias: alias, compression: compression, rotation: rotation } = imageItem;
|
|
27498
|
-
const x = this.calculateX(position.x, size.width);
|
|
27710
|
+
const x = this.calculateX(position.x, size.width, position.offsetX);
|
|
27499
27711
|
const y = sectionY + position.y;
|
|
27500
27712
|
const format = src.split('.').pop()?.toUpperCase();
|
|
27501
27713
|
this.backend.addImage(src, format, x, y, size.width, size.height, alias, compression, rotation);
|
|
@@ -27525,16 +27737,16 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27525
27737
|
}
|
|
27526
27738
|
/**
|
|
27527
27739
|
* Calculates the X position based on alignment
|
|
27528
|
-
*/ calculateX(alignment, width = 0) {
|
|
27740
|
+
*/ calculateX(alignment, width = 0, offsetX = 0) {
|
|
27529
27741
|
switch(alignment){
|
|
27530
27742
|
case 'center':
|
|
27531
|
-
return this.backend.pageSize.width / 2 - width / 2;
|
|
27743
|
+
return this.backend.pageSize.width / 2 - width / 2 + offsetX;
|
|
27532
27744
|
case 'right':
|
|
27533
|
-
return this.backend.pageSize.width - this.context.margins.right - width;
|
|
27745
|
+
return this.backend.pageSize.width - this.context.margins.right - width + offsetX;
|
|
27534
27746
|
case 'left':
|
|
27535
27747
|
default:
|
|
27536
|
-
if (typeof alignment === 'number') return this.context.margins.left + alignment;
|
|
27537
|
-
return this.context.margins.left;
|
|
27748
|
+
if (typeof alignment === 'number') return this.context.margins.left + alignment + offsetX;
|
|
27749
|
+
return this.context.margins.left + offsetX;
|
|
27538
27750
|
}
|
|
27539
27751
|
}
|
|
27540
27752
|
/**
|
|
@@ -27805,8 +28017,6 @@ var $6be14f9184cf598f$export$2e2bcd8739ae039 = $6be14f9184cf598f$export$f1e5feaa
|
|
|
27805
28017
|
*/ recordRenderingTime() {
|
|
27806
28018
|
const endTime = performance.now();
|
|
27807
28019
|
this.renderTime = (endTime - this.startTime) / 1000;
|
|
27808
|
-
// eslint-disable-next-line no-console
|
|
27809
|
-
console.log(`Rendered in ${this.renderTime.toFixed(2)} seconds`);
|
|
27810
28020
|
}
|
|
27811
28021
|
/**
|
|
27812
28022
|
* Get the elements for a specific page
|
|
@@ -27923,7 +28133,7 @@ var $d8f61af58ffafb14$export$2e2bcd8739ae039 = $d8f61af58ffafb14$var$Renderer;
|
|
|
27923
28133
|
/**
|
|
27924
28134
|
* Creates a new HtmlRenderer
|
|
27925
28135
|
*/ constructor(song, container, configuration){
|
|
27926
|
-
super(song), this._dimensions = null, this._dimensionCacheKey = null;
|
|
28136
|
+
super(song), this.currentLayoutFontStyle = null, this.currentLayoutSection = null, this.currentLayoutTextItem = null, this.currentLineStyle = null, this._dimensions = null, this._dimensionCacheKey = null;
|
|
27927
28137
|
this.container = container;
|
|
27928
28138
|
this.configuration = configuration;
|
|
27929
28139
|
this.styler = new (0, $51b611548911e213$export$2e2bcd8739ae039)({
|
|
@@ -27985,44 +28195,73 @@ var $d8f61af58ffafb14$export$2e2bcd8739ae039 = $d8f61af58ffafb14$var$Renderer;
|
|
|
27985
28195
|
console.log('Chord diagram rendering is stubbed out');
|
|
27986
28196
|
}
|
|
27987
28197
|
renderHeadersAndFooters() {
|
|
27988
|
-
const
|
|
27989
|
-
|
|
27990
|
-
|
|
27991
|
-
|
|
27992
|
-
|
|
27993
|
-
|
|
28198
|
+
const headerConfig = this.getHeaderConfig();
|
|
28199
|
+
const footerConfig = this.getFooterConfig();
|
|
28200
|
+
if (headerConfig) this.renderLayoutForEachPage(headerConfig, 'header');
|
|
28201
|
+
if (footerConfig) this.renderLayoutForEachPage(footerConfig, 'footer');
|
|
28202
|
+
this.resetLayoutRenderingState();
|
|
28203
|
+
}
|
|
28204
|
+
renderLayoutForEachPage(layoutConfig, section) {
|
|
28205
|
+
this.doc.eachPage((_page, index)=>{
|
|
28206
|
+
this.currentLayoutSection = section;
|
|
28207
|
+
this.resetLayoutRenderingState(section);
|
|
28208
|
+
this.createLayoutRenderer(index + 1, this.doc.totalPages).renderLayout(layoutConfig, section);
|
|
27994
28209
|
});
|
|
27995
28210
|
}
|
|
27996
|
-
|
|
27997
|
-
|
|
28211
|
+
resetLayoutRenderingState(section = null) {
|
|
28212
|
+
this.currentLayoutSection = section;
|
|
28213
|
+
this.currentLayoutFontStyle = null;
|
|
28214
|
+
this.currentLayoutTextItem = null;
|
|
28215
|
+
this.currentLineStyle = null;
|
|
28216
|
+
}
|
|
28217
|
+
createLayoutRenderer(page, totalPages) {
|
|
28218
|
+
const backend = this.createLayoutBackend(page, totalPages);
|
|
27998
28219
|
return new (0, $6be14f9184cf598f$export$2e2bcd8739ae039)(backend, {
|
|
27999
28220
|
metadata: this.song.metadata,
|
|
28000
28221
|
margins: this.dimensions.margins,
|
|
28001
|
-
extraMetadata: this.getExtraMetadata(
|
|
28222
|
+
extraMetadata: this.getExtraMetadata(page, totalPages)
|
|
28002
28223
|
});
|
|
28003
28224
|
}
|
|
28004
|
-
createLayoutBackend() {
|
|
28225
|
+
createLayoutBackend(page, totalPages) {
|
|
28005
28226
|
return {
|
|
28006
28227
|
pageSize: this.doc.pageSize,
|
|
28007
|
-
currentPage:
|
|
28008
|
-
totalPages:
|
|
28228
|
+
currentPage: page,
|
|
28229
|
+
totalPages: totalPages,
|
|
28009
28230
|
text: (content, x, y)=>this.renderHtmlText(content, x, y),
|
|
28010
28231
|
getTextWidth: (text, font)=>this.doc.getTextWidth(text, font),
|
|
28011
28232
|
splitTextToSize: (text, maxWidth, font)=>this.doc.splitTextToSize(text, maxWidth, font),
|
|
28012
|
-
setFontStyle: ()=>{
|
|
28233
|
+
setFontStyle: (style)=>{
|
|
28234
|
+
this.currentLayoutFontStyle = style;
|
|
28235
|
+
},
|
|
28236
|
+
setTextItem: (item)=>{
|
|
28237
|
+
this.currentLayoutTextItem = item;
|
|
28238
|
+
},
|
|
28013
28239
|
addElement: (element, x, y)=>this.doc.addElement(element, x, y),
|
|
28014
28240
|
addImage: (src, _format, x, y, width, height)=>this.renderHtmlImage(src, x, y, width, height),
|
|
28015
28241
|
line: (x1, y1, x2, y2)=>this.renderHtmlLine(x1, y1, x2, y2),
|
|
28016
|
-
setLineStyle: ()=>{
|
|
28242
|
+
setLineStyle: (style)=>{
|
|
28243
|
+
this.currentLineStyle = style;
|
|
28244
|
+
},
|
|
28017
28245
|
resetDash: ()=>{}
|
|
28018
28246
|
};
|
|
28019
28247
|
}
|
|
28020
28248
|
renderHtmlText(content, x, y) {
|
|
28021
28249
|
const element = document.createElement('div');
|
|
28022
28250
|
element.className = `${this.styler.prefix}header-text`;
|
|
28251
|
+
this.applyLayoutTextClasses(element);
|
|
28023
28252
|
element.textContent = content;
|
|
28253
|
+
this.applyLayoutTextStyles(element);
|
|
28024
28254
|
this.doc.addElement(element, x, y);
|
|
28025
28255
|
}
|
|
28256
|
+
applyLayoutTextClasses(element) {
|
|
28257
|
+
const sectionClass = this.currentLayoutSection ? this.styler.getCustomClass(this.currentLayoutSection) : undefined;
|
|
28258
|
+
if (sectionClass) element.classList.add(sectionClass);
|
|
28259
|
+
if (this.currentLayoutTextItem?.cssClass) element.classList.add(this.currentLayoutTextItem.cssClass);
|
|
28260
|
+
}
|
|
28261
|
+
applyLayoutTextStyles(element) {
|
|
28262
|
+
if (this.currentLayoutTextItem?.elementStyle) Object.assign(element.style, this.currentLayoutTextItem.elementStyle);
|
|
28263
|
+
if (this.currentLayoutFontStyle) this.styler.applyFontStyle(element, this.currentLayoutFontStyle);
|
|
28264
|
+
}
|
|
28026
28265
|
renderHtmlImage(src, x, y, width, height) {
|
|
28027
28266
|
const img = document.createElement('img');
|
|
28028
28267
|
img.className = `${this.styler.prefix}image`;
|
|
@@ -28034,11 +28273,12 @@ var $d8f61af58ffafb14$export$2e2bcd8739ae039 = $d8f61af58ffafb14$var$Renderer;
|
|
|
28034
28273
|
renderHtmlLine(x1, y1, x2, _y2) {
|
|
28035
28274
|
const lineElement = document.createElement('div');
|
|
28036
28275
|
lineElement.className = `${this.styler.prefix}line`;
|
|
28276
|
+
const lineStyle = this.currentLineStyle;
|
|
28037
28277
|
lineElement.style.width = `${x2 - x1}px`;
|
|
28038
|
-
lineElement.style.height = '
|
|
28039
|
-
lineElement.style.borderBottomWidth =
|
|
28040
|
-
lineElement.style.borderBottomStyle = 'solid';
|
|
28041
|
-
lineElement.style.borderBottomColor = '#000000';
|
|
28278
|
+
lineElement.style.height = '0';
|
|
28279
|
+
lineElement.style.borderBottomWidth = `${lineStyle?.width ?? 1}px`;
|
|
28280
|
+
lineElement.style.borderBottomStyle = lineStyle?.dash?.length ? 'dashed' : 'solid';
|
|
28281
|
+
lineElement.style.borderBottomColor = lineStyle?.color ?? '#000000';
|
|
28042
28282
|
this.doc.addElement(lineElement, x1, y1);
|
|
28043
28283
|
}
|
|
28044
28284
|
renderParagraphs(paragraphLayouts) {
|
|
@@ -37573,7 +37813,7 @@ const $ecd3f348894bfbde$var$endSectionTags = {
|
|
|
37573
37813
|
var $ecd3f348894bfbde$export$2e2bcd8739ae039 = $ecd3f348894bfbde$var$UltimateGuitarParser;
|
|
37574
37814
|
|
|
37575
37815
|
|
|
37576
|
-
var $a91afe1497b28cb4$export$2e2bcd8739ae039 = '14.
|
|
37816
|
+
var $a91afe1497b28cb4$export$2e2bcd8739ae039 = '14.6.1';
|
|
37577
37817
|
|
|
37578
37818
|
|
|
37579
37819
|
|