notations 1.0.4 → 1.0.7
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 +1 -0
- package/dist/NotationView.css +15 -0
- package/dist/NotationView.css.map +1 -1
- package/dist/NotationView.min.css +1 -1
- package/dist/NotationView.min.css.map +1 -1
- package/dist/notations.umd.js +469 -108
- package/dist/notations.umd.min.js +2 -2
- package/dist/notations.umd.min.js.map +1 -1
- package/lib/cjs/beats.js +1 -1
- package/lib/cjs/beats.js.map +1 -1
- package/lib/cjs/block.d.ts +4 -0
- package/lib/cjs/block.js +24 -0
- package/lib/cjs/block.js.map +1 -1
- package/lib/cjs/carnatic/NotationView.d.ts +1 -0
- package/lib/cjs/carnatic/NotationView.js +10 -0
- package/lib/cjs/carnatic/NotationView.js.map +1 -1
- package/lib/cjs/carnatic/atomviews.d.ts +4 -1
- package/lib/cjs/carnatic/atomviews.js +18 -2
- package/lib/cjs/carnatic/atomviews.js.map +1 -1
- package/lib/cjs/carnatic/embelishments.d.ts +18 -1
- package/lib/cjs/carnatic/embelishments.js +87 -1
- package/lib/cjs/carnatic/embelishments.js.map +1 -1
- package/lib/cjs/core.d.ts +18 -3
- package/lib/cjs/core.js +161 -21
- package/lib/cjs/core.js.map +1 -1
- package/lib/cjs/entity.d.ts +4 -0
- package/lib/cjs/entity.js +12 -0
- package/lib/cjs/entity.js.map +1 -1
- package/lib/cjs/events.d.ts +56 -0
- package/lib/cjs/events.js +27 -0
- package/lib/cjs/events.js.map +1 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/shapes.d.ts +13 -1
- package/lib/cjs/shapes.js +35 -7
- package/lib/cjs/shapes.js.map +1 -1
- package/lib/esm/beats.js +1 -1
- package/lib/esm/beats.js.map +1 -1
- package/lib/esm/block.d.ts +4 -0
- package/lib/esm/block.js +24 -0
- package/lib/esm/block.js.map +1 -1
- package/lib/esm/carnatic/NotationView.d.ts +1 -0
- package/lib/esm/carnatic/NotationView.js +10 -0
- package/lib/esm/carnatic/NotationView.js.map +1 -1
- package/lib/esm/carnatic/atomviews.d.ts +4 -1
- package/lib/esm/carnatic/atomviews.js +19 -3
- package/lib/esm/carnatic/atomviews.js.map +1 -1
- package/lib/esm/carnatic/embelishments.d.ts +18 -1
- package/lib/esm/carnatic/embelishments.js +85 -0
- package/lib/esm/carnatic/embelishments.js.map +1 -1
- package/lib/esm/core.d.ts +18 -3
- package/lib/esm/core.js +161 -21
- package/lib/esm/core.js.map +1 -1
- package/lib/esm/entity.d.ts +4 -0
- package/lib/esm/entity.js +12 -0
- package/lib/esm/entity.js.map +1 -1
- package/lib/esm/events.d.ts +56 -0
- package/lib/esm/events.js +24 -0
- package/lib/esm/events.js.map +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/shapes.d.ts +13 -1
- package/lib/esm/shapes.js +34 -7
- package/lib/esm/shapes.js.map +1 -1
- package/package.json +3 -1
- package/styles/NotationView.scss +15 -0
|
@@ -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,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC,MAAM,OAAgB,wBAAyB,SAAQ,YAAY;IACjE,YAA4B,QAAsB;QAChD,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAc;IAElD,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,wBAAwB;IAK3D,YACkB,QAAsB,EACtB,IAAU;QAE1B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAHA,aAAQ,GAAR,QAAQ,CAAc;QACtB,SAAI,GAAJ,IAAI,CAAM;QAN5B,cAAS,GAAG,CAAC,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SU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../beatview\";\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(\n public readonly noteView: LeafAtomView,\n public readonly note: Note,\n ) {\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 class: \"notation-octave-dot\",\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(\n public readonly label: string,\n public readonly atomView: LeafAtomView,\n ) {\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 class: \"notation-embelishment-label\",\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(\n public readonly source: BeatView,\n public readonly rootElement: SVGGraphicsElement,\n ) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\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(\n public readonly source: BeatView,\n public readonly rootElement: SVGGraphicsElement,\n nLines = 1,\n ) {\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 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 = 0;\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(\n public readonly jaaru: JaaruGamaka,\n public readonly atomView: LeafAtomView,\n ) {\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 class: \"notation-jaaru-path\",\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
|
+
{"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAA8B,MAAM,WAAW,CAAC;AAOrE,MAAM,OAAgB,wBAAyB,SAAQ,YAAY;IACjE,YAA4B,QAAsB;QAChD,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAc;IAElD,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,wBAAwB;IAK3D,YACkB,QAAsB,EACtB,IAAU;QAE1B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAHA,aAAQ,GAAR,QAAQ,CAAc;QACtB,SAAI,GAAJ,IAAI,CAAM;QAN5B,cAAS,GAAG,CAAC,CAAC;QACd,eAAU,GAAG,GAAG,CAAC;QAQf,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,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,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU;gBACrE,MAAM,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC;gBAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,QA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AI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAExC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../beatview\";\nimport { Embelishment, GroupView as GroupViewBase } 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(\n public readonly noteView: LeafAtomView,\n public readonly note: Note,\n ) {\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 class: \"notation-octave-dot\",\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(\n public readonly label: string,\n public readonly atomView: LeafAtomView,\n ) {\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 class: \"notation-embelishment-label\",\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(\n public readonly source: BeatView,\n public readonly rootElement: SVGGraphicsElement,\n ) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\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(\n public readonly source: BeatView,\n public readonly rootElement: SVGGraphicsElement,\n nLines = 1,\n ) {\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 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 = 0;\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(\n public readonly jaaru: JaaruGamaka,\n public readonly atomView: LeafAtomView,\n ) {\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 class: \"notation-jaaru-path\",\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\n/**\n * Position mode for GroupBracket - controls how the bracket interacts with embellishments.\n */\nexport type GroupBracketPositionMode = \"above-all\" | \"below-embellishments\" | \"separate-space\";\n\n/**\n * Renders a single bracket line as the top border of a GroupView container.\n * Each nested group gets its own bracket line, creating a visual effect where\n * atoms inside deeply nested groups appear to have multiple lines above them.\n *\n * For example, with notation `A B [ S R [ P D [ W X ] ] ]`:\n * - Group 1 (outermost) has 1 bracket line\n * - Group 2 has 1 bracket line (inside Group 1's bracket)\n * - Group 3 (innermost) has 1 bracket line (inside Groups 1 & 2's brackets)\n * - Atoms W X visually appear to have 3 lines above (cumulative effect)\n */\nexport class GroupBracket extends Embelishment {\n private line: SVGLineElement | null = null;\n private leftCircle: SVGCircleElement | null = null;\n private rightCircle: SVGCircleElement | null = null;\n private bracketGroup: SVGGElement | null = null;\n\n // Configuration - exposed for experimentation\n /** Distance above group content */\n lineOffset = 2;\n /** End circle radius */\n circleRadius = 1.5;\n /** How far line extends beyond group content on each side */\n lineExtension = 2;\n\n /**\n * Position mode for embellishment interaction experimentation:\n * - 'above-all': Bracket at very top, above all embellishments\n * - 'below-embellishments': Bracket between glyphs and embellishments (default)\n * - 'separate-space': Bracket in dedicated reserved space\n */\n positionMode: GroupBracketPositionMode = \"below-embellishments\";\n\n constructor(public readonly groupView: GroupViewBase) {\n super();\n\n this.bracketGroup = TSU.DOM.createSVGNode(\"g\", {\n doc: document,\n parent: this.groupView.groupElement,\n attrs: {\n class: \"group-bracket\",\n source: \"group\" + this.groupView.group.uuid,\n },\n });\n\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.bracketGroup,\n attrs: {\n class: \"group-bracket-line\",\n },\n });\n\n this.leftCircle = TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.bracketGroup,\n attrs: {\n class: \"group-bracket-circle\",\n r: String(this.circleRadius),\n },\n });\n\n this.rightCircle = TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.bracketGroup,\n attrs: {\n class: \"group-bracket-circle\",\n r: String(this.circleRadius),\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n if (!this.bracketGroup) return new TSU.Geom.Rect(0, 0, 0, 0);\n return TSU.DOM.svgBBox(this.bracketGroup);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n // Single bracket line height contribution\n return new TSU.Geom.Size(0, this.lineOffset + this.circleRadius);\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 if (!this.line || !this.leftCircle || !this.rightCircle) return;\n\n const bbox = this.groupView.bbox;\n // Use actual content width (not bbox which may include extra space)\n const groupWidth = this.groupView.contentWidth || bbox.width;\n\n // Calculate Y position based on position mode\n let y: number;\n switch (this.positionMode) {\n case \"below-embellishments\":\n // Position just above glyph content, below other embellishments\n y = bbox.y + this.lineOffset - 2;\n break;\n case \"separate-space\":\n // Use dedicated space at very top of group bbox\n y = bbox.y - this.lineOffset;\n break;\n case \"above-all\":\n default:\n // Position above everything including embellishments\n y = bbox.y - this.lineOffset;\n break;\n }\n\n const x1 = -this.lineExtension;\n const x2 = groupWidth + this.lineExtension;\n\n this.line.setAttribute(\"x1\", String(x1));\n this.line.setAttribute(\"y1\", String(y));\n this.line.setAttribute(\"x2\", String(x2));\n this.line.setAttribute(\"y2\", String(y));\n\n this.leftCircle.setAttribute(\"cx\", String(x1));\n this.leftCircle.setAttribute(\"cy\", String(y));\n this.rightCircle.setAttribute(\"cx\", String(x2));\n this.rightCircle.setAttribute(\"cy\", String(y));\n }\n}\n"]}
|
package/lib/esm/core.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as TSU from "@panyam/tsutils";
|
|
2
2
|
import { Entity, TimedEntity } from "./entity";
|
|
3
3
|
import { LayoutParams } from "./layouts";
|
|
4
|
+
import { GroupObserver, RoleObserver, LineObserver } from "./events";
|
|
4
5
|
type Fraction = TSU.Num.Fraction;
|
|
5
6
|
export declare const ZERO: TSU.Num.Fraction;
|
|
6
7
|
export declare const ONE: TSU.Num.Fraction;
|
|
@@ -87,14 +88,18 @@ export declare class Note extends Literal {
|
|
|
87
88
|
}
|
|
88
89
|
export declare class Group extends Atom {
|
|
89
90
|
readonly TYPE = "Group";
|
|
90
|
-
|
|
91
|
+
durationIsSpeedMultiplier: boolean;
|
|
91
92
|
readonly atoms: TSU.Lists.ValueList<Atom>;
|
|
93
|
+
private _observers;
|
|
92
94
|
constructor(...atoms: Atom[]);
|
|
95
|
+
addObserver(observer: GroupObserver<Atom, Group>): () => void;
|
|
96
|
+
removeObserver(observer: GroupObserver<Atom, Group>): void;
|
|
97
|
+
private notifyObservers;
|
|
93
98
|
equals(another: this, expect?: boolean): boolean;
|
|
94
99
|
copyTo(another: this): void;
|
|
95
100
|
get duration(): Fraction;
|
|
96
|
-
setDurationAsMultiplier(
|
|
97
|
-
setDuration(d: Fraction,
|
|
101
|
+
setDurationAsMultiplier(asSpeedMultiplier?: boolean): this;
|
|
102
|
+
setDuration(d: Fraction, asSpeedMultiplier?: boolean): this;
|
|
98
103
|
debugValue(): any;
|
|
99
104
|
splitAt(requiredDuration: Fraction): TSU.Nullable<Group>;
|
|
100
105
|
get totalChildDuration(): Fraction;
|
|
@@ -108,12 +113,16 @@ export declare class Line extends Entity {
|
|
|
108
113
|
roles: Role[];
|
|
109
114
|
marginText: string;
|
|
110
115
|
layoutParams: LayoutParams;
|
|
116
|
+
private _observers;
|
|
117
|
+
addObserver(observer: LineObserver<Role, Line>): () => void;
|
|
118
|
+
removeObserver(observer: LineObserver<Role, Line>): void;
|
|
111
119
|
indexOfRole(name: string): number;
|
|
112
120
|
get isEmpty(): boolean;
|
|
113
121
|
debugValue(): any;
|
|
114
122
|
copyTo(another: this): void;
|
|
115
123
|
addAtoms(roleName: string, defaultToNotes: boolean, ...atoms: Atom[]): this;
|
|
116
124
|
ensureRole(roleName: string, defaultToNotes: boolean): Role;
|
|
125
|
+
removeRole(roleName: string): boolean;
|
|
117
126
|
get duration(): Fraction;
|
|
118
127
|
}
|
|
119
128
|
export declare class Role extends Entity {
|
|
@@ -122,10 +131,16 @@ export declare class Role extends Entity {
|
|
|
122
131
|
readonly TYPE = "Role";
|
|
123
132
|
defaultToNotes: boolean;
|
|
124
133
|
atoms: Atom[];
|
|
134
|
+
private _observers;
|
|
125
135
|
constructor(line: Line, name: string);
|
|
136
|
+
addObserver(observer: RoleObserver<Atom, Role>): () => void;
|
|
137
|
+
removeObserver(observer: RoleObserver<Atom, Role>): void;
|
|
138
|
+
private notifyObservers;
|
|
126
139
|
get isEmpty(): boolean;
|
|
127
140
|
debugValue(): any;
|
|
128
141
|
addAtoms(...atoms: Atom[]): void;
|
|
142
|
+
insertAtomsAt(index: number, ...atoms: Atom[]): void;
|
|
143
|
+
removeAtoms(...atoms: Atom[]): void;
|
|
129
144
|
copyTo(another: Role): void;
|
|
130
145
|
get duration(): Fraction;
|
|
131
146
|
}
|
package/lib/esm/core.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as TSU from "@panyam/tsutils";
|
|
2
2
|
import { Entity, TimedEntity } from "./entity";
|
|
3
|
+
import { AtomChangeType } from "./events";
|
|
3
4
|
export const ZERO = TSU.Num.Fraction.ZERO;
|
|
4
5
|
export const ONE = TSU.Num.Fraction.ONE;
|
|
5
6
|
export var AtomType;
|
|
@@ -201,10 +202,39 @@ export class Group extends Atom {
|
|
|
201
202
|
constructor(...atoms) {
|
|
202
203
|
super(atoms.length == 0 ? ZERO : ONE);
|
|
203
204
|
this.TYPE = "Group";
|
|
204
|
-
this.
|
|
205
|
+
this.durationIsSpeedMultiplier = false;
|
|
205
206
|
this.atoms = new TSU.Lists.ValueList();
|
|
207
|
+
this._observers = [];
|
|
206
208
|
this.addAtoms(false, ...atoms);
|
|
207
209
|
}
|
|
210
|
+
addObserver(observer) {
|
|
211
|
+
this._observers.push(observer);
|
|
212
|
+
return () => this.removeObserver(observer);
|
|
213
|
+
}
|
|
214
|
+
removeObserver(observer) {
|
|
215
|
+
const index = this._observers.indexOf(observer);
|
|
216
|
+
if (index >= 0) {
|
|
217
|
+
this._observers.splice(index, 1);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
notifyObservers(type, atoms, index) {
|
|
221
|
+
var _a, _b, _c;
|
|
222
|
+
if (!this._eventsEnabled)
|
|
223
|
+
return;
|
|
224
|
+
for (const observer of this._observers) {
|
|
225
|
+
switch (type) {
|
|
226
|
+
case AtomChangeType.ADD:
|
|
227
|
+
(_a = observer.onAtomsAdded) === null || _a === void 0 ? void 0 : _a.call(observer, this, atoms, index);
|
|
228
|
+
break;
|
|
229
|
+
case AtomChangeType.INSERT:
|
|
230
|
+
(_b = observer.onAtomsInserted) === null || _b === void 0 ? void 0 : _b.call(observer, this, atoms, index);
|
|
231
|
+
break;
|
|
232
|
+
case AtomChangeType.REMOVE:
|
|
233
|
+
(_c = observer.onAtomsRemoved) === null || _c === void 0 ? void 0 : _c.call(observer, this, atoms);
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
208
238
|
equals(another, expect = false) {
|
|
209
239
|
if (!super.equals(another))
|
|
210
240
|
return false;
|
|
@@ -212,30 +242,32 @@ export class Group extends Atom {
|
|
|
212
242
|
}
|
|
213
243
|
copyTo(another) {
|
|
214
244
|
super.copyTo(another);
|
|
215
|
-
another.
|
|
216
|
-
|
|
245
|
+
another.durationIsSpeedMultiplier = this.durationIsSpeedMultiplier;
|
|
246
|
+
for (const atom of this.atoms.values()) {
|
|
247
|
+
another.atoms.add(atom.clone());
|
|
248
|
+
}
|
|
217
249
|
}
|
|
218
250
|
get duration() {
|
|
219
|
-
if (this.
|
|
251
|
+
if (this.durationIsSpeedMultiplier) {
|
|
220
252
|
return this.totalChildDuration.divby(this._duration);
|
|
221
253
|
}
|
|
222
254
|
else {
|
|
223
255
|
return this._duration;
|
|
224
256
|
}
|
|
225
257
|
}
|
|
226
|
-
setDurationAsMultiplier(
|
|
227
|
-
this.
|
|
258
|
+
setDurationAsMultiplier(asSpeedMultiplier = true) {
|
|
259
|
+
this.durationIsSpeedMultiplier = asSpeedMultiplier;
|
|
228
260
|
return this;
|
|
229
261
|
}
|
|
230
|
-
setDuration(d,
|
|
262
|
+
setDuration(d, asSpeedMultiplier = false) {
|
|
231
263
|
this._duration = d;
|
|
232
|
-
this.
|
|
264
|
+
this.durationIsSpeedMultiplier = asSpeedMultiplier;
|
|
233
265
|
return this;
|
|
234
266
|
}
|
|
235
267
|
debugValue() {
|
|
236
268
|
const out = Object.assign(Object.assign({}, super.debugValue()), { atoms: Array.from(this.atoms.values(), (a) => a.debugValue()) });
|
|
237
|
-
if (this.
|
|
238
|
-
out.
|
|
269
|
+
if (this.durationIsSpeedMultiplier)
|
|
270
|
+
out.durationIsSpeedMultiplier = true;
|
|
239
271
|
return out;
|
|
240
272
|
}
|
|
241
273
|
splitAt(requiredDuration) {
|
|
@@ -243,13 +275,13 @@ export class Group extends Atom {
|
|
|
243
275
|
return null;
|
|
244
276
|
}
|
|
245
277
|
const targetGroup = new Group();
|
|
246
|
-
if (this.
|
|
247
|
-
targetGroup.
|
|
278
|
+
if (this.durationIsSpeedMultiplier) {
|
|
279
|
+
targetGroup.durationIsSpeedMultiplier = true;
|
|
248
280
|
targetGroup._duration = this._duration;
|
|
249
281
|
}
|
|
250
282
|
let remainingDur = this.duration;
|
|
251
283
|
const totalChildDuration = this.totalChildDuration;
|
|
252
|
-
const durationFactor = this.
|
|
284
|
+
const durationFactor = this.durationIsSpeedMultiplier
|
|
253
285
|
? ONE.divby(this._duration)
|
|
254
286
|
: this._duration.divby(totalChildDuration, true);
|
|
255
287
|
while (remainingDur.isGT(requiredDuration) && this.atoms.last) {
|
|
@@ -269,7 +301,7 @@ export class Group extends Atom {
|
|
|
269
301
|
if (spillOver == null) {
|
|
270
302
|
throw new Error("Spill over cannot be null here");
|
|
271
303
|
}
|
|
272
|
-
if (!this.
|
|
304
|
+
if (!this.durationIsSpeedMultiplier) {
|
|
273
305
|
this._duration = requiredDuration;
|
|
274
306
|
}
|
|
275
307
|
else {
|
|
@@ -286,12 +318,27 @@ export class Group extends Atom {
|
|
|
286
318
|
}
|
|
287
319
|
get totalChildDuration() {
|
|
288
320
|
let out = ZERO;
|
|
289
|
-
|
|
321
|
+
for (const atom of this.atoms.values()) {
|
|
322
|
+
out = out.plus(atom.duration);
|
|
323
|
+
}
|
|
290
324
|
return out;
|
|
291
325
|
}
|
|
292
326
|
insertAtomsAt(beforeAtom, adjustDuration = false, ...atoms) {
|
|
293
|
-
adjustDuration = adjustDuration && !this.
|
|
327
|
+
adjustDuration = adjustDuration && !this.durationIsSpeedMultiplier;
|
|
294
328
|
const oldChildDuration = adjustDuration ? this.totalChildDuration : ONE;
|
|
329
|
+
let insertIndex;
|
|
330
|
+
if (beforeAtom) {
|
|
331
|
+
insertIndex = 0;
|
|
332
|
+
for (const a of this.atoms.values()) {
|
|
333
|
+
if (a === beforeAtom)
|
|
334
|
+
break;
|
|
335
|
+
insertIndex++;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
insertIndex = this.atoms.size;
|
|
340
|
+
}
|
|
341
|
+
const addedAtoms = [];
|
|
295
342
|
for (const atom of atoms) {
|
|
296
343
|
if (atom.parentGroup != null) {
|
|
297
344
|
if (atom.parentGroup != this) {
|
|
@@ -308,11 +355,12 @@ export class Group extends Atom {
|
|
|
308
355
|
else {
|
|
309
356
|
atom.parentGroup = this;
|
|
310
357
|
this.atoms.add(atom, beforeAtom);
|
|
358
|
+
addedAtoms.push(atom);
|
|
311
359
|
}
|
|
312
360
|
}
|
|
313
361
|
if (adjustDuration) {
|
|
314
362
|
if (this._duration.isZero) {
|
|
315
|
-
if (this.
|
|
363
|
+
if (this.durationIsSpeedMultiplier)
|
|
316
364
|
throw new Error("How can this be?");
|
|
317
365
|
this._duration = this.totalChildDuration;
|
|
318
366
|
}
|
|
@@ -321,18 +369,24 @@ export class Group extends Atom {
|
|
|
321
369
|
this._duration = this._duration.times(scaleFactor, true);
|
|
322
370
|
}
|
|
323
371
|
}
|
|
372
|
+
if (addedAtoms.length > 0) {
|
|
373
|
+
const type = beforeAtom ? AtomChangeType.INSERT : AtomChangeType.ADD;
|
|
374
|
+
this.notifyObservers(type, addedAtoms, insertIndex);
|
|
375
|
+
}
|
|
324
376
|
return this;
|
|
325
377
|
}
|
|
326
378
|
addAtoms(adjustDuration = false, ...atoms) {
|
|
327
379
|
return this.insertAtomsAt(null, adjustDuration, ...atoms);
|
|
328
380
|
}
|
|
329
381
|
removeAtoms(adjustDuration = false, ...atoms) {
|
|
330
|
-
adjustDuration = adjustDuration && !this.
|
|
382
|
+
adjustDuration = adjustDuration && !this.durationIsSpeedMultiplier;
|
|
331
383
|
const oldChildDuration = adjustDuration ? this.totalChildDuration : ONE;
|
|
384
|
+
const removedAtoms = [];
|
|
332
385
|
for (const atom of atoms) {
|
|
333
386
|
if (atom.parentGroup == this) {
|
|
334
387
|
this.atoms.remove(atom);
|
|
335
388
|
atom.parentGroup = null;
|
|
389
|
+
removedAtoms.push(atom);
|
|
336
390
|
}
|
|
337
391
|
else if (atom.parentGroup != null) {
|
|
338
392
|
throw new Error("Atom cannot be removed as it does not belong to this group");
|
|
@@ -340,7 +394,7 @@ export class Group extends Atom {
|
|
|
340
394
|
}
|
|
341
395
|
if (adjustDuration) {
|
|
342
396
|
if (this._duration.isZero) {
|
|
343
|
-
if (this.
|
|
397
|
+
if (this.durationIsSpeedMultiplier)
|
|
344
398
|
throw new Error("How can this be?");
|
|
345
399
|
this._duration = this.totalChildDuration;
|
|
346
400
|
}
|
|
@@ -349,6 +403,9 @@ export class Group extends Atom {
|
|
|
349
403
|
this._duration = this._duration.times(scaleFactor, true);
|
|
350
404
|
}
|
|
351
405
|
}
|
|
406
|
+
if (removedAtoms.length > 0) {
|
|
407
|
+
this.notifyObservers(AtomChangeType.REMOVE, removedAtoms, -1);
|
|
408
|
+
}
|
|
352
409
|
return this;
|
|
353
410
|
}
|
|
354
411
|
}
|
|
@@ -359,6 +416,17 @@ export class Line extends Entity {
|
|
|
359
416
|
this.offset = ZERO;
|
|
360
417
|
this.roles = [];
|
|
361
418
|
this.marginText = "";
|
|
419
|
+
this._observers = [];
|
|
420
|
+
}
|
|
421
|
+
addObserver(observer) {
|
|
422
|
+
this._observers.push(observer);
|
|
423
|
+
return () => this.removeObserver(observer);
|
|
424
|
+
}
|
|
425
|
+
removeObserver(observer) {
|
|
426
|
+
const index = this._observers.indexOf(observer);
|
|
427
|
+
if (index >= 0) {
|
|
428
|
+
this._observers.splice(index, 1);
|
|
429
|
+
}
|
|
362
430
|
}
|
|
363
431
|
indexOfRole(name) {
|
|
364
432
|
for (let i = 0; i < this.roles.length; i++) {
|
|
@@ -390,15 +458,35 @@ export class Line extends Entity {
|
|
|
390
458
|
return this;
|
|
391
459
|
}
|
|
392
460
|
ensureRole(roleName, defaultToNotes) {
|
|
461
|
+
var _a;
|
|
393
462
|
let ri = this.roles.findIndex((r) => r.name == roleName);
|
|
394
463
|
if (ri < 0) {
|
|
395
464
|
ri = this.roles.length;
|
|
396
465
|
const role = new Role(this, roleName);
|
|
397
466
|
role.defaultToNotes = defaultToNotes;
|
|
398
467
|
this.roles.push(role);
|
|
468
|
+
if (this._eventsEnabled) {
|
|
469
|
+
for (const observer of this._observers) {
|
|
470
|
+
(_a = observer.onRoleAdded) === null || _a === void 0 ? void 0 : _a.call(observer, this, roleName, role);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
399
473
|
}
|
|
400
474
|
return this.roles[ri];
|
|
401
475
|
}
|
|
476
|
+
removeRole(roleName) {
|
|
477
|
+
var _a;
|
|
478
|
+
const ri = this.roles.findIndex((r) => r.name == roleName);
|
|
479
|
+
if (ri >= 0) {
|
|
480
|
+
this.roles.splice(ri, 1);
|
|
481
|
+
if (this._eventsEnabled) {
|
|
482
|
+
for (const observer of this._observers) {
|
|
483
|
+
(_a = observer.onRoleRemoved) === null || _a === void 0 ? void 0 : _a.call(observer, this, roleName);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return true;
|
|
487
|
+
}
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
402
490
|
get duration() {
|
|
403
491
|
let max = ZERO;
|
|
404
492
|
for (const role of this.roles) {
|
|
@@ -415,6 +503,35 @@ export class Role extends Entity {
|
|
|
415
503
|
this.TYPE = "Role";
|
|
416
504
|
this.defaultToNotes = true;
|
|
417
505
|
this.atoms = [];
|
|
506
|
+
this._observers = [];
|
|
507
|
+
}
|
|
508
|
+
addObserver(observer) {
|
|
509
|
+
this._observers.push(observer);
|
|
510
|
+
return () => this.removeObserver(observer);
|
|
511
|
+
}
|
|
512
|
+
removeObserver(observer) {
|
|
513
|
+
const index = this._observers.indexOf(observer);
|
|
514
|
+
if (index >= 0) {
|
|
515
|
+
this._observers.splice(index, 1);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
notifyObservers(type, atoms, index) {
|
|
519
|
+
var _a, _b, _c;
|
|
520
|
+
if (!this._eventsEnabled)
|
|
521
|
+
return;
|
|
522
|
+
for (const observer of this._observers) {
|
|
523
|
+
switch (type) {
|
|
524
|
+
case AtomChangeType.ADD:
|
|
525
|
+
(_a = observer.onAtomsAdded) === null || _a === void 0 ? void 0 : _a.call(observer, this, atoms, index);
|
|
526
|
+
break;
|
|
527
|
+
case AtomChangeType.INSERT:
|
|
528
|
+
(_b = observer.onAtomsInserted) === null || _b === void 0 ? void 0 : _b.call(observer, this, atoms, index);
|
|
529
|
+
break;
|
|
530
|
+
case AtomChangeType.REMOVE:
|
|
531
|
+
(_c = observer.onAtomsRemoved) === null || _c === void 0 ? void 0 : _c.call(observer, this, atoms);
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
418
535
|
}
|
|
419
536
|
get isEmpty() {
|
|
420
537
|
return this.atoms.length == 0;
|
|
@@ -423,7 +540,11 @@ export class Role extends Entity {
|
|
|
423
540
|
return { name: this.name, atoms: this.atoms.map((a) => a.debugValue()) };
|
|
424
541
|
}
|
|
425
542
|
addAtoms(...atoms) {
|
|
426
|
-
|
|
543
|
+
this.insertAtomsAt(this.atoms.length, ...atoms);
|
|
544
|
+
}
|
|
545
|
+
insertAtomsAt(index, ...atoms) {
|
|
546
|
+
const addedAtoms = [];
|
|
547
|
+
let last = index > 0 ? this.atoms[index - 1] : null;
|
|
427
548
|
for (const atom of atoms) {
|
|
428
549
|
if (atom.TYPE == AtomType.REST) {
|
|
429
550
|
if (last && last.TYPE != AtomType.GROUP && last.TYPE != AtomType.LABEL) {
|
|
@@ -431,10 +552,29 @@ export class Role extends Entity {
|
|
|
431
552
|
}
|
|
432
553
|
}
|
|
433
554
|
else {
|
|
434
|
-
this.atoms.
|
|
555
|
+
this.atoms.splice(index + addedAtoms.length, 0, atom);
|
|
556
|
+
addedAtoms.push(atom);
|
|
435
557
|
}
|
|
436
558
|
last = atom;
|
|
437
559
|
}
|
|
560
|
+
if (addedAtoms.length > 0) {
|
|
561
|
+
const isAppend = index >= this.atoms.length - addedAtoms.length;
|
|
562
|
+
const type = isAppend ? AtomChangeType.ADD : AtomChangeType.INSERT;
|
|
563
|
+
this.notifyObservers(type, addedAtoms, index);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
removeAtoms(...atoms) {
|
|
567
|
+
const removedAtoms = [];
|
|
568
|
+
for (const atom of atoms) {
|
|
569
|
+
const idx = this.atoms.indexOf(atom);
|
|
570
|
+
if (idx >= 0) {
|
|
571
|
+
this.atoms.splice(idx, 1);
|
|
572
|
+
removedAtoms.push(atom);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (removedAtoms.length > 0) {
|
|
576
|
+
this.notifyObservers(AtomChangeType.REMOVE, removedAtoms, -1);
|
|
577
|
+
}
|
|
438
578
|
}
|
|
439
579
|
copyTo(another) {
|
|
440
580
|
another.addAtoms(...this.atoms);
|