chordsheetjs 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +477 -539
  2. package/lib/bundle.js +15353 -0
  3. package/lib/index.js +6253 -216
  4. package/lib/index.js.map +1 -0
  5. package/lib/main.d.ts +1062 -0
  6. package/lib/main.d.ts.map +1 -0
  7. package/package.json +50 -23
  8. package/d7b54993c4ea66c07a35bd36690482ab620f836e.patch +0 -105
  9. package/lib/chord.js +0 -496
  10. package/lib/chord_sheet/chord_lyrics_pair.js +0 -75
  11. package/lib/chord_sheet/chord_pro/composite.js +0 -54
  12. package/lib/chord_sheet/chord_pro/evaluation_error.js +0 -58
  13. package/lib/chord_sheet/chord_pro/literal.js +0 -42
  14. package/lib/chord_sheet/chord_pro/ternary.js +0 -126
  15. package/lib/chord_sheet/comment.js +0 -55
  16. package/lib/chord_sheet/line.js +0 -185
  17. package/lib/chord_sheet/metadata.js +0 -202
  18. package/lib/chord_sheet/paragraph.js +0 -88
  19. package/lib/chord_sheet/song.js +0 -353
  20. package/lib/chord_sheet/tag.js +0 -345
  21. package/lib/chord_sheet_serializer.js +0 -278
  22. package/lib/constants.js +0 -54
  23. package/lib/formatter/chord_pro_formatter.js +0 -184
  24. package/lib/formatter/html_div_formatter.js +0 -130
  25. package/lib/formatter/html_formatter.js +0 -44
  26. package/lib/formatter/html_table_formatter.js +0 -154
  27. package/lib/formatter/templates/html_div_formatter.js +0 -544
  28. package/lib/formatter/templates/html_table_formatter.js +0 -731
  29. package/lib/formatter/text_formatter.js +0 -184
  30. package/lib/helpers.js +0 -32
  31. package/lib/key.js +0 -386
  32. package/lib/normalize_mappings/enharmonic-normalize.js +0 -124
  33. package/lib/normalize_mappings/generate-suffix-normalize-mapping.js +0 -36
  34. package/lib/normalize_mappings/suffix-normalize-mapping.js +0 -914
  35. package/lib/note.js +0 -264
  36. package/lib/parser/chord_pro_parser.js +0 -64
  37. package/lib/parser/chord_pro_peg_parser.js +0 -2069
  38. package/lib/parser/chord_sheet_parser.js +0 -175
  39. package/lib/parser/parser_warning.js +0 -62
  40. package/lib/parser/ultimate_guitar_parser.js +0 -154
  41. package/lib/template_helpers.js +0 -98
  42. package/lib/utilities.js +0 -110
