notations 1.0.6 → 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/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 +142 -26
- 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/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 +3 -3
- package/lib/cjs/core.js +17 -17
- package/lib/cjs/core.js.map +1 -1
- package/lib/cjs/shapes.d.ts +2 -1
- package/lib/cjs/shapes.js +11 -6
- 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/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 +3 -3
- package/lib/esm/core.js +17 -17
- package/lib/esm/core.js.map +1 -1
- package/lib/esm/shapes.d.ts +2 -1
- package/lib/esm/shapes.js +11 -6
- package/lib/esm/shapes.js.map +1 -1
- package/package.json +1 -1
- package/styles/NotationView.scss +15 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAGvC,sCAAyC;AAOzC,MAAsB,wBAAyB,SAAQ,qBAAY;IACjE,YAA4B,QAAsB;QAChD,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAc;IAElD,CAAC;CACF;AAJD,4DAIC;AAED,MAAa,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,QAAQ,CAAC,IAAI;aAC7C;SACF,CAAC,CAAC;QACH,IAAI,EAAE,GAAG,C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G,CAAC,GAAG,EAAE,CAAC;QACd,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IAES,cAAc;QACtB,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,WAAW;QACnB,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,YAAY,CACpB,CAAgB,EAChB,EAAiB,EACjB,EAAiB,EACjB,EAAiB;QAEjB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,aAAa;QACX,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAzDD,sBAyDC","sourcesContent":["import * as TSU 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,qDAAuC;AAGvC,sCAAqE;AAOrE,MAAsB,wBAAyB,SAAQ,qBAAY;IACjE,YAA4B,QAAsB;QAChD,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAc;IAElD,CAAC;CACF;AAJD,4DAIC;AAED,MAAa,eAAgB,SAAQ,wBAAwB;IAK3D,YACk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AAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACF;AAtHD,oCAsHC","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/cjs/core.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export declare class Note extends Literal {
|
|
|
88
88
|
}
|
|
89
89
|
export declare class Group extends Atom {
|
|
90
90
|
readonly TYPE = "Group";
|
|
91
|
-
|
|
91
|
+
durationIsSpeedMultiplier: boolean;
|
|
92
92
|
readonly atoms: TSU.Lists.ValueList<Atom>;
|
|
93
93
|
private _observers;
|
|
94
94
|
constructor(...atoms: Atom[]);
|
|
@@ -98,8 +98,8 @@ export declare class Group extends Atom {
|
|
|
98
98
|
equals(another: this, expect?: boolean): boolean;
|
|
99
99
|
copyTo(another: this): void;
|
|
100
100
|
get duration(): Fraction;
|
|
101
|
-
setDurationAsMultiplier(
|
|
102
|
-
setDuration(d: Fraction,
|
|
101
|
+
setDurationAsMultiplier(asSpeedMultiplier?: boolean): this;
|
|
102
|
+
setDuration(d: Fraction, asSpeedMultiplier?: boolean): this;
|
|
103
103
|
debugValue(): any;
|
|
104
104
|
splitAt(requiredDuration: Fraction): TSU.Nullable<Group>;
|
|
105
105
|
get totalChildDuration(): Fraction;
|
package/lib/cjs/core.js
CHANGED
|
@@ -246,7 +246,7 @@ class Group extends Atom {
|
|
|
246
246
|
constructor(...atoms) {
|
|
247
247
|
super(atoms.length == 0 ? exports.ZERO : exports.ONE);
|
|
248
248
|
this.TYPE = "Group";
|
|
249
|
-
this.
|
|
249
|
+
this.durationIsSpeedMultiplier = false;
|
|
250
250
|
this.atoms = new TSU.Lists.ValueList();
|
|
251
251
|
this._observers = [];
|
|
252
252
|
this.addAtoms(false, ...atoms);
|
|
@@ -286,32 +286,32 @@ class Group extends Atom {
|
|
|
286
286
|
}
|
|
287
287
|
copyTo(another) {
|
|
288
288
|
super.copyTo(another);
|
|
289
|
-
another.
|
|
289
|
+
another.durationIsSpeedMultiplier = this.durationIsSpeedMultiplier;
|
|
290
290
|
for (const atom of this.atoms.values()) {
|
|
291
291
|
another.atoms.add(atom.clone());
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
get duration() {
|
|
295
|
-
if (this.
|
|
295
|
+
if (this.durationIsSpeedMultiplier) {
|
|
296
296
|
return this.totalChildDuration.divby(this._duration);
|
|
297
297
|
}
|
|
298
298
|
else {
|
|
299
299
|
return this._duration;
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
setDurationAsMultiplier(
|
|
303
|
-
this.
|
|
302
|
+
setDurationAsMultiplier(asSpeedMultiplier = true) {
|
|
303
|
+
this.durationIsSpeedMultiplier = asSpeedMultiplier;
|
|
304
304
|
return this;
|
|
305
305
|
}
|
|
306
|
-
setDuration(d,
|
|
306
|
+
setDuration(d, asSpeedMultiplier = false) {
|
|
307
307
|
this._duration = d;
|
|
308
|
-
this.
|
|
308
|
+
this.durationIsSpeedMultiplier = asSpeedMultiplier;
|
|
309
309
|
return this;
|
|
310
310
|
}
|
|
311
311
|
debugValue() {
|
|
312
312
|
const out = Object.assign(Object.assign({}, super.debugValue()), { atoms: Array.from(this.atoms.values(), (a) => a.debugValue()) });
|
|
313
|
-
if (this.
|
|
314
|
-
out.
|
|
313
|
+
if (this.durationIsSpeedMultiplier)
|
|
314
|
+
out.durationIsSpeedMultiplier = true;
|
|
315
315
|
return out;
|
|
316
316
|
}
|
|
317
317
|
splitAt(requiredDuration) {
|
|
@@ -319,13 +319,13 @@ class Group extends Atom {
|
|
|
319
319
|
return null;
|
|
320
320
|
}
|
|
321
321
|
const targetGroup = new Group();
|
|
322
|
-
if (this.
|
|
323
|
-
targetGroup.
|
|
322
|
+
if (this.durationIsSpeedMultiplier) {
|
|
323
|
+
targetGroup.durationIsSpeedMultiplier = true;
|
|
324
324
|
targetGroup._duration = this._duration;
|
|
325
325
|
}
|
|
326
326
|
let remainingDur = this.duration;
|
|
327
327
|
const totalChildDuration = this.totalChildDuration;
|
|
328
|
-
const durationFactor = this.
|
|
328
|
+
const durationFactor = this.durationIsSpeedMultiplier
|
|
329
329
|
? exports.ONE.divby(this._duration)
|
|
330
330
|
: this._duration.divby(totalChildDuration, true);
|
|
331
331
|
while (remainingDur.isGT(requiredDuration) && this.atoms.last) {
|
|
@@ -345,7 +345,7 @@ class Group extends Atom {
|
|
|
345
345
|
if (spillOver == null) {
|
|
346
346
|
throw new Error("Spill over cannot be null here");
|
|
347
347
|
}
|
|
348
|
-
if (!this.
|
|
348
|
+
if (!this.durationIsSpeedMultiplier) {
|
|
349
349
|
this._duration = requiredDuration;
|
|
350
350
|
}
|
|
351
351
|
else {
|
|
@@ -368,7 +368,7 @@ class Group extends Atom {
|
|
|
368
368
|
return out;
|
|
369
369
|
}
|
|
370
370
|
insertAtomsAt(beforeAtom, adjustDuration = false, ...atoms) {
|
|
371
|
-
adjustDuration = adjustDuration && !this.
|
|
371
|
+
adjustDuration = adjustDuration && !this.durationIsSpeedMultiplier;
|
|
372
372
|
const oldChildDuration = adjustDuration ? this.totalChildDuration : exports.ONE;
|
|
373
373
|
let insertIndex;
|
|
374
374
|
if (beforeAtom) {
|
|
@@ -404,7 +404,7 @@ class Group extends Atom {
|
|
|
404
404
|
}
|
|
405
405
|
if (adjustDuration) {
|
|
406
406
|
if (this._duration.isZero) {
|
|
407
|
-
if (this.
|
|
407
|
+
if (this.durationIsSpeedMultiplier)
|
|
408
408
|
throw new Error("How can this be?");
|
|
409
409
|
this._duration = this.totalChildDuration;
|
|
410
410
|
}
|
|
@@ -423,7 +423,7 @@ class Group extends Atom {
|
|
|
423
423
|
return this.insertAtomsAt(null, adjustDuration, ...atoms);
|
|
424
424
|
}
|
|
425
425
|
removeAtoms(adjustDuration = false, ...atoms) {
|
|
426
|
-
adjustDuration = adjustDuration && !this.
|
|
426
|
+
adjustDuration = adjustDuration && !this.durationIsSpeedMultiplier;
|
|
427
427
|
const oldChildDuration = adjustDuration ? this.totalChildDuration : exports.ONE;
|
|
428
428
|
const removedAtoms = [];
|
|
429
429
|
for (const atom of atoms) {
|
|
@@ -438,7 +438,7 @@ class Group extends Atom {
|
|
|
438
438
|
}
|
|
439
439
|
if (adjustDuration) {
|
|
440
440
|
if (this._duration.isZero) {
|
|
441
|
-
if (this.
|
|
441
|
+
if (this.durationIsSpeedMultiplier)
|
|
442
442
|
throw new Error("How can this be?");
|
|
443
443
|
this._duration = this.totalChildDuration;
|
|
444
444
|
}
|
package/lib/cjs/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,qCAA+C;AAE/C,qCAAqF;AAMxE,QAAA,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC7B,QAAA,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;AAOxC,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EATW,QAAQ,wBAAR,QAAQ,QASnB;AAMD,MAAsB,IAAK,SAAQ,oBAAW;IAsB5C,YAAY,QAAQ,GAAG,WAAG;QACxB,KAAK,EAAE,CAAC;QAtBD,SAAI,GAAW,MAAM,CAAC;QAQ/B,gBAAW,GAAuB,IAAI,CAAC;QAEvC,gBAAW,GAAuB,IAAI,CAAC;QAEvC,gBAAW,GAAwB,IAAI,CAAC;QAGxC,mBAAc,GAAG,KAAK,CAAC;QAQrB,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI,WAAG,CAAC;IACnC,CAAC;IAaD,UAAU;QACR,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,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AAC;QACH,CAAC;QAGD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,eAAe,CAAC,uBAAc,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAMD,MAAM,CAAC,OAAa;QAClB,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAKD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,YAAI,CAAC,CAAC;IAC/D,CAAC;CACF;AA/JD,oBA+JC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Entity, TimedEntity } from \"./entity\";\nimport { LayoutParams } from \"./layouts\";\nimport { AtomChangeType, GroupObserver, RoleObserver, LineObserver } from \"./events\";\n\n/**\n * Alias to TSU.Num.Fraction in tsutils.\n */\ntype Fraction = TSU.Num.Fraction;\nexport const ZERO = TSU.Num.Fraction.ZERO;\nexport const ONE = TSU.Num.Fraction.ONE;\n\n/**\n * AtomType enums are used to denote specific Atoms\n * Each type represents a specific musical or notational element.\n * @enum\n */\nexport enum AtomType {\n NOTE = \"Note\",\n LITERAL = \"Literal\",\n SYLLABLE = \"Syllable\",\n SPACE = \"Space\",\n GROUP = \"Group\",\n LABEL = \"Label\",\n REST = \"Rest\",\n MARKER = \"Marker\",\n}\n\n/**\n * Atoms are the base class for all timed entities that can appear in a Notation.\n * An Atom represents the fundamental building block of the notation system.\n */\nexport abstract class Atom extends TimedEntity {\n readonly TYPE: string = \"Atom\";\n\n protected _duration: Fraction;\n /** Markers to be displayed before this atom */\n markersBefore: Marker[];\n /** Markers to be displayed after this atom */\n markersAfter: Marker[];\n /** Next atom in the sequence */\n nextSibling: TSU.Nullable<Atom> = null;\n /** Previous atom in the sequence */\n prevSibling: TSU.Nullable<Atom> = null;\n /** The Group this Atom belongs to, if any */\n parentGroup: TSU.Nullable<Group> = null;\n\n /** Indicates if this Atom is a continuation from a previous atom */\n isContinuation = false;\n\n /**\n * Creates a new Atom with the specified duration.\n * @param duration The duration of the atom, defaults to ONE (1/1)\n */\n constructor(duration = ONE) {\n super();\n this._duration = duration || ONE;\n }\n\n /**\n * Splits this atom at the specified duration.\n * @param requiredDuration The duration at which to split the atom\n * @returns A new atom representing the portion beyond the split point, or null if no split is needed\n */\n abstract splitAt(requiredDuration: Fraction): TSU.Nullable<Atom>;\n\n /**\n * Returns a debug-friendly representation of this Atom.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = super.debugValue();\n if (!this.duration.isOne) {\n out.duration = this.duration.factorized.toString();\n }\n if (this.isContinuation) {\n out.isContinuation = true;\n }\n if ((this.markersBefore || []).length > 0) {\n out.mbef = this.markersBefore.map((m) => m.debugValue());\n }\n if ((this.markersAfter || []).length > 0) {\n out.maft = this.markersAfter.map((m) => m.debugValue());\n }\n return out;\n }\n\n /**\n * Copies the properties of this atom to another atom.\n * @param another The target atom to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another._duration = new TSU.Num.Fraction(this.duration.num, this.duration.den);\n }\n\n /**\n * Gets the duration of this atom.\n */\n get duration(): Fraction {\n return this._duration;\n }\n\n /**\n * Sets the duration of this atom.\n */\n set duration(d: Fraction) {\n this._duration = d;\n }\n}\n\n/**\n * Base class for atoms that cannot contain other atoms.\n * LeafAtom represents atomic elements that can't be further subdivided.\n */\nexport abstract class LeafAtom extends Atom {\n readonly TYPE: string = \"LeafAtom\";\n\n /** Indicates if this atom is followed by a rest */\n beforeRest = false;\n\n /**\n * Splits this atom at a certain duration.\n * If this atom's duration is longer than the given duration, it's truncated\n * to the given duration and a continuation space is returned.\n *\n * @param duration The duration at which to split the atom\n * @returns A new Space atom representing the spillover if needed, otherwise null\n */\n splitAt(duration: Fraction): TSU.Nullable<Atom> {\n if (this.duration.cmp(duration) > 0) {\n const spillOver = this.createSpilloverSpace(this.duration.minus(duration));\n spillOver.isContinuation = true;\n this.duration = duration;\n // TODO - Here we need to move the markersAfter to the spill-over as it doesnt belong to this any more\n return spillOver;\n }\n return null;\n }\n\n /**\n * Creates a Space atom to represent spillover duration when splitting.\n * @param duration The duration of the spillover\n * @returns A new Space atom\n */\n protected createSpilloverSpace(duration: Fraction): Space {\n return new Space(duration);\n }\n\n /**\n * Returns a debug-friendly representation of this LeafAtom.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return this.beforeRest ? { ...super.debugValue(), beforeRest: true } : super.debugValue();\n }\n}\n\n/**\n * Represents a marker or annotation in the notation.\n * Markers can be placed before or after atoms to provide additional context.\n */\nexport class Marker extends Entity {\n readonly TYPE = \"Marker\";\n\n /**\n * Creates a new Marker with the specified text.\n * @param text The text content of the marker\n * @param isBefore Whether the marker should appear before (true) or after (false) its associated atom\n */\n constructor(\n public text: string,\n public isBefore = true,\n ) {\n super();\n }\n\n /**\n * Returns a debug-friendly representation of this Marker.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return { ...super.debugValue(), text: this.text, before: this.isBefore };\n }\n\n /**\n * Returns a string representation of this Marker.\n * @returns A string representation\n */\n toString(): string {\n return `Marker(${this.text}-${this.isBefore})`;\n }\n}\n\n/**\n * Represents a rest (silence) in the notation.\n * Rests are zero-length atoms that indicate a pause.\n */\nexport class Rest extends LeafAtom {\n readonly TYPE = \"Rest\";\n\n /**\n * Creates a new Rest.\n * Rests are zero length by default.\n */\n constructor() {\n super(ZERO);\n }\n}\n\n/**\n * Represents a space or silence in the notation.\n * Spaces can be used to denote either silence or continuations of previous notes.\n */\nexport class Space extends LeafAtom {\n readonly TYPE = \"Space\";\n\n /**\n * Indicates whether this is a silent space or a continuation of the previous note.\n */\n isSilent = false;\n\n /**\n * Creates a new Space with the specified duration and silence property.\n * @param duration The duration of the space, defaults to ONE (1/1)\n * @param isSilent Whether the space represents silence (true) or a continuation (false)\n */\n constructor(duration = ONE, isSilent = false) {\n super(duration);\n this.isSilent = isSilent;\n }\n\n /**\n * Returns a debug-friendly representation of this Space.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return { ...super.debugValue(), isSilent: this.isSilent };\n }\n\n /**\n * Returns a string representation of this Space.\n * @returns A string representation\n */\n toString(): string {\n return `Space(${this.duration}-${this.isSilent})`;\n }\n\n /**\n * Copies the properties of this Space to another Space.\n * @param another The target Space to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.isSilent = this.isSilent;\n }\n\n /**\n * Checks if this Space is equal to another Space.\n * @param another The Space to compare with\n * @returns True if the Spaces are equal, false otherwise\n */\n equals(another: this): boolean {\n return super.equals(another) && this.isSilent == another.isSilent;\n }\n\n /**\n * Creates a Space atom to represent spillover duration when splitting.\n * @param duration The duration of the spillover\n * @returns A new Space atom with the same silence property as this Space\n */\n protected createSpilloverSpace(duration: Fraction): Space {\n const out = super.createSpilloverSpace(duration);\n out.isSilent = this.isSilent;\n return out;\n }\n}\n\n/**\n * Represents a literal value in the notation.\n * Literals are the basic building blocks for notes and syllables.\n */\nexport class Literal extends LeafAtom {\n readonly TYPE: string = \"Literal\";\n\n /**\n * The embellishments applied to this Literal.\n */\n embelishments: any[] = [];\n\n /**\n * Creates a new Literal with the specified value and duration.\n * @param value The string value of the literal\n * @param duration The duration of the literal, defaults to ONE (1/1)\n */\n constructor(\n public value: string,\n duration = ONE,\n ) {\n super(duration);\n }\n\n /**\n * Returns a debug-friendly representation of this Literal.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = { ...super.debugValue(), value: this.value };\n if (this.embelishments.length > 0) {\n out.embs = this.embelishments.map((e) => (\"debugValue\" in e ? e.debugValue() : e));\n }\n return out;\n }\n\n /**\n * Returns a string representation of this Literal.\n * @returns A string representation\n */\n toString(): string {\n return `Lit(${this.duration}-${this.value})`;\n }\n\n /**\n * Checks if this Literal is equal to another Literal.\n * @param another The Literal to compare with\n * @returns True if the Literals are equal, false otherwise\n */\n equals(another: this): boolean {\n return super.equals(another) && this.value == another.value;\n }\n\n /**\n * Copies the properties of this Literal to another Literal.\n * @param another The target Literal to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.value = this.value;\n }\n}\n\n/**\n * Represents a syllable in lyrics or text to be sung.\n * Extends Literal to provide specialized handling for sung text.\n */\nexport class Syllable extends Literal {\n readonly TYPE = \"Syllable\";\n\n /**\n * Creates a Syllable from a Literal.\n * @param lit The Literal to convert to a Syllable\n * @returns A new Syllable with the properties of the Literal\n */\n static fromLit(lit: Literal): Syllable {\n if (lit.TYPE == AtomType.SYLLABLE) return lit as Syllable;\n const out = new Syllable(lit.value, lit.duration);\n out.embelishments = lit.embelishments;\n out.beforeRest = lit.beforeRest;\n return out;\n }\n\n /**\n * Returns a string representation of this Syllable.\n * @returns A string representation\n */\n toString(): string {\n return `Syll(${this.duration}-${this.value})`;\n }\n}\n\n/**\n * Represents a musical note in the notation.\n * Extends Literal to add properties specific to musical notes.\n */\nexport class Note extends Literal {\n readonly TYPE = \"Note\";\n\n /**\n * Which octave the note is in. Can be positive or negative to indicate higher or lower octaves.\n */\n octave = 0;\n\n /**\n * How the note is shifted - i.e., shifted towards major or minor by # of semi-tones.\n */\n shift: number | boolean = 0;\n\n /**\n * Creates a new Note with the specified properties.\n * @param value The string value of the note\n * @param duration The duration of the note, defaults to ONE (1/1)\n * @param octave The octave of the note, defaults to 0\n * @param shift The shift of the note, defaults to 0\n */\n constructor(value: string, duration = ONE, octave = 0, shift = 0) {\n super(value, duration);\n this.octave = octave;\n this.shift = shift;\n }\n\n /**\n * Creates a Note from a Literal.\n * @param lit The Literal to convert to a Note\n * @returns A new Note with the properties of the Literal\n */\n static fromLit(lit: Literal): Note {\n if (lit.TYPE == AtomType.NOTE) return lit as Note;\n const out = new Note(lit.value, lit.duration);\n out.embelishments = lit.embelishments;\n out.beforeRest = lit.beforeRest;\n return out;\n }\n\n /**\n * Returns a debug-friendly representation of this Note.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = { ...super.debugValue() };\n if (this.octave != 0) out.octave = this.octave;\n if (this.shift != 0) out.shift = this.shift;\n return out;\n }\n\n /**\n * Returns a string representation of this Note.\n * @returns A string representation\n */\n toString(): string {\n return `Note(${this.duration}-${this.value}-${this.octave})`;\n }\n\n /**\n * Checks if this Note is equal to another Note.\n * @param another The Note to compare with\n * @returns True if the Notes are equal, false otherwise\n */\n equals(another: this): boolean {\n return super.equals(another) && this.octave == another.octave && this.shift == another.shift;\n }\n\n /**\n * Copies the properties of this Note to another Note.\n * @param another The target Note to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.octave = this.octave;\n another.shift = this.shift;\n }\n}\n\n/**\n * Represents a group of atoms that are treated as a single unit.\n * Groups can contain any number of atoms, including other groups.\n */\nexport class Group extends Atom {\n readonly TYPE = \"Group\";\n\n /**\n * Indicates whether the duration is static or linear to the number of atoms in this group.\n * When true, the duration is used as a multiplier for the total child duration.\n * When false, the duration is absolute.\n */\n durationIsMultiplier = false;\n\n /**\n * The list of atoms in this group.\n */\n readonly atoms = new TSU.Lists.ValueList<Atom>();\n\n /**\n * Observers that receive notifications when atoms change.\n */\n private _observers: GroupObserver<Atom, Group>[] = [];\n\n /**\n * Creates a new Group containing the specified atoms.\n * @param atoms The atoms to include in this group\n */\n constructor(...atoms: Atom[]) {\n super(atoms.length == 0 ? ZERO : ONE);\n this.addAtoms(false, ...atoms);\n }\n\n /**\n * Adds an observer to receive atom change notifications.\n * @param observer The observer to add\n * @returns A function to remove the observer\n */\n addObserver(observer: GroupObserver<Atom, Group>): () => void {\n this._observers.push(observer);\n return () => this.removeObserver(observer);\n }\n\n /**\n * Removes an observer.\n * @param observer The observer to remove\n */\n removeObserver(observer: GroupObserver<Atom, Group>): void {\n const index = this._observers.indexOf(observer);\n if (index >= 0) {\n this._observers.splice(index, 1);\n }\n }\n\n /**\n * Notifies observers of atom changes.\n */\n private notifyObservers(type: AtomChangeType, atoms: Atom[], index: number): void {\n if (!this._eventsEnabled) return;\n for (const observer of this._observers) {\n switch (type) {\n case AtomChangeType.ADD:\n observer.onAtomsAdded?.(this, atoms, index);\n break;\n case AtomChangeType.INSERT:\n observer.onAtomsInserted?.(this, atoms, index);\n break;\n case AtomChangeType.REMOVE:\n observer.onAtomsRemoved?.(this, atoms);\n break;\n }\n }\n }\n\n /**\n * Checks if this Group is equal to another Group.\n * @param another The Group to compare with\n * @param expect Optional parameter\n * @returns True if the Groups are equal, false otherwise\n */\n equals(another: this, expect = false): boolean {\n if (!super.equals(another)) return false;\n return this.atoms.equals(another.atoms, (a1, a2) => a1.equals(a2));\n }\n\n /**\n * Copies the properties of this Group to another Group.\n * @param another The target Group to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.durationIsMultiplier = this.durationIsMultiplier;\n for (const atom of this.atoms.values()) {\n another.atoms.add(atom.clone());\n }\n }\n\n /**\n * Gets the duration of this group.\n * If durationIsMultiplier is true, returns the total child duration divided by the multiplier.\n * Otherwise, returns the absolute duration.\n */\n get duration(): Fraction {\n if (this.durationIsMultiplier) {\n return this.totalChildDuration.divby(this._duration);\n } else {\n return this._duration;\n }\n }\n\n /**\n * Sets this group to use a multiplier for duration calculations.\n * @param asMultiplier Whether to use the duration as a multiplier\n * @returns This Group instance for method chaining\n */\n setDurationAsMultiplier(asMultiplier = true): this {\n this.durationIsMultiplier = asMultiplier;\n return this;\n }\n\n /**\n * Sets the duration of this group.\n * @param d The new duration\n * @param asMultiplier Whether to use the duration as a multiplier\n * @returns This Group instance for method chaining\n */\n setDuration(d: Fraction, asMultiplier = false): this {\n this._duration = d;\n this.durationIsMultiplier = asMultiplier;\n return this;\n }\n\n /**\n * Returns a debug-friendly representation of this Group.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = { ...super.debugValue(), atoms: Array.from(this.atoms.values(), (a) => a.debugValue()) };\n if (this.durationIsMultiplier) out.durationIsMultiplier = true;\n return out;\n }\n\n /**\n * Splits this group into two parts.\n * The first part (this group) fits within the given duration and everything else\n * longer than the given duration is returned as a new Group.\n *\n * @param requiredDuration The duration at which to split the group\n * @returns A new Group containing the atoms beyond the split point, or null if no split is needed\n */\n splitAt(requiredDuration: Fraction): TSU.Nullable<Group> {\n if (this.duration.isLTE(requiredDuration) || requiredDuration.isLTE(ZERO)) {\n return null;\n }\n const targetGroup = new Group();\n if (this.durationIsMultiplier) {\n targetGroup.durationIsMultiplier = true;\n targetGroup._duration = this._duration;\n }\n\n let remainingDur = this.duration;\n const totalChildDuration = this.totalChildDuration;\n const durationFactor = this.durationIsMultiplier\n ? ONE.divby(this._duration)\n : this._duration.divby(totalChildDuration, true);\n while (remainingDur.isGT(requiredDuration) && this.atoms.last) {\n const lastChild = this.atoms.last;\n // Child's duration is absolute in its own \"system\"\n // Its duration within the parent (this) group's frame of reference depends\n // on whether the parent's duration is absolute or as a multiplier\n //\n // realChildDuration = case (group.durationIsMultiper) {\n // | true => child.duration / this._duration\n // | false => child.duration * this._duration / total child duration\n // }\n const childDuration = lastChild.duration.times(durationFactor);\n const newDuration = remainingDur.minus(childDuration);\n if (newDuration.isGTE(requiredDuration)) {\n // remove ourselves and add to target\n // in both cases duration will be adjusted if need be\n this.removeAtoms(true, lastChild);\n targetGroup.insertAtomsAt(targetGroup.atoms.first, true, lastChild);\n if (newDuration.equals(requiredDuration)) {\n // we have reached the end so return\n return targetGroup;\n }\n } else {\n // our scenario is now this:\n //\n // totalParentDuration = 10\n // required = 8\n // lastChildDuration (relative to parent) is 5\n //\n // durWithoutLast = 10 - 5\n // newRequired = requiredDur - durWithoutLast = 3\n //\n // However 3 is a duration in the parent's frame of reference\n // this has to be converted back to the child's FoR\n const newRequiredDur = requiredDuration.minus(newDuration, true).divby(durationFactor, true);\n // console.log( \"newRequiredDur: \", newRequiredDur, \"requiedDur: \", requiredDuration, \"remainingDur: \", remainingDur,);\n // then the last item needs to be split, and by how much?\n const spillOver = lastChild.splitAt(newRequiredDur);\n if (spillOver == null) {\n throw new Error(\"Spill over cannot be null here\");\n }\n if (!this.durationIsMultiplier) {\n // Our own duration has also now changed\n this._duration = requiredDuration;\n } else {\n if (this._duration.isZero) throw new Error(\"How can this be?\");\n }\n spillOver.isContinuation = true;\n // Add spill over to the target\n targetGroup.insertAtomsAt(targetGroup.atoms.first, true, spillOver);\n return targetGroup;\n }\n remainingDur = newDuration;\n }\n return targetGroup;\n }\n\n /**\n * Gets the total duration of all child atoms.\n * @returns The sum of durations of all atoms in this group\n */\n get totalChildDuration(): Fraction {\n let out = ZERO;\n for (const atom of this.atoms.values()) {\n out = out.plus(atom.duration);\n }\n return out;\n }\n\n /**\n * Inserts atoms before a given cursor atom.\n * If the cursor atom is null, the atoms are appended at the end.\n *\n * @param beforeAtom The atom before which to insert the new atoms, or null to append\n * @param adjustDuration Whether to adjust this group's duration based on the new atoms\n * @param atoms The atoms to insert\n * @returns This Group instance for method chaining\n */\n insertAtomsAt(beforeAtom: TSU.Nullable<Atom>, adjustDuration = false, ...atoms: Atom[]): this {\n adjustDuration = adjustDuration && !this.durationIsMultiplier;\n const oldChildDuration = adjustDuration ? this.totalChildDuration : ONE;\n\n // Calculate insertion index for event notification\n let insertIndex: number;\n if (beforeAtom) {\n // Find index of beforeAtom using for loop\n insertIndex = 0;\n for (const a of this.atoms.values()) {\n if (a === beforeAtom) break;\n insertIndex++;\n }\n } else {\n // Appending to end - use size property\n insertIndex = this.atoms.size;\n }\n\n // Track which atoms were actually added (excluding REST atoms)\n const addedAtoms: Atom[] = [];\n\n // First form a chain of the given atoms\n for (const atom of atoms) {\n if (atom.parentGroup != null) {\n if (atom.parentGroup != this) {\n throw new Error(\"Atom belongs to another parent. Remove it first\");\n }\n atom.parentGroup.removeAtoms(false, atom);\n }\n if (atom.TYPE == AtomType.REST) {\n const last = this.atoms.last;\n if (last && last.TYPE != AtomType.GROUP && last.TYPE != AtomType.LABEL) {\n (last as LeafAtom).beforeRest = true;\n }\n } else {\n atom.parentGroup = this;\n this.atoms.add(atom, beforeAtom);\n addedAtoms.push(atom);\n }\n }\n if (adjustDuration) {\n if (this._duration.isZero) {\n if (this.durationIsMultiplier) throw new Error(\"How can this be?\");\n this._duration = this.totalChildDuration;\n } else {\n const scaleFactor = this.totalChildDuration.divby(oldChildDuration);\n this._duration = this._duration.times(scaleFactor, true);\n }\n }\n\n // Notify observers if atoms were added\n if (addedAtoms.length > 0) {\n const type = beforeAtom ? AtomChangeType.INSERT : AtomChangeType.ADD;\n this.notifyObservers(type, addedAtoms, insertIndex);\n }\n\n return this;\n }\n\n /**\n * Adds atoms to the end of this group's atom list.\n *\n * @param adjustDuration Whether to adjust this group's duration based on the new atoms\n * @param atoms The atoms to add\n * @returns This Group instance for method chaining\n */\n addAtoms(adjustDuration = false, ...atoms: Atom[]): this {\n return this.insertAtomsAt(null, adjustDuration, ...atoms);\n }\n\n /**\n * Removes atoms from this group's child list.\n *\n * @param adjustDuration Whether to adjust this group's duration after removing atoms\n * @param atoms The atoms to remove\n * @returns This Group instance for method chaining\n */\n removeAtoms(adjustDuration = false, ...atoms: Atom[]): this {\n adjustDuration = adjustDuration && !this.durationIsMultiplier;\n const oldChildDuration = adjustDuration ? this.totalChildDuration : ONE;\n\n // Track which atoms were actually removed\n const removedAtoms: Atom[] = [];\n\n for (const atom of atoms) {\n if (atom.parentGroup == this) {\n this.atoms.remove(atom);\n atom.parentGroup = null;\n removedAtoms.push(atom);\n } else if (atom.parentGroup != null) {\n throw new Error(\"Atom cannot be removed as it does not belong to this group\");\n }\n }\n if (adjustDuration) {\n if (this._duration.isZero) {\n if (this.durationIsMultiplier) throw new Error(\"How can this be?\");\n this._duration = this.totalChildDuration;\n } else {\n const scaleFactor = this.totalChildDuration.divby(oldChildDuration);\n this._duration = this._duration.times(scaleFactor, true);\n }\n }\n\n // Notify observers if atoms were removed\n if (removedAtoms.length > 0) {\n this.notifyObservers(AtomChangeType.REMOVE, removedAtoms, -1);\n }\n\n return this;\n }\n}\n\n/**\n * Represents a line of notation containing multiple roles.\n * A line can have atoms starting before or after the cycle.\n */\nexport class Line extends Entity {\n readonly TYPE: string = \"Line\";\n\n /**\n * Offset tells how many notes before or after the cycle this line's atoms start at.\n */\n offset: Fraction = ZERO;\n\n /**\n * The roles contained in this line.\n */\n roles: Role[] = [];\n\n /**\n * Text to be displayed in the margin of the line.\n * This is a hacky solution to doing left side pre-margin text typically\n * found in notations - e.g., line X of a pallavi has this. This makes vertical\n * space less wasteful.\n *\n * A better solution is inter-beat annotation but it is very complex for now.\n */\n marginText = \"\";\n\n /**\n * The LayoutParams associated with this line.\n */\n layoutParams: LayoutParams;\n\n /**\n * Observers that receive notifications when roles change.\n */\n private _observers: LineObserver<Role, Line>[] = [];\n\n /**\n * Adds an observer to receive role change notifications.\n * @param observer The observer to add\n * @returns A function to remove the observer\n */\n addObserver(observer: LineObserver<Role, Line>): () => void {\n this._observers.push(observer);\n return () => this.removeObserver(observer);\n }\n\n /**\n * Removes an observer.\n * @param observer The observer to remove\n */\n removeObserver(observer: LineObserver<Role, Line>): void {\n const index = this._observers.indexOf(observer);\n if (index >= 0) {\n this._observers.splice(index, 1);\n }\n }\n\n /**\n * Finds the index of a role with the given name.\n * @param name The name of the role to find\n * @returns The index of the role, or -1 if not found\n */\n indexOfRole(name: string): number {\n for (let i = 0; i < this.roles.length; i++) {\n if (this.roles[i].name == name) return i;\n }\n return -1;\n }\n\n /**\n * Checks if this line is empty (has no content in any role).\n */\n get isEmpty(): boolean {\n for (const r of this.roles) if (!r.isEmpty) return false;\n return true;\n }\n\n /**\n * Returns a debug-friendly representation of this Line.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = {\n ...super.debugValue(),\n roles: this.roles.map((r) => r.debugValue()),\n };\n if (!this.offset.isZero) {\n out.offset = this.offset.toString();\n }\n return out;\n }\n\n /**\n * Copies the properties of this Line to another Line.\n * @param another The target Line to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.roles = this.roles.map((r) => r.clone());\n }\n\n /**\n * Adds atoms to a role in this line.\n * @param roleName The name of the role to add atoms to\n * @param defaultToNotes Whether to default to notes for this role\n * @param atoms The atoms to add\n * @returns This Line instance for method chaining\n */\n addAtoms(roleName: string, defaultToNotes: boolean, ...atoms: Atom[]): this {\n const role = this.ensureRole(roleName, defaultToNotes);\n role.addAtoms(...atoms);\n return this;\n }\n\n /**\n * Ensures a role with the given name exists in this line, creating it if needed.\n * @param roleName The name of the role to ensure\n * @param defaultToNotes Whether to default to notes for this role\n * @returns The role with the specified name\n */\n ensureRole(roleName: string, defaultToNotes: boolean): Role {\n // Ensure we have this many roles\n let ri = this.roles.findIndex((r) => r.name == roleName);\n if (ri < 0) {\n ri = this.roles.length;\n const role = new Role(this, roleName);\n role.defaultToNotes = defaultToNotes;\n this.roles.push(role);\n\n // Notify observers of new role\n if (this._eventsEnabled) {\n for (const observer of this._observers) {\n observer.onRoleAdded?.(this, roleName, role);\n }\n }\n }\n return this.roles[ri];\n }\n\n /**\n * Removes a role from this line.\n * @param roleName The name of the role to remove\n * @returns True if the role was removed, false if not found\n */\n removeRole(roleName: string): boolean {\n const ri = this.roles.findIndex((r) => r.name == roleName);\n if (ri >= 0) {\n this.roles.splice(ri, 1);\n\n // Notify observers of removed role\n if (this._eventsEnabled) {\n for (const observer of this._observers) {\n observer.onRoleRemoved?.(this, roleName);\n }\n }\n return true;\n }\n return false;\n }\n\n /**\n * Gets the maximum duration across all roles in this line.\n */\n get duration(): Fraction {\n let max = ZERO;\n for (const role of this.roles) {\n max = TSU.Num.Fraction.max(role.duration, max);\n }\n return max;\n }\n}\n\n/**\n * Represents a specific role or voice in a line of notation.\n * Each role contains a sequence of atoms.\n */\nexport class Role extends Entity {\n readonly TYPE = \"Role\";\n\n /**\n * Whether this role represents notes by default.\n */\n defaultToNotes = true;\n\n /**\n * The atoms in this role.\n */\n atoms: Atom[] = [];\n\n /**\n * Observers that receive notifications when atoms change.\n */\n private _observers: RoleObserver<Atom, Role>[] = [];\n\n /**\n * Creates a new Role with the specified line and name.\n * @param line The line this role belongs to\n * @param name The name of the role\n */\n constructor(\n public readonly line: Line,\n public readonly name: string,\n ) {\n super();\n }\n\n /**\n * Adds an observer to receive atom change notifications.\n * @param observer The observer to add\n * @returns A function to remove the observer\n */\n addObserver(observer: RoleObserver<Atom, Role>): () => void {\n this._observers.push(observer);\n return () => this.removeObserver(observer);\n }\n\n /**\n * Removes an observer.\n * @param observer The observer to remove\n */\n removeObserver(observer: RoleObserver<Atom, Role>): void {\n const index = this._observers.indexOf(observer);\n if (index >= 0) {\n this._observers.splice(index, 1);\n }\n }\n\n /**\n * Notifies observers of atom changes.\n */\n private notifyObservers(type: AtomChangeType, atoms: Atom[], index: number): void {\n if (!this._eventsEnabled) return;\n for (const observer of this._observers) {\n switch (type) {\n case AtomChangeType.ADD:\n observer.onAtomsAdded?.(this, atoms, index);\n break;\n case AtomChangeType.INSERT:\n observer.onAtomsInserted?.(this, atoms, index);\n break;\n case AtomChangeType.REMOVE:\n observer.onAtomsRemoved?.(this, atoms);\n break;\n }\n }\n }\n\n /**\n * Checks if this role is empty (has no atoms).\n */\n get isEmpty(): boolean {\n return this.atoms.length == 0;\n }\n\n /**\n * Returns a debug-friendly representation of this Role.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return { name: this.name, atoms: this.atoms.map((a) => a.debugValue()) };\n }\n\n /**\n * Adds atoms to the end of this role.\n * @param atoms The atoms to add\n */\n addAtoms(...atoms: Atom[]): void {\n this.insertAtomsAt(this.atoms.length, ...atoms);\n }\n\n /**\n * Inserts atoms at a specific index in this role.\n * @param index The index at which to insert\n * @param atoms The atoms to insert\n */\n insertAtomsAt(index: number, ...atoms: Atom[]): void {\n // Track which atoms were actually added (excluding REST atoms)\n const addedAtoms: Atom[] = [];\n let last: null | Atom = index > 0 ? this.atoms[index - 1] : null;\n\n for (const atom of atoms) {\n if (atom.TYPE == AtomType.REST) {\n if (last && last.TYPE != AtomType.GROUP && last.TYPE != AtomType.LABEL) {\n (last as LeafAtom).beforeRest = true;\n }\n } else {\n this.atoms.splice(index + addedAtoms.length, 0, atom);\n addedAtoms.push(atom);\n }\n last = atom;\n }\n\n // Notify observers if atoms were added\n if (addedAtoms.length > 0) {\n const isAppend = index >= this.atoms.length - addedAtoms.length;\n const type = isAppend ? AtomChangeType.ADD : AtomChangeType.INSERT;\n this.notifyObservers(type, addedAtoms, index);\n }\n }\n\n /**\n * Removes atoms from this role.\n * @param atoms The atoms to remove\n */\n removeAtoms(...atoms: Atom[]): void {\n const removedAtoms: Atom[] = [];\n\n for (const atom of atoms) {\n const idx = this.atoms.indexOf(atom);\n if (idx >= 0) {\n this.atoms.splice(idx, 1);\n removedAtoms.push(atom);\n }\n }\n\n // Notify observers if atoms were removed\n if (removedAtoms.length > 0) {\n this.notifyObservers(AtomChangeType.REMOVE, removedAtoms, -1);\n }\n }\n\n /**\n * Copies the properties of this Role to another Role.\n * @param another The target Role to copy properties to\n */\n copyTo(another: Role): void {\n another.addAtoms(...this.atoms);\n }\n\n /**\n * Gets the total duration of all atoms in this role.\n */\n get duration(): Fraction {\n return this.atoms.reduce((a, b) => a.plus(b.duration), ZERO);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,qCAA+C;AAE/C,qCAAqF;AAMxE,QAAA,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC7B,QAAA,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;AAOxC,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EATW,QAAQ,wBAAR,Q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AAc,CAAC,MAAM,CAAC;YACnE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAMD,WAAW,CAAC,GAAG,KAAa;QAC1B,MAAM,YAAY,GAAW,EAAE,CAAC;QAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC1B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAGD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,eAAe,CAAC,uBAAc,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAMD,MAAM,CAAC,OAAa;QAClB,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAKD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,YAAI,CAAC,CAAC;IAC/D,CAAC;CACF;AA/JD,oBA+JC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Entity, TimedEntity } from \"./entity\";\nimport { LayoutParams } from \"./layouts\";\nimport { AtomChangeType, GroupObserver, RoleObserver, LineObserver } from \"./events\";\n\n/**\n * Alias to TSU.Num.Fraction in tsutils.\n */\ntype Fraction = TSU.Num.Fraction;\nexport const ZERO = TSU.Num.Fraction.ZERO;\nexport const ONE = TSU.Num.Fraction.ONE;\n\n/**\n * AtomType enums are used to denote specific Atoms\n * Each type represents a specific musical or notational element.\n * @enum\n */\nexport enum AtomType {\n NOTE = \"Note\",\n LITERAL = \"Literal\",\n SYLLABLE = \"Syllable\",\n SPACE = \"Space\",\n GROUP = \"Group\",\n LABEL = \"Label\",\n REST = \"Rest\",\n MARKER = \"Marker\",\n}\n\n/**\n * Atoms are the base class for all timed entities that can appear in a Notation.\n * An Atom represents the fundamental building block of the notation system.\n */\nexport abstract class Atom extends TimedEntity {\n readonly TYPE: string = \"Atom\";\n\n protected _duration: Fraction;\n /** Markers to be displayed before this atom */\n markersBefore: Marker[];\n /** Markers to be displayed after this atom */\n markersAfter: Marker[];\n /** Next atom in the sequence */\n nextSibling: TSU.Nullable<Atom> = null;\n /** Previous atom in the sequence */\n prevSibling: TSU.Nullable<Atom> = null;\n /** The Group this Atom belongs to, if any */\n parentGroup: TSU.Nullable<Group> = null;\n\n /** Indicates if this Atom is a continuation from a previous atom */\n isContinuation = false;\n\n /**\n * Creates a new Atom with the specified duration.\n * @param duration The duration of the atom, defaults to ONE (1/1)\n */\n constructor(duration = ONE) {\n super();\n this._duration = duration || ONE;\n }\n\n /**\n * Splits this atom at the specified duration.\n * @param requiredDuration The duration at which to split the atom\n * @returns A new atom representing the portion beyond the split point, or null if no split is needed\n */\n abstract splitAt(requiredDuration: Fraction): TSU.Nullable<Atom>;\n\n /**\n * Returns a debug-friendly representation of this Atom.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = super.debugValue();\n if (!this.duration.isOne) {\n out.duration = this.duration.factorized.toString();\n }\n if (this.isContinuation) {\n out.isContinuation = true;\n }\n if ((this.markersBefore || []).length > 0) {\n out.mbef = this.markersBefore.map((m) => m.debugValue());\n }\n if ((this.markersAfter || []).length > 0) {\n out.maft = this.markersAfter.map((m) => m.debugValue());\n }\n return out;\n }\n\n /**\n * Copies the properties of this atom to another atom.\n * @param another The target atom to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another._duration = new TSU.Num.Fraction(this.duration.num, this.duration.den);\n }\n\n /**\n * Gets the duration of this atom.\n */\n get duration(): Fraction {\n return this._duration;\n }\n\n /**\n * Sets the duration of this atom.\n */\n set duration(d: Fraction) {\n this._duration = d;\n }\n}\n\n/**\n * Base class for atoms that cannot contain other atoms.\n * LeafAtom represents atomic elements that can't be further subdivided.\n */\nexport abstract class LeafAtom extends Atom {\n readonly TYPE: string = \"LeafAtom\";\n\n /** Indicates if this atom is followed by a rest */\n beforeRest = false;\n\n /**\n * Splits this atom at a certain duration.\n * If this atom's duration is longer than the given duration, it's truncated\n * to the given duration and a continuation space is returned.\n *\n * @param duration The duration at which to split the atom\n * @returns A new Space atom representing the spillover if needed, otherwise null\n */\n splitAt(duration: Fraction): TSU.Nullable<Atom> {\n if (this.duration.cmp(duration) > 0) {\n const spillOver = this.createSpilloverSpace(this.duration.minus(duration));\n spillOver.isContinuation = true;\n this.duration = duration;\n // TODO - Here we need to move the markersAfter to the spill-over as it doesnt belong to this any more\n return spillOver;\n }\n return null;\n }\n\n /**\n * Creates a Space atom to represent spillover duration when splitting.\n * @param duration The duration of the spillover\n * @returns A new Space atom\n */\n protected createSpilloverSpace(duration: Fraction): Space {\n return new Space(duration);\n }\n\n /**\n * Returns a debug-friendly representation of this LeafAtom.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return this.beforeRest ? { ...super.debugValue(), beforeRest: true } : super.debugValue();\n }\n}\n\n/**\n * Represents a marker or annotation in the notation.\n * Markers can be placed before or after atoms to provide additional context.\n */\nexport class Marker extends Entity {\n readonly TYPE = \"Marker\";\n\n /**\n * Creates a new Marker with the specified text.\n * @param text The text content of the marker\n * @param isBefore Whether the marker should appear before (true) or after (false) its associated atom\n */\n constructor(\n public text: string,\n public isBefore = true,\n ) {\n super();\n }\n\n /**\n * Returns a debug-friendly representation of this Marker.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return { ...super.debugValue(), text: this.text, before: this.isBefore };\n }\n\n /**\n * Returns a string representation of this Marker.\n * @returns A string representation\n */\n toString(): string {\n return `Marker(${this.text}-${this.isBefore})`;\n }\n}\n\n/**\n * Represents a rest (silence) in the notation.\n * Rests are zero-length atoms that indicate a pause.\n */\nexport class Rest extends LeafAtom {\n readonly TYPE = \"Rest\";\n\n /**\n * Creates a new Rest.\n * Rests are zero length by default.\n */\n constructor() {\n super(ZERO);\n }\n}\n\n/**\n * Represents a space or silence in the notation.\n * Spaces can be used to denote either silence or continuations of previous notes.\n */\nexport class Space extends LeafAtom {\n readonly TYPE = \"Space\";\n\n /**\n * Indicates whether this is a silent space or a continuation of the previous note.\n */\n isSilent = false;\n\n /**\n * Creates a new Space with the specified duration and silence property.\n * @param duration The duration of the space, defaults to ONE (1/1)\n * @param isSilent Whether the space represents silence (true) or a continuation (false)\n */\n constructor(duration = ONE, isSilent = false) {\n super(duration);\n this.isSilent = isSilent;\n }\n\n /**\n * Returns a debug-friendly representation of this Space.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return { ...super.debugValue(), isSilent: this.isSilent };\n }\n\n /**\n * Returns a string representation of this Space.\n * @returns A string representation\n */\n toString(): string {\n return `Space(${this.duration}-${this.isSilent})`;\n }\n\n /**\n * Copies the properties of this Space to another Space.\n * @param another The target Space to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.isSilent = this.isSilent;\n }\n\n /**\n * Checks if this Space is equal to another Space.\n * @param another The Space to compare with\n * @returns True if the Spaces are equal, false otherwise\n */\n equals(another: this): boolean {\n return super.equals(another) && this.isSilent == another.isSilent;\n }\n\n /**\n * Creates a Space atom to represent spillover duration when splitting.\n * @param duration The duration of the spillover\n * @returns A new Space atom with the same silence property as this Space\n */\n protected createSpilloverSpace(duration: Fraction): Space {\n const out = super.createSpilloverSpace(duration);\n out.isSilent = this.isSilent;\n return out;\n }\n}\n\n/**\n * Represents a literal value in the notation.\n * Literals are the basic building blocks for notes and syllables.\n */\nexport class Literal extends LeafAtom {\n readonly TYPE: string = \"Literal\";\n\n /**\n * The embellishments applied to this Literal.\n */\n embelishments: any[] = [];\n\n /**\n * Creates a new Literal with the specified value and duration.\n * @param value The string value of the literal\n * @param duration The duration of the literal, defaults to ONE (1/1)\n */\n constructor(\n public value: string,\n duration = ONE,\n ) {\n super(duration);\n }\n\n /**\n * Returns a debug-friendly representation of this Literal.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = { ...super.debugValue(), value: this.value };\n if (this.embelishments.length > 0) {\n out.embs = this.embelishments.map((e) => (\"debugValue\" in e ? e.debugValue() : e));\n }\n return out;\n }\n\n /**\n * Returns a string representation of this Literal.\n * @returns A string representation\n */\n toString(): string {\n return `Lit(${this.duration}-${this.value})`;\n }\n\n /**\n * Checks if this Literal is equal to another Literal.\n * @param another The Literal to compare with\n * @returns True if the Literals are equal, false otherwise\n */\n equals(another: this): boolean {\n return super.equals(another) && this.value == another.value;\n }\n\n /**\n * Copies the properties of this Literal to another Literal.\n * @param another The target Literal to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.value = this.value;\n }\n}\n\n/**\n * Represents a syllable in lyrics or text to be sung.\n * Extends Literal to provide specialized handling for sung text.\n */\nexport class Syllable extends Literal {\n readonly TYPE = \"Syllable\";\n\n /**\n * Creates a Syllable from a Literal.\n * @param lit The Literal to convert to a Syllable\n * @returns A new Syllable with the properties of the Literal\n */\n static fromLit(lit: Literal): Syllable {\n if (lit.TYPE == AtomType.SYLLABLE) return lit as Syllable;\n const out = new Syllable(lit.value, lit.duration);\n out.embelishments = lit.embelishments;\n out.beforeRest = lit.beforeRest;\n return out;\n }\n\n /**\n * Returns a string representation of this Syllable.\n * @returns A string representation\n */\n toString(): string {\n return `Syll(${this.duration}-${this.value})`;\n }\n}\n\n/**\n * Represents a musical note in the notation.\n * Extends Literal to add properties specific to musical notes.\n */\nexport class Note extends Literal {\n readonly TYPE = \"Note\";\n\n /**\n * Which octave the note is in. Can be positive or negative to indicate higher or lower octaves.\n */\n octave = 0;\n\n /**\n * How the note is shifted - i.e., shifted towards major or minor by # of semi-tones.\n */\n shift: number | boolean = 0;\n\n /**\n * Creates a new Note with the specified properties.\n * @param value The string value of the note\n * @param duration The duration of the note, defaults to ONE (1/1)\n * @param octave The octave of the note, defaults to 0\n * @param shift The shift of the note, defaults to 0\n */\n constructor(value: string, duration = ONE, octave = 0, shift = 0) {\n super(value, duration);\n this.octave = octave;\n this.shift = shift;\n }\n\n /**\n * Creates a Note from a Literal.\n * @param lit The Literal to convert to a Note\n * @returns A new Note with the properties of the Literal\n */\n static fromLit(lit: Literal): Note {\n if (lit.TYPE == AtomType.NOTE) return lit as Note;\n const out = new Note(lit.value, lit.duration);\n out.embelishments = lit.embelishments;\n out.beforeRest = lit.beforeRest;\n return out;\n }\n\n /**\n * Returns a debug-friendly representation of this Note.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = { ...super.debugValue() };\n if (this.octave != 0) out.octave = this.octave;\n if (this.shift != 0) out.shift = this.shift;\n return out;\n }\n\n /**\n * Returns a string representation of this Note.\n * @returns A string representation\n */\n toString(): string {\n return `Note(${this.duration}-${this.value}-${this.octave})`;\n }\n\n /**\n * Checks if this Note is equal to another Note.\n * @param another The Note to compare with\n * @returns True if the Notes are equal, false otherwise\n */\n equals(another: this): boolean {\n return super.equals(another) && this.octave == another.octave && this.shift == another.shift;\n }\n\n /**\n * Copies the properties of this Note to another Note.\n * @param another The target Note to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.octave = this.octave;\n another.shift = this.shift;\n }\n}\n\n/**\n * Represents a group of atoms that are treated as a single unit.\n * Groups can contain any number of atoms, including other groups.\n */\nexport class Group extends Atom {\n readonly TYPE = \"Group\";\n\n /**\n * Indicates whether the duration is static or linear to the number of atoms in this group.\n * When true, the duration is used as a multiplier for the total child duration.\n * When false, the duration is absolute.\n */\n durationIsSpeedMultiplier = false;\n\n /**\n * The list of atoms in this group.\n */\n readonly atoms = new TSU.Lists.ValueList<Atom>();\n\n /**\n * Observers that receive notifications when atoms change.\n */\n private _observers: GroupObserver<Atom, Group>[] = [];\n\n /**\n * Creates a new Group containing the specified atoms.\n * @param atoms The atoms to include in this group\n */\n constructor(...atoms: Atom[]) {\n super(atoms.length == 0 ? ZERO : ONE);\n this.addAtoms(false, ...atoms);\n }\n\n /**\n * Adds an observer to receive atom change notifications.\n * @param observer The observer to add\n * @returns A function to remove the observer\n */\n addObserver(observer: GroupObserver<Atom, Group>): () => void {\n this._observers.push(observer);\n return () => this.removeObserver(observer);\n }\n\n /**\n * Removes an observer.\n * @param observer The observer to remove\n */\n removeObserver(observer: GroupObserver<Atom, Group>): void {\n const index = this._observers.indexOf(observer);\n if (index >= 0) {\n this._observers.splice(index, 1);\n }\n }\n\n /**\n * Notifies observers of atom changes.\n */\n private notifyObservers(type: AtomChangeType, atoms: Atom[], index: number): void {\n if (!this._eventsEnabled) return;\n for (const observer of this._observers) {\n switch (type) {\n case AtomChangeType.ADD:\n observer.onAtomsAdded?.(this, atoms, index);\n break;\n case AtomChangeType.INSERT:\n observer.onAtomsInserted?.(this, atoms, index);\n break;\n case AtomChangeType.REMOVE:\n observer.onAtomsRemoved?.(this, atoms);\n break;\n }\n }\n }\n\n /**\n * Checks if this Group is equal to another Group.\n * @param another The Group to compare with\n * @param expect Optional parameter\n * @returns True if the Groups are equal, false otherwise\n */\n equals(another: this, expect = false): boolean {\n if (!super.equals(another)) return false;\n return this.atoms.equals(another.atoms, (a1, a2) => a1.equals(a2));\n }\n\n /**\n * Copies the properties of this Group to another Group.\n * @param another The target Group to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.durationIsSpeedMultiplier = this.durationIsSpeedMultiplier;\n for (const atom of this.atoms.values()) {\n another.atoms.add(atom.clone());\n }\n }\n\n /**\n * Gets the duration of this group.\n * If durationIsSpeedMultiplier is true, returns the total child duration divided by the multiplier.\n * Otherwise, returns the absolute duration.\n */\n get duration(): Fraction {\n if (this.durationIsSpeedMultiplier) {\n return this.totalChildDuration.divby(this._duration);\n } else {\n return this._duration;\n }\n }\n\n /**\n * Sets this group to use a multiplier for duration calculations.\n * @param asSpeedMultiplier Whether to use the duration as a speed multiplier. Eg If our duration was 2 and this was\n * set then since the speed is doubled - then the actual duration is halved.\n * @returns This Group instance for method chaining\n */\n setDurationAsMultiplier(asSpeedMultiplier = true): this {\n this.durationIsSpeedMultiplier = asSpeedMultiplier;\n return this;\n }\n\n /**\n * Sets the duration of this group.\n * @param d The new duration\n * @param asSpeedMultiplier Whether to use the duration as a speed multiplier. Eg If our duration was 2 and this was\n * set then since the speed is doubled - then the actual duration is halved.\n * @returns This Group instance for method chaining\n */\n setDuration(d: Fraction, asSpeedMultiplier = false): this {\n this._duration = d;\n this.durationIsSpeedMultiplier = asSpeedMultiplier;\n return this;\n }\n\n /**\n * Returns a debug-friendly representation of this Group.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = { ...super.debugValue(), atoms: Array.from(this.atoms.values(), (a) => a.debugValue()) };\n if (this.durationIsSpeedMultiplier) out.durationIsSpeedMultiplier = true;\n return out;\n }\n\n /**\n * Splits this group into two parts.\n * The first part (this group) fits within the given duration and everything else\n * longer than the given duration is returned as a new Group.\n *\n * @param requiredDuration The duration at which to split the group\n * @returns A new Group containing the atoms beyond the split point, or null if no split is needed\n */\n splitAt(requiredDuration: Fraction): TSU.Nullable<Group> {\n if (this.duration.isLTE(requiredDuration) || requiredDuration.isLTE(ZERO)) {\n return null;\n }\n const targetGroup = new Group();\n if (this.durationIsSpeedMultiplier) {\n targetGroup.durationIsSpeedMultiplier = true;\n targetGroup._duration = this._duration;\n }\n\n let remainingDur = this.duration;\n const totalChildDuration = this.totalChildDuration;\n const durationFactor = this.durationIsSpeedMultiplier\n ? ONE.divby(this._duration)\n : this._duration.divby(totalChildDuration, true);\n while (remainingDur.isGT(requiredDuration) && this.atoms.last) {\n const lastChild = this.atoms.last;\n // Child's duration is absolute in its own \"system\"\n // Its duration within the parent (this) group's frame of reference depends\n // on whether the parent's duration is absolute or as a multiplier\n //\n // realChildDuration = case (group.durationIsMultiper) {\n // | true => child.duration / this._duration\n // | false => child.duration * this._duration / total child duration\n // }\n const childDuration = lastChild.duration.times(durationFactor);\n const newDuration = remainingDur.minus(childDuration);\n if (newDuration.isGTE(requiredDuration)) {\n // remove ourselves and add to target\n // in both cases duration will be adjusted if need be\n this.removeAtoms(true, lastChild);\n targetGroup.insertAtomsAt(targetGroup.atoms.first, true, lastChild);\n if (newDuration.equals(requiredDuration)) {\n // we have reached the end so return\n return targetGroup;\n }\n } else {\n // our scenario is now this:\n //\n // totalParentDuration = 10\n // required = 8\n // lastChildDuration (relative to parent) is 5\n //\n // durWithoutLast = 10 - 5\n // newRequired = requiredDur - durWithoutLast = 3\n //\n // However 3 is a duration in the parent's frame of reference\n // this has to be converted back to the child's FoR\n const newRequiredDur = requiredDuration.minus(newDuration, true).divby(durationFactor, true);\n // console.log( \"newRequiredDur: \", newRequiredDur, \"requiedDur: \", requiredDuration, \"remainingDur: \", remainingDur,);\n // then the last item needs to be split, and by how much?\n const spillOver = lastChild.splitAt(newRequiredDur);\n if (spillOver == null) {\n throw new Error(\"Spill over cannot be null here\");\n }\n if (!this.durationIsSpeedMultiplier) {\n // Our own duration has also now changed\n this._duration = requiredDuration;\n } else {\n if (this._duration.isZero) throw new Error(\"How can this be?\");\n }\n spillOver.isContinuation = true;\n // Add spill over to the target\n targetGroup.insertAtomsAt(targetGroup.atoms.first, true, spillOver);\n return targetGroup;\n }\n remainingDur = newDuration;\n }\n return targetGroup;\n }\n\n /**\n * Gets the total duration of all child atoms.\n * @returns The sum of durations of all atoms in this group\n */\n get totalChildDuration(): Fraction {\n let out = ZERO;\n for (const atom of this.atoms.values()) {\n out = out.plus(atom.duration);\n }\n return out;\n }\n\n /**\n * Inserts atoms before a given cursor atom.\n * If the cursor atom is null, the atoms are appended at the end.\n *\n * @param beforeAtom The atom before which to insert the new atoms, or null to append\n * @param adjustDuration Whether to adjust this group's duration based on the new atoms\n * @param atoms The atoms to insert\n * @returns This Group instance for method chaining\n */\n insertAtomsAt(beforeAtom: TSU.Nullable<Atom>, adjustDuration = false, ...atoms: Atom[]): this {\n adjustDuration = adjustDuration && !this.durationIsSpeedMultiplier;\n const oldChildDuration = adjustDuration ? this.totalChildDuration : ONE;\n\n // Calculate insertion index for event notification\n let insertIndex: number;\n if (beforeAtom) {\n // Find index of beforeAtom using for loop\n insertIndex = 0;\n for (const a of this.atoms.values()) {\n if (a === beforeAtom) break;\n insertIndex++;\n }\n } else {\n // Appending to end - use size property\n insertIndex = this.atoms.size;\n }\n\n // Track which atoms were actually added (excluding REST atoms)\n const addedAtoms: Atom[] = [];\n\n // First form a chain of the given atoms\n for (const atom of atoms) {\n if (atom.parentGroup != null) {\n if (atom.parentGroup != this) {\n throw new Error(\"Atom belongs to another parent. Remove it first\");\n }\n atom.parentGroup.removeAtoms(false, atom);\n }\n if (atom.TYPE == AtomType.REST) {\n const last = this.atoms.last;\n if (last && last.TYPE != AtomType.GROUP && last.TYPE != AtomType.LABEL) {\n (last as LeafAtom).beforeRest = true;\n }\n } else {\n atom.parentGroup = this;\n this.atoms.add(atom, beforeAtom);\n addedAtoms.push(atom);\n }\n }\n if (adjustDuration) {\n if (this._duration.isZero) {\n if (this.durationIsSpeedMultiplier) throw new Error(\"How can this be?\");\n this._duration = this.totalChildDuration;\n } else {\n const scaleFactor = this.totalChildDuration.divby(oldChildDuration);\n this._duration = this._duration.times(scaleFactor, true);\n }\n }\n\n // Notify observers if atoms were added\n if (addedAtoms.length > 0) {\n const type = beforeAtom ? AtomChangeType.INSERT : AtomChangeType.ADD;\n this.notifyObservers(type, addedAtoms, insertIndex);\n }\n\n return this;\n }\n\n /**\n * Adds atoms to the end of this group's atom list.\n *\n * @param adjustDuration Whether to adjust this group's duration based on the new atoms\n * @param atoms The atoms to add\n * @returns This Group instance for method chaining\n */\n addAtoms(adjustDuration = false, ...atoms: Atom[]): this {\n return this.insertAtomsAt(null, adjustDuration, ...atoms);\n }\n\n /**\n * Removes atoms from this group's child list.\n *\n * @param adjustDuration Whether to adjust this group's duration after removing atoms\n * @param atoms The atoms to remove\n * @returns This Group instance for method chaining\n */\n removeAtoms(adjustDuration = false, ...atoms: Atom[]): this {\n adjustDuration = adjustDuration && !this.durationIsSpeedMultiplier;\n const oldChildDuration = adjustDuration ? this.totalChildDuration : ONE;\n\n // Track which atoms were actually removed\n const removedAtoms: Atom[] = [];\n\n for (const atom of atoms) {\n if (atom.parentGroup == this) {\n this.atoms.remove(atom);\n atom.parentGroup = null;\n removedAtoms.push(atom);\n } else if (atom.parentGroup != null) {\n throw new Error(\"Atom cannot be removed as it does not belong to this group\");\n }\n }\n if (adjustDuration) {\n if (this._duration.isZero) {\n if (this.durationIsSpeedMultiplier) throw new Error(\"How can this be?\");\n this._duration = this.totalChildDuration;\n } else {\n const scaleFactor = this.totalChildDuration.divby(oldChildDuration);\n this._duration = this._duration.times(scaleFactor, true);\n }\n }\n\n // Notify observers if atoms were removed\n if (removedAtoms.length > 0) {\n this.notifyObservers(AtomChangeType.REMOVE, removedAtoms, -1);\n }\n\n return this;\n }\n}\n\n/**\n * Represents a line of notation containing multiple roles.\n * A line can have atoms starting before or after the cycle.\n */\nexport class Line extends Entity {\n readonly TYPE: string = \"Line\";\n\n /**\n * Offset tells how many notes before or after the cycle this line's atoms start at.\n */\n offset: Fraction = ZERO;\n\n /**\n * The roles contained in this line.\n */\n roles: Role[] = [];\n\n /**\n * Text to be displayed in the margin of the line.\n * This is a hacky solution to doing left side pre-margin text typically\n * found in notations - e.g., line X of a pallavi has this. This makes vertical\n * space less wasteful.\n *\n * A better solution is inter-beat annotation but it is very complex for now.\n */\n marginText = \"\";\n\n /**\n * The LayoutParams associated with this line.\n */\n layoutParams: LayoutParams;\n\n /**\n * Observers that receive notifications when roles change.\n */\n private _observers: LineObserver<Role, Line>[] = [];\n\n /**\n * Adds an observer to receive role change notifications.\n * @param observer The observer to add\n * @returns A function to remove the observer\n */\n addObserver(observer: LineObserver<Role, Line>): () => void {\n this._observers.push(observer);\n return () => this.removeObserver(observer);\n }\n\n /**\n * Removes an observer.\n * @param observer The observer to remove\n */\n removeObserver(observer: LineObserver<Role, Line>): void {\n const index = this._observers.indexOf(observer);\n if (index >= 0) {\n this._observers.splice(index, 1);\n }\n }\n\n /**\n * Finds the index of a role with the given name.\n * @param name The name of the role to find\n * @returns The index of the role, or -1 if not found\n */\n indexOfRole(name: string): number {\n for (let i = 0; i < this.roles.length; i++) {\n if (this.roles[i].name == name) return i;\n }\n return -1;\n }\n\n /**\n * Checks if this line is empty (has no content in any role).\n */\n get isEmpty(): boolean {\n for (const r of this.roles) if (!r.isEmpty) return false;\n return true;\n }\n\n /**\n * Returns a debug-friendly representation of this Line.\n * @returns An object containing debug information\n */\n debugValue(): any {\n const out = {\n ...super.debugValue(),\n roles: this.roles.map((r) => r.debugValue()),\n };\n if (!this.offset.isZero) {\n out.offset = this.offset.toString();\n }\n return out;\n }\n\n /**\n * Copies the properties of this Line to another Line.\n * @param another The target Line to copy properties to\n */\n copyTo(another: this): void {\n super.copyTo(another);\n another.roles = this.roles.map((r) => r.clone());\n }\n\n /**\n * Adds atoms to a role in this line.\n * @param roleName The name of the role to add atoms to\n * @param defaultToNotes Whether to default to notes for this role\n * @param atoms The atoms to add\n * @returns This Line instance for method chaining\n */\n addAtoms(roleName: string, defaultToNotes: boolean, ...atoms: Atom[]): this {\n const role = this.ensureRole(roleName, defaultToNotes);\n role.addAtoms(...atoms);\n return this;\n }\n\n /**\n * Ensures a role with the given name exists in this line, creating it if needed.\n * @param roleName The name of the role to ensure\n * @param defaultToNotes Whether to default to notes for this role\n * @returns The role with the specified name\n */\n ensureRole(roleName: string, defaultToNotes: boolean): Role {\n // Ensure we have this many roles\n let ri = this.roles.findIndex((r) => r.name == roleName);\n if (ri < 0) {\n ri = this.roles.length;\n const role = new Role(this, roleName);\n role.defaultToNotes = defaultToNotes;\n this.roles.push(role);\n\n // Notify observers of new role\n if (this._eventsEnabled) {\n for (const observer of this._observers) {\n observer.onRoleAdded?.(this, roleName, role);\n }\n }\n }\n return this.roles[ri];\n }\n\n /**\n * Removes a role from this line.\n * @param roleName The name of the role to remove\n * @returns True if the role was removed, false if not found\n */\n removeRole(roleName: string): boolean {\n const ri = this.roles.findIndex((r) => r.name == roleName);\n if (ri >= 0) {\n this.roles.splice(ri, 1);\n\n // Notify observers of removed role\n if (this._eventsEnabled) {\n for (const observer of this._observers) {\n observer.onRoleRemoved?.(this, roleName);\n }\n }\n return true;\n }\n return false;\n }\n\n /**\n * Gets the maximum duration across all roles in this line.\n */\n get duration(): Fraction {\n let max = ZERO;\n for (const role of this.roles) {\n max = TSU.Num.Fraction.max(role.duration, max);\n }\n return max;\n }\n}\n\n/**\n * Represents a specific role or voice in a line of notation.\n * Each role contains a sequence of atoms.\n */\nexport class Role extends Entity {\n readonly TYPE = \"Role\";\n\n /**\n * Whether this role represents notes by default.\n */\n defaultToNotes = true;\n\n /**\n * The atoms in this role.\n */\n atoms: Atom[] = [];\n\n /**\n * Observers that receive notifications when atoms change.\n */\n private _observers: RoleObserver<Atom, Role>[] = [];\n\n /**\n * Creates a new Role with the specified line and name.\n * @param line The line this role belongs to\n * @param name The name of the role\n */\n constructor(\n public readonly line: Line,\n public readonly name: string,\n ) {\n super();\n }\n\n /**\n * Adds an observer to receive atom change notifications.\n * @param observer The observer to add\n * @returns A function to remove the observer\n */\n addObserver(observer: RoleObserver<Atom, Role>): () => void {\n this._observers.push(observer);\n return () => this.removeObserver(observer);\n }\n\n /**\n * Removes an observer.\n * @param observer The observer to remove\n */\n removeObserver(observer: RoleObserver<Atom, Role>): void {\n const index = this._observers.indexOf(observer);\n if (index >= 0) {\n this._observers.splice(index, 1);\n }\n }\n\n /**\n * Notifies observers of atom changes.\n */\n private notifyObservers(type: AtomChangeType, atoms: Atom[], index: number): void {\n if (!this._eventsEnabled) return;\n for (const observer of this._observers) {\n switch (type) {\n case AtomChangeType.ADD:\n observer.onAtomsAdded?.(this, atoms, index);\n break;\n case AtomChangeType.INSERT:\n observer.onAtomsInserted?.(this, atoms, index);\n break;\n case AtomChangeType.REMOVE:\n observer.onAtomsRemoved?.(this, atoms);\n break;\n }\n }\n }\n\n /**\n * Checks if this role is empty (has no atoms).\n */\n get isEmpty(): boolean {\n return this.atoms.length == 0;\n }\n\n /**\n * Returns a debug-friendly representation of this Role.\n * @returns An object containing debug information\n */\n debugValue(): any {\n return { name: this.name, atoms: this.atoms.map((a) => a.debugValue()) };\n }\n\n /**\n * Adds atoms to the end of this role.\n * @param atoms The atoms to add\n */\n addAtoms(...atoms: Atom[]): void {\n this.insertAtomsAt(this.atoms.length, ...atoms);\n }\n\n /**\n * Inserts atoms at a specific index in this role.\n * @param index The index at which to insert\n * @param atoms The atoms to insert\n */\n insertAtomsAt(index: number, ...atoms: Atom[]): void {\n // Track which atoms were actually added (excluding REST atoms)\n const addedAtoms: Atom[] = [];\n let last: null | Atom = index > 0 ? this.atoms[index - 1] : null;\n\n for (const atom of atoms) {\n if (atom.TYPE == AtomType.REST) {\n if (last && last.TYPE != AtomType.GROUP && last.TYPE != AtomType.LABEL) {\n (last as LeafAtom).beforeRest = true;\n }\n } else {\n this.atoms.splice(index + addedAtoms.length, 0, atom);\n addedAtoms.push(atom);\n }\n last = atom;\n }\n\n // Notify observers if atoms were added\n if (addedAtoms.length > 0) {\n const isAppend = index >= this.atoms.length - addedAtoms.length;\n const type = isAppend ? AtomChangeType.ADD : AtomChangeType.INSERT;\n this.notifyObservers(type, addedAtoms, index);\n }\n }\n\n /**\n * Removes atoms from this role.\n * @param atoms The atoms to remove\n */\n removeAtoms(...atoms: Atom[]): void {\n const removedAtoms: Atom[] = [];\n\n for (const atom of atoms) {\n const idx = this.atoms.indexOf(atom);\n if (idx >= 0) {\n this.atoms.splice(idx, 1);\n removedAtoms.push(atom);\n }\n }\n\n // Notify observers if atoms were removed\n if (removedAtoms.length > 0) {\n this.notifyObservers(AtomChangeType.REMOVE, removedAtoms, -1);\n }\n }\n\n /**\n * Copies the properties of this Role to another Role.\n * @param another The target Role to copy properties to\n */\n copyTo(another: Role): void {\n another.addAtoms(...this.atoms);\n }\n\n /**\n * Gets the total duration of all atoms in this role.\n */\n get duration(): Fraction {\n return this.atoms.reduce((a, b) => a.plus(b.duration), ZERO);\n }\n}\n"]}
|
package/lib/cjs/shapes.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export declare abstract class LeafAtomView extends AtomView {
|
|
|
76
76
|
export declare abstract class GroupView extends AtomView {
|
|
77
77
|
group: Group;
|
|
78
78
|
protected atomSpacing: number;
|
|
79
|
-
|
|
79
|
+
groupElement: SVGGElement;
|
|
80
80
|
protected atomViews: AtomView[];
|
|
81
81
|
private _embelishments;
|
|
82
82
|
defaultToNotes: boolean;
|
|
@@ -84,6 +84,7 @@ export declare abstract class GroupView extends AtomView {
|
|
|
84
84
|
scaleFactor: number;
|
|
85
85
|
showContinuationMarkers: boolean;
|
|
86
86
|
protected continuationMarkerElements: SVGTextElement[];
|
|
87
|
+
contentWidth: number;
|
|
87
88
|
constructor(group: Group, config?: any);
|
|
88
89
|
get totalDuration(): TSU.Num.Fraction;
|
|
89
90
|
createElements(parent: SVGGraphicsElement): void;
|
package/lib/cjs/shapes.js
CHANGED
|
@@ -257,13 +257,14 @@ class GroupView extends AtomView {
|
|
|
257
257
|
this.defaultToNotes = true;
|
|
258
258
|
this.needsLayout = true;
|
|
259
259
|
this.scaleFactor = 1.0;
|
|
260
|
-
this.showContinuationMarkers =
|
|
260
|
+
this.showContinuationMarkers = false;
|
|
261
261
|
this.continuationMarkerElements = [];
|
|
262
|
-
this.
|
|
262
|
+
this.contentWidth = 0;
|
|
263
|
+
this.atomSpacing = 2;
|
|
263
264
|
this.setStyles(config || {});
|
|
264
265
|
}
|
|
265
266
|
get totalDuration() {
|
|
266
|
-
return this.group.
|
|
267
|
+
return this.group.duration;
|
|
267
268
|
}
|
|
268
269
|
createElements(parent) {
|
|
269
270
|
this.groupElement = TSU.DOM.createSVGNode("g", {
|
|
@@ -300,7 +301,7 @@ class GroupView extends AtomView {
|
|
|
300
301
|
});
|
|
301
302
|
const totalDuration = this.group.totalChildDuration;
|
|
302
303
|
const totalDurValue = totalDuration.num / totalDuration.den;
|
|
303
|
-
const totalWidth = minWidthPerDuration * totalDurValue;
|
|
304
|
+
const totalWidth = Math.max(0, minWidthPerDuration * totalDurValue - this.atomSpacing);
|
|
304
305
|
return new TSU.Geom.Size(totalWidth * this.scaleFactor, maxHeight * this.scaleFactor);
|
|
305
306
|
}
|
|
306
307
|
updateBounds(x, y, w, h) {
|
|
@@ -312,7 +313,9 @@ class GroupView extends AtomView {
|
|
|
312
313
|
transform += " scale(" + this.scaleFactor + ")";
|
|
313
314
|
}
|
|
314
315
|
this.groupElement.setAttribute("transform", transform);
|
|
315
|
-
const
|
|
316
|
+
const unscaledContentHeight = this.minSize.height / this.scaleFactor;
|
|
317
|
+
const unscaledAllocatedHeight = this.hasHeight ? this.height / this.scaleFactor : unscaledContentHeight;
|
|
318
|
+
const currY = unscaledAllocatedHeight - unscaledContentHeight;
|
|
316
319
|
const totalDur = this.group.totalChildDuration;
|
|
317
320
|
const unscaledMinWidth = this.minSize.width / this.scaleFactor;
|
|
318
321
|
const groupWidth = this.hasWidth ? this.width / this.scaleFactor : unscaledMinWidth;
|
|
@@ -326,7 +329,8 @@ class GroupView extends AtomView {
|
|
|
326
329
|
realX = prevNoteEndX;
|
|
327
330
|
}
|
|
328
331
|
av.setBounds(realX, currY, null, null, true);
|
|
329
|
-
|
|
332
|
+
const avWidth = av.contentWidth || av.bbox.width;
|
|
333
|
+
prevNoteEndX = realX + avWidth;
|
|
330
334
|
if (this.showContinuationMarkers && !totalDur.isZero) {
|
|
331
335
|
const atomDur = av.totalDuration;
|
|
332
336
|
const durValue = atomDur.num / atomDur.den;
|
|
@@ -341,6 +345,7 @@ class GroupView extends AtomView {
|
|
|
341
345
|
}
|
|
342
346
|
currTime = currTime.plus(av.totalDuration);
|
|
343
347
|
});
|
|
348
|
+
this.contentWidth = prevNoteEndX;
|
|
344
349
|
this.invalidateBounds();
|
|
345
350
|
for (const e of this.embelishments)
|
|
346
351
|
e.refreshLayout();
|