chordsheetjs 4.8.0 → 5.0.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/chord.js CHANGED
@@ -1,9 +1,20 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
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 _constants = require("./constants");
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7
18
 
8
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9
20
 
@@ -17,62 +28,357 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
17
28
 
18
29
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
19
30
 
31
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
32
+
33
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
34
+
35
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
36
+
37
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
38
+
39
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
40
+
41
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
42
+
43
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
44
+
45
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
46
+
47
+ 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
48
+
49
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
50
+
51
+ var MAJOR_SCALE = [null, 'M', 'm', 'm', 'M', 'M', 'm', 'dim'];
52
+
53
+ function normalizeSuffix(suffix) {
54
+ if (suffix === 'M') {
55
+ return '';
56
+ }
57
+
58
+ return suffix;
59
+ }
60
+
61
+ function chordSuffix(noteNumber, suffix) {
62
+ if ((0, _utilities.isEmptyString)(suffix)) {
63
+ var defaultSuffix = MAJOR_SCALE[noteNumber];
64
+ return normalizeSuffix(defaultSuffix);
65
+ }
66
+
67
+ return normalizeSuffix(suffix);
68
+ }
69
+
70
+ 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, {
71
+ base: 1,
72
+ modifier: 2,
73
+ suffix: 3,
74
+ bassBase: 5,
75
+ bassModifier: 6
76
+ });
77
+
78
+ var numericChordRegex = /*#__PURE__*/_wrapRegExp(/^(#|b)?([1-7])((?:(?![\t-\r \/\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])[\s\S])*)(\/(#|b)?([0-7]))?$/, {
79
+ modifier: 1,
80
+ base: 2,
81
+ suffix: 3,
82
+ bassModifier: 5,
83
+ bassBase: 6
84
+ });
85
+
86
+ var regexes = [numericChordRegex, chordRegex];
20
87
  /**
21
- * Base class for {@link ChordSymbol} and {@link NumericChord}
88
+ * Represents a Chord, consisting of a root, suffix (quality) and bass
22
89
  */
90
+
91
+ var _rootNote = /*#__PURE__*/new WeakMap();
92
+
93
+ var _process = /*#__PURE__*/new WeakSet();
94
+
95
+ var _is = /*#__PURE__*/new WeakSet();
96
+
23
97
  var Chord = /*#__PURE__*/function () {
24
98
  function Chord(_ref) {
25
- var base = _ref.base,
26
- modifier = _ref.modifier,
27
- suffix = _ref.suffix,
28
- bassBase = _ref.bassBase,
29
- bassModifier = _ref.bassModifier;
99
+ var _ref$base = _ref.base,
100
+ base = _ref$base === void 0 ? null : _ref$base,
101
+ _ref$modifier = _ref.modifier,
102
+ modifier = _ref$modifier === void 0 ? null : _ref$modifier,
103
+ _ref$suffix = _ref.suffix,
104
+ suffix = _ref$suffix === void 0 ? null : _ref$suffix,
105
+ _ref$bassBase = _ref.bassBase,
106
+ bassBase = _ref$bassBase === void 0 ? null : _ref$bassBase,
107
+ _ref$bassModifier = _ref.bassModifier,
108
+ bassModifier = _ref$bassModifier === void 0 ? null : _ref$bassModifier,
109
+ _ref$root = _ref.root,
110
+ root = _ref$root === void 0 ? null : _ref$root,
111
+ _ref$bass = _ref.bass,
112
+ bass = _ref$bass === void 0 ? null : _ref$bass;
30
113
 
31
114
  _classCallCheck(this, Chord);
32
115
 
33
- this.base = base || null;
34
- this.modifier = modifier || null;
35
- this.suffix = suffix || null;
36
- this.bassBase = bassBase || null;
37
- this.bassModifier = bassModifier || null;
38
- }
39
- /**
40
- * Returns a deep copy of the chord
41
- * @returns {Chord}
42
- */
116
+ _classPrivateMethodInitSpec(this, _is);
117
+
118
+ _classPrivateMethodInitSpec(this, _process);
43
119
 
120
+ _classPrivateFieldInitSpec(this, _rootNote, {
121
+ get: _get_rootNote,
122
+ set: void 0
123
+ });
124
+
125
+ this.root = root || new _key["default"]({
126
+ note: base,
127
+ modifier: modifier
128
+ });
129
+ this.suffix = (0, _utilities.presence)(suffix);
130
+ this.bass = bass || (bassBase ? new _key["default"]({
131
+ note: bassBase,
132
+ modifier: bassModifier
133
+ }) : null);
134
+ }
44
135
 
