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 CHANGED
@@ -33871,6 +33871,7 @@ var ChordSheetJS = (() => {
33871
33871
  * @param {boolean} isRhythmSymbol Whether this pair represents a rhythm symbol
33872
33872
  */
33873
33873
  constructor(chords = "", lyrics = null, annotation = null, chordObj = null, isRhythmSymbol = false) {
33874
+ this.parentLine = null;
33874
33875
  this._chordObj = null;
33875
33876
  this.chords = chords || "";
33876
33877
  this.lyrics = lyrics || "";
@@ -36962,8 +36963,9 @@ ${error.stack}`);
36962
36963
  */
36963
36964
  toString({ useUnicodeModifier = false } = {}) {
36964
36965
  let chordString = "";
36965
- const suffix = this.suffix || "";
36966
+ let suffix = this.suffix || "";
36966
36967
  const showMinor = suffix[0] !== "m";
36968
+ if (useUnicodeModifier) suffix = suffix.replace(/#(?=\d)/g, "\u266F").replace(/b(?=\d)/g, "\u266D");
36967
36969
  if (this.root) chordString = this.root.toString({
36968
36970
  showMinor,
36969
36971
  useUnicodeModifier
@@ -38043,6 +38045,7 @@ ${error.stack}`);
38043
38045
  var $6c1ed1378c3b5965$export$2e2bcd8739ae039 = $6c1ed1378c3b5965$var$ChordDefinition;
38044
38046
  var $0bd084786477abba$var$Comment = class _$0bd084786477abba$var$Comment {
38045
38047
  constructor(content) {
38048
+ this.parentLine = null;
38046
38049
  this.content = content;
38047
38050
  }
38048
38051
  /**
@@ -38066,6 +38069,7 @@ ${error.stack}`);
38066
38069
  var $0bd084786477abba$export$2e2bcd8739ae039 = $0bd084786477abba$var$Comment;
38067
38070
  var $c5ce4fc4f57fe810$var$AstComponent = class {
38068
38071
  constructor(traceInfo = null) {
38072
+ this.parentLine = null;
38069
38073
  this.line = null;
38070
38074
  this.column = null;
38071
38075
  this.offset = null;
@@ -38541,129 +38545,301 @@ ${error.stack}`);
38541
38545
  },
38542
38546
  fonts: {
38543
38547
  title: {
38544
- name: "NimbusSansL-Bol",
38548
+ name: "Arial",
38545
38549
  style: "bold",
38546
- size: 24,
38547
- color: "black"
38550
+ size: 22,
38551
+ color: "#151515"
38548
38552
  },
38549
38553
  subtitle: {
38550
- name: "NimbusSansL-Reg",
38554
+ name: "Arial",
38551
38555
  style: "normal",
38552
- size: 10,
38553
- color: 100
38556
+ size: 11,
38557
+ color: "#6f6f6f"
38554
38558
  },
38555
38559
  metadata: {
38556
- name: "NimbusSansL-Reg",
38560
+ name: "Arial",
38557
38561
  style: "normal",
38558
38562
  size: 10,
38559
- color: 100
38563
+ color: "#8b8b8b"
38560
38564
  },
38561
38565
  text: {
38562
- name: "NimbusSansL-Reg",
38566
+ name: "Arial",
38563
38567
  style: "normal",
38564
38568
  size: 10,
38565
- color: "black"
38569
+ color: "#232323"
38566
38570
  },
38567
38571
  chord: {
38568
- name: "NimbusSansL-Bol",
38572
+ name: "Arial",
38569
38573
  style: "bold",
38570
38574
  size: 9,
38571
- color: "black"
38575
+ color: "#232323"
38572
38576
  },
38573
38577
  comment: {
38574
- name: "NimbusSansL-Bol",
38578
+ name: "Arial",
38575
38579
  style: "bold",
38576
38580
  size: 10,
38577
- color: "black"
38581
+ color: "#232323"
38578
38582
  },
38579
38583
  sectionLabel: {
38580
- name: "NimbusSansL-Bol",
38584
+ name: "Arial",
38581
38585
  style: "bold",
38582
38586
  size: 10,
38583
- color: "black"
38587
+ color: "#a1312d"
38584
38588
  },
38585
38589
  annotation: {
38586
- name: "NimbusSansL-Reg",
38590
+ name: "Arial",
38587
38591
  style: "normal",
38588
38592
  size: 10,
38589
- color: "black"
38593
+ color: "#232323"
38590
38594
  }
38591
38595
  },
38592
38596
  layout: {
38593
38597
  global: {
38594
38598
  margins: {
38595
- top: 35,
38596
- bottom: 10,
38599
+ top: 14,
38600
+ bottom: 12,
38597
38601
  left: 45,
38598
38602
  right: 45
38599
38603
  }
38600
38604
  },
38601
38605
  header: {
38602
- height: 60,
38606
+ height: 72,
38603
38607
  content: [
38604
38608
  {
38605
38609
  type: "text",
38606
38610
  template: "%{title}",
38607
38611
  style: {
38608
- name: "NimbusSansL-Bol",
38612
+ name: "Arial",
38609
38613
  style: "bold",
38610
- size: 24,
38611
- color: "black"
38614
+ size: 19,
38615
+ color: "#151515",
38616
+ weight: 700
38612
38617
  },
38613
38618
  position: {
38614
38619
  x: "left",
38615
- y: 15
38620
+ y: 0,
38621
+ clip: true,
38622
+ ellipsis: true
38623
+ },
38624
+ condition: {
38625
+ page: {
38626
+ first: true
38627
+ }
38616
38628
  }
38617
38629
  },
38618
38630
  {
38619
38631
  type: "text",
38620
- template: "Key of %{key} - BPM %{tempo} - Time %{time}",
38632
+ template: "%{artist}",
38621
38633
  style: {
38622
- name: "NimbusSansL-Reg",
38634
+ name: "Arial",
38623
38635
  style: "normal",
38624
- size: 12,
38625
- color: 100
38636
+ size: 11,
38637
+ color: "#6f6f6f"
38626
38638
  },
38627
38639
  position: {
38628
38640
  x: "left",
38629
- y: 28
38641
+ y: 25,
38642
+ clip: true,
38643
+ ellipsis: true
38644
+ },
38645
+ condition: {
38646
+ page: {
38647
+ first: true
38648
+ }
38630
38649
  }
38631
38650
  },
38632
38651
  {
38633
38652
  type: "text",
38634
- template: "By %{artist} %{subtitle}",
38653
+ template: "%{tempo|%{} BPM}%{time| \xB7 %{}}%{capo| \xB7 Capo %{}}",
38635
38654
  style: {
38636
- name: "NimbusSansL-Reg",
38655
+ name: "Arial",
38637
38656
  style: "normal",
38638
- size: 10,
38639
- color: 100
38657
+ size: 11,
38658
+ color: "#6f6f6f"
38640
38659
  },
38641
38660
  position: {
38642
38661
  x: "left",
38643
- y: 38
38662
+ y: 40,
38663
+ width: 240,
38664
+ clip: true,
38665
+ ellipsis: true
38666
+ },
38667
+ condition: {
38668
+ page: {
38669
+ first: true
38670
+ }
38644
38671
  }
38645
- }
38646
- ]
38647
- },
38648
- footer: {
38649
- height: 30,
38650
- content: [
38672
+ },
38673
+ {
38674
+ type: "line",
38675
+ style: {
38676
+ width: 1,
38677
+ color: "#d7d7d7"
38678
+ },
38679
+ position: {
38680
+ x: 0,
38681
+ y: 60,
38682
+ width: "auto",
38683
+ height: 0
38684
+ },
38685
+ condition: {
38686
+ page: {
38687
+ first: true
38688
+ }
38689
+ }
38690
+ },
38651
38691
  {
38652
38692
  type: "text",
38653
- value: "\xA92024 My Music Publishing",
38693
+ template: "%{key}",
38694
+ cssClass: "measured-html-key-badge",
38695
+ elementStyle: {
38696
+ width: "28px",
38697
+ height: "28px",
38698
+ display: "flex",
38699
+ alignItems: "center",
38700
+ justifyContent: "center",
38701
+ borderRadius: "999px",
38702
+ backgroundColor: "#a1312d",
38703
+ textAlign: "center",
38704
+ boxSizing: "border-box"
38705
+ },
38654
38706
  style: {
38655
- name: "NimbusSansL-Reg",
38707
+ name: "Arial",
38708
+ style: "bold",
38709
+ size: 12,
38710
+ color: "#ffffff",
38711
+ weight: 700
38712
+ },
38713
+ position: {
38714
+ x: "right",
38715
+ y: 12,
38716
+ width: 28,
38717
+ offsetX: -2
38718
+ },
38719
+ condition: {
38720
+ and: [
38721
+ {
38722
+ page: {
38723
+ first: true
38724
+ }
38725
+ },
38726
+ {
38727
+ key: {
38728
+ exists: true
38729
+ }
38730
+ }
38731
+ ]
38732
+ }
38733
+ },
38734
+ {
38735
+ type: "text",
38736
+ template: "%{title}",
38737
+ style: {
38738
+ name: "Arial",
38739
+ style: "bold",
38740
+ size: 12,
38741
+ color: "#151515",
38742
+ weight: 700
38743
+ },
38744
+ position: {
38745
+ x: "left",
38746
+ y: 0,
38747
+ clip: true,
38748
+ ellipsis: true
38749
+ },
38750
+ condition: {
38751
+ page: {
38752
+ greater_than: 1
38753
+ }
38754
+ }
38755
+ },
38756
+ {
38757
+ type: "text",
38758
+ template: "%{page}/%{pages}",
38759
+ style: {
38760
+ name: "Arial",
38656
38761
  style: "normal",
38657
38762
  size: 10,
38658
- color: "black"
38763
+ color: "#9a9a9a"
38659
38764
  },
38660
38765
  position: {
38661
- x: "left",
38662
- y: 0
38766
+ x: "right",
38767
+ y: 4,
38768
+ offsetX: -38
38769
+ },
38770
+ condition: {
38771
+ page: {
38772
+ greater_than: 1
38773
+ }
38774
+ }
38775
+ },
38776
+ {
38777
+ type: "text",
38778
+ template: "%{key}",
38779
+ cssClass: "measured-html-key-badge",
38780
+ elementStyle: {
38781
+ width: "28px",
38782
+ height: "28px",
38783
+ display: "flex",
38784
+ alignItems: "center",
38785
+ justifyContent: "center",
38786
+ borderRadius: "999px",
38787
+ backgroundColor: "#a1312d",
38788
+ textAlign: "center",
38789
+ boxSizing: "border-box"
38790
+ },
38791
+ style: {
38792
+ name: "Arial",
38793
+ style: "bold",
38794
+ size: 12,
38795
+ color: "#ffffff",
38796
+ weight: 700
38797
+ },
38798
+ position: {
38799
+ x: "right",
38800
+ y: 2,
38801
+ width: 28,
38802
+ offsetX: -2
38803
+ },
38804
+ condition: {
38805
+ and: [
38806
+ {
38807
+ page: {
38808
+ greater_than: 1
38809
+ }
38810
+ },
38811
+ {
38812
+ key: {
38813
+ exists: true
38814
+ }
38815
+ }
38816
+ ]
38817
+ }
38818
+ },
38819
+ {
38820
+ type: "line",
38821
+ style: {
38822
+ width: 1,
38823
+ color: "#d7d7d7"
38824
+ },
38825
+ position: {
38826
+ x: 0,
38827
+ y: 32,
38828
+ width: "auto",
38829
+ height: 0
38830
+ },
38831
+ condition: {
38832
+ page: {
38833
+ greater_than: 1
38834
+ }
38663
38835
  }
38664
38836
  }
38665
38837
  ]
38666
38838
  },
38839
+ footer: {
38840
+ height: 0,
38841
+ content: []
38842
+ },
38667
38843
  sections: {
38668
38844
  global: {
38669
38845
  paragraphSpacing: 10,
@@ -38710,22 +38886,22 @@ ${error.stack}`);
38710
38886
  },
38711
38887
  fonts: {
38712
38888
  title: {
38713
- name: "NimbusSansL-Bol",
38889
+ name: "Arial",
38714
38890
  style: "bold",
38715
38891
  size: 9,
38716
- color: "black"
38892
+ color: "#232323"
38717
38893
  },
38718
38894
  fingerings: {
38719
- name: "NimbusSansL-Bol",
38895
+ name: "Arial",
38720
38896
  style: "bold",
38721
38897
  size: 6,
38722
- color: "black"
38898
+ color: "#232323"
38723
38899
  },
38724
38900
  baseFret: {
38725
- name: "NimbusSansL-Bol",
38901
+ name: "Arial",
38726
38902
  style: "bold",
38727
38903
  size: 6,
38728
- color: "black"
38904
+ color: "#232323"
38729
38905
  }
38730
38906
  }
38731
38907
  }
@@ -39454,7 +39630,11 @@ ${formattedContentLines}`;
39454
39630
  if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) this.addTag(item);
39455
39631
  else if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) this.addChordLyricsPair(item);
39456
39632
  else if (item instanceof (0, $0bd084786477abba$export$2e2bcd8739ae039)) this.addComment(item);
39457
- else this.items.push(item);
39633
+ else {
39634
+ const addedItem = item;
39635
+ addedItem.parentLine = this;
39636
+ this.items.push(addedItem);
39637
+ }
39458
39638
  }
39459
39639
  /**
39460
39640
  * Indicates whether the line contains items that are renderable
@@ -39532,6 +39712,7 @@ ${formattedContentLines}`;
39532
39712
  addChordLyricsPair(chords = null, lyrics = null) {
39533
39713
  if (chords instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) this.currentChordLyricsPair = chords;
39534
39714
  else this.currentChordLyricsPair = new (0, $551a223fc13b5c10$export$2e2bcd8739ae039)(chords || "", lyrics || "");
39715
+ this.currentChordLyricsPair.parentLine = this;
39535
39716
  this.items.push(this.currentChordLyricsPair);
39536
39717
  return this.currentChordLyricsPair;
39537
39718
  }
@@ -39548,11 +39729,13 @@ ${formattedContentLines}`;
39548
39729
  }
39549
39730
  addTag(nameOrTag, value = null) {
39550
39731
  const tag = nameOrTag instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) ? nameOrTag : new (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)(nameOrTag, value);
39732
+ tag.parentLine = this;
39551
39733
  this.items.push(tag);
39552
39734
  return tag;
39553
39735
  }
39554
39736
  addComment(content) {
39555
39737
  const comment = content instanceof (0, $0bd084786477abba$export$2e2bcd8739ae039) ? content : new (0, $0bd084786477abba$export$2e2bcd8739ae039)(content);
39738
+ comment.parentLine = this;
39556
39739
  this.items.push(comment);
39557
39740
  return comment;
39558
39741
  }
@@ -40791,7 +40974,7 @@ ${formattedContentLines}`;
40791
40974
  });
40792
40975
  }
40793
40976
  if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return _$c53141c05fae8382$var$Song.transposeChordLyricsPair(item, delta, transposedKey, normalizeChordSuffix, accidental);
40794
- if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039)) return _$c53141c05fae8382$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
40977
+ if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039) && _$c53141c05fae8382$var$Song.isMusicalSection(item.parentLine)) return _$c53141c05fae8382$var$Song.transposeLiteral(item, delta, transposedKey, normalizeChordSuffix, accidental);
40795
40978
  return item;
40796
40979
  });
40797
40980
  }
@@ -40902,10 +41085,18 @@ ${formattedContentLines}`;
40902
41085
  changeChords(func) {
40903
41086
  return this.mapItems((item) => {
40904
41087
  if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return item.changeChord(func);
40905
- if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039)) return _$c53141c05fae8382$var$Song.mapChordsInLiteral(item, func);
41088
+ if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039) && _$c53141c05fae8382$var$Song.isMusicalSection(item.parentLine)) return _$c53141c05fae8382$var$Song.mapChordsInLiteral(item, func);
40906
41089
  return item;
40907
41090
  });
40908
41091
  }
41092
+ static isMusicalSection(line) {
41093
+ return line === null || ![
41094
+ (0, $dce48cb70c4120bb$export$92249c36c213e508),
41095
+ (0, $dce48cb70c4120bb$export$6a5a2eab72b6e3d),
41096
+ (0, $dce48cb70c4120bb$export$13f4b12aafeba5d6),
41097
+ (0, $dce48cb70c4120bb$export$5a2cf64ea612936a)
41098
+ ].includes(line.type);
41099
+ }
40909
41100
  static mapChordsInLiteral(item, func) {
40910
41101
  const changedString = item.string.replace(/(\s|^)(\S+)(?=\s|$)/g, (_match, space, token) => {
40911
41102
  const chord = (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(token);
@@ -59606,6 +59797,7 @@ Or set the song key before changing key:
59606
59797
  * Gets conditional CSS styles from font configuration
59607
59798
  */
59608
59799
  getConditionalStyles(style) {
59800
+ const normalizedFontStyles = this.getNormalizedFontStyles(style);
59609
59801
  return {
59610
59802
  ...style.name && {
59611
59803
  fontFamily: style.name
@@ -59613,15 +59805,7 @@ Or set the song key before changing key:
59613
59805
  ...style.size && {
59614
59806
  fontSize: `${style.size}px`
59615
59807
  },
59616
- ...style.weight && {
59617
- fontWeight: style.weight
59618
- },
59619
- ...style.style && {
59620
- fontStyle: style.style
59621
- },
59622
- ...style.color && {
59623
- color: style.color
59624
- },
59808
+ ...normalizedFontStyles,
59625
59809
  ...style.underline && {
59626
59810
  textDecoration: "underline"
59627
59811
  },
@@ -59672,6 +59856,7 @@ Or set the song key before changing key:
59672
59856
  * Applies font styles to an HTML element
59673
59857
  */
59674
59858
  applyFontStyle(element, style) {
59859
+ const normalizedFontStyles = this.getNormalizedFontStyles(style);
59675
59860
  const styles = {
59676
59861
  whiteSpace: "pre",
59677
59862
  ...style.name && {
@@ -59680,15 +59865,7 @@ Or set the song key before changing key:
59680
59865
  ...style.size && {
59681
59866
  fontSize: `${style.size}px`
59682
59867
  },
59683
- ...style.weight && {
59684
- fontWeight: style.weight
59685
- },
59686
- ...style.style && {
59687
- fontStyle: style.style
59688
- },
59689
- ...style.color && {
59690
- color: style.color
59691
- },
59868
+ ...normalizedFontStyles,
59692
59869
  ...style.underline && {
59693
59870
  textDecoration: "underline"
59694
59871
  },
@@ -59721,6 +59898,27 @@ Or set the song key before changing key:
59721
59898
  getCustomClass(elementType) {
59722
59899
  return this.config.cssClasses?.[elementType];
59723
59900
  }
59901
+ getNormalizedFontStyles(style) {
59902
+ const fontWeight = style.weight ?? (style.style === "bold" ? "bold" : void 0);
59903
+ const fontStyle = style.style && style.style !== "bold" ? style.style : void 0;
59904
+ const color = this.normalizeColor(style.color);
59905
+ return {
59906
+ ...fontWeight && {
59907
+ fontWeight
59908
+ },
59909
+ ...fontStyle && {
59910
+ fontStyle
59911
+ },
59912
+ ...color && {
59913
+ color
59914
+ }
59915
+ };
59916
+ }
59917
+ normalizeColor(color) {
59918
+ if (typeof color === "number") return `rgb(${color}, ${color}, ${color})`;
59919
+ if (typeof color === "string" && /^\d+$/.test(color)) return `rgb(${color}, ${color}, ${color})`;
59920
+ return color;
59921
+ }
59724
59922
  };
59725
59923
  var $0594288a7c3f9fa6$export$2e2bcd8739ae039 = $0594288a7c3f9fa6$export$94eb343ca6d26096;
59726
59924
  function $bdd8c6196670168a$var$isNumber(value) {
@@ -59955,7 +60153,14 @@ Or set the song key before changing key:
59955
60153
  if (!contentItem.condition) return true;
59956
60154
  const { metadata: songMetadata, extraMetadata } = this.context;
59957
60155
  const metadata = new Proxy({}, {
59958
- get: (_3, prop) => extraMetadata?.[prop] ?? songMetadata.get(prop)
60156
+ get: (_3, prop) => {
60157
+ const value = extraMetadata?.[prop] ?? songMetadata.get(prop);
60158
+ if ((prop === "page" || prop === "pages" || prop === "renderTime") && typeof value === "string") {
60159
+ const numericValue = Number(value);
60160
+ if (!Number.isNaN(numericValue)) return numericValue;
60161
+ }
60162
+ return value;
60163
+ }
59959
60164
  });
59960
60165
  return new (0, $bdd8c6196670168a$export$2e2bcd8739ae039)(contentItem.condition, metadata).evaluate();
59961
60166
  }
@@ -59970,16 +60175,19 @@ Or set the song key before changing key:
59970
60175
  this.backend.setFontStyle(style);
59971
60176
  const availableWidth = position.width || this.getAvailableWidth();
59972
60177
  const y3 = sectionY + position.y;
59973
- if (position.clip) this.renderClippedText(textValue, position, availableWidth, y3, style);
59974
- else this.renderMultilineText(textValue, position, availableWidth, y3, style);
60178
+ if (position.clip) this.renderClippedText(textValue, textItem, availableWidth, y3, style);
60179
+ else this.renderMultilineText(textValue, textItem, availableWidth, y3, style);
59975
60180
  }
59976
60181
  /**
59977
60182
  * Renders clipped text with optional ellipsis
59978
60183
  */
59979
- renderClippedText(textValue, position, availableWidth, y3, style) {
60184
+ renderClippedText(textValue, textItem, availableWidth, y3, style) {
60185
+ const { position } = textItem;
59980
60186
  const clippedText = position.ellipsis ? this.clipTextWithEllipsis(textValue, availableWidth, style) : this.clipText(textValue, availableWidth, style);
59981
60187
  const textWidth = this.backend.getTextWidth(clippedText, style);
59982
- const x2 = this.calculateX(position.x, textWidth);
60188
+ const alignmentWidth = position.width ?? textWidth;
60189
+ this.backend.setTextItem?.(textItem);
60190
+ const x2 = this.calculateX(position.x, alignmentWidth, position.offsetX);
59983
60191
  this.backend.text(clippedText, x2, y3);
59984
60192
  }
59985
60193
  /**
@@ -60001,12 +60209,15 @@ Or set the song key before changing key:
60001
60209
  /**
60002
60210
  * Renders multiline text
60003
60211
  */
60004
- renderMultilineText(textValue, position, availableWidth, y3, style) {
60212
+ renderMultilineText(textValue, textItem, availableWidth, y3, style) {
60213
+ const { position } = textItem;
60005
60214
  const lines = this.backend.splitTextToSize(textValue, availableWidth, style);
60006
60215
  let tempY = y3;
60007
60216
  lines.forEach((line) => {
60008
60217
  const lineWidth = this.backend.getTextWidth(line, style);
60009
- const x2 = this.calculateX(position.x, lineWidth);
60218
+ const alignmentWidth = position.width ?? lineWidth;
60219
+ this.backend.setTextItem?.(textItem);
60220
+ const x2 = this.calculateX(position.x, alignmentWidth, position.offsetX);
60010
60221
  this.backend.text(line, x2, tempY);
60011
60222
  tempY += style.size * (style.lineHeight ?? 1.2);
60012
60223
  });
@@ -60016,7 +60227,7 @@ Or set the song key before changing key:
60016
60227
  */
60017
60228
  renderImage(imageItem, sectionY) {
60018
60229
  const { src, position, size, alias, compression, rotation } = imageItem;
60019
- const x2 = this.calculateX(position.x, size.width);
60230
+ const x2 = this.calculateX(position.x, size.width, position.offsetX);
60020
60231
  const y3 = sectionY + position.y;
60021
60232
  const format = src.split(".").pop()?.toUpperCase();
60022
60233
  this.backend.addImage(src, format, x2, y3, size.width, size.height, alias, compression, rotation);
@@ -60053,16 +60264,16 @@ ${template}
60053
60264
  /**
60054
60265
  * Calculates the X position based on alignment
60055
60266
  */
60056
- calculateX(alignment, width = 0) {
60267
+ calculateX(alignment, width = 0, offsetX = 0) {
60057
60268
  switch (alignment) {
60058
60269
  case "center":
60059
- return this.backend.pageSize.width / 2 - width / 2;
60270
+ return this.backend.pageSize.width / 2 - width / 2 + offsetX;
60060
60271
  case "right":
60061
- return this.backend.pageSize.width - this.context.margins.right - width;
60272
+ return this.backend.pageSize.width - this.context.margins.right - width + offsetX;
60062
60273
  case "left":
60063
60274
  default:
60064
- if (typeof alignment === "number") return this.context.margins.left + alignment;
60065
- return this.context.margins.left;
60275
+ if (typeof alignment === "number") return this.context.margins.left + alignment + offsetX;
60276
+ return this.context.margins.left + offsetX;
60066
60277
  }
60067
60278
  }
60068
60279
  /**
@@ -60335,7 +60546,6 @@ ${template}
60335
60546
  recordRenderingTime() {
60336
60547
  const endTime = performance.now();
60337
60548
  this.renderTime = (endTime - this.startTime) / 1e3;
60338
- console.log(`Rendered in ${this.renderTime.toFixed(2)} seconds`);
60339
60549
  }
60340
60550
  /**
60341
60551
  * Get the elements for a specific page
@@ -60469,7 +60679,7 @@ ${template}
60469
60679
  * Creates a new HtmlRenderer
60470
60680
  */
60471
60681
  constructor(song, container, configuration) {
60472
- super(song), this._dimensions = null, this._dimensionCacheKey = null;
60682
+ super(song), this.currentLayoutFontStyle = null, this.currentLayoutSection = null, this.currentLayoutTextItem = null, this.currentLineStyle = null, this._dimensions = null, this._dimensionCacheKey = null;
60473
60683
  this.container = container;
60474
60684
  this.configuration = configuration;
60475
60685
  this.styler = new (0, $0594288a7c3f9fa6$export$2e2bcd8739ae039)({
@@ -60530,36 +60740,52 @@ ${template}
60530
60740
  console.log("Chord diagram rendering is stubbed out");
60531
60741
  }
60532
60742
  renderHeadersAndFooters() {
60533
- const layoutRenderer = this.createLayoutRenderer();
60534
- if (this.getHeaderConfig()) this.doc.eachPage(() => {
60535
- layoutRenderer.renderLayout(this.getHeaderConfig(), "header");
60536
- });
60537
- if (this.getFooterConfig()) this.doc.eachPage(() => {
60538
- layoutRenderer.renderLayout(this.getFooterConfig(), "footer");
60743
+ const headerConfig = this.getHeaderConfig();
60744
+ const footerConfig = this.getFooterConfig();
60745
+ if (headerConfig) this.renderLayoutForEachPage(headerConfig, "header");
60746
+ if (footerConfig) this.renderLayoutForEachPage(footerConfig, "footer");
60747
+ this.resetLayoutRenderingState();
60748
+ }
60749
+ renderLayoutForEachPage(layoutConfig, section) {
60750
+ this.doc.eachPage((_page, index2) => {
60751
+ this.currentLayoutSection = section;
60752
+ this.resetLayoutRenderingState(section);
60753
+ this.createLayoutRenderer(index2 + 1, this.doc.totalPages).renderLayout(layoutConfig, section);
60539
60754
  });
60540
60755
  }
60541
- createLayoutRenderer() {
60542
- const backend = this.createLayoutBackend();
60756
+ resetLayoutRenderingState(section = null) {
60757
+ this.currentLayoutSection = section;
60758
+ this.currentLayoutFontStyle = null;
60759
+ this.currentLayoutTextItem = null;
60760
+ this.currentLineStyle = null;
60761
+ }
60762
+ createLayoutRenderer(page, totalPages) {
60763
+ const backend = this.createLayoutBackend(page, totalPages);
60543
60764
  return new (0, $2e404bc796b05dec$export$2e2bcd8739ae039)(backend, {
60544
60765
  metadata: this.song.metadata,
60545
60766
  margins: this.dimensions.margins,
60546
- extraMetadata: this.getExtraMetadata(this.doc.currentPage, this.doc.totalPages)
60767
+ extraMetadata: this.getExtraMetadata(page, totalPages)
60547
60768
  });
60548
60769
  }
60549
- createLayoutBackend() {
60770
+ createLayoutBackend(page, totalPages) {
60550
60771
  return {
60551
60772
  pageSize: this.doc.pageSize,
60552
- currentPage: this.doc.currentPage,
60553
- totalPages: this.doc.totalPages,
60773
+ currentPage: page,
60774
+ totalPages,
60554
60775
  text: (content, x2, y3) => this.renderHtmlText(content, x2, y3),
60555
60776
  getTextWidth: (text2, font) => this.doc.getTextWidth(text2, font),
60556
60777
  splitTextToSize: (text2, maxWidth, font) => this.doc.splitTextToSize(text2, maxWidth, font),
60557
- setFontStyle: () => {
60778
+ setFontStyle: (style) => {
60779
+ this.currentLayoutFontStyle = style;
60780
+ },
60781
+ setTextItem: (item) => {
60782
+ this.currentLayoutTextItem = item;
60558
60783
  },
60559
60784
  addElement: (element, x2, y3) => this.doc.addElement(element, x2, y3),
60560
60785
  addImage: (src, _format, x2, y3, width, height) => this.renderHtmlImage(src, x2, y3, width, height),
60561
60786
  line: (x1, y1, x2, y22) => this.renderHtmlLine(x1, y1, x2, y22),
60562
- setLineStyle: () => {
60787
+ setLineStyle: (style) => {
60788
+ this.currentLineStyle = style;
60563
60789
  },
60564
60790
  resetDash: () => {
60565
60791
  }
@@ -60568,9 +60794,20 @@ ${template}
60568
60794
  renderHtmlText(content, x2, y3) {
60569
60795
  const element = document.createElement("div");
60570
60796
  element.className = `${this.styler.prefix}header-text`;
60797
+ this.applyLayoutTextClasses(element);
60571
60798
  element.textContent = content;
60799
+ this.applyLayoutTextStyles(element);
60572
60800
  this.doc.addElement(element, x2, y3);
60573
60801
  }
60802
+ applyLayoutTextClasses(element) {
60803
+ const sectionClass = this.currentLayoutSection ? this.styler.getCustomClass(this.currentLayoutSection) : void 0;
60804
+ if (sectionClass) element.classList.add(sectionClass);
60805
+ if (this.currentLayoutTextItem?.cssClass) element.classList.add(this.currentLayoutTextItem.cssClass);
60806
+ }
60807
+ applyLayoutTextStyles(element) {
60808
+ if (this.currentLayoutTextItem?.elementStyle) Object.assign(element.style, this.currentLayoutTextItem.elementStyle);
60809
+ if (this.currentLayoutFontStyle) this.styler.applyFontStyle(element, this.currentLayoutFontStyle);
60810
+ }
60574
60811
  renderHtmlImage(src, x2, y3, width, height) {
60575
60812
  const img = document.createElement("img");
60576
60813
  img.className = `${this.styler.prefix}image`;
@@ -60582,11 +60819,12 @@ ${template}
60582
60819
  renderHtmlLine(x1, y1, x2, _y2) {
60583
60820
  const lineElement = document.createElement("div");
60584
60821
  lineElement.className = `${this.styler.prefix}line`;
60822
+ const lineStyle = this.currentLineStyle;
60585
60823
  lineElement.style.width = `${x2 - x1}px`;
60586
- lineElement.style.height = "1px";
60587
- lineElement.style.borderBottomWidth = "1px";
60588
- lineElement.style.borderBottomStyle = "solid";
60589
- lineElement.style.borderBottomColor = "#000000";
60824
+ lineElement.style.height = "0";
60825
+ lineElement.style.borderBottomWidth = `${lineStyle?.width ?? 1}px`;
60826
+ lineElement.style.borderBottomStyle = lineStyle?.dash?.length ? "dashed" : "solid";
60827
+ lineElement.style.borderBottomColor = lineStyle?.color ?? "#000000";
60590
60828
  this.doc.addElement(lineElement, x1, y1);
60591
60829
  }
60592
60830
  renderParagraphs(paragraphLayouts) {
@@ -69993,7 +70231,7 @@ AjwCRQJ5AAAAAAABAAAAANpTmfAAAAAA0e+yRgAAAADR77JG
69993
70231
  }
69994
70232
  };
69995
70233
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
69996
- var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "14.5.1";
70234
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "14.6.1";
69997
70235
  var $a3816b486f741c00$exports = {};
69998
70236
  var $892913528e7f60f9$export$2e2bcd8739ae039 = {
69999
70237
  CHORUS: $dce48cb70c4120bb$export$8db6c706fc9142b2,