chordsheetjs 14.5.1 → 14.6.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 +325 -105
- package/lib/bundle.min.js +88 -88
- package/lib/index.js +327 -106
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +5 -2
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +327 -106
- package/lib/module.js.map +1 -1
- package/package.json +2 -2
package/lib/module.js
CHANGED
|
@@ -3952,8 +3952,9 @@ const $33f7017b34767c5f$export$98e6a39c04603d36 = $33f7017b34767c5f$var$peg$pars
|
|
|
3952
3952
|
* @returns {string} the chord string
|
|
3953
3953
|
*/ toString({ useUnicodeModifier: useUnicodeModifier = false } = {}) {
|
|
3954
3954
|
let chordString = '';
|
|
3955
|
-
|
|
3955
|
+
let suffix = this.suffix || '';
|
|
3956
3956
|
const showMinor = suffix[0] !== 'm';
|
|
3957
|
+
if (useUnicodeModifier) suffix = suffix.replace(/#(?=\d)/g, '\u266f').replace(/b(?=\d)/g, '\u266d');
|
|
3957
3958
|
if (this.root) chordString = this.root.toString({
|
|
3958
3959
|
showMinor: showMinor,
|
|
3959
3960
|
useUnicodeModifier: useUnicodeModifier
|
|
@@ -5580,129 +5581,301 @@ const $152f7db1a9a2d897$export$ccccd344e69710ef = {
|
|
|
5580
5581
|
},
|
|
5581
5582
|
fonts: {
|
|
5582
5583
|
title: {
|
|
5583
|
-
name: '
|
|
5584
|
+
name: 'Arial',
|
|
5584
5585
|
style: 'bold',
|
|
5585
|
-
size:
|
|
5586
|
-
color: '
|
|
5586
|
+
size: 22,
|
|
5587
|
+
color: '#151515'
|
|
5587
5588
|
},
|
|
5588
5589
|
subtitle: {
|
|
5589
|
-
name: '
|
|
5590
|
+
name: 'Arial',
|
|
5590
5591
|
style: 'normal',
|
|
5591
|
-
size:
|
|
5592
|
-
color:
|
|
5592
|
+
size: 11,
|
|
5593
|
+
color: '#6f6f6f'
|
|
5593
5594
|
},
|
|
5594
5595
|
metadata: {
|
|
5595
|
-
name: '
|
|
5596
|
+
name: 'Arial',
|
|
5596
5597
|
style: 'normal',
|
|
5597
5598
|
size: 10,
|
|
5598
|
-
color:
|
|
5599
|
+
color: '#8b8b8b'
|
|
5599
5600
|
},
|
|
5600
5601
|
text: {
|
|
5601
|
-
name: '
|
|
5602
|
+
name: 'Arial',
|
|
5602
5603
|
style: 'normal',
|
|
5603
5604
|
size: 10,
|
|
5604
|
-
color: '
|
|
5605
|
+
color: '#232323'
|
|
5605
5606
|
},
|
|
5606
5607
|
chord: {
|
|
5607
|
-
name: '
|
|
5608
|
+
name: 'Arial',
|
|
5608
5609
|
style: 'bold',
|
|
5609
5610
|
size: 9,
|
|
5610
|
-
color: '
|
|
5611
|
+
color: '#232323'
|
|
5611
5612
|
},
|
|
5612
5613
|
comment: {
|
|
5613
|
-
name: '
|
|
5614
|
+
name: 'Arial',
|
|
5614
5615
|
style: 'bold',
|
|
5615
5616
|
size: 10,
|
|
5616
|
-
color: '
|
|
5617
|
+
color: '#232323'
|
|
5617
5618
|
},
|
|
5618
5619
|
sectionLabel: {
|
|
5619
|
-
name: '
|
|
5620
|
+
name: 'Arial',
|
|
5620
5621
|
style: 'bold',
|
|
5621
5622
|
size: 10,
|
|
5622
|
-
color: '
|
|
5623
|
+
color: '#a1312d'
|
|
5623
5624
|
},
|
|
5624
5625
|
annotation: {
|
|
5625
|
-
name: '
|
|
5626
|
+
name: 'Arial',
|
|
5626
5627
|
style: 'normal',
|
|
5627
5628
|
size: 10,
|
|
5628
|
-
color: '
|
|
5629
|
+
color: '#232323'
|
|
5629
5630
|
}
|
|
5630
5631
|
},
|
|
5631
5632
|
layout: {
|
|
5632
5633
|
global: {
|
|
5633
5634
|
margins: {
|
|
5634
|
-
top:
|
|
5635
|
-
bottom:
|
|
5635
|
+
top: 14,
|
|
5636
|
+
bottom: 12,
|
|
5636
5637
|
left: 45,
|
|
5637
5638
|
right: 45
|
|
5638
5639
|
}
|
|
5639
5640
|
},
|
|
5640
5641
|
header: {
|
|
5641
|
-
height:
|
|
5642
|
+
height: 72,
|
|
5642
5643
|
content: [
|
|
5643
5644
|
{
|
|
5644
5645
|
type: 'text',
|
|
5645
5646
|
template: '%{title}',
|
|
5646
5647
|
style: {
|
|
5647
|
-
name: '
|
|
5648
|
+
name: 'Arial',
|
|
5648
5649
|
style: 'bold',
|
|
5649
|
-
size:
|
|
5650
|
-
color: '
|
|
5650
|
+
size: 19,
|
|
5651
|
+
color: '#151515',
|
|
5652
|
+
weight: 700
|
|
5651
5653
|
},
|
|
5652
5654
|
position: {
|
|
5653
5655
|
x: 'left',
|
|
5654
|
-
y:
|
|
5656
|
+
y: 0,
|
|
5657
|
+
clip: true,
|
|
5658
|
+
ellipsis: true
|
|
5659
|
+
},
|
|
5660
|
+
condition: {
|
|
5661
|
+
page: {
|
|
5662
|
+
first: true
|
|
5663
|
+
}
|
|
5655
5664
|
}
|
|
5656
5665
|
},
|
|
5657
5666
|
{
|
|
5658
5667
|
type: 'text',
|
|
5659
|
-
template: '
|
|
5668
|
+
template: '%{artist}',
|
|
5660
5669
|
style: {
|
|
5661
|
-
name: '
|
|
5670
|
+
name: 'Arial',
|
|
5662
5671
|
style: 'normal',
|
|
5663
|
-
size:
|
|
5664
|
-
color:
|
|
5672
|
+
size: 11,
|
|
5673
|
+
color: '#6f6f6f'
|
|
5665
5674
|
},
|
|
5666
5675
|
position: {
|
|
5667
5676
|
x: 'left',
|
|
5668
|
-
y:
|
|
5677
|
+
y: 25,
|
|
5678
|
+
clip: true,
|
|
5679
|
+
ellipsis: true
|
|
5680
|
+
},
|
|
5681
|
+
condition: {
|
|
5682
|
+
page: {
|
|
5683
|
+
first: true
|
|
5684
|
+
}
|
|
5669
5685
|
}
|
|
5670
5686
|
},
|
|
5671
5687
|
{
|
|
5672
5688
|
type: 'text',
|
|
5673
|
-
template: '
|
|
5689
|
+
template: '%{tempo|%{} BPM}%{time| \u00b7 %{}}%{capo| \u00b7 Capo %{}}',
|
|
5674
5690
|
style: {
|
|
5675
|
-
name: '
|
|
5691
|
+
name: 'Arial',
|
|
5676
5692
|
style: 'normal',
|
|
5677
|
-
size:
|
|
5678
|
-
color:
|
|
5693
|
+
size: 11,
|
|
5694
|
+
color: '#6f6f6f'
|
|
5679
5695
|
},
|
|
5680
5696
|
position: {
|
|
5681
5697
|
x: 'left',
|
|
5682
|
-
y:
|
|
5698
|
+
y: 40,
|
|
5699
|
+
width: 240,
|
|
5700
|
+
clip: true,
|
|
5701
|
+
ellipsis: true
|
|
5702
|
+
},
|
|
5703
|
+
condition: {
|
|
5704
|
+
page: {
|
|
5705
|
+
first: true
|
|
5706
|
+
}
|
|
5683
5707
|
}
|
|
5684
|
-
}
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5708
|
+
},
|
|
5709
|
+
{
|
|
5710
|
+
type: 'line',
|
|
5711
|
+
style: {
|
|
5712
|
+
width: 1,
|
|
5713
|
+
color: '#d7d7d7'
|
|
5714
|
+
},
|
|
5715
|
+
position: {
|
|
5716
|
+
x: 0,
|
|
5717
|
+
y: 60,
|
|
5718
|
+
width: 'auto',
|
|
5719
|
+
height: 0
|
|
5720
|
+
},
|
|
5721
|
+
condition: {
|
|
5722
|
+
page: {
|
|
5723
|
+
first: true
|
|
5724
|
+
}
|
|
5725
|
+
}
|
|
5726
|
+
},
|
|
5690
5727
|
{
|
|
5691
5728
|
type: 'text',
|
|
5692
|
-
|
|
5729
|
+
template: '%{key}',
|
|
5730
|
+
cssClass: 'measured-html-key-badge',
|
|
5731
|
+
elementStyle: {
|
|
5732
|
+
width: '28px',
|
|
5733
|
+
height: '28px',
|
|
5734
|
+
display: 'flex',
|
|
5735
|
+
alignItems: 'center',
|
|
5736
|
+
justifyContent: 'center',
|
|
5737
|
+
borderRadius: '999px',
|
|
5738
|
+
backgroundColor: '#a1312d',
|
|
5739
|
+
textAlign: 'center',
|
|
5740
|
+
boxSizing: 'border-box'
|
|
5741
|
+
},
|
|
5693
5742
|
style: {
|
|
5694
|
-
name: '
|
|
5743
|
+
name: 'Arial',
|
|
5744
|
+
style: 'bold',
|
|
5745
|
+
size: 12,
|
|
5746
|
+
color: '#ffffff',
|
|
5747
|
+
weight: 700
|
|
5748
|
+
},
|
|
5749
|
+
position: {
|
|
5750
|
+
x: 'right',
|
|
5751
|
+
y: 12,
|
|
5752
|
+
width: 28,
|
|
5753
|
+
offsetX: -2
|
|
5754
|
+
},
|
|
5755
|
+
condition: {
|
|
5756
|
+
and: [
|
|
5757
|
+
{
|
|
5758
|
+
page: {
|
|
5759
|
+
first: true
|
|
5760
|
+
}
|
|
5761
|
+
},
|
|
5762
|
+
{
|
|
5763
|
+
key: {
|
|
5764
|
+
exists: true
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
]
|
|
5768
|
+
}
|
|
5769
|
+
},
|
|
5770
|
+
{
|
|
5771
|
+
type: 'text',
|
|
5772
|
+
template: '%{title}',
|
|
5773
|
+
style: {
|
|
5774
|
+
name: 'Arial',
|
|
5775
|
+
style: 'bold',
|
|
5776
|
+
size: 12,
|
|
5777
|
+
color: '#151515',
|
|
5778
|
+
weight: 700
|
|
5779
|
+
},
|
|
5780
|
+
position: {
|
|
5781
|
+
x: 'left',
|
|
5782
|
+
y: 0,
|
|
5783
|
+
clip: true,
|
|
5784
|
+
ellipsis: true
|
|
5785
|
+
},
|
|
5786
|
+
condition: {
|
|
5787
|
+
page: {
|
|
5788
|
+
greater_than: 1
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
},
|
|
5792
|
+
{
|
|
5793
|
+
type: 'text',
|
|
5794
|
+
template: '%{page}/%{pages}',
|
|
5795
|
+
style: {
|
|
5796
|
+
name: 'Arial',
|
|
5695
5797
|
style: 'normal',
|
|
5696
5798
|
size: 10,
|
|
5697
|
-
color: '
|
|
5799
|
+
color: '#9a9a9a'
|
|
5698
5800
|
},
|
|
5699
5801
|
position: {
|
|
5700
|
-
x: '
|
|
5701
|
-
y:
|
|
5802
|
+
x: 'right',
|
|
5803
|
+
y: 4,
|
|
5804
|
+
offsetX: -38
|
|
5805
|
+
},
|
|
5806
|
+
condition: {
|
|
5807
|
+
page: {
|
|
5808
|
+
greater_than: 1
|
|
5809
|
+
}
|
|
5810
|
+
}
|
|
5811
|
+
},
|
|
5812
|
+
{
|
|
5813
|
+
type: 'text',
|
|
5814
|
+
template: '%{key}',
|
|
5815
|
+
cssClass: 'measured-html-key-badge',
|
|
5816
|
+
elementStyle: {
|
|
5817
|
+
width: '28px',
|
|
5818
|
+
height: '28px',
|
|
5819
|
+
display: 'flex',
|
|
5820
|
+
alignItems: 'center',
|
|
5821
|
+
justifyContent: 'center',
|
|
5822
|
+
borderRadius: '999px',
|
|
5823
|
+
backgroundColor: '#a1312d',
|
|
5824
|
+
textAlign: 'center',
|
|
5825
|
+
boxSizing: 'border-box'
|
|
5826
|
+
},
|
|
5827
|
+
style: {
|
|
5828
|
+
name: 'Arial',
|
|
5829
|
+
style: 'bold',
|
|
5830
|
+
size: 12,
|
|
5831
|
+
color: '#ffffff',
|
|
5832
|
+
weight: 700
|
|
5833
|
+
},
|
|
5834
|
+
position: {
|
|
5835
|
+
x: 'right',
|
|
5836
|
+
y: 2,
|
|
5837
|
+
width: 28,
|
|
5838
|
+
offsetX: -2
|
|
5839
|
+
},
|
|
5840
|
+
condition: {
|
|
5841
|
+
and: [
|
|
5842
|
+
{
|
|
5843
|
+
page: {
|
|
5844
|
+
greater_than: 1
|
|
5845
|
+
}
|
|
5846
|
+
},
|
|
5847
|
+
{
|
|
5848
|
+
key: {
|
|
5849
|
+
exists: true
|
|
5850
|
+
}
|
|
5851
|
+
}
|
|
5852
|
+
]
|
|
5853
|
+
}
|
|
5854
|
+
},
|
|
5855
|
+
{
|
|
5856
|
+
type: 'line',
|
|
5857
|
+
style: {
|
|
5858
|
+
width: 1,
|
|
5859
|
+
color: '#d7d7d7'
|
|
5860
|
+
},
|
|
5861
|
+
position: {
|
|
5862
|
+
x: 0,
|
|
5863
|
+
y: 32,
|
|
5864
|
+
width: 'auto',
|
|
5865
|
+
height: 0
|
|
5866
|
+
},
|
|
5867
|
+
condition: {
|
|
5868
|
+
page: {
|
|
5869
|
+
greater_than: 1
|
|
5870
|
+
}
|
|
5702
5871
|
}
|
|
5703
5872
|
}
|
|
5704
5873
|
]
|
|
5705
5874
|
},
|
|
5875
|
+
footer: {
|
|
5876
|
+
height: 0,
|
|
5877
|
+
content: []
|
|
5878
|
+
},
|
|
5706
5879
|
sections: {
|
|
5707
5880
|
global: {
|
|
5708
5881
|
paragraphSpacing: 10,
|
|
@@ -5749,22 +5922,22 @@ const $152f7db1a9a2d897$export$ccccd344e69710ef = {
|
|
|
5749
5922
|
},
|
|
5750
5923
|
fonts: {
|
|
5751
5924
|
title: {
|
|
5752
|
-
name: '
|
|
5925
|
+
name: 'Arial',
|
|
5753
5926
|
style: 'bold',
|
|
5754
5927
|
size: 9,
|
|
5755
|
-
color: '
|
|
5928
|
+
color: '#232323'
|
|
5756
5929
|
},
|
|
5757
5930
|
fingerings: {
|
|
5758
|
-
name: '
|
|
5931
|
+
name: 'Arial',
|
|
5759
5932
|
style: 'bold',
|
|
5760
5933
|
size: 6,
|
|
5761
|
-
color: '
|
|
5934
|
+
color: '#232323'
|
|
5762
5935
|
},
|
|
5763
5936
|
baseFret: {
|
|
5764
|
-
name: '
|
|
5937
|
+
name: 'Arial',
|
|
5765
5938
|
style: 'bold',
|
|
5766
5939
|
size: 6,
|
|
5767
|
-
color: '
|
|
5940
|
+
color: '#232323'
|
|
5768
5941
|
}
|
|
5769
5942
|
}
|
|
5770
5943
|
}
|
|
@@ -27080,6 +27253,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27080
27253
|
/**
|
|
27081
27254
|
* Gets conditional CSS styles from font configuration
|
|
27082
27255
|
*/ getConditionalStyles(style) {
|
|
27256
|
+
const normalizedFontStyles = this.getNormalizedFontStyles(style);
|
|
27083
27257
|
return {
|
|
27084
27258
|
...style.name && {
|
|
27085
27259
|
fontFamily: style.name
|
|
@@ -27087,15 +27261,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27087
27261
|
...style.size && {
|
|
27088
27262
|
fontSize: `${style.size}px`
|
|
27089
27263
|
},
|
|
27090
|
-
...
|
|
27091
|
-
fontWeight: style.weight
|
|
27092
|
-
},
|
|
27093
|
-
...style.style && {
|
|
27094
|
-
fontStyle: style.style
|
|
27095
|
-
},
|
|
27096
|
-
...style.color && {
|
|
27097
|
-
color: style.color
|
|
27098
|
-
},
|
|
27264
|
+
...normalizedFontStyles,
|
|
27099
27265
|
...style.underline && {
|
|
27100
27266
|
textDecoration: 'underline'
|
|
27101
27267
|
},
|
|
@@ -27143,6 +27309,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27143
27309
|
/**
|
|
27144
27310
|
* Applies font styles to an HTML element
|
|
27145
27311
|
*/ applyFontStyle(element, style) {
|
|
27312
|
+
const normalizedFontStyles = this.getNormalizedFontStyles(style);
|
|
27146
27313
|
const styles = {
|
|
27147
27314
|
whiteSpace: 'pre',
|
|
27148
27315
|
...style.name && {
|
|
@@ -27151,15 +27318,7 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27151
27318
|
...style.size && {
|
|
27152
27319
|
fontSize: `${style.size}px`
|
|
27153
27320
|
},
|
|
27154
|
-
...
|
|
27155
|
-
fontWeight: style.weight
|
|
27156
|
-
},
|
|
27157
|
-
...style.style && {
|
|
27158
|
-
fontStyle: style.style
|
|
27159
|
-
},
|
|
27160
|
-
...style.color && {
|
|
27161
|
-
color: style.color
|
|
27162
|
-
},
|
|
27321
|
+
...normalizedFontStyles,
|
|
27163
27322
|
...style.underline && {
|
|
27164
27323
|
textDecoration: 'underline'
|
|
27165
27324
|
},
|
|
@@ -27189,6 +27348,27 @@ class $51b611548911e213$export$94eb343ca6d26096 {
|
|
|
27189
27348
|
*/ getCustomClass(elementType) {
|
|
27190
27349
|
return this.config.cssClasses?.[elementType];
|
|
27191
27350
|
}
|
|
27351
|
+
getNormalizedFontStyles(style) {
|
|
27352
|
+
const fontWeight = style.weight ?? (style.style === 'bold' ? 'bold' : undefined);
|
|
27353
|
+
const fontStyle = style.style && style.style !== 'bold' ? style.style : undefined;
|
|
27354
|
+
const color = this.normalizeColor(style.color);
|
|
27355
|
+
return {
|
|
27356
|
+
...fontWeight && {
|
|
27357
|
+
fontWeight: fontWeight
|
|
27358
|
+
},
|
|
27359
|
+
...fontStyle && {
|
|
27360
|
+
fontStyle: fontStyle
|
|
27361
|
+
},
|
|
27362
|
+
...color && {
|
|
27363
|
+
color: color
|
|
27364
|
+
}
|
|
27365
|
+
};
|
|
27366
|
+
}
|
|
27367
|
+
normalizeColor(color) {
|
|
27368
|
+
if (typeof color === 'number') return `rgb(${color}, ${color}, ${color})`;
|
|
27369
|
+
if (typeof color === 'string' && /^\d+$/.test(color)) return `rgb(${color}, ${color}, ${color})`;
|
|
27370
|
+
return color;
|
|
27371
|
+
}
|
|
27192
27372
|
}
|
|
27193
27373
|
var $51b611548911e213$export$2e2bcd8739ae039 = $51b611548911e213$export$94eb343ca6d26096;
|
|
27194
27374
|
|
|
@@ -27440,7 +27620,14 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27440
27620
|
if (!contentItem.condition) return true;
|
|
27441
27621
|
const { metadata: songMetadata, extraMetadata: extraMetadata } = this.context;
|
|
27442
27622
|
const metadata = new Proxy({}, {
|
|
27443
|
-
get: (_, prop)=>
|
|
27623
|
+
get: (_, prop)=>{
|
|
27624
|
+
const value = extraMetadata?.[prop] ?? songMetadata.get(prop);
|
|
27625
|
+
if ((prop === 'page' || prop === 'pages' || prop === 'renderTime') && typeof value === 'string') {
|
|
27626
|
+
const numericValue = Number(value);
|
|
27627
|
+
if (!Number.isNaN(numericValue)) return numericValue;
|
|
27628
|
+
}
|
|
27629
|
+
return value;
|
|
27630
|
+
}
|
|
27444
27631
|
});
|
|
27445
27632
|
return new (0, $fb708a54a5f79aab$export$2e2bcd8739ae039)(contentItem.condition, metadata).evaluate();
|
|
27446
27633
|
}
|
|
@@ -27454,15 +27641,18 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27454
27641
|
this.backend.setFontStyle(style);
|
|
27455
27642
|
const availableWidth = position.width || this.getAvailableWidth();
|
|
27456
27643
|
const y = sectionY + position.y;
|
|
27457
|
-
if (position.clip) this.renderClippedText(textValue,
|
|
27458
|
-
else this.renderMultilineText(textValue,
|
|
27644
|
+
if (position.clip) this.renderClippedText(textValue, textItem, availableWidth, y, style);
|
|
27645
|
+
else this.renderMultilineText(textValue, textItem, availableWidth, y, style);
|
|
27459
27646
|
}
|
|
27460
27647
|
/**
|
|
27461
27648
|
* Renders clipped text with optional ellipsis
|
|
27462
|
-
*/ renderClippedText(textValue,
|
|
27649
|
+
*/ renderClippedText(textValue, textItem, availableWidth, y, style) {
|
|
27650
|
+
const { position: position } = textItem;
|
|
27463
27651
|
const clippedText = position.ellipsis ? this.clipTextWithEllipsis(textValue, availableWidth, style) : this.clipText(textValue, availableWidth, style);
|
|
27464
27652
|
const textWidth = this.backend.getTextWidth(clippedText, style);
|
|
27465
|
-
const
|
|
27653
|
+
const alignmentWidth = position.width ?? textWidth;
|
|
27654
|
+
this.backend.setTextItem?.(textItem);
|
|
27655
|
+
const x = this.calculateX(position.x, alignmentWidth, position.offsetX);
|
|
27466
27656
|
this.backend.text(clippedText, x, y);
|
|
27467
27657
|
}
|
|
27468
27658
|
/**
|
|
@@ -27481,12 +27671,15 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27481
27671
|
}
|
|
27482
27672
|
/**
|
|
27483
27673
|
* Renders multiline text
|
|
27484
|
-
*/ renderMultilineText(textValue,
|
|
27674
|
+
*/ renderMultilineText(textValue, textItem, availableWidth, y, style) {
|
|
27675
|
+
const { position: position } = textItem;
|
|
27485
27676
|
const lines = this.backend.splitTextToSize(textValue, availableWidth, style);
|
|
27486
27677
|
let tempY = y;
|
|
27487
27678
|
lines.forEach((line)=>{
|
|
27488
27679
|
const lineWidth = this.backend.getTextWidth(line, style);
|
|
27489
|
-
const
|
|
27680
|
+
const alignmentWidth = position.width ?? lineWidth;
|
|
27681
|
+
this.backend.setTextItem?.(textItem);
|
|
27682
|
+
const x = this.calculateX(position.x, alignmentWidth, position.offsetX);
|
|
27490
27683
|
this.backend.text(line, x, tempY);
|
|
27491
27684
|
tempY += style.size * (style.lineHeight ?? 1.2);
|
|
27492
27685
|
});
|
|
@@ -27495,7 +27688,7 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27495
27688
|
* Renders an image
|
|
27496
27689
|
*/ renderImage(imageItem, sectionY) {
|
|
27497
27690
|
const { src: src, position: position, size: size, alias: alias, compression: compression, rotation: rotation } = imageItem;
|
|
27498
|
-
const x = this.calculateX(position.x, size.width);
|
|
27691
|
+
const x = this.calculateX(position.x, size.width, position.offsetX);
|
|
27499
27692
|
const y = sectionY + position.y;
|
|
27500
27693
|
const format = src.split('.').pop()?.toUpperCase();
|
|
27501
27694
|
this.backend.addImage(src, format, x, y, size.width, size.height, alias, compression, rotation);
|
|
@@ -27525,16 +27718,16 @@ class $6be14f9184cf598f$export$f1e5feaa438be04f {
|
|
|
27525
27718
|
}
|
|
27526
27719
|
/**
|
|
27527
27720
|
* Calculates the X position based on alignment
|
|
27528
|
-
*/ calculateX(alignment, width = 0) {
|
|
27721
|
+
*/ calculateX(alignment, width = 0, offsetX = 0) {
|
|
27529
27722
|
switch(alignment){
|
|
27530
27723
|
case 'center':
|
|
27531
|
-
return this.backend.pageSize.width / 2 - width / 2;
|
|
27724
|
+
return this.backend.pageSize.width / 2 - width / 2 + offsetX;
|
|
27532
27725
|
case 'right':
|
|
27533
|
-
return this.backend.pageSize.width - this.context.margins.right - width;
|
|
27726
|
+
return this.backend.pageSize.width - this.context.margins.right - width + offsetX;
|
|
27534
27727
|
case 'left':
|
|
27535
27728
|
default:
|
|
27536
|
-
if (typeof alignment === 'number') return this.context.margins.left + alignment;
|
|
27537
|
-
return this.context.margins.left;
|
|
27729
|
+
if (typeof alignment === 'number') return this.context.margins.left + alignment + offsetX;
|
|
27730
|
+
return this.context.margins.left + offsetX;
|
|
27538
27731
|
}
|
|
27539
27732
|
}
|
|
27540
27733
|
/**
|
|
@@ -27805,8 +27998,6 @@ var $6be14f9184cf598f$export$2e2bcd8739ae039 = $6be14f9184cf598f$export$f1e5feaa
|
|
|
27805
27998
|
*/ recordRenderingTime() {
|
|
27806
27999
|
const endTime = performance.now();
|
|
27807
28000
|
this.renderTime = (endTime - this.startTime) / 1000;
|
|
27808
|
-
// eslint-disable-next-line no-console
|
|
27809
|
-
console.log(`Rendered in ${this.renderTime.toFixed(2)} seconds`);
|
|
27810
28001
|
}
|
|
27811
28002
|
/**
|
|
27812
28003
|
* Get the elements for a specific page
|
|
@@ -27923,7 +28114,7 @@ var $d8f61af58ffafb14$export$2e2bcd8739ae039 = $d8f61af58ffafb14$var$Renderer;
|
|
|
27923
28114
|
/**
|
|
27924
28115
|
* Creates a new HtmlRenderer
|
|
27925
28116
|
*/ constructor(song, container, configuration){
|
|
27926
|
-
super(song), this._dimensions = null, this._dimensionCacheKey = null;
|
|
28117
|
+
super(song), this.currentLayoutFontStyle = null, this.currentLayoutSection = null, this.currentLayoutTextItem = null, this.currentLineStyle = null, this._dimensions = null, this._dimensionCacheKey = null;
|
|
27927
28118
|
this.container = container;
|
|
27928
28119
|
this.configuration = configuration;
|
|
27929
28120
|
this.styler = new (0, $51b611548911e213$export$2e2bcd8739ae039)({
|
|
@@ -27985,44 +28176,73 @@ var $d8f61af58ffafb14$export$2e2bcd8739ae039 = $d8f61af58ffafb14$var$Renderer;
|
|
|
27985
28176
|
console.log('Chord diagram rendering is stubbed out');
|
|
27986
28177
|
}
|
|
27987
28178
|
renderHeadersAndFooters() {
|
|
27988
|
-
const
|
|
27989
|
-
|
|
27990
|
-
|
|
27991
|
-
|
|
27992
|
-
|
|
27993
|
-
|
|
28179
|
+
const headerConfig = this.getHeaderConfig();
|
|
28180
|
+
const footerConfig = this.getFooterConfig();
|
|
28181
|
+
if (headerConfig) this.renderLayoutForEachPage(headerConfig, 'header');
|
|
28182
|
+
if (footerConfig) this.renderLayoutForEachPage(footerConfig, 'footer');
|
|
28183
|
+
this.resetLayoutRenderingState();
|
|
28184
|
+
}
|
|
28185
|
+
renderLayoutForEachPage(layoutConfig, section) {
|
|
28186
|
+
this.doc.eachPage((_page, index)=>{
|
|
28187
|
+
this.currentLayoutSection = section;
|
|
28188
|
+
this.resetLayoutRenderingState(section);
|
|
28189
|
+
this.createLayoutRenderer(index + 1, this.doc.totalPages).renderLayout(layoutConfig, section);
|
|
27994
28190
|
});
|
|
27995
28191
|
}
|
|
27996
|
-
|
|
27997
|
-
|
|
28192
|
+
resetLayoutRenderingState(section = null) {
|
|
28193
|
+
this.currentLayoutSection = section;
|
|
28194
|
+
this.currentLayoutFontStyle = null;
|
|
28195
|
+
this.currentLayoutTextItem = null;
|
|
28196
|
+
this.currentLineStyle = null;
|
|
28197
|
+
}
|
|
28198
|
+
createLayoutRenderer(page, totalPages) {
|
|
28199
|
+
const backend = this.createLayoutBackend(page, totalPages);
|
|
27998
28200
|
return new (0, $6be14f9184cf598f$export$2e2bcd8739ae039)(backend, {
|
|
27999
28201
|
metadata: this.song.metadata,
|
|
28000
28202
|
margins: this.dimensions.margins,
|
|
28001
|
-
extraMetadata: this.getExtraMetadata(
|
|
28203
|
+
extraMetadata: this.getExtraMetadata(page, totalPages)
|
|
28002
28204
|
});
|
|
28003
28205
|
}
|
|
28004
|
-
createLayoutBackend() {
|
|
28206
|
+
createLayoutBackend(page, totalPages) {
|
|
28005
28207
|
return {
|
|
28006
28208
|
pageSize: this.doc.pageSize,
|
|
28007
|
-
currentPage:
|
|
28008
|
-
totalPages:
|
|
28209
|
+
currentPage: page,
|
|
28210
|
+
totalPages: totalPages,
|
|
28009
28211
|
text: (content, x, y)=>this.renderHtmlText(content, x, y),
|
|
28010
28212
|
getTextWidth: (text, font)=>this.doc.getTextWidth(text, font),
|
|
28011
28213
|
splitTextToSize: (text, maxWidth, font)=>this.doc.splitTextToSize(text, maxWidth, font),
|
|
28012
|
-
setFontStyle: ()=>{
|
|
28214
|
+
setFontStyle: (style)=>{
|
|
28215
|
+
this.currentLayoutFontStyle = style;
|
|
28216
|
+
},
|
|
28217
|
+
setTextItem: (item)=>{
|
|
28218
|
+
this.currentLayoutTextItem = item;
|
|
28219
|
+
},
|
|
28013
28220
|
addElement: (element, x, y)=>this.doc.addElement(element, x, y),
|
|
28014
28221
|
addImage: (src, _format, x, y, width, height)=>this.renderHtmlImage(src, x, y, width, height),
|
|
28015
28222
|
line: (x1, y1, x2, y2)=>this.renderHtmlLine(x1, y1, x2, y2),
|
|
28016
|
-
setLineStyle: ()=>{
|
|
28223
|
+
setLineStyle: (style)=>{
|
|
28224
|
+
this.currentLineStyle = style;
|
|
28225
|
+
},
|
|
28017
28226
|
resetDash: ()=>{}
|
|
28018
28227
|
};
|
|
28019
28228
|
}
|
|
28020
28229
|
renderHtmlText(content, x, y) {
|
|
28021
28230
|
const element = document.createElement('div');
|
|
28022
28231
|
element.className = `${this.styler.prefix}header-text`;
|
|
28232
|
+
this.applyLayoutTextClasses(element);
|
|
28023
28233
|
element.textContent = content;
|
|
28234
|
+
this.applyLayoutTextStyles(element);
|
|
28024
28235
|
this.doc.addElement(element, x, y);
|
|
28025
28236
|
}
|
|
28237
|
+
applyLayoutTextClasses(element) {
|
|
28238
|
+
const sectionClass = this.currentLayoutSection ? this.styler.getCustomClass(this.currentLayoutSection) : undefined;
|
|
28239
|
+
if (sectionClass) element.classList.add(sectionClass);
|
|
28240
|
+
if (this.currentLayoutTextItem?.cssClass) element.classList.add(this.currentLayoutTextItem.cssClass);
|
|
28241
|
+
}
|
|
28242
|
+
applyLayoutTextStyles(element) {
|
|
28243
|
+
if (this.currentLayoutTextItem?.elementStyle) Object.assign(element.style, this.currentLayoutTextItem.elementStyle);
|
|
28244
|
+
if (this.currentLayoutFontStyle) this.styler.applyFontStyle(element, this.currentLayoutFontStyle);
|
|
28245
|
+
}
|
|
28026
28246
|
renderHtmlImage(src, x, y, width, height) {
|
|
28027
28247
|
const img = document.createElement('img');
|
|
28028
28248
|
img.className = `${this.styler.prefix}image`;
|
|
@@ -28034,11 +28254,12 @@ var $d8f61af58ffafb14$export$2e2bcd8739ae039 = $d8f61af58ffafb14$var$Renderer;
|
|
|
28034
28254
|
renderHtmlLine(x1, y1, x2, _y2) {
|
|
28035
28255
|
const lineElement = document.createElement('div');
|
|
28036
28256
|
lineElement.className = `${this.styler.prefix}line`;
|
|
28257
|
+
const lineStyle = this.currentLineStyle;
|
|
28037
28258
|
lineElement.style.width = `${x2 - x1}px`;
|
|
28038
|
-
lineElement.style.height = '
|
|
28039
|
-
lineElement.style.borderBottomWidth =
|
|
28040
|
-
lineElement.style.borderBottomStyle = 'solid';
|
|
28041
|
-
lineElement.style.borderBottomColor = '#000000';
|
|
28259
|
+
lineElement.style.height = '0';
|
|
28260
|
+
lineElement.style.borderBottomWidth = `${lineStyle?.width ?? 1}px`;
|
|
28261
|
+
lineElement.style.borderBottomStyle = lineStyle?.dash?.length ? 'dashed' : 'solid';
|
|
28262
|
+
lineElement.style.borderBottomColor = lineStyle?.color ?? '#000000';
|
|
28042
28263
|
this.doc.addElement(lineElement, x1, y1);
|
|
28043
28264
|
}
|
|
28044
28265
|
renderParagraphs(paragraphLayouts) {
|
|
@@ -37573,7 +37794,7 @@ const $ecd3f348894bfbde$var$endSectionTags = {
|
|
|
37573
37794
|
var $ecd3f348894bfbde$export$2e2bcd8739ae039 = $ecd3f348894bfbde$var$UltimateGuitarParser;
|
|
37574
37795
|
|
|
37575
37796
|
|
|
37576
|
-
var $a91afe1497b28cb4$export$2e2bcd8739ae039 = '14.
|
|
37797
|
+
var $a91afe1497b28cb4$export$2e2bcd8739ae039 = '14.6.0';
|
|
37577
37798
|
|
|
37578
37799
|
|
|
37579
37800
|
|