notations 0.0.47 → 0.0.50

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 +73 -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 +230 -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 +71 -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 +225 -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,24 +1,8 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
1
  import * as TSU from "@panyam/tsutils";
18
2
  import { Cycle, CycleCursor } from "./cycle";
19
- var ZERO = TSU.Num.Fraction.ZERO;
20
- var LayoutParams = (function () {
21
- function LayoutParams(config) {
3
+ const ZERO = TSU.Num.Fraction.ZERO;
4
+ export class LayoutParams {
5
+ constructor(config) {
22
6
  this.uuid = LayoutParams.counter++;
23
7
  config = config || {};
24
8
  this.beatDuration = config.beatDuration || 1;
@@ -35,35 +19,33 @@ var LayoutParams = (function () {
35
19
  this._beatLayouts = [];
36
20
  this.lineBreaks = config.lineBreaks || config.layout || [];
37
21
  }
38
- LayoutParams.prototype.equals = function (another) {
22
+ equals(another) {
39
23
  return (this.beatDuration == another.beatDuration &&
40
24
  this.cycle.equals(another.cycle) &&
41
25
  this.lineBreaksEqual(another._lineBreaks));
42
- };
43
- LayoutParams.prototype.lineBreaksEqual = function (another) {
44
- return this._lineBreaks.length == another.length && this._lineBreaks.every(function (x, i) { return x == another[i]; });
45
- };
46
- LayoutParams.prototype.debugValue = function () {
26
+ }
27
+ lineBreaksEqual(another) {
28
+ return this._lineBreaks.length == another.length && this._lineBreaks.every((x, i) => x == another[i]);
29
+ }
30
+ debugValue() {
47
31
  var _a;
48
32
  return {
49
33
  cycle: (_a = this.cycle) === null || _a === void 0 ? void 0 : _a.debugValue(),
50
34
  beatDuration: this.beatDuration,
51
35
  lineBreaks: this._lineBreaks,
52
36
  };
53
- };
54
- LayoutParams.prototype.getBeatLocation = function (beat) {
55
- var _a;
56
- var modIndex = beat.index % this.totalBeats;
57
- var total = 0;
58
- for (var i = 0; i < this._lineBreaks.length; i++) {
37
+ }
38
+ getBeatLocation(beat) {
39
+ const modIndex = beat.index % this.totalBeats;
40
+ let total = 0;
41
+ for (let i = 0; i < this._lineBreaks.length; i++) {
59
42
  if (modIndex < total + this._lineBreaks[i]) {
60
- var offset = ZERO;
61
- var startBeat = beat;
43
+ let offset = ZERO;
62
44
  if (modIndex > total) {
63
- var cursor = new CycleCursor(this.cycle, beat.barIndex, beat.beatIndex, beat.instance);
64
- var _b = __read(cursor.prev, 2), pos = _b[0], duration = _b[1];
65
- for (var i_1 = total; i_1 < modIndex; i_1++) {
66
- _a = __read(cursor.prev, 2), pos = _a[0], duration = _a[1];
45
+ const cursor = new CycleCursor(this.cycle, beat.barIndex, beat.beatIndex, beat.instance);
46
+ let [, duration] = cursor.prev;
47
+ for (let i = total; i < modIndex; i++) {
48
+ [, duration] = cursor.prev;
67
49
  offset = offset.plus(duration.timesNum(this.beatDuration));
68
50
  }
69
51
  }
@@ -73,72 +55,53 @@ var LayoutParams = (function () {
73
55
  }
74
56
  throw new Error("Invalid beat index: " + beat.index);
75
57
  return [-1, -1, ZERO];
76
- };
77
- Object.defineProperty(LayoutParams.prototype, "lineBreaks", {
78
- get: function () {
79
- if (!this._lineBreaks || this._lineBreaks.length == 0) {
80
- this.lineBreaks = [this.cycle.beatCount];
81
- }
82
- return this._lineBreaks;
83
- },
84
- set: function (val) {
85
- this._lineBreaks = val;
58
+ }
59
+ get lineBreaks() {
60
+ if (!this._lineBreaks || this._lineBreaks.length == 0) {
61
+ this.lineBreaks = [this.cycle.beatCount];
62
+ }
63
+ return this._lineBreaks;
64
+ }
65
+ set lineBreaks(val) {
66
+ this._lineBreaks = val;
67
+ this.refreshLayout();
68
+ }
69
+ get beatLayouts() {
70
+ if (!this._beatLayouts || this._beatLayouts.length < this.lineBreaks.length) {
86
71
  this.refreshLayout();
87
- },
88
- enumerable: false,
89
- configurable: true
90
- });
91
- LayoutParams.prototype.refreshLayout = function () {
92
- var _this = this;
93
- var cycleIter = this.cycle.iterateBeats();
94
- var akb = this.beatDuration;
95
- this._beatLayouts = this.lineBreaks.map(function (numBeats, index) {
96
- var beats = [];
97
- for (var i = 0; i < numBeats; i++) {
98
- var nextCP = cycleIter.next().value;
72
+ }
73
+ return this._beatLayouts;
74
+ }
75
+ get totalBeats() {
76
+ this.beatLayouts;
77
+ return this._totalBeats;
78
+ }
79
+ get totalLayoutDuration() {
80
+ this.beatLayouts;
81
+ return this._totalLayoutDuration;
82
+ }
83
+ refreshLayout() {
84
+ const cycleIter = this.cycle.iterateBeats();
85
+ const akb = this.beatDuration;
86
+ this._beatLayouts = this.lineBreaks.map((numBeats, index) => {
87
+ const beats = [];
88
+ for (let i = 0; i < numBeats; i++) {
89
+ const nextCP = cycleIter.next().value;
99
90
  nextCP[1] = nextCP[1].timesNum(akb);
100
91
  beats.push(nextCP);
101
92
  }
102
93
  return beats;
103
94
  });
104
- this._totalBeats = this.lineBreaks.reduce(function (a, b) { return a + b; }, 0);
105
- this._rowDurations = this._beatLayouts.map(function (beats) { return beats.reduce(function (x, y) { return x.plus(y[1]); }, ZERO); });
106
- this._rowDurations.forEach(function (rd, index) {
107
- _this._rowStartOffsets[index] = index == 0 ? ZERO : _this._rowStartOffsets[index - 1].plus(rd);
95
+ this._totalBeats = this.lineBreaks.reduce((a, b) => a + b, 0);
96
+ this._rowDurations = this._beatLayouts.map((beats) => beats.reduce((x, y) => x.plus(y[1]), ZERO));
97
+ this._rowDurations.forEach((rd, index) => {
98
+ this._rowStartOffsets[index] = index == 0 ? ZERO : this._rowStartOffsets[index - 1].plus(rd);
108
99
  });
109
- this._rowEndOffsets = this._rowDurations.map(function (rd, index) {
110
- return _this._rowStartOffsets[index].plus(rd);
100
+ this._rowEndOffsets = this._rowDurations.map((rd, index) => {
101
+ return this._rowStartOffsets[index].plus(rd);
111
102
  });
112
- this._totalLayoutDuration = this._rowDurations.reduce(function (x, y) { return x.plus(y); }, ZERO);
113
- };
114
- Object.defineProperty(LayoutParams.prototype, "beatLayouts", {
115
- get: function () {
116
- if (!this._beatLayouts || this._beatLayouts.length < this.lineBreaks.length) {
117
- this.refreshLayout();
118
- }
119
- return this._beatLayouts;
120
- },
121
- enumerable: false,
122
- configurable: true
123
- });
124
- Object.defineProperty(LayoutParams.prototype, "totalBeats", {
125
- get: function () {
126
- this.beatLayouts;
127
- return this._totalBeats;
128
- },
129
- enumerable: false,
130
- configurable: true
131
- });
132
- Object.defineProperty(LayoutParams.prototype, "totalLayoutDuration", {
133
- get: function () {
134
- this.beatLayouts;
135
- return this._totalLayoutDuration;
136
- },
137
- enumerable: false,
138
- configurable: true
139
- });
140
- LayoutParams.counter = 0;
141
- return LayoutParams;
142
- }());
143
- export { LayoutParams };
103
+ this._totalLayoutDuration = this._rowDurations.reduce((x, y) => x.plus(y), ZERO);
104
+ }
105
+ }
106
+ LayoutParams.counter = 0;
144
107
  //# sourceMappingURL=layouts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layouts.js","sourceRoot":"","sources":["../../src/layouts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAiB,WAAW,EAAE,MAAM,SAAS,CAAC;AAG5D,IAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;AAEnC;IAaE,sBAAY,MAAY;QAXf,SAAI,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC;QAYrC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,CAAC,CAAC;QAC7C,IAAI,OAAO,IAAI,MAAM;YAAE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC7C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;SAC5B;QAED,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,E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utils\";\nimport { Cycle, CyclePosition, CycleCursor } from \"./cycle\";\n\ntype Fraction = TSU.Num.Fraction;\nconst ZERO = TSU.Num.Fraction.ZERO;\n\nexport class LayoutParams {\n private static counter = 0;\n readonly uuid = LayoutParams.counter++;\n beatDuration: number;\n cycle: Cycle;\n protected _lineBreaks: number[];\n private _rowStartOffsets: Fraction[];\n private _rowEndOffsets: Fraction[];\n private _rowDurations: Fraction[];\n private _totalLayoutDuration;\n private _beatLayouts: [CyclePosition, Fraction][][];\n private _totalBeats: number;\n\n constructor(config?: any) {\n config = config || {};\n this.beatDuration = config.beatDuration || 1;\n if (\"cycle\" in config) this.cycle = config.cycle;\n if (!this.cycle || this.cycle.duration.isZero) {\n this.cycle = Cycle.DEFAULT;\n }\n\n this._rowStartOffsets = [];\n this._rowEndOffsets = [];\n this._rowDurations = [];\n this._totalLayoutDuration = ZERO;\n this._totalBeats = 0;\n this._beatLayouts = [];\n this.lineBreaks = config.lineBreaks || config.layout || [];\n }\n\n equals(another: this): boolean {\n return (\n // super.equals(another) &&\n this.beatDuration == another.beatDuration &&\n this.cycle.equals(another.cycle) &&\n this.lineBreaksEqual(another._lineBreaks)\n );\n }\n\n lineBreaksEqual(another: number[]): boolean {\n return this._lineBreaks.length == another.length && this._lineBreaks.every((x, i) => x == another[i]);\n }\n\n debugValue(): any {\n return {\n // ...super.debugValue(),\n cycle: this.cycle?.debugValue(),\n beatDuration: this.beatDuration,\n lineBreaks: this._lineBreaks,\n };\n }\n\n /**\n * Returns the \"location\" of a beat within a layout.\n *\n * Lines are broken into beats of notes (which can be changed) and those beats\n * are aligned as per the specs in the LayoutParams (breaks).\n *\n * This methods returns the triple: [layoutLine, layoutColumn, rowOffset]\n * where\n *\n * layoutLine: The particular line in the layout break spec this index falls in. Note\n * that since lines can start with negative offsets, we can even return a\n * layoutLine that is towards the end and then go back to 0, eg 4, 0, 1, 2, 3, 4 ...\n * layoutColumn: The column within the layoutLine line where this beat falls.\n * rowOffset: The note offset of the beat from the start of the row/line\n * (not from the start of the cycle).\n *\n * Note the beatIndex can also be negative so we can return a beat starting from before\n * the cycle starting point.\n *\n * To calculate the \"real\" line globally simply do:\n *\n * realLine = [Math.floor(beatIndex / this.totalBeats) + layoutLine;\n */\n getBeatLocation(beat: {\n index: number;\n barIndex: number;\n beatIndex: number;\n instance: number;\n }): [number, number, Fraction] {\n const modIndex = beat.index % this.totalBeats;\n let total = 0;\n for (let i = 0; i < this._lineBreaks.length; i++) {\n if (modIndex < total + this._lineBreaks[i]) {\n // TODO: What is the right offset here?\n let offset = ZERO;\n const startBeat = beat;\n if (modIndex > total) {\n const cursor = new CycleCursor(this.cycle, beat.barIndex, beat.beatIndex, beat.instance);\n let [pos, duration] = cursor.prev;\n for (let i = total; i < modIndex; i++) {\n [pos, duration] = cursor.prev;\n offset = offset.plus(duration.timesNum(this.beatDuration));\n }\n }\n return [i, modIndex - total, offset];\n }\n total += this._lineBreaks[i];\n }\n throw new Error(\"Invalid beat index: \" + beat.index);\n return [-1, -1, ZERO];\n }\n\n /**\n * Return the line layout - ie number of beats in each line - as a\n * repeating pattern.\n *\n * For example 4,2,4 indicates that the notes in our song should be\n * laid out 4 beats in line 1, 2 beats in line 2, 4 beats in line 3 and\n * 4 beats in line 4 and so on as long as there are more notes available\n * in this line.\n */\n get lineBreaks(): number[] {\n if (!this._lineBreaks || this._lineBreaks.length == 0) {\n // trigger a refresh\n this.lineBreaks = [this.cycle.beatCount];\n }\n return this._lineBreaks;\n }\n\n /**\n * Sets the line layout pattern.\n */\n set lineBreaks(val: number[]) {\n this._lineBreaks = val;\n this.refreshLayout();\n }\n\n refreshLayout(): void {\n const cycleIter = this.cycle.iterateBeats();\n const akb = this.beatDuration;\n this._beatLayouts = this.lineBreaks.map((numBeats, index) => {\n const beats: [CyclePosition, Fraction][] = [];\n // see what the beat lengths are here\n for (let i = 0; i < numBeats; i++) {\n const nextCP = cycleIter.next().value;\n nextCP[1] = nextCP[1].timesNum(akb);\n beats.push(nextCP);\n }\n return beats;\n });\n this._totalBeats = this.lineBreaks.reduce((a, b) => a + b, 0);\n this._rowDurations = this._beatLayouts.map((beats) => beats.reduce((x, y) => x.plus(y[1]), ZERO));\n this._rowDurations.forEach((rd, index) => {\n this._rowStartOffsets[index] = index == 0 ? ZERO : this._rowStartOffsets[index - 1].plus(rd);\n });\n this._rowEndOffsets = this._rowDurations.map((rd, index) => {\n return this._rowStartOffsets[index].plus(rd);\n });\n this._totalLayoutDuration = this._rowDurations.reduce((x, y) => x.plus(y), ZERO);\n }\n\n /**\n * Returns the number of beats in each line based on the line layout\n * after taking beatDuration into account.\n */\n get beatLayouts(): ReadonlyArray<ReadonlyArray<[CyclePosition, Fraction]>> {\n if (!this._beatLayouts || this._beatLayouts.length < this.lineBreaks.length) {\n this.refreshLayout();\n }\n return this._beatLayouts;\n }\n\n /**\n * Total duration of all beats across all lines in our line layout.\n */\n get totalBeats(): number {\n this.beatLayouts;\n return this._totalBeats;\n }\n\n /**\n * Total duration of all beats across all lines in our line layout.\n */\n get totalLayoutDuration(): Fraction {\n this.beatLayouts;\n return this._totalLayoutDuration;\n }\n\n /*\n layoutOffsetsFor(offset: Fraction, layoutLine = -1): [number, Fraction] {\n const m1 = offset.mod(this.totalLayoutDuration);\n\n // layoutLine = L such that layout[L].startOffset <= atom.offset % totalLayoutDuration < layout[L].endOffset\n // calculate layoutLine if not provided\n if (layoutLine < 0) {\n // this.beatLayouts should kick off eval of all row offsets, durations etc\n for (let i = 0; i < this.beatLayouts.length; i++) {\n let cmp = this._rowStartOffsets[i].cmp(m1);\n if (cmp >= 0) {\n cmp = m1.cmp(this._rowEndOffsets[i]);\n if (cmp < 0) {\n layoutLine = i;\n break;\n }\n }\n }\n }\n if (layoutLine < 0) {\n throw new Error(\"Atom offset falls outside beat layout range: \" + offset.toString());\n }\n\n // offset = atom.offset % totalLayoutDuration - rowOffset[layoutLine]\n const layoutOffset = m1.minus(this._rowStartOffsets[layoutLine]);\n return [layoutLine, layoutOffset];\n }\n */\n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CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/F,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;YACzD,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACnF,CAAC;;AAxMc,oBAAO,GAAG,CAAC,CAAC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Cycle, CyclePosition, CycleCursor } from \"./cycle\";\n\ntype Fraction = TSU.Num.Fraction;\nconst ZERO = TSU.Num.Fraction.ZERO;\n\nexport class LayoutParams {\n private static counter = 0;\n readonly uuid = LayoutParams.counter++;\n beatDuration: number;\n cycle: Cycle;\n protected _lineBreaks: number[];\n private _rowStartOffsets: Fraction[];\n private _rowEndOffsets: Fraction[];\n private _rowDurations: Fraction[];\n private _totalLayoutDuration;\n private _beatLayouts: [CyclePosition, Fraction][][];\n private _totalBeats: number;\n\n constructor(config?: any) {\n config = config || {};\n this.beatDuration = config.beatDuration || 1;\n if (\"cycle\" in config) this.cycle = config.cycle;\n if (!this.cycle || this.cycle.duration.isZero) {\n this.cycle = Cycle.DEFAULT;\n }\n\n this._rowStartOffsets = [];\n this._rowEndOffsets = [];\n this._rowDurations = [];\n this._totalLayoutDuration = ZERO;\n this._totalBeats = 0;\n this._beatLayouts = [];\n this.lineBreaks = config.lineBreaks || config.layout || [];\n }\n\n equals(another: this): boolean {\n return (\n // super.equals(another) &&\n this.beatDuration == another.beatDuration &&\n this.cycle.equals(another.cycle) &&\n this.lineBreaksEqual(another._lineBreaks)\n );\n }\n\n lineBreaksEqual(another: number[]): boolean {\n return this._lineBreaks.length == another.length && this._lineBreaks.every((x, i) => x == another[i]);\n }\n\n debugValue(): any {\n return {\n // ...super.debugValue(),\n cycle: this.cycle?.debugValue(),\n beatDuration: this.beatDuration,\n lineBreaks: this._lineBreaks,\n };\n }\n\n /**\n * Returns the \"location\" of a beat within a layout.\n *\n * Lines are broken into beats of notes and those beats are aligned as per\n * the specs in the LayoutParams (breaks). For example if the breaks param\n * stipulates [5, 5, 4] then we have 5 beats in the first 2 lines and 4 in\n * the last line.\n *\n * If a line contains say 50 beats (B1 - B50), then it is laid out as:\n *\n * C1 C2 C3 C4 C5\n * ---------------------\n * L1 | B1 B2 B3 B4 B5\n * L1 | B6 B7 B8 B9 B10\n * L1 | B11 B12 B13 B14\n * L2 | B15 B16 B17 B18 B19\n * L2 | B20 B21 B22 B23 B24\n * L2 | B25 B26 B27 B28\n * L3 | B29 B30 B31 B32 B33\n * L3 | B34 B35 B36 B37 B38\n * L3 | B39 B40 B41 B42\n * L4 | B43 B44 B45 B46 B47\n * L4 | B48 B49 B50\n *\n * This methods returns the triple: [layoutLine, layoutColumn, rowOffset]\n * where\n *\n * layoutLine: The particular line in the layout break spec this index falls in.\n * *Note*: Since lines can start with negative offsets, we can\n * even return a layoutLine that is towards the end and then go\n * back to 0, eg 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4 ...\n * (eg returns L1 or L2 ... Ln)\n * layoutColumn: The column within the layoutLine line where this beat falls.\n * (eg C1 - C5 above - or depending on how many columns exist\n * in the particular layout line).\n * rowOffset: The note offset of the beat from the start of the row/line\n * (not from the start of the cycle).\n *\n * Note the beatIndex can also be negative so we can return a beat\n * starting from before the cycle starting point.\n *\n * To calculate the \"real\" line globally simply do:\n *\n * realLine = [Math.floor(beatIndex / this.totalBeats) + layoutLine;\n *\n * Some examples here are (using B1-B50 above):\n */\n getBeatLocation(beat: {\n index: number;\n barIndex: number;\n beatIndex: number;\n instance: number;\n }): [number, number, Fraction] {\n const modIndex = beat.index % this.totalBeats;\n let total = 0;\n for (let i = 0; i < this._lineBreaks.length; i++) {\n if (modIndex < total + this._lineBreaks[i]) {\n // TODO: What is the right offset here?\n let offset = ZERO;\n if (modIndex > total) {\n const cursor = new CycleCursor(this.cycle, beat.barIndex, beat.beatIndex, beat.instance);\n let [, duration] = cursor.prev;\n for (let i = total; i < modIndex; i++) {\n [, duration] = cursor.prev;\n offset = offset.plus(duration.timesNum(this.beatDuration));\n }\n }\n return [i, modIndex - total, offset];\n }\n total += this._lineBreaks[i];\n }\n throw new Error(\"Invalid beat index: \" + beat.index);\n return [-1, -1, ZERO];\n }\n\n /**\n * Return the line layout - ie number of beats in each line - as a\n * repeating pattern.\n *\n * For example 4,2,4 indicates that the notes in our song should be\n * laid out 4 beats in line 1, 2 beats in line 2, 4 beats in line 3 and\n * 4 beats in line 4 and so on as long as there are more notes available\n * in this line.\n */\n get lineBreaks(): number[] {\n if (!this._lineBreaks || this._lineBreaks.length == 0) {\n // trigger a refresh\n this.lineBreaks = [this.cycle.beatCount];\n }\n return this._lineBreaks;\n }\n\n /**\n * Sets the line layout pattern.\n */\n set lineBreaks(val: number[]) {\n this._lineBreaks = val;\n this.refreshLayout();\n }\n\n /**\n * Returns the number of beats in each line based on the line layout\n * after taking beatDuration into account.\n */\n get beatLayouts(): ReadonlyArray<ReadonlyArray<[CyclePosition, Fraction]>> {\n if (!this._beatLayouts || this._beatLayouts.length < this.lineBreaks.length) {\n this.refreshLayout();\n }\n return this._beatLayouts;\n }\n\n /**\n * Total duration of all beats across all lines in our line layout.\n */\n get totalBeats(): number {\n this.beatLayouts;\n return this._totalBeats;\n }\n\n /**\n * Total duration of all beats across all lines in our line layout.\n */\n get totalLayoutDuration(): Fraction {\n this.beatLayouts;\n return this._totalLayoutDuration;\n }\n\n protected refreshLayout(): void {\n const cycleIter = this.cycle.iterateBeats();\n const akb = this.beatDuration;\n this._beatLayouts = this.lineBreaks.map((numBeats, index) => {\n const beats: [CyclePosition, Fraction][] = [];\n // see what the beat lengths are here\n for (let i = 0; i < numBeats; i++) {\n const nextCP = cycleIter.next().value;\n nextCP[1] = nextCP[1].timesNum(akb);\n beats.push(nextCP);\n }\n return beats;\n });\n this._totalBeats = this.lineBreaks.reduce((a, b) => a + b, 0);\n this._rowDurations = this._beatLayouts.map((beats) => beats.reduce((x, y) => x.plus(y[1]), ZERO));\n this._rowDurations.forEach((rd, index) => {\n this._rowStartOffsets[index] = index == 0 ? ZERO : this._rowStartOffsets[index - 1].plus(rd);\n });\n this._rowEndOffsets = this._rowDurations.map((rd, index) => {\n return this._rowStartOffsets[index].plus(rd);\n });\n this._totalLayoutDuration = this._rowDurations.reduce((x, y) => x.plus(y), ZERO);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as TSU from "@panyam/tsutils";
2
2
  import * as G from "galore";
3
- import { BeatLayout, Beat } from "./beats";
3
+ import { GlobalBeatLayout } from "./beats";
4
4
  import { Notation } from "./notation";
5
5
  export declare function parse(input: string): [Notation, G.ParseError[]];
6
- export declare function load(codeText: string, config?: any): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[], TSU.StringMap<number>];
6
+ export declare function load(codeText: string, config?: any): [Notation, GlobalBeatLayout, G.ParseError[], TSU.StringMap<number>];
package/lib/esm/loader.js CHANGED
@@ -1,136 +1,36 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
- if (ar || !(i in from)) {
20
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
- ar[i] = from[i];
22
- }
23
- }
24
- return to.concat(ar || Array.prototype.slice.call(from));
25
- };
26
- var __values = (this && this.__values) || function(o) {
27
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
28
- if (m) return m.call(o);
29
- if (o && typeof o.length === "number") return {
30
- next: function () {
31
- if (o && i >= o.length) o = void 0;
32
- return { value: o && o[i++], done: !o };
33
- }
34
- };
35
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
36
- };
37
1
  import * as TSU from "@panyam/tsutils";
38
- import { BeatLayout, BeatsBuilder } from "./beats";
2
+ import { GlobalBeatLayout } from "./beats";
39
3
  import { Parser } from "./parser";
40
4
  import { Notation } from "./notation";
41
5
  export function parse(input) {
42
- var e_1, _a;
43
- var notation = new Notation();
44
- var parser = new Parser();
45
- var errors = [];
6
+ const notation = new Notation();
7
+ const parser = new Parser();
8
+ const errors = [];
46
9
  parser.parse(input);
47
- errors.push.apply(errors, __spreadArray([], __read(parser.errors), false));
48
- try {
49
- for (var _b = __values(parser.commands), _c = _b.next(); !_c.done; _c = _b.next()) {
50
- var cmd = _c.value;
51
- cmd.applyToNotation(notation);
52
- }
53
- }
54
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
55
- finally {
56
- try {
57
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
58
- }
59
- finally { if (e_1) throw e_1.error; }
60
- }
10
+ errors.push(...parser.errors);
11
+ for (const cmd of parser.commands)
12
+ cmd.applyToNotation(notation);
61
13
  return [notation, errors];
62
14
  }
63
- export function load(codeText, config) {
64
- var e_2, _a, e_3, _b, e_4, _c;
65
- if (config === void 0) { config = {}; }
66
- var beatsByLineRole = new Map();
67
- var beatLayouts = new Map();
68
- var startTime = performance.now();
69
- var _d = __read(parse(codeText), 2), notation = _d[0], errors = _d[1];
70
- var parseTime = performance.now();
71
- try {
72
- for (var _e = __values(notation.blocks), _f = _e.next(); !_f.done; _f = _e.next()) {
73
- var block = _f.value;
74
- if (block.type == "Line") {
75
- var line = block;
76
- var layoutParams = notation.layoutParamsForLine(line) || null;
77
- if (!line.isEmpty) {
78
- TSU.assert(layoutParams != null, "Layout params for a non empty line *should* exist");
79
- var beatLayout = beatLayouts.get(layoutParams.uuid) || null;
80
- if (beatLayout == null) {
81
- beatLayout = new BeatLayout(layoutParams);
82
- beatLayouts.set(layoutParams.uuid, beatLayout);
83
- }
84
- var roleBeats = [];
85
- beatsByLineRole.set(line.uuid, roleBeats);
86
- var lineOffset = line.offset.divbyNum(layoutParams.beatDuration);
87
- try {
88
- for (var _g = (e_3 = void 0, __values(line.roles)), _h = _g.next(); !_h.done; _h = _g.next()) {
89
- var role = _h.value;
90
- var bb = new BeatsBuilder(role, layoutParams, lineOffset);
91
- bb.addAtoms.apply(bb, __spreadArray([], __read(role.atoms), false));
92
- roleBeats.push(bb.beats);
93
- try {
94
- for (var _j = (e_4 = void 0, __values(bb.beats)), _k = _j.next(); !_k.done; _k = _j.next()) {
95
- var beat = _k.value;
96
- beatLayout.addBeat(beat);
97
- }
98
- }
99
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
100
- finally {
101
- try {
102
- if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
103
- }
104
- finally { if (e_4) throw e_4.error; }
105
- }
106
- }
107
- }
108
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
109
- finally {
110
- try {
111
- if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
112
- }
113
- finally { if (e_3) throw e_3.error; }
114
- }
115
- }
116
- }
117
- }
118
- }
119
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
120
- finally {
121
- try {
122
- if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
15
+ export function load(codeText, config = {}) {
16
+ const beatLayout = new GlobalBeatLayout();
17
+ const startTime = performance.now();
18
+ const [notation, errors] = parse(codeText);
19
+ const parseTime = performance.now();
20
+ for (const block of notation.blocks) {
21
+ if (block.type == "Line" && !block.isEmpty) {
22
+ const line = block;
23
+ TSU.assert(line.layoutParams != null, "Layout params for a non empty line *SHOULD* exist");
24
+ beatLayout.addLine(line);
123
25
  }
124
- finally { if (e_2) throw e_2.error; }
125
26
  }
126
- var buildTime = performance.now();
27
+ const buildTime = performance.now();
127
28
  if (config.log) {
128
- console.log("V4 Document, Parse Time: ".concat(parseTime - startTime, "ms, Build Time: ").concat(buildTime - parseTime, "ms"));
29
+ console.log(`V4 Document, Parse Time: ${parseTime - startTime}ms, Build Time: ${buildTime - parseTime}ms`);
129
30
  }
130
31
  return [
131
32
  notation,
132
- beatsByLineRole,
133
- beatLayouts,
33
+ beatLayout,
134
34
  errors,
135
35
  {
136
36
  parseTime: parseTime - startTime,
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAQ,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,KAAK,CAAC,KAAa;;IACjC,IAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,IAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,IAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,CAAC,IAAI,OAAX,MAAM,2BAAS,MAAM,CAAC,MAAM,WAAE;;QAC9B,KAAkB,IAAA,KAAA,SAAA,MAAM,CAAC,QAAQ,CAAA,gBAAA;YAA5B,IAAM,GAAG,WAAA;YAAqB,GAAG,CAAC,eAAe,CAAC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AE,SAAS,CAAC,CAAC;oBAE1C,IAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;;wBACnE,KAAmB,IAAA,oBAAA,SAAA,IAAI,CAAC,KAAK,CAAA,CAAA,gBAAA,4BAAE;4BAA1B,IAAM,IAAI,WAAA;4BACb,IAAM,EAAE,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;4BAC5D,EAAE,CAAC,QAAQ,OAAX,EAAE,2BAAa,IAAI,CAAC,KAAK,WAAE;4BAC3B,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;;gCAGzB,KAAmB,IAAA,oBAAA,SAAA,EAAE,CAAC,KAAK,CAAA,CAAA,gBAAA,4BAAE;oCAAxB,IAAM,IAAI,WAAA;oCAEb,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iCAC1B;;;;;;;;;yBACF;;;;;;;;;iBACF;aACF;SACF;;;;;;;;;IACD,IAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACpC,IAAI,MAAM,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,mCAA4B,SAAS,GAAG,SAAS,6BAAmB,SAAS,GAAG,SAAS,OAAI,CAAC,CAAC;KAC5G;IACD,OAAO;QACL,QAAQ;QACR,eAAe;QACf,WAAW;QACX,MAAM;QACN;YACE,SAAS,EAAE,SAAS,GAAG,SAAS;YAChC,SAAS,EAAE,SAAS,GAAG,SAAS;SACjC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport * as G from \"galore\";\nimport { Line } from \"./core\";\nimport { BeatLayout, Beat, BeatsBuilder } from \"./beats\";\nimport { Parser } from \"./parser\";\nimport { Notation } from \"./notation\";\n\nexport function parse(input: string): [Notation, G.ParseError[]] {\n const notation = new Notation();\n const parser = new Parser();\n const errors: G.ParseError[] = [];\n parser.parse(input);\n errors.push(...parser.errors);\n for (const cmd of parser.commands) cmd.applyToNotation(notation);\n return [notation, errors];\n}\n\nexport function load(\n codeText: string,\n config: any = {},\n): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[], TSU.StringMap<number>] {\n const beatsByLineRole = new Map<number, Beat[][]>();\n const beatLayouts = new Map<number, BeatLayout>();\n const startTime = performance.now();\n const [notation, errors] = parse(codeText);\n const parseTime = performance.now();\n\n // Create Line Beats\n for (const block of notation.blocks) {\n if (block.type == \"Line\") {\n const line = block as Line;\n // LP should exist by now\n const layoutParams = notation.layoutParamsForLine(line) || null;\n if (!line.isEmpty) {\n // Probably because this is an empty line and AddAtoms was not called\n TSU.assert(layoutParams != null, \"Layout params for a non empty line *should* exist\");\n let beatLayout = beatLayouts.get(layoutParams.uuid) || null;\n if (beatLayout == null) {\n beatLayout = new BeatLayout(layoutParams);\n beatLayouts.set(layoutParams.uuid, beatLayout);\n }\n const roleBeats = [] as Beat[][];\n beatsByLineRole.set(line.uuid, roleBeats);\n\n const lineOffset = line.offset.divbyNum(layoutParams.beatDuration);\n for (const role of line.roles) {\n const bb = new BeatsBuilder(role, layoutParams, lineOffset);\n bb.addAtoms(...role.atoms);\n roleBeats.push(bb.beats);\n\n // Add these to the beat layout too\n for (const beat of bb.beats) {\n // beat.ensureUniformSpaces(layoutParams.beatDuration);\n beatLayout.addBeat(beat);\n }\n }\n }\n }\n }\n const buildTime = performance.now();\n if (config.log) {\n console.log(`V4 Document, Parse Time: ${parseTime - startTime}ms, Build Time: ${buildTime - parseTime}ms`);\n }\n return [\n notation,\n beatsByLineRole,\n beatLayouts,\n errors,\n {\n parseTime: parseTime - startTime,\n buildTime: buildTime - parseTime,\n },\n ];\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,gBA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AAG,EAAE,CAAC;IACpC,IAAI,MAAM,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,4BAA4B,SAAS,GAAG,SAAS,mBAAmB,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC;KAC5G;IACD,OAAO;QACL,QAAQ;QACR,UAAU;QACV,MAAM;QACN;YACE,SAAS,EAAE,SAAS,GAAG,SAAS;YAChC,SAAS,EAAE,SAAS,GAAG,SAAS;SACjC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport * as G from \"galore\";\nimport { Line } from \"./core\";\nimport { GlobalBeatLayout } from \"./beats\";\nimport { Parser } from \"./parser\";\nimport { Notation } from \"./notation\";\n\nexport function parse(input: string): [Notation, G.ParseError[]] {\n const notation = new Notation();\n const parser = new Parser();\n const errors: G.ParseError[] = [];\n parser.parse(input);\n errors.push(...parser.errors);\n for (const cmd of parser.commands) cmd.applyToNotation(notation);\n return [notation, errors];\n}\n\nexport function load(\n codeText: string,\n config: any = {},\n): [Notation, GlobalBeatLayout, G.ParseError[], TSU.StringMap<number>] {\n const beatLayout = new GlobalBeatLayout();\n const startTime = performance.now();\n const [notation, errors] = parse(codeText);\n const parseTime = performance.now();\n\n // Create Line Beats\n for (const block of notation.blocks) {\n if (block.type == \"Line\" && !(block as Line).isEmpty) {\n const line = block as Line;\n // LP should exist by now\n // Probably because this is an empty line and AddAtoms was not called\n TSU.assert(line.layoutParams != null, \"Layout params for a non empty line *SHOULD* exist\");\n beatLayout.addLine(line);\n }\n }\n\n const buildTime = performance.now();\n if (config.log) {\n console.log(`V4 Document, Parse Time: ${parseTime - startTime}ms, Build Time: ${buildTime - parseTime}ms`);\n }\n return [\n notation,\n beatLayout,\n errors,\n {\n parseTime: parseTime - startTime,\n buildTime: buildTime - parseTime,\n },\n ];\n}\n"]}
@@ -45,14 +45,11 @@ export declare class Notation extends Entity {
45
45
  private _currRoleDef;
46
46
  roles: RoleDef[];
47
47
  blocks: (Line | RawBlock)[];
48
- private lpsForLine;
49
48
  currentAPB: number;
50
49
  currentCycle: Cycle;
51
50
  currentBreaks: number[];
52
51
  metadata: Map<string, MetaData>;
53
52
  onMissingRole: (name: string) => RoleDef | null;
54
- layoutParamsForLine(line: Line): null | LayoutParams;
55
- setLayoutParamsForLine(line: Line, layoutParams: LayoutParams): void;
56
53
  get unnamedLayoutParams(): ReadonlyArray<LayoutParams>;
57
54
  get namedLayoutParams(): ReadonlyMap<string, LayoutParams>;
58
55
  get type(): unknown;