notations 0.0.40 → 0.0.45
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/README.md +38 -0
- package/lib/cjs/beats.d.ts +111 -0
- package/lib/cjs/beats.js +523 -0
- package/lib/cjs/beats.js.map +1 -0
- package/lib/cjs/carnatic/LineView.d.ts +20 -0
- package/lib/cjs/carnatic/LineView.js +69 -0
- package/lib/cjs/carnatic/LineView.js.map +1 -0
- package/lib/cjs/carnatic/NotationView.d.ts +31 -0
- package/lib/cjs/carnatic/NotationView.js +250 -0
- package/lib/cjs/carnatic/NotationView.js.map +1 -0
- package/lib/cjs/carnatic/atomviews.d.ts +14 -7
- package/lib/cjs/carnatic/atomviews.js +170 -137
- package/lib/cjs/carnatic/atomviews.js.map +1 -1
- package/lib/cjs/carnatic/beatviews.d.ts +10 -14
- package/lib/cjs/carnatic/beatviews.js +53 -108
- package/lib/cjs/carnatic/beatviews.js.map +1 -1
- package/lib/cjs/carnatic/embelishments.d.ts +38 -32
- package/lib/cjs/carnatic/embelishments.js +35 -20
- package/lib/cjs/carnatic/embelishments.js.map +1 -1
- package/lib/cjs/carnatic/index.d.ts +2 -0
- package/lib/cjs/carnatic/index.js +2 -0
- package/lib/cjs/carnatic/index.js.map +1 -1
- package/lib/cjs/core.d.ts +15 -73
- package/lib/cjs/core.js +200 -568
- package/lib/cjs/core.js.map +1 -1
- package/lib/cjs/cycle.d.ts +47 -0
- package/lib/cjs/cycle.js +492 -0
- package/lib/cjs/cycle.js.map +1 -0
- package/lib/cjs/entity.d.ts +24 -0
- package/lib/cjs/entity.js +135 -0
- package/lib/cjs/entity.js.map +1 -0
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.js +3 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/iterators.d.ts +14 -2
- package/lib/cjs/iterators.js +79 -7
- package/lib/cjs/iterators.js.map +1 -1
- package/lib/cjs/layouts.d.ts +7 -106
- package/lib/cjs/layouts.js +4 -478
- package/lib/cjs/layouts.js.map +1 -1
- package/lib/cjs/loader.d.ts +2 -1
- package/lib/cjs/loader.js +32 -27
- package/lib/cjs/loader.js.map +1 -1
- package/lib/cjs/notation.d.ts +3 -1
- package/lib/cjs/notation.js +6 -4
- package/lib/cjs/notation.js.map +1 -1
- package/lib/cjs/parser.js +6 -5
- package/lib/cjs/parser.js.map +1 -1
- package/lib/cjs/shapes.d.ts +35 -14
- package/lib/cjs/shapes.js +153 -43
- package/lib/cjs/shapes.js.map +1 -1
- package/lib/cjs/utils.d.ts +2 -1
- package/lib/cjs/utils.js +20 -8
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/beats.d.ts +111 -0
- package/lib/esm/beats.js +501 -0
- package/lib/esm/beats.js.map +1 -0
- package/lib/esm/carnatic/LineView.d.ts +20 -0
- package/lib/esm/carnatic/LineView.js +47 -0
- package/lib/esm/carnatic/LineView.js.map +1 -0
- package/lib/esm/carnatic/NotationView.d.ts +31 -0
- package/lib/esm/carnatic/NotationView.js +228 -0
- package/lib/esm/carnatic/NotationView.js.map +1 -0
- package/lib/esm/carnatic/atomviews.d.ts +14 -7
- package/lib/esm/carnatic/atomviews.js +170 -137
- package/lib/esm/carnatic/atomviews.js.map +1 -1
- package/lib/esm/carnatic/beatviews.d.ts +10 -14
- package/lib/esm/carnatic/beatviews.js +54 -109
- package/lib/esm/carnatic/beatviews.js.map +1 -1
- package/lib/esm/carnatic/embelishments.d.ts +38 -32
- package/lib/esm/carnatic/embelishments.js +34 -19
- package/lib/esm/carnatic/embelishments.js.map +1 -1
- package/lib/esm/carnatic/index.d.ts +2 -0
- package/lib/esm/carnatic/index.js +2 -0
- package/lib/esm/carnatic/index.js.map +1 -1
- package/lib/esm/core.d.ts +15 -73
- package/lib/esm/core.js +196 -564
- package/lib/esm/core.js.map +1 -1
- package/lib/esm/cycle.d.ts +47 -0
- package/lib/esm/cycle.js +470 -0
- package/lib/esm/cycle.js.map +1 -0
- package/lib/esm/entity.d.ts +24 -0
- package/lib/esm/entity.js +132 -0
- package/lib/esm/entity.js.map +1 -0
- package/lib/esm/index.d.ts +3 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/iterators.d.ts +14 -2
- package/lib/esm/iterators.js +75 -3
- package/lib/esm/iterators.js.map +1 -1
- package/lib/esm/layouts.d.ts +7 -106
- package/lib/esm/layouts.js +1 -475
- package/lib/esm/layouts.js.map +1 -1
- package/lib/esm/loader.d.ts +2 -1
- package/lib/esm/loader.js +28 -24
- package/lib/esm/loader.js.map +1 -1
- package/lib/esm/notation.d.ts +3 -1
- package/lib/esm/notation.js +3 -1
- package/lib/esm/notation.js.map +1 -1
- package/lib/esm/parser.js +6 -5
- package/lib/esm/parser.js.map +1 -1
- package/lib/esm/shapes.d.ts +35 -14
- package/lib/esm/shapes.js +152 -42
- package/lib/esm/shapes.js.map +1 -1
- package/lib/esm/utils.d.ts +2 -1
- package/lib/esm/utils.js +19 -7
- package/lib/esm/utils.js.map +1 -1
- package/package.json +33 -28
- package/styles/NotationView.scss +35 -0
|
@@ -25,148 +25,93 @@ var __values = (this && this.__values) || function(o) {
|
|
|
25
25
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
26
26
|
};
|
|
27
27
|
import * as TSU from "@panyam/tsutils";
|
|
28
|
-
import {
|
|
29
|
-
import { Shape } from "../shapes";
|
|
28
|
+
import { ElementShape } from "../shapes";
|
|
30
29
|
import { createAtomView } from "./atomviews";
|
|
31
30
|
import { BeatStartLines, BeatEndLines } from "./embelishments";
|
|
32
31
|
var BeatView = (function (_super) {
|
|
33
32
|
__extends(BeatView, _super);
|
|
34
33
|
function BeatView(beat, rootElement, cycle, config) {
|
|
35
|
-
var
|
|
36
|
-
var _this = _super.call(this) || this;
|
|
37
|
-
_this.beat = beat;
|
|
38
|
-
_this.cycle = cycle;
|
|
39
|
-
_this.needsLayout = true;
|
|
40
|
-
_this.atomViews = [];
|
|
41
|
-
_this.atomSpacing = 5;
|
|
42
|
-
_this.groupElement = TSU.DOM.createSVGNode("g", {
|
|
34
|
+
var _this = _super.call(this, TSU.DOM.createSVGNode("g", {
|
|
43
35
|
parent: rootElement,
|
|
44
36
|
attrs: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
layoutLine: beat.layoutLine,
|
|
49
|
-
layoutColumn: beat.layoutColumn,
|
|
50
|
-
beatIndex: beat.index,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
_this.textElement = TSU.DOM.createSVGNode("text", {
|
|
54
|
-
parent: _this.groupElement,
|
|
55
|
-
attrs: {
|
|
56
|
-
class: "roleAtomsText",
|
|
57
|
-
style: "dominant-baseline: hanging",
|
|
58
|
-
beatId: beat.uuid,
|
|
59
|
-
id: "beatText" + beat.uuid,
|
|
37
|
+
class: "beatView",
|
|
38
|
+
beatId: "" + beat.uuid,
|
|
39
|
+
id: "" + beat.uuid,
|
|
60
40
|
roleName: beat.role.name,
|
|
61
|
-
layoutLine: beat.layoutLine,
|
|
62
|
-
layoutColumn: beat.layoutColumn,
|
|
63
|
-
beatIndex: beat.index,
|
|
41
|
+
layoutLine: "" + beat.layoutLine,
|
|
42
|
+
layoutColumn: "" + beat.layoutColumn,
|
|
43
|
+
beatIndex: "" + beat.index,
|
|
64
44
|
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
flatAtom.atom = Note.fromLit(lit);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
flatAtom.atom = Syllable.fromLit(lit);
|
|
76
|
-
}
|
|
77
|
-
flatAtom.atom.beforeRest = lit.beforeRest;
|
|
78
|
-
}
|
|
79
|
-
var atomView = createAtomView(_this.textElement, flatAtom);
|
|
80
|
-
atomView.depth = flatAtom.depth;
|
|
81
|
-
_this.atomViews.push(atomView);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
85
|
-
finally {
|
|
86
|
-
try {
|
|
87
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
88
|
-
}
|
|
89
|
-
finally { if (e_1) throw e_1.error; }
|
|
90
|
-
}
|
|
91
|
-
_this.setStyles(config || {});
|
|
45
|
+
})) || this;
|
|
46
|
+
_this.beat = beat;
|
|
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();
|
|
92
52
|
return _this;
|
|
93
53
|
}
|
|
94
|
-
BeatView.prototype.refreshMinSize = function () {
|
|
95
|
-
var _this = this;
|
|
96
|
-
var totalWidth = 0;
|
|
97
|
-
var maxHeight = 0;
|
|
98
|
-
this.atomViews.forEach(function (av, index) {
|
|
99
|
-
var ms = av.minSize;
|
|
100
|
-
totalWidth += ms.width + _this.atomSpacing;
|
|
101
|
-
maxHeight = Math.max(maxHeight, ms.height);
|
|
102
|
-
});
|
|
103
|
-
return new TSU.Geom.Size(totalWidth, maxHeight);
|
|
104
|
-
};
|
|
105
|
-
BeatView.prototype.updateBounds = function (x, y, w, h) {
|
|
106
|
-
return [x, y, w, h];
|
|
107
|
-
};
|
|
108
|
-
BeatView.prototype.setStyles = function (config) {
|
|
109
|
-
if ("atomSpacing" in config)
|
|
110
|
-
this.atomSpacing = config.atomSpacing;
|
|
111
|
-
this.needsLayout = true;
|
|
112
|
-
};
|
|
113
54
|
BeatView.prototype.refreshLayout = function () {
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.atomViews.forEach(function (av, index) {
|
|
120
|
-
av.setBounds(currX, currY, null, null, true);
|
|
121
|
-
currX += _this.atomSpacing + av.minSize.width;
|
|
122
|
-
});
|
|
123
|
-
this.resetMinSize();
|
|
55
|
+
var e_1, _a;
|
|
56
|
+
var newX = this.hasX ? this._x : 0;
|
|
57
|
+
var newY = this.hasY ? this._y : 0;
|
|
58
|
+
this.element.setAttribute("transform", "translate(" + newX + "," + newY + ")");
|
|
59
|
+
this.invalidateBounds();
|
|
124
60
|
try {
|
|
125
61
|
for (var _b = __values(this.embelishments), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
126
62
|
var e = _c.value;
|
|
127
63
|
e.refreshLayout();
|
|
128
64
|
}
|
|
129
65
|
}
|
|
130
|
-
catch (
|
|
66
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
131
67
|
finally {
|
|
132
68
|
try {
|
|
133
69
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
134
70
|
}
|
|
135
|
-
finally { if (
|
|
71
|
+
finally { if (e_1) throw e_1.error; }
|
|
136
72
|
}
|
|
137
|
-
this.
|
|
73
|
+
this.invalidateBounds();
|
|
138
74
|
};
|
|
139
75
|
Object.defineProperty(BeatView.prototype, "embelishments", {
|
|
140
76
|
get: function () {
|
|
141
77
|
if (!this._embelishments) {
|
|
142
|
-
this._embelishments =
|
|
143
|
-
var beat = this.beat;
|
|
144
|
-
var rootElement = this.textElement.parentElement;
|
|
145
|
-
if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {
|
|
146
|
-
var emb = new BeatStartLines(this, rootElement);
|
|
147
|
-
this._embelishments = [emb];
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
var cycle = this.cycle;
|
|
151
|
-
var bar = cycle.bars[beat.barIndex];
|
|
152
|
-
if (beat.beatIndex == bar.beatCount - 1) {
|
|
153
|
-
if (beat.barIndex == cycle.bars.length - 1) {
|
|
154
|
-
var emb = new BeatEndLines(this, rootElement, 2);
|
|
155
|
-
this._embelishments = [emb];
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
var emb = new BeatEndLines(this, rootElement);
|
|
159
|
-
this._embelishments = [emb];
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
78
|
+
this._embelishments = this.createEmbelishments();
|
|
163
79
|
}
|
|
164
80
|
return this._embelishments;
|
|
165
81
|
},
|
|
166
82
|
enumerable: false,
|
|
167
83
|
configurable: true
|
|
168
84
|
});
|
|
85
|
+
BeatView.prototype.createEmbelishments = function () {
|
|
86
|
+
var embelishments = [];
|
|
87
|
+
var beat = this.beat;
|
|
88
|
+
var rootElement = this.rootElement;
|
|
89
|
+
if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {
|
|
90
|
+
var emb = new BeatStartLines(this, rootElement);
|
|
91
|
+
embelishments = [emb];
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
var cycle = this.cycle;
|
|
95
|
+
var bar = cycle.bars[beat.barIndex];
|
|
96
|
+
if (beat.beatIndex == bar.beatCount - 1) {
|
|
97
|
+
if (beat.instance == bar.instanceCount(beat.beatIndex) - 1) {
|
|
98
|
+
if (beat.barIndex == cycle.bars.length - 1) {
|
|
99
|
+
var emb = new BeatEndLines(this, rootElement, 2);
|
|
100
|
+
embelishments = [emb];
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
var emb = new BeatEndLines(this, rootElement);
|
|
104
|
+
embelishments = [emb];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return embelishments;
|
|
110
|
+
};
|
|
111
|
+
BeatView.prototype.setStyles = function (config) {
|
|
112
|
+
this.needsLayout = true;
|
|
113
|
+
};
|
|
169
114
|
return BeatView;
|
|
170
|
-
}(
|
|
115
|
+
}(ElementShape));
|
|
171
116
|
export { BeatView };
|
|
172
117
|
//# sourceMappingURL=beatviews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beatviews.js","sourceRoot":"","sources":["../../../src/carnatic/beatviews.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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AK,CAAC;YACzB,IAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE;gBAIvC,IAAI,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;oBAC1D,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;wBAE1C,IAAM,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;wBACnD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;yBAAM;wBAEL,IAAM,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;wBAChD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;iBACF;aACF;SACF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,4BAAS,GAAT,UAAU,MAAW;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IACH,eAAC;AAAD,CAAC,AA/ED,CAA8B,YAAY,GA+EzC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { AtomType } from \"../core\";\nimport { Cycle } from \"../cycle\";\nimport { BeatView as BeatViewBase, Beat } from \"../beats\";\nimport { AtomView, GroupView, Embelishment, ElementShape } from \"../shapes\";\nimport { createAtomView } from \"./atomviews\";\nimport { BeatStartLines, BeatEndLines } from \"./embelishments\";\n\nexport class BeatView extends ElementShape<SVGGElement> implements BeatViewBase {\n private _embelishments: Embelishment[];\n atomView: AtomView;\n needsLayout = true;\n constructor(\n public readonly beat: Beat,\n public readonly rootElement: SVGGraphicsElement,\n public readonly cycle: Cycle,\n config?: any,\n ) {\n super(\n TSU.DOM.createSVGNode(\"g\", {\n parent: rootElement,\n attrs: {\n class: \"beatView\",\n beatId: \"\" + beat.uuid,\n id: \"\" + beat.uuid,\n roleName: beat.role.name,\n layoutLine: \"\" + beat.layoutLine,\n layoutColumn: \"\" + beat.layoutColumn,\n beatIndex: \"\" + beat.index,\n },\n }),\n );\n this.atomView = createAtomView(this.element, beat.atom, beat.role.defaultToNotes);\n this.atomView.refreshLayout();\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 get embelishments(): Embelishment[] {\n if (!this._embelishments) {\n this._embelishments = this.createEmbelishments();\n }\n return this._embelishments;\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 setStyles(config: any): void {\n this.needsLayout = true;\n }\n}\n"]}
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import * as TSU from "@panyam/tsutils";
|
|
2
2
|
import { Note } from "../core";
|
|
3
|
-
import { BeatView } from "../
|
|
4
|
-
import {
|
|
3
|
+
import { BeatView } from "../beats";
|
|
4
|
+
import { Embelishment } from "../shapes";
|
|
5
|
+
import { LeafAtomView } from "./atomviews";
|
|
5
6
|
import { JaaruGamaka } from "./gamakas";
|
|
6
|
-
export declare abstract class
|
|
7
|
-
readonly atomView:
|
|
8
|
-
constructor(atomView:
|
|
7
|
+
export declare abstract class LeafAtomViewEmbelishment extends Embelishment {
|
|
8
|
+
readonly atomView: LeafAtomView;
|
|
9
|
+
constructor(atomView: LeafAtomView);
|
|
9
10
|
}
|
|
10
|
-
export declare class OctaveIndicator extends
|
|
11
|
-
readonly noteView:
|
|
11
|
+
export declare class OctaveIndicator extends LeafAtomViewEmbelishment {
|
|
12
|
+
readonly noteView: LeafAtomView;
|
|
12
13
|
readonly note: Note;
|
|
13
14
|
dotRadius: number;
|
|
14
15
|
dotSpacing: number;
|
|
15
16
|
dotsElem: SVGGElement;
|
|
16
|
-
constructor(noteView:
|
|
17
|
+
constructor(noteView: LeafAtomView, note: Note);
|
|
18
|
+
protected refreshBBox(): TSU.Geom.Rect;
|
|
17
19
|
protected refreshMinSize(): TSU.Geom.Size;
|
|
18
20
|
protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
|
|
19
21
|
refreshLayout(): void;
|
|
20
22
|
}
|
|
21
|
-
export declare class LabelEmbelishment extends
|
|
23
|
+
export declare class LabelEmbelishment extends LeafAtomViewEmbelishment {
|
|
22
24
|
readonly label: string;
|
|
23
|
-
readonly atomView:
|
|
25
|
+
readonly atomView: LeafAtomView;
|
|
24
26
|
labelElem: SVGTextElement;
|
|
25
|
-
constructor(label: string, atomView:
|
|
27
|
+
constructor(label: string, atomView: LeafAtomView);
|
|
28
|
+
protected refreshBBox(): TSU.Geom.Rect;
|
|
26
29
|
protected refreshMinSize(): TSU.Geom.Size;
|
|
27
30
|
protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
|
|
28
31
|
refreshLayout(): void;
|
|
@@ -33,6 +36,7 @@ export declare class BeatStartLines extends Embelishment {
|
|
|
33
36
|
barSpacing: number;
|
|
34
37
|
protected line: SVGLineElement;
|
|
35
38
|
constructor(source: BeatView, rootElement: SVGGraphicsElement);
|
|
39
|
+
protected refreshBBox(): TSU.Geom.Rect;
|
|
36
40
|
protected refreshMinSize(): TSU.Geom.Size;
|
|
37
41
|
refreshLayout(): void;
|
|
38
42
|
protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
|
|
@@ -43,6 +47,7 @@ export declare class BeatEndLines extends Embelishment {
|
|
|
43
47
|
lineSpacing: number;
|
|
44
48
|
protected lines: SVGLineElement[];
|
|
45
49
|
constructor(source: BeatView, rootElement: SVGGraphicsElement, nLines?: number);
|
|
50
|
+
protected refreshBBox(): TSU.Geom.Rect;
|
|
46
51
|
protected refreshMinSize(): TSU.Geom.Size;
|
|
47
52
|
protected updatePosition(x: null | number, y: null | number): [number | null, number | null];
|
|
48
53
|
barSpacing: number;
|
|
@@ -50,48 +55,49 @@ export declare class BeatEndLines extends Embelishment {
|
|
|
50
55
|
protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
|
|
51
56
|
}
|
|
52
57
|
export declare class Kampitham extends LabelEmbelishment {
|
|
53
|
-
readonly atomView:
|
|
54
|
-
constructor(atomView:
|
|
58
|
+
readonly atomView: LeafAtomView;
|
|
59
|
+
constructor(atomView: LeafAtomView);
|
|
55
60
|
}
|
|
56
61
|
export declare class Nokku extends LabelEmbelishment {
|
|
57
|
-
readonly atomView:
|
|
58
|
-
constructor(atomView:
|
|
62
|
+
readonly atomView: LeafAtomView;
|
|
63
|
+
constructor(atomView: LeafAtomView);
|
|
59
64
|
}
|
|
60
65
|
export declare class Prathyagatham extends LabelEmbelishment {
|
|
61
|
-
readonly atomView:
|
|
62
|
-
constructor(atomView:
|
|
66
|
+
readonly atomView: LeafAtomView;
|
|
67
|
+
constructor(atomView: LeafAtomView);
|
|
63
68
|
}
|
|
64
69
|
export declare class Spuritham extends LabelEmbelishment {
|
|
65
|
-
readonly atomView:
|
|
66
|
-
constructor(atomView:
|
|
70
|
+
readonly atomView: LeafAtomView;
|
|
71
|
+
constructor(atomView: LeafAtomView);
|
|
67
72
|
}
|
|
68
73
|
export declare class Raavi extends LabelEmbelishment {
|
|
69
|
-
readonly atomView:
|
|
70
|
-
constructor(atomView:
|
|
74
|
+
readonly atomView: LeafAtomView;
|
|
75
|
+
constructor(atomView: LeafAtomView);
|
|
71
76
|
}
|
|
72
77
|
export declare class Kandippu extends LabelEmbelishment {
|
|
73
|
-
readonly atomView:
|
|
74
|
-
constructor(atomView:
|
|
78
|
+
readonly atomView: LeafAtomView;
|
|
79
|
+
constructor(atomView: LeafAtomView);
|
|
75
80
|
}
|
|
76
81
|
export declare class Vaali extends LabelEmbelishment {
|
|
77
|
-
readonly atomView:
|
|
78
|
-
constructor(atomView:
|
|
82
|
+
readonly atomView: LeafAtomView;
|
|
83
|
+
constructor(atomView: LeafAtomView);
|
|
79
84
|
}
|
|
80
85
|
export declare class Odukkal extends LabelEmbelishment {
|
|
81
|
-
readonly atomView:
|
|
82
|
-
constructor(atomView:
|
|
86
|
+
readonly atomView: LeafAtomView;
|
|
87
|
+
constructor(atomView: LeafAtomView);
|
|
83
88
|
}
|
|
84
89
|
export declare class Orikkai extends LabelEmbelishment {
|
|
85
|
-
readonly atomView:
|
|
86
|
-
constructor(atomView:
|
|
90
|
+
readonly atomView: LeafAtomView;
|
|
91
|
+
constructor(atomView: LeafAtomView);
|
|
87
92
|
}
|
|
88
|
-
export declare class Jaaru extends
|
|
93
|
+
export declare class Jaaru extends LeafAtomViewEmbelishment {
|
|
89
94
|
readonly jaaru: JaaruGamaka;
|
|
90
|
-
readonly atomView:
|
|
95
|
+
readonly atomView: LeafAtomView;
|
|
91
96
|
pathElem: SVGPathElement;
|
|
92
|
-
constructor(jaaru: JaaruGamaka, atomView:
|
|
97
|
+
constructor(jaaru: JaaruGamaka, atomView: LeafAtomView);
|
|
93
98
|
pathAttribute(x?: number): string;
|
|
94
99
|
protected refreshMinSize(): TSU.Geom.Size;
|
|
100
|
+
protected refreshBBox(): TSU.Geom.Rect;
|
|
95
101
|
protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
|
|
96
102
|
refreshLayout(): void;
|
|
97
103
|
}
|
|
@@ -26,16 +26,16 @@ var __values = (this && this.__values) || function(o) {
|
|
|
26
26
|
};
|
|
27
27
|
import * as TSU from "@panyam/tsutils";
|
|
28
28
|
import { Embelishment } from "../shapes";
|
|
29
|
-
var
|
|
30
|
-
__extends(
|
|
31
|
-
function
|
|
29
|
+
var LeafAtomViewEmbelishment = (function (_super) {
|
|
30
|
+
__extends(LeafAtomViewEmbelishment, _super);
|
|
31
|
+
function LeafAtomViewEmbelishment(atomView) {
|
|
32
32
|
var _this = _super.call(this) || this;
|
|
33
33
|
_this.atomView = atomView;
|
|
34
34
|
return _this;
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return LeafAtomViewEmbelishment;
|
|
37
37
|
}(Embelishment));
|
|
38
|
-
export {
|
|
38
|
+
export { LeafAtomViewEmbelishment };
|
|
39
39
|
var OctaveIndicator = (function (_super) {
|
|
40
40
|
__extends(OctaveIndicator, _super);
|
|
41
41
|
function OctaveIndicator(noteView, note) {
|
|
@@ -52,7 +52,7 @@ var OctaveIndicator = (function (_super) {
|
|
|
52
52
|
attrs: {
|
|
53
53
|
width: _this.dotRadius * 2 * numDots + (numDots - 1) * _this.dotSpacing,
|
|
54
54
|
height: _this.dotRadius * 2,
|
|
55
|
-
source: "atom" + _this.noteView.
|
|
55
|
+
source: "atom" + _this.noteView.leafAtom.uuid,
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
var cx = 0;
|
|
@@ -72,6 +72,9 @@ var OctaveIndicator = (function (_super) {
|
|
|
72
72
|
}
|
|
73
73
|
return _this;
|
|
74
74
|
}
|
|
75
|
+
OctaveIndicator.prototype.refreshBBox = function () {
|
|
76
|
+
return TSU.DOM.svgBBox(this.dotsElem);
|
|
77
|
+
};
|
|
75
78
|
OctaveIndicator.prototype.refreshMinSize = function () {
|
|
76
79
|
var numDots = Math.abs(this.note.octave);
|
|
77
80
|
return {
|
|
@@ -90,7 +93,7 @@ var OctaveIndicator = (function (_super) {
|
|
|
90
93
|
this.dotsElem.setAttribute("transform", "translate(" + this.x + "," + this.y + ")");
|
|
91
94
|
};
|
|
92
95
|
return OctaveIndicator;
|
|
93
|
-
}(
|
|
96
|
+
}(LeafAtomViewEmbelishment));
|
|
94
97
|
export { OctaveIndicator };
|
|
95
98
|
var LabelEmbelishment = (function (_super) {
|
|
96
99
|
__extends(LabelEmbelishment, _super);
|
|
@@ -104,12 +107,15 @@ var LabelEmbelishment = (function (_super) {
|
|
|
104
107
|
parent: rootElem,
|
|
105
108
|
text: label,
|
|
106
109
|
attrs: {
|
|
107
|
-
source: "atom" + _this.atomView.
|
|
110
|
+
source: "atom" + _this.atomView.leafAtom.uuid,
|
|
108
111
|
"dominant-baseline": "hanging",
|
|
109
112
|
},
|
|
110
113
|
});
|
|
111
114
|
return _this;
|
|
112
115
|
}
|
|
116
|
+
LabelEmbelishment.prototype.refreshBBox = function () {
|
|
117
|
+
return TSU.DOM.svgBBox(this.labelElem);
|
|
118
|
+
};
|
|
113
119
|
LabelEmbelishment.prototype.refreshMinSize = function () {
|
|
114
120
|
return TSU.DOM.svgBBox(this.labelElem);
|
|
115
121
|
};
|
|
@@ -121,7 +127,7 @@ var LabelEmbelishment = (function (_super) {
|
|
|
121
127
|
this.labelElem.setAttribute("y", "" + this.y);
|
|
122
128
|
};
|
|
123
129
|
return LabelEmbelishment;
|
|
124
|
-
}(
|
|
130
|
+
}(LeafAtomViewEmbelishment));
|
|
125
131
|
export { LabelEmbelishment };
|
|
126
132
|
var BeatStartLines = (function (_super) {
|
|
127
133
|
__extends(BeatStartLines, _super);
|
|
@@ -141,16 +147,19 @@ var BeatStartLines = (function (_super) {
|
|
|
141
147
|
});
|
|
142
148
|
return _this;
|
|
143
149
|
}
|
|
150
|
+
BeatStartLines.prototype.refreshBBox = function () {
|
|
151
|
+
return new TSU.Geom.Rect(0, 0, 0, 0);
|
|
152
|
+
};
|
|
144
153
|
BeatStartLines.prototype.refreshMinSize = function () {
|
|
145
154
|
return new TSU.Geom.Rect(0, 0, 0, 0);
|
|
146
155
|
};
|
|
147
156
|
BeatStartLines.prototype.refreshLayout = function () {
|
|
148
157
|
var line = this.line;
|
|
149
|
-
var x = -this.barSpacing;
|
|
158
|
+
var x = this.source.x - this.barSpacing;
|
|
150
159
|
line.setAttribute("x1", "" + x);
|
|
151
160
|
line.setAttribute("x2", "" + x);
|
|
152
|
-
var y =
|
|
153
|
-
var h = this.source.height;
|
|
161
|
+
var y = this.source.y + this.source.bbox.y;
|
|
162
|
+
var h = this.source.bbox.height;
|
|
154
163
|
line.setAttribute("y1", "" + y);
|
|
155
164
|
line.setAttribute("y2", "" + (y + h));
|
|
156
165
|
};
|
|
@@ -183,6 +192,9 @@ var BeatEndLines = (function (_super) {
|
|
|
183
192
|
}
|
|
184
193
|
return _this;
|
|
185
194
|
}
|
|
195
|
+
BeatEndLines.prototype.refreshBBox = function () {
|
|
196
|
+
return new TSU.Geom.Rect(0, 0, 0, 0);
|
|
197
|
+
};
|
|
186
198
|
BeatEndLines.prototype.refreshMinSize = function () {
|
|
187
199
|
return new TSU.Geom.Rect(0, 0, 0, 0);
|
|
188
200
|
};
|
|
@@ -191,9 +203,9 @@ var BeatEndLines = (function (_super) {
|
|
|
191
203
|
};
|
|
192
204
|
BeatEndLines.prototype.refreshLayout = function () {
|
|
193
205
|
var e_1, _a, e_2, _b;
|
|
194
|
-
var x = this.source.width + this.barSpacing;
|
|
195
|
-
var y =
|
|
196
|
-
var h = this.source.height;
|
|
206
|
+
var x = this.source.x + this.source.width + this.barSpacing;
|
|
207
|
+
var y = this.source.y + this.source.bbox.y;
|
|
208
|
+
var h = this.source.bbox.height;
|
|
197
209
|
var currX = x;
|
|
198
210
|
try {
|
|
199
211
|
for (var _c = __values(this.lines), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -333,7 +345,7 @@ var Jaaru = (function (_super) {
|
|
|
333
345
|
doc: document,
|
|
334
346
|
parent: rootElem,
|
|
335
347
|
attrs: {
|
|
336
|
-
source: "atom" + _this.atomView.
|
|
348
|
+
source: "atom" + _this.atomView.leafAtom.uuid,
|
|
337
349
|
stroke: "black",
|
|
338
350
|
fill: "transparent",
|
|
339
351
|
d: _this.pathAttribute(),
|
|
@@ -343,7 +355,7 @@ var Jaaru = (function (_super) {
|
|
|
343
355
|
}
|
|
344
356
|
Jaaru.prototype.pathAttribute = function (x) {
|
|
345
357
|
if (x === void 0) { x = 0; }
|
|
346
|
-
var avbbox = this.atomView.minSize;
|
|
358
|
+
var avbbox = this.atomView.glyph.minSize;
|
|
347
359
|
var y2 = 0;
|
|
348
360
|
var h2 = avbbox.height / 2;
|
|
349
361
|
var x2 = x + h2;
|
|
@@ -356,11 +368,14 @@ var Jaaru = (function (_super) {
|
|
|
356
368
|
y -= h2;
|
|
357
369
|
y2 = y + h2;
|
|
358
370
|
}
|
|
359
|
-
return ["M "
|
|
371
|
+
return ["M ".concat(x, " ").concat(y), "Q ".concat(x2, " ").concat(y, " ").concat(x2, " ").concat(y2)].join(" ");
|
|
360
372
|
};
|
|
361
373
|
Jaaru.prototype.refreshMinSize = function () {
|
|
362
374
|
return TSU.DOM.svgBBox(this.pathElem);
|
|
363
375
|
};
|
|
376
|
+
Jaaru.prototype.refreshBBox = function () {
|
|
377
|
+
return TSU.DOM.svgBBox(this.pathElem);
|
|
378
|
+
};
|
|
364
379
|
Jaaru.prototype.updateBounds = function (x, y, w, h) {
|
|
365
380
|
return [x, null, null, null];
|
|
366
381
|
};
|
|
@@ -368,6 +383,6 @@ var Jaaru = (function (_super) {
|
|
|
368
383
|
this.pathElem.setAttribute("d", this.pathAttribute(this.x));
|
|
369
384
|
};
|
|
370
385
|
return Jaaru;
|
|
371
|
-
}(
|
|
386
|
+
}(LeafAtomViewEmbelishment));
|
|
372
387
|
export { Jaaru };
|
|
373
388
|
//# sourceMappingURL=embelishments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAY,YAAY,EAAE,MAAM,WAAW,CAAC;AAMnD;IAAmD,wCAAY;IAC7D,8BAA4B,QAAkB;QAA9C,YACE,iBAAO,SACR;QAF2B,cAAQ,GAAR,QAAQ,CAAU;;IAE9C,CAAC;IACH,2BAAC;AAAD,CAAC,AAJD,CAAmD,YAAY,GAI9D;;AAED;IAAqC,mCAAoB;IAKvD,yBAA4B,QAAkB,EAAkB,IAAU;QAA1E,YACE,kBAAM,QAAQ,CAAC,SA2BhB;QA5B2B,cAAQ,GAAR,QAAQ,CAAU;QAAkB,UAAI,GAAJ,IAAI,CAAM;QAJ1E,eAAS,GAAG,CAAC,CAAC;QACd,gBAAU,GAAG,GAAG,CAAC;QAKf,IAAM,QAAQ,GAAG,KAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzC,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,KAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE;YACzC,GAAG,EAAE,QAAQ;YACb,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE;gBACL,KAAK,EAAE,KAAI,CAAC,SAAS,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,KAAI,CAAC,UAAU;gBACrE,MAAM,EAAE,KAAI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SAAS,EAAE;YACxB,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;YACnB,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;SACb;aAAM;YACL,CAAC,IAAI,EAAE,CAAC;YACR,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;SACb;QACD,OAAO,CAAC,OAAK,CAAC,SAAI,CAAG,EAAE,OAAK,EAAE,SAAI,CAAC,SAAI,EAAE,SAAI,EAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IAES,8BAAc,GAAxB;QACE,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,4BAAY,GAAtB,UACE,CAAgB,EAChB,CAAgB,EAChB,CAAgB,EAChB,CAAgB;QAEhB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,6BAAa,GAAb;QACE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACH,YAAC;AAAD,CAAC,AAnDD,CAA2B,oBAAoB,GAmD9C","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../layouts\";\nimport { AtomView, Embelishment } from \"../shapes\";\nimport { JaaruGamaka } from \"./gamakas\";\n\n/**\n * Embelishments specifically \"around\" a single atom view.\n */\nexport abstract class AtomViewEmbelishment extends Embelishment {\n constructor(public readonly atomView: AtomView) {\n super();\n }\n}\n\nexport class OctaveIndicator extends AtomViewEmbelishment {\n dotRadius = 1;\n dotSpacing = 2.5;\n dotsElem: SVGGElement;\n\n constructor(public readonly noteView: AtomView, public readonly note: Note) {\n super(noteView);\n const rootElem = this.noteView.embRoot();\n const numDots = Math.abs(note.octave);\n this.dotsElem = TSU.DOM.createSVGNode(\"g\", {\n doc: document,\n parent: rootElem,\n attrs: {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n source: \"atom\" + this.noteView.flatAtom.atom.uuid,\n },\n });\n let cx = 0;\n for (let i = 0; i < numDots; i++) {\n TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.dotsElem,\n attrs: {\n cx: cx,\n cy: 0,\n r: this.dotRadius,\n stroke: \"black\",\n \"stroke-width\": \"1\",\n },\n });\n cx += this.dotRadius + this.dotRadius + this.dotSpacing;\n }\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const numDots = Math.abs(this.note.octave);\n return {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n };\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 if (x == null) x = this.x;\n if (y == null) y = this.y;\n // cannot set w/h\n // this.bbox.x = x;\n // this.bbox.y = y;\n return [x, y, null, null];\n }\n\n refreshLayout(): void {\n this.dotsElem.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n}\n\n////////// Carnatic embelishments\nexport class LabelEmbelishment extends AtomViewEmbelishment {\n labelElem: SVGTextElement;\n constructor(public readonly label: string, public readonly atomView: AtomView) {\n super(atomView);\n const rootElem = this.atomView.embRoot();\n this.labelElem = TSU.DOM.createSVGNode(\"text\", {\n doc: document,\n parent: rootElem,\n text: label,\n attrs: {\n source: \"atom\" + this.atomView.flatAtom.atom.uuid,\n \"dominant-baseline\": \"hanging\",\n },\n });\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.labelElem);\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, w, h];\n }\n\n refreshLayout(): void {\n this.labelElem.setAttribute(\"x\", \"\" + this.x);\n this.labelElem.setAttribute(\"y\", \"\" + this.y);\n }\n}\n\nexport class BeatStartLines extends Embelishment {\n barSpacing = 10;\n protected line: SVGLineElement;\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-start-line\",\n },\n });\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n refreshLayout(): void {\n const line = this.line;\n const x = -this.barSpacing;\n line.setAttribute(\"x1\", \"\" + x);\n line.setAttribute(\"x2\", \"\" + x);\n const y = 0;\n const h = this.source.height;\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\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, null, h];\n }\n}\n\nexport class BeatEndLines extends Embelishment {\n lineSpacing = 2;\n protected lines: SVGLineElement[];\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement, nLines = 1) {\n super();\n this.lines = [];\n for (let i = 0; i < nLines; i++) {\n this.lines.push(\n TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n // parent: l2g,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-end-line\",\n },\n }),\n );\n }\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected updatePosition(x: null | number, y: null | number): [number | null, number | null] {\n return [x, y];\n }\n\n barSpacing = 15;\n\n refreshLayout(): void {\n const x = this.source.width + this.barSpacing;\n const y = 0;\n const h = this.source.height;\n let currX = x;\n for (const line of this.lines) {\n const lx = \"\" + currX;\n line.setAttribute(\"x1\", lx);\n line.setAttribute(\"x2\", lx);\n currX += 4;\n }\n for (const line of this.lines) {\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\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 [null, null, null, null];\n }\n}\n\n/// Carnatic Embelishments\nexport class Kampitham extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"~\", atomView);\n }\n}\n\nexport class Nokku extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"w\", atomView);\n }\n}\n\nexport class Prathyagatham extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"∵\", atomView);\n }\n}\nexport class Spuritham extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"∴\", atomView);\n }\n}\nexport class Raavi extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"^\", atomView);\n }\n}\nexport class Kandippu extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"✓\", atomView);\n }\n}\n\nexport class Vaali extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"⌒\", atomView);\n }\n}\nexport class Odukkal extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"x\", atomView);\n }\n}\nexport class Orikkai extends LabelEmbelishment {\n constructor(public readonly atomView: AtomView) {\n super(\"γ\", atomView);\n }\n}\n\nexport class Jaaru extends AtomViewEmbelishment {\n pathElem: SVGPathElement;\n constructor(public readonly jaaru: JaaruGamaka, public readonly atomView: AtomView) {\n super(atomView);\n // TODO - Create the \"fancier\" view\n // for now represent this with just a slant line (like a slash)\n const rootElem = this.atomView.embRoot();\n this.pathElem = TSU.DOM.createSVGNode(\"path\", {\n doc: document,\n parent: rootElem,\n attrs: {\n source: \"atom\" + this.atomView.flatAtom.atom.uuid,\n stroke: \"black\",\n fill: \"transparent\",\n d: this.pathAttribute(),\n },\n });\n }\n\n pathAttribute(x = 0): string {\n const avbbox = this.atomView.minSize;\n let y2 = 0;\n const h2 = avbbox.height / 2;\n const x2 = x + h2;\n let y = this.atomView.y;\n if (this.jaaru.ascending) {\n y += avbbox.height;\n y2 = y - h2;\n } else {\n y -= h2;\n y2 = y + h2;\n }\n return [`M ${x} ${y}`, `Q ${x2} ${y} ${x2} ${y2}`].join(\" \");\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.pathElem);\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, null, null, null];\n }\n\n refreshLayout(): void {\n this.pathElem.setAttribute(\"d\", this.pathAttribute(this.x));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC;IAAuD,4CAAY;IACjE,kCAA4B,QAAsB;QAAlD,YACE,iBAAO,SACR;QAF2B,cAAQ,GAAR,QAAQ,CAAc;;IAElD,CAAC;IACH,+BAAC;AAAD,CAAC,AAJD,CAAuD,YAAY,GAIlE;;AAED;IAAqC,mCAAwB;IAK3D,yBAA4B,QAAsB,EAAkB,IAAU;QAA9E,YACE,kBAAM,QAAQ,CAAC,SA2BhB;QA5B2B,cAAQ,GAAR,QAAQ,CAAc;QAAkB,UAAI,GAAJ,IAAI,CAAM;QAJ9E,eAAS,GAAG,CAAC,CAAC;QACd,gBAAU,GAAG,GAAG,CAAC;QAKf,IAAM,QAAQ,GAAG,KAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzC,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,KAAI,CAA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EAAE,cAAI,EAAE,CAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IAES,8BAAc,GAAxB;QACE,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,2BAAW,GAArB;QACE,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,4BAAY,GAAtB,UACE,CAAgB,EAChB,CAAgB,EAChB,CAAgB,EAChB,CAAgB;QAEhB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,6BAAa,GAAb;QACE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACH,YAAC;AAAD,CAAC,AAvDD,CAA2B,wBAAwB,GAuDlD","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../beats\";\nimport { Embelishment } from \"../shapes\";\nimport { LeafAtomView } from \"./atomviews\";\nimport { JaaruGamaka } from \"./gamakas\";\n\n/**\n * Embelishments specifically \"around\" a single atom view.\n */\nexport abstract class LeafAtomViewEmbelishment extends Embelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super();\n }\n}\n\nexport class OctaveIndicator extends LeafAtomViewEmbelishment {\n dotRadius = 1;\n dotSpacing = 2.5;\n dotsElem: SVGGElement;\n\n constructor(public readonly noteView: LeafAtomView, public readonly note: Note) {\n super(noteView);\n const rootElem = this.noteView.embRoot();\n const numDots = Math.abs(note.octave);\n this.dotsElem = TSU.DOM.createSVGNode(\"g\", {\n doc: document,\n parent: rootElem,\n attrs: {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n source: \"atom\" + this.noteView.leafAtom.uuid,\n },\n });\n let cx = 0;\n for (let i = 0; i < numDots; i++) {\n TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.dotsElem,\n attrs: {\n cx: cx,\n cy: 0,\n r: this.dotRadius,\n stroke: \"black\",\n \"stroke-width\": \"1\",\n },\n });\n cx += this.dotRadius + this.dotRadius + this.dotSpacing;\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.dotsElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const numDots = Math.abs(this.note.octave);\n return {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n };\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 if (x == null) x = this.x;\n if (y == null) y = this.y;\n // cannot set w/h\n // this.bbox.x = x;\n // this.bbox.y = y;\n return [x, y, null, null];\n }\n\n refreshLayout(): void {\n this.dotsElem.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n}\n\n////////// Carnatic embelishments\nexport class LabelEmbelishment extends LeafAtomViewEmbelishment {\n labelElem: SVGTextElement;\n constructor(public readonly label: string, public readonly atomView: LeafAtomView) {\n super(atomView);\n const rootElem = this.atomView.embRoot();\n this.labelElem = TSU.DOM.createSVGNode(\"text\", {\n doc: document,\n parent: rootElem,\n text: label,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n \"dominant-baseline\": \"hanging\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.labelElem);\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, w, h];\n }\n\n refreshLayout(): void {\n this.labelElem.setAttribute(\"x\", \"\" + this.x);\n this.labelElem.setAttribute(\"y\", \"\" + this.y);\n }\n}\n\nexport class BeatStartLines extends Embelishment {\n barSpacing = 10;\n protected line: SVGLineElement;\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-start-line\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n refreshLayout(): void {\n const line = this.line;\n const x = this.source.x - this.barSpacing;\n line.setAttribute(\"x1\", \"\" + x);\n line.setAttribute(\"x2\", \"\" + x);\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\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, null, h];\n }\n}\n\nexport class BeatEndLines extends Embelishment {\n lineSpacing = 2;\n protected lines: SVGLineElement[];\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement, nLines = 1) {\n super();\n this.lines = [];\n for (let i = 0; i < nLines; i++) {\n this.lines.push(\n TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n // parent: l2g,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-end-line\",\n },\n }),\n );\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected updatePosition(x: null | number, y: null | number): [number | null, number | null] {\n return [x, y];\n }\n\n barSpacing = 15;\n\n refreshLayout(): void {\n // const x = this.source.width + this.barSpacing;\n // const y = 0;\n // const h = this.source.height;\n const x = this.source.x + this.source.width + this.barSpacing;\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n let currX = x;\n for (const line of this.lines) {\n const lx = \"\" + currX;\n line.setAttribute(\"x1\", lx);\n line.setAttribute(\"x2\", lx);\n currX += 4;\n }\n for (const line of this.lines) {\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\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 [null, null, null, null];\n }\n}\n\n/// Carnatic Embelishments\nexport class Kampitham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"~\", atomView);\n }\n}\n\nexport class Nokku extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"w\", atomView);\n }\n}\n\nexport class Prathyagatham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∵\", atomView);\n }\n}\nexport class Spuritham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∴\", atomView);\n }\n}\nexport class Raavi extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"^\", atomView);\n }\n}\nexport class Kandippu extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"✓\", atomView);\n }\n}\n\nexport class Vaali extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"⌒\", atomView);\n }\n}\nexport class Odukkal extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"x\", atomView);\n }\n}\nexport class Orikkai extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"γ\", atomView);\n }\n}\n\nexport class Jaaru extends LeafAtomViewEmbelishment {\n pathElem: SVGPathElement;\n constructor(public readonly jaaru: JaaruGamaka, public readonly atomView: LeafAtomView) {\n super(atomView);\n // TODO - Create the \"fancier\" view\n // for now represent this with just a slant line (like a slash)\n const rootElem = this.atomView.embRoot();\n this.pathElem = TSU.DOM.createSVGNode(\"path\", {\n doc: document,\n parent: rootElem,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n stroke: \"black\",\n fill: \"transparent\",\n d: this.pathAttribute(),\n },\n });\n }\n\n pathAttribute(x = 0): string {\n const avbbox = this.atomView.glyph.minSize;\n let y2 = 0;\n const h2 = avbbox.height / 2;\n const x2 = x + h2;\n let y = this.atomView.y;\n if (this.jaaru.ascending) {\n y += avbbox.height;\n y2 = y - h2;\n } else {\n y -= h2;\n y2 = y + h2;\n }\n return [`M ${x} ${y}`, `Q ${x2} ${y} ${x2} ${y2}`].join(\" \");\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.pathElem);\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, null, null, null];\n }\n\n refreshLayout(): void {\n this.pathElem.setAttribute(\"d\", this.pathAttribute(this.x));\n }\n}\n"]}
|