45
136
  _createClass(Chord, [{
46
137
  key: "clone",
47
- value: function clone() {
48
- var base = this.base,
49
- modifier = this.modifier,
50
- suffix = this.suffix,
51
- bassBase = this.bassBase,
52
- bassModifier = this.bassModifier;
53
- return new this.constructor({
54
- base: base,
55
- modifier: modifier,
56
- suffix: suffix,
57
- bassBase: bassBase,
58
- bassModifier: bassModifier
138
+ value:
139
+ /**
140
+ * Returns a deep copy of the chord
141
+ * @returns {Chord}
142
+ */
143
+ function clone() {
144
+ return this.set({});
145
+ }
146
+ /**
147
+ * Converts the chord to a chord symbol, using the supplied key as a reference.
148
+ * For example, a numeric chord `#4` with reference key `E` will return the chord symbol `A#`.
149
+ * When the chord is already a chord symbol, it will return a clone of the object.
150
+ * @param {Key|string} key the reference key
151
+ * @returns {Chord} the chord symbol
152
+ */
153
+
154
+ }, {
155
+ key: "toChordSymbol",
156
+ value: function toChordSymbol(key) {
157
+ var _this$bass;
158
+
159
+ if (this.isChordSymbol()) {
160
+ return this.clone();
161
+ }
162
+
163
+ var keyObj = _key["default"].wrap(key);
164
+
165
+ return new Chord({
166
+ suffix: chordSuffix(_classPrivateFieldGet(this, _rootNote), this.suffix),
167
+ root: this.root.toChordSymbol(keyObj),
168
+ bass: (_this$bass = this.bass) === null || _this$bass === void 0 ? void 0 : _this$bass.toChordSymbol(keyObj)
169
+ });
170
+ }
171
+ /**
172
+ * Converts the chord to a chord symbol string, using the supplied key as a reference.
173
+ * For example, a numeric chord `#4` with reference key `E` will return the chord symbol `A#`.
174
+ * When the chord is already a chord symbol, it will return a string version of the chord.
175
+ * @param {Key|string} key the reference key
176
+ * @returns {string} the chord symbol string
177
+ * @see {toChordSymbol}
178
+ */
179
+
180
+ }, {
181
+ key: "toChordSymbolString",
182
+ value: function toChordSymbolString(key) {
183
+ return this.toChordSymbol(key).toString();
184
+ }
185
+ /**
186
+ * Determines whether the chord is a chord symbol
187
+ * @returns {boolean}
188
+ */
189
+
190
+ }, {
191
+ key: "isChordSymbol",
192
+ value: function isChordSymbol() {
193
+ return _classPrivateMethodGet(this, _is, _is2).call(this, _constants.SYMBOL);
194
+ }
195
+ /**
196
+ * Converts the chord to a numeric chord, using the supplied kye as a reference.
197
+ * For example, a chord symbol A# with reference key E will return the numeric chord #4.
198
+ * @param {Key|string} key the reference key
199
+ * @returns {Chord} the numeric chord
200
+ */
201
+
202
+ }, {
203
+ key: "toNumeric",
204
+ value: function toNumeric(key) {
205
+ var _this$bass2;
206
+
207
+ if (this.isNumeric()) {
208
+ return this.clone();
209
+ }
210
+
211
+ var keyObj = _key["default"].wrap(key);
212
+
213
+ return new Chord({
214
+ suffix: chordSuffix(_classPrivateFieldGet(this, _rootNote), this.suffix),
215
+ root: this.root.toNumeric(keyObj),
216
+ bass: (_this$bass2 = this.bass) === null || _this$bass2 === void 0 ? void 0 : _this$bass2.toNumeric(keyObj)
59
217
  });
60
218
  }
219
+ /**
220
+ * Determines whether the chord is numeric
221
+ * @returns {boolean}
222
+ */
223
+
224
+ }, {
225
+ key: "isNumeric",
226
+ value: function isNumeric() {
227
+ return _classPrivateMethodGet(this, _is, _is2).call(this, _constants.NUMERIC);
228
+ }
229
+ /**
230
+ * Converts the chord to a numeric chord string, using the supplied kye as a reference.
231
+ * For example, a chord symbol A# with reference key E will return the numeric chord #4.
232
+ * @param {Key|string} key the reference key
233
+ * @returns {string} the numeric chord string
234
+ * @see {toNumeric}
235
+ */
236
+
237
+ }, {
238
+ key: "toNumericString",
239
+ value: function toNumericString(key) {
240
+ return this.toNumeric(key).toString();
241
+ }
242
+ /**
243
+ * Converts the chord to a string, eg `Esus4/G#` or `1sus4/#3`
244
+ * @returns {string} the chord string
245
+ */
246
+
247
+ }, {
248
+ key: "toString",
249
+ value: function toString() {
250
+ var chordString = this.root.toString() + (this.suffix || '');
251
+
252
+ if (this.bass) {
253
+ return "".concat(chordString, "/").concat(this.bass.toString());
254
+ }
255
+
256
+ return chordString;
257
+ }
258
+ /**
259
+ * Normalizes the chord:
260
+ * - Fb becomes E
261
+ * - Cb becomes B
262
+ * - B# becomes C
263
+ * - E# becomes F
264
+ * - 4b becomes 3
265
+ * - 1b becomes 7
266
+ * - 7# becomes 1
267
+ * - 3# becomes 4
268
+ *
269
+ * If the chord is already normalized, this will return a copy.
270
+ * @returns {Chord} the normalized chord
271
+ */
272
+
273
+ }, {
274
+ key: "normalize",
275
+ value: function normalize() {
276
+ return _classPrivateMethodGet(this, _process, _process2).call(this, 'normalize');
277
+ }
278
+ /**
279
+ * Switches to the specified modifier
280
+ * @param newModifier the modifier to use: `'#'` or `'b'`
281
+ * @returns {Chord} the new, changed chord
282
+ */
283
+
284
+ }, {
285
+ key: "useModifier",
286
+ value: function useModifier(newModifier) {
287
+ return _classPrivateMethodGet(this, _process, _process2).call(this, 'useModifier', newModifier);
288
+ }
289
+ /**
290
+ * Transposes the chord up by 1 semitone. Eg. A becomes A#, Eb becomes E
291
+ * @returns {Chord} the new, transposed chord
292
+ */
293
+
294
+ }, {
295
+ key: "transposeUp",
296
+ value: function transposeUp() {
297
+ return _classPrivateMethodGet(this, _process, _process2).call(this, 'transposeUp');
298
+ }
299
+ /**
300
+ * Transposes the chord down by 1 semitone. Eg. A# becomes A, E becomes Eb
301
+ * @returns {Chord} the new, transposed chord
302
+ */
303
+
304
+ }, {
305
+ key: "transposeDown",
306
+ value: function transposeDown() {
307
+ return _classPrivateMethodGet(this, _process, _process2).call(this, 'transposeDown');
308
+ }
309
+ /**
310
+ * Transposes the chord by the specified number of semitones
311
+ * @param delta de number of semitones
312
+ * @returns {Chord} the new, transposed chord
313
+ */
314
+
315
+ }, {
316
+ key: "transpose",
317
+ value: function transpose(delta) {
318
+ return _classPrivateMethodGet(this, _process, _process2).call(this, 'transpose', delta);
319
+ }
61
320
  }, {
62
321
  key: "set",
63
322
  value: function set(properties) {
323
+ var _this$bass3;
324
+
64
325
  return new this.constructor(_objectSpread({
65
- base: this.base,
66
- modifier: this.modifier,
326
+ root: this.root.clone(),
67
327
  suffix: this.suffix,
68
- bassBase: this.bassBase,
69
- bassModifier: this.bassModifier
328
+ bass: (_this$bass3 = this.bass) === null || _this$bass3 === void 0 ? void 0 : _this$bass3.clone()
70
329
  }, properties));
71
330
  }
331
+ }], [{
332
+ key: "parse",
333
+ value:
334
+ /**
335
+ * Tries to parse a chord string into a chord
336
+ * @param chordString the chord string, eg `Esus4/G#` or `1sus4/#3`
337
+ * @returns {null|Chord}
338
+ */
339
+ function parse(chordString) {
340
+ for (var i = 0, count = regexes.length; i < count; i += 1) {
341
+ var match = chordString.match(regexes[i]);
342
+
343
+ if (match) {
344
+ return new Chord(match.groups);
345
+ }
346
+ }
347
+
348
+ return null;
349
+ }
72
350
  }]);
73
351
 
74
352
  return Chord;
75
353
  }();
354
+ /**
355
+ * Tries to parse a chord string into a chord
356
+ * @param chordString the chord string, eg Esus4/G# or 1sus4/#3
357
+ * @deprecated Please use {@link Chord.parse} instead
358
+ * @returns {null|Chord}
359
+ */
360
+
361
+
362
+ function _get_rootNote() {
363
+ return this.root.note.note;
364
+ }
365
+
366
+ function _process2(func) {
367
+ var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
368
+ return this.set({
369
+ root: this.root[func](arg),
370
+ bass: this.bass ? this.bass[func](arg) : null
371
+ });
372
+ }
373
+
374
+ function _is2(type) {
375
+ return this.root.is(type) && (!this.bass || this.bass.is(type));
376
+ }
377
+
378
+ function parseChord(chordString) {
379
+ (0, _utilities.deprecate)('parseChord() is deprecated, please use Chord.parse() instead');
380
+ return Chord.parse(chordString);
381
+ }
76
382
 
77
383
  var _default = Chord;
78
384
  exports["default"] = _default;
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
 
8
- var _parse_chord = _interopRequireDefault(require("../parse_chord"));
9
-
10
8
  var _tag = require("./tag");
11
9
 
10
+ var _chord = _interopRequireDefault(require("../chord"));
11
+
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
13
 
14
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -188,7 +188,7 @@ var Metadata = /*#__PURE__*/function () {
188
188
  var key = this.get(_tag.KEY);
189
189
 
190
190
  if (capo && key) {
191
- return (0, _parse_chord["default"])(key).transpose(parseInt(capo, 10)).toString();
191
+ return _chord["default"].parse(key).transpose(parseInt(capo, 10)).toString();
192
192
  }
193
193
 
194
194
  return undefined;
@@ -228,6 +228,14 @@ var Song = /*#__PURE__*/function () {
228
228
  this.endSection(_constants.CHORUS, tag);
229
229
  break;
230
230
 
231
+ case _tag.START_OF_TAB:
232
+ this.startSection(_constants.TAB, tag);
233
+ break;
234
+
235
+ case _tag.END_OF_TAB:
236
+ this.endSection(_constants.TAB, tag);
237
+ break;
238
+
231
239
  case _tag.START_OF_VERSE:
232
240
  this.startSection(_constants.VERSE, tag);
233
241
  break;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports._KEY = exports.YEAR = exports.TITLE = exports.TIME = exports.TEMPO = exports.SUBTITLE = exports.START_OF_VERSE = exports.START_OF_CHORUS = exports.READ_ONLY_TAGS = exports.META_TAGS = exports.LYRICIST = exports.KEY = exports.END_OF_VERSE = exports.END_OF_CHORUS = exports.DURATION = exports.COPYRIGHT = exports.COMPOSER = exports.COMMENT = exports.CAPO = exports.ARTIST = exports.ALBUM = void 0;
6
+ exports["default"] = exports._KEY = exports.YEAR = exports.TITLE = exports.TIME = exports.TEMPO = exports.SUBTITLE = exports.START_OF_VERSE = exports.START_OF_TAB = exports.START_OF_CHORUS = exports.READ_ONLY_TAGS = exports.META_TAGS = exports.LYRICIST = exports.KEY = exports.END_OF_VERSE = exports.END_OF_TAB = exports.END_OF_CHORUS = exports.DURATION = exports.COPYRIGHT = exports.COMPOSER = exports.COMMENT = exports.CAPO = exports.ARTIST = exports.ALBUM = void 0;
7
7
  exports.isReadonlyTag = isReadonlyTag;
8
8
 
9
9
  var _ALIASES;
@@ -71,11 +71,18 @@ var DURATION = 'duration';
71
71
  exports.DURATION = DURATION;
72
72
  var END_OF_CHORUS = 'end_of_chorus';
73
73
  /**
74
- * End of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/
74
+ * End of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/
75
75
  * @type {string}
76
76
  */
77
77
 
78
78
  exports.END_OF_CHORUS = END_OF_CHORUS;
79
+ var END_OF_TAB = 'end_of_tab';
80
+ /**
81
+ * End of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/
82
+ * @type {string}
83
+ */
84
+
85
+ exports.END_OF_TAB = END_OF_TAB;
79
86
  var END_OF_VERSE = 'end_of_verse';
80
87
  /**
81
88
  * Key meta directive. See https://www.chordpro.org/chordpro/directives-key/
@@ -106,11 +113,18 @@ var LYRICIST = 'lyricist';
106
113
  exports.LYRICIST = LYRICIST;
107
114
  var START_OF_CHORUS = 'start_of_chorus';
108
115
  /**
109
- * Start of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/
116
+ * Start of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/
110
117
  * @type {string}
111
118
  */
112
119
 
113
120
  exports.START_OF_CHORUS = START_OF_CHORUS;
121
+ var START_OF_TAB = 'start_of_tab';
122
+ /**
123
+ * Start of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/
124
+ * @type {string}
125
+ */
126
+
127
+ exports.START_OF_TAB = START_OF_TAB;
114
128
  var START_OF_VERSE = 'start_of_verse';
115
129
  /**
116
130
  * Subtitle meta directive. See https://www.chordpro.org/chordpro/directives-subtitle/
@@ -153,12 +167,14 @@ var SUBTITLE_SHORT = 'st';
153
167
  var COMMENT_SHORT = 'c';
154
168
  var START_OF_CHORUS_SHORT = 'soc';
155
169
  var END_OF_CHORUS_SHORT = 'eoc';
170
+ var START_OF_TAB_SHORT = 'sot';
171
+ var END_OF_TAB_SHORT = 'eot';
156
172
  var RENDERABLE_TAGS = [COMMENT];
157
173
  var META_TAGS = [ALBUM, ARTIST, CAPO, COMPOSER, COPYRIGHT, DURATION, KEY, LYRICIST, TEMPO, TIME, TITLE, SUBTITLE, YEAR];
158
174
  exports.META_TAGS = META_TAGS;
159
175
  var READ_ONLY_TAGS = [_KEY];
160
176
  exports.READ_ONLY_TAGS = READ_ONLY_TAGS;
161
- var ALIASES = (_ALIASES = {}, _defineProperty(_ALIASES, TITLE_SHORT, TITLE), _defineProperty(_ALIASES, SUBTITLE_SHORT, SUBTITLE), _defineProperty(_ALIASES, COMMENT_SHORT, COMMENT), _defineProperty(_ALIASES, START_OF_CHORUS_SHORT, START_OF_CHORUS), _defineProperty(_ALIASES, END_OF_CHORUS_SHORT, END_OF_CHORUS), _ALIASES);
177
+ var ALIASES = (_ALIASES = {}, _defineProperty(_ALIASES, TITLE_SHORT, TITLE), _defineProperty(_ALIASES, SUBTITLE_SHORT, SUBTITLE), _defineProperty(_ALIASES, COMMENT_SHORT, COMMENT), _defineProperty(_ALIASES, START_OF_CHORUS_SHORT, START_OF_CHORUS), _defineProperty(_ALIASES, END_OF_CHORUS_SHORT, END_OF_CHORUS), _defineProperty(_ALIASES, START_OF_TAB_SHORT, START_OF_TAB), _defineProperty(_ALIASES, END_OF_TAB_SHORT, END_OF_TAB), _ALIASES);
162
178
  var META_TAG_REGEX = /^meta:\s*([^:\s]+)(\s*(.+))?$/;
163
179
  var TAG_REGEX = /^([^:\s]+)(:?\s*(.+))?$/;
164
180
  var CUSTOM_META_TAG_NAME_REGEX = /^x_(.+)$/;
package/lib/constants.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VERSE = exports.NONE = exports.INDETERMINATE = exports.CHORUS = void 0;
6
+ exports.VERSE = exports.TAB = exports.SYMBOL = exports.NUMERIC = exports.NONE = exports.INDETERMINATE = exports.CHORUS = void 0;
7
7
 
8
8
  /**
9
9
  * Used to mark a paragraph as verse
@@ -35,4 +35,16 @@ var NONE = 'none';
35
35
 
36
36
  exports.NONE = NONE;
37
37
  var INDETERMINATE = 'indeterminate';
38
- exports.INDETERMINATE = INDETERMINATE;
38
+ /**
39
+ * Used to mark a paragraph as tab
40
+ * @constant
41
+ * @type {string}
42
+ */
43
+
44
+ exports.INDETERMINATE = INDETERMINATE;
45
+ var TAB = 'tab';
46
+ exports.TAB = TAB;
47
+ var SYMBOL = 'symbol';
48
+ exports.SYMBOL = SYMBOL;
49
+ var NUMERIC = 'numeric';
50
+ exports.NUMERIC = NUMERIC;
package/lib/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -75,6 +77,12 @@ Object.defineProperty(exports, "INDETERMINATE", {
75
77
  return _constants.INDETERMINATE;
76
78
  }
77
79
  });
80
+ Object.defineProperty(exports, "Key", {
81
+ enumerable: true,
82
+ get: function get() {
83
+ return _key["default"];
84
+ }
85
+ });
78
86
  Object.defineProperty(exports, "Line", {
79
87
  enumerable: true,
80
88
  get: function get() {
@@ -99,18 +107,36 @@ Object.defineProperty(exports, "NONE", {
99
107
  return _constants.NONE;
100
108
  }
101
109
  });
110
+ Object.defineProperty(exports, "NUMERIC", {
111
+ enumerable: true,
112
+ get: function get() {
113
+ return _constants.NUMERIC;
114
+ }
115
+ });
102
116
  Object.defineProperty(exports, "Paragraph", {
103
117
  enumerable: true,
104
118
  get: function get() {
105
119
  return _paragraph["default"];
106
120
  }
107
121
  });
122
+ Object.defineProperty(exports, "SYMBOL", {
123
+ enumerable: true,
124
+ get: function get() {
125
+ return _constants.SYMBOL;
126
+ }
127
+ });
108
128
  Object.defineProperty(exports, "Song", {
109
129
  enumerable: true,
110
130
  get: function get() {
111
131
  return _song["default"];
112
132
  }
113
133
  });
134
+ Object.defineProperty(exports, "TAB", {
135
+ enumerable: true,
136
+ get: function get() {
137
+ return _constants.TAB;
138
+ }
139
+ });
114
140
  Object.defineProperty(exports, "Tag", {
115
141
  enumerable: true,
116
142
  get: function get() {
@@ -145,13 +171,7 @@ exports["default"] = void 0;
145
171
  Object.defineProperty(exports, "parseChord", {
146
172
  enumerable: true,
147
173
  get: function get() {
148
- return _parse_chord["default"];
149
- }
150
- });
151
- Object.defineProperty(exports, "toChordSymbol", {
152
- enumerable: true,
153
- get: function get() {
154
- return _to_chord_symbol["default"];
174
+ return _chord.parseChord;
155
175
  }
156
176
  });
157
177
 
@@ -193,11 +213,13 @@ var _chord_sheet_serializer = _interopRequireDefault(require("./chord_sheet_seri
193
213
 
194
214
  var _constants = require("./constants");
195
215
 
196
- var _chord = _interopRequireDefault(require("./chord"));
216
+ var _chord = _interopRequireWildcard(require("./chord"));
217
+
218
+ var _key = _interopRequireDefault(require("./key"));
197
219
 
198
- var _parse_chord = _interopRequireDefault(require("./parse_chord"));
220
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
199
221
 
200
- var _to_chord_symbol = _interopRequireDefault(require("./to_chord_symbol"));
222
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
201
223
 
202
224
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
203
225
 
@@ -222,6 +244,7 @@ var _default = {
222
244
  ChordSheetSerializer: _chord_sheet_serializer["default"],
223
245
  CHORUS: _constants.CHORUS,
224
246
  INDETERMINATE: _constants.INDETERMINATE,
247
+ TAB: _constants.TAB,
225
248
  VERSE: _constants.VERSE,
226
249
  NONE: _constants.NONE
227
250
  };