chordsheetjs 13.2.0 → 13.2.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 +25 -12
- package/lib/bundle.min.js +4 -4
- package/lib/index.js +28 -28
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +11 -4
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +28 -28
- package/lib/module.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -912,22 +912,16 @@ const $3d106a0ee348cfa8$export$40141681ebb03523 = {
|
|
|
912
912
|
* @param {string} chords The chords
|
|
913
913
|
* @param {string | null} lyrics The lyrics
|
|
914
914
|
* @param {string | null} annotation The annotation
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
*/ this.lyrics = lyrics || '';
|
|
926
|
-
/**
|
|
927
|
-
* The annotation
|
|
928
|
-
* @member
|
|
929
|
-
* @type {string}
|
|
930
|
-
*/ this.annotation = annotation || '';
|
|
915
|
+
* @param {Chord | null} chordObj Optional pre-parsed Chord object
|
|
916
|
+
*/ constructor(chords = '', lyrics = null, annotation = null, chordObj = null){
|
|
917
|
+
this._chordObj = null;
|
|
918
|
+
this.chords = chords || '';
|
|
919
|
+
this.lyrics = lyrics || '';
|
|
920
|
+
this.annotation = annotation || '';
|
|
921
|
+
this._chordObj = chordObj;
|
|
922
|
+
}
|
|
923
|
+
/** Returns the Chord object if available, otherwise parses from string */ get chord() {
|
|
924
|
+
return this._chordObj || (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(this.chords.trim());
|
|
931
925
|
}
|
|
932
926
|
/**
|
|
933
927
|
* Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets)
|
|
@@ -944,13 +938,13 @@ const $3d106a0ee348cfa8$export$40141681ebb03523 = {
|
|
|
944
938
|
* Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song
|
|
945
939
|
* @returns {ChordLyricsPair}
|
|
946
940
|
*/ clone() {
|
|
947
|
-
return new $551a223fc13b5c10$var$ChordLyricsPair(this.chords, this.lyrics, this.annotation);
|
|
941
|
+
return new $551a223fc13b5c10$var$ChordLyricsPair(this.chords, this.lyrics, this.annotation, this._chordObj?.clone() || null);
|
|
948
942
|
}
|
|
949
943
|
toString() {
|
|
950
944
|
return `ChordLyricsPair(chords=${this.chords}, lyrics=${this.lyrics})`;
|
|
951
945
|
}
|
|
952
|
-
set({ chords: chords, lyrics: lyrics, annotation: annotation }) {
|
|
953
|
-
return new $551a223fc13b5c10$var$ChordLyricsPair(chords
|
|
946
|
+
set({ chords: chords, lyrics: lyrics, annotation: annotation, chordObj: chordObj }) {
|
|
947
|
+
return new $551a223fc13b5c10$var$ChordLyricsPair(chords ?? this.chords, lyrics ?? this.lyrics, annotation ?? this.annotation, chordObj ?? null);
|
|
954
948
|
}
|
|
955
949
|
setLyrics(lyrics) {
|
|
956
950
|
return this.set({
|
|
@@ -987,7 +981,8 @@ const $3d106a0ee348cfa8$export$40141681ebb03523 = {
|
|
|
987
981
|
if (chordObj) {
|
|
988
982
|
const changedChord = func(chordObj);
|
|
989
983
|
return this.set({
|
|
990
|
-
chords: changedChord.toString()
|
|
984
|
+
chords: changedChord.toString(),
|
|
985
|
+
chordObj: changedChord
|
|
991
986
|
});
|
|
992
987
|
}
|
|
993
988
|
return this.clone();
|
|
@@ -2231,12 +2226,13 @@ const $c2d6ab25ad00308f$var$PREFERS_FLAT_NUMBERS = [
|
|
|
2231
2226
|
*/ static distance(oneKey, otherKey) {
|
|
2232
2227
|
return this.wrapOrFail(oneKey).distanceTo(otherKey);
|
|
2233
2228
|
}
|
|
2234
|
-
constructor({ grade: grade = null, number: number = null, minor: minor, type: type, accidental: accidental, referenceKeyGrade: referenceKeyGrade = null, referenceKeyMode: referenceKeyMode = null, originalKeyString: originalKeyString = null, preferredAccidental: preferredAccidental = null }){
|
|
2229
|
+
constructor({ grade: grade = null, number: number = null, minor: minor, type: type, accidental: accidental, referenceKeyGrade: referenceKeyGrade = null, referenceKeyMode: referenceKeyMode = null, originalKeyString: originalKeyString = null, preferredAccidental: preferredAccidental = null, explicitAccidental: explicitAccidental = false }){
|
|
2235
2230
|
this.number = null;
|
|
2236
2231
|
this.minor = false;
|
|
2237
2232
|
this.referenceKeyGrade = null;
|
|
2238
2233
|
this.referenceKeyMode = null;
|
|
2239
2234
|
this.originalKeyString = null;
|
|
2235
|
+
this.explicitAccidental = false;
|
|
2240
2236
|
this.grade = grade;
|
|
2241
2237
|
this.number = number;
|
|
2242
2238
|
this.minor = minor;
|
|
@@ -2246,6 +2242,7 @@ const $c2d6ab25ad00308f$var$PREFERS_FLAT_NUMBERS = [
|
|
|
2246
2242
|
this.referenceKeyGrade = referenceKeyGrade;
|
|
2247
2243
|
this.referenceKeyMode = referenceKeyMode;
|
|
2248
2244
|
this.originalKeyString = originalKeyString;
|
|
2245
|
+
this.explicitAccidental = explicitAccidental;
|
|
2249
2246
|
}
|
|
2250
2247
|
distanceTo(otherKey) {
|
|
2251
2248
|
const otherKeyObj = $c2d6ab25ad00308f$var$Key.wrapOrFail(otherKey);
|
|
@@ -2499,7 +2496,8 @@ const $c2d6ab25ad00308f$var$PREFERS_FLAT_NUMBERS = [
|
|
|
2499
2496
|
useAccidental(newAccidental) {
|
|
2500
2497
|
this.ensureGrade();
|
|
2501
2498
|
return this.set({
|
|
2502
|
-
accidental: newAccidental
|
|
2499
|
+
accidental: newAccidental,
|
|
2500
|
+
explicitAccidental: newAccidental !== null
|
|
2503
2501
|
});
|
|
2504
2502
|
}
|
|
2505
2503
|
/** @deprecated Use useAccidental instead */ useModifier(newAccidental) {
|
|
@@ -2518,6 +2516,8 @@ const $c2d6ab25ad00308f$var$PREFERS_FLAT_NUMBERS = [
|
|
|
2518
2516
|
}
|
|
2519
2517
|
normalizeEnharmonics(key) {
|
|
2520
2518
|
if (key) {
|
|
2519
|
+
// Preserve explicit accidental choices made via useAccidental()
|
|
2520
|
+
if (this.explicitAccidental) return this.clone();
|
|
2521
2521
|
const rootKeyString = $c2d6ab25ad00308f$var$Key.wrapOrFail(key).toString({
|
|
2522
2522
|
showMinor: true
|
|
2523
2523
|
});
|
|
@@ -2542,6 +2542,7 @@ const $c2d6ab25ad00308f$var$PREFERS_FLAT_NUMBERS = [
|
|
|
2542
2542
|
referenceKeyGrade: this.referenceKeyGrade,
|
|
2543
2543
|
originalKeyString: this.originalKeyString,
|
|
2544
2544
|
preferredAccidental: this.preferredAccidental,
|
|
2545
|
+
explicitAccidental: this.explicitAccidental,
|
|
2545
2546
|
...overwrite ? attributes : {}
|
|
2546
2547
|
});
|
|
2547
2548
|
}
|
|
@@ -5113,7 +5114,6 @@ var $6c1ed1378c3b5965$export$2e2bcd8739ae039 = $6c1ed1378c3b5965$var$ChordDefini
|
|
|
5113
5114
|
|
|
5114
5115
|
|
|
5115
5116
|
|
|
5116
|
-
|
|
5117
5117
|
/**
|
|
5118
5118
|
* Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview
|
|
5119
5119
|
*/ class $0bd084786477abba$var$Comment {
|
|
@@ -6431,10 +6431,10 @@ var $15f1d40e3d1ed3a0$export$2e2bcd8739ae039 = $15f1d40e3d1ed3a0$var$Ternary;
|
|
|
6431
6431
|
}
|
|
6432
6432
|
formatChordLyricsPairChords(chordLyricsPair) {
|
|
6433
6433
|
if (chordLyricsPair.chords) {
|
|
6434
|
-
const
|
|
6435
|
-
if (!
|
|
6436
|
-
const
|
|
6437
|
-
return `[${
|
|
6434
|
+
const chordObj = chordLyricsPair.chord;
|
|
6435
|
+
if (!chordObj) return `[${chordLyricsPair.chords}]`;
|
|
6436
|
+
const finalChord = this.configuration.normalizeChords ? chordObj.normalize() : chordObj;
|
|
6437
|
+
return `[${finalChord}]`;
|
|
6438
6438
|
}
|
|
6439
6439
|
if (chordLyricsPair.annotation) return `[*${chordLyricsPair.annotation}]`;
|
|
6440
6440
|
return '';
|
|
@@ -36517,7 +36517,7 @@ const $a5a21ced491ea51f$var$endSectionTags = {
|
|
|
36517
36517
|
var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
|
|
36518
36518
|
|
|
36519
36519
|
|
|
36520
|
-
var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '13.2.
|
|
36520
|
+
var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '13.2.1';
|
|
36521
36521
|
|
|
36522
36522
|
|
|
36523
36523
|
|