chordsheetjs 4.8.1 → 5.1.2

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;
@@ -9,17 +9,17 @@ exports["default"] = void 0;
9
9
 
10
10
  var _line = _interopRequireDefault(require("./line"));
11
11
 
12
- var _tag = _interopRequireWildcard(require("./tag"));
13
-
14
12
  var _paragraph = _interopRequireDefault(require("./paragraph"));
15
13
 
16
14
  var _utilities = require("../utilities");
17
15
 
18
16
  var _metadata = _interopRequireDefault(require("./metadata"));
19
17
 
18
+ var _parser_warning = _interopRequireDefault(require("../parser/parser_warning"));
19
+
20
20
  var _constants = require("../constants");
21
21
 
22
- var _parser_warning = _interopRequireDefault(require("../parser/parser_warning"));
22
+ var _tag = _interopRequireWildcard(require("./tag"));
23
23
 
24
24
  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); }
25
25
 
@@ -82,6 +82,7 @@ var Song = /*#__PURE__*/function () {
82
82
  this.currentParagraph = null;
83
83
  this.warnings = [];
84
84
  this.sectionType = _constants.NONE;
85
+ this.currentKey = null;
85
86
  }
86
87
 
87
88
  _createClass(Song, [{
@@ -150,6 +151,7 @@ var Song = /*#__PURE__*/function () {
150
151
  this.flushLine();
151
152
  this.currentLine = (0, _utilities.pushNew)(this.lines, _line["default"]);
152
153
  this.setCurrentLineType(this.sectionType);
154
+ this.currentLine.key = this.currentKey;
153
155
  return this.currentLine;
154
156
  }
155
157
  }, {
@@ -208,6 +210,8 @@ var Song = /*#__PURE__*/function () {
208
210
 
209
211
  if (tag.isMetaTag()) {
210
212
  this.setMetaData(tag.name, tag.value);
213
+ } else if (tag.name === _tag.TRANSPOSE) {
214
+ this.currentKey = tag.value;
211
215
  } else {
212
216
  this.setSectionTypeFromTag(tag);
213
217
  }
@@ -228,6 +232,14 @@ var Song = /*#__PURE__*/function () {
228
232
  this.endSection(_constants.CHORUS, tag);
229
233
  break;
230
234
 
235
+ case _tag.START_OF_TAB:
236
+ this.startSection(_constants.TAB, tag);
237
+ break;
238
+
239
+ case _tag.END_OF_TAB:
240
+ this.endSection(_constants.TAB, tag);
241
+ break;
242
+
231
243
  case _tag.START_OF_VERSE:
232
244
  this.startSection(_constants.VERSE, tag);
233
245
  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.TRANSPOSE = 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/
@@ -141,11 +155,18 @@ var TIME = 'time';
141
155
  exports.TIME = TIME;
142
156
  var TITLE = 'title';
143
157
  /**
144
- * Year meta directive. See https://www.chordpro.org/chordpro/directives-year/
158
+ * Transpose meta directive. See: https://www.chordpro.org/chordpro/directives-transpose/
145
159
  * @type {string}
146
160
  */
147
161
 
148
162
  exports.TITLE = TITLE;
163
+ var TRANSPOSE = 'transpose';
164
+ /**
165
+ * Year meta directive. See https://www.chordpro.org/chordpro/directives-year/
166
+ * @type {string}
167
+ */
168
+
169
+ exports.TRANSPOSE = TRANSPOSE;
149
170
  var YEAR = 'year';
150
171
  exports.YEAR = YEAR;
151
172
  var TITLE_SHORT = 't';
@@ -153,12 +174,14 @@ var SUBTITLE_SHORT = 'st';
153
174
  var COMMENT_SHORT = 'c';
154
175
  var START_OF_CHORUS_SHORT = 'soc';
155
176
  var END_OF_CHORUS_SHORT = 'eoc';
177
+ var START_OF_TAB_SHORT = 'sot';
178
+ var END_OF_TAB_SHORT = 'eot';
156
179
  var RENDERABLE_TAGS = [COMMENT];
157
180
  var META_TAGS = [ALBUM, ARTIST, CAPO, COMPOSER, COPYRIGHT, DURATION, KEY, LYRICIST, TEMPO, TIME, TITLE, SUBTITLE, YEAR];
158
181
  exports.META_TAGS = META_TAGS;
159
182
  var READ_ONLY_TAGS = [_KEY];
160
183
  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);
184
+ 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
185
  var META_TAG_REGEX = /^meta:\s*([^:\s]+)(\s*(.+))?$/;
163
186
  var TAG_REGEX = /^([^:\s]+)(:?\s*(.+))?$/;
164
187
  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;
@@ -30,7 +30,8 @@ var HtmlFormatter = /*#__PURE__*/function () {
30
30
  bodyParagraphs: true,
31
31
  subtitle: true,
32
32
  title: true,
33
- value: true
33
+ value: true,
34
+ key: true
34
35
  }
35
36
  });
36
37
  }