chordsheetjs 7.17.3 → 7.18.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/README.md CHANGED
@@ -366,7 +366,7 @@ subject to breaking changes between major versions.
366
366
  <dd><p>Represents a chord with the corresponding (partial) lyrics</p></dd>
367
367
  <dt><a href="#Comment">Comment</a></dt>
368
368
  <dd><p>Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview</p></dd>
369
- <dt><a href="#Line">Line</a></dt>
369
+ <dt><a href="#Line">Line</a> : <code><a href="#Font">Font</a></code></dt>
370
370
  <dd><p>Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag</p></dd>
371
371
  <dt><a href="#Metadata">Metadata</a></dt>
372
372
  <dd><p>Stores song metadata. Properties can be accessed using the get() method:</p>
@@ -453,6 +453,10 @@ Inherits from [ChordSheetParser](#ChordSheetParser)</p></dd>
453
453
  ## Members
454
454
 
455
455
  <dl>
456
+ <dt><a href="#Font">Font</a> : <code>string</code> | <code>null</code></dt>
457
+ <dd><p>The font color</p></dd>
458
+ <dt><a href="#FontSize">FontSize</a> : <code>number</code></dt>
459
+ <dd><p>The font size</p></dd>
456
460
  <dt><a href="#ALBUM">ALBUM</a> : <code>string</code></dt>
457
461
  <dd><p>Artist meta directive. See https://www.chordpro.org/chordpro/directives-artist/</p></dd>
458
462
  <dt><a href="#ARTIST">ARTIST</a> : <code>string</code></dt>
@@ -634,12 +638,13 @@ For a CSS string see [scopedCss](scopedCss)</p></dd>
634
638
  **Kind**: instance method of [<code>Comment</code>](#Comment)
635
639
  <a name="Line"></a>
636
640
 
637
- ## Line
641
+ ## Line : [<code>Font</code>](#Font)
638
642
  <p>Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag</p>
639
643
 
640
644
  **Kind**: global class
641
645
 
642
- * [Line](#Line)
646
+ * [Line](#Line) : [<code>Font</code>](#Font)
647
+ * [new Line()](#new_Line_new)
643
648
  * [.isEmpty()](#Line+isEmpty) ⇒ <code>boolean</code>
644
649
  * [.addItem(item)](#Line+addItem)
645
650
  * [.hasRenderableItems()](#Line+hasRenderableItems) ⇒ <code>boolean</code>
@@ -648,6 +653,13 @@ For a CSS string see [scopedCss](scopedCss)</p></dd>
648
653
  * [.isChorus()](#Line+isChorus) ⇒ <code>boolean</code>
649
654
  * ~~[.hasContent()](#Line+hasContent) ⇒ <code>boolean</code>~~
650
655
 
656
+ <a name="new_Line_new"></a>
657
+
658
+ ### new Line()
659
+ <p>The chord font that applies to this line. Is derived from the directives:
660
+ <code>chordfont</code>, <code>chordsize</code> and <code>chordcolour</code>
661
+ See: https://www.chordpro.org/chordpro/directives-props_chord_legacy/</p>
662
+
651
663
  <a name="Line+isEmpty"></a>
652
664
 
653
665
  ### line.isEmpty() ⇒ <code>boolean</code>
@@ -750,9 +762,16 @@ else it returns an array of strings.</p>
750
762
  **Kind**: global class
751
763
 
752
764
  * [Paragraph](#Paragraph)
765
+ * [.addLine](#Paragraph+addLine) : [<code>Array.&lt;Line&gt;</code>](#Line)
753
766
  * [.type](#Paragraph+type) ⇒ <code>string</code>
754
767
  * [.hasRenderableItems()](#Paragraph+hasRenderableItems) ⇒ <code>boolean</code>
755
768
 
769
+ <a name="Paragraph+addLine"></a>
770
+
771
+ ### paragraph.addLine : [<code>Array.&lt;Line&gt;</code>](#Line)
772
+ <p>The [Line](#Line) items of which the paragraph consists</p>
773
+
774
+ **Kind**: instance property of [<code>Paragraph</code>](#Paragraph)
756
775
  <a name="Paragraph+type"></a>
757
776
 
758
777
  ### paragraph.type ⇒ <code>string</code>
@@ -1676,6 +1695,64 @@ Can be deserialized using [deserialize](deserialize)</p>
1676
1695
  | oneKey | [<code>Key</code>](#Key) \| <code>string</code> | <p>the key</p> |
1677
1696
  | otherKey | [<code>Key</code>](#Key) \| <code>string</code> | <p>the other key</p> |
1678
1697
 
1698
+ <a name="Font"></a>
1699
+
1700
+ ## Font : <code>string</code> \| <code>null</code>
1701
+ <p>The font color</p>
1702
+
1703
+ **Kind**: global variable
1704
+ <a name="Font+toCssString"></a>
1705
+
1706
+ ### font.toCssString() ⇒ <code>string</code>
1707
+ <p>Converts the font, size and color to a CSS string.
1708
+ If possible, font and size are combined to the <code>font</code> shorthand.
1709
+ If <code>font</code> contains double quotes (<code>&quot;</code>) those will be converted to single quotes (<code>'</code>).</p>
1710
+
1711
+ **Kind**: instance method of [<code>Font</code>](#Font)
1712
+ **Returns**: <code>string</code> - <p>The CSS string</p>
1713
+ **Example**
1714
+ ```js
1715
+ // Returns "font-family: 'Times New Roman'"
1716
+ new Font({ font: '"Times New Roman"' }).toCssString()
1717
+ ```
1718
+ **Example**
1719
+ ```js
1720
+ // Returns "color: red; font-family: Verdana"
1721
+ new Font({ font: 'Verdana', colour: 'red' }).toCssString()
1722
+ ```
1723
+ **Example**
1724
+ ```js
1725
+ // Returns "font: 30px Verdana"
1726
+ new Font({ font: 'Verdana', size: '30' }).toCssString()
1727
+ ```
1728
+ **Example**
1729
+ ```js
1730
+ // Returns "color: blue; font: 30% Verdana"
1731
+ new Font({ font: 'Verdana', size: '30%', colour: 'blue' }).toCssString()
1732
+ ```
1733
+ <a name="FontSize"></a>
1734
+
1735
+ ## FontSize : <code>number</code>
1736
+ <p>The font size</p>
1737
+
1738
+ **Kind**: global variable
1739
+ <a name="FontSize+toString"></a>
1740
+
1741
+ ### fontSize.toString() ⇒ <code>string</code>
1742
+ <p>Stringifies the font size by concatenating size and unit</p>
1743
+
1744
+ **Kind**: instance method of [<code>FontSize</code>](#FontSize)
1745
+ **Returns**: <code>string</code> - <p>The font size</p>
1746
+ **Example**
1747
+ ```js
1748
+ // Returns "30px"
1749
+ new FontSize(30, 'px').toString()
1750
+ ```
1751
+ **Example**
1752
+ ```js
1753
+ // Returns "120%"
1754
+ new FontSize(120, '%').toString()
1755
+ ```
1679
1756
  <a name="ALBUM"></a>
1680
1757
 
1681
1758
  ## ALBUM : <code>string</code>
package/lib/bundle.js CHANGED
@@ -164,7 +164,7 @@ function $ea7c5d4e4ce912f8$var$peg$parse(input, options) {
164
164
  const peg$c2 = peg$literalExpectation("#", false);
165
165
  const peg$c3 = "b";
166
166
  const peg$c4 = peg$literalExpectation("b", false);
167
- const peg$c5 = /^[a-zA-Z0-9()#+]/;
167
+ const peg$c5 = /^[a-zA-Z0-9()#+\-]/;
168
168
  const peg$c6 = peg$classExpectation([
169
169
  [
170
170
  "a",
@@ -181,7 +181,8 @@ function $ea7c5d4e4ce912f8$var$peg$parse(input, options) {
181
181
  "(",
182
182
  ")",
183
183
  "#",
184
- "+"
184
+ "+",
185
+ "-"
185
186
  ], false, false);
186
187
  const peg$c7 = function(root, modifier, suffix, bass) {
187
188
  return {
@@ -1469,7 +1470,6 @@ const $e12151f977ef7bf6$var$mapping = {
1469
1470
  "(+5)": "+",
1470
1471
  "x": "+",
1471
1472
  "dom11": "11",
1472
- "dom 11": "11",
1473
1473
  "11(#5)": "11(#5)",
1474
1474
  "11#5": "11(#5)",
1475
1475
  "11+5": "11(#5)",
@@ -1495,7 +1495,6 @@ const $e12151f977ef7bf6$var$mapping = {
1495
1495
  "m11sus4": "11sus4",
1496
1496
  "m11sus": "11sus4",
1497
1497
  "dom13": "13",
1498
- "dom 13": "13",
1499
1498
  "13(#11)": "13(#11)",
1500
1499
  "13#11": "13(#11)",
1501
1500
  "13+11": "13(#11)",
@@ -1555,8 +1554,6 @@ const $e12151f977ef7bf6$var$mapping = {
1555
1554
  "sus42": "4(2)",
1556
1555
  "no3": "5",
1557
1556
  "(no3)": "5",
1558
- "(no 3)": "5",
1559
- "(no 3rd)": "5",
1560
1557
  "5(no3)": "5",
1561
1558
  "6(2)": "6(2)",
1562
1559
  "6(b9)": "6(b9)",
@@ -1564,8 +1561,6 @@ const $e12151f977ef7bf6$var$mapping = {
1564
1561
  "6(9)": "6(9)",
1565
1562
  "6(add9)": "6(9)",
1566
1563
  "dom7": "7",
1567
- "dom 7": "7",
1568
- "dom 7th": "7",
1569
1564
  "7(#11)": "7(#11)",
1570
1565
  "7#11": "7(#11)",
1571
1566
  "7+11": "7(#11)",
@@ -1576,8 +1571,6 @@ const $e12151f977ef7bf6$var$mapping = {
1576
1571
  "7+5": "7(#5)",
1577
1572
  "7(+5)": "7(#5)",
1578
1573
  "x7": "7(#5)",
1579
- "aug 7": "7(#5)",
1580
- "aug 7th": "7(#5)",
1581
1574
  "7(#5#11)": "7(#5#11)",
1582
1575
  "7#5#11": "7(#5#11)",
1583
1576
  "7+5+11": "7(#5#11)",
@@ -1647,7 +1640,6 @@ const $e12151f977ef7bf6$var$mapping = {
1647
1640
  "7sus4": "7sus4",
1648
1641
  "7sus": "7sus4",
1649
1642
  "dom9": "9",
1650
- "dom 9": "9",
1651
1643
  "9(#11)": "9(#11)",
1652
1644
  "9#11": "9(#11)",
1653
1645
  "9+11": "9(#11)",
@@ -1683,8 +1675,6 @@ const $e12151f977ef7bf6$var$mapping = {
1683
1675
  "-b5": "dim",
1684
1676
  "dim7": "dim7",
1685
1677
  "o7": "dim7",
1686
- "dim 7": "dim7",
1687
- "dim 7th": "dim7",
1688
1678
  "m": "m",
1689
1679
  "mi": "m",
1690
1680
  "min": "m",
@@ -2316,7 +2306,8 @@ const $e12151f977ef7bf6$var$mapping = {
2316
2306
  "sus": "sus",
2317
2307
  "sus4": "sus",
2318
2308
  "sus(no5)": "sus(no5)",
2319
- "sus#42": "sus#42"
2309
+ "sus#42": "sus#42",
2310
+ "": ""
2320
2311
  };
2321
2312
  var $e12151f977ef7bf6$export$2e2bcd8739ae039 = $e12151f977ef7bf6$var$mapping;
2322
2313
 
@@ -7039,7 +7030,7 @@ function $3df1df9cc0f1cab9$var$peg$parse(input, options) {
7039
7030
  const peg$c59 = peg$literalExpectation("#", false);
7040
7031
  const peg$c60 = "b";
7041
7032
  const peg$c61 = peg$literalExpectation("b", false);
7042
- const peg$c62 = /^[a-zA-Z0-9()#+]/;
7033
+ const peg$c62 = /^[a-zA-Z0-9()#+\-]/;
7043
7034
  const peg$c63 = peg$classExpectation([
7044
7035
  [
7045
7036
  "a",
@@ -7056,7 +7047,8 @@ function $3df1df9cc0f1cab9$var$peg$parse(input, options) {
7056
7047
  "(",
7057
7048
  ")",
7058
7049
  "#",
7059
- "+"
7050
+ "+",
7051
+ "-"
7060
7052
  ], false, false);
7061
7053
  const peg$c64 = function(root, modifier, suffix, bass) {
7062
7054
  return {
package/lib/index.js CHANGED
@@ -163,7 +163,7 @@ function $ea7c5d4e4ce912f8$var$peg$parse(input, options) {
163
163
  const peg$c2 = peg$literalExpectation("#", false);
164
164
  const peg$c3 = "b";
165
165
  const peg$c4 = peg$literalExpectation("b", false);
166
- const peg$c5 = /^[a-zA-Z0-9()#+]/;
166
+ const peg$c5 = /^[a-zA-Z0-9()#+\-]/;
167
167
  const peg$c6 = peg$classExpectation([
168
168
  [
169
169
  "a",
@@ -180,7 +180,8 @@ function $ea7c5d4e4ce912f8$var$peg$parse(input, options) {
180
180
  "(",
181
181
  ")",
182
182
  "#",
183
- "+"
183
+ "+",
184
+ "-"
184
185
  ], false, false);
185
186
  const peg$c7 = function(root, modifier, suffix, bass) {
186
187
  return {
@@ -1468,7 +1469,6 @@ const $e12151f977ef7bf6$var$mapping = {
1468
1469
  "(+5)": "+",
1469
1470
  "x": "+",
1470
1471
  "dom11": "11",
1471
- "dom 11": "11",
1472
1472
  "11(#5)": "11(#5)",
1473
1473
  "11#5": "11(#5)",
1474
1474
  "11+5": "11(#5)",
@@ -1494,7 +1494,6 @@ const $e12151f977ef7bf6$var$mapping = {
1494
1494
  "m11sus4": "11sus4",
1495
1495
  "m11sus": "11sus4",
1496
1496
  "dom13": "13",
1497
- "dom 13": "13",
1498
1497
  "13(#11)": "13(#11)",
1499
1498
  "13#11": "13(#11)",
1500
1499
  "13+11": "13(#11)",
@@ -1554,8 +1553,6 @@ const $e12151f977ef7bf6$var$mapping = {
1554
1553
  "sus42": "4(2)",
1555
1554
  "no3": "5",
1556
1555
  "(no3)": "5",
1557
- "(no 3)": "5",
1558
- "(no 3rd)": "5",
1559
1556
  "5(no3)": "5",
1560
1557
  "6(2)": "6(2)",
1561
1558
  "6(b9)": "6(b9)",
@@ -1563,8 +1560,6 @@ const $e12151f977ef7bf6$var$mapping = {
1563
1560
  "6(9)": "6(9)",
1564
1561
  "6(add9)": "6(9)",
1565
1562
  "dom7": "7",
1566
- "dom 7": "7",
1567
- "dom 7th": "7",
1568
1563
  "7(#11)": "7(#11)",
1569
1564
  "7#11": "7(#11)",
1570
1565
  "7+11": "7(#11)",
@@ -1575,8 +1570,6 @@ const $e12151f977ef7bf6$var$mapping = {
1575
1570
  "7+5": "7(#5)",
1576
1571
  "7(+5)": "7(#5)",
1577
1572
  "x7": "7(#5)",
1578
- "aug 7": "7(#5)",
1579
- "aug 7th": "7(#5)",
1580
1573
  "7(#5#11)": "7(#5#11)",
1581
1574
  "7#5#11": "7(#5#11)",
1582
1575
  "7+5+11": "7(#5#11)",
@@ -1646,7 +1639,6 @@ const $e12151f977ef7bf6$var$mapping = {
1646
1639
  "7sus4": "7sus4",
1647
1640
  "7sus": "7sus4",
1648
1641
  "dom9": "9",
1649
- "dom 9": "9",
1650
1642
  "9(#11)": "9(#11)",
1651
1643
  "9#11": "9(#11)",
1652
1644
  "9+11": "9(#11)",
@@ -1682,8 +1674,6 @@ const $e12151f977ef7bf6$var$mapping = {
1682
1674
  "-b5": "dim",
1683
1675
  "dim7": "dim7",
1684
1676
  "o7": "dim7",
1685
- "dim 7": "dim7",
1686
- "dim 7th": "dim7",
1687
1677
  "m": "m",
1688
1678
  "mi": "m",
1689
1679
  "min": "m",
@@ -2315,7 +2305,8 @@ const $e12151f977ef7bf6$var$mapping = {
2315
2305
  "sus": "sus",
2316
2306
  "sus4": "sus",
2317
2307
  "sus(no5)": "sus(no5)",
2318
- "sus#42": "sus#42"
2308
+ "sus#42": "sus#42",
2309
+ "": ""
2319
2310
  };
2320
2311
  var $e12151f977ef7bf6$export$2e2bcd8739ae039 = $e12151f977ef7bf6$var$mapping;
2321
2312
 
@@ -7038,7 +7029,7 @@ function $3df1df9cc0f1cab9$var$peg$parse(input, options) {
7038
7029
  const peg$c59 = peg$literalExpectation("#", false);
7039
7030
  const peg$c60 = "b";
7040
7031
  const peg$c61 = peg$literalExpectation("b", false);
7041
- const peg$c62 = /^[a-zA-Z0-9()#+]/;
7032
+ const peg$c62 = /^[a-zA-Z0-9()#+\-]/;
7042
7033
  const peg$c63 = peg$classExpectation([
7043
7034
  [
7044
7035
  "a",
@@ -7055,7 +7046,8 @@ function $3df1df9cc0f1cab9$var$peg$parse(input, options) {
7055
7046
  "(",
7056
7047
  ")",
7057
7048
  "#",
7058
- "+"
7049
+ "+",
7050
+ "-"
7059
7051
  ], false, false);
7060
7052
  const peg$c64 = function(root, modifier, suffix, bass) {
7061
7053
  return {