chordsheetjs 10.4.1 → 10.5.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 +15 -0
- package/lib/bundle.js +31 -9
- package/lib/bundle.min.js +38 -38
- package/lib/index.js +40 -10
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +47 -1
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +40 -11
- package/lib/module.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -892,6 +892,7 @@ the paragraph contents as one string where lines are separated by newlines.</p>
|
|
|
892
892
|
* [.changeMetadata(name, value)](#Song+changeMetadata)
|
|
893
893
|
* [.mapItems(func)](#Song+mapItems) ⇒ [<code>Song</code>](#Song)
|
|
894
894
|
* [.getChords()](#Song+getChords) ⇒ <code>Array.<string></code>
|
|
895
|
+
* [.getChordDefinitions()](#Song+getChordDefinitions) ⇒ <code>Record.<string, ChordDefinition></code>
|
|
895
896
|
* [.mapLines(func)](#Song+mapLines) ⇒ [<code>Song</code>](#Song)
|
|
896
897
|
|
|
897
898
|
<a name="new_Song_new"></a>
|
|
@@ -1102,6 +1103,20 @@ song.mapItems((item) => {
|
|
|
1102
1103
|
|
|
1103
1104
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
1104
1105
|
**Returns**: <code>Array.<string></code> - <p>the chords</p>
|
|
1106
|
+
<a name="Song+getChordDefinitions"></a>
|
|
1107
|
+
|
|
1108
|
+
### song.getChordDefinitions() ⇒ <code>Record.<string, ChordDefinition></code>
|
|
1109
|
+
<p>Returns all chord definitions from the song.
|
|
1110
|
+
Definitions are made using the <code>{chord}</code> or <code>{define}</code> directive.
|
|
1111
|
+
A chord definitions overrides a previous chord definition for the exact same chord.</p>
|
|
1112
|
+
|
|
1113
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
1114
|
+
**Returns**: <code>Record.<string, ChordDefinition></code> - <p>the chord definitions</p>
|
|
1115
|
+
**See**
|
|
1116
|
+
|
|
1117
|
+
- https://chordpro.org/chordpro/directives-define/
|
|
1118
|
+
- https://chordpro.org/chordpro/directives-chord/
|
|
1119
|
+
|
|
1105
1120
|
<a name="Song+mapLines"></a>
|
|
1106
1121
|
|
|
1107
1122
|
### song.mapLines(func) ⇒ [<code>Song</code>](#Song)
|
package/lib/bundle.js
CHANGED
|
@@ -326,6 +326,7 @@ var ChordSheetJS = (() => {
|
|
|
326
326
|
$parcel$defineInteropFlag(module.exports);
|
|
327
327
|
$parcel$export(module.exports, "default", () => $892913528e7f60f9$export$2e2bcd8739ae039);
|
|
328
328
|
$parcel$export(module.exports, "Chord", () => $177a605b8569b31c$export$2e2bcd8739ae039);
|
|
329
|
+
$parcel$export(module.exports, "ChordDefinition", () => $36ec5eba476f1300$export$2e2bcd8739ae039);
|
|
329
330
|
$parcel$export(module.exports, "ChordLyricsPair", () => $551a223fc13b5c10$export$2e2bcd8739ae039);
|
|
330
331
|
$parcel$export(module.exports, "ChordProFormatter", () => $244a67400187e14e$export$2e2bcd8739ae039);
|
|
331
332
|
$parcel$export(module.exports, "ChordProParser", () => $957f29f677b8d58d$export$2e2bcd8739ae039);
|
|
@@ -13883,6 +13884,18 @@ to a key`);
|
|
|
13883
13884
|
}
|
|
13884
13885
|
};
|
|
13885
13886
|
var $177a605b8569b31c$export$2e2bcd8739ae039 = $177a605b8569b31c$var$Chord;
|
|
13887
|
+
var $36ec5eba476f1300$var$ChordDefinition = class _$36ec5eba476f1300$var$ChordDefinition {
|
|
13888
|
+
constructor(name, baseFret, frets, fingers) {
|
|
13889
|
+
this.name = name;
|
|
13890
|
+
this.baseFret = baseFret;
|
|
13891
|
+
this.frets = frets;
|
|
13892
|
+
this.fingers = fingers || [];
|
|
13893
|
+
}
|
|
13894
|
+
clone() {
|
|
13895
|
+
return new _$36ec5eba476f1300$var$ChordDefinition(this.name, this.baseFret, this.frets, this.fingers);
|
|
13896
|
+
}
|
|
13897
|
+
};
|
|
13898
|
+
var $36ec5eba476f1300$export$2e2bcd8739ae039 = $36ec5eba476f1300$var$ChordDefinition;
|
|
13886
13899
|
var $f1e1976743ced067$export$a014e67b549cbef4 = {
|
|
13887
13900
|
separator: ","
|
|
13888
13901
|
};
|
|
@@ -18719,6 +18732,23 @@ Or set the song key before changing key:
|
|
|
18719
18732
|
return Array.from(chords);
|
|
18720
18733
|
}
|
|
18721
18734
|
/**
|
|
18735
|
+
* Returns all chord definitions from the song.
|
|
18736
|
+
* Definitions are made using the `{chord}` or `{define}` directive.
|
|
18737
|
+
* A chord definitions overrides a previous chord definition for the exact same chord.
|
|
18738
|
+
* @returns {Record<string, ChordDefinition>} the chord definitions
|
|
18739
|
+
* @see https://chordpro.org/chordpro/directives-define/
|
|
18740
|
+
* @see https://chordpro.org/chordpro/directives-chord/
|
|
18741
|
+
*/
|
|
18742
|
+
getChordDefinitions() {
|
|
18743
|
+
const chordDefinitions = {};
|
|
18744
|
+
this.foreachItem((item) => {
|
|
18745
|
+
if (!(item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039))) return;
|
|
18746
|
+
const { chordDefinition } = item;
|
|
18747
|
+
if (chordDefinition) chordDefinitions[chordDefinition.name] = chordDefinition.clone();
|
|
18748
|
+
});
|
|
18749
|
+
return chordDefinitions;
|
|
18750
|
+
}
|
|
18751
|
+
/**
|
|
18722
18752
|
* Change the song contents inline. Return a new {@link Line} to replace it. Return `null` to remove it.
|
|
18723
18753
|
* @example
|
|
18724
18754
|
* // remove lines with only Tags:
|
|
@@ -18772,15 +18802,6 @@ Or set the song key before changing key:
|
|
|
18772
18802
|
}
|
|
18773
18803
|
};
|
|
18774
18804
|
var $c53141c05fae8382$export$2e2bcd8739ae039 = $c53141c05fae8382$var$Song;
|
|
18775
|
-
var $36ec5eba476f1300$var$ChordDefinition = class {
|
|
18776
|
-
constructor(name, baseFret, frets, fingers) {
|
|
18777
|
-
this.name = name;
|
|
18778
|
-
this.baseFret = baseFret;
|
|
18779
|
-
this.frets = frets;
|
|
18780
|
-
this.fingers = fingers || [];
|
|
18781
|
-
}
|
|
18782
|
-
};
|
|
18783
|
-
var $36ec5eba476f1300$export$2e2bcd8739ae039 = $36ec5eba476f1300$var$ChordDefinition;
|
|
18784
18805
|
var $8b93ef43471b6ed2$var$CHORD_LYRICS_PAIR = "chordLyricsPair";
|
|
18785
18806
|
var $8b93ef43471b6ed2$var$CHORD_SHEET = "chordSheet";
|
|
18786
18807
|
var $8b93ef43471b6ed2$var$COMMENT = "comment";
|
|
@@ -31806,6 +31827,7 @@ Or set the song key before changing key:
|
|
|
31806
31827
|
var $892913528e7f60f9$export$2e2bcd8739ae039 = {
|
|
31807
31828
|
CHORUS: $dce48cb70c4120bb$export$8db6c706fc9142b2,
|
|
31808
31829
|
Chord: $177a605b8569b31c$export$2e2bcd8739ae039,
|
|
31830
|
+
ChordDefinition: $36ec5eba476f1300$export$2e2bcd8739ae039,
|
|
31809
31831
|
ChordLyricsPair: $551a223fc13b5c10$export$2e2bcd8739ae039,
|
|
31810
31832
|
ChordProFormatter: $244a67400187e14e$export$2e2bcd8739ae039,
|
|
31811
31833
|
ChordProParser: $957f29f677b8d58d$export$2e2bcd8739ae039,
|