@tspro/web-music-score 4.2.0 → 4.2.1

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.
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,5 +1,5 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
- import "../chunk-5NWLGWHS.mjs";
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
+ import "../chunk-64N22LCV.mjs";
3
3
 
4
4
  // src/pieces/frere-jacques.ts
5
5
  import { DocumentBuilder } from "@tspro/web-music-score/score";
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-5NWLGWHS.mjs";
4
+ } from "../chunk-64N22LCV.mjs";
5
5
 
6
6
  // src/react-ui/circle-of-fifths.tsx
7
7
  import * as React from "react";
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -1816,24 +1816,24 @@ var ObjRest = class extends MusicObject {
1816
1816
  visibleInStaff(staff) {
1817
1817
  return staff.containsVoiceId(this.voiceId) && this.staffObjects.some((obj) => obj instanceof ObjStaffRest && obj.staff === staff);
1818
1818
  }
1819
- getRestDotVerticalDisplacement(noteLength) {
1820
- switch (noteLength) {
1821
- case import_theory3.NoteLength.Whole:
1819
+ getRestDotVerticalDisplacement(noteSize) {
1820
+ switch (noteSize) {
1821
+ case 1:
1822
1822
  return 1;
1823
- case import_theory3.NoteLength.Half:
1823
+ case 2:
1824
1824
  return -1;
1825
- case import_theory3.NoteLength.Quarter:
1825
+ case 4:
1826
1826
  return -1;
1827
- case import_theory3.NoteLength.Eighth:
1827
+ case 8:
1828
1828
  return -1;
1829
- case import_theory3.NoteLength.Sixteenth:
1829
+ case 16:
1830
1830
  return -1;
1831
- case import_theory3.NoteLength.ThirtySecond:
1831
+ case 32:
1832
1832
  return -3;
1833
- case import_theory3.NoteLength.SixtyFourth:
1833
+ case 64:
1834
1834
  return -3;
1835
1835
  default:
1836
- throw new import_core5.MusicError(import_core5.MusicErrorType.Score, "Cannot get rest dot vertical displacement because note length is invalid.");
1836
+ throw new import_core5.MusicError(import_core5.MusicErrorType.Score, `Get rest dot vertical displacement: Invalid note size: ${noteSize}`);
1837
1837
  }
1838
1838
  }
1839
1839
  updateAccidentalState(accState) {
@@ -1846,22 +1846,22 @@ var ObjRest = class extends MusicObject {
1846
1846
  }
1847
1847
  let { unitSize } = renderer;
1848
1848
  let { ownDiatonicId } = this;
1849
- let { noteLength, dotCount, flagCount } = this.rhythmProps;
1849
+ let { noteSize, dotCount, flagCount } = this.rhythmProps;
1850
1850
  let leftw = 0;
1851
1851
  let rightw = 0;
1852
1852
  let toph = 0;
1853
1853
  let bottomh = 0;
1854
- if (noteLength === import_theory3.NoteLength.Whole) {
1854
+ if (import_theory3.NoteLengthProps.equals(noteSize, import_theory3.NoteLength.Whole)) {
1855
1855
  leftw = unitSize;
1856
1856
  rightw = unitSize;
1857
1857
  toph = 0;
1858
1858
  bottomh = unitSize;
1859
- } else if (noteLength === import_theory3.NoteLength.Half) {
1859
+ } else if (import_theory3.NoteLengthProps.equals(noteSize, import_theory3.NoteLength.Half)) {
1860
1860
  leftw = unitSize;
1861
1861
  rightw = unitSize;
1862
1862
  toph = unitSize;
1863
1863
  bottomh = 0;
1864
- } else if (noteLength === import_theory3.NoteLength.Quarter) {
1864
+ } else if (import_theory3.NoteLengthProps.equals(noteSize, import_theory3.NoteLength.Quarter)) {
1865
1865
  leftw = unitSize * 1;
1866
1866
  rightw = unitSize * 1;
1867
1867
  toph = unitSize * 3.2;
@@ -1882,7 +1882,7 @@ var ObjRest = class extends MusicObject {
1882
1882
  for (let i = 0; i < dotCount; i++) {
1883
1883
  let dotWidth = DocumentSettings.DotSize * unitSize;
1884
1884
  let dotX = rightw + (DocumentSettings.RestDotSpace + DocumentSettings.DotSize * unitSize) + i * DocumentSettings.DotSize * unitSize * 1.5;
1885
- let dotY = this.getRestDotVerticalDisplacement(noteLength) * unitSize;
1885
+ let dotY = this.getRestDotVerticalDisplacement(noteSize) * unitSize;
1886
1886
  obj.dotRects.push(DivRect.createCentered(dotX, dotY, dotWidth, dotWidth));
1887
1887
  }
1888
1888
  obj.offset(0, staff.getDiatonicIdY(ownDiatonicId));
@@ -1913,18 +1913,18 @@ var ObjRest = class extends MusicObject {
1913
1913
  renderer.drawDebugRect(this.getRect());
1914
1914
  let { unitSize, lineWidth } = renderer;
1915
1915
  let { color } = this;
1916
- let { noteLength, flagCount } = this.rhythmProps;
1916
+ let { noteSize, flagCount } = this.rhythmProps;
1917
1917
  ctx.strokeStyle = ctx.fillStyle = color;
1918
1918
  ctx.lineWidth = lineWidth;
1919
1919
  this.staffObjects.forEach((obj) => {
1920
1920
  let { dotRects, restRect } = obj;
1921
1921
  let x = restRect.centerX;
1922
1922
  let y = restRect.centerY;
1923
- if (noteLength === import_theory3.NoteLength.Whole) {
1923
+ if (import_theory3.NoteLengthProps.equals(noteSize, import_theory3.NoteLength.Whole)) {
1924
1924
  ctx.fillRect(x - unitSize, y, unitSize * 2, unitSize);
1925
- } else if (noteLength === import_theory3.NoteLength.Half) {
1925
+ } else if (import_theory3.NoteLengthProps.equals(noteSize, import_theory3.NoteLength.Half)) {
1926
1926
  ctx.fillRect(x - unitSize, y - unitSize, unitSize * 2, unitSize);
1927
- } else if (noteLength === import_theory3.NoteLength.Quarter) {
1927
+ } else if (import_theory3.NoteLengthProps.equals(noteSize, import_theory3.NoteLength.Quarter)) {
1928
1928
  ctx.beginPath();
1929
1929
  ctx.moveTo(x - unitSize * 0.6, y - unitSize * 3.2);
1930
1930
  ctx.lineTo(x + unitSize * 0.7, y - unitSize * 1.5);
@@ -1,10 +1,10 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  RhythmProps
4
- } from "../chunk-7MNV5JN6.mjs";
4
+ } from "../chunk-RQFFLRWF.mjs";
5
5
  import {
6
6
  __publicField
7
- } from "../chunk-5NWLGWHS.mjs";
7
+ } from "../chunk-64N22LCV.mjs";
8
8
 
9
9
  // src/score/pub/div-rect.ts
10
10
  import { Utils } from "@tspro/ts-utils-lib";
@@ -1729,24 +1729,24 @@ var ObjRest = class extends MusicObject {
1729
1729
  visibleInStaff(staff) {
1730
1730
  return staff.containsVoiceId(this.voiceId) && this.staffObjects.some((obj) => obj instanceof ObjStaffRest && obj.staff === staff);
1731
1731
  }
1732
- getRestDotVerticalDisplacement(noteLength) {
1733
- switch (noteLength) {
1734
- case NoteLength.Whole:
1732
+ getRestDotVerticalDisplacement(noteSize) {
1733
+ switch (noteSize) {
1734
+ case 1:
1735
1735
  return 1;
1736
- case NoteLength.Half:
1736
+ case 2:
1737
1737
  return -1;
1738
- case NoteLength.Quarter:
1738
+ case 4:
1739
1739
  return -1;
1740
- case NoteLength.Eighth:
1740
+ case 8:
1741
1741
  return -1;
1742
- case NoteLength.Sixteenth:
1742
+ case 16:
1743
1743
  return -1;
1744
- case NoteLength.ThirtySecond:
1744
+ case 32:
1745
1745
  return -3;
1746
- case NoteLength.SixtyFourth:
1746
+ case 64:
1747
1747
  return -3;
1748
1748
  default:
1749
- throw new MusicError5(MusicErrorType5.Score, "Cannot get rest dot vertical displacement because note length is invalid.");
1749
+ throw new MusicError5(MusicErrorType5.Score, `Get rest dot vertical displacement: Invalid note size: ${noteSize}`);
1750
1750
  }
1751
1751
  }
1752
1752
  updateAccidentalState(accState) {
@@ -1759,22 +1759,22 @@ var ObjRest = class extends MusicObject {
1759
1759
  }
1760
1760
  let { unitSize } = renderer;
1761
1761
  let { ownDiatonicId } = this;
1762
- let { noteLength, dotCount, flagCount } = this.rhythmProps;
1762
+ let { noteSize, dotCount, flagCount } = this.rhythmProps;
1763
1763
  let leftw = 0;
1764
1764
  let rightw = 0;
1765
1765
  let toph = 0;
1766
1766
  let bottomh = 0;
1767
- if (noteLength === NoteLength.Whole) {
1767
+ if (NoteLengthProps.equals(noteSize, NoteLength.Whole)) {
1768
1768
  leftw = unitSize;
1769
1769
  rightw = unitSize;
1770
1770
  toph = 0;
1771
1771
  bottomh = unitSize;
1772
- } else if (noteLength === NoteLength.Half) {
1772
+ } else if (NoteLengthProps.equals(noteSize, NoteLength.Half)) {
1773
1773
  leftw = unitSize;
1774
1774
  rightw = unitSize;
1775
1775
  toph = unitSize;
1776
1776
  bottomh = 0;
1777
- } else if (noteLength === NoteLength.Quarter) {
1777
+ } else if (NoteLengthProps.equals(noteSize, NoteLength.Quarter)) {
1778
1778
  leftw = unitSize * 1;
1779
1779
  rightw = unitSize * 1;
1780
1780
  toph = unitSize * 3.2;
@@ -1795,7 +1795,7 @@ var ObjRest = class extends MusicObject {
1795
1795
  for (let i = 0; i < dotCount; i++) {
1796
1796
  let dotWidth = DocumentSettings.DotSize * unitSize;
1797
1797
  let dotX = rightw + (DocumentSettings.RestDotSpace + DocumentSettings.DotSize * unitSize) + i * DocumentSettings.DotSize * unitSize * 1.5;
1798
- let dotY = this.getRestDotVerticalDisplacement(noteLength) * unitSize;
1798
+ let dotY = this.getRestDotVerticalDisplacement(noteSize) * unitSize;
1799
1799
  obj.dotRects.push(DivRect.createCentered(dotX, dotY, dotWidth, dotWidth));
1800
1800
  }
1801
1801
  obj.offset(0, staff.getDiatonicIdY(ownDiatonicId));
@@ -1826,18 +1826,18 @@ var ObjRest = class extends MusicObject {
1826
1826
  renderer.drawDebugRect(this.getRect());
1827
1827
  let { unitSize, lineWidth } = renderer;
1828
1828
  let { color } = this;
1829
- let { noteLength, flagCount } = this.rhythmProps;
1829
+ let { noteSize, flagCount } = this.rhythmProps;
1830
1830
  ctx.strokeStyle = ctx.fillStyle = color;
1831
1831
  ctx.lineWidth = lineWidth;
1832
1832
  this.staffObjects.forEach((obj) => {
1833
1833
  let { dotRects, restRect } = obj;
1834
1834
  let x = restRect.centerX;
1835
1835
  let y = restRect.centerY;
1836
- if (noteLength === NoteLength.Whole) {
1836
+ if (NoteLengthProps.equals(noteSize, NoteLength.Whole)) {
1837
1837
  ctx.fillRect(x - unitSize, y, unitSize * 2, unitSize);
1838
- } else if (noteLength === NoteLength.Half) {
1838
+ } else if (NoteLengthProps.equals(noteSize, NoteLength.Half)) {
1839
1839
  ctx.fillRect(x - unitSize, y - unitSize, unitSize * 2, unitSize);
1840
- } else if (noteLength === NoteLength.Quarter) {
1840
+ } else if (NoteLengthProps.equals(noteSize, NoteLength.Quarter)) {
1841
1841
  ctx.beginPath();
1842
1842
  ctx.moveTo(x - unitSize * 0.6, y - unitSize * 3.2);
1843
1843
  ctx.lineTo(x + unitSize * 0.7, y - unitSize * 1.5);
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  NoteLength,
4
4
  NoteLengthProps,
@@ -6,10 +6,10 @@ import {
6
6
  Tuplet,
7
7
  validateNoteLength,
8
8
  validateTupletRatio
9
- } from "../chunk-7MNV5JN6.mjs";
9
+ } from "../chunk-RQFFLRWF.mjs";
10
10
  import {
11
11
  __publicField
12
- } from "../chunk-5NWLGWHS.mjs";
12
+ } from "../chunk-64N22LCV.mjs";
13
13
 
14
14
  // src/theory/chord.ts
15
15
  import { Utils as Utils6 } from "@tspro/ts-utils-lib";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tspro/web-music-score",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "author": "PahkaSoft",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -96,7 +96,7 @@
96
96
  "package.json"
97
97
  ],
98
98
  "dependencies": {
99
- "@tspro/ts-utils-lib": "^1.6.0",
99
+ "@tspro/ts-utils-lib": "^1.7.0",
100
100
  "tone": "^15.1.22"
101
101
  },
102
102
  "peerDependencies": {