chordsheetjs 7.14.0 → 7.15.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 +637 -633
- package/lib/index.js +637 -633
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +233 -233
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +636 -634
- package/lib/module.js.map +1 -1
- package/package.json +1 -1
package/lib/bundle.js
CHANGED
|
@@ -14,75 +14,37 @@ function $parcel$interopDefault(a) {
|
|
|
14
14
|
$parcel$defineInteropFlag(module.exports);
|
|
15
15
|
|
|
16
16
|
$parcel$export(module.exports, "default", () => $882b6d93070905b3$export$2e2bcd8739ae039);
|
|
17
|
+
$parcel$export(module.exports, "Chord", () => $26f57998457eb2d4$export$2e2bcd8739ae039);
|
|
18
|
+
$parcel$export(module.exports, "parseChord", () => $26f57998457eb2d4$export$621b8187b24d90c6);
|
|
19
|
+
$parcel$export(module.exports, "ChordLyricsPair", () => $d454f4215ba01af2$export$2e2bcd8739ae039);
|
|
20
|
+
$parcel$export(module.exports, "ChordProFormatter", () => $b601b9602157ea5f$export$2e2bcd8739ae039);
|
|
17
21
|
$parcel$export(module.exports, "ChordProParser", () => $4f0048d666582440$export$2e2bcd8739ae039);
|
|
18
22
|
$parcel$export(module.exports, "ChordSheetParser", () => $c049675f48c823b2$export$2e2bcd8739ae039);
|
|
23
|
+
$parcel$export(module.exports, "ChordSheetSerializer", () => $1c14afc274b727b7$export$2e2bcd8739ae039);
|
|
19
24
|
$parcel$export(module.exports, "ChordsOverWordsParser", () => $c5e7c9181f4c1376$export$2e2bcd8739ae039);
|
|
20
|
-
$parcel$export(module.exports, "
|
|
21
|
-
$parcel$export(module.exports, "
|
|
22
|
-
$parcel$export(module.exports, "
|
|
25
|
+
$parcel$export(module.exports, "Comment", () => $2115988b22311cb1$export$2e2bcd8739ae039);
|
|
26
|
+
$parcel$export(module.exports, "Composite", () => $812df3771838671d$export$2e2bcd8739ae039);
|
|
27
|
+
$parcel$export(module.exports, "Formatter", () => $0055ecb09272ba2d$export$2e2bcd8739ae039);
|
|
28
|
+
$parcel$export(module.exports, "HtmlFormatter", () => $d834af97c9a2e4df$export$2e2bcd8739ae039);
|
|
23
29
|
$parcel$export(module.exports, "HtmlDivFormatter", () => $ee0c149cc33dc156$export$2e2bcd8739ae039);
|
|
24
|
-
$parcel$export(module.exports, "
|
|
25
|
-
$parcel$export(module.exports, "
|
|
30
|
+
$parcel$export(module.exports, "HtmlTableFormatter", () => $5b02ea769c63fd56$export$2e2bcd8739ae039);
|
|
31
|
+
$parcel$export(module.exports, "Key", () => $bff5407e03fdc8ee$export$2e2bcd8739ae039);
|
|
26
32
|
$parcel$export(module.exports, "Line", () => $bc411321e9739719$export$2e2bcd8739ae039);
|
|
27
|
-
$parcel$export(module.exports, "
|
|
28
|
-
$parcel$export(module.exports, "Tag", () => $5e9ede69210ec54a$export$2e2bcd8739ae039);
|
|
29
|
-
$parcel$export(module.exports, "Comment", () => $2115988b22311cb1$export$2e2bcd8739ae039);
|
|
33
|
+
$parcel$export(module.exports, "Literal", () => $e1378a714a1834c5$export$2e2bcd8739ae039);
|
|
30
34
|
$parcel$export(module.exports, "Metadata", () => $1406c61233580008$export$2e2bcd8739ae039);
|
|
31
35
|
$parcel$export(module.exports, "Paragraph", () => $0c3420c6a3e8a9d7$export$2e2bcd8739ae039);
|
|
36
|
+
$parcel$export(module.exports, "Song", () => $6f653df65dfdf4ef$export$2e2bcd8739ae039);
|
|
37
|
+
$parcel$export(module.exports, "Tag", () => $5e9ede69210ec54a$export$2e2bcd8739ae039);
|
|
32
38
|
$parcel$export(module.exports, "Ternary", () => $b6d84b168638423d$export$2e2bcd8739ae039);
|
|
33
|
-
$parcel$export(module.exports, "
|
|
34
|
-
$parcel$export(module.exports, "
|
|
35
|
-
$parcel$export(module.exports, "ChordSheetSerializer", () => $1c14afc274b727b7$export$2e2bcd8739ae039);
|
|
36
|
-
$parcel$export(module.exports, "Chord", () => $26f57998457eb2d4$export$2e2bcd8739ae039);
|
|
37
|
-
$parcel$export(module.exports, "parseChord", () => $26f57998457eb2d4$export$621b8187b24d90c6);
|
|
38
|
-
$parcel$export(module.exports, "Key", () => $bff5407e03fdc8ee$export$2e2bcd8739ae039);
|
|
39
|
+
$parcel$export(module.exports, "TextFormatter", () => $525b2331e4b0ed83$export$2e2bcd8739ae039);
|
|
40
|
+
$parcel$export(module.exports, "UltimateGuitarParser", () => $db9c80925e255cd2$export$2e2bcd8739ae039);
|
|
39
41
|
$parcel$export(module.exports, "CHORUS", () => $af8d31735c159a26$export$8db6c706fc9142b2);
|
|
40
42
|
$parcel$export(module.exports, "INDETERMINATE", () => $af8d31735c159a26$export$c5a6fe907430212e);
|
|
41
|
-
$parcel$export(module.exports, "VERSE", () => $af8d31735c159a26$export$4b194284baed1659);
|
|
42
43
|
$parcel$export(module.exports, "NONE", () => $af8d31735c159a26$export$c53d0f541b41b88e);
|
|
43
|
-
$parcel$export(module.exports, "TAB", () => $af8d31735c159a26$export$f1c9dd0f5207dd5e);
|
|
44
|
-
$parcel$export(module.exports, "SYMBOL", () => $af8d31735c159a26$export$27c95a7104c1f7aa);
|
|
45
44
|
$parcel$export(module.exports, "NUMERIC", () => $af8d31735c159a26$export$4d318981b5a83836);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
line = null;
|
|
50
|
-
column = null;
|
|
51
|
-
offset = null;
|
|
52
|
-
constructor(traceInfo = null){
|
|
53
|
-
if (traceInfo) {
|
|
54
|
-
this.line = traceInfo.line || null;
|
|
55
|
-
this.column = traceInfo.column || null;
|
|
56
|
-
this.offset = traceInfo.offset || null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
var $cf00b4d3af89fa07$export$2e2bcd8739ae039 = $cf00b4d3af89fa07$var$AstComponent;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class $da904aab90d40723$var$Evaluatable extends (0, $cf00b4d3af89fa07$export$2e2bcd8739ae039) {
|
|
64
|
-
}
|
|
65
|
-
var $da904aab90d40723$export$2e2bcd8739ae039 = $da904aab90d40723$var$Evaluatable;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class $e1378a714a1834c5$var$Literal extends (0, $da904aab90d40723$export$2e2bcd8739ae039) {
|
|
69
|
-
constructor(expression){
|
|
70
|
-
super();
|
|
71
|
-
this.string = expression;
|
|
72
|
-
}
|
|
73
|
-
evaluate() {
|
|
74
|
-
return this.string;
|
|
75
|
-
}
|
|
76
|
-
isRenderable() {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
clone() {
|
|
80
|
-
return new $e1378a714a1834c5$var$Literal(this.string);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
var $e1378a714a1834c5$export$2e2bcd8739ae039 = $e1378a714a1834c5$var$Literal;
|
|
84
|
-
|
|
85
|
-
|
|
45
|
+
$parcel$export(module.exports, "SYMBOL", () => $af8d31735c159a26$export$27c95a7104c1f7aa);
|
|
46
|
+
$parcel$export(module.exports, "TAB", () => $af8d31735c159a26$export$f1c9dd0f5207dd5e);
|
|
47
|
+
$parcel$export(module.exports, "VERSE", () => $af8d31735c159a26$export$4b194284baed1659);
|
|
86
48
|
// Generated by peggy v. 2.0.1 (ts-pegjs plugin v. 3.0.0 )
|
|
87
49
|
//
|
|
88
50
|
// https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
|
|
@@ -2704,10 +2666,88 @@ var $26f57998457eb2d4$export$2e2bcd8739ae039 = $26f57998457eb2d4$var$Chord;
|
|
|
2704
2666
|
var $d454f4215ba01af2$export$2e2bcd8739ae039 = $d454f4215ba01af2$var$ChordLyricsPair;
|
|
2705
2667
|
|
|
2706
2668
|
|
|
2669
|
+
|
|
2670
|
+
const $71c330be198ce421$export$a014e67b549cbef4 = {
|
|
2671
|
+
separator: ","
|
|
2672
|
+
};
|
|
2673
|
+
class $71c330be198ce421$var$MetadataConfiguration {
|
|
2674
|
+
constructor(metadataConfiguration = $71c330be198ce421$export$a014e67b549cbef4){
|
|
2675
|
+
this.separator = metadataConfiguration.separator;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
var $71c330be198ce421$export$2e2bcd8739ae039 = $71c330be198ce421$var$MetadataConfiguration;
|
|
2679
|
+
|
|
2680
|
+
|
|
2681
|
+
|
|
2682
|
+
const $bbcfd2c49e8e9957$export$78c0028a34264234 = {
|
|
2683
|
+
evaluate: false,
|
|
2684
|
+
metadata: {
|
|
2685
|
+
separator: ","
|
|
2686
|
+
},
|
|
2687
|
+
key: null,
|
|
2688
|
+
expandChorusDirective: false
|
|
2689
|
+
};
|
|
2690
|
+
class $bbcfd2c49e8e9957$var$Configuration {
|
|
2691
|
+
constructor(configuration = $bbcfd2c49e8e9957$export$78c0028a34264234){
|
|
2692
|
+
const mergedConfig = {
|
|
2693
|
+
...$bbcfd2c49e8e9957$export$78c0028a34264234,
|
|
2694
|
+
...configuration
|
|
2695
|
+
};
|
|
2696
|
+
this.evaluate = !!mergedConfig.evaluate;
|
|
2697
|
+
this.expandChorusDirective = !!mergedConfig.expandChorusDirective;
|
|
2698
|
+
this.metadata = new (0, $71c330be198ce421$export$2e2bcd8739ae039)(configuration.metadata);
|
|
2699
|
+
this.key = configuration.key ? (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(configuration.key) : null;
|
|
2700
|
+
this.configuration = configuration;
|
|
2701
|
+
}
|
|
2702
|
+
get(key) {
|
|
2703
|
+
return (0, ($parcel$interopDefault($988mA$lodashget)))(this, key);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
var $bbcfd2c49e8e9957$export$2e2bcd8739ae039 = $bbcfd2c49e8e9957$var$Configuration;
|
|
2707
|
+
|
|
2708
|
+
|
|
2709
|
+
/**
|
|
2710
|
+
* Base class for all formatters, taking care of receiving a configuration wrapping that inside a Configuration object
|
|
2711
|
+
*/ class $0055ecb09272ba2d$var$Formatter {
|
|
2712
|
+
/**
|
|
2713
|
+
* Instantiate
|
|
2714
|
+
* @param {Object} [configuration={}] options
|
|
2715
|
+
* @param {boolean} [configuration.evaluate=false] Whether or not to evaluate meta expressions. For more info about
|
|
2716
|
+
* meta expressions, see: https://bit.ly/2SC9c2u
|
|
2717
|
+
* @param {object} [configuration.metadata={}]
|
|
2718
|
+
* @param {string} [configuration.metadata.separator=", "] The separator to be used when rendering a metadata value
|
|
2719
|
+
* that has multiple values. See: https://bit.ly/2SC9c2u
|
|
2720
|
+
* @param {Key|string} [configuration.key=null] The key to use for rendering. The chord sheet will be transposed
|
|
2721
|
+
* from the song's original key (as indicated by the `{key}` directive) to the specified key.
|
|
2722
|
+
* Note that transposing will only work
|
|
2723
|
+
* if the original song key is set.
|
|
2724
|
+
* @param {boolean} [configuration.expandChorusDirective=false] Whether or not to expand `{chorus}` directives
|
|
2725
|
+
* by rendering the last defined chorus inline after the directive.
|
|
2726
|
+
*/ constructor(configuration = null){
|
|
2727
|
+
this.configuration = new (0, $bbcfd2c49e8e9957$export$2e2bcd8739ae039)(configuration || {});
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
var $0055ecb09272ba2d$export$2e2bcd8739ae039 = $0055ecb09272ba2d$var$Formatter;
|
|
2731
|
+
|
|
2732
|
+
|
|
2707
2733
|
/**
|
|
2708
2734
|
* Album meta directive. See https://www.chordpro.org/chordpro/directives-album/
|
|
2709
2735
|
* @type {string}
|
|
2710
|
-
*/
|
|
2736
|
+
*/ class $cf00b4d3af89fa07$var$AstComponent {
|
|
2737
|
+
line = null;
|
|
2738
|
+
column = null;
|
|
2739
|
+
offset = null;
|
|
2740
|
+
constructor(traceInfo = null){
|
|
2741
|
+
if (traceInfo) {
|
|
2742
|
+
this.line = traceInfo.line || null;
|
|
2743
|
+
this.column = traceInfo.column || null;
|
|
2744
|
+
this.offset = traceInfo.offset || null;
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
var $cf00b4d3af89fa07$export$2e2bcd8739ae039 = $cf00b4d3af89fa07$var$AstComponent;
|
|
2749
|
+
|
|
2750
|
+
|
|
2711
2751
|
const $5e9ede69210ec54a$export$10227cb086d1770c = "album";
|
|
2712
2752
|
const $5e9ede69210ec54a$export$17d8dfb3db842bf = "artist";
|
|
2713
2753
|
const $5e9ede69210ec54a$export$866f445d49bad88e = "capo";
|
|
@@ -2939,74 +2979,271 @@ const $5e9ede69210ec54a$var$translateTagNameAlias = (name)=>{
|
|
|
2939
2979
|
var $5e9ede69210ec54a$export$2e2bcd8739ae039 = $5e9ede69210ec54a$var$Tag;
|
|
2940
2980
|
|
|
2941
2981
|
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2982
|
+
|
|
2983
|
+
class $55622b65d99fa8e1$var$EvaluationError extends Error {
|
|
2984
|
+
line = null;
|
|
2985
|
+
column = null;
|
|
2986
|
+
offset = null;
|
|
2987
|
+
constructor(message, line = null, column = null, offset = null){
|
|
2988
|
+
super(`${message} on line ${line} column ${column}`);
|
|
2989
|
+
this.name = "ExpressionError";
|
|
2990
|
+
this.line = line;
|
|
2991
|
+
this.column = column;
|
|
2992
|
+
this.offset = offset;
|
|
2947
2993
|
}
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2994
|
+
}
|
|
2995
|
+
var $55622b65d99fa8e1$export$2e2bcd8739ae039 = $55622b65d99fa8e1$var$EvaluationError;
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
class $da904aab90d40723$var$Evaluatable extends (0, $cf00b4d3af89fa07$export$2e2bcd8739ae039) {
|
|
3001
|
+
}
|
|
3002
|
+
var $da904aab90d40723$export$2e2bcd8739ae039 = $da904aab90d40723$var$Evaluatable;
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
class $812df3771838671d$var$Composite extends (0, $da904aab90d40723$export$2e2bcd8739ae039) {
|
|
3006
|
+
expressions = [];
|
|
3007
|
+
constructor(expressions, variable = null){
|
|
3008
|
+
super();
|
|
3009
|
+
this.expressions = expressions;
|
|
3010
|
+
this.variable = variable;
|
|
2953
3011
|
}
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
* @returns {Comment}
|
|
2957
|
-
*/ clone() {
|
|
2958
|
-
return new $2115988b22311cb1$var$Comment(this.content);
|
|
3012
|
+
evaluate(metadata, metadataSeparator) {
|
|
3013
|
+
return this.expressions.map((expression)=>expression.evaluate(metadata, metadataSeparator, this.variable)).join("");
|
|
2959
3014
|
}
|
|
2960
|
-
|
|
2961
|
-
return
|
|
3015
|
+
isRenderable() {
|
|
3016
|
+
return true;
|
|
3017
|
+
}
|
|
3018
|
+
clone() {
|
|
3019
|
+
return new $812df3771838671d$var$Composite(this.expressions.map((expression)=>expression.clone()), this.variable);
|
|
2962
3020
|
}
|
|
2963
3021
|
}
|
|
2964
|
-
var $
|
|
3022
|
+
var $812df3771838671d$export$2e2bcd8739ae039 = $812df3771838671d$var$Composite;
|
|
2965
3023
|
|
|
2966
3024
|
|
|
2967
3025
|
|
|
2968
|
-
class $
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
*/ size = null;
|
|
2977
|
-
/**
|
|
2978
|
-
* The font color
|
|
2979
|
-
* @member {string | null}
|
|
2980
|
-
*/ colour = null;
|
|
2981
|
-
constructor({ font: font , size: size , colour: colour } = {
|
|
2982
|
-
font: null,
|
|
2983
|
-
size: null,
|
|
2984
|
-
colour: null
|
|
2985
|
-
}){
|
|
2986
|
-
this.font = font ? font.replace(/"/g, "'") : null;
|
|
2987
|
-
this.size = size || null;
|
|
2988
|
-
this.colour = colour || null;
|
|
2989
|
-
}
|
|
2990
|
-
clone() {
|
|
2991
|
-
return new $7de89f83a0afd136$var$Font({
|
|
2992
|
-
font: this.font,
|
|
2993
|
-
size: this.size,
|
|
2994
|
-
colour: this.colour
|
|
3026
|
+
class $b6d84b168638423d$var$Ternary extends (0, $da904aab90d40723$export$2e2bcd8739ae039) {
|
|
3027
|
+
trueExpression = [];
|
|
3028
|
+
falseExpression = [];
|
|
3029
|
+
constructor({ variable: variable = null , valueTest: valueTest = null , trueExpression: trueExpression = [] , falseExpression: falseExpression = [] , line: line = null , column: column = null , offset: offset = null }){
|
|
3030
|
+
super({
|
|
3031
|
+
line: line,
|
|
3032
|
+
column: column,
|
|
3033
|
+
offset: offset
|
|
2995
3034
|
});
|
|
3035
|
+
this.variable = variable || null;
|
|
3036
|
+
this.valueTest = valueTest || null;
|
|
3037
|
+
this.trueExpression = trueExpression;
|
|
3038
|
+
this.falseExpression = falseExpression;
|
|
2996
3039
|
}
|
|
2997
3040
|
/**
|
|
2998
|
-
*
|
|
2999
|
-
*
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3041
|
+
* Evaluate the meta expression
|
|
3042
|
+
* @param {Metadata} metadata The metadata object to use for evaluating the expression
|
|
3043
|
+
* @param {string} [metadataSeparator=null] The metadata separator to use if necessary
|
|
3044
|
+
* @returns {string} The evaluated expression
|
|
3045
|
+
*/ evaluate(metadata, metadataSeparator, upperContext = null) {
|
|
3046
|
+
if (this.variable) return this.evaluateWithVariable(metadata, metadataSeparator);
|
|
3047
|
+
if (!upperContext) throw new (0, $55622b65d99fa8e1$export$2e2bcd8739ae039)("Unexpected empty expression", this.line, this.column, this.offset);
|
|
3048
|
+
return this.evaluateToString(metadata.get(upperContext) || "", metadataSeparator);
|
|
3049
|
+
}
|
|
3050
|
+
evaluateToString(value, metadataSeparator) {
|
|
3051
|
+
if (Array.isArray(value)) return value.join(metadataSeparator);
|
|
3052
|
+
return value;
|
|
3053
|
+
}
|
|
3054
|
+
evaluateWithVariable(metadata, metadataSeparator) {
|
|
3055
|
+
if (!this.variable) throw new Error("Expected this.variable to be present");
|
|
3056
|
+
const value = metadata.get(this.variable);
|
|
3057
|
+
if (value && ((0, $21a34a464e7bc609$export$78d1711480f95c3e)(this.valueTest) || value === this.valueTest)) return this.evaluateForTruthyValue(metadata, metadataSeparator, value);
|
|
3058
|
+
if (this.falseExpression.length) return new (0, $812df3771838671d$export$2e2bcd8739ae039)(this.falseExpression, this.variable).evaluate(metadata, metadataSeparator);
|
|
3059
|
+
return "";
|
|
3060
|
+
}
|
|
3061
|
+
evaluateForTruthyValue(metadata, metadataSeparator, value) {
|
|
3062
|
+
if (this.trueExpression.length) return new (0, $812df3771838671d$export$2e2bcd8739ae039)(this.trueExpression, this.variable).evaluate(metadata, metadataSeparator);
|
|
3063
|
+
return this.evaluateToString(value, metadataSeparator);
|
|
3064
|
+
}
|
|
3065
|
+
isRenderable() {
|
|
3066
|
+
return true;
|
|
3067
|
+
}
|
|
3068
|
+
clone() {
|
|
3069
|
+
return new $b6d84b168638423d$var$Ternary({
|
|
3070
|
+
variable: this.variable,
|
|
3071
|
+
valueTest: this.valueTest,
|
|
3072
|
+
trueExpression: this.trueExpression.map((part)=>part.clone()),
|
|
3073
|
+
falseExpression: this.falseExpression.map((part)=>part.clone()),
|
|
3074
|
+
line: this.line,
|
|
3075
|
+
column: this.column,
|
|
3076
|
+
offset: this.offset
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
var $b6d84b168638423d$export$2e2bcd8739ae039 = $b6d84b168638423d$var$Ternary;
|
|
3081
|
+
|
|
3082
|
+
|
|
3083
|
+
|
|
3084
|
+
class $e1378a714a1834c5$var$Literal extends (0, $da904aab90d40723$export$2e2bcd8739ae039) {
|
|
3085
|
+
constructor(expression){
|
|
3086
|
+
super();
|
|
3087
|
+
this.string = expression;
|
|
3088
|
+
}
|
|
3089
|
+
evaluate() {
|
|
3090
|
+
return this.string;
|
|
3091
|
+
}
|
|
3092
|
+
isRenderable() {
|
|
3093
|
+
return true;
|
|
3094
|
+
}
|
|
3095
|
+
clone() {
|
|
3096
|
+
return new $e1378a714a1834c5$var$Literal(this.string);
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
var $e1378a714a1834c5$export$2e2bcd8739ae039 = $e1378a714a1834c5$var$Literal;
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
const $b601b9602157ea5f$var$NEW_LINE = "\n";
|
|
3103
|
+
/**
|
|
3104
|
+
* Formats a song into a ChordPro chord sheet
|
|
3105
|
+
*/ class $b601b9602157ea5f$var$ChordProFormatter extends (0, $0055ecb09272ba2d$export$2e2bcd8739ae039) {
|
|
3106
|
+
/**
|
|
3107
|
+
* Formats a song into a ChordPro chord sheet.
|
|
3108
|
+
* @param {Song} song The song to be formatted
|
|
3109
|
+
* @returns {string} The ChordPro string
|
|
3110
|
+
*/ format(song) {
|
|
3111
|
+
const { lines: lines , metadata: metadata } = song;
|
|
3112
|
+
return lines.map((line)=>this.formatLine(line, metadata)).join($b601b9602157ea5f$var$NEW_LINE);
|
|
3113
|
+
}
|
|
3114
|
+
formatLine(line, metadata) {
|
|
3115
|
+
return line.items.map((item)=>this.formatItem(item, metadata)).join("");
|
|
3116
|
+
}
|
|
3117
|
+
formatItem(item, metadata) {
|
|
3118
|
+
if (item instanceof (0, $5e9ede69210ec54a$export$2e2bcd8739ae039)) return this.formatTag(item);
|
|
3119
|
+
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return this.formatChordLyricsPair(item);
|
|
3120
|
+
if ("evaluate" in item) return this.formatOrEvaluateItem(item, metadata);
|
|
3121
|
+
throw new Error(`Don't know how to format a ${item.constructor.name}`);
|
|
3122
|
+
}
|
|
3123
|
+
formatOrEvaluateItem(item, metadata) {
|
|
3124
|
+
if (this.configuration.evaluate) return item.evaluate(metadata, this.configuration.get("metadata.separator"));
|
|
3125
|
+
if (item instanceof (0, $b6d84b168638423d$export$2e2bcd8739ae039)) return this.formatTernary(item);
|
|
3126
|
+
if (item instanceof (0, $e1378a714a1834c5$export$2e2bcd8739ae039)) return item.evaluate();
|
|
3127
|
+
throw new Error(`Don't know how to format a ${item.constructor.name}`);
|
|
3128
|
+
}
|
|
3129
|
+
formatTernary(ternary) {
|
|
3130
|
+
const { variable: variable , valueTest: valueTest , trueExpression: trueExpression , falseExpression: falseExpression } = ternary;
|
|
3131
|
+
return [
|
|
3132
|
+
"%{",
|
|
3133
|
+
variable || "",
|
|
3134
|
+
this.formatValueTest(valueTest),
|
|
3135
|
+
this.formatExpressionRange(trueExpression),
|
|
3136
|
+
this.formatExpressionRange(falseExpression),
|
|
3137
|
+
"}"
|
|
3138
|
+
].join("");
|
|
3139
|
+
}
|
|
3140
|
+
formatValueTest(valueTest) {
|
|
3141
|
+
if (!valueTest) return "";
|
|
3142
|
+
return `=${valueTest}`;
|
|
3143
|
+
}
|
|
3144
|
+
formatExpressionRange(expressionRange) {
|
|
3145
|
+
if (!expressionRange.length) return "";
|
|
3146
|
+
return `|${expressionRange.map((expression)=>this.formatExpression(expression)).join("")}`;
|
|
3147
|
+
}
|
|
3148
|
+
formatExpression(expression) {
|
|
3149
|
+
if (expression instanceof (0, $b6d84b168638423d$export$2e2bcd8739ae039)) return this.formatTernary(expression);
|
|
3150
|
+
if (expression instanceof (0, $e1378a714a1834c5$export$2e2bcd8739ae039)) return expression.string;
|
|
3151
|
+
return "";
|
|
3152
|
+
}
|
|
3153
|
+
formatTag(tag) {
|
|
3154
|
+
if (tag.hasValue()) return `{${tag.originalName}: ${tag.value}}`;
|
|
3155
|
+
return `{${tag.originalName}}`;
|
|
3156
|
+
}
|
|
3157
|
+
formatChordLyricsPair(chordLyricsPair) {
|
|
3158
|
+
return [
|
|
3159
|
+
this.formatChordLyricsPairChords(chordLyricsPair),
|
|
3160
|
+
this.formatChordLyricsPairLyrics(chordLyricsPair)
|
|
3161
|
+
].join("");
|
|
3162
|
+
}
|
|
3163
|
+
formatChordLyricsPairChords(chordLyricsPair) {
|
|
3164
|
+
if (chordLyricsPair.chords) return `[${chordLyricsPair.chords}]`;
|
|
3165
|
+
return "";
|
|
3166
|
+
}
|
|
3167
|
+
formatChordLyricsPairLyrics(chordLyricsPair) {
|
|
3168
|
+
return chordLyricsPair.lyrics || "";
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
var $b601b9602157ea5f$export$2e2bcd8739ae039 = $b601b9602157ea5f$var$ChordProFormatter;
|
|
3172
|
+
|
|
3173
|
+
|
|
3174
|
+
// eslint-disable-next-line import/no-cycle
|
|
3175
|
+
|
|
3176
|
+
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
/**
|
|
3180
|
+
* Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview
|
|
3181
|
+
*/ class $2115988b22311cb1$var$Comment {
|
|
3182
|
+
constructor(content){
|
|
3183
|
+
this.content = content;
|
|
3184
|
+
}
|
|
3185
|
+
/**
|
|
3186
|
+
* Indicates whether a Comment should be visible in a formatted chord sheet (except for ChordPro sheets)
|
|
3187
|
+
* @returns {boolean}
|
|
3188
|
+
*/ isRenderable() {
|
|
3189
|
+
return false;
|
|
3190
|
+
}
|
|
3191
|
+
/**
|
|
3192
|
+
* Returns a deep copy of the Comment, useful when programmatically transforming a song
|
|
3193
|
+
* @returns {Comment}
|
|
3194
|
+
*/ clone() {
|
|
3195
|
+
return new $2115988b22311cb1$var$Comment(this.content);
|
|
3196
|
+
}
|
|
3197
|
+
toString() {
|
|
3198
|
+
return `Comment(content=${this.content})`;
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
var $2115988b22311cb1$export$2e2bcd8739ae039 = $2115988b22311cb1$var$Comment;
|
|
3202
|
+
|
|
3203
|
+
|
|
3204
|
+
|
|
3205
|
+
class $7de89f83a0afd136$var$Font {
|
|
3206
|
+
/**
|
|
3207
|
+
* The font
|
|
3208
|
+
* @member {string | null}
|
|
3209
|
+
*/ font = null;
|
|
3210
|
+
/**
|
|
3211
|
+
* The font size, expressed in either pixels or percentage.
|
|
3212
|
+
* @member {FontSize | null}
|
|
3213
|
+
*/ size = null;
|
|
3214
|
+
/**
|
|
3215
|
+
* The font color
|
|
3216
|
+
* @member {string | null}
|
|
3217
|
+
*/ colour = null;
|
|
3218
|
+
constructor({ font: font , size: size , colour: colour } = {
|
|
3219
|
+
font: null,
|
|
3220
|
+
size: null,
|
|
3221
|
+
colour: null
|
|
3222
|
+
}){
|
|
3223
|
+
this.font = font ? font.replace(/"/g, "'") : null;
|
|
3224
|
+
this.size = size || null;
|
|
3225
|
+
this.colour = colour || null;
|
|
3226
|
+
}
|
|
3227
|
+
clone() {
|
|
3228
|
+
return new $7de89f83a0afd136$var$Font({
|
|
3229
|
+
font: this.font,
|
|
3230
|
+
size: this.size,
|
|
3231
|
+
colour: this.colour
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
/**
|
|
3235
|
+
* Converts the font, size and color to a CSS string.
|
|
3236
|
+
* If possible, font and size are combined to the `font` shorthand.
|
|
3237
|
+
* If `font` contains double quotes (`"`) those will be converted to single quotes (`'`).
|
|
3238
|
+
*
|
|
3239
|
+
* @example
|
|
3240
|
+
* // Returns "font-family: 'Times New Roman'"
|
|
3241
|
+
* new Font({ font: '"Times New Roman"' }).toCssString()
|
|
3242
|
+
* @example
|
|
3243
|
+
* // Returns "color: red; font-family: Verdana"
|
|
3244
|
+
* new Font({ font: 'Verdana', colour: 'red' }).toCssString()
|
|
3245
|
+
* @example
|
|
3246
|
+
* // Returns "font: 30px Verdana"
|
|
3010
3247
|
* new Font({ font: 'Verdana', size: '30' }).toCssString()
|
|
3011
3248
|
* @example
|
|
3012
3249
|
* // Returns "color: blue; font: 30% Verdana"
|
|
@@ -3961,127 +4198,33 @@ var $6f653df65dfdf4ef$export$2e2bcd8739ae039 = $6f653df65dfdf4ef$var$Song;
|
|
|
3961
4198
|
|
|
3962
4199
|
|
|
3963
4200
|
|
|
3964
|
-
class $55622b65d99fa8e1$var$EvaluationError extends Error {
|
|
3965
|
-
line = null;
|
|
3966
|
-
column = null;
|
|
3967
|
-
offset = null;
|
|
3968
|
-
constructor(message, line = null, column = null, offset = null){
|
|
3969
|
-
super(`${message} on line ${line} column ${column}`);
|
|
3970
|
-
this.name = "ExpressionError";
|
|
3971
|
-
this.line = line;
|
|
3972
|
-
this.column = column;
|
|
3973
|
-
this.offset = offset;
|
|
3974
|
-
}
|
|
3975
|
-
}
|
|
3976
|
-
var $55622b65d99fa8e1$export$2e2bcd8739ae039 = $55622b65d99fa8e1$var$EvaluationError;
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
4201
|
|
|
3980
4202
|
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4203
|
+
const $1c14afc274b727b7$var$CHORD_SHEET = "chordSheet";
|
|
4204
|
+
const $1c14afc274b727b7$var$CHORD_LYRICS_PAIR = "chordLyricsPair";
|
|
4205
|
+
const $1c14afc274b727b7$var$TAG = "tag";
|
|
4206
|
+
const $1c14afc274b727b7$var$COMMENT = "comment";
|
|
4207
|
+
const $1c14afc274b727b7$var$TERNARY = "ternary";
|
|
4208
|
+
const $1c14afc274b727b7$var$LINE = "line";
|
|
4209
|
+
/**
|
|
4210
|
+
* Serializes a song into een plain object, and deserializes the serialized object back into a {@link Song}
|
|
4211
|
+
*/ class $1c14afc274b727b7$var$ChordSheetSerializer {
|
|
4212
|
+
song = new (0, $6f653df65dfdf4ef$export$2e2bcd8739ae039)();
|
|
4213
|
+
/**
|
|
4214
|
+
* Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc
|
|
4215
|
+
* Can be deserialized using {@link deserialize}
|
|
4216
|
+
* @returns object A plain JS object containing all chord sheet data
|
|
4217
|
+
*/ serialize(song) {
|
|
4218
|
+
return {
|
|
4219
|
+
type: $1c14afc274b727b7$var$CHORD_SHEET,
|
|
4220
|
+
lines: song.lines.map((line)=>this.serializeLine(line))
|
|
4221
|
+
};
|
|
3990
4222
|
}
|
|
3991
|
-
|
|
3992
|
-
return
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
}
|
|
3997
|
-
}
|
|
3998
|
-
var $812df3771838671d$export$2e2bcd8739ae039 = $812df3771838671d$var$Composite;
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
class $b6d84b168638423d$var$Ternary extends (0, $da904aab90d40723$export$2e2bcd8739ae039) {
|
|
4003
|
-
trueExpression = [];
|
|
4004
|
-
falseExpression = [];
|
|
4005
|
-
constructor({ variable: variable = null , valueTest: valueTest = null , trueExpression: trueExpression = [] , falseExpression: falseExpression = [] , line: line = null , column: column = null , offset: offset = null }){
|
|
4006
|
-
super({
|
|
4007
|
-
line: line,
|
|
4008
|
-
column: column,
|
|
4009
|
-
offset: offset
|
|
4010
|
-
});
|
|
4011
|
-
this.variable = variable || null;
|
|
4012
|
-
this.valueTest = valueTest || null;
|
|
4013
|
-
this.trueExpression = trueExpression;
|
|
4014
|
-
this.falseExpression = falseExpression;
|
|
4015
|
-
}
|
|
4016
|
-
/**
|
|
4017
|
-
* Evaluate the meta expression
|
|
4018
|
-
* @param {Metadata} metadata The metadata object to use for evaluating the expression
|
|
4019
|
-
* @param {string} [metadataSeparator=null] The metadata separator to use if necessary
|
|
4020
|
-
* @returns {string} The evaluated expression
|
|
4021
|
-
*/ evaluate(metadata, metadataSeparator, upperContext = null) {
|
|
4022
|
-
if (this.variable) return this.evaluateWithVariable(metadata, metadataSeparator);
|
|
4023
|
-
if (!upperContext) throw new (0, $55622b65d99fa8e1$export$2e2bcd8739ae039)("Unexpected empty expression", this.line, this.column, this.offset);
|
|
4024
|
-
return this.evaluateToString(metadata.get(upperContext) || "", metadataSeparator);
|
|
4025
|
-
}
|
|
4026
|
-
evaluateToString(value, metadataSeparator) {
|
|
4027
|
-
if (Array.isArray(value)) return value.join(metadataSeparator);
|
|
4028
|
-
return value;
|
|
4029
|
-
}
|
|
4030
|
-
evaluateWithVariable(metadata, metadataSeparator) {
|
|
4031
|
-
if (!this.variable) throw new Error("Expected this.variable to be present");
|
|
4032
|
-
const value = metadata.get(this.variable);
|
|
4033
|
-
if (value && ((0, $21a34a464e7bc609$export$78d1711480f95c3e)(this.valueTest) || value === this.valueTest)) return this.evaluateForTruthyValue(metadata, metadataSeparator, value);
|
|
4034
|
-
if (this.falseExpression.length) return new (0, $812df3771838671d$export$2e2bcd8739ae039)(this.falseExpression, this.variable).evaluate(metadata, metadataSeparator);
|
|
4035
|
-
return "";
|
|
4036
|
-
}
|
|
4037
|
-
evaluateForTruthyValue(metadata, metadataSeparator, value) {
|
|
4038
|
-
if (this.trueExpression.length) return new (0, $812df3771838671d$export$2e2bcd8739ae039)(this.trueExpression, this.variable).evaluate(metadata, metadataSeparator);
|
|
4039
|
-
return this.evaluateToString(value, metadataSeparator);
|
|
4040
|
-
}
|
|
4041
|
-
isRenderable() {
|
|
4042
|
-
return true;
|
|
4043
|
-
}
|
|
4044
|
-
clone() {
|
|
4045
|
-
return new $b6d84b168638423d$var$Ternary({
|
|
4046
|
-
variable: this.variable,
|
|
4047
|
-
valueTest: this.valueTest,
|
|
4048
|
-
trueExpression: this.trueExpression.map((part)=>part.clone()),
|
|
4049
|
-
falseExpression: this.falseExpression.map((part)=>part.clone()),
|
|
4050
|
-
line: this.line,
|
|
4051
|
-
column: this.column,
|
|
4052
|
-
offset: this.offset
|
|
4053
|
-
});
|
|
4054
|
-
}
|
|
4055
|
-
}
|
|
4056
|
-
var $b6d84b168638423d$export$2e2bcd8739ae039 = $b6d84b168638423d$var$Ternary;
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
const $1c14afc274b727b7$var$CHORD_SHEET = "chordSheet";
|
|
4061
|
-
const $1c14afc274b727b7$var$CHORD_LYRICS_PAIR = "chordLyricsPair";
|
|
4062
|
-
const $1c14afc274b727b7$var$TAG = "tag";
|
|
4063
|
-
const $1c14afc274b727b7$var$COMMENT = "comment";
|
|
4064
|
-
const $1c14afc274b727b7$var$TERNARY = "ternary";
|
|
4065
|
-
const $1c14afc274b727b7$var$LINE = "line";
|
|
4066
|
-
/**
|
|
4067
|
-
* Serializes a song into een plain object, and deserializes the serialized object back into a {@link Song}
|
|
4068
|
-
*/ class $1c14afc274b727b7$var$ChordSheetSerializer {
|
|
4069
|
-
song = new (0, $6f653df65dfdf4ef$export$2e2bcd8739ae039)();
|
|
4070
|
-
/**
|
|
4071
|
-
* Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc
|
|
4072
|
-
* Can be deserialized using {@link deserialize}
|
|
4073
|
-
* @returns object A plain JS object containing all chord sheet data
|
|
4074
|
-
*/ serialize(song) {
|
|
4075
|
-
return {
|
|
4076
|
-
type: $1c14afc274b727b7$var$CHORD_SHEET,
|
|
4077
|
-
lines: song.lines.map((line)=>this.serializeLine(line))
|
|
4078
|
-
};
|
|
4079
|
-
}
|
|
4080
|
-
serializeLine(line) {
|
|
4081
|
-
return {
|
|
4082
|
-
type: $1c14afc274b727b7$var$LINE,
|
|
4083
|
-
items: line.items.map((item)=>this.serializeItem(item))
|
|
4084
|
-
};
|
|
4223
|
+
serializeLine(line) {
|
|
4224
|
+
return {
|
|
4225
|
+
type: $1c14afc274b727b7$var$LINE,
|
|
4226
|
+
items: line.items.map((item)=>this.serializeItem(item))
|
|
4227
|
+
};
|
|
4085
4228
|
}
|
|
4086
4229
|
serializeItem(item) {
|
|
4087
4230
|
if (item instanceof (0, $5e9ede69210ec54a$export$2e2bcd8739ae039)) return this.serializeTag(item);
|
|
@@ -5998,6 +6141,7 @@ var $c049675f48c823b2$export$2e2bcd8739ae039 = $c049675f48c823b2$var$ChordSheetP
|
|
|
5998
6141
|
|
|
5999
6142
|
|
|
6000
6143
|
|
|
6144
|
+
|
|
6001
6145
|
// Generated by peggy v. 2.0.1 (ts-pegjs plugin v. 3.0.0 )
|
|
6002
6146
|
//
|
|
6003
6147
|
// https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
|
|
@@ -7820,135 +7964,64 @@ var $c5e7c9181f4c1376$export$2e2bcd8739ae039 = $c5e7c9181f4c1376$var$ChordsOverW
|
|
|
7820
7964
|
|
|
7821
7965
|
|
|
7822
7966
|
|
|
7823
|
-
|
|
7824
|
-
const $db9c80925e255cd2$var$CHORUS_LINE_REGEX = /^\[Chorus]/;
|
|
7825
|
-
const $db9c80925e255cd2$var$OTHER_METADATA_LINE_REGEX = /^\[([^\]]+)]/;
|
|
7826
|
-
const $db9c80925e255cd2$var$startSectionTags = {
|
|
7827
|
-
[(0, $af8d31735c159a26$export$4b194284baed1659)]: (0, $5e9ede69210ec54a$export$deca399f8cd9b7dc),
|
|
7828
|
-
[(0, $af8d31735c159a26$export$8db6c706fc9142b2)]: (0, $5e9ede69210ec54a$export$4f5168acae064e01)
|
|
7829
|
-
};
|
|
7830
|
-
const $db9c80925e255cd2$var$endSectionTags = {
|
|
7831
|
-
[(0, $af8d31735c159a26$export$4b194284baed1659)]: (0, $5e9ede69210ec54a$export$640d294ab83f9040),
|
|
7832
|
-
[(0, $af8d31735c159a26$export$8db6c706fc9142b2)]: (0, $5e9ede69210ec54a$export$473c1a4819e5180b)
|
|
7833
|
-
};
|
|
7967
|
+
|
|
7834
7968
|
/**
|
|
7835
|
-
*
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
this.
|
|
7846
|
-
this.
|
|
7847
|
-
} else if ($db9c80925e255cd2$var$OTHER_METADATA_LINE_REGEX.test(line)) this.parseMetadataLine(line);
|
|
7848
|
-
else super.parseLine(line);
|
|
7849
|
-
}
|
|
7850
|
-
parseMetadataLine(line) {
|
|
7851
|
-
this.startNewLine();
|
|
7852
|
-
this.endSection();
|
|
7853
|
-
const comment = line.match($db9c80925e255cd2$var$OTHER_METADATA_LINE_REGEX)[1];
|
|
7854
|
-
if (!this.songLine) throw new Error("Expected this.songLine to be present");
|
|
7855
|
-
this.songLine.addTag(new (0, $5e9ede69210ec54a$export$2e2bcd8739ae039)((0, $5e9ede69210ec54a$export$a29989082612d0d9), comment));
|
|
7856
|
-
}
|
|
7857
|
-
isSectionEnd() {
|
|
7858
|
-
return this.songLine !== null && this.songLine.isEmpty() && this.song.previousLine !== null && !this.song.previousLine.isEmpty();
|
|
7859
|
-
}
|
|
7860
|
-
endOfSong() {
|
|
7861
|
-
super.endOfSong();
|
|
7862
|
-
if (this.currentSectionType !== null && this.currentSectionType in $db9c80925e255cd2$var$endSectionTags) this.startNewLine();
|
|
7863
|
-
this.endSection({
|
|
7864
|
-
addNewLine: false
|
|
7969
|
+
* Acts as a base class for HTML formatters
|
|
7970
|
+
*/ class $d834af97c9a2e4df$var$HtmlFormatter extends (0, $0055ecb09272ba2d$export$2e2bcd8739ae039) {
|
|
7971
|
+
/**
|
|
7972
|
+
* Formats a song into HTML.
|
|
7973
|
+
* @param {Song} song The song to be formatted
|
|
7974
|
+
* @returns {string} The HTML string
|
|
7975
|
+
*/ format(song) {
|
|
7976
|
+
const { bodyParagraphs: bodyParagraphs , expandedBodyParagraphs: expandedBodyParagraphs } = song;
|
|
7977
|
+
return this.template({
|
|
7978
|
+
song: song,
|
|
7979
|
+
configuration: this.configuration,
|
|
7980
|
+
bodyParagraphs: this.configuration.expandChorusDirective ? expandedBodyParagraphs : bodyParagraphs
|
|
7865
7981
|
});
|
|
7866
7982
|
}
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7983
|
+
/**
|
|
7984
|
+
* Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output
|
|
7985
|
+
* @deprecated
|
|
7986
|
+
*/ static cssString(_scope = "") {
|
|
7987
|
+
(0, $21a34a464e7bc609$export$c73e2a74b163f89e)("The class method cssString() was removed in favor of the instance PROPERTY. Please use `new <Formatter>().cssString` instead.");
|
|
7872
7988
|
}
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7989
|
+
/**
|
|
7990
|
+
* Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output
|
|
7991
|
+
*
|
|
7992
|
+
* For example, execute cssString('.chordSheetViewer') will result in CSS like:
|
|
7993
|
+
*
|
|
7994
|
+
* .chordSheetViewer .paragraph {
|
|
7995
|
+
* margin-bottom: 1em;
|
|
7996
|
+
* }
|
|
7997
|
+
*
|
|
7998
|
+
* @param scope the CSS scope to use, for example `.chordSheetViewer`
|
|
7999
|
+
* @returns {string} the CSS string
|
|
8000
|
+
*/ cssString(scope = "") {
|
|
8001
|
+
return (0, $21a34a464e7bc609$export$59d377d2a2e0150a)(this.defaultCss, scope);
|
|
7880
8002
|
}
|
|
7881
|
-
|
|
7882
|
-
|
|
8003
|
+
/**
|
|
8004
|
+
* Basic CSS, in object style à la useStyles, to use with the HTML output
|
|
8005
|
+
* @deprecated
|
|
8006
|
+
*/ static cssObject() {
|
|
8007
|
+
(0, $21a34a464e7bc609$export$c73e2a74b163f89e)("The class method cssObject() was removed in favor of the instance PROPERTY. Please use `new <Formatter>().cssObject` instead.");
|
|
7883
8008
|
}
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
8009
|
+
/**
|
|
8010
|
+
* Basic CSS, in object style à la useStyles, to use with the HTML output
|
|
8011
|
+
* For a CSS string see {@link cssString}
|
|
8012
|
+
*
|
|
8013
|
+
* Example:
|
|
8014
|
+
*
|
|
8015
|
+
* '.paragraph': {
|
|
8016
|
+
* marginBottom: '1em'
|
|
8017
|
+
* }
|
|
8018
|
+
*
|
|
8019
|
+
* @return {Object.<string, Object.<string, string>>} the CSS object
|
|
8020
|
+
*/ get cssObject() {
|
|
8021
|
+
return this.defaultCss;
|
|
7895
8022
|
}
|
|
7896
8023
|
}
|
|
7897
|
-
var $
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
const $bbcfd2c49e8e9957$export$78c0028a34264234 = {
|
|
7902
|
-
evaluate: false,
|
|
7903
|
-
metadata: {
|
|
7904
|
-
separator: ","
|
|
7905
|
-
},
|
|
7906
|
-
key: null,
|
|
7907
|
-
expandChorusDirective: false
|
|
7908
|
-
};
|
|
7909
|
-
class $bbcfd2c49e8e9957$var$Configuration {
|
|
7910
|
-
constructor(configuration = $bbcfd2c49e8e9957$export$78c0028a34264234){
|
|
7911
|
-
const mergedConfig = {
|
|
7912
|
-
...$bbcfd2c49e8e9957$export$78c0028a34264234,
|
|
7913
|
-
...configuration
|
|
7914
|
-
};
|
|
7915
|
-
this.evaluate = !!mergedConfig.evaluate;
|
|
7916
|
-
this.expandChorusDirective = !!mergedConfig.expandChorusDirective;
|
|
7917
|
-
this.metadata = new (0, $71c330be198ce421$export$2e2bcd8739ae039)(configuration.metadata);
|
|
7918
|
-
this.key = configuration.key ? (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(configuration.key) : null;
|
|
7919
|
-
this.configuration = configuration;
|
|
7920
|
-
}
|
|
7921
|
-
get(key) {
|
|
7922
|
-
return (0, ($parcel$interopDefault($988mA$lodashget)))(this, key);
|
|
7923
|
-
}
|
|
7924
|
-
}
|
|
7925
|
-
var $bbcfd2c49e8e9957$export$2e2bcd8739ae039 = $bbcfd2c49e8e9957$var$Configuration;
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
/**
|
|
7929
|
-
* Base class for all formatters, taking care of receiving a configuration wrapping that inside a Configuration object
|
|
7930
|
-
*/ class $0055ecb09272ba2d$var$Formatter {
|
|
7931
|
-
/**
|
|
7932
|
-
* Instantiate
|
|
7933
|
-
* @param {Object} [configuration={}] options
|
|
7934
|
-
* @param {boolean} [configuration.evaluate=false] Whether or not to evaluate meta expressions. For more info about
|
|
7935
|
-
* meta expressions, see: https://bit.ly/2SC9c2u
|
|
7936
|
-
* @param {object} [configuration.metadata={}]
|
|
7937
|
-
* @param {string} [configuration.metadata.separator=", "] The separator to be used when rendering a metadata value
|
|
7938
|
-
* that has multiple values. See: https://bit.ly/2SC9c2u
|
|
7939
|
-
* @param {Key|string} [configuration.key=null] The key to use for rendering. The chord sheet will be transposed
|
|
7940
|
-
* from the song's original key (as indicated by the `{key}` directive) to the specified key.
|
|
7941
|
-
* Note that transposing will only work
|
|
7942
|
-
* if the original song key is set.
|
|
7943
|
-
* @param {boolean} [configuration.expandChorusDirective=false] Whether or not to expand `{chorus}` directives
|
|
7944
|
-
* by rendering the last defined chorus inline after the directive.
|
|
7945
|
-
*/ constructor(configuration = null){
|
|
7946
|
-
this.configuration = new (0, $bbcfd2c49e8e9957$export$2e2bcd8739ae039)(configuration || {});
|
|
7947
|
-
}
|
|
7948
|
-
}
|
|
7949
|
-
var $0055ecb09272ba2d$export$2e2bcd8739ae039 = $0055ecb09272ba2d$var$Formatter;
|
|
7950
|
-
|
|
7951
|
-
|
|
8024
|
+
var $d834af97c9a2e4df$export$2e2bcd8739ae039 = $d834af97c9a2e4df$var$HtmlFormatter;
|
|
7952
8025
|
|
|
7953
8026
|
|
|
7954
8027
|
|
|
@@ -8206,151 +8279,83 @@ function $376e205ced98486b$export$ca030c9435779e4b(font) {
|
|
|
8206
8279
|
}
|
|
8207
8280
|
|
|
8208
8281
|
|
|
8282
|
+
var $93f055b77b2d269f$export$2e2bcd8739ae039 = ({ configuration: configuration , configuration: { key: key } , song: song , renderBlankLines: renderBlankLines = false , song: { title: title , subtitle: subtitle , metadata: metadata } , bodyParagraphs: bodyParagraphs })=>(0, $376e205ced98486b$export$6ea1b0eb82ead3f)(`
|
|
8283
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)(title, ()=>`<h1>${title}</h1>`)}
|
|
8284
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)(subtitle, ()=>`<h2>${subtitle}</h2>`)}
|
|
8285
|
+
|
|
8286
|
+
<div class="chord-sheet">
|
|
8287
|
+
${(0, $376e205ced98486b$export$79b2f7037acddd43)(bodyParagraphs, (paragraph)=>`
|
|
8288
|
+
<div class="${(0, $376e205ced98486b$export$dcd1550c9709312c)(paragraph)}">
|
|
8289
|
+
${(0, $376e205ced98486b$export$79b2f7037acddd43)(paragraph.lines, (line)=>`
|
|
8290
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)(renderBlankLines || (0, $376e205ced98486b$export$3db5961874282581)(line), ()=>`
|
|
8291
|
+
<div class="${(0, $376e205ced98486b$export$8a559c16cc3576)(line)}">
|
|
8292
|
+
${(0, $376e205ced98486b$export$79b2f7037acddd43)(line.items, (item)=>`
|
|
8293
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $376e205ced98486b$export$17c9e635b932873b)(item), ()=>`
|
|
8294
|
+
<div class="column">
|
|
8295
|
+
<div class="chord"${(0, $376e205ced98486b$export$ca030c9435779e4b)(line.chordFont)}>${(0, $dfecd32049fa58e9$export$596ec52955da9472)(item.chords, line, song, key)}</div>
|
|
8296
|
+
<div class="lyrics"${(0, $376e205ced98486b$export$ca030c9435779e4b)(line.textFont)}>${item.lyrics}</div>
|
|
8297
|
+
</div>
|
|
8298
|
+
`)}
|
|
8299
|
+
|
|
8300
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $376e205ced98486b$export$3bf645f08efe3292)(item), ()=>`
|
|
8301
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $376e205ced98486b$export$3ab01370f5e64ac8)(item), ()=>`
|
|
8302
|
+
<div class="comment">${item.value}</div>
|
|
8303
|
+
`)}
|
|
8304
|
+
|
|
8305
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)(item.hasRenderableLabel(), ()=>`
|
|
8306
|
+
<h3 class="label">${item.value}</h3>
|
|
8307
|
+
`)}
|
|
8308
|
+
`)}
|
|
8309
|
+
|
|
8310
|
+
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $21a34a464e7bc609$export$e3f63561d52b936d)(item), ()=>`
|
|
8311
|
+
<div class="column">
|
|
8312
|
+
<div class="chord"></div>
|
|
8313
|
+
<div class="lyrics"${(0, $376e205ced98486b$export$ca030c9435779e4b)(line.textFont)}>${(0, $376e205ced98486b$export$fef61f332f2c0afc)(item, metadata, configuration)}</div>
|
|
8314
|
+
</div>
|
|
8315
|
+
`)}
|
|
8316
|
+
`)}
|
|
8317
|
+
</div>
|
|
8318
|
+
`)}
|
|
8319
|
+
`)}
|
|
8320
|
+
</div>
|
|
8321
|
+
`)}
|
|
8322
|
+
</div>
|
|
8323
|
+
`);
|
|
8209
8324
|
|
|
8210
8325
|
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
const { title: title , subtitle: subtitle } = this.song;
|
|
8228
|
-
const separator = title || subtitle ? "\n" : "";
|
|
8229
|
-
return [
|
|
8230
|
-
this.formatTitle(title),
|
|
8231
|
-
this.formatSubTitle(subtitle),
|
|
8232
|
-
separator
|
|
8233
|
-
].join("");
|
|
8234
|
-
}
|
|
8235
|
-
formatParagraphs() {
|
|
8236
|
-
const { bodyParagraphs: bodyParagraphs , expandedBodyParagraphs: expandedBodyParagraphs , metadata: metadata } = this.song;
|
|
8237
|
-
const { expandChorusDirective: expandChorusDirective } = this.configuration;
|
|
8238
|
-
return (expandChorusDirective ? expandedBodyParagraphs : bodyParagraphs).map((paragraph)=>this.formatParagraph(paragraph, metadata)).join("\n\n");
|
|
8239
|
-
}
|
|
8240
|
-
formatParagraph(paragraph, metadata) {
|
|
8241
|
-
return paragraph.lines.filter((line)=>line.hasRenderableItems()).map((line)=>this.formatLine(line, metadata)).join("\n");
|
|
8242
|
-
}
|
|
8243
|
-
formatLine(line, metadata) {
|
|
8244
|
-
const parts = [
|
|
8245
|
-
this.formatLineTop(line, metadata),
|
|
8246
|
-
this.formatLineBottom(line, metadata)
|
|
8247
|
-
];
|
|
8248
|
-
return parts.filter((p)=>!(0, $21a34a464e7bc609$export$78d1711480f95c3e)(p)).map((part)=>(part || "").trimRight()).join("\n");
|
|
8249
|
-
}
|
|
8250
|
-
formatTitle(title) {
|
|
8251
|
-
if (title) return `${title.toUpperCase()}\n`;
|
|
8252
|
-
return "";
|
|
8253
|
-
}
|
|
8254
|
-
formatSubTitle(subtitle) {
|
|
8255
|
-
if (subtitle) return `${subtitle}\n`;
|
|
8256
|
-
return "";
|
|
8257
|
-
}
|
|
8258
|
-
formatLineTop(line, metadata) {
|
|
8259
|
-
if ((0, $21a34a464e7bc609$export$d332d76d125f0cbe)(line)) return this.formatLineWithFormatter(line, this.formatItemTop, metadata);
|
|
8260
|
-
return null;
|
|
8261
|
-
}
|
|
8262
|
-
chordLyricsPairLength(chordLyricsPair, line) {
|
|
8263
|
-
const chords = (0, $dfecd32049fa58e9$export$596ec52955da9472)(chordLyricsPair.chords, line, this.song, this.configuration.key);
|
|
8264
|
-
const { lyrics: lyrics } = chordLyricsPair;
|
|
8265
|
-
const chordsLength = (chords || "").length;
|
|
8266
|
-
const lyricsLength = (lyrics || "").length;
|
|
8267
|
-
if (chordsLength >= lyricsLength) return chordsLength + 1;
|
|
8268
|
-
return Math.max(chordsLength, lyricsLength);
|
|
8269
|
-
}
|
|
8270
|
-
formatItemTop(item, _metadata, line) {
|
|
8271
|
-
if (item instanceof (0, $5e9ede69210ec54a$export$2e2bcd8739ae039) && item.isRenderable()) return item.value || "";
|
|
8272
|
-
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) {
|
|
8273
|
-
const chords = (0, $dfecd32049fa58e9$export$596ec52955da9472)(item.chords, line, this.song, this.configuration.key);
|
|
8274
|
-
return (0, $21a34a464e7bc609$export$bc3bea8325045070)(chords, this.chordLyricsPairLength(item, line));
|
|
8275
|
-
}
|
|
8276
|
-
return "";
|
|
8277
|
-
}
|
|
8278
|
-
formatLineBottom(line, metadata) {
|
|
8279
|
-
if ((0, $376e205ced98486b$export$b8d631d9200974fa)(line)) return this.formatLineWithFormatter(line, this.formatItemBottom, metadata);
|
|
8280
|
-
return "";
|
|
8281
|
-
}
|
|
8282
|
-
formatLineWithFormatter(line, formatter, metadata) {
|
|
8283
|
-
return line.items.map((item)=>formatter.call(this, item, metadata, line)).join("");
|
|
8284
|
-
}
|
|
8285
|
-
formatItemBottom(item, metadata, line) {
|
|
8286
|
-
if (item instanceof (0, $5e9ede69210ec54a$export$2e2bcd8739ae039) && item.isRenderable()) return item.value || "";
|
|
8287
|
-
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return (0, $21a34a464e7bc609$export$bc3bea8325045070)(item.lyrics || "", this.chordLyricsPairLength(item, line));
|
|
8288
|
-
if ("evaluate" in item) return item.evaluate(metadata, this.configuration.get("metadata.separator"));
|
|
8289
|
-
return "";
|
|
8326
|
+
|
|
8327
|
+
const $ee0c149cc33dc156$export$200cf2de69532aa8 = {
|
|
8328
|
+
".chord:not(:last-child)": {
|
|
8329
|
+
paddingRight: "10px"
|
|
8330
|
+
},
|
|
8331
|
+
".paragraph": {
|
|
8332
|
+
marginBottom: "1em"
|
|
8333
|
+
},
|
|
8334
|
+
".row": {
|
|
8335
|
+
display: "flex"
|
|
8336
|
+
},
|
|
8337
|
+
".chord:after": {
|
|
8338
|
+
content: "'\\200b'"
|
|
8339
|
+
},
|
|
8340
|
+
".lyrics:after": {
|
|
8341
|
+
content: "'\\200b'"
|
|
8290
8342
|
}
|
|
8343
|
+
};
|
|
8344
|
+
function $ee0c149cc33dc156$export$aa5b6043dd05348b(scope) {
|
|
8345
|
+
return (0, $21a34a464e7bc609$export$59d377d2a2e0150a)($ee0c149cc33dc156$export$200cf2de69532aa8, scope);
|
|
8291
8346
|
}
|
|
8292
|
-
var $525b2331e4b0ed83$export$2e2bcd8739ae039 = $525b2331e4b0ed83$var$TextFormatter;
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
8347
|
/**
|
|
8298
|
-
*
|
|
8299
|
-
*/ class $
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
* @param {Song} song The song to be formatted
|
|
8303
|
-
* @returns {string} The HTML string
|
|
8304
|
-
*/ format(song) {
|
|
8305
|
-
const { bodyParagraphs: bodyParagraphs , expandedBodyParagraphs: expandedBodyParagraphs } = song;
|
|
8306
|
-
return this.template({
|
|
8307
|
-
song: song,
|
|
8308
|
-
configuration: this.configuration,
|
|
8309
|
-
bodyParagraphs: this.configuration.expandChorusDirective ? expandedBodyParagraphs : bodyParagraphs
|
|
8310
|
-
});
|
|
8311
|
-
}
|
|
8312
|
-
/**
|
|
8313
|
-
* Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output
|
|
8314
|
-
* @deprecated
|
|
8315
|
-
*/ static cssString(_scope = "") {
|
|
8316
|
-
(0, $21a34a464e7bc609$export$c73e2a74b163f89e)("The class method cssString() was removed in favor of the instance PROPERTY. Please use `new <Formatter>().cssString` instead.");
|
|
8317
|
-
}
|
|
8318
|
-
/**
|
|
8319
|
-
* Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output
|
|
8320
|
-
*
|
|
8321
|
-
* For example, execute cssString('.chordSheetViewer') will result in CSS like:
|
|
8322
|
-
*
|
|
8323
|
-
* .chordSheetViewer .paragraph {
|
|
8324
|
-
* margin-bottom: 1em;
|
|
8325
|
-
* }
|
|
8326
|
-
*
|
|
8327
|
-
* @param scope the CSS scope to use, for example `.chordSheetViewer`
|
|
8328
|
-
* @returns {string} the CSS string
|
|
8329
|
-
*/ cssString(scope = "") {
|
|
8330
|
-
return (0, $21a34a464e7bc609$export$59d377d2a2e0150a)(this.defaultCss, scope);
|
|
8331
|
-
}
|
|
8332
|
-
/**
|
|
8333
|
-
* Basic CSS, in object style à la useStyles, to use with the HTML output
|
|
8334
|
-
* @deprecated
|
|
8335
|
-
*/ static cssObject() {
|
|
8336
|
-
(0, $21a34a464e7bc609$export$c73e2a74b163f89e)("The class method cssObject() was removed in favor of the instance PROPERTY. Please use `new <Formatter>().cssObject` instead.");
|
|
8348
|
+
* Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.
|
|
8349
|
+
*/ class $ee0c149cc33dc156$var$HtmlDivFormatter extends (0, $d834af97c9a2e4df$export$2e2bcd8739ae039) {
|
|
8350
|
+
get template() {
|
|
8351
|
+
return 0, $93f055b77b2d269f$export$2e2bcd8739ae039;
|
|
8337
8352
|
}
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
* For a CSS string see {@link cssString}
|
|
8341
|
-
*
|
|
8342
|
-
* Example:
|
|
8343
|
-
*
|
|
8344
|
-
* '.paragraph': {
|
|
8345
|
-
* marginBottom: '1em'
|
|
8346
|
-
* }
|
|
8347
|
-
*
|
|
8348
|
-
* @return {Object.<string, Object.<string, string>>} the CSS object
|
|
8349
|
-
*/ get cssObject() {
|
|
8350
|
-
return this.defaultCss;
|
|
8353
|
+
get defaultCss() {
|
|
8354
|
+
return $ee0c149cc33dc156$export$200cf2de69532aa8;
|
|
8351
8355
|
}
|
|
8352
8356
|
}
|
|
8353
|
-
var $
|
|
8357
|
+
var $ee0c149cc33dc156$export$2e2bcd8739ae039 = $ee0c149cc33dc156$var$HtmlDivFormatter;
|
|
8358
|
+
|
|
8354
8359
|
|
|
8355
8360
|
|
|
8356
8361
|
|
|
@@ -8452,82 +8457,9 @@ var $5b02ea769c63fd56$export$2e2bcd8739ae039 = $5b02ea769c63fd56$var$HtmlTableFo
|
|
|
8452
8457
|
|
|
8453
8458
|
|
|
8454
8459
|
|
|
8455
|
-
var $93f055b77b2d269f$export$2e2bcd8739ae039 = ({ configuration: configuration , configuration: { key: key } , song: song , renderBlankLines: renderBlankLines = false , song: { title: title , subtitle: subtitle , metadata: metadata } , bodyParagraphs: bodyParagraphs })=>(0, $376e205ced98486b$export$6ea1b0eb82ead3f)(`
|
|
8456
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)(title, ()=>`<h1>${title}</h1>`)}
|
|
8457
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)(subtitle, ()=>`<h2>${subtitle}</h2>`)}
|
|
8458
|
-
|
|
8459
|
-
<div class="chord-sheet">
|
|
8460
|
-
${(0, $376e205ced98486b$export$79b2f7037acddd43)(bodyParagraphs, (paragraph)=>`
|
|
8461
|
-
<div class="${(0, $376e205ced98486b$export$dcd1550c9709312c)(paragraph)}">
|
|
8462
|
-
${(0, $376e205ced98486b$export$79b2f7037acddd43)(paragraph.lines, (line)=>`
|
|
8463
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)(renderBlankLines || (0, $376e205ced98486b$export$3db5961874282581)(line), ()=>`
|
|
8464
|
-
<div class="${(0, $376e205ced98486b$export$8a559c16cc3576)(line)}">
|
|
8465
|
-
${(0, $376e205ced98486b$export$79b2f7037acddd43)(line.items, (item)=>`
|
|
8466
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $376e205ced98486b$export$17c9e635b932873b)(item), ()=>`
|
|
8467
|
-
<div class="column">
|
|
8468
|
-
<div class="chord"${(0, $376e205ced98486b$export$ca030c9435779e4b)(line.chordFont)}>${(0, $dfecd32049fa58e9$export$596ec52955da9472)(item.chords, line, song, key)}</div>
|
|
8469
|
-
<div class="lyrics"${(0, $376e205ced98486b$export$ca030c9435779e4b)(line.textFont)}>${item.lyrics}</div>
|
|
8470
|
-
</div>
|
|
8471
|
-
`)}
|
|
8472
|
-
|
|
8473
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $376e205ced98486b$export$3bf645f08efe3292)(item), ()=>`
|
|
8474
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $376e205ced98486b$export$3ab01370f5e64ac8)(item), ()=>`
|
|
8475
|
-
<div class="comment">${item.value}</div>
|
|
8476
|
-
`)}
|
|
8477
|
-
|
|
8478
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)(item.hasRenderableLabel(), ()=>`
|
|
8479
|
-
<h3 class="label">${item.value}</h3>
|
|
8480
|
-
`)}
|
|
8481
|
-
`)}
|
|
8482
|
-
|
|
8483
|
-
${(0, $376e205ced98486b$export$a55877ca9db47377)((0, $21a34a464e7bc609$export$e3f63561d52b936d)(item), ()=>`
|
|
8484
|
-
<div class="column">
|
|
8485
|
-
<div class="chord"></div>
|
|
8486
|
-
<div class="lyrics"${(0, $376e205ced98486b$export$ca030c9435779e4b)(line.textFont)}>${(0, $376e205ced98486b$export$fef61f332f2c0afc)(item, metadata, configuration)}</div>
|
|
8487
|
-
</div>
|
|
8488
|
-
`)}
|
|
8489
|
-
`)}
|
|
8490
|
-
</div>
|
|
8491
|
-
`)}
|
|
8492
|
-
`)}
|
|
8493
|
-
</div>
|
|
8494
|
-
`)}
|
|
8495
|
-
</div>
|
|
8496
|
-
`);
|
|
8497
8460
|
|
|
8498
8461
|
|
|
8499
8462
|
|
|
8500
|
-
const $ee0c149cc33dc156$export$200cf2de69532aa8 = {
|
|
8501
|
-
".chord:not(:last-child)": {
|
|
8502
|
-
paddingRight: "10px"
|
|
8503
|
-
},
|
|
8504
|
-
".paragraph": {
|
|
8505
|
-
marginBottom: "1em"
|
|
8506
|
-
},
|
|
8507
|
-
".row": {
|
|
8508
|
-
display: "flex"
|
|
8509
|
-
},
|
|
8510
|
-
".chord:after": {
|
|
8511
|
-
content: "'\\200b'"
|
|
8512
|
-
},
|
|
8513
|
-
".lyrics:after": {
|
|
8514
|
-
content: "'\\200b'"
|
|
8515
|
-
}
|
|
8516
|
-
};
|
|
8517
|
-
function $ee0c149cc33dc156$export$aa5b6043dd05348b(scope) {
|
|
8518
|
-
return (0, $21a34a464e7bc609$export$59d377d2a2e0150a)($ee0c149cc33dc156$export$200cf2de69532aa8, scope);
|
|
8519
|
-
}
|
|
8520
|
-
/**
|
|
8521
|
-
* Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.
|
|
8522
|
-
*/ class $ee0c149cc33dc156$var$HtmlDivFormatter extends (0, $d834af97c9a2e4df$export$2e2bcd8739ae039) {
|
|
8523
|
-
get template() {
|
|
8524
|
-
return 0, $93f055b77b2d269f$export$2e2bcd8739ae039;
|
|
8525
|
-
}
|
|
8526
|
-
get defaultCss() {
|
|
8527
|
-
return $ee0c149cc33dc156$export$200cf2de69532aa8;
|
|
8528
|
-
}
|
|
8529
|
-
}
|
|
8530
|
-
var $ee0c149cc33dc156$export$2e2bcd8739ae039 = $ee0c149cc33dc156$var$HtmlDivFormatter;
|
|
8531
8463
|
|
|
8532
8464
|
|
|
8533
8465
|
|
|
@@ -8535,85 +8467,157 @@ var $ee0c149cc33dc156$export$2e2bcd8739ae039 = $ee0c149cc33dc156$var$HtmlDivForm
|
|
|
8535
8467
|
|
|
8536
8468
|
|
|
8537
8469
|
|
|
8538
|
-
|
|
8470
|
+
|
|
8539
8471
|
/**
|
|
8540
|
-
* Formats a song into a
|
|
8541
|
-
*/ class $
|
|
8472
|
+
* Formats a song into a plain text chord sheet
|
|
8473
|
+
*/ class $525b2331e4b0ed83$var$TextFormatter extends (0, $0055ecb09272ba2d$export$2e2bcd8739ae039) {
|
|
8474
|
+
song = new (0, $6f653df65dfdf4ef$export$2e2bcd8739ae039)();
|
|
8542
8475
|
/**
|
|
8543
|
-
* Formats a song into a
|
|
8476
|
+
* Formats a song into a plain text chord sheet
|
|
8544
8477
|
* @param {Song} song The song to be formatted
|
|
8545
|
-
* @returns {string}
|
|
8478
|
+
* @returns {string} the chord sheet
|
|
8546
8479
|
*/ format(song) {
|
|
8547
|
-
|
|
8548
|
-
return
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
}
|
|
8553
|
-
formatItem(item, metadata) {
|
|
8554
|
-
if (item instanceof (0, $5e9ede69210ec54a$export$2e2bcd8739ae039)) return this.formatTag(item);
|
|
8555
|
-
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return this.formatChordLyricsPair(item);
|
|
8556
|
-
if ("evaluate" in item) return this.formatOrEvaluateItem(item, metadata);
|
|
8557
|
-
throw new Error(`Don't know how to format a ${item.constructor.name}`);
|
|
8558
|
-
}
|
|
8559
|
-
formatOrEvaluateItem(item, metadata) {
|
|
8560
|
-
if (this.configuration.evaluate) return item.evaluate(metadata, this.configuration.get("metadata.separator"));
|
|
8561
|
-
if (item instanceof (0, $b6d84b168638423d$export$2e2bcd8739ae039)) return this.formatTernary(item);
|
|
8562
|
-
if (item instanceof (0, $e1378a714a1834c5$export$2e2bcd8739ae039)) return item.evaluate();
|
|
8563
|
-
throw new Error(`Don't know how to format a ${item.constructor.name}`);
|
|
8480
|
+
this.song = song;
|
|
8481
|
+
return [
|
|
8482
|
+
this.formatHeader(),
|
|
8483
|
+
this.formatParagraphs()
|
|
8484
|
+
].join("");
|
|
8564
8485
|
}
|
|
8565
|
-
|
|
8566
|
-
const {
|
|
8486
|
+
formatHeader() {
|
|
8487
|
+
const { title: title , subtitle: subtitle } = this.song;
|
|
8488
|
+
const separator = title || subtitle ? "\n" : "";
|
|
8567
8489
|
return [
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
this.formatExpressionRange(trueExpression),
|
|
8572
|
-
this.formatExpressionRange(falseExpression),
|
|
8573
|
-
"}"
|
|
8490
|
+
this.formatTitle(title),
|
|
8491
|
+
this.formatSubTitle(subtitle),
|
|
8492
|
+
separator
|
|
8574
8493
|
].join("");
|
|
8575
8494
|
}
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8495
|
+
formatParagraphs() {
|
|
8496
|
+
const { bodyParagraphs: bodyParagraphs , expandedBodyParagraphs: expandedBodyParagraphs , metadata: metadata } = this.song;
|
|
8497
|
+
const { expandChorusDirective: expandChorusDirective } = this.configuration;
|
|
8498
|
+
return (expandChorusDirective ? expandedBodyParagraphs : bodyParagraphs).map((paragraph)=>this.formatParagraph(paragraph, metadata)).join("\n\n");
|
|
8579
8499
|
}
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
return `|${expressionRange.map((expression)=>this.formatExpression(expression)).join("")}`;
|
|
8500
|
+
formatParagraph(paragraph, metadata) {
|
|
8501
|
+
return paragraph.lines.filter((line)=>line.hasRenderableItems()).map((line)=>this.formatLine(line, metadata)).join("\n");
|
|
8583
8502
|
}
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8503
|
+
formatLine(line, metadata) {
|
|
8504
|
+
const parts = [
|
|
8505
|
+
this.formatLineTop(line, metadata),
|
|
8506
|
+
this.formatLineBottom(line, metadata)
|
|
8507
|
+
];
|
|
8508
|
+
return parts.filter((p)=>!(0, $21a34a464e7bc609$export$78d1711480f95c3e)(p)).map((part)=>(part || "").trimRight()).join("\n");
|
|
8509
|
+
}
|
|
8510
|
+
formatTitle(title) {
|
|
8511
|
+
if (title) return `${title.toUpperCase()}\n`;
|
|
8587
8512
|
return "";
|
|
8588
8513
|
}
|
|
8589
|
-
|
|
8590
|
-
if (
|
|
8591
|
-
return
|
|
8514
|
+
formatSubTitle(subtitle) {
|
|
8515
|
+
if (subtitle) return `${subtitle}\n`;
|
|
8516
|
+
return "";
|
|
8592
8517
|
}
|
|
8593
|
-
|
|
8594
|
-
return
|
|
8595
|
-
|
|
8596
|
-
this.formatChordLyricsPairLyrics(chordLyricsPair)
|
|
8597
|
-
].join("");
|
|
8518
|
+
formatLineTop(line, metadata) {
|
|
8519
|
+
if ((0, $21a34a464e7bc609$export$d332d76d125f0cbe)(line)) return this.formatLineWithFormatter(line, this.formatItemTop, metadata);
|
|
8520
|
+
return null;
|
|
8598
8521
|
}
|
|
8599
|
-
|
|
8600
|
-
|
|
8522
|
+
chordLyricsPairLength(chordLyricsPair, line) {
|
|
8523
|
+
const chords = (0, $dfecd32049fa58e9$export$596ec52955da9472)(chordLyricsPair.chords, line, this.song, this.configuration.key);
|
|
8524
|
+
const { lyrics: lyrics } = chordLyricsPair;
|
|
8525
|
+
const chordsLength = (chords || "").length;
|
|
8526
|
+
const lyricsLength = (lyrics || "").length;
|
|
8527
|
+
if (chordsLength >= lyricsLength) return chordsLength + 1;
|
|
8528
|
+
return Math.max(chordsLength, lyricsLength);
|
|
8529
|
+
}
|
|
8530
|
+
formatItemTop(item, _metadata, line) {
|
|
8531
|
+
if (item instanceof (0, $5e9ede69210ec54a$export$2e2bcd8739ae039) && item.isRenderable()) return item.value || "";
|
|
8532
|
+
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) {
|
|
8533
|
+
const chords = (0, $dfecd32049fa58e9$export$596ec52955da9472)(item.chords, line, this.song, this.configuration.key);
|
|
8534
|
+
return (0, $21a34a464e7bc609$export$bc3bea8325045070)(chords, this.chordLyricsPairLength(item, line));
|
|
8535
|
+
}
|
|
8601
8536
|
return "";
|
|
8602
8537
|
}
|
|
8603
|
-
|
|
8604
|
-
return
|
|
8538
|
+
formatLineBottom(line, metadata) {
|
|
8539
|
+
if ((0, $376e205ced98486b$export$b8d631d9200974fa)(line)) return this.formatLineWithFormatter(line, this.formatItemBottom, metadata);
|
|
8540
|
+
return "";
|
|
8541
|
+
}
|
|
8542
|
+
formatLineWithFormatter(line, formatter, metadata) {
|
|
8543
|
+
return line.items.map((item)=>formatter.call(this, item, metadata, line)).join("");
|
|
8544
|
+
}
|
|
8545
|
+
formatItemBottom(item, metadata, line) {
|
|
8546
|
+
if (item instanceof (0, $5e9ede69210ec54a$export$2e2bcd8739ae039) && item.isRenderable()) return item.value || "";
|
|
8547
|
+
if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return (0, $21a34a464e7bc609$export$bc3bea8325045070)(item.lyrics || "", this.chordLyricsPairLength(item, line));
|
|
8548
|
+
if ("evaluate" in item) return item.evaluate(metadata, this.configuration.get("metadata.separator"));
|
|
8549
|
+
return "";
|
|
8605
8550
|
}
|
|
8606
8551
|
}
|
|
8607
|
-
var $
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8552
|
+
var $525b2331e4b0ed83$export$2e2bcd8739ae039 = $525b2331e4b0ed83$var$TextFormatter;
|
|
8612
8553
|
|
|
8613
8554
|
|
|
8614
8555
|
|
|
8615
8556
|
|
|
8616
8557
|
|
|
8558
|
+
const $db9c80925e255cd2$var$VERSE_LINE_REGEX = /^\[Verse.*]/;
|
|
8559
|
+
const $db9c80925e255cd2$var$CHORUS_LINE_REGEX = /^\[Chorus]/;
|
|
8560
|
+
const $db9c80925e255cd2$var$OTHER_METADATA_LINE_REGEX = /^\[([^\]]+)]/;
|
|
8561
|
+
const $db9c80925e255cd2$var$startSectionTags = {
|
|
8562
|
+
[(0, $af8d31735c159a26$export$4b194284baed1659)]: (0, $5e9ede69210ec54a$export$deca399f8cd9b7dc),
|
|
8563
|
+
[(0, $af8d31735c159a26$export$8db6c706fc9142b2)]: (0, $5e9ede69210ec54a$export$4f5168acae064e01)
|
|
8564
|
+
};
|
|
8565
|
+
const $db9c80925e255cd2$var$endSectionTags = {
|
|
8566
|
+
[(0, $af8d31735c159a26$export$4b194284baed1659)]: (0, $5e9ede69210ec54a$export$640d294ab83f9040),
|
|
8567
|
+
[(0, $af8d31735c159a26$export$8db6c706fc9142b2)]: (0, $5e9ede69210ec54a$export$473c1a4819e5180b)
|
|
8568
|
+
};
|
|
8569
|
+
/**
|
|
8570
|
+
* Parses an Ultimate Guitar chord sheet with metadata
|
|
8571
|
+
* Inherits from {@link ChordSheetParser}
|
|
8572
|
+
*/ class $db9c80925e255cd2$var$UltimateGuitarParser extends (0, $c049675f48c823b2$export$2e2bcd8739ae039) {
|
|
8573
|
+
currentSectionType = null;
|
|
8574
|
+
parseLine(line) {
|
|
8575
|
+
if (this.isSectionEnd()) this.endSection();
|
|
8576
|
+
if ($db9c80925e255cd2$var$VERSE_LINE_REGEX.test(line)) {
|
|
8577
|
+
this.startNewLine();
|
|
8578
|
+
this.startSection((0, $af8d31735c159a26$export$4b194284baed1659));
|
|
8579
|
+
} else if ($db9c80925e255cd2$var$CHORUS_LINE_REGEX.test(line)) {
|
|
8580
|
+
this.startNewLine();
|
|
8581
|
+
this.startSection((0, $af8d31735c159a26$export$8db6c706fc9142b2));
|
|
8582
|
+
} else if ($db9c80925e255cd2$var$OTHER_METADATA_LINE_REGEX.test(line)) this.parseMetadataLine(line);
|
|
8583
|
+
else super.parseLine(line);
|
|
8584
|
+
}
|
|
8585
|
+
parseMetadataLine(line) {
|
|
8586
|
+
this.startNewLine();
|
|
8587
|
+
this.endSection();
|
|
8588
|
+
const comment = line.match($db9c80925e255cd2$var$OTHER_METADATA_LINE_REGEX)[1];
|
|
8589
|
+
if (!this.songLine) throw new Error("Expected this.songLine to be present");
|
|
8590
|
+
this.songLine.addTag(new (0, $5e9ede69210ec54a$export$2e2bcd8739ae039)((0, $5e9ede69210ec54a$export$a29989082612d0d9), comment));
|
|
8591
|
+
}
|
|
8592
|
+
isSectionEnd() {
|
|
8593
|
+
return this.songLine !== null && this.songLine.isEmpty() && this.song.previousLine !== null && !this.song.previousLine.isEmpty();
|
|
8594
|
+
}
|
|
8595
|
+
endOfSong() {
|
|
8596
|
+
super.endOfSong();
|
|
8597
|
+
if (this.currentSectionType !== null && this.currentSectionType in $db9c80925e255cd2$var$endSectionTags) this.startNewLine();
|
|
8598
|
+
this.endSection({
|
|
8599
|
+
addNewLine: false
|
|
8600
|
+
});
|
|
8601
|
+
}
|
|
8602
|
+
startSection(sectionType) {
|
|
8603
|
+
if (this.currentSectionType) this.endSection();
|
|
8604
|
+
this.currentSectionType = sectionType;
|
|
8605
|
+
this.song.setCurrentProperties(sectionType);
|
|
8606
|
+
if (sectionType in $db9c80925e255cd2$var$startSectionTags) this.song.addTag(new (0, $5e9ede69210ec54a$export$2e2bcd8739ae039)($db9c80925e255cd2$var$startSectionTags[sectionType]));
|
|
8607
|
+
}
|
|
8608
|
+
endSection({ addNewLine: addNewLine = true } = {}) {
|
|
8609
|
+
if (this.currentSectionType !== null && this.currentSectionType in $db9c80925e255cd2$var$endSectionTags) {
|
|
8610
|
+
this.song.addTag(new (0, $5e9ede69210ec54a$export$2e2bcd8739ae039)($db9c80925e255cd2$var$endSectionTags[this.currentSectionType]));
|
|
8611
|
+
if (addNewLine) this.startNewLine();
|
|
8612
|
+
}
|
|
8613
|
+
this.song.setCurrentProperties((0, $af8d31735c159a26$export$c53d0f541b41b88e));
|
|
8614
|
+
this.currentSectionType = null;
|
|
8615
|
+
}
|
|
8616
|
+
startNewLine() {
|
|
8617
|
+
this.songLine = this.song.addLine();
|
|
8618
|
+
}
|
|
8619
|
+
}
|
|
8620
|
+
var $db9c80925e255cd2$export$2e2bcd8739ae039 = $db9c80925e255cd2$var$UltimateGuitarParser;
|
|
8617
8621
|
|
|
8618
8622
|
|
|
8619
8623
|
|
|
@@ -8642,30 +8646,30 @@ var $b601b9602157ea5f$export$2e2bcd8739ae039 = $b601b9602157ea5f$var$ChordProFor
|
|
|
8642
8646
|
|
|
8643
8647
|
|
|
8644
8648
|
var $882b6d93070905b3$export$2e2bcd8739ae039 = {
|
|
8649
|
+
ChordLyricsPair: $d454f4215ba01af2$export$2e2bcd8739ae039,
|
|
8650
|
+
ChordProFormatter: $b601b9602157ea5f$export$2e2bcd8739ae039,
|
|
8645
8651
|
ChordProParser: $4f0048d666582440$export$2e2bcd8739ae039,
|
|
8646
8652
|
ChordSheetParser: $c049675f48c823b2$export$2e2bcd8739ae039,
|
|
8653
|
+
ChordSheetSerializer: $1c14afc274b727b7$export$2e2bcd8739ae039,
|
|
8647
8654
|
ChordsOverWordsParser: $c5e7c9181f4c1376$export$2e2bcd8739ae039,
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
HtmlTableFormatter: $5b02ea769c63fd56$export$2e2bcd8739ae039,
|
|
8655
|
+
Comment: $2115988b22311cb1$export$2e2bcd8739ae039,
|
|
8656
|
+
Composite: $812df3771838671d$export$2e2bcd8739ae039,
|
|
8651
8657
|
HtmlDivFormatter: $ee0c149cc33dc156$export$2e2bcd8739ae039,
|
|
8652
|
-
|
|
8653
|
-
ChordLyricsPair: $d454f4215ba01af2$export$2e2bcd8739ae039,
|
|
8658
|
+
HtmlTableFormatter: $5b02ea769c63fd56$export$2e2bcd8739ae039,
|
|
8654
8659
|
Line: $bc411321e9739719$export$2e2bcd8739ae039,
|
|
8655
|
-
|
|
8656
|
-
Tag: $5e9ede69210ec54a$export$2e2bcd8739ae039,
|
|
8657
|
-
Comment: $2115988b22311cb1$export$2e2bcd8739ae039,
|
|
8660
|
+
Literal: $e1378a714a1834c5$export$2e2bcd8739ae039,
|
|
8658
8661
|
Metadata: $1406c61233580008$export$2e2bcd8739ae039,
|
|
8659
8662
|
Paragraph: $0c3420c6a3e8a9d7$export$2e2bcd8739ae039,
|
|
8663
|
+
Song: $6f653df65dfdf4ef$export$2e2bcd8739ae039,
|
|
8664
|
+
Tag: $5e9ede69210ec54a$export$2e2bcd8739ae039,
|
|
8660
8665
|
Ternary: $b6d84b168638423d$export$2e2bcd8739ae039,
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
ChordSheetSerializer: $1c14afc274b727b7$export$2e2bcd8739ae039,
|
|
8666
|
+
TextFormatter: $525b2331e4b0ed83$export$2e2bcd8739ae039,
|
|
8667
|
+
UltimateGuitarParser: $db9c80925e255cd2$export$2e2bcd8739ae039,
|
|
8664
8668
|
CHORUS: $af8d31735c159a26$export$8db6c706fc9142b2,
|
|
8665
8669
|
INDETERMINATE: $af8d31735c159a26$export$c5a6fe907430212e,
|
|
8670
|
+
NONE: $af8d31735c159a26$export$c53d0f541b41b88e,
|
|
8666
8671
|
TAB: $af8d31735c159a26$export$f1c9dd0f5207dd5e,
|
|
8667
|
-
VERSE: $af8d31735c159a26$export$4b194284baed1659
|
|
8668
|
-
NONE: $af8d31735c159a26$export$c53d0f541b41b88e
|
|
8672
|
+
VERSE: $af8d31735c159a26$export$4b194284baed1659
|
|
8669
8673
|
};
|
|
8670
8674
|
|
|
8671
8675
|
|