chordsheetjs 15.2.0 → 15.3.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/lib/bundle.js +37 -6
- package/lib/bundle.min.js +50 -50
- package/lib/index.js +51 -6
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +7 -14
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +51 -6
- package/lib/module.js.map +1 -1
- package/lib/pdf/index.js +52 -6
- package/lib/pdf/index.js.map +1 -1
- package/lib/pdf/main.d.ts +1 -0
- package/lib/pdf/main.d.ts.map +1 -1
- package/lib/pdf/module.js +52 -6
- package/lib/pdf/module.js.map +1 -1
- package/package.json +2 -2
package/lib/pdf/module.js
CHANGED
|
@@ -739,6 +739,7 @@ const $663e568e94e22dc9$export$82f9bd327a40ea54 = {
|
|
|
739
739
|
key: null,
|
|
740
740
|
metadata: $663e568e94e22dc9$export$a014e67b549cbef4,
|
|
741
741
|
normalizeChords: true,
|
|
742
|
+
normalizeChordSuffix: true,
|
|
742
743
|
useUnicodeModifiers: false,
|
|
743
744
|
user: null
|
|
744
745
|
};
|
|
@@ -13935,6 +13936,7 @@ const $f5e27e8faa22bf25$var$defaultConstructorOptions = {
|
|
|
13935
13936
|
contextKey: null,
|
|
13936
13937
|
decapo: false,
|
|
13937
13938
|
normalizeChords: true,
|
|
13939
|
+
normalizeChordSuffix: true,
|
|
13938
13940
|
renderKey: null,
|
|
13939
13941
|
songKey: null,
|
|
13940
13942
|
style: null,
|
|
@@ -13950,6 +13952,7 @@ class $f5e27e8faa22bf25$var$ChordRenderer {
|
|
|
13950
13952
|
this.capo = config.decapo ? config.capo : 0;
|
|
13951
13953
|
this.contextKey = config.contextKey;
|
|
13952
13954
|
this.normalizeChords = config.normalizeChords;
|
|
13955
|
+
this.normalizeChordSuffix = config.normalizeChordSuffix;
|
|
13953
13956
|
this.renderKey = config.renderKey;
|
|
13954
13957
|
this.songKey = config.songKey;
|
|
13955
13958
|
this.style = config.style;
|
|
@@ -13962,7 +13965,9 @@ class $f5e27e8faa22bf25$var$ChordRenderer {
|
|
|
13962
13965
|
return (0, $974bd1d260bb1d53$export$79570e60478bce41)(chord, [
|
|
13963
13966
|
(c)=>c.transpose(this.effectiveTransposeDistance),
|
|
13964
13967
|
(c)=>this.accidental ? c.useAccidental(this.accidental) : c,
|
|
13965
|
-
(c)=>this.normalizeChords ? c.normalize(this.effectiveKey
|
|
13968
|
+
(c)=>this.normalizeChords ? c.normalize(this.effectiveKey, {
|
|
13969
|
+
normalizeSuffix: this.normalizeChordSuffix
|
|
13970
|
+
}) : c,
|
|
13966
13971
|
(c)=>this.changeChordType(c)
|
|
13967
13972
|
]).toString({
|
|
13968
13973
|
useUnicodeModifier: this.useUnicodeModifier
|
|
@@ -14362,13 +14367,38 @@ function $e2e1ea6dd3b7d2e1$export$fd31a53e6281557e(transposeKey, songKey) {
|
|
|
14362
14367
|
if (/^\d+$/.test(transposeKey)) return parseInt(transposeKey, 10);
|
|
14363
14368
|
return (0, $918eb2016ac61e41$export$2e2bcd8739ae039).distance(songKey, transposeKey);
|
|
14364
14369
|
}
|
|
14365
|
-
|
|
14370
|
+
/**
|
|
14371
|
+
* Renders a chord in the context of a line and song and taking into account some options
|
|
14372
|
+
* @param chordString The chord to render
|
|
14373
|
+
* @param line The line the chord is in
|
|
14374
|
+
* @param song The song the line is in
|
|
14375
|
+
* @param renderKey The key to render the chord in. If not provided, the line key will be used,
|
|
14376
|
+
* or the song key if the line key is not provided.
|
|
14377
|
+
* @param useUnicodeModifier Whether to use unicode modifiers ('\u266f'/'\u266d') or plain text ('#'/'b').
|
|
14378
|
+
* Default `false`.
|
|
14379
|
+
* @param normalizeChords Whether to normalize the chord to the key (default `true`)
|
|
14380
|
+
* @param normalizeChordSuffix Whether to normalize the chord suffix (e.g. `sus2` to `2`, `maj7` to `ma7`).
|
|
14381
|
+
* Only takes effect when `normalizeChords` is `true`. Default `true`.
|
|
14382
|
+
* @param decapo Whether to transpose all chords to eliminate the capo (default `false`)
|
|
14383
|
+
*/ const $e2e1ea6dd3b7d2e1$var$renderChordDefaults = {
|
|
14384
|
+
renderKey: null,
|
|
14385
|
+
useUnicodeModifier: false,
|
|
14386
|
+
normalizeChords: true,
|
|
14387
|
+
normalizeChordSuffix: true,
|
|
14388
|
+
decapo: false
|
|
14389
|
+
};
|
|
14390
|
+
function $e2e1ea6dd3b7d2e1$export$596ec52955da9472(chordString, line, song, options = {}) {
|
|
14391
|
+
const { renderKey: renderKey, useUnicodeModifier: useUnicodeModifier, normalizeChords: normalizeChords, normalizeChordSuffix: normalizeChordSuffix, decapo: decapo } = {
|
|
14392
|
+
...$e2e1ea6dd3b7d2e1$var$renderChordDefaults,
|
|
14393
|
+
...options
|
|
14394
|
+
};
|
|
14366
14395
|
const capoString = song.metadata.getSingle((0, $fc279350ee3ca664$export$866f445d49bad88e));
|
|
14367
14396
|
return new (0, $f5e27e8faa22bf25$export$2e2bcd8739ae039)({
|
|
14368
14397
|
capo: capoString ? parseInt(capoString, 10) : 0,
|
|
14369
14398
|
contextKey: (0, $918eb2016ac61e41$export$2e2bcd8739ae039).wrap(line.key || song.key),
|
|
14370
14399
|
decapo: decapo,
|
|
14371
14400
|
normalizeChords: normalizeChords,
|
|
14401
|
+
normalizeChordSuffix: normalizeChordSuffix,
|
|
14372
14402
|
renderKey: renderKey,
|
|
14373
14403
|
songKey: (0, $918eb2016ac61e41$export$2e2bcd8739ae039).wrap(song.key),
|
|
14374
14404
|
style: song.metadata.getSingle((0, $fc279350ee3ca664$export$d8cbdf44b1f66df1)),
|
|
@@ -21144,9 +21174,16 @@ var $c1baef5f0178006c$export$2e2bcd8739ae039 = $c1baef5f0178006c$var$When;
|
|
|
21144
21174
|
|
|
21145
21175
|
|
|
21146
21176
|
|
|
21177
|
+
|
|
21147
21178
|
/**
|
|
21148
21179
|
* Formats a song into a ChordPro chord sheet
|
|
21149
21180
|
*/ class $feb758e68dd351a4$var$ChordProFormatter extends (0, $2dfa852662754780$export$2e2bcd8739ae039) {
|
|
21181
|
+
getDefaultConfiguration() {
|
|
21182
|
+
return {
|
|
21183
|
+
...(0, $a4496115a7f17554$export$cb4529290f33d264)(),
|
|
21184
|
+
normalizeChordSuffix: false
|
|
21185
|
+
};
|
|
21186
|
+
}
|
|
21150
21187
|
/**
|
|
21151
21188
|
* Formats a song into a ChordPro chord sheet.
|
|
21152
21189
|
* @param {Song} song The song to be formatted
|
|
@@ -21272,7 +21309,9 @@ var $c1baef5f0178006c$export$2e2bcd8739ae039 = $c1baef5f0178006c$var$When;
|
|
|
21272
21309
|
if (chordLyricsPair.chords) {
|
|
21273
21310
|
const chordObj = chordLyricsPair.chord;
|
|
21274
21311
|
if (!chordObj) return `[${chordLyricsPair.chords}]`;
|
|
21275
|
-
const finalChord = this.configuration.normalizeChords ? chordObj.normalize(
|
|
21312
|
+
const finalChord = this.configuration.normalizeChords ? chordObj.normalize(null, {
|
|
21313
|
+
normalizeSuffix: this.configuration.normalizeChordSuffix
|
|
21314
|
+
}) : chordObj;
|
|
21276
21315
|
return `[${finalChord}]`;
|
|
21277
21316
|
}
|
|
21278
21317
|
if (chordLyricsPair.annotation) return `[*${chordLyricsPair.annotation}]`;
|
|
@@ -21366,7 +21405,7 @@ function $559e0277f2c887f5$export$9f6ee93f4e2fb3d2(string) {
|
|
|
21366
21405
|
|
|
21367
21406
|
|
|
21368
21407
|
const $9c17b505581d81bb$var$WHITE_SPACE = /\s/;
|
|
21369
|
-
const $9c17b505581d81bb$var$CHORD_LINE_REGEX = /^\s*((([A-G|Do|Re|Mi|Fa|Sol|La|Si
|
|
21408
|
+
const $9c17b505581d81bb$var$CHORD_LINE_REGEX = /^\s*(((?:[A-G]|Do|Re|Mi|Fa|Sol|La|Si)(#|b)?([^/\s]*)(\/(?:[A-G]|Do|Re|Mi|Fa|Sol|La|Si)(#|b)?)?)(\s|$)+)+(\s|$)+/;
|
|
21370
21409
|
/**
|
|
21371
21410
|
* Parses a normal chord sheet
|
|
21372
21411
|
*
|
|
@@ -21589,6 +21628,7 @@ var $9c17b505581d81bb$export$2e2bcd8739ae039 = $9c17b505581d81bb$var$ChordSheetP
|
|
|
21589
21628
|
return (0, $e2e1ea6dd3b7d2e1$export$596ec52955da9472)(item.chords, line, this.song, {
|
|
21590
21629
|
renderKey: this.configuration.key,
|
|
21591
21630
|
normalizeChords: this.configuration.normalizeChords,
|
|
21631
|
+
normalizeChordSuffix: this.configuration.normalizeChordSuffix,
|
|
21592
21632
|
decapo: this.configuration.decapo
|
|
21593
21633
|
});
|
|
21594
21634
|
}
|
|
@@ -34134,6 +34174,7 @@ var $d6c38f6287712fb1$export$2e2bcd8739ae039 = ({ configuration: configuration,
|
|
|
34134
34174
|
renderKey: key,
|
|
34135
34175
|
useUnicodeModifier: configuration.useUnicodeModifiers,
|
|
34136
34176
|
normalizeChords: configuration.normalizeChords,
|
|
34177
|
+
normalizeChordSuffix: configuration.normalizeChordSuffix,
|
|
34137
34178
|
decapo: configuration.decapo
|
|
34138
34179
|
})}
|
|
34139
34180
|
</div>
|
|
@@ -34333,6 +34374,7 @@ var $9940e2d1d4d0b0b9$export$2e2bcd8739ae039 = ({ configuration: configuration,
|
|
|
34333
34374
|
renderKey: key,
|
|
34334
34375
|
useUnicodeModifier: configuration.useUnicodeModifiers,
|
|
34335
34376
|
normalizeChords: configuration.normalizeChords,
|
|
34377
|
+
normalizeChordSuffix: configuration.normalizeChordSuffix,
|
|
34336
34378
|
decapo: configuration.decapo
|
|
34337
34379
|
})}</td>
|
|
34338
34380
|
`;
|
|
@@ -35793,6 +35835,7 @@ class $b5b6826de720b411$export$e6ce86b8bc39728b {
|
|
|
35793
35835
|
renderKey: null,
|
|
35794
35836
|
useUnicodeModifier: this.config.useUnicodeModifiers,
|
|
35795
35837
|
normalizeChords: this.config.normalizeChords,
|
|
35838
|
+
normalizeChordSuffix: this.config.normalizeChordSuffix,
|
|
35796
35839
|
decapo: this.config.decapo
|
|
35797
35840
|
});
|
|
35798
35841
|
}
|
|
@@ -36869,6 +36912,7 @@ class $850a89b14e4b94eb$export$12b762d1038ddc6b {
|
|
|
36869
36912
|
linePadding: this.configuration.layout.sections.global.linePadding,
|
|
36870
36913
|
useUnicodeModifiers: this.configuration.useUnicodeModifiers,
|
|
36871
36914
|
normalizeChords: this.configuration.normalizeChords,
|
|
36915
|
+
normalizeChordSuffix: this.configuration.normalizeChordSuffix,
|
|
36872
36916
|
// Column and page layout information
|
|
36873
36917
|
minY: dimensions.minY,
|
|
36874
36918
|
columnWidth: dimensions.columnWidth,
|
|
@@ -36929,7 +36973,7 @@ const $7c59209366f6488e$var$UG_METADATA_REGEX = /^(\w+):\s*(.+)$/;
|
|
|
36929
36973
|
const $7c59209366f6488e$var$OTHER_METADATA_LINE_REGEX = /^\[([^\]]+)]/;
|
|
36930
36974
|
const $7c59209366f6488e$var$REPEAT_NOTATION_REGEX = /\s+(x\d+)\s*$/i;
|
|
36931
36975
|
// eslint-disable-next-line max-len
|
|
36932
|
-
const $7c59209366f6488e$var$CHORD_LINE_REGEX = /^\s*((([A-G|Do|Re|Mi|Fa|Sol|La|Si
|
|
36976
|
+
const $7c59209366f6488e$var$CHORD_LINE_REGEX = /^\s*(((?:[A-G]|Do|Re|Mi|Fa|Sol|La|Si)(#|b)?([^/\s]*)(\/(?:[A-G]|Do|Re|Mi|Fa|Sol|La|Si)(#|b)?)?)(\s|$)+)+(\s|$)+/;
|
|
36933
36977
|
const $7c59209366f6488e$var$startSectionTags = {
|
|
36934
36978
|
[(0, $234747a9630b4642$export$4b194284baed1659)]: (0, $fc279350ee3ca664$export$deca399f8cd9b7dc),
|
|
36935
36979
|
[(0, $234747a9630b4642$export$8db6c706fc9142b2)]: (0, $fc279350ee3ca664$export$4f5168acae064e01),
|
|
@@ -37134,7 +37178,7 @@ const $7c59209366f6488e$var$endSectionTags = {
|
|
|
37134
37178
|
var $7c59209366f6488e$export$2e2bcd8739ae039 = $7c59209366f6488e$var$UltimateGuitarParser;
|
|
37135
37179
|
|
|
37136
37180
|
|
|
37137
|
-
var $3e7872a494b653a9$export$2e2bcd8739ae039 = '15.
|
|
37181
|
+
var $3e7872a494b653a9$export$2e2bcd8739ae039 = '15.3.0';
|
|
37138
37182
|
|
|
37139
37183
|
|
|
37140
37184
|
|
|
@@ -37410,6 +37454,7 @@ var $a2a605be2775ff64$export$2e2bcd8739ae039 = {
|
|
|
37410
37454
|
renderKey: this.configuration.key,
|
|
37411
37455
|
useUnicodeModifier: this.configuration.useUnicodeModifiers,
|
|
37412
37456
|
normalizeChords: this.configuration.normalizeChords,
|
|
37457
|
+
normalizeChordSuffix: this.configuration.normalizeChordSuffix,
|
|
37413
37458
|
decapo: this.configuration.decapo
|
|
37414
37459
|
});
|
|
37415
37460
|
return chords;
|
|
@@ -37871,6 +37916,7 @@ var $5ad5f749425e7fe5$export$2e2bcd8739ae039 = $5ad5f749425e7fe5$var$JsPdfRender
|
|
|
37871
37916
|
linePadding: this.configuration.layout.sections.global.linePadding,
|
|
37872
37917
|
useUnicodeModifiers: this.configuration.useUnicodeModifiers,
|
|
37873
37918
|
normalizeChords: this.configuration.normalizeChords,
|
|
37919
|
+
normalizeChordSuffix: this.configuration.normalizeChordSuffix,
|
|
37874
37920
|
// Column and page layout information
|
|
37875
37921
|
minY: dimensions.minY,
|
|
37876
37922
|
columnWidth: dimensions.columnWidth,
|