notations 0.0.48 → 0.0.51
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/cjs/beats.d.ts +36 -71
- package/lib/cjs/beats.js +225 -432
- package/lib/cjs/beats.js.map +1 -1
- package/lib/cjs/beatutils.d.ts +3 -0
- package/lib/cjs/beatutils.js +64 -0
- package/lib/cjs/beatutils.js.map +1 -0
- package/lib/cjs/beatview.d.ts +18 -0
- package/lib/cjs/beatview.js +62 -0
- package/lib/cjs/beatview.js.map +1 -0
- package/lib/cjs/carnatic/LineView.d.ts +2 -7
- package/lib/cjs/carnatic/LineView.js +13 -31
- package/lib/cjs/carnatic/LineView.js.map +1 -1
- package/lib/cjs/carnatic/NotationView.d.ts +9 -7
- package/lib/cjs/carnatic/NotationView.js +90 -153
- package/lib/cjs/carnatic/NotationView.js.map +1 -1
- package/lib/cjs/carnatic/atomviews.js +149 -287
- package/lib/cjs/carnatic/atomviews.js.map +1 -1
- package/lib/cjs/carnatic/beatviews.d.ts +18 -10
- package/lib/cjs/carnatic/beatviews.js +59 -91
- package/lib/cjs/carnatic/beatviews.js.map +1 -1
- package/lib/cjs/carnatic/embelishments.d.ts +1 -1
- package/lib/cjs/carnatic/embelishments.js +189 -283
- package/lib/cjs/carnatic/embelishments.js.map +1 -1
- package/lib/cjs/carnatic/gamakas.js +15 -47
- package/lib/cjs/carnatic/gamakas.js.map +1 -1
- package/lib/cjs/commands.js +111 -271
- package/lib/cjs/commands.js.map +1 -1
- package/lib/cjs/core.d.ts +6 -1
- package/lib/cjs/core.js +288 -493
- package/lib/cjs/core.js.map +1 -1
- package/lib/cjs/cycle.js +175 -367
- package/lib/cjs/cycle.js.map +1 -1
- package/lib/cjs/entity.js +48 -102
- package/lib/cjs/entity.js.map +1 -1
- package/lib/cjs/grids.d.ts +124 -1
- package/lib/cjs/grids.js +546 -6
- package/lib/cjs/grids.js.map +1 -1
- package/lib/cjs/iterators.js +96 -234
- package/lib/cjs/iterators.js.map +1 -1
- package/lib/cjs/layouts.d.ts +1 -1
- package/lib/cjs/layouts.js +62 -98
- package/lib/cjs/layouts.js.map +1 -1
- package/lib/cjs/loader.d.ts +2 -2
- package/lib/cjs/loader.js +23 -123
- package/lib/cjs/loader.js.map +1 -1
- package/lib/cjs/notation.d.ts +0 -3
- package/lib/cjs/notation.js +139 -241
- package/lib/cjs/notation.js.map +1 -1
- package/lib/cjs/parser.d.ts +2 -0
- package/lib/cjs/parser.js +222 -219
- package/lib/cjs/parser.js.map +1 -1
- package/lib/cjs/shapes.js +149 -283
- package/lib/cjs/shapes.js.map +1 -1
- package/lib/cjs/utils.d.ts +8 -0
- package/lib/cjs/utils.js +60 -55
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/beats.d.ts +36 -71
- package/lib/esm/beats.js +218 -430
- package/lib/esm/beats.js.map +1 -1
- package/lib/esm/beatutils.d.ts +3 -0
- package/lib/esm/beatutils.js +37 -0
- package/lib/esm/beatutils.js.map +1 -0
- package/lib/esm/beatview.d.ts +18 -0
- package/lib/esm/beatview.js +35 -0
- package/lib/esm/beatview.js.map +1 -0
- package/lib/esm/carnatic/LineView.d.ts +2 -7
- package/lib/esm/carnatic/LineView.js +12 -31
- package/lib/esm/carnatic/LineView.js.map +1 -1
- package/lib/esm/carnatic/NotationView.d.ts +9 -7
- package/lib/esm/carnatic/NotationView.js +88 -152
- package/lib/esm/carnatic/NotationView.js.map +1 -1
- package/lib/esm/carnatic/atomviews.js +144 -284
- package/lib/esm/carnatic/atomviews.js.map +1 -1
- package/lib/esm/carnatic/beatviews.d.ts +18 -10
- package/lib/esm/carnatic/beatviews.js +53 -87
- package/lib/esm/carnatic/beatviews.js.map +1 -1
- package/lib/esm/carnatic/embelishments.d.ts +1 -1
- package/lib/esm/carnatic/embelishments.js +187 -296
- package/lib/esm/carnatic/embelishments.js.map +1 -1
- package/lib/esm/carnatic/gamakas.js +14 -48
- package/lib/esm/carnatic/gamakas.js.map +1 -1
- package/lib/esm/commands.js +100 -271
- package/lib/esm/commands.js.map +1 -1
- package/lib/esm/core.d.ts +6 -1
- package/lib/esm/core.js +286 -502
- package/lib/esm/core.js.map +1 -1
- package/lib/esm/cycle.js +172 -367
- package/lib/esm/cycle.js.map +1 -1
- package/lib/esm/entity.js +48 -104
- package/lib/esm/entity.js.map +1 -1
- package/lib/esm/grids.d.ts +124 -1
- package/lib/esm/grids.js +515 -5
- package/lib/esm/grids.js.map +1 -1
- package/lib/esm/iterators.js +93 -235
- package/lib/esm/iterators.js.map +1 -1
- package/lib/esm/layouts.d.ts +1 -1
- package/lib/esm/layouts.js +60 -97
- package/lib/esm/layouts.js.map +1 -1
- package/lib/esm/loader.d.ts +2 -2
- package/lib/esm/loader.js +20 -120
- package/lib/esm/loader.js.map +1 -1
- package/lib/esm/notation.d.ts +0 -3
- package/lib/esm/notation.js +135 -242
- package/lib/esm/notation.js.map +1 -1
- package/lib/esm/parser.d.ts +2 -0
- package/lib/esm/parser.js +216 -214
- package/lib/esm/parser.js.map +1 -1
- package/lib/esm/shapes.js +148 -288
- package/lib/esm/shapes.js.map +1 -1
- package/lib/esm/utils.d.ts +8 -0
- package/lib/esm/utils.js +55 -51
- package/lib/esm/utils.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Embelishment } from "../shapes";
|
|
2
|
+
import { GridCell, GridCellView } from "../grids";
|
|
3
|
+
import { ElementShape } from "../shapes";
|
|
4
|
+
import { Marker } from "../core";
|
|
5
|
+
import { Beat } from "../beats";
|
|
6
|
+
import { BeatView as BeatViewBase } from "../beatview";
|
|
7
|
+
export declare class MarkerView extends ElementShape<SVGGElement> implements GridCellView {
|
|
8
|
+
readonly cell: GridCell;
|
|
5
9
|
readonly beat: Beat;
|
|
10
|
+
readonly markers: Marker[];
|
|
11
|
+
readonly isPreMarker: boolean;
|
|
6
12
|
readonly rootElement: SVGGraphicsElement;
|
|
7
|
-
readonly cycle: Cycle;
|
|
8
|
-
private _embelishments;
|
|
9
|
-
atomView: AtomView;
|
|
10
13
|
needsLayout: boolean;
|
|
11
|
-
|
|
14
|
+
rootGroup: SVGGElement;
|
|
15
|
+
textElement: SVGTextElement;
|
|
16
|
+
constructor(cell: GridCell, beat: Beat, markers: Marker[], isPreMarker: boolean, rootElement: SVGGraphicsElement, config?: any);
|
|
17
|
+
refreshLayout(): void;
|
|
18
|
+
protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
|
|
19
|
+
}
|
|
20
|
+
export declare class BeatView extends BeatViewBase {
|
|
21
|
+
createAtomView(): import("../shapes").AtomView;
|
|
12
22
|
refreshLayout(): void;
|
|
13
|
-
get embelishments(): Embelishment[];
|
|
14
23
|
protected createEmbelishments(): Embelishment[];
|
|
15
|
-
setStyles(config: any): void;
|
|
16
24
|
}
|
|
@@ -1,117 +1,83 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __values = (this && this.__values) || function(o) {
|
|
17
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
18
|
-
if (m) return m.call(o);
|
|
19
|
-
if (o && typeof o.length === "number") return {
|
|
20
|
-
next: function () {
|
|
21
|
-
if (o && i >= o.length) o = void 0;
|
|
22
|
-
return { value: o && o[i++], done: !o };
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
26
|
-
};
|
|
27
1
|
import * as TSU from "@panyam/tsutils";
|
|
28
2
|
import { ElementShape } from "../shapes";
|
|
29
3
|
import { createAtomView } from "./atomviews";
|
|
4
|
+
import { BeatView as BeatViewBase } from "../beatview";
|
|
30
5
|
import { BeatStartLines, BeatEndLines } from "./embelishments";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var _this = _super.call(this, TSU.DOM.createSVGNode("g", {
|
|
6
|
+
export class MarkerView extends ElementShape {
|
|
7
|
+
constructor(cell, beat, markers, isPreMarker, rootElement, config) {
|
|
8
|
+
const rootGroup = TSU.DOM.createSVGNode("g", {
|
|
35
9
|
parent: rootElement,
|
|
36
10
|
attrs: {
|
|
37
|
-
class: "
|
|
38
|
-
|
|
39
|
-
id: "" + beat.uuid,
|
|
11
|
+
class: "markerView",
|
|
12
|
+
pre: isPreMarker,
|
|
40
13
|
roleName: beat.role.name,
|
|
41
|
-
layoutLine: "" + beat.layoutLine,
|
|
42
|
-
layoutColumn: "" + beat.layoutColumn,
|
|
43
14
|
beatIndex: "" + beat.index,
|
|
15
|
+
gridRow: cell.rowIndex,
|
|
16
|
+
gridCol: cell.colIndex,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
super(rootGroup);
|
|
20
|
+
this.cell = cell;
|
|
21
|
+
this.beat = beat;
|
|
22
|
+
this.markers = markers;
|
|
23
|
+
this.isPreMarker = isPreMarker;
|
|
24
|
+
this.rootElement = rootElement;
|
|
25
|
+
this.needsLayout = true;
|
|
26
|
+
this.rootGroup = rootGroup;
|
|
27
|
+
this.textElement = TSU.DOM.createSVGNode("text", {
|
|
28
|
+
parent: rootGroup,
|
|
29
|
+
attrs: {
|
|
30
|
+
class: "markerText",
|
|
31
|
+
pre: isPreMarker,
|
|
44
32
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_this.rootElement = rootElement;
|
|
48
|
-
_this.cycle = cycle;
|
|
49
|
-
_this.needsLayout = true;
|
|
50
|
-
_this.atomView = createAtomView(_this.element, beat.atom, beat.role.defaultToNotes);
|
|
51
|
-
_this.atomView.refreshLayout();
|
|
52
|
-
return _this;
|
|
33
|
+
text: this.markers[0].text,
|
|
34
|
+
});
|
|
53
35
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
36
|
+
refreshLayout() {
|
|
37
|
+
this.rootGroup.setAttribute("transform", "translate(" + this.x + "," + this.y + ")");
|
|
38
|
+
}
|
|
39
|
+
updateBounds(x, y, w, h) {
|
|
40
|
+
return [x, y, NaN, NaN];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class BeatView extends BeatViewBase {
|
|
44
|
+
createAtomView() {
|
|
45
|
+
return createAtomView(this.element, this.beat.atom, this.beat.role.defaultToNotes);
|
|
46
|
+
}
|
|
47
|
+
refreshLayout() {
|
|
48
|
+
const newX = this.hasX ? this._x : 0;
|
|
49
|
+
const newY = this.hasY ? this._y : 0;
|
|
58
50
|
this.element.setAttribute("transform", "translate(" + newX + "," + newY + ")");
|
|
59
51
|
this.invalidateBounds();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var e = _c.value;
|
|
63
|
-
e.refreshLayout();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
67
|
-
finally {
|
|
68
|
-
try {
|
|
69
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
70
|
-
}
|
|
71
|
-
finally { if (e_1) throw e_1.error; }
|
|
72
|
-
}
|
|
52
|
+
for (const e of this.embelishments)
|
|
53
|
+
e.refreshLayout();
|
|
73
54
|
this.invalidateBounds();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
return this._embelishments;
|
|
81
|
-
},
|
|
82
|
-
enumerable: false,
|
|
83
|
-
configurable: true
|
|
84
|
-
});
|
|
85
|
-
BeatView.prototype.createEmbelishments = function () {
|
|
86
|
-
var embelishments = [];
|
|
87
|
-
var beat = this.beat;
|
|
88
|
-
var rootElement = this.rootElement;
|
|
55
|
+
}
|
|
56
|
+
createEmbelishments() {
|
|
57
|
+
let embelishments = [];
|
|
58
|
+
const beat = this.beat;
|
|
59
|
+
const rootElement = this.rootElement;
|
|
89
60
|
if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {
|
|
90
|
-
|
|
61
|
+
const emb = new BeatStartLines(this, rootElement);
|
|
91
62
|
embelishments = [emb];
|
|
92
63
|
}
|
|
93
64
|
else {
|
|
94
|
-
|
|
95
|
-
|
|
65
|
+
const cycle = this.cycle;
|
|
66
|
+
const bar = cycle.bars[beat.barIndex];
|
|
96
67
|
if (beat.beatIndex == bar.beatCount - 1) {
|
|
97
68
|
if (beat.instance == bar.instanceCount(beat.beatIndex) - 1) {
|
|
98
69
|
if (beat.barIndex == cycle.bars.length - 1) {
|
|
99
|
-
|
|
70
|
+
const emb = new BeatEndLines(this, rootElement, 2);
|
|
100
71
|
embelishments = [emb];
|
|
101
72
|
}
|
|
102
73
|
else {
|
|
103
|
-
|
|
74
|
+
const emb = new BeatEndLines(this, rootElement);
|
|
104
75
|
embelishments = [emb];
|
|
105
76
|
}
|
|
106
77
|
}
|
|
107
78
|
}
|
|
108
79
|
}
|
|
109
80
|
return embelishments;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this.needsLayout = true;
|
|
113
|
-
};
|
|
114
|
-
return BeatView;
|
|
115
|
-
}(ElementShape));
|
|
116
|
-
export { BeatView };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
117
83
|
//# sourceMappingURL=beatviews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beatviews.js","sourceRoot":"","sources":["../../../src/carnatic/beatviews.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"beatviews.js","sourceRoot":"","sources":["../../../src/carnatic/beatviews.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,OAAO,UAAW,SAAQ,YAAyB;IAIvD,YACkB,IAAc,EACd,IAAU,EACV,OAAiB,EACjB,WAAoB,EACpB,WAA+B,EAC/C,MAAY;QAEZ,MAAM,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE;YAC3C,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE;gBACL,KAAK,EAAE,YAAY;gBACnB,GAAG,EAAE,WAAW;gBAChB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;gBACxB,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK;gBAC1B,OAAO,EAAE,IAAI,CAAC,QAAQ;gBACtB,OAAO,EAAE,IAAI,CAAC,QAAQ;aACvB;SACF,CAAC,CAAC;QACH,KAAK,CAAC,SAAS,CAAC,CAAC;QAlBD,SAAI,GAAJ,IAAI,CAAU;QACd,SAAI,GAAJ,IAAI,CAAM;QACV,YAAO,GAAP,OAAO,CAAU;QACjB,gBAAW,GAAX,WAAW,CAAS;QACpB,gBAAW,GAAX,WAAW,CAAoB;QARjD,gBAAW,GAAG,IAAI,CAAC;QAuBjB,IAAI,CAAC,SAAS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as TSU from \"@panyam/tsutils\";\nimport { Embelishment } from \"../shapes\";\nimport { GridCell, GridCellView } from \"../grids\";\nimport { ElementShape } from \"../shapes\";\nimport { createAtomView } from \"./atomviews\";\nimport { Marker } from \"../core\";\nimport { Beat } from \"../beats\";\nimport { BeatView as BeatViewBase } from \"../beatview\";\nimport { BeatStartLines, BeatEndLines } from \"./embelishments\";\n\nexport class MarkerView extends ElementShape<SVGGElement> implements GridCellView {\n needsLayout = true;\n rootGroup: SVGGElement;\n textElement: SVGTextElement;\n constructor(\n public readonly cell: GridCell,\n public readonly beat: Beat,\n public readonly markers: Marker[],\n public readonly isPreMarker: boolean,\n public readonly rootElement: SVGGraphicsElement,\n config?: any,\n ) {\n const rootGroup = TSU.DOM.createSVGNode(\"g\", {\n parent: rootElement,\n attrs: {\n class: \"markerView\",\n pre: isPreMarker,\n roleName: beat.role.name,\n beatIndex: \"\" + beat.index,\n gridRow: cell.rowIndex,\n gridCol: cell.colIndex,\n },\n });\n super(rootGroup);\n this.rootGroup = rootGroup as SVGGElement;\n this.textElement = TSU.DOM.createSVGNode(\"text\", {\n parent: rootGroup,\n attrs: {\n class: \"markerText\",\n pre: isPreMarker,\n },\n text: this.markers[0].text,\n });\n }\n\n refreshLayout(): void {\n // TODO - move this code out to refreshLayout?\n // set the glyphs Y first so we can layout others\n this.rootGroup.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, NaN, NaN];\n }\n}\n\nexport class BeatView extends BeatViewBase {\n createAtomView() {\n return createAtomView(this.element, this.beat.atom, this.beat.role.defaultToNotes);\n }\n\n refreshLayout(): void {\n const newX = this.hasX ? this._x : 0;\n const newY = this.hasY ? this._y : 0;\n this.element.setAttribute(\"transform\", \"translate(\" + newX + \",\" + newY + \")\");\n this.invalidateBounds();\n for (const e of this.embelishments) e.refreshLayout();\n this.invalidateBounds();\n }\n\n protected createEmbelishments(): Embelishment[] {\n let embelishments: Embelishment[] = [];\n const beat = this.beat;\n // TODO - Should this be the group's parent element?\n const rootElement = this.rootElement;\n if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {\n // first beat in bar - Do a BarStart\n const emb = new BeatStartLines(this, rootElement);\n embelishments = [emb];\n } else {\n const cycle = this.cycle;\n const bar = cycle.bars[beat.barIndex];\n if (beat.beatIndex == bar.beatCount - 1) {\n // It is important that we are not just looking at the last beat of the bar\n // but also in the last \"instance\" of the beat in this bar to account for\n // kalais\n if (beat.instance == bar.instanceCount(beat.beatIndex) - 1) {\n if (beat.barIndex == cycle.bars.length - 1) {\n // last beat in last bar so - do a thalam end (2 lines)\n const emb = new BeatEndLines(this, rootElement, 2);\n embelishments = [emb];\n } else {\n // end of a bar so single line end\n const emb = new BeatEndLines(this, rootElement);\n embelishments = [emb];\n }\n }\n }\n }\n return embelishments;\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as TSU from "@panyam/tsutils";
|
|
2
2
|
import { Note } from "../core";
|
|
3
|
-
import { BeatView } from "../
|
|
3
|
+
import { BeatView } from "../beatview";
|
|
4
4
|
import { Embelishment } from "../shapes";
|
|
5
5
|
import { LeafAtomView } from "./atomviews";
|
|
6
6
|
import { JaaruGamaka } from "./gamakas";
|