chordsheetjs 6.3.0 → 7.2.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 +92 -11
- package/lib/bundle.js +590 -573
- package/lib/index.html +40 -0
- package/lib/index.js +590 -573
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +57 -13
- package/lib/main.d.ts.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -424,7 +424,8 @@ Inherits from [ChordSheetParser](#ChordSheetParser)</p></dd>
|
|
|
424
424
|
<dt><a href="#END_OF_VERSE">END_OF_VERSE</a> : <code>string</code></dt>
|
|
425
425
|
<dd><p>Key meta directive. See https://www.chordpro.org/chordpro/directives-key/</p></dd>
|
|
426
426
|
<dt><a href="#KEY">KEY</a> : <code>string</code></dt>
|
|
427
|
-
<dd><p>
|
|
427
|
+
<dd><p>_Key meta directive. Reflects the key as transposed by the capo value
|
|
428
|
+
See https://www.chordpro.org/chordpro/directives-key/</p></dd>
|
|
428
429
|
<dt><a href="#_KEY">_KEY</a> : <code>string</code></dt>
|
|
429
430
|
<dd><p>Lyricist meta directive. See https://www.chordpro.org/chordpro/directives-lyricist/</p></dd>
|
|
430
431
|
<dt><a href="#LYRICIST">LYRICIST</a> : <code>string</code></dt>
|
|
@@ -636,8 +637,13 @@ If not, it returns [INDETERMINATE](#INDETERMINATE)</p>
|
|
|
636
637
|
* [.paragraphs](#Song+paragraphs) : [<code>Array.<Paragraph></code>](#Paragraph)
|
|
637
638
|
* ~~[.metaData](#Song+metaData) ⇒~~
|
|
638
639
|
* [.clone()](#Song+clone) ⇒ [<code>Song</code>](#Song)
|
|
639
|
-
* [.setCapo(capo)](#Song+setCapo) ⇒ [<code>Song</code>](#Song)
|
|
640
640
|
* [.setKey(key)](#Song+setKey) ⇒ [<code>Song</code>](#Song)
|
|
641
|
+
* [.setCapo(capo)](#Song+setCapo) ⇒ [<code>Song</code>](#Song)
|
|
642
|
+
* [.transpose(delta)](#Song+transpose) ⇒ [<code>Song</code>](#Song)
|
|
643
|
+
* [.transposeUp()](#Song+transposeUp) ⇒ [<code>Song</code>](#Song)
|
|
644
|
+
* [.transposeDown()](#Song+transposeDown) ⇒ [<code>Song</code>](#Song)
|
|
645
|
+
* [.changeKey(newKey)](#Song+changeKey) ⇒ [<code>Song</code>](#Song)
|
|
646
|
+
* [.changeMetadata(name, value)](#Song+changeMetadata)
|
|
641
647
|
* [.mapItems(func)](#Song+mapItems) ⇒ [<code>Song</code>](#Song)
|
|
642
648
|
* [.mapLines(func)](#Song+mapLines) ⇒ [<code>Song</code>](#Song)
|
|
643
649
|
|
|
@@ -689,13 +695,29 @@ if you want to skip the "header lines": the lines that only contain me
|
|
|
689
695
|
|
|
690
696
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
691
697
|
**Returns**: [<code>Song</code>](#Song) - <p>The cloned song</p>
|
|
698
|
+
<a name="Song+setKey"></a>
|
|
699
|
+
|
|
700
|
+
### song.setKey(key) ⇒ [<code>Song</code>](#Song)
|
|
701
|
+
<p>Returns a copy of the song with the key value set to the specified key. It changes:</p>
|
|
702
|
+
<ul>
|
|
703
|
+
<li>the value for <code>key</code> in the [metadata](metadata) set</li>
|
|
704
|
+
<li>any existing <code>key</code> directive</li>
|
|
705
|
+
</ul>
|
|
706
|
+
|
|
707
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
708
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The changed song</p>
|
|
709
|
+
|
|
710
|
+
| Param | Type | Description |
|
|
711
|
+
| --- | --- | --- |
|
|
712
|
+
| key | <code>number</code> \| <code>null</code> | <p>the key. Passing <code>null</code> will:</p> <ul> <li>remove the current key from [metadata](metadata)</li> <li>remove any <code>key</code> directive</li> </ul> |
|
|
713
|
+
|
|
692
714
|
<a name="Song+setCapo"></a>
|
|
693
715
|
|
|
694
716
|
### song.setCapo(capo) ⇒ [<code>Song</code>](#Song)
|
|
695
|
-
<p>Returns a copy of the song with the
|
|
717
|
+
<p>Returns a copy of the song with the key value set to the specified capo. It changes:</p>
|
|
696
718
|
<ul>
|
|
697
|
-
<li>the value for <code>capo</code> in the
|
|
698
|
-
<li>any existing <code>capo</code> directive
|
|
719
|
+
<li>the value for <code>capo</code> in the [metadata](metadata) set</li>
|
|
720
|
+
<li>any existing <code>capo</code> directive</li>
|
|
699
721
|
</ul>
|
|
700
722
|
|
|
701
723
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
@@ -703,14 +725,55 @@ if you want to skip the "header lines": the lines that only contain me
|
|
|
703
725
|
|
|
704
726
|
| Param | Type | Description |
|
|
705
727
|
| --- | --- | --- |
|
|
706
|
-
| capo | <code>number</code> \| <code>null</code> | <p>the capo. Passing <code>null</code> will:</p> <ul> <li>remove the current key from
|
|
728
|
+
| capo | <code>number</code> \| <code>null</code> | <p>the capo. Passing <code>null</code> will:</p> <ul> <li>remove the current key from [metadata](metadata)</li> <li>remove any <code>capo</code> directive</li> </ul> |
|
|
707
729
|
|
|
708
|
-
<a name="Song+
|
|
730
|
+
<a name="Song+transpose"></a>
|
|
709
731
|
|
|
710
|
-
### song.
|
|
732
|
+
### song.transpose(delta) ⇒ [<code>Song</code>](#Song)
|
|
733
|
+
<p>Transposes the song by the specified delta. It will:</p>
|
|
734
|
+
<ul>
|
|
735
|
+
<li>transpose all chords, see: [transpose](#Chord+transpose)</li>
|
|
736
|
+
<li>transpose the song key in [metadata](metadata)</li>
|
|
737
|
+
<li>update any existing <code>key</code> directive</li>
|
|
738
|
+
</ul>
|
|
739
|
+
|
|
740
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
741
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
|
|
742
|
+
|
|
743
|
+
| Param | Type | Description |
|
|
744
|
+
| --- | --- | --- |
|
|
745
|
+
| delta | <code>number</code> | <p>The number of semitones (positive or negative) to transpose with</p> |
|
|
746
|
+
|
|
747
|
+
<a name="Song+transposeUp"></a>
|
|
748
|
+
|
|
749
|
+
### song.transposeUp() ⇒ [<code>Song</code>](#Song)
|
|
750
|
+
<p>Transposes the song up by one semitone. It will:</p>
|
|
751
|
+
<ul>
|
|
752
|
+
<li>transpose all chords, see: [transpose](#Chord+transpose)</li>
|
|
753
|
+
<li>transpose the song key in [metadata](metadata)</li>
|
|
754
|
+
<li>update any existing <code>key</code> directive</li>
|
|
755
|
+
</ul>
|
|
756
|
+
|
|
757
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
758
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
|
|
759
|
+
<a name="Song+transposeDown"></a>
|
|
760
|
+
|
|
761
|
+
### song.transposeDown() ⇒ [<code>Song</code>](#Song)
|
|
762
|
+
<p>Transposes the song down by one semitone. It will:</p>
|
|
763
|
+
<ul>
|
|
764
|
+
<li>transpose all chords, see: [transpose](#Chord+transpose)</li>
|
|
765
|
+
<li>transpose the song key in [metadata](metadata)</li>
|
|
766
|
+
<li>update any existing <code>key</code> directive</li>
|
|
767
|
+
</ul>
|
|
768
|
+
|
|
769
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
770
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
|
|
771
|
+
<a name="Song+changeKey"></a>
|
|
772
|
+
|
|
773
|
+
### song.changeKey(newKey) ⇒ [<code>Song</code>](#Song)
|
|
711
774
|
<p>Returns a copy of the song with the key set to the specified key. It changes:</p>
|
|
712
775
|
<ul>
|
|
713
|
-
<li>the value for <code>key</code> in the
|
|
776
|
+
<li>the value for <code>key</code> in the [metadata](metadata) set</li>
|
|
714
777
|
<li>any existing <code>key</code> directive</li>
|
|
715
778
|
<li>all chords, those are transposed according to the distance between the current and the new key</li>
|
|
716
779
|
</ul>
|
|
@@ -720,7 +783,24 @@ if you want to skip the "header lines": the lines that only contain me
|
|
|
720
783
|
|
|
721
784
|
| Param | Type | Description |
|
|
722
785
|
| --- | --- | --- |
|
|
723
|
-
|
|
|
786
|
+
| newKey | <code>string</code> | <p>The new key.</p> |
|
|
787
|
+
|
|
788
|
+
<a name="Song+changeMetadata"></a>
|
|
789
|
+
|
|
790
|
+
### song.changeMetadata(name, value)
|
|
791
|
+
<p>Returns a copy of the song with the directive value set to the specified value.</p>
|
|
792
|
+
<ul>
|
|
793
|
+
<li>when there is a matching directive in the song, it will update the directive</li>
|
|
794
|
+
<li>when there is no matching directive, it will be inserted
|
|
795
|
+
If <code>value</code> is <code>null</code> it will act as a delete, any directive matching <code>name</code> will be removed.</li>
|
|
796
|
+
</ul>
|
|
797
|
+
|
|
798
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
799
|
+
|
|
800
|
+
| Param | Type | Description |
|
|
801
|
+
| --- | --- | --- |
|
|
802
|
+
| name | <code>string</code> | <p>The directive name</p> |
|
|
803
|
+
| value | <code>string</code> \| <code>null</code> | <p>The value to set, or <code>null</code> to remove the directive</p> |
|
|
724
804
|
|
|
725
805
|
<a name="Song+mapItems"></a>
|
|
726
806
|
|
|
@@ -1392,7 +1472,8 @@ Can be deserialized using [deserialize](deserialize)</p>
|
|
|
1392
1472
|
<a name="KEY"></a>
|
|
1393
1473
|
|
|
1394
1474
|
## KEY : <code>string</code>
|
|
1395
|
-
<p>
|
|
1475
|
+
<p>_Key meta directive. Reflects the key as transposed by the capo value
|
|
1476
|
+
See https://www.chordpro.org/chordpro/directives-key/</p>
|
|
1396
1477
|
|
|
1397
1478
|
**Kind**: global variable
|
|
1398
1479
|
<a name="_KEY"></a>
|