package/lib/chord.js DELETED
@@ -1,496 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
- exports.parseChord = parseChord;
10
-
11
- var _utilities = require("./utilities");
12
-
13
- var _key = _interopRequireDefault(require("./key"));
14
-
15
- var _suffixNormalizeMapping = _interopRequireDefault(require("./normalize_mappings/suffix-normalize-mapping"));
16
-
17
- var _constants = require("./constants");
18
-
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
20
-
21
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
-
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
-
25
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
-
27
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
-
29
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
30
-
31
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
32
-
33
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
34
-
35
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
36
-
37
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
38
-
39
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
40
-
41
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
42
-
43
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
44
-
45
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
46
-
47
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
48
-
49
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
50
-
51
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
52
-
53
- function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { return groups[name] = result[g[name]], groups; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
54
-
55
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
56
-
57
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
58
-
59
- function normalizeSuffix(suffix) {
60
- if (_suffixNormalizeMapping["default"][suffix] === '[blank]') {
61
- return null;
62
- }
63
-
64
- return _suffixNormalizeMapping["default"][suffix] || suffix;
65
- }
66
-
67
- var chordRegex = /*#__PURE__*/_wrapRegExp(/^([A-G])(#|b)?((?:(?![\t-\r \/\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])[\s\S])*)(\/([A-G])(#|b)?)?$/i, {
68
- base: 1,
69
- modifier: 2,
70
- suffix: 3,
71
- bassBase: 5,
72
- bassModifier: 6
73
- });
74
-
75
- var numericChordRegex = /*#__PURE__*/_wrapRegExp(/^(#|b)?([1-7])((?:(?![\t-\r \/\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])[\s\S])*)(\/(#|b)?([0-7]))?$/, {
76
- modifier: 1,
77
- base: 2,
78
- suffix: 3,
79
- bassModifier: 5,
80
- bassBase: 6
81
- });
82
-
83
- var sortedNumerals = _toConsumableArray(_constants.ROMAN_NUMERALS).sort(function (numeralA, numeralB) {
84
- return numeralB.length - numeralA.length;
85
- });
86
-
87
- var numerals = [].concat(_toConsumableArray(sortedNumerals), _toConsumableArray(sortedNumerals.map(function (numeral) {
88
- return numeral.toLowerCase();
89
- }))).join('|');
90
- var numeralChordRegex = // eslint-disable-next-line max-len
91
- new RegExp("^(?<modifier>#|b)?(?<base>".concat(numerals, ")(?<suffix>[^/\\s]*)(\\/(?<bassModifier>#|b)?(?<bassBase>").concat(numerals, "))?$"));
92
- var regexes = [numericChordRegex, numeralChordRegex, chordRegex];
93
- /**
94
- * Represents a Chord, consisting of a root, suffix (quality) and bass
95
- */
96
-
97
- var _rootNote = /*#__PURE__*/new WeakMap();
98
-
99
- var _process = /*#__PURE__*/new WeakSet();
100
-
101
- var _is = /*#__PURE__*/new WeakSet();
102
-
103
- var Chord = /*#__PURE__*/function () {
104
- function Chord(_ref) {
105
- var _ref$base = _ref.base,
106
- base = _ref$base === void 0 ? null : _ref$base,
107
- _ref$modifier = _ref.modifier,
108
- modifier = _ref$modifier === void 0 ? null : _ref$modifier,
109
- _ref$suffix = _ref.suffix,
110
- suffix = _ref$suffix === void 0 ? null : _ref$suffix,
111
- _ref$bassBase = _ref.bassBase,
112
- bassBase = _ref$bassBase === void 0 ? null : _ref$bassBase,
113
- _ref$bassModifier = _ref.bassModifier,
114
- bassModifier = _ref$bassModifier === void 0 ? null : _ref$bassModifier,
115
- _ref$root = _ref.root,
116
- root = _ref$root === void 0 ? null : _ref$root,
117
- _ref$bass = _ref.bass,
118
- bass = _ref$bass === void 0 ? null : _ref$bass;
119
-
120
- _classCallCheck(this, Chord);
121
-
122
- _classPrivateMethodInitSpec(this, _is);
123
-
124
- _classPrivateMethodInitSpec(this, _process);
125
-
126
- _classPrivateFieldInitSpec(this, _rootNote, {
127
- get: _get_rootNote,
128
- set: void 0
129
- });
130
-
131
- this.suffix = (0, _utilities.presence)(suffix);
132
- this.root = root || new _key["default"]({
133
- note: base,
134
- modifier: modifier,
135
- minor: suffix === 'm'
136
- });
137
-
138
- if (bass) {
139
- this.bass = bass;
140
- } else if (bassBase) {
141
- this.bass = new _key["default"]({
142
- note: bassBase,
143
- modifier: bassModifier,
144
- minor: suffix === 'm'
145
- });
146
- } else {
147
- this.bass = null;
148
- }
149
- }
150
-
151
- _createClass(Chord, [{
152
- key: "clone",
153
- value:
154
- /**
155
- * Returns a deep copy of the chord
156
- * @returns {Chord}
157
- */
158
- function clone() {
159
- return this.set({});
160
- }
161
- /**
162
- * Converts the chord to a chord symbol, using the supplied key as a reference.
163
- * For example, a numeric chord `#4` with reference key `E` will return the chord symbol `A#`.
164
- * When the chord is already a chord symbol, it will return a clone of the object.
165
- * @param {Key|string} key the reference key
166
- * @returns {Chord} the chord symbol
167
- */
168
-
169
- }, {
170
- key: "toChordSymbol",
171
- value: function toChordSymbol(key) {
172
- var _this$bass;
173
-
174
- if (this.isChordSymbol()) {
175
- return this.clone();
176
- }
177
-
178
- var keyObj = _key["default"].wrap(key);
179
-
180
- var rootKey = this.root.toChordSymbol(keyObj).normalizeEnharmonics(keyObj);
181
- var chordSymbolChord = new Chord({
182
- suffix: normalizeSuffix(this.suffix),
183
- root: rootKey,
184
- bass: (_this$bass = this.bass) === null || _this$bass === void 0 ? void 0 : _this$bass.toChordSymbol(keyObj).normalizeEnharmonics(rootKey)
185
- });
186
-
187
- if (this.root.isMinor()) {
188
- chordSymbolChord = chordSymbolChord.makeMinor();
189
- }
190
-
191
- return chordSymbolChord;
192
- }
193
- /**
194
- * Converts the chord to a chord symbol string, using the supplied key as a reference.
195
- * For example, a numeric chord `#4` with reference key `E` will return the chord symbol `A#`.
196
- * When the chord is already a chord symbol, it will return a string version of the chord.
197
- * @param {Key|string} key the reference key
198
- * @returns {string} the chord symbol string
199
- * @see {toChordSymbol}
200
- */
201
-
202
- }, {
203
- key: "toChordSymbolString",
204
- value: function toChordSymbolString(key) {
205
- return this.toChordSymbol(key).toString();
206
- }
207
- /**
208
- * Determines whether the chord is a chord symbol
209
- * @returns {boolean}
210
- */
211
-
212
- }, {
213
- key: "isChordSymbol",
214
- value: function isChordSymbol() {
215
- return _classPrivateMethodGet(this, _is, _is2).call(this, _constants.SYMBOL);
216
- }
217
- /**
218
- * Converts the chord to a numeric chord, using the supplied key as a reference.
219
- * For example, a chord symbol A# with reference key E will return the numeric chord #4.
220
- * @param {Key|string} key the reference key
221
- * @returns {Chord} the numeric chord
222
- */
223
-
224
- }, {
225
- key: "toNumeric",
226
- value: function toNumeric(key) {
227
- var _this$bass3;
228
-
229
- if (this.isNumeric()) {
230
- return this.clone();
231
- }
232
-
233
- if (this.isNumeral()) {
234
- var _this$bass2;
235
-
236
- return this.set({
237
- root: this.root.toNumeric(),
238
- bass: (_this$bass2 = this.bass) === null || _this$bass2 === void 0 ? void 0 : _this$bass2.toNumeric()
239
- });
240
- }
241
-
242
- var keyObj = _key["default"].wrap(key);
243
-
244
- return new Chord({
245
- suffix: normalizeSuffix(this.suffix),
246
- root: this.root.toNumeric(keyObj),
247
- bass: (_this$bass3 = this.bass) === null || _this$bass3 === void 0 ? void 0 : _this$bass3.toNumeric(keyObj)
248
- });
249
- }
250
- /**
251
- * Converts the chord to a numeral chord, using the supplied key as a reference.
252
- * For example, a chord symbol A# with reference key E will return the numeral chord #IV.
253
- * @param {Key|string|null} key the reference key. The key is required when converting a chord symbol
254
- * @returns {Chord} the numeral chord
255
- */
256
-
257
- }, {
258
- key: "toNumeral",
259
- value: function toNumeral() {
260
- var _this$bass5;
261
-
262
- var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
263
-
264
- if (this.isNumeral()) {
265
- return this.clone();
266
- }
267
-
268
- if (this.isNumeric()) {
269
- var _this$bass4;
270
-
271
- return this.set({
272
- root: this.root.toNumeral(),
273
- bass: (_this$bass4 = this.bass) === null || _this$bass4 === void 0 ? void 0 : _this$bass4.toNumeral()
274
- });
275
- }
276
-
277
- var keyObj = _key["default"].wrap(key);
278
-
279
- return new Chord({
280
- suffix: normalizeSuffix(this.suffix),
281
- root: this.root.toNumeral(keyObj),
282
- bass: (_this$bass5 = this.bass) === null || _this$bass5 === void 0 ? void 0 : _this$bass5.toNumeral(keyObj)
283
- });
284
- }
285
- /**
286
- * Converts the chord to a numeral chord string, using the supplied kye as a reference.
287
- * For example, a chord symbol A# with reference key E will return the numeral chord #4.
288
- * @param {Key|string} key the reference key
289
- * @returns {string} the numeral chord string
290
- * @see {toNumeral}
291
- */
292
-
293
- }, {
294
- key: "toNumeralString",
295
- value: function toNumeralString(key) {
296
- return this.toNumeral(key).toString();
297
- }
298
- /**
299
- * Determines whether the chord is numeric
300
- * @returns {boolean}
301
- */
302
-
303
- }, {
304
- key: "isNumeric",
305
- value: function isNumeric() {
306
- return _classPrivateMethodGet(this, _is, _is2).call(this, _constants.NUMERIC);
307
- }
308
- /**
309
- * Converts the chord to a numeric chord string, using the supplied kye as a reference.
310
- * For example, a chord symbol A# with reference key E will return the numeric chord #4.
311
- * @param {Key|string} key the reference key
312
- * @returns {string} the numeric chord string
313
- * @see {toNumeric}
314
- */
315
-
316
- }, {
317
- key: "toNumericString",
318
- value: function toNumericString(key) {
319
- return this.toNumeric(key).toString();
320
- }
321
- /**
322
- * Determines whether the chord is a numeral
323
- * @returns {boolean}
324
- */
325
-
326
- }, {
327
- key: "isNumeral",
328
- value: function isNumeral() {
329
- return _classPrivateMethodGet(this, _is, _is2).call(this, _constants.NUMERAL);
330
- }
331
- /**
332
- * Converts the chord to a string, eg `Esus4/G#` or `1sus4/#3`
333
- * @returns {string} the chord string
334
- */
335
-
336
- }, {
337
- key: "toString",
338
- value: function toString() {
339
- var chordString = this.root.toString() + (this.suffix || '');
340
-
341
- if (this.bass) {
342
- return "".concat(chordString, "/").concat(this.bass.toString());
343
- }
344
-
345
- return chordString;
346
- }
347
- /**
348
- * Normalizes the chord root and bass notes:
349
- * - Fb becomes E
350
- * - Cb becomes B
351
- * - B# becomes C
352
- * - E# becomes F
353
- * - 4b becomes 3
354
- * - 1b becomes 7
355
- * - 7# becomes 1
356
- * - 3# becomes 4
357
- *
358
- * Besides that it normalizes the suffix. For example, `sus2` becomes `2`, `sus4` becomes `sus`.
359
- * All suffix normalizations can be found in `src/normalize_mappings/suffix-mapping.txt`.
360
- *
361
- * @returns {Chord} the normalized chord
362
- */
363
-
364
- }, {
365
- key: "normalize",
366
- value: function normalize(key) {
367
- if (!(0, _utilities.presence)(key)) {
368
- return _classPrivateMethodGet(this, _process, _process2).call(this, 'normalize').set({
369
- suffix: (0, _utilities.presence)(normalizeSuffix(this.suffix))
370
- });
371
- }
372
-
373
- return this.set({
374
- root: this.root.normalizeEnharmonics(key),
375
- suffix: (0, _utilities.presence)(normalizeSuffix(this.suffix)),
376
- bass: this.bass ? this.bass.normalizeEnharmonics(this.root.toString()) : null
377
- });
378
- }
379
- /**
380
- * Switches to the specified modifier
381
- * @param newModifier the modifier to use: `'#'` or `'b'`
382
- * @returns {Chord} the new, changed chord
383
- */
384
-
385
- }, {
386
- key: "useModifier",
387
- value: function useModifier(newModifier) {
388
- return _classPrivateMethodGet(this, _process, _process2).call(this, 'useModifier', newModifier);
389
- }
390
- /**
391
- * Transposes the chord up by 1 semitone. Eg. A becomes A#, Eb becomes E
392
- * @returns {Chord} the new, transposed chord
393
- */
394
-
395
- }, {
396
- key: "transposeUp",
397
- value: function transposeUp() {
398
- return _classPrivateMethodGet(this, _process, _process2).call(this, 'transposeUp');
399
- }
400
- /**
401
- * Transposes the chord down by 1 semitone. Eg. A# becomes A, E becomes Eb
402
- * @returns {Chord} the new, transposed chord
403
- */
404
-
405
- }, {
406
- key: "transposeDown",
407
- value: function transposeDown() {
408
- return _classPrivateMethodGet(this, _process, _process2).call(this, 'transposeDown');
409
- }
410
- /**
411
- * Transposes the chord by the specified number of semitones
412
- * @param delta de number of semitones
413
- * @returns {Chord} the new, transposed chord
414
- */
415
-
416
- }, {
417
- key: "transpose",
418
- value: function transpose(delta) {
419
- return _classPrivateMethodGet(this, _process, _process2).call(this, 'transpose', delta);
420
- }
421
- }, {
422
- key: "makeMinor",
423
- value: function makeMinor() {
424
- if (!this.suffix || this.suffix[0] !== 'm') {
425
- return this.set({
426
- suffix: "m".concat(this.suffix || '')
427
- });
428
- }
429
-
430
- return this.clone();
431
- }
432
- }, {
433
- key: "set",
434
- value: function set(properties) {
435
- var _this$bass6;
436
-
437
- return new this.constructor(_objectSpread({
438
- root: this.root.clone(),
439
- suffix: this.suffix,
440
- bass: (_this$bass6 = this.bass) === null || _this$bass6 === void 0 ? void 0 : _this$bass6.clone()
441
- }, properties));
442
- }
443
- }], [{
444
- key: "parse",
445
- value:
446
- /**
447
- * Tries to parse a chord string into a chord
448
- * @param chordString the chord string, eg `Esus4/G#` or `1sus4/#3`
449
- * @returns {null|Chord}
450
- */
451
- function parse(chordString) {
452
- for (var i = 0, count = regexes.length; i < count; i += 1) {
453
- var match = chordString.match(regexes[i]);
454
-
455
- if (match) {
456
- return new Chord(match.groups);
457
- }
458
- }
459
-
460
- return null;
461
- }
462
- }]);
463
-
464
- return Chord;
465
- }();
466
- /**
467
- * Tries to parse a chord string into a chord
468
- * @param chordString the chord string, eg Esus4/G# or 1sus4/#3
469
- * @deprecated Please use {@link Chord.parse} instead
470
- * @returns {null|Chord}
471
- */
472
-
473
-
474
- function _get_rootNote() {
475
- return this.root.note.note;
476
- }
477
-
478
- function _process2(func) {
479
- var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
480
- return this.set({
481
- root: this.root[func](arg),
482
- bass: this.bass ? this.bass[func](arg) : null
483
- });
484
- }
485
-
486
- function _is2(type) {
487
- return this.root.is(type) && (!this.bass || this.bass.is(type));
488
- }
489
-
490
- function parseChord(chordString) {
491
- (0, _utilities.deprecate)('parseChord() is deprecated, please use Chord.parse() instead');
492
- return Chord.parse(chordString);
493
- }
494
-
495
- var _default = Chord;
496
- exports["default"] = _default;
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
-
10
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
-
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
-
14
- /**
15
- * Represents a chord with the corresponding (partial) lyrics
16
- */
17
- var ChordLyricsPair = /*#__PURE__*/function () {
18
- /**
19
- * Initialises a ChordLyricsPair
20
- * @param {string} chords The chords
21
- * @param {string} lyrics The lyrics
22
- */
23
- function ChordLyricsPair() {
24
- var chords = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
25
- var lyrics = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
26
-
27
- _classCallCheck(this, ChordLyricsPair);
28
-
29
- /**
30
- * The chords
31
- * @member
32
- * @type {string}
33
- */
34
- this.chords = chords || '';
35
- /**
36
- * The lyrics
37
- * @member
38
- * @type {string}
39
- */
40
-
41
- this.lyrics = lyrics || '';
42
- }
43
- /**
44
- * Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets)
45
- * @returns {boolean}
46
- */
47
-
48
-
49
- _createClass(ChordLyricsPair, [{
50
- key: "isRenderable",
51
- value: function isRenderable() {
52
- return true;
53
- }
54
- /**
55
- * Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song
56
- * @returns {ChordLyricsPair}
57
- */
58
-
59
- }, {
60
- key: "clone",
61
- value: function clone() {
62
- return new ChordLyricsPair(this.chords, this.lyrics);
63
- }
64
- }, {
65
- key: "toString",
66
- value: function toString() {
67
- return "ChordLyricsPair(chords=".concat(this.chords, ", lyrics=").concat(this.lyrics, ")");
68
- }
69
- }]);
70
-
71
- return ChordLyricsPair;
72
- }();
73
-
74
- var _default = ChordLyricsPair;
75
- exports["default"] = _default;
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
-
10
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
-
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
-
14
- var Composite = /*#__PURE__*/function () {
15
- function Composite(expressions) {
16
- var variable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
17
-
18
- _classCallCheck(this, Composite);
19
-
20
- this.expressions = expressions;
21
- this.variable = variable;
22
- }
23
-
24
- _createClass(Composite, [{
25
- key: "evaluate",
26
- value: function evaluate(metadata) {
27
- var _this = this;
28
-
29
- return this.expressions.map(function (expression) {
30
- return expression.evaluate(metadata, _this.variable);
31
- }).join('');
32
- }
33
- }, {
34
- key: "isRenderable",
35
- value: function isRenderable() {
36
- return true;
37
- }
38
- }, {
39
- key: "clone",
40
- value: function clone() {
41
- return new Composite({
42
- expressions: this.expressions.map(function (expression) {
43
- return expression.clone();
44
- }),
45
- variable: this.variable
46
- });
47
- }
48
- }]);
49
-
50
- return Composite;
51
- }();
52
-
53
- var _default = Composite;
54
- exports["default"] = _default;
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
-
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
-
14
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
-
16
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
-
18
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
-
20
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
21
-
22
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
23
-
24
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
25
-
26
- function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
27
-
28
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
-
30
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
31
-
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
-
34
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
-
36
- var EvaluationError = /*#__PURE__*/function (_Error) {
37
- _inherits(EvaluationError, _Error);
38
-
39
- var _super = _createSuper(EvaluationError);
40
-
41
- function EvaluationError(message, line, column, offset) {
42
- var _this;
43
-
44
- _classCallCheck(this, EvaluationError);
45
-
46
- _this = _super.call(this, "".concat(message, " on line ").concat(line, " column ").concat(column));
47
- _this.name = 'ExpressionError';
48
- _this.line = line;
49
- _this.column = column;
50
- _this.offset = offset;
51
- return _this;
52
- }
53
-
54
- return _createClass(EvaluationError);
55
- }( /*#__PURE__*/_wrapNativeSuper(Error));
56
-
57
- var _default = EvaluationError;
58
- exports["default"] = _default;