notations 0.0.46 → 0.0.49

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 (113) hide show
  1. package/lib/cjs/beats.d.ts +34 -69
  2. package/lib/cjs/beats.js +178 -439
  3. package/lib/cjs/beats.js.map +1 -1
  4. package/lib/cjs/beatutils.d.ts +3 -0
  5. package/lib/cjs/beatutils.js +64 -0
  6. package/lib/cjs/beatutils.js.map +1 -0
  7. package/lib/cjs/beatview.d.ts +18 -0
  8. package/lib/cjs/beatview.js +62 -0
  9. package/lib/cjs/beatview.js.map +1 -0
  10. package/lib/cjs/carnatic/LineView.d.ts +2 -7
  11. package/lib/cjs/carnatic/LineView.js +13 -31
  12. package/lib/cjs/carnatic/LineView.js.map +1 -1
  13. package/lib/cjs/carnatic/NotationView.d.ts +8 -7
  14. package/lib/cjs/carnatic/NotationView.js +76 -153
  15. package/lib/cjs/carnatic/NotationView.js.map +1 -1
  16. package/lib/cjs/carnatic/atomviews.js +149 -287
  17. package/lib/cjs/carnatic/atomviews.js.map +1 -1
  18. package/lib/cjs/carnatic/beatviews.d.ts +4 -13
  19. package/lib/cjs/carnatic/beatviews.js +23 -118
  20. package/lib/cjs/carnatic/beatviews.js.map +1 -1
  21. package/lib/cjs/carnatic/embelishments.d.ts +1 -1
  22. package/lib/cjs/carnatic/embelishments.js +189 -283
  23. package/lib/cjs/carnatic/embelishments.js.map +1 -1
  24. package/lib/cjs/carnatic/gamakas.js +15 -47
  25. package/lib/cjs/carnatic/gamakas.js.map +1 -1
  26. package/lib/cjs/commands.js +111 -271
  27. package/lib/cjs/commands.js.map +1 -1
  28. package/lib/cjs/core.d.ts +14 -1
  29. package/lib/cjs/core.js +291 -477
  30. package/lib/cjs/core.js.map +1 -1
  31. package/lib/cjs/cycle.js +175 -367
  32. package/lib/cjs/cycle.js.map +1 -1
  33. package/lib/cjs/entity.js +48 -102
  34. package/lib/cjs/entity.js.map +1 -1
  35. package/lib/cjs/grids.d.ts +125 -0
  36. package/lib/cjs/grids.js +550 -0
  37. package/lib/cjs/grids.js.map +1 -0
  38. package/lib/cjs/iterators.js +96 -234
  39. package/lib/cjs/iterators.js.map +1 -1
  40. package/lib/cjs/layouts.d.ts +1 -1
  41. package/lib/cjs/layouts.js +62 -98
  42. package/lib/cjs/layouts.js.map +1 -1
  43. package/lib/cjs/loader.d.ts +2 -2
  44. package/lib/cjs/loader.js +23 -123
  45. package/lib/cjs/loader.js.map +1 -1
  46. package/lib/cjs/notation.d.ts +0 -3
  47. package/lib/cjs/notation.js +139 -241
  48. package/lib/cjs/notation.js.map +1 -1
  49. package/lib/cjs/parser.d.ts +2 -0
  50. package/lib/cjs/parser.js +225 -214
  51. package/lib/cjs/parser.js.map +1 -1
  52. package/lib/cjs/shapes.js +149 -283
  53. package/lib/cjs/shapes.js.map +1 -1
  54. package/lib/cjs/utils.d.ts +8 -0
  55. package/lib/cjs/utils.js +60 -55
  56. package/lib/cjs/utils.js.map +1 -1
  57. package/lib/esm/beats.d.ts +34 -69
  58. package/lib/esm/beats.js +172 -438
  59. package/lib/esm/beats.js.map +1 -1
  60. package/lib/esm/beatutils.d.ts +3 -0
  61. package/lib/esm/beatutils.js +37 -0
  62. package/lib/esm/beatutils.js.map +1 -0
  63. package/lib/esm/beatview.d.ts +18 -0
  64. package/lib/esm/beatview.js +35 -0
  65. package/lib/esm/beatview.js.map +1 -0
  66. package/lib/esm/carnatic/LineView.d.ts +2 -7
  67. package/lib/esm/carnatic/LineView.js +12 -31
  68. package/lib/esm/carnatic/LineView.js.map +1 -1
  69. package/lib/esm/carnatic/NotationView.d.ts +8 -7
  70. package/lib/esm/carnatic/NotationView.js +74 -152
  71. package/lib/esm/carnatic/NotationView.js.map +1 -1
  72. package/lib/esm/carnatic/atomviews.js +144 -284
  73. package/lib/esm/carnatic/atomviews.js.map +1 -1
  74. package/lib/esm/carnatic/beatviews.d.ts +4 -13
  75. package/lib/esm/carnatic/beatviews.js +21 -94
  76. package/lib/esm/carnatic/beatviews.js.map +1 -1
  77. package/lib/esm/carnatic/embelishments.d.ts +1 -1
  78. package/lib/esm/carnatic/embelishments.js +187 -296
  79. package/lib/esm/carnatic/embelishments.js.map +1 -1
  80. package/lib/esm/carnatic/gamakas.js +14 -48
  81. package/lib/esm/carnatic/gamakas.js.map +1 -1
  82. package/lib/esm/commands.js +100 -271
  83. package/lib/esm/commands.js.map +1 -1
  84. package/lib/esm/core.d.ts +14 -1
  85. package/lib/esm/core.js +287 -484
  86. package/lib/esm/core.js.map +1 -1
  87. package/lib/esm/cycle.js +172 -367
  88. package/lib/esm/cycle.js.map +1 -1
  89. package/lib/esm/entity.js +48 -104
  90. package/lib/esm/entity.js.map +1 -1
  91. package/lib/esm/grids.d.ts +125 -0
  92. package/lib/esm/grids.js +517 -0
  93. package/lib/esm/grids.js.map +1 -0
  94. package/lib/esm/iterators.js +93 -235
  95. package/lib/esm/iterators.js.map +1 -1
  96. package/lib/esm/layouts.d.ts +1 -1
  97. package/lib/esm/layouts.js +60 -97
  98. package/lib/esm/layouts.js.map +1 -1
  99. package/lib/esm/loader.d.ts +2 -2
  100. package/lib/esm/loader.js +20 -120
  101. package/lib/esm/loader.js.map +1 -1
  102. package/lib/esm/notation.d.ts +0 -3
  103. package/lib/esm/notation.js +135 -242
  104. package/lib/esm/notation.js.map +1 -1
  105. package/lib/esm/parser.d.ts +2 -0
  106. package/lib/esm/parser.js +220 -210
  107. package/lib/esm/parser.js.map +1 -1
  108. package/lib/esm/shapes.js +148 -288
  109. package/lib/esm/shapes.js.map +1 -1
  110. package/lib/esm/utils.d.ts +8 -0
  111. package/lib/esm/utils.js +55 -51
  112. package/lib/esm/utils.js.map +1 -1
  113. package/package.json +18 -17
@@ -1,304 +1,204 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __values = (this && this.__values) || function(o) {
29
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
30
- if (m) return m.call(o);
31
- if (o && typeof o.length === "number") return {
32
- next: function () {
33
- if (o && i >= o.length) o = void 0;
34
- return { value: o && o[i++], done: !o };
35
- }
36
- };
37
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
38
- };
39
2
  Object.defineProperty(exports, "__esModule", { value: true });
40
3
  exports.Notation = exports.MetaData = exports.RawBlock = exports.Command = exports.RoleDef = void 0;
41
- var entity_1 = require("./entity");
42
- var cycle_1 = require("./cycle");
43
- var core_1 = require("./core");
44
- var layouts_1 = require("./layouts");
45
- var RoleDef = (function () {
46
- function RoleDef() {
4
+ const entity_1 = require("./entity");
5
+ const cycle_1 = require("./cycle");
6
+ const core_1 = require("./core");
7
+ const layouts_1 = require("./layouts");
8
+ class RoleDef {
9
+ constructor() {
47
10
  this.name = "";
48
11
  this.notesOnly = false;
49
12
  this.index = 0;
50
13
  }
51
- return RoleDef;
52
- }());
14
+ }
53
15
  exports.RoleDef = RoleDef;
54
- var Command = (function (_super) {
55
- __extends(Command, _super);
56
- function Command(params) {
57
- if (params === void 0) { params = []; }
58
- var _this = _super.call(this) || this;
59
- _this.autoGenerated = false;
60
- _this.prevSibling = null;
61
- _this.nextSibling = null;
62
- _this.params = params;
63
- _this.index = 0;
64
- _this.validateParams();
65
- return _this;
66
- }
67
- Command.prototype.validateParams = function () {
68
- };
69
- Object.defineProperty(Command.prototype, "name", {
70
- get: function () {
71
- return this.constructor.name;
72
- },
73
- enumerable: false,
74
- configurable: true
75
- });
76
- Object.defineProperty(Command.prototype, "type", {
77
- get: function () {
78
- return "Command";
79
- },
80
- enumerable: false,
81
- configurable: true
82
- });
83
- Command.prototype.debugValue = function () {
16
+ class Command extends entity_1.Entity {
17
+ constructor(params = []) {
18
+ super();
19
+ this.autoGenerated = false;
20
+ this.prevSibling = null;
21
+ this.nextSibling = null;
22
+ this.params = params;
23
+ this.index = 0;
24
+ this.validateParams();
25
+ }
26
+ validateParams() {
27
+ }
28
+ get name() {
29
+ return this.constructor.name;
30
+ }
31
+ get type() {
32
+ return "Command";
33
+ }
34
+ debugValue() {
84
35
  return { name: this.name, index: this.index, params: this.params };
85
- };
86
- Command.prototype.getParam = function (name) {
87
- var e_1, _a;
88
- try {
89
- for (var _b = __values(this.params), _c = _b.next(); !_c.done; _c = _b.next()) {
90
- var param = _c.value;
91
- if (param.key == name)
92
- return param.value;
93
- }
94
- }
95
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
96
- finally {
97
- try {
98
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
99
- }
100
- finally { if (e_1) throw e_1.error; }
36
+ }
37
+ getParam(name) {
38
+ for (const param of this.params) {
39
+ if (param.key == name)
40
+ return param.value;
101
41
  }
102
42
  return null;
103
- };
104
- Command.prototype.getParamAt = function (index) {
43
+ }
44
+ getParamAt(index) {
105
45
  return index < this.params.length ? this.params[index].value : null;
106
- };
107
- return Command;
108
- }(entity_1.Entity));
46
+ }
47
+ }
109
48
  exports.Command = Command;
110
- var RawBlock = (function (_super) {
111
- __extends(RawBlock, _super);
112
- function RawBlock(content, contentType) {
113
- if (contentType === void 0) { contentType = "md"; }
114
- var _this = _super.call(this) || this;
115
- _this.content = content;
116
- _this.contentType = contentType;
117
- return _this;
118
- }
119
- RawBlock.prototype.debugValue = function () {
120
- return __assign(__assign({}, _super.prototype.debugValue.call(this)), { content: this.content, contentType: this.contentType });
121
- };
122
- return RawBlock;
123
- }(entity_1.Entity));
49
+ class RawBlock extends entity_1.Entity {
50
+ constructor(content, contentType = "md") {
51
+ super();
52
+ this.content = content;
53
+ this.contentType = contentType;
54
+ }
55
+ debugValue() {
56
+ return Object.assign(Object.assign({}, super.debugValue()), { content: this.content, contentType: this.contentType });
57
+ }
58
+ }
124
59
  exports.RawBlock = RawBlock;
125
- var MetaData = (function () {
126
- function MetaData(key, value, params) {
60
+ class MetaData {
61
+ constructor(key, value, params) {
127
62
  this.key = key;
128
63
  this.value = value;
129
64
  this.params = params;
130
65
  params = params || {};
131
66
  }
132
- return MetaData;
133
- }());
67
+ }
134
68
  exports.MetaData = MetaData;
135
- var Notation = (function (_super) {
136
- __extends(Notation, _super);
137
- function Notation() {
138
- var _this = _super !== null && _super.apply(this, arguments) || this;
139
- _this._unnamedLayoutParams = [];
140
- _this._namedLayoutParams = new Map();
141
- _this._currRoleDef = null;
142
- _this.roles = [];
143
- _this.blocks = [];
144
- _this.lpsForLine = new Map();
145
- _this.currentAPB = 1;
146
- _this.currentCycle = cycle_1.Cycle.DEFAULT;
147
- _this.currentBreaks = [];
148
- _this.metadata = new Map();
149
- _this.onMissingRole = function (name) { return _this.newRoleDef(name, name == "sw"); };
150
- _this._currentLine = null;
151
- _this._layoutParams = null;
152
- return _this;
153
- }
154
- Notation.prototype.layoutParamsForLine = function (line) {
155
- return this.lpsForLine.get(line.uuid) || null;
156
- };
157
- Notation.prototype.setLayoutParamsForLine = function (line, layoutParams) {
158
- this.lpsForLine.set(line.uuid, layoutParams);
159
- };
160
- Object.defineProperty(Notation.prototype, "unnamedLayoutParams", {
161
- get: function () {
162
- return this._unnamedLayoutParams;
163
- },
164
- enumerable: false,
165
- configurable: true
166
- });
167
- Object.defineProperty(Notation.prototype, "namedLayoutParams", {
168
- get: function () {
169
- return this._namedLayoutParams;
170
- },
171
- enumerable: false,
172
- configurable: true
173
- });
174
- Object.defineProperty(Notation.prototype, "type", {
175
- get: function () {
176
- return "Notation";
177
- },
178
- enumerable: false,
179
- configurable: true
180
- });
181
- Notation.prototype.addLine = function (line) {
69
+ class Notation extends entity_1.Entity {
70
+ constructor() {
71
+ super(...arguments);
72
+ this._unnamedLayoutParams = [];
73
+ this._namedLayoutParams = new Map();
74
+ this._currRoleDef = null;
75
+ this.roles = [];
76
+ this.blocks = [];
77
+ this.currentAPB = 1;
78
+ this.currentCycle = cycle_1.Cycle.DEFAULT;
79
+ this.currentBreaks = [];
80
+ this.metadata = new Map();
81
+ this.onMissingRole = (name) => this.newRoleDef(name, name == "sw");
82
+ this._currentLine = null;
83
+ this._layoutParams = null;
84
+ }
85
+ get unnamedLayoutParams() {
86
+ return this._unnamedLayoutParams;
87
+ }
88
+ get namedLayoutParams() {
89
+ return this._namedLayoutParams;
90
+ }
91
+ get type() {
92
+ return "Notation";
93
+ }
94
+ addLine(line) {
182
95
  this.blocks.push(line);
183
- };
184
- Notation.prototype.removeLine = function (line) {
185
- var index = this.blocks.findIndex(function (l) { return l == line; });
96
+ }
97
+ removeLine(line) {
98
+ const index = this.blocks.findIndex((l) => l == line);
186
99
  if (index >= 0) {
187
100
  this.blocks.splice(index, 1);
188
101
  }
189
102
  return index;
190
- };
191
- Notation.prototype.addRawBlock = function (raw) {
103
+ }
104
+ addRawBlock(raw) {
192
105
  this.blocks.push(raw);
193
106
  this.resetLine();
194
- };
195
- Notation.prototype.addMetaData = function (meta) {
107
+ }
108
+ addMetaData(meta) {
196
109
  if (!this.metadata.has(meta.key)) {
197
- var raw = new RawBlock(meta.key, "metadata");
110
+ const raw = new RawBlock(meta.key, "metadata");
198
111
  this.addRawBlock(raw);
199
112
  }
200
113
  this.metadata.set(meta.key, meta);
201
- };
202
- Notation.prototype.debugValue = function () {
114
+ }
115
+ debugValue() {
203
116
  var _a;
204
- return __assign(__assign({}, _super.prototype.debugValue), { roles: this.roles, blocks: this.blocks.map(function (b) { return b.debugValue(); }), currentAPB: this.currentAPB, currentCycle: (_a = this.currentCycle) === null || _a === void 0 ? void 0 : _a.uuid, currentBreaks: this.currentBreaks });
205
- };
206
- Notation.prototype.getRoleDef = function (name) {
117
+ return Object.assign(Object.assign({}, super.debugValue), { roles: this.roles, blocks: this.blocks.map((b) => b.debugValue()), currentAPB: this.currentAPB, currentCycle: (_a = this.currentCycle) === null || _a === void 0 ? void 0 : _a.uuid, currentBreaks: this.currentBreaks });
118
+ }
119
+ getRoleDef(name) {
207
120
  name = name.trim().toLowerCase();
208
121
  if (name == "") {
209
122
  return this.roles[this.roles.length - 1] || null;
210
123
  }
211
- for (var i = 0; i < this.roles.length; i++) {
212
- var rd = this.roles[i];
124
+ for (let i = 0; i < this.roles.length; i++) {
125
+ const rd = this.roles[i];
213
126
  if (name == rd.name)
214
127
  return rd;
215
128
  }
216
129
  return null;
217
- };
218
- Notation.prototype.newRoleDef = function (name, notesOnly) {
219
- if (notesOnly === void 0) { notesOnly = false; }
130
+ }
131
+ newRoleDef(name, notesOnly = false) {
220
132
  name = name.trim().toLowerCase();
221
133
  if (name.trim() == "") {
222
134
  throw new Error("Role name cannot be empty");
223
135
  }
224
- var roleDef = this.getRoleDef(name);
136
+ const roleDef = this.getRoleDef(name);
225
137
  if (roleDef != null) {
226
138
  throw new Error("Role already exists");
227
139
  }
228
- var rd = new RoleDef();
140
+ const rd = new RoleDef();
229
141
  rd.name = name;
230
142
  rd.notesOnly = notesOnly;
231
143
  rd.index = this.roles.length;
232
144
  this.roles.push(rd);
233
145
  return rd;
234
- };
235
- Object.defineProperty(Notation.prototype, "currRoleDef", {
236
- get: function () {
237
- if (this._currRoleDef == null) {
238
- if (this.roles.length == 0) {
239
- return null;
240
- }
241
- else {
242
- this._currRoleDef = this.roles[this.roles.length - 1];
243
- }
146
+ }
147
+ get currRoleDef() {
148
+ if (this._currRoleDef == null) {
149
+ if (this.roles.length == 0) {
150
+ return null;
151
+ }
152
+ else {
153
+ this._currRoleDef = this.roles[this.roles.length - 1];
244
154
  }
245
- return this._currRoleDef;
246
- },
247
- enumerable: false,
248
- configurable: true
249
- });
250
- Notation.prototype.setCurrRole = function (name) {
155
+ }
156
+ return this._currRoleDef;
157
+ }
158
+ setCurrRole(name) {
251
159
  name = name.trim().toLowerCase();
252
160
  if (name.trim() == "") {
253
161
  throw new Error("Role name cannot be empty");
254
162
  }
255
- var roleDef = this.getRoleDef(name) || (this.onMissingRole ? this.onMissingRole(name) || null : null);
163
+ const roleDef = this.getRoleDef(name) || (this.onMissingRole ? this.onMissingRole(name) || null : null);
256
164
  if (roleDef == null) {
257
165
  throw new Error("Role not found: " + name);
258
166
  }
259
167
  this._currRoleDef = roleDef;
260
- };
261
- Object.defineProperty(Notation.prototype, "currentLine", {
262
- get: function () {
263
- if (this._currentLine == null) {
264
- return this.newLine();
265
- }
266
- return this._currentLine;
267
- },
268
- enumerable: false,
269
- configurable: true
270
- });
271
- Notation.prototype.resetLine = function () {
168
+ }
169
+ get currentLine() {
170
+ if (this._currentLine == null) {
171
+ return this.newLine();
172
+ }
173
+ return this._currentLine;
174
+ }
175
+ resetLine() {
272
176
  this._currentLine = null;
273
- };
274
- Notation.prototype.newLine = function () {
177
+ }
178
+ newLine() {
275
179
  if (this._currentLine && this._currentLine.isEmpty) {
276
180
  this.removeLine(this._currentLine);
277
181
  }
278
182
  this._currentLine = new core_1.Line();
279
183
  this.addLine(this._currentLine);
280
184
  return this._currentLine;
281
- };
282
- Notation.prototype.resetLayoutParams = function () {
185
+ }
186
+ resetLayoutParams() {
283
187
  this._layoutParams = null;
284
188
  this.resetLine();
285
- };
286
- Object.defineProperty(Notation.prototype, "layoutParams", {
287
- get: function () {
189
+ }
190
+ get layoutParams() {
191
+ if (this._layoutParams == null) {
192
+ this._layoutParams = this.findUnnamedLayoutParams();
288
193
  if (this._layoutParams == null) {
289
- this._layoutParams = this.findUnnamedLayoutParams();
290
- if (this._layoutParams == null) {
291
- this._layoutParams = this.snapshotLayoutParams();
292
- this._unnamedLayoutParams.push(this._layoutParams);
293
- }
194
+ this._layoutParams = this.snapshotLayoutParams();
195
+ this._unnamedLayoutParams.push(this._layoutParams);
294
196
  }
295
- return this._layoutParams;
296
- },
297
- enumerable: false,
298
- configurable: true
299
- });
300
- Notation.prototype.ensureNamedLayoutParams = function (name) {
301
- var lp = this._namedLayoutParams.get(name) || null;
197
+ }
198
+ return this._layoutParams;
199
+ }
200
+ ensureNamedLayoutParams(name) {
201
+ let lp = this._namedLayoutParams.get(name) || null;
302
202
  if (lp == null || this._layoutParams != lp) {
303
203
  if (lp == null) {
304
204
  lp = this.snapshotLayoutParams();
@@ -313,23 +213,21 @@ var Notation = (function (_super) {
313
213
  this.resetLine();
314
214
  }
315
215
  return this._layoutParams;
316
- };
317
- Notation.prototype.snapshotLayoutParams = function () {
216
+ }
217
+ snapshotLayoutParams() {
318
218
  return new layouts_1.LayoutParams({
319
219
  cycle: this.currentCycle,
320
220
  beatDuration: this.currentAPB,
321
221
  layout: this.currentBreaks,
322
222
  });
323
- };
324
- Notation.prototype.findUnnamedLayoutParams = function () {
325
- var _this = this;
326
- return (this._unnamedLayoutParams.find(function (lp) {
327
- return (lp.beatDuration == _this.currentAPB &&
328
- _this.currentCycle.equals(lp.cycle) &&
329
- lp.lineBreaksEqual(_this.currentBreaks));
223
+ }
224
+ findUnnamedLayoutParams() {
225
+ return (this._unnamedLayoutParams.find((lp) => {
226
+ return (lp.beatDuration == this.currentAPB &&
227
+ this.currentCycle.equals(lp.cycle) &&
228
+ lp.lineBreaksEqual(this.currentBreaks));
330
229
  }) || null);
331
- };
332
- return Notation;
333
- }(entity_1.Entity));
230
+ }
231
+ }
334
232
  exports.Notation = Notation;
335
233
  //# sourceMappingURL=notation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notation.js","sourceRoot":"","sources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0CAAuB,GAAjC;QAAA,iBAUC;QATC,OAAO,CACL,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAC,EAAE;YAChC,OAAO,CACL,EAAE,CAAC,YAAY,IAAI,KAAI,CAAC,UAAU;gBAClC,KAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;gBAClC,EAAE,CAAC,eAAe,CAAC,KAAI,CAAC,aAAa,CAAC,CACvC,CAAC;QACJ,CAAC,CAAC,IAAI,IAAI,CACX,CAAC;IACJ,CAAC;IACH,eAAC;AAAD,CAAC,AAtND,CAA8B,eAAM,GAsNnC;AAtNY,4BAAQ","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Entity } from \"./entity\";\nimport { Cycle } from \"./cycle\";\nimport { Line } from \"./core\";\nimport { LayoutParams } from \"./layouts\";\n\nexport class RoleDef {\n name = \"\";\n notesOnly = false;\n index = 0;\n}\n\nexport type CmdParam = { key: TSU.Nullable<string>; value: any };\nexport abstract class Command extends Entity {\n // Commands that are auto generated are usually created by other commands\n autoGenerated = false;\n prevSibling: null | Command = null;\n nextSibling: null | Command = null;\n params: CmdParam[];\n index: number;\n\n constructor(params: CmdParam[] = []) {\n super();\n this.params = params;\n this.index = 0;\n this.validateParams();\n }\n\n /**\n * called to validate parameters.\n */\n validateParams(): void {\n //\n }\n\n get name(): string {\n return this.constructor.name;\n }\n\n get type(): string {\n return \"Command\";\n }\n\n debugValue(): any {\n return { name: this.name, index: this.index, params: this.params };\n }\n\n getParam(name: string): any {\n for (const param of this.params) {\n if (param.key == name) return param.value;\n }\n return null;\n }\n\n getParamAt(index: number): any {\n return index < this.params.length ? this.params[index].value : null;\n }\n abstract applyToNotation(notebook: Notation): void;\n}\n\nexport class RawBlock extends Entity {\n constructor(public content: string, public contentType: string = \"md\") {\n super();\n }\n\n debugValue(): any {\n return { ...super.debugValue(), content: this.content, contentType: this.contentType };\n }\n}\n\nexport class MetaData {\n constructor(public readonly key: string, public readonly value: string, public readonly params?: any) {\n params = params || {};\n }\n}\n\nexport class Notation extends Entity {\n private _unnamedLayoutParams: LayoutParams[] = [];\n private _namedLayoutParams = new Map<string, LayoutParams>();\n private _currRoleDef: TSU.Nullable<RoleDef> = null;\n roles: RoleDef[] = [];\n blocks: (Line | RawBlock)[] = [];\n private lpsForLine = new Map<number, LayoutParams>();\n currentAPB = 1;\n currentCycle: Cycle = Cycle.DEFAULT;\n currentBreaks: number[] = [];\n metadata = new Map<string, MetaData>();\n onMissingRole: (name: string) => RoleDef | null = (name) => this.newRoleDef(name, name == \"sw\");\n\n layoutParamsForLine(line: Line): null | LayoutParams {\n return this.lpsForLine.get(line.uuid) || null;\n }\n\n setLayoutParamsForLine(line: Line, layoutParams: LayoutParams): void {\n this.lpsForLine.set(line.uuid, layoutParams);\n }\n\n get unnamedLayoutParams(): ReadonlyArray<LayoutParams> {\n return this._unnamedLayoutParams;\n }\n\n get namedLayoutParams(): ReadonlyMap<string, LayoutParams> {\n return this._namedLayoutParams;\n }\n\n get type(): unknown {\n return \"Notation\";\n }\n\n addLine(line: Line): void {\n this.blocks.push(line);\n }\n\n removeLine(line: Line): number {\n const index = this.blocks.findIndex((l) => l == line);\n if (index >= 0) {\n this.blocks.splice(index, 1);\n }\n return index;\n }\n\n addRawBlock(raw: RawBlock): void {\n this.blocks.push(raw);\n this.resetLine();\n }\n\n addMetaData(meta: MetaData): void {\n if (!this.metadata.has(meta.key)) {\n // Add a new raw block here\n // set this by key so even if metadata changes we can\n // get latest value of it\n const raw = new RawBlock(meta.key, \"metadata\");\n this.addRawBlock(raw);\n }\n this.metadata.set(meta.key, meta);\n }\n\n debugValue(): any {\n return {\n ...super.debugValue,\n roles: this.roles,\n blocks: this.blocks.map((b) => b.debugValue()),\n currentAPB: this.currentAPB,\n currentCycle: this.currentCycle?.uuid,\n currentBreaks: this.currentBreaks,\n };\n }\n\n getRoleDef(name: string): TSU.Nullable<RoleDef> {\n name = name.trim().toLowerCase();\n if (name == \"\") {\n return this.roles[this.roles.length - 1] || null;\n }\n for (let i = 0; i < this.roles.length; i++) {\n const rd = this.roles[i];\n if (name == rd.name) return rd;\n }\n return null;\n }\n\n newRoleDef(name: string, notesOnly = false): RoleDef {\n name = name.trim().toLowerCase();\n if (name.trim() == \"\") {\n throw new Error(\"Role name cannot be empty\");\n }\n const roleDef = this.getRoleDef(name);\n if (roleDef != null) {\n throw new Error(\"Role already exists\");\n // roleDef.notesOnly = notesOnly;\n // return roleDef;\n }\n // create new and add\n const rd = new RoleDef();\n rd.name = name;\n rd.notesOnly = notesOnly;\n rd.index = this.roles.length;\n this.roles.push(rd);\n\n return rd;\n }\n\n get currRoleDef(): RoleDef | null {\n if (this._currRoleDef == null) {\n if (this.roles.length == 0) {\n return null;\n } else {\n this._currRoleDef = this.roles[this.roles.length - 1];\n }\n }\n return this._currRoleDef;\n }\n\n setCurrRole(name: string): void {\n name = name.trim().toLowerCase();\n if (name.trim() == \"\") {\n throw new Error(\"Role name cannot be empty\");\n }\n const roleDef = this.getRoleDef(name) || (this.onMissingRole ? this.onMissingRole(name) || null : null);\n if (roleDef == null) {\n throw new Error(\"Role not found: \" + name);\n }\n this._currRoleDef = roleDef;\n }\n\n // Gets the current line, creating it if needed\n private _currentLine: Line | null = null;\n get currentLine(): Line {\n if (this._currentLine == null) {\n return this.newLine();\n }\n return this._currentLine;\n }\n\n resetLine(): void {\n this._currentLine = null;\n }\n\n newLine(): Line {\n if (this._currentLine && this._currentLine.isEmpty) {\n // then remove it first instead of adding another\n // so we dont have a string of empty lines\n this.removeLine(this._currentLine);\n }\n this._currentLine = new Line();\n this.addLine(this._currentLine);\n return this._currentLine;\n }\n\n private _layoutParams: LayoutParams | null = null;\n resetLayoutParams(): void {\n this._layoutParams = null;\n this.resetLine();\n }\n\n get layoutParams(): LayoutParams {\n if (this._layoutParams == null) {\n // create it or find one that matches current params\n this._layoutParams = this.findUnnamedLayoutParams();\n if (this._layoutParams == null) {\n this._layoutParams = this.snapshotLayoutParams();\n this._unnamedLayoutParams.push(this._layoutParams);\n }\n }\n return this._layoutParams;\n }\n\n ensureNamedLayoutParams(name: string): LayoutParams {\n let lp = this._namedLayoutParams.get(name) || null;\n if (lp == null || this._layoutParams != lp) {\n // no change so go ahead\n if (lp == null) {\n // does not exist so create one by re-snapshotting it\n // and saving it\n lp = this.snapshotLayoutParams();\n this._namedLayoutParams.set(name, lp);\n } else {\n // copy named LPs attributes into our locals\n this.currentCycle = lp.cycle;\n this.currentAPB = lp.beatDuration;\n this.currentBreaks = lp.lineBreaks;\n }\n this._layoutParams = lp;\n this.resetLine(); // since layout params have changed\n }\n return this._layoutParams;\n }\n\n protected snapshotLayoutParams(): LayoutParams {\n return new LayoutParams({\n cycle: this.currentCycle,\n beatDuration: this.currentAPB,\n layout: this.currentBreaks,\n });\n }\n\n /**\n * Find a layout params that is currently _unnamed but matches one\n * by current set of layout attributes.\n */\n protected findUnnamedLayoutParams(): LayoutParams | null {\n return (\n this._unnamedLayoutParams.find((lp) => {\n return (\n lp.beatDuration == this.currentAPB &&\n this.currentCycle.equals(lp.cycle) &&\n lp.lineBreaksEqual(this.currentBreaks)\n );\n }) || null\n );\n }\n}\n"]}
1
+ {"version":3,"file":"notation.js","sourceRoot":"","sources":["../../src/notation.ts"],"names":[],"mappings":";;;AACA,qCAAkC;AAClC,mCAAgC;AAChC,iCAA8B;AAC9B,uCAAyC;AAEzC,MAAa,OAAO;IAApB;QACE,SAAI,GAAG,EAAE,CAAC;QACV,cAAS,GAAG,KAAK,CAAC;QAClB,UAAK,GAAG,CAAC,CAAC;IACZ,CAAC;CAAA;AAJD,0BAIC;AAGD,MAAsB,OAAQ,SAAQ,eAAM;IAQ1C,YAAY,SAAqB,EAAE;QACjC,KAAK,EAAE,CAAC;QAPV,kBAAa,GAAG,KAAK,CAAC;QACtB,gBAAW,GAAmB,IAAI,CAAC;QACnC,gBAAW,GAAmB,IAAI,CAAC;QAMjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IA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IAAI,CAAC,UAAU;gBAClC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;gBAClC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CACvC,CAAC;QACJ,CAAC,CAAC,IAAI,IAAI,CACX,CAAC;IACJ,CAAC;CACF;AA7MD,4BA6MC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Entity } from \"./entity\";\nimport { Cycle } from \"./cycle\";\nimport { Line } from \"./core\";\nimport { LayoutParams } from \"./layouts\";\n\nexport class RoleDef {\n name = \"\";\n notesOnly = false;\n index = 0;\n}\n\nexport type CmdParam = { key: TSU.Nullable<string>; value: any };\nexport abstract class Command extends Entity {\n // Commands that are auto generated are usually created by other commands\n autoGenerated = false;\n prevSibling: null | Command = null;\n nextSibling: null | Command = null;\n params: CmdParam[];\n index: number;\n\n constructor(params: CmdParam[] = []) {\n super();\n this.params = params;\n this.index = 0;\n this.validateParams();\n }\n\n /**\n * called to validate parameters.\n */\n validateParams(): void {\n //\n }\n\n get name(): string {\n return this.constructor.name;\n }\n\n get type(): string {\n return \"Command\";\n }\n\n debugValue(): any {\n return { name: this.name, index: this.index, params: this.params };\n }\n\n getParam(name: string): any {\n for (const param of this.params) {\n if (param.key == name) return param.value;\n }\n return null;\n }\n\n getParamAt(index: number): any {\n return index < this.params.length ? this.params[index].value : null;\n }\n abstract applyToNotation(notebook: Notation): void;\n}\n\nexport class RawBlock extends Entity {\n constructor(public content: string, public contentType: string = \"md\") {\n super();\n }\n\n debugValue(): any {\n return { ...super.debugValue(), content: this.content, contentType: this.contentType };\n }\n}\n\nexport class MetaData {\n constructor(public readonly key: string, public readonly value: string, public readonly params?: any) {\n params = params || {};\n }\n}\n\nexport class Notation extends Entity {\n private _unnamedLayoutParams: LayoutParams[] = [];\n private _namedLayoutParams = new Map<string, LayoutParams>();\n private _currRoleDef: TSU.Nullable<RoleDef> = null;\n roles: RoleDef[] = [];\n blocks: (Line | RawBlock)[] = [];\n currentAPB = 1;\n currentCycle: Cycle = Cycle.DEFAULT;\n currentBreaks: number[] = [];\n metadata = new Map<string, MetaData>();\n onMissingRole: (name: string) => RoleDef | null = (name) => this.newRoleDef(name, name == \"sw\");\n\n get unnamedLayoutParams(): ReadonlyArray<LayoutParams> {\n return this._unnamedLayoutParams;\n }\n\n get namedLayoutParams(): ReadonlyMap<string, LayoutParams> {\n return this._namedLayoutParams;\n }\n\n get type(): unknown {\n return \"Notation\";\n }\n\n addLine(line: Line): void {\n this.blocks.push(line);\n }\n\n removeLine(line: Line): number {\n const index = this.blocks.findIndex((l) => l == line);\n if (index >= 0) {\n this.blocks.splice(index, 1);\n }\n return index;\n }\n\n addRawBlock(raw: RawBlock): void {\n this.blocks.push(raw);\n this.resetLine();\n }\n\n addMetaData(meta: MetaData): void {\n if (!this.metadata.has(meta.key)) {\n // Add a new raw block here\n // set this by key so even if metadata changes we can\n // get latest value of it\n const raw = new RawBlock(meta.key, \"metadata\");\n this.addRawBlock(raw);\n }\n this.metadata.set(meta.key, meta);\n }\n\n debugValue(): any {\n return {\n ...super.debugValue,\n roles: this.roles,\n blocks: this.blocks.map((b) => b.debugValue()),\n currentAPB: this.currentAPB,\n currentCycle: this.currentCycle?.uuid,\n currentBreaks: this.currentBreaks,\n };\n }\n\n getRoleDef(name: string): TSU.Nullable<RoleDef> {\n name = name.trim().toLowerCase();\n if (name == \"\") {\n return this.roles[this.roles.length - 1] || null;\n }\n for (let i = 0; i < this.roles.length; i++) {\n const rd = this.roles[i];\n if (name == rd.name) return rd;\n }\n return null;\n }\n\n newRoleDef(name: string, notesOnly = false): RoleDef {\n name = name.trim().toLowerCase();\n if (name.trim() == \"\") {\n throw new Error(\"Role name cannot be empty\");\n }\n const roleDef = this.getRoleDef(name);\n if (roleDef != null) {\n throw new Error(\"Role already exists\");\n // roleDef.notesOnly = notesOnly;\n // return roleDef;\n }\n // create new and add\n const rd = new RoleDef();\n rd.name = name;\n rd.notesOnly = notesOnly;\n rd.index = this.roles.length;\n this.roles.push(rd);\n\n return rd;\n }\n\n get currRoleDef(): RoleDef | null {\n if (this._currRoleDef == null) {\n if (this.roles.length == 0) {\n return null;\n } else {\n this._currRoleDef = this.roles[this.roles.length - 1];\n }\n }\n return this._currRoleDef;\n }\n\n setCurrRole(name: string): void {\n name = name.trim().toLowerCase();\n if (name.trim() == \"\") {\n throw new Error(\"Role name cannot be empty\");\n }\n const roleDef = this.getRoleDef(name) || (this.onMissingRole ? this.onMissingRole(name) || null : null);\n if (roleDef == null) {\n throw new Error(\"Role not found: \" + name);\n }\n this._currRoleDef = roleDef;\n }\n\n // Gets the current line, creating it if needed\n private _currentLine: Line | null = null;\n get currentLine(): Line {\n if (this._currentLine == null) {\n return this.newLine();\n }\n return this._currentLine;\n }\n\n resetLine(): void {\n this._currentLine = null;\n }\n\n newLine(): Line {\n if (this._currentLine && this._currentLine.isEmpty) {\n // then remove it first instead of adding another\n // so we dont have a string of empty lines\n this.removeLine(this._currentLine);\n }\n this._currentLine = new Line();\n this.addLine(this._currentLine);\n return this._currentLine;\n }\n\n private _layoutParams: LayoutParams | null = null;\n resetLayoutParams(): void {\n this._layoutParams = null;\n this.resetLine();\n }\n\n get layoutParams(): LayoutParams {\n if (this._layoutParams == null) {\n // create it or find one that matches current params\n this._layoutParams = this.findUnnamedLayoutParams();\n if (this._layoutParams == null) {\n this._layoutParams = this.snapshotLayoutParams();\n this._unnamedLayoutParams.push(this._layoutParams);\n }\n }\n return this._layoutParams;\n }\n\n ensureNamedLayoutParams(name: string): LayoutParams {\n let lp = this._namedLayoutParams.get(name) || null;\n if (lp == null || this._layoutParams != lp) {\n // no change so go ahead\n if (lp == null) {\n // does not exist so create one by re-snapshotting it\n // and saving it\n lp = this.snapshotLayoutParams();\n this._namedLayoutParams.set(name, lp);\n } else {\n // copy named LPs attributes into our locals\n this.currentCycle = lp.cycle;\n this.currentAPB = lp.beatDuration;\n this.currentBreaks = lp.lineBreaks;\n }\n this._layoutParams = lp;\n this.resetLine(); // since layout params have changed\n }\n return this._layoutParams;\n }\n\n protected snapshotLayoutParams(): LayoutParams {\n return new LayoutParams({\n cycle: this.currentCycle,\n beatDuration: this.currentAPB,\n layout: this.currentBreaks,\n });\n }\n\n /**\n * Find a layout params that is currently _unnamed but matches one\n * by current set of layout attributes.\n */\n protected findUnnamedLayoutParams(): LayoutParams | null {\n return (\n this._unnamedLayoutParams.find((lp) => {\n return (\n lp.beatDuration == this.currentAPB &&\n this.currentCycle.equals(lp.cycle) &&\n lp.lineBreaksEqual(this.currentBreaks)\n );\n }) || null\n );\n }\n}\n"]}
@@ -18,6 +18,8 @@ export declare class Parser {
18
18
  newRest: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => Rest;
19
19
  newDoubleSpace: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => Space;
20
20
  newSilentSpace: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => Space;
21
+ applyPreMarker: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => Atom;
22
+ applyPostMarker: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => Atom;
21
23
  applyDuration: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => Atom;
22
24
  newArray: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => any[];
23
25
  concatAtoms: (rule: G.Rule, parent: G.PTNode, ...children: G.PTNode[]) => any;