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/index.js CHANGED
@@ -4034,8 +4034,9 @@ const $b0c0093f9a3a0967$export$98e6a39c04603d36 = $b0c0093f9a3a0967$var$peg$pars
4034
4034
  * @returns {string} the chord string
4035
4035
  */ toString({ useUnicodeModifier: useUnicodeModifier = false } = {}) {
4036
4036
  let chordString = '';
4037
- const suffix = this.suffix || '';
4037
+ let suffix = this.suffix || '';
4038
4038
  const showMinor = suffix[0] !== 'm';
4039
+ if (useUnicodeModifier) suffix = suffix.replace(/#(?=\d)/g, '\u266f').replace(/b(?=\d)/g, '\u266d');
4039
4040
  if (this.root) chordString = this.root.toString({
4040
4041
  showMinor: showMinor,
4041
4042
  useUnicodeModifier: useUnicodeModifier
@@ -5662,129 +5663,301 @@ const $fb5aa6e96efc0a76$export$ccccd344e69710ef = {
5662
5663
  },
5663
5664
  fonts: {
5664
5665
  title: {
5665
- name: 'NimbusSansL-Bol',
5666
+ name: 'Arial',
5666
5667
  style: 'bold',
5667
- size: 24,
5668
- color: 'black'
5668
+ size: 22,
5669
+ color: '#151515'
5669
5670
  },
5670
5671
  subtitle: {
5671
- name: 'NimbusSansL-Reg',
5672
+ name: 'Arial',
5672
5673
  style: 'normal',
5673
- size: 10,
5674
- color: 100
5674
+ size: 11,
5675
+ color: '#6f6f6f'
5675
5676
  },
5676
5677
  metadata: {
5677
- name: 'NimbusSansL-Reg',
5678
+ name: 'Arial',
5678
5679
  style: 'normal',
5679
5680
  size: 10,
5680
- color: 100
5681
+ color: '#8b8b8b'
5681
5682
  },
5682
5683
  text: {
5683
- name: 'NimbusSansL-Reg',
5684
+ name: 'Arial',
5684
5685
  style: 'normal',
5685
5686
  size: 10,
5686
- color: 'black'
5687
+ color: '#232323'
5687
5688
  },
5688
5689
  chord: {
5689
- name: 'NimbusSansL-Bol',
5690
+ name: 'Arial',
5690
5691
  style: 'bold',
5691
5692
  size: 9,
5692
- color: 'black'
5693
+ color: '#232323'
5693
5694
  },
5694
5695
  comment: {
5695
- name: 'NimbusSansL-Bol',
5696
+ name: 'Arial',
5696
5697
  style: 'bold',
5697
5698
  size: 10,
5698
- color: 'black'
5699
+ color: '#232323'
5699
5700
  },
5700
5701
  sectionLabel: {
5701
- name: 'NimbusSansL-Bol',
5702
+ name: 'Arial',
5702
5703
  style: 'bold',
5703
5704
  size: 10,
5704
- color: 'black'
5705
+ color: '#a1312d'
5705
5706
  },
5706
5707
  annotation: {
5707
- name: 'NimbusSansL-Reg',
5708
+ name: 'Arial',
5708
5709
  style: 'normal',
5709
5710
  size: 10,
5710
- color: 'black'
5711
+ color: '#232323'
5711
5712
  }
5712
5713
  },
5713
5714
  layout: {
5714
5715
  global: {
5715
5716
  margins: {
5716
- top: 35,
5717
- bottom: 10,
5717
+ top: 14,
5718
+ bottom: 12,
5718
5719
  left: 45,
5719
5720
  right: 45
5720
5721
  }
5721
5722
  },
5722
5723
  header: {
5723
- height: 60,
5724
+ height: 72,
5724
5725
  content: [
5725
5726
  {
5726
5727
  type: 'text',
5727
5728
  template: '%{title}',
5728
5729
  style: {
5729
- name: 'NimbusSansL-Bol',
5730
+ name: 'Arial',
5730
5731
  style: 'bold',
5731
- size: 24,
5732
- color: 'black'
5732
+ size: 19,
5733
+ color: '#151515',
5734
+ weight: 700
5733
5735
  },
5734
5736
  position: {
5735
5737
  x: 'left',
5736
- y: 15
5738
+ y: 0,
5739
+ clip: true,
5740
+ ellipsis: true
5741
+ },
5742
+ condition: {
5743
+ page: {
5744
+ first: true
5745
+ }
5737
5746
  }
5738
5747
  },
5739
5748
  {
5740
5749
  type: 'text',
5741
- template: 'Key of %{key} - BPM %{tempo} - Time %{time}',
5750
+ template: '%{artist}',
5742
5751
  style: {
5743
- name: 'NimbusSansL-Reg',
5752
+ name: 'Arial',
5744
5753
  style: 'normal',
5745
- size: 12,
5746
- color: 100
5754
+ size: 11,
5755
+ color: '#6f6f6f'
5747
5756
  },
5748
5757
  position: {
5749
5758
  x: 'left',
5750
- y: 28
5759
+ y: 25,
5760
+ clip: true,
5761
+ ellipsis: true
5762
+ },
5763
+ condition: {
5764
+ page: {
5765
+ first: true
5766
+ }
5751
5767
  }
5752
5768
  },
5753
5769
  {
5754
5770
  type: 'text',
5755
- template: 'By %{artist} %{subtitle}',
5771
+ template: '%{tempo|%{} BPM}%{time| \u00b7 %{}}%{capo| \u00b7 Capo %{}}',
5756
5772
  style: {
5757
- name: 'NimbusSansL-Reg',
5773
+ name: 'Arial',
5758
5774
  style: 'normal',
5759
- size: 10,
5760
- color: 100
5775
+ size: 11,
5776
+ color: '#6f6f6f'
5761
5777
  },
5762
5778
  position: {
5763
5779
  x: 'left',
5764
- y: 38
5780
+ y: 40,
5781
+ width: 240,
5782
+ clip: true,
5783
+ ellipsis: true
5784
+ },
5785
+ condition: {
5786
+ page: {
5787
+ first: true
5788
+ }
5765
5789
  }
5766
- }
5767
- ]
5768
- },
5769
- footer: {
5770
- height: 30,
5771
- content: [
5790
+ },
5791
+ {
5792
+ type: 'line',
5793
+ style: {
5794
+ width: 1,
5795
+ color: '#d7d7d7'
5796
+ },
5797
+ position: {
5798
+ x: 0,
5799
+ y: 60,
5800
+ width: 'auto',
5801
+ height: 0
5802
+ },
5803
+ condition: {
5804
+ page: {
5805
+ first: true
5806
+ }
5807
+ }
5808
+ },
5772
5809
  {
5773
5810
  type: 'text',
5774
- value: "\xa92024 My Music Publishing",
5811
+ template: '%{key}',
5812
+ cssClass: 'measured-html-key-badge',
5813
+ elementStyle: {
5814
+ width: '28px',
5815
+ height: '28px',
5816
+ display: 'flex',
5817
+ alignItems: 'center',
5818
+ justifyContent: 'center',
5819
+ borderRadius: '999px',
5820
+ backgroundColor: '#a1312d',
5821
+ textAlign: 'center',
5822
+ boxSizing: 'border-box'
5823
+ },
5775
5824
  style: {
5776
- name: 'NimbusSansL-Reg',
5825
+ name: 'Arial',
5826
+ style: 'bold',
5827
+ size: 12,
5828
+ color: '#ffffff',
5829
+ weight: 700
5830
+ },
5831
+ position: {
5832
+ x: 'right',
5833
+ y: 12,
5834
+ width: 28,
5835
+ offsetX: -2
5836
+ },
5837
+ condition: {
5838
+ and: [
5839
+ {
5840
+ page: {
5841
+ first: true
5842
+ }
5843
+ },
5844
+ {
5845
+ key: {
5846
+ exists: true
5847
+ }
5848
+ }
5849
+ ]
5850
+ }
5851
+ },
5852
+ {
5853
+ type: 'text',
5854
+ template: '%{title}',
5855
+ style: {
5856
+ name: 'Arial',
5857
+ style: 'bold',
5858
+ size: 12,
5859
+ color: '#151515',
5860
+ weight: 700
5861
+ },
5862
+ position: {
5863
+ x: 'left',
5864
+ y: 0,
5865
+ clip: true,
5866
+ ellipsis: true
5867
+ },
5868
+ condition: {
5869
+ page: {
5870
+ greater_than: 1
5871
+ }
5872
+ }
5873
+ },
5874
+ {
5875
+ type: 'text',
5876
+ template: '%{page}/%{pages}',
5877
+ style: {
5878
+ name: 'Arial',
5777
5879
  style: 'normal',
5778
5880
  size: 10,
5779
- color: 'black'
5881
+ color: '#9a9a9a'
5780
5882
  },
5781
5883
  position: {
5782
- x: 'left',
5783
- y: 0
5884
+ x: 'right',
5885
+ y: 4,
5886
+ offsetX: -38
5887
+ },
5888
+ condition: {
5889
+ page: {
5890
+ greater_than: 1
5891
+ }
5892
+ }
5893
+ },
5894
+ {
5895
+ type: 'text',
5896
+ template: '%{key}',
5897
+ cssClass: 'measured-html-key-badge',
5898
+ elementStyle: {
5899
+ width: '28px',
5900
+ height: '28px',
5901
+ display: 'flex',
5902
+ alignItems: 'center',
5903
+ justifyContent: 'center',
5904
+ borderRadius: '999px',
5905
+ backgroundColor: '#a1312d',
5906
+ textAlign: 'center',
5907
+ boxSizing: 'border-box'
5908
+ },
5909
+ style: {
5910
+ name: 'Arial',
5911
+ style: 'bold',
5912
+ size: 12,
5913
+ color: '#ffffff',
5914
+ weight: 700
5915
+ },
5916
+ position: {
5917
+ x: 'right',
5918
+ y: 2,
5919
+ width: 28,
5920
+ offsetX: -2
5921
+ },
5922
+ condition: {
5923
+ and: [
5924
+ {
5925
+ page: {
5926
+ greater_than: 1
5927
+ }
5928
+ },
5929
+ {
5930
+ key: {
5931
+ exists: true
5932
+ }
5933
+ }
5934
+ ]
5935
+ }
5936
+ },
5937
+ {
5938
+ type: 'line',
5939
+ style: {
5940
+ width: 1,
5941
+ color: '#d7d7d7'
5942
+ },
5943
+ position: {
5944
+ x: 0,
5945
+ y: 32,
5946
+ width: 'auto',
5947
+ height: 0
5948
+ },
5949
+ condition: {
5950
+ page: {
5951
+ greater_than: 1
5952
+ }
5784
5953
  }
5785
5954
  }
5786
5955
  ]
5787
5956
  },
5957
+ footer: {
5958
+ height: 0,
5959
+ content: []
5960
+ },
5788
5961
  sections: {
5789
5962
  global: {
5790
5963
  paragraphSpacing: 10,
@@ -5831,22 +6004,22 @@ const $fb5aa6e96efc0a76$export$ccccd344e69710ef = {
5831
6004
  },
5832
6005
  fonts: {
5833
6006
  title: {
5834
- name: 'NimbusSansL-Bol',
6007
+ name: 'Arial',
5835
6008
  style: 'bold',
5836
6009
  size: 9,
5837
- color: 'black'
6010
+ color: '#232323'
5838
6011
  },
5839
6012
  fingerings: {
5840
- name: 'NimbusSansL-Bol',
6013
+ name: 'Arial',
5841
6014
  style: 'bold',
5842
6015
  size: 6,
5843
- color: 'black'
6016
+ color: '#232323'
5844
6017
  },
5845
6018
  baseFret: {
5846
- name: 'NimbusSansL-Bol',
6019
+ name: 'Arial',
5847
6020
  style: 'bold',
5848
6021
  size: 6,
5849
- color: 'black'
6022
+ color: '#232323'
5850
6023
  }
5851
6024
  }
5852
6025
  }
@@ -27162,6 +27335,7 @@ class $0594288a7c3f9fa6$export$94eb343ca6d26096 {
27162
27335
  /**
27163
27336
  * Gets conditional CSS styles from font configuration
27164
27337
  */ getConditionalStyles(style) {
27338
+ const normalizedFontStyles = this.getNormalizedFontStyles(style);
27165
27339
  return {
27166
27340
  ...style.name && {
27167
27341
  fontFamily: style.name
@@ -27169,15 +27343,7 @@ class $0594288a7c3f9fa6$export$94eb343ca6d26096 {
27169
27343
  ...style.size && {
27170
27344
  fontSize: `${style.size}px`
27171
27345
  },
27172
- ...style.weight && {
27173
- fontWeight: style.weight
27174
- },
27175
- ...style.style && {
27176
- fontStyle: style.style
27177
- },
27178
- ...style.color && {
27179
- color: style.color
27180
- },
27346
+ ...normalizedFontStyles,
27181
27347
  ...style.underline && {
27182
27348
  textDecoration: 'underline'
27183
27349
  },
@@ -27225,6 +27391,7 @@ class $0594288a7c3f9fa6$export$94eb343ca6d26096 {
27225
27391
  /**
27226
27392
  * Applies font styles to an HTML element
27227
27393
  */ applyFontStyle(element, style) {
27394
+ const normalizedFontStyles = this.getNormalizedFontStyles(style);
27228
27395
  const styles = {
27229
27396
  whiteSpace: 'pre',
27230
27397
  ...style.name && {
@@ -27233,15 +27400,7 @@ class $0594288a7c3f9fa6$export$94eb343ca6d26096 {
27233
27400
  ...style.size && {
27234
27401
  fontSize: `${style.size}px`
27235
27402
  },
27236
- ...style.weight && {
27237
- fontWeight: style.weight
27238
- },
27239
- ...style.style && {
27240
- fontStyle: style.style
27241
- },
27242
- ...style.color && {
27243
- color: style.color
27244
- },
27403
+ ...normalizedFontStyles,
27245
27404
  ...style.underline && {
27246
27405
  textDecoration: 'underline'
27247
27406
  },
@@ -27271,6 +27430,27 @@ class $0594288a7c3f9fa6$export$94eb343ca6d26096 {
27271
27430
  */ getCustomClass(elementType) {
27272
27431
  return this.config.cssClasses?.[elementType];
27273
27432
  }
27433
+ getNormalizedFontStyles(style) {
27434
+ const fontWeight = style.weight ?? (style.style === 'bold' ? 'bold' : undefined);
27435
+ const fontStyle = style.style && style.style !== 'bold' ? style.style : undefined;
27436
+ const color = this.normalizeColor(style.color);
27437
+ return {
27438
+ ...fontWeight && {
27439
+ fontWeight: fontWeight
27440
+ },
27441
+ ...fontStyle && {
27442
+ fontStyle: fontStyle
27443
+ },
27444
+ ...color && {
27445
+ color: color
27446
+ }
27447
+ };
27448
+ }
27449
+ normalizeColor(color) {
27450
+ if (typeof color === 'number') return `rgb(${color}, ${color}, ${color})`;
27451
+ if (typeof color === 'string' && /^\d+$/.test(color)) return `rgb(${color}, ${color}, ${color})`;
27452
+ return color;
27453
+ }
27274
27454
  }
27275
27455
  var $0594288a7c3f9fa6$export$2e2bcd8739ae039 = $0594288a7c3f9fa6$export$94eb343ca6d26096;
27276
27456
 
@@ -27522,7 +27702,14 @@ class $2e404bc796b05dec$export$f1e5feaa438be04f {
27522
27702
  if (!contentItem.condition) return true;
27523
27703
  const { metadata: songMetadata, extraMetadata: extraMetadata } = this.context;
27524
27704
  const metadata = new Proxy({}, {
27525
- get: (_, prop)=>extraMetadata?.[prop] ?? songMetadata.get(prop)
27705
+ get: (_, prop)=>{
27706
+ const value = extraMetadata?.[prop] ?? songMetadata.get(prop);
27707
+ if ((prop === 'page' || prop === 'pages' || prop === 'renderTime') && typeof value === 'string') {
27708
+ const numericValue = Number(value);
27709
+ if (!Number.isNaN(numericValue)) return numericValue;
27710
+ }
27711
+ return value;
27712
+ }
27526
27713
  });
27527
27714
  return new (0, $bdd8c6196670168a$export$2e2bcd8739ae039)(contentItem.condition, metadata).evaluate();
27528
27715
  }
@@ -27536,15 +27723,18 @@ class $2e404bc796b05dec$export$f1e5feaa438be04f {
27536
27723
  this.backend.setFontStyle(style);
27537
27724
  const availableWidth = position.width || this.getAvailableWidth();
27538
27725
  const y = sectionY + position.y;
27539
- if (position.clip) this.renderClippedText(textValue, position, availableWidth, y, style);
27540
- else this.renderMultilineText(textValue, position, availableWidth, y, style);
27726
+ if (position.clip) this.renderClippedText(textValue, textItem, availableWidth, y, style);
27727
+ else this.renderMultilineText(textValue, textItem, availableWidth, y, style);
27541
27728
  }
27542
27729
  /**
27543
27730
  * Renders clipped text with optional ellipsis
27544
- */ renderClippedText(textValue, position, availableWidth, y, style) {
27731
+ */ renderClippedText(textValue, textItem, availableWidth, y, style) {
27732
+ const { position: position } = textItem;
27545
27733
  const clippedText = position.ellipsis ? this.clipTextWithEllipsis(textValue, availableWidth, style) : this.clipText(textValue, availableWidth, style);
27546
27734
  const textWidth = this.backend.getTextWidth(clippedText, style);
27547
- const x = this.calculateX(position.x, textWidth);
27735
+ const alignmentWidth = position.width ?? textWidth;
27736
+ this.backend.setTextItem?.(textItem);
27737
+ const x = this.calculateX(position.x, alignmentWidth, position.offsetX);
27548
27738
  this.backend.text(clippedText, x, y);
27549
27739
  }
27550
27740
  /**
@@ -27563,12 +27753,15 @@ class $2e404bc796b05dec$export$f1e5feaa438be04f {
27563
27753
  }
27564
27754
  /**
27565
27755
  * Renders multiline text
27566
- */ renderMultilineText(textValue, position, availableWidth, y, style) {
27756
+ */ renderMultilineText(textValue, textItem, availableWidth, y, style) {
27757
+ const { position: position } = textItem;
27567
27758
  const lines = this.backend.splitTextToSize(textValue, availableWidth, style);
27568
27759
  let tempY = y;
27569
27760
  lines.forEach((line)=>{
27570
27761
  const lineWidth = this.backend.getTextWidth(line, style);
27571
- const x = this.calculateX(position.x, lineWidth);
27762
+ const alignmentWidth = position.width ?? lineWidth;
27763
+ this.backend.setTextItem?.(textItem);
27764
+ const x = this.calculateX(position.x, alignmentWidth, position.offsetX);
27572
27765
  this.backend.text(line, x, tempY);
27573
27766
  tempY += style.size * (style.lineHeight ?? 1.2);
27574
27767
  });
@@ -27577,7 +27770,7 @@ class $2e404bc796b05dec$export$f1e5feaa438be04f {
27577
27770
  * Renders an image
27578
27771
  */ renderImage(imageItem, sectionY) {
27579
27772
  const { src: src, position: position, size: size, alias: alias, compression: compression, rotation: rotation } = imageItem;
27580
- const x = this.calculateX(position.x, size.width);
27773
+ const x = this.calculateX(position.x, size.width, position.offsetX);
27581
27774
  const y = sectionY + position.y;
27582
27775
  const format = src.split('.').pop()?.toUpperCase();
27583
27776
  this.backend.addImage(src, format, x, y, size.width, size.height, alias, compression, rotation);
@@ -27607,16 +27800,16 @@ class $2e404bc796b05dec$export$f1e5feaa438be04f {
27607
27800
  }
27608
27801
  /**
27609
27802
  * Calculates the X position based on alignment
27610
- */ calculateX(alignment, width = 0) {
27803
+ */ calculateX(alignment, width = 0, offsetX = 0) {
27611
27804
  switch(alignment){
27612
27805
  case 'center':
27613
- return this.backend.pageSize.width / 2 - width / 2;
27806
+ return this.backend.pageSize.width / 2 - width / 2 + offsetX;
27614
27807
  case 'right':
27615
- return this.backend.pageSize.width - this.context.margins.right - width;
27808
+ return this.backend.pageSize.width - this.context.margins.right - width + offsetX;
27616
27809
  case 'left':
27617
27810
  default:
27618
- if (typeof alignment === 'number') return this.context.margins.left + alignment;
27619
- return this.context.margins.left;
27811
+ if (typeof alignment === 'number') return this.context.margins.left + alignment + offsetX;
27812
+ return this.context.margins.left + offsetX;
27620
27813
  }
27621
27814
  }
27622
27815
  /**
@@ -27887,8 +28080,6 @@ var $2e404bc796b05dec$export$2e2bcd8739ae039 = $2e404bc796b05dec$export$f1e5feaa
27887
28080
  */ recordRenderingTime() {
27888
28081
  const endTime = performance.now();
27889
28082
  this.renderTime = (endTime - this.startTime) / 1000;
27890
- // eslint-disable-next-line no-console
27891
- console.log(`Rendered in ${this.renderTime.toFixed(2)} seconds`);
27892
28083
  }
27893
28084
  /**
27894
28085
  * Get the elements for a specific page
@@ -28005,7 +28196,7 @@ var $952711184d4e89d8$export$2e2bcd8739ae039 = $952711184d4e89d8$var$Renderer;
28005
28196
  /**
28006
28197
  * Creates a new HtmlRenderer
28007
28198
  */ constructor(song, container, configuration){
28008
- super(song), this._dimensions = null, this._dimensionCacheKey = null;
28199
+ super(song), this.currentLayoutFontStyle = null, this.currentLayoutSection = null, this.currentLayoutTextItem = null, this.currentLineStyle = null, this._dimensions = null, this._dimensionCacheKey = null;
28009
28200
  this.container = container;
28010
28201
  this.configuration = configuration;
28011
28202
  this.styler = new (0, $0594288a7c3f9fa6$export$2e2bcd8739ae039)({
@@ -28067,44 +28258,73 @@ var $952711184d4e89d8$export$2e2bcd8739ae039 = $952711184d4e89d8$var$Renderer;
28067
28258
  console.log('Chord diagram rendering is stubbed out');
28068
28259
  }
28069
28260
  renderHeadersAndFooters() {
28070
- const layoutRenderer = this.createLayoutRenderer();
28071
- if (this.getHeaderConfig()) this.doc.eachPage(()=>{
28072
- layoutRenderer.renderLayout(this.getHeaderConfig(), 'header');
28073
- });
28074
- if (this.getFooterConfig()) this.doc.eachPage(()=>{
28075
- layoutRenderer.renderLayout(this.getFooterConfig(), 'footer');
28261
+ const headerConfig = this.getHeaderConfig();
28262
+ const footerConfig = this.getFooterConfig();
28263
+ if (headerConfig) this.renderLayoutForEachPage(headerConfig, 'header');
28264
+ if (footerConfig) this.renderLayoutForEachPage(footerConfig, 'footer');
28265
+ this.resetLayoutRenderingState();
28266
+ }
28267
+ renderLayoutForEachPage(layoutConfig, section) {
28268
+ this.doc.eachPage((_page, index)=>{
28269
+ this.currentLayoutSection = section;
28270
+ this.resetLayoutRenderingState(section);
28271
+ this.createLayoutRenderer(index + 1, this.doc.totalPages).renderLayout(layoutConfig, section);
28076
28272
  });
28077
28273
  }
28078
- createLayoutRenderer() {
28079
- const backend = this.createLayoutBackend();
28274
+ resetLayoutRenderingState(section = null) {
28275
+ this.currentLayoutSection = section;
28276
+ this.currentLayoutFontStyle = null;
28277
+ this.currentLayoutTextItem = null;
28278
+ this.currentLineStyle = null;
28279
+ }
28280
+ createLayoutRenderer(page, totalPages) {
28281
+ const backend = this.createLayoutBackend(page, totalPages);
28080
28282
  return new (0, $2e404bc796b05dec$export$2e2bcd8739ae039)(backend, {
28081
28283
  metadata: this.song.metadata,
28082
28284
  margins: this.dimensions.margins,
28083
- extraMetadata: this.getExtraMetadata(this.doc.currentPage, this.doc.totalPages)
28285
+ extraMetadata: this.getExtraMetadata(page, totalPages)
28084
28286
  });
28085
28287
  }
28086
- createLayoutBackend() {
28288
+ createLayoutBackend(page, totalPages) {
28087
28289
  return {
28088
28290
  pageSize: this.doc.pageSize,
28089
- currentPage: this.doc.currentPage,
28090
- totalPages: this.doc.totalPages,
28291
+ currentPage: page,
28292
+ totalPages: totalPages,
28091
28293
  text: (content, x, y)=>this.renderHtmlText(content, x, y),
28092
28294
  getTextWidth: (text, font)=>this.doc.getTextWidth(text, font),
28093
28295
  splitTextToSize: (text, maxWidth, font)=>this.doc.splitTextToSize(text, maxWidth, font),
28094
- setFontStyle: ()=>{},
28296
+ setFontStyle: (style)=>{
28297
+ this.currentLayoutFontStyle = style;
28298
+ },
28299
+ setTextItem: (item)=>{
28300
+ this.currentLayoutTextItem = item;
28301
+ },
28095
28302
  addElement: (element, x, y)=>this.doc.addElement(element, x, y),
28096
28303
  addImage: (src, _format, x, y, width, height)=>this.renderHtmlImage(src, x, y, width, height),
28097
28304
  line: (x1, y1, x2, y2)=>this.renderHtmlLine(x1, y1, x2, y2),
28098
- setLineStyle: ()=>{},
28305
+ setLineStyle: (style)=>{
28306
+ this.currentLineStyle = style;
28307
+ },
28099
28308
  resetDash: ()=>{}
28100
28309
  };
28101
28310
  }
28102
28311
  renderHtmlText(content, x, y) {
28103
28312
  const element = document.createElement('div');
28104
28313
  element.className = `${this.styler.prefix}header-text`;
28314
+ this.applyLayoutTextClasses(element);
28105
28315
  element.textContent = content;
28316
+ this.applyLayoutTextStyles(element);
28106
28317
  this.doc.addElement(element, x, y);
28107
28318
  }
28319
+ applyLayoutTextClasses(element) {
28320
+ const sectionClass = this.currentLayoutSection ? this.styler.getCustomClass(this.currentLayoutSection) : undefined;
28321
+ if (sectionClass) element.classList.add(sectionClass);
28322
+ if (this.currentLayoutTextItem?.cssClass) element.classList.add(this.currentLayoutTextItem.cssClass);
28323
+ }
28324
+ applyLayoutTextStyles(element) {
28325
+ if (this.currentLayoutTextItem?.elementStyle) Object.assign(element.style, this.currentLayoutTextItem.elementStyle);
28326
+ if (this.currentLayoutFontStyle) this.styler.applyFontStyle(element, this.currentLayoutFontStyle);
28327
+ }
28108
28328
  renderHtmlImage(src, x, y, width, height) {
28109
28329
  const img = document.createElement('img');
28110
28330
  img.className = `${this.styler.prefix}image`;
@@ -28116,11 +28336,12 @@ var $952711184d4e89d8$export$2e2bcd8739ae039 = $952711184d4e89d8$var$Renderer;
28116
28336
  renderHtmlLine(x1, y1, x2, _y2) {
28117
28337
  const lineElement = document.createElement('div');
28118
28338
  lineElement.className = `${this.styler.prefix}line`;
28339
+ const lineStyle = this.currentLineStyle;
28119
28340
  lineElement.style.width = `${x2 - x1}px`;
28120
- lineElement.style.height = '1px';
28121
- lineElement.style.borderBottomWidth = '1px';
28122
- lineElement.style.borderBottomStyle = 'solid';
28123
- lineElement.style.borderBottomColor = '#000000';
28341
+ lineElement.style.height = '0';
28342
+ lineElement.style.borderBottomWidth = `${lineStyle?.width ?? 1}px`;
28343
+ lineElement.style.borderBottomStyle = lineStyle?.dash?.length ? 'dashed' : 'solid';
28344
+ lineElement.style.borderBottomColor = lineStyle?.color ?? '#000000';
28124
28345
  this.doc.addElement(lineElement, x1, y1);
28125
28346
  }
28126
28347
  renderParagraphs(paragraphLayouts) {
@@ -37655,7 +37876,7 @@ const $a5a21ced491ea51f$var$endSectionTags = {
37655
37876
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
37656
37877
 
37657
37878
 
37658
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '14.5.1';
37879
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '14.6.0';
37659
37880
 
37660
37881
 
37661
37882