notations 0.0.44 → 0.0.47
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 +527 -0
- package/lib/cjs/beats.js.map +1 -0
- package/lib/cjs/carnatic/LineView.d.ts +20 -0
- package/lib/cjs/carnatic/LineView.js +73 -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 +257 -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 +175 -138
- package/lib/cjs/carnatic/atomviews.js.map +1 -1
- package/lib/cjs/carnatic/beatviews.d.ts +10 -14
- package/lib/cjs/carnatic/beatviews.js +58 -111
- package/lib/cjs/carnatic/beatviews.js.map +1 -1
- package/lib/cjs/carnatic/embelishments.d.ts +38 -32
- package/lib/cjs/carnatic/embelishments.js +39 -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 +7 -1
- package/lib/cjs/carnatic/index.js.map +1 -1
- package/lib/cjs/commands.js +5 -1
- package/lib/cjs/commands.js.map +1 -1
- package/lib/cjs/core.d.ts +15 -73
- package/lib/cjs/core.js +201 -565
- package/lib/cjs/core.js.map +1 -1
- package/lib/cjs/cycle.d.ts +47 -0
- package/lib/cjs/cycle.js +496 -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 +8 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/iterators.d.ts +14 -2
- package/lib/cjs/iterators.js +82 -6
- package/lib/cjs/iterators.js.map +1 -1
- package/lib/cjs/layouts.d.ts +7 -106
- package/lib/cjs/layouts.js +9 -479
- package/lib/cjs/layouts.js.map +1 -1
- package/lib/cjs/loader.d.ts +2 -1
- package/lib/cjs/loader.js +36 -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 +10 -5
- package/lib/cjs/parser.js.map +1 -1
- package/lib/cjs/shapes.d.ts +35 -14
- package/lib/cjs/shapes.js +158 -44
- package/lib/cjs/shapes.js.map +1 -1
- package/lib/cjs/utils.d.ts +2 -1
- package/lib/cjs/utils.js +9 -4
- 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 +231 -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 -111
- package/lib/esm/carnatic/beatviews.js.map +1 -1
- package/lib/esm/carnatic/embelishments.d.ts +38 -32
- package/lib/esm/carnatic/embelishments.js +33 -18
- 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 +192 -560
- 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 +73 -1
- 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 +27 -23
- 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 +5 -4
- 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 +3 -2
- package/lib/esm/utils.js.map +1 -1
- package/package.json +33 -28
- package/styles/NotationView.scss +35 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuC;AAGvC,oCAAmD;AAMnD;IAAmD,wCAAY;IAC7D,8BAA4B,QAAkB;QAA9C,YACE,iBAAO,SACR;QAF2B,cAAQ,GAAR,QAAQ,CAAU;;IAE9C,CAAC;IACH,2BAAC;AAAD,CAAC,AAJD,CAAmD,qBAAY,GAI9D;AAJqB,oDAAoB;AAM1C;IAAqC,mCAAoB;IAKvD,yBAA4B,QAAkB,EAAkB,IAAU;QAA1E,YACE,kBAAM,QAAQ,CAAC,SA2BhB;QA5B2B,cAAQ,GAAR,QAAQ,CA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B,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;AAnDY,sBAAK","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"]}
|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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;AAvDY,sBAAK","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"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,4 +18,6 @@ __exportStar(require("./gamakas"), exports);
|
|
|
14
18
|
__exportStar(require("./atomviews"), exports);
|
|
15
19
|
__exportStar(require("./beatviews"), exports);
|
|
16
20
|
__exportStar(require("./embelishments"), exports);
|
|
21
|
+
__exportStar(require("./LineView"), exports);
|
|
22
|
+
__exportStar(require("./NotationView"), exports);
|
|
17
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/carnatic/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/carnatic/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,8CAA4B;AAC5B,kDAAgC;AAChC,6CAA2B;AAC3B,iDAA+B","sourcesContent":["export * from \"./gamakas\";\nexport * from \"./atomviews\";\nexport * from \"./beatviews\";\nexport * from \"./embelishments\";\nexport * from \"./LineView\";\nexport * from \"./NotationView\";\n"]}
|
package/lib/cjs/commands.js
CHANGED
|
@@ -16,7 +16,11 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
package/lib/cjs/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/commands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuC;AAEvC,iCAAqC;AACrC,uCAA2E;AAE3E;IAAkC,gCAAO;IAAzC;;IASA,CAAC;IARC,sBAAI,qCAAW;aAAf;YACE,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Af,UAAgB,QAAkB;QAChC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC;QACxC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;IAC/B,CAAC;IACH,sBAAC;AAAD,CAAC,AAfD,CAAqC,kBAAkB,GAetD;AAfY,0CAAe","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Atom } from \"./core\";\nimport { parseCycle } from \"./utils\";\nimport { Command, RawBlock, Notation, MetaData as Meta } from \"./notation\";\n\nexport class RawEmbedding extends Command {\n get rawContents(): string {\n return this.getParamAt(0);\n }\n\n applyToNotation(notation: Notation): void {\n const raw = new RawBlock(this.rawContents);\n notation.addRawBlock(raw);\n }\n}\n\nexport class MetaData extends Command {\n // Called when running in execution mode\n applyToNotation(notation: Notation): void {\n // Create the role - ensure that we have a role\n notation.addMetaData(this.meta);\n }\n\n get meta(): Meta {\n const out = new Meta(this.key, this.value);\n return out;\n }\n\n get key(): string {\n return this.getParamAt(0);\n }\n\n get value(): string {\n return this.getParamAt(1);\n }\n}\n\nexport class ActivateRole extends Command {\n // Called when running in execution mode\n applyToNotation(notation: Notation): void {\n // Create the role - ensure that we have a role\n notation.setCurrRole(this.roleName);\n // const line = notation.ensureLine();\n }\n\n get roleName(): string {\n return this.getParamAt(0);\n }\n}\n\nexport class AddAtoms extends Command {\n index: number;\n atoms: Atom[];\n\n constructor(...atoms: Atom[]) {\n super();\n this.atoms = atoms;\n this.index = 0;\n }\n\n debugValue(): any {\n return {\n name: this.name,\n index: this.index,\n atoms: this.atoms.map((a) => a.debugValue()),\n };\n }\n\n applyToNotation(notation: Notation): void {\n let roleDef = notation.currRoleDef;\n if (roleDef == null) {\n // By default create a role for swaras\n roleDef = notation.newRoleDef(\"Sw\", true);\n // throw new Error(\"Current role is invalid\");\n }\n // Ensure a line exists\n const lpForLine = notation.layoutParamsForLine(notation.currentLine);\n if (lpForLine == null) {\n notation.setLayoutParamsForLine(notation.currentLine, notation.layoutParams);\n } else {\n TSU.assert(\n lpForLine == notation.layoutParams,\n \"Layout parameters have changed so a new line should have been started\",\n );\n }\n const finalised = this.atoms;\n notation.currentLine.addAtoms(roleDef.name, roleDef.notesOnly, ...finalised);\n }\n}\n\nexport class CreateLine extends Command {\n applyToNotation(notation: Notation): void {\n // We are not calling a newLine here just to avoid\n // a series of \\line commands creating wasteful empty lines\n // TODO - how do we consider offsets in line create\n const line = notation.newLine();\n line.offset = this.offset;\n line.marginText = this.marginText;\n }\n\n get offset(): TSU.Num.Fraction {\n let offset = this.getParam(\"offset\") || TSU.Num.Fraction.ZERO;\n if (typeof offset === \"number\") offset = new TSU.Num.Fraction(offset);\n return offset;\n }\n\n get marginText(): string {\n if (this.params.length > 0) {\n if (this.params[0].key == null && typeof this.params[0].value === \"string\") {\n return this.params[0].value.trim();\n }\n }\n return this.getParam(\"marginText\") || \"\";\n }\n}\n\nexport class CreateRole extends Command {\n applyToNotation(notation: Notation): void {\n // Create the role\n const name = this.getParamAt(0);\n notation.newRoleDef(name, this.notesOnly);\n }\n\n get notesOnly(): boolean {\n const notesOnly = this.getParam(\"notes\");\n return notesOnly == \"true\" || notesOnly == \"yes\" || notesOnly == true;\n }\n}\n\nexport abstract class LayoutParamCommand extends Command {}\n\n/**\n * Saves the current layout with the given name.\n * Typically users can change layout params (currently cycle, APB and line layout)\n * with the \\cycle, \\layout and \\beatDuration commands. Each time these are\n * changed, the current layout params is set to null. So the next time layout\n * params are needed we look at saved layout params and search by by the unique\n * combination of cycle, apb and line layout. This prevetns users from creating\n * too many layouts with the same config. Each layout is associated with an\n * AtomLayout instance.\n *\n * For example consider this:\n *\n * \\apb(4)\n * \\breaks(4)\n * \\cycle(\"|4|2|2|\")\n * \\apb(5)\n * \\breaks(3)\n *\n * In all these cases LayoutParams are *not* created. Instead they are reset to null.\n *\n *\n * When we do an AddAtoms command, this is where a LineView is created and along with this\n * a layoutParams is created taking the latest state of the layout params resulting an\n * LP (instance id = 1) of (layout = 3, cycle = \"4|2|2\", apb = 5)\n *\n * Now after this say we had the following commands:\n *\n * \\cycle(x)\n * \\cycle(|4|2|2)\n * \\apb(10)\n * \\apb(5)\n *\n * Sw: a b c\n *\n * Here again since the LP was set to null, \"creating\" layout params results in returning\n * the LP created previously (at the end of these commands the cycle, apb and layout params\n * are the same).\n *\n * eg doing\n *\n * \\layout(\"layout1\")\n *\n * This ensures that a *new* LP instance is created (even if another one exists with the same\n * apb, cycle, layout combo). This allows us to group different sectiosn that are identical\n * in layout but to be processed by different atom layouts.\n *\n * To use a saved layout simply do:\n *\n * \\layout(\"layout\")\n *\n * Note the use and saving commands are same - as we cannot override existing\n * layouts so referring to it the first time creates and saves it too\n */\nexport class ApplyLayout extends Command {\n validateParams(): void {\n if (this.params.length != 1 || typeof this.params[0].value !== \"string\") {\n throw new Error(\"layout command must contain one string argument\");\n }\n }\n\n applyToNotation(notation: Notation): void {\n const value = this.params[0].value;\n notation.ensureNamedLayoutParams(value);\n }\n}\n\n/**\n * Allows use (and creation) of layouts.\n */\nexport class SetBreaks extends LayoutParamCommand {\n get pattern(): number[] {\n return this.params.map((cmd) => cmd.value as number);\n }\n\n /**\n * called to validate parameters.\n */\n validateParams(): void {\n for (const param of this.params) {\n if (param.key != null) {\n throw new Error(\"Breaks command cannot have keyword params\");\n }\n if (typeof param.value !== \"number\") {\n throw new Error(\"Breaks command must be a list of integers\");\n }\n }\n }\n\n applyToNotation(notation: Notation): void {\n notation.currentBreaks = this.pattern;\n notation.resetLayoutParams();\n }\n}\n\nexport class SetCycle extends LayoutParamCommand {\n applyToNotation(notation: Notation): void {\n const value = this.params[0].value;\n // TODO - move the parsing to validation\n const cycle = parseCycle(value);\n notation.currentCycle = cycle;\n notation.resetLayoutParams();\n }\n}\n\nexport class SetBeatDuration extends LayoutParamCommand {\n validateParams(): void {\n if (this.params.length != 1 || typeof this.params[0].value !== \"number\") {\n throw new Error(\"beatDuration command must contain one number\");\n }\n }\n\n get beatDuration(): number {\n return this.params[0].value;\n }\n\n applyToNotation(notation: Notation): void {\n notation.currentAPB = this.beatDuration;\n notation.resetLayoutParams();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/commands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuC;AAEvC,iCAAqC;AACrC,uCAA2E;AAE3E;IAAkC,gCAAO;IAAzC;;IASA,CAAC;IARC,sBAAI,qCAAW;aAAf;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;;;OAAA;IAED,sCAAe,GAAf,UAAgB,QAAkB;QAChC,IAAM,GAAG,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3C,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IACH,mBAAC;AAAD,CAAC,AATD,CAAkC,kBAAO,GASxC;AATY,oCAAY;AAWzB;IAA8B,4BAAO;IAArC;;IAmBA,CAAC;IAjBC,kCAAe,GAAf,UAAgB,QAAkB;QAEhC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,sBAAI,0BAAI;aAAR;YACE,IAAM,GAAG,GAAG,IAAI,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,GAAG,CAAC;QACb,CAAC;;;OAAA;IAED,sBAAI,yBAAG;aAAP;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;;;OAAA;IAED,sBAAI,2BAAK;aAAT;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;;;OAAA;IACH,eAAC;AAAD,CAAC,AAnBD,CAA8B,kBAAO,GAmBpC;AAnBY,4BAAQ;AAqB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CAAc,GAAd;QACE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,EAAE;YACvE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;IACH,CAAC;IAED,sBAAI,yCAAY;aAAhB;YACE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC9B,CAAC;;;OAAA;IAED,yCAAe,GAAf,UAAgB,QAAkB;QAChC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC;QACxC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;IAC/B,CAAC;IACH,sBAAC;AAAD,CAAC,AAfD,CAAqC,kBAAkB,GAetD;AAfY,0CAAe","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Atom } from \"./core\";\nimport { parseCycle } from \"./utils\";\nimport { Command, RawBlock, Notation, MetaData as Meta } from \"./notation\";\n\nexport class RawEmbedding extends Command {\n get rawContents(): string {\n return this.getParamAt(0);\n }\n\n applyToNotation(notation: Notation): void {\n const raw = new RawBlock(this.rawContents);\n notation.addRawBlock(raw);\n }\n}\n\nexport class MetaData extends Command {\n // Called when running in execution mode\n applyToNotation(notation: Notation): void {\n // Create the role - ensure that we have a role\n notation.addMetaData(this.meta);\n }\n\n get meta(): Meta {\n const out = new Meta(this.key, this.value);\n return out;\n }\n\n get key(): string {\n return this.getParamAt(0);\n }\n\n get value(): string {\n return this.getParamAt(1);\n }\n}\n\nexport class ActivateRole extends Command {\n // Called when running in execution mode\n applyToNotation(notation: Notation): void {\n // Create the role - ensure that we have a role\n notation.setCurrRole(this.roleName);\n // const line = notation.ensureLine();\n }\n\n get roleName(): string {\n return this.getParamAt(0);\n }\n}\n\nexport class AddAtoms extends Command {\n index: number;\n atoms: Atom[];\n\n constructor(...atoms: Atom[]) {\n super();\n this.atoms = atoms;\n this.index = 0;\n }\n\n debugValue(): any {\n return {\n name: this.name,\n index: this.index,\n atoms: this.atoms.map((a) => a.debugValue()),\n };\n }\n\n applyToNotation(notation: Notation): void {\n let roleDef = notation.currRoleDef;\n if (roleDef == null) {\n // By default create a role for swaras\n roleDef = notation.newRoleDef(\"Sw\", true);\n // throw new Error(\"Current role is invalid\");\n }\n // Ensure a line exists\n const lpForLine = notation.layoutParamsForLine(notation.currentLine);\n if (lpForLine == null) {\n notation.setLayoutParamsForLine(notation.currentLine, notation.layoutParams);\n } else {\n TSU.assert(\n lpForLine == notation.layoutParams,\n \"Layout parameters have changed so a new line should have been started\",\n );\n }\n const finalised = this.atoms;\n notation.currentLine.addAtoms(roleDef.name, roleDef.notesOnly, ...finalised);\n }\n}\n\nexport class CreateLine extends Command {\n applyToNotation(notation: Notation): void {\n // We are not calling a newLine here just to avoid\n // a series of \\line commands creating wasteful empty lines\n // TODO - how do we consider offsets in line create\n const line = notation.newLine();\n line.offset = this.offset;\n line.marginText = this.marginText;\n }\n\n get offset(): TSU.Num.Fraction {\n let offset = this.getParam(\"offset\") || TSU.Num.Fraction.ZERO;\n if (typeof offset === \"number\") offset = new TSU.Num.Fraction(offset);\n return offset;\n }\n\n get marginText(): string {\n if (this.params.length > 0) {\n if (this.params[0].key == null && typeof this.params[0].value === \"string\") {\n return this.params[0].value.trim();\n }\n }\n return this.getParam(\"marginText\") || \"\";\n }\n}\n\nexport class CreateRole extends Command {\n applyToNotation(notation: Notation): void {\n // Create the role\n const name = this.getParamAt(0);\n notation.newRoleDef(name, this.notesOnly);\n }\n\n get notesOnly(): boolean {\n const notesOnly = this.getParam(\"notes\");\n return notesOnly == \"true\" || notesOnly == \"yes\" || notesOnly == true;\n }\n}\n\nexport abstract class LayoutParamCommand extends Command {}\n\n/**\n * Saves the current layout with the given name.\n * Typically users can change layout params (currently cycle, APB and line layout)\n * with the \\cycle, \\layout and \\beatDuration commands. Each time these are\n * changed, the current layout params is set to null. So the next time layout\n * params are needed we look at saved layout params and search by by the unique\n * combination of cycle, apb and line layout. This prevetns users from creating\n * too many layouts with the same config. Each layout is associated with an\n * AtomLayout instance.\n *\n * For example consider this:\n *\n * \\apb(4)\n * \\breaks(4)\n * \\cycle(\"|4|2|2|\")\n * \\apb(5)\n * \\breaks(3)\n *\n * In all these cases LayoutParams are *not* created. Instead they are reset to null.\n *\n *\n * When we do an AddAtoms command, this is where a LineView is created and along with this\n * a layoutParams is created taking the latest state of the layout params resulting an\n * LP (instance id = 1) of (layout = 3, cycle = \"4|2|2\", apb = 5)\n *\n * Now after this say we had the following commands:\n *\n * \\cycle(x)\n * \\cycle(|4|2|2)\n * \\apb(10)\n * \\apb(5)\n *\n * Sw: a b c\n *\n * Here again since the LP was set to null, \"creating\" layout params results in returning\n * the LP created previously (at the end of these commands the cycle, apb and layout params\n * are the same).\n *\n * eg doing\n *\n * \\layout(\"layout1\")\n *\n * This ensures that a *new* LP instance is created (even if another one exists with the same\n * apb, cycle, layout combo). This allows us to group different sectiosn that are identical\n * in layout but to be processed by different atom layouts.\n *\n * To use a saved layout simply do:\n *\n * \\layout(\"layout\")\n *\n * Note the use and saving commands are same - as we cannot override existing\n * layouts so referring to it the first time creates and saves it too\n */\nexport class ApplyLayout extends Command {\n validateParams(): void {\n if (this.params.length != 1 || typeof this.params[0].value !== \"string\") {\n throw new Error(\"layout command must contain one string argument\");\n }\n }\n\n applyToNotation(notation: Notation): void {\n const value = this.params[0].value;\n notation.ensureNamedLayoutParams(value);\n }\n}\n\n/**\n * Allows use (and creation) of layouts.\n */\nexport class SetBreaks extends LayoutParamCommand {\n get pattern(): number[] {\n return this.params.map((cmd) => cmd.value as number);\n }\n\n /**\n * called to validate parameters.\n */\n validateParams(): void {\n for (const param of this.params) {\n if (param.key != null) {\n throw new Error(\"Breaks command cannot have keyword params\");\n }\n if (typeof param.value !== \"number\") {\n throw new Error(\"Breaks command must be a list of integers\");\n }\n }\n }\n\n applyToNotation(notation: Notation): void {\n notation.currentBreaks = this.pattern;\n notation.resetLayoutParams();\n }\n}\n\nexport class SetCycle extends LayoutParamCommand {\n applyToNotation(notation: Notation): void {\n const value = this.params[0].value;\n // TODO - move the parsing to validation\n const cycle = parseCycle(value);\n notation.currentCycle = cycle;\n notation.resetLayoutParams();\n }\n}\n\nexport class SetBeatDuration extends LayoutParamCommand {\n validateParams(): void {\n if (this.params.length != 1 || typeof this.params[0].value !== \"number\") {\n throw new Error(\"beatDuration command must contain one number\");\n }\n }\n\n get beatDuration(): number {\n return this.params[0].value;\n }\n\n applyToNotation(notation: Notation): void {\n notation.currentAPB = this.beatDuration;\n notation.resetLayoutParams();\n }\n}\n"]}
|
package/lib/cjs/core.d.ts
CHANGED
|
@@ -1,32 +1,6 @@
|
|
|
1
1
|
import * as TSU from "@panyam/tsutils";
|
|
2
|
+
import { Entity, TimedEntity } from "./entity";
|
|
2
3
|
declare type Fraction = TSU.Num.Fraction;
|
|
3
|
-
export declare class Entity {
|
|
4
|
-
private static counter;
|
|
5
|
-
readonly uuid: number;
|
|
6
|
-
metadata: TSU.StringMap<any>;
|
|
7
|
-
parent: TSU.Nullable<Entity>;
|
|
8
|
-
constructor(config?: any);
|
|
9
|
-
debugValue(): any;
|
|
10
|
-
children(): Entity[];
|
|
11
|
-
get childCount(): number;
|
|
12
|
-
addChild(child: Entity, index?: number): this;
|
|
13
|
-
childAt(index: number): Entity;
|
|
14
|
-
indexOfChild(entity: Entity): number;
|
|
15
|
-
removeChildAt(index: number): Entity;
|
|
16
|
-
setChildAt(index: number, entity: Entity): this;
|
|
17
|
-
setMetadata(key: string, value: any): this;
|
|
18
|
-
getMetadata(key: string, recurse?: boolean): any;
|
|
19
|
-
get type(): unknown;
|
|
20
|
-
toString(): string;
|
|
21
|
-
equals(another: this, expect?: boolean): boolean;
|
|
22
|
-
clone(): this;
|
|
23
|
-
copyTo(another: this): void;
|
|
24
|
-
protected newInstance(): this;
|
|
25
|
-
}
|
|
26
|
-
export declare abstract class TimedEntity extends Entity {
|
|
27
|
-
abstract get duration(): Fraction;
|
|
28
|
-
equals(another: this): boolean;
|
|
29
|
-
}
|
|
30
4
|
export declare enum AtomType {
|
|
31
5
|
NOTE = "Note",
|
|
32
6
|
LITERAL = "Literal",
|
|
@@ -40,7 +14,10 @@ export declare abstract class Atom extends TimedEntity {
|
|
|
40
14
|
protected _duration: Fraction;
|
|
41
15
|
nextSibling: TSU.Nullable<Atom>;
|
|
42
16
|
prevSibling: TSU.Nullable<Atom>;
|
|
17
|
+
parentGroup: TSU.Nullable<Group>;
|
|
18
|
+
isContinuation: boolean;
|
|
43
19
|
constructor(duration?: TSU.Num.Fraction);
|
|
20
|
+
abstract splitAt(requiredDuration: Fraction): TSU.Nullable<Atom>;
|
|
44
21
|
debugValue(): any;
|
|
45
22
|
copyTo(another: this): void;
|
|
46
23
|
get duration(): Fraction;
|
|
@@ -48,6 +25,8 @@ export declare abstract class Atom extends TimedEntity {
|
|
|
48
25
|
}
|
|
49
26
|
export declare abstract class LeafAtom extends Atom {
|
|
50
27
|
beforeRest: boolean;
|
|
28
|
+
splitAt(duration: Fraction): TSU.Nullable<Atom>;
|
|
29
|
+
protected createSpilloverSpace(duration: Fraction): Space;
|
|
51
30
|
debugValue(): any;
|
|
52
31
|
}
|
|
53
32
|
export declare class Rest extends LeafAtom {
|
|
@@ -60,6 +39,7 @@ export declare class Space extends LeafAtom {
|
|
|
60
39
|
toString(): string;
|
|
61
40
|
copyTo(another: this): void;
|
|
62
41
|
equals(another: this): boolean;
|
|
42
|
+
protected createSpilloverSpace(duration: Fraction): Space;
|
|
63
43
|
}
|
|
64
44
|
export declare class Literal extends LeafAtom {
|
|
65
45
|
value: string;
|
|
@@ -87,56 +67,18 @@ export declare class Note extends Literal {
|
|
|
87
67
|
export declare class Group extends Atom {
|
|
88
68
|
durationIsMultiplier: boolean;
|
|
89
69
|
readonly atoms: TSU.Lists.ValueList<Atom>;
|
|
90
|
-
constructor(
|
|
91
|
-
get duration(): Fraction;
|
|
92
|
-
set duration(d: Fraction);
|
|
93
|
-
debugValue(): any;
|
|
94
|
-
get totalChildDuration(): Fraction;
|
|
70
|
+
constructor(...atoms: Atom[]);
|
|
95
71
|
equals(another: this, expect?: boolean): boolean;
|
|
96
72
|
copyTo(another: this): void;
|
|
97
|
-
addAtoms(...atoms: Atom[]): this;
|
|
98
|
-
}
|
|
99
|
-
export declare type CyclePosition = [number, number, number];
|
|
100
|
-
export declare type CycleIterator = Generator<[CyclePosition, Fraction]>;
|
|
101
|
-
export declare class CycleCursor {
|
|
102
|
-
readonly cycle: Cycle;
|
|
103
|
-
barIndex: number;
|
|
104
|
-
beatIndex: number;
|
|
105
|
-
instance: number;
|
|
106
|
-
constructor(cycle: Cycle, barIndex?: number, beatIndex?: number, instance?: number);
|
|
107
|
-
get next(): [CyclePosition, Fraction];
|
|
108
|
-
get prev(): [CyclePosition, Fraction];
|
|
109
|
-
}
|
|
110
|
-
export declare class Bar extends TimedEntity {
|
|
111
|
-
name: string;
|
|
112
|
-
beatLengths: Fraction[];
|
|
113
|
-
beatCounts: number[];
|
|
114
|
-
constructor(config?: any);
|
|
115
|
-
debugValue(): any;
|
|
116
|
-
equals(another: this): boolean;
|
|
117
|
-
copyTo(another: this): void;
|
|
118
|
-
get beatCount(): number;
|
|
119
|
-
get totalBeatCount(): number;
|
|
120
73
|
get duration(): Fraction;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
name: string;
|
|
124
|
-
bars: Bar[];
|
|
125
|
-
static readonly DEFAULT: Cycle;
|
|
126
|
-
constructor(config?: null | {
|
|
127
|
-
name?: string;
|
|
128
|
-
bars?: Bar[];
|
|
129
|
-
});
|
|
74
|
+
setDurationAsMultiplier(asMultiplier?: boolean): this;
|
|
75
|
+
setDuration(d: Fraction, asMultiplier?: boolean): this;
|
|
130
76
|
debugValue(): any;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
copyTo(another: this): void;
|
|
137
|
-
get beatCount(): number;
|
|
138
|
-
get totalBeatCount(): number;
|
|
139
|
-
get duration(): Fraction;
|
|
77
|
+
splitAt(requiredDuration: Fraction): TSU.Nullable<Group>;
|
|
78
|
+
get totalChildDuration(): Fraction;
|
|
79
|
+
insertAtomsAt(beforeAtom: TSU.Nullable<Atom>, adjustDuration?: boolean, ...atoms: Atom[]): this;
|
|
80
|
+
addAtoms(adjustDuration?: boolean, ...atoms: Atom[]): this;
|
|
81
|
+
removeAtoms(adjustDuration?: boolean, ...atoms: Atom[]): this;
|
|
140
82
|
}
|
|
141
83
|
export declare class Line extends Entity {
|
|
142
84
|
offset: Fraction;
|