@tspro/web-music-score 4.0.1 → 4.2.0

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +70 -28
  3. package/dist/audio/index.js +1 -1
  4. package/dist/audio/index.mjs +2 -2
  5. package/dist/audio-cg/index.js +1 -1
  6. package/dist/audio-cg/index.mjs +2 -2
  7. package/dist/{chunk-YFPLOHP2.mjs → chunk-5NWLGWHS.mjs} +2 -2
  8. package/dist/chunk-7MNV5JN6.mjs +264 -0
  9. package/dist/core/index.js +2 -2
  10. package/dist/core/index.mjs +3 -3
  11. package/dist/iife/index.global.js +11 -11
  12. package/dist/{music-objects-DJQ4d2OA.d.mts → music-objects-3Hxlkxy6.d.mts} +172 -80
  13. package/dist/{music-objects-Dc3kR-XF.d.ts → music-objects-CI7IjsjE.d.ts} +172 -80
  14. package/dist/pieces/index.d.mts +2 -2
  15. package/dist/pieces/index.d.ts +2 -2
  16. package/dist/pieces/index.js +3 -3
  17. package/dist/pieces/index.mjs +4 -4
  18. package/dist/react-ui/index.d.mts +3 -3
  19. package/dist/react-ui/index.d.ts +3 -3
  20. package/dist/react-ui/index.js +1 -1
  21. package/dist/react-ui/index.mjs +2 -2
  22. package/dist/{scale-B2Icbetz.d.ts → scale-DGx3tJH4.d.ts} +1 -1
  23. package/dist/{scale-BbDJTbrG.d.mts → scale-DQP3b9Zx.d.mts} +1 -1
  24. package/dist/score/index.d.mts +60 -23
  25. package/dist/score/index.d.ts +60 -23
  26. package/dist/score/index.js +910 -349
  27. package/dist/score/index.mjs +630 -320
  28. package/dist/{tempo-Dt8aHpol.d.ts → tempo-GrstpD9G.d.ts} +42 -10
  29. package/dist/{tempo-CtUhvJbr.d.mts → tempo-dkctPkCS.d.mts} +42 -10
  30. package/dist/theory/index.d.mts +3 -3
  31. package/dist/theory/index.d.ts +3 -3
  32. package/dist/theory/index.js +70 -20
  33. package/dist/theory/index.mjs +84 -280
  34. package/package.json +8 -3
@@ -1,7 +1,15 @@
1
- /* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
+ import {
3
+ NoteLength,
4
+ NoteLengthProps,
5
+ RhythmProps,
6
+ Tuplet,
7
+ validateNoteLength,
8
+ validateTupletRatio
9
+ } from "../chunk-7MNV5JN6.mjs";
2
10
  import {
3
11
  __publicField
4
- } from "../chunk-YFPLOHP2.mjs";
12
+ } from "../chunk-5NWLGWHS.mjs";
5
13
 
6
14
  // src/theory/chord.ts
7
15
  import { Utils as Utils6 } from "@tspro/ts-utils-lib";
@@ -1808,260 +1816,27 @@ function getTuningStrings(tuningName) {
1808
1816
  }
1809
1817
 
1810
1818
  // src/theory/time-signature.ts
1811
- import { Utils as Utils9 } from "@tspro/ts-utils-lib";
1812
-
1813
- // src/theory/rhythm.ts
1814
1819
  import { Utils as Utils8 } from "@tspro/ts-utils-lib";
1815
1820
  import { MusicError as MusicError8, MusicErrorType as MusicErrorType8 } from "@tspro/web-music-score/core";
1816
- var cmp = (a, b) => a === b ? 0 : a < b ? -1 : 1;
1817
- var MaxTupletRatioValue = 12;
1818
- var TicksMultiplier = 12 * 11 * 9 * 7 * 5;
1819
- var NoteLength = /* @__PURE__ */ ((NoteLength3) => {
1820
- NoteLength3["Whole"] = "1n";
1821
- NoteLength3["WholeTriplet"] = "1t";
1822
- NoteLength3["WholeDot"] = "1.";
1823
- NoteLength3["Whole2Dots"] = "1..";
1824
- NoteLength3["Whole12Dots"] = "1..";
1825
- NoteLength3["Whole3Dots"] = "1...";
1826
- NoteLength3["Whole4Dots"] = "1....";
1827
- NoteLength3["Whole5Dots"] = "1.....";
1828
- NoteLength3["Whole6Dots"] = "1......";
1829
- NoteLength3["Half"] = "2n";
1830
- NoteLength3["HalfTriplet"] = "2t";
1831
- NoteLength3["HalfDot"] = "2.";
1832
- NoteLength3["Half2Dots"] = "2..";
1833
- NoteLength3["Half3Dots"] = "2...";
1834
- NoteLength3["Half4Dots"] = "2....";
1835
- NoteLength3["Half5Dots"] = "2.....";
1836
- NoteLength3["Quarter"] = "4n";
1837
- NoteLength3["QuarterTriplet"] = "4t";
1838
- NoteLength3["QuarterDot"] = "4.";
1839
- NoteLength3["Quarter2Dots"] = "4..";
1840
- NoteLength3["Quarter3Dots"] = "4...";
1841
- NoteLength3["Quarter4Dots"] = "4....";
1842
- NoteLength3["Eighth"] = "8n";
1843
- NoteLength3["EighthTriplet"] = "8t";
1844
- NoteLength3["EighthDot"] = "8.";
1845
- NoteLength3["Eighth2Dots"] = "8..";
1846
- NoteLength3["Eighth3Dots"] = "8...";
1847
- NoteLength3["Sixteenth"] = "16n";
1848
- NoteLength3["SixteenthTriplet"] = "16t";
1849
- NoteLength3["SixteenthDot"] = "16.";
1850
- NoteLength3["Sixteenth2Dots"] = "16..";
1851
- NoteLength3["ThirtySecond"] = "32n";
1852
- NoteLength3["ThirtySecondTriplet"] = "32t";
1853
- NoteLength3["ThirtySecondDot"] = "32.";
1854
- NoteLength3["SixtyFourth"] = "64n";
1855
- NoteLength3["SixtyFourthTriplet"] = "64t";
1856
- return NoteLength3;
1857
- })(NoteLength || {});
1858
- function validateNoteLength(noteLength) {
1859
- if (Utils8.Is.isEnumValue(noteLength, NoteLength)) {
1860
- return noteLength;
1861
- } else {
1862
- throw new MusicError8(MusicErrorType8.InvalidArg, `Invalid noteLength: ${noteLength}`);
1863
- }
1864
- }
1865
- var _NoteLengthProps = class _NoteLengthProps {
1866
- constructor(noteLength) {
1867
- /** Note length. */
1868
- __publicField(this, "noteLength");
1869
- /** Note size (whole=1, half=2, quarter=4, ...). */
1870
- __publicField(this, "noteSize");
1871
- /** Number of ticks (not altered by isTriplet). */
1872
- __publicField(this, "ticks");
1873
- /** Flag count. */
1874
- __publicField(this, "flagCount");
1875
- /** Dot count. */
1876
- __publicField(this, "dotCount");
1877
- /** Max dot count. */
1878
- __publicField(this, "maxDotCount");
1879
- /** Is triplet? */
1880
- __publicField(this, "isTriplet");
1881
- /** Has note stem. */
1882
- __publicField(this, "hasStem");
1883
- /** Is note head solid (black)? */
1884
- __publicField(this, "isSolid");
1885
- this.noteLength = validateNoteLength(noteLength);
1886
- this.noteSize = parseInt(noteLength);
1887
- this.isTriplet = noteLength.endsWith("t");
1888
- this.maxDotCount = this.isTriplet ? 0 : Math.floor(Math.log2(_NoteLengthProps.ShortestNoteSize / this.noteSize));
1889
- this.dotCount = Utils8.Str.charCount(noteLength, ".");
1890
- this.flagCount = this.noteSize > 4 ? Math.floor(Math.log2(this.noteSize / 4)) : 0;
1891
- this.ticks = TicksMultiplier * _NoteLengthProps.ShortestNoteSize / this.noteSize;
1892
- this.hasStem = this.noteSize > 1;
1893
- this.isSolid = this.noteSize > 2;
1894
- if (this.dotCount > this.maxDotCount) {
1895
- throw new MusicError8(MusicErrorType8.Note, `dotCount ${this.dotCount} > maxDotCount ${this.maxDotCount}, for noteLength "${this.noteLength}".`);
1896
- } else if (this.isTriplet && this.dotCount > 0) {
1897
- throw new MusicError8(MusicErrorType8.Note, `noteLength "${this.noteLength}" is both triplet and dotted!`);
1898
- }
1899
- }
1900
- /**
1901
- * Get note length props.
1902
- * @param noteLength - Note length.
1903
- * @returns - Note length props.
1904
- */
1905
- static get(noteLength) {
1906
- let p = this.cache.get(noteLength);
1907
- if (!p) {
1908
- this.cache.set(noteLength, p = new _NoteLengthProps(noteLength));
1909
- }
1910
- return p;
1911
- }
1912
- /**
1913
- * Create note length props.
1914
- * @param noteLength - Note length or note size.
1915
- * @param dotCount - Dot count.
1916
- * @returns - Note length props.
1917
- */
1918
- static create(noteLength, dotCount = 0) {
1919
- let noteSize = typeof noteLength === "number" ? noteLength : this.get(noteLength).noteSize;
1920
- return this.get(noteSize + (Utils8.Is.isIntegerGte(dotCount, 1) ? ".".repeat(dotCount) : "n"));
1921
- }
1922
- /**
1923
- * Compare note lengths/sizes. Whole (1) > half (2) > quarter (4), etc.
1924
- * Ignores possible triplet property of note length.
1925
- * @param a - NoteLengthProps, NoteLength/Str or noteSize
1926
- * @param b - NoteLengthProps, NoteLength/Str or noteSize
1927
- * @returns - -1: a < b, 0: a === b, +1: a > b (note length/size comparisons)
1928
- */
1929
- static cmp(a, b) {
1930
- let aNoteSize = a instanceof _NoteLengthProps ? a.noteSize : typeof a === "number" ? a : _NoteLengthProps.get(a).noteSize;
1931
- let bNoteSize = b instanceof _NoteLengthProps ? b.noteSize : typeof b === "number" ? b : _NoteLengthProps.get(b).noteSize;
1932
- return cmp(bNoteSize, aNoteSize);
1933
- }
1934
- /**
1935
- * Compare note lengths/sizes for equality.
1936
- * Ignores possible triplet property of note length.
1937
- * @param a - NoteLengthProps, NoteLength/Str or noteSize
1938
- * @param b - NoteLengthProps, NoteLength/Str or noteSize
1939
- * @returns - true: a === b, false: a !== b (note length/size comparisons)
1940
- */
1941
- static equals(a, b) {
1942
- let aNoteSize = a instanceof _NoteLengthProps ? a.noteSize : typeof a === "number" ? a : _NoteLengthProps.get(a).noteSize;
1943
- let bNoteSize = b instanceof _NoteLengthProps ? b.noteSize : typeof b === "number" ? b : _NoteLengthProps.get(b).noteSize;
1944
- return aNoteSize === bNoteSize;
1945
- }
1946
- };
1947
- /** Longest note size (e.g. 1 = whole note). */
1948
- __publicField(_NoteLengthProps, "LongestNoteSize", Math.min(...Utils8.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
1949
- /** Shortest note size (e.g. 64 = sixtyfourth note). */
1950
- __publicField(_NoteLengthProps, "ShortestNoteSize", Math.max(...Utils8.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
1951
- __publicField(_NoteLengthProps, "cache", /* @__PURE__ */ new Map());
1952
- var NoteLengthProps = _NoteLengthProps;
1953
- function validateTupletRatio(tupletRatio) {
1954
- if (Utils8.Is.isObject(tupletRatio) && Utils8.Is.isIntegerBetween(tupletRatio.parts, 2, MaxTupletRatioValue) && Utils8.Is.isIntegerBetween(tupletRatio.inTimeOf, 2, MaxTupletRatioValue)) {
1955
- return tupletRatio;
1956
- } else {
1957
- throw new MusicError8(MusicErrorType8.Note, `Invalid tupletRatio ${JSON.stringify(tupletRatio)}`);
1958
- }
1959
- }
1960
- var Tuplet = {
1961
- /** Duplet: 2 in the time of 3 */
1962
- Duplet: { parts: 2, inTimeOf: 3 },
1963
- /** Triplet: 3 in the time of 2 */
1964
- Triplet: { parts: 3, inTimeOf: 2 },
1965
- /** Quadruplet: 4 in the time of 3 */
1966
- Quadruplet: { parts: 4, inTimeOf: 3 }
1967
- };
1968
- var _RhythmProps = class _RhythmProps {
1969
- constructor(noteLength, dotCount, tupletRatio) {
1970
- /** Note length. */
1971
- __publicField(this, "noteLength");
1972
- /** Note size (whole=1, half=2, quarter=4, ...). */
1973
- __publicField(this, "noteSize");
1974
- /** Dot count. */
1975
- __publicField(this, "dotCount");
1976
- /** Tuplet ratio. */
1977
- __publicField(this, "tupletRatio");
1978
- /** Number of ticks. */
1979
- __publicField(this, "ticks");
1980
- /** Flag count. */
1981
- __publicField(this, "flagCount");
1982
- /** Has note stem. */
1983
- __publicField(this, "hasStem");
1984
- /** Is note head solid (black)? */
1985
- __publicField(this, "isSolidNoteHead");
1986
- this.noteLength = validateNoteLength(noteLength);
1987
- let p = NoteLengthProps.get(noteLength);
1988
- this.noteSize = p.noteSize;
1989
- this.ticks = p.ticks;
1990
- this.flagCount = p.flagCount;
1991
- this.dotCount = dotCount != null ? dotCount : p.dotCount;
1992
- this.hasStem = p.hasStem;
1993
- this.isSolidNoteHead = p.isSolid;
1994
- if (Utils8.Is.isObject(tupletRatio)) {
1995
- this.tupletRatio = validateTupletRatio(tupletRatio);
1996
- } else if (p.isTriplet) {
1997
- this.tupletRatio = Tuplet.Triplet;
1998
- } else {
1999
- this.tupletRatio = void 0;
2000
- }
2001
- if (this.dotCount > 0 && this.tupletRatio !== void 0) {
2002
- throw new MusicError8(MusicErrorType8.Note, `Note cannot be both dotted and tuplet!`);
2003
- } else if (this.dotCount > p.maxDotCount) {
2004
- throw new MusicError8(MusicErrorType8.Note, `Too big dot count ${this.dotCount} for note length ${this.noteLength}.`);
2005
- }
2006
- for (let add = this.ticks / 2, i = 1; i <= this.dotCount; i++, add /= 2) {
2007
- this.ticks += add;
2008
- }
2009
- if (this.tupletRatio) {
2010
- this.ticks *= this.tupletRatio.inTimeOf / this.tupletRatio.parts;
2011
- }
2012
- }
2013
- /**
2014
- * Get string presentation of rhythm props.
2015
- * @returns - String presentation.
2016
- */
2017
- toString() {
2018
- let sym = _RhythmProps.NoteSymbolMap.get(this.noteSize);
2019
- let dots = ".".repeat(this.dotCount);
2020
- return sym ? sym + dots : "" + this.noteSize + (dots.length > 0 ? dots : "n");
2021
- }
2022
- /**
2023
- * Get rhythm props with given arguments.
2024
- * @param noteLength - Note length.
2025
- * @param dotCount - Dot count.
2026
- * @param tupletRatio - Tuplet ratio.
2027
- * @returns - Rhythm props.
2028
- */
2029
- static get(noteLength, dotCount, tupletRatio) {
2030
- if (dotCount !== void 0 || tupletRatio !== void 0) {
2031
- return new _RhythmProps(noteLength, dotCount, tupletRatio);
2032
- } else {
2033
- let rhythmProps = this.cache.get(noteLength);
2034
- if (!rhythmProps) {
2035
- this.cache.set(noteLength, rhythmProps = new _RhythmProps(noteLength));
2036
- }
2037
- return rhythmProps;
2038
- }
2039
- }
2040
- /**
2041
- * Compare duration of rhythm props.
2042
- * @param a - RhythmProps
2043
- * @param b - RhythmProps
2044
- * @returns - -1: a < b, 0: a === b, +1: a > b (duration comparisons)
2045
- */
2046
- static cmp(a, b) {
2047
- return cmp(a.ticks, b.ticks);
2048
- }
2049
- /**
2050
- * Compare duration equality of rhythm props.
2051
- * @param a - RhythmProps
2052
- * @param b - RhythmProps
2053
- * @returns - true: a === b, false: a !== b (duration comparisons)
2054
- */
2055
- static equals(a, b) {
2056
- return a.ticks === b.ticks;
2057
- }
2058
- };
2059
- __publicField(_RhythmProps, "NoteSymbolMap", /* @__PURE__ */ new Map([[1, "\u{1D15D}"], [2, "\u{1D15E}"], [4, "\u{1D15F}"], [8, "\u{1D160}"], [16, "\u{1D161}"], [32, "\u{1D162}"], [64, "\u{1D163}"], [128, "\u{1D164}"]]));
2060
- __publicField(_RhythmProps, "cache", /* @__PURE__ */ new Map());
2061
- var RhythmProps = _RhythmProps;
2062
-
2063
- // src/theory/time-signature.ts
2064
- import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
1821
+ var TimeSignatures = /* @__PURE__ */ ((TimeSignatures2) => {
1822
+ TimeSignatures2["_2_4"] = "2/4";
1823
+ TimeSignatures2["_3_4"] = "3/4";
1824
+ TimeSignatures2["_4_4"] = "4/4";
1825
+ TimeSignatures2["_3_8"] = "3/8";
1826
+ TimeSignatures2["_5_8"] = "5/8";
1827
+ TimeSignatures2["_6_8"] = "6/8";
1828
+ TimeSignatures2["_7_8"] = "7/8";
1829
+ TimeSignatures2["_9_8"] = "9/8";
1830
+ TimeSignatures2["_12_8"] = "12/8";
1831
+ return TimeSignatures2;
1832
+ })(TimeSignatures || {});
1833
+ var BeamGrouping = /* @__PURE__ */ ((BeamGrouping2) => {
1834
+ BeamGrouping2["_2_3"] = "2-3";
1835
+ BeamGrouping2["_3_2"] = "3-2";
1836
+ BeamGrouping2["_2_2_3"] = "2-2-3";
1837
+ BeamGrouping2["_3_2_2"] = "3-2-2";
1838
+ return BeamGrouping2;
1839
+ })(BeamGrouping || {});
2065
1840
  var TimeSignature = class {
2066
1841
  constructor(...args) {
2067
1842
  /** Number of beats in measure, upper value (e.g. "3" in "3/4"). */
@@ -2072,39 +1847,66 @@ var TimeSignature = class {
2072
1847
  __publicField(this, "beatLength");
2073
1848
  /** Number of ticks in measure. */
2074
1849
  __publicField(this, "measureTicks");
2075
- /** Number of beam groups in measure. */
2076
- __publicField(this, "beamGroupCount");
2077
- /** Length of one beam group. */
2078
- __publicField(this, "beamGroupLength");
2079
- if (args.length === 1 && typeof args[0] === "string") {
1850
+ /** Beam groups (e.g. [[2], [2]] or [[2, 2], [2, 2]] (first try as [[4], [4]])). */
1851
+ __publicField(this, "beamGroupSizes", []);
1852
+ let beamGrouping;
1853
+ if (Utils8.Is.isEnumValue(args[0], TimeSignatures)) {
2080
1854
  let parts = args[0].split("/");
2081
1855
  this.beatCount = +parts[0];
2082
1856
  this.beatSize = +parts[1];
2083
- } else if (args.length === 2 && typeof args[0] === "number" && typeof args[1] === "number") {
1857
+ if (Utils8.Is.isEnumValue(args[1], BeamGrouping)) {
1858
+ beamGrouping = args[1];
1859
+ }
1860
+ } else if (Utils8.Is.isIntegerGte(args[0], 2) && Utils8.Is.isIntegerGte(args[1], 2)) {
2084
1861
  this.beatCount = args[0];
2085
1862
  this.beatSize = args[1];
1863
+ if (Utils8.Is.isEnumValue(args[2], BeamGrouping)) {
1864
+ beamGrouping = args[2];
1865
+ }
2086
1866
  } else {
2087
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid args: ${args}`);
2088
- }
2089
- if (!Utils9.Is.isIntegerGte(this.beatCount, 1)) {
2090
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beatCount: ${this.beatCount}`);
2091
- } else if (!Utils9.Is.isIntegerGte(this.beatSize, 1)) {
2092
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beatSize: ${this.beatSize}`);
2093
- }
2094
- let props = NoteLengthProps.create(this.beatSize);
2095
- this.beatLength = props.noteLength;
2096
- this.measureTicks = this.beatCount * props.ticks;
2097
- if (this.is(2, 4) || this.is(3, 4) || this.is(4, 4)) {
2098
- this.beamGroupCount = this.beatCount;
2099
- } else if (this.is(6, 8) || this.is(9, 8)) {
2100
- this.beamGroupCount = this.beatCount / 3;
2101
- } else {
2102
- console.warn("Not necessarily an error, but unsupported time signature: " + this.toString());
2103
- this.beamGroupCount = 1;
1867
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid args: ${args}`);
1868
+ }
1869
+ if (!Utils8.Is.isIntegerGte(this.beatCount, 1)) {
1870
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beatCount: ${this.beatCount}`);
1871
+ } else if (!Utils8.Is.isIntegerGte(this.beatSize, 1)) {
1872
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beatSize: ${this.beatSize}`);
1873
+ }
1874
+ let { noteLength, ticks } = NoteLengthProps.create(this.beatSize);
1875
+ this.beatLength = noteLength;
1876
+ this.measureTicks = this.beatCount * ticks;
1877
+ if (this.is(2, 4)) {
1878
+ this.beamGroupSizes = [[2], [2]];
1879
+ } else if (this.is(3, 4)) {
1880
+ this.beamGroupSizes = [[2], [2], [2]];
1881
+ } else if (this.is(4, 4)) {
1882
+ this.beamGroupSizes = [[2, 2], [2, 2]];
1883
+ } else if (this.is(3, 8)) {
1884
+ this.beamGroupSizes = [[3]];
1885
+ } else if (this.is(5, 8)) {
1886
+ if (!Utils8.Is.isUndefined(beamGrouping) && beamGrouping !== "2-3" /* _2_3 */ && beamGrouping !== "3-2" /* _3_2 */) {
1887
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
1888
+ } else {
1889
+ this.beamGroupSizes = beamGrouping === "3-2" /* _3_2 */ ? [[3], [2]] : [[2], [3]];
1890
+ beamGrouping = void 0;
1891
+ }
1892
+ } else if (this.is(6, 8)) {
1893
+ this.beamGroupSizes = [[3], [3]];
1894
+ } else if (this.is(7, 8)) {
1895
+ if (!Utils8.Is.isUndefined(beamGrouping) && beamGrouping !== "2-2-3" /* _2_2_3 */ && beamGrouping !== "3-2-2" /* _3_2_2 */) {
1896
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
1897
+ } else {
1898
+ this.beamGroupSizes = beamGrouping === "3-2-2" /* _3_2_2 */ ? [[3], [2], [2]] : [[2], [2], [3]];
1899
+ beamGrouping = void 0;
1900
+ }
1901
+ } else if (this.is(9, 8)) {
1902
+ this.beamGroupSizes = [[3], [3], [3]];
1903
+ } else if (this.is(12, 8)) {
1904
+ this.beamGroupSizes = [[3], [3], [3], [3]];
2104
1905
  }
2105
- this.beamGroupLength = this.measureTicks / this.beamGroupCount;
2106
- if (!Utils9.Is.isIntegerGte(this.beamGroupLength, 1)) {
2107
- throw new MusicError9(MusicErrorType9.Timesignature, `Invalid beamGroupLength: ${this.beamGroupLength}`);
1906
+ if (this.beamGroupSizes.length === 0) {
1907
+ throw new MusicError8(MusicErrorType8.Timesignature, `Unimplemented time signature "${this.toString()}".`);
1908
+ } else if (beamGrouping !== void 0) {
1909
+ throw new MusicError8(MusicErrorType8.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
2108
1910
  }
2109
1911
  }
2110
1912
  /**
@@ -2155,6 +1957,7 @@ import { init as initCore } from "@tspro/web-music-score/core";
2155
1957
  initCore();
2156
1958
  export {
2157
1959
  AccidentalType,
1960
+ BeamGrouping,
2158
1961
  Chord,
2159
1962
  DefaultGuitarNoteLabel,
2160
1963
  DefaultHandedness,
@@ -2177,6 +1980,7 @@ export {
2177
1980
  ScaleType,
2178
1981
  SymbolSet,
2179
1982
  TimeSignature,
1983
+ TimeSignatures,
2180
1984
  TuningNameList,
2181
1985
  Tuplet,
2182
1986
  alterTempoSpeed,
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@tspro/web-music-score",
3
- "version": "4.0.1",
3
+ "version": "4.2.0",
4
4
  "author": "PahkaSoft",
5
5
  "license": "MIT",
6
6
  "private": false,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/pahkasoft/web-music-score.git"
10
+ },
7
11
  "bugs": {
8
- "url": "https://github.com/pahkasoft/issues/issues/new"
12
+ "url": "https://github.com/pahkasoft/web-music-score/issues/new/choose"
9
13
  },
10
14
  "description": "TS/JS component for rendering and playing music scores in the browser.",
11
15
  "exports": {
@@ -102,6 +106,7 @@
102
106
  "@tspro/tsup-plugin-inline-assets": "^1.0.0",
103
107
  "@types/react": "^18.0.0",
104
108
  "@types/react-dom": "^18.0.0",
109
+ "rimraf": "^6.0.1",
105
110
  "tsup": "^8.5.0",
106
111
  "typedoc": "^0.28.6",
107
112
  "typescript": "latest"
@@ -117,4 +122,4 @@
117
122
  "build:prod (all workspaces)": "npm run build && npm run build:prod --workspaces --if-present",
118
123
  "docs": "typedoc"
119
124
  }
120
- }
125
+ }