@tspro/web-music-score 4.2.0 → 5.0.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.
@@ -1,10 +1,10 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  RhythmProps
4
- } from "../chunk-7MNV5JN6.mjs";
4
+ } from "../chunk-EYFT3RWB.mjs";
5
5
  import {
6
6
  __publicField
7
- } from "../chunk-5NWLGWHS.mjs";
7
+ } from "../chunk-J3KU3U4W.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);
@@ -7425,13 +7425,13 @@ var DocumentBuilder = class {
7425
7425
  }
7426
7426
  /**
7427
7427
  * Usage:
7428
- * <pre>
7428
+ * ```ts
7429
7429
  * addTuplet(0, Theory.Tuplet.Triplet, notes => {
7430
7430
  * notes.addNote("G3", Theory.NoteLength.Eighth);
7431
7431
  * notes.addNote("B3", Theory.NoteLength.Eighth);
7432
7432
  * notes.addNote("D4", Theory.NoteLength.Eighth);
7433
7433
  * });
7434
- * </pre>
7434
+ * ```
7435
7435
  *
7436
7436
  * @param voiceId - Voice id to add tuplet to.
7437
7437
  * @param tupletRatio - You can also use Theory.Tuplet presets (e.g. Theory.Tuplet.Triplet).
@@ -7646,13 +7646,13 @@ var DocumentBuilder = class {
7646
7646
  }
7647
7647
  /**
7648
7648
  * Add extension line to previously added annotation or label element.
7649
- * <pre>
7649
+ * ```ts
7650
7650
  * // Example
7651
7651
  * addExtension(ext => ext.notes("1n", 2)) // length is 2 whole notes
7652
7652
  * addExtension(ext => ext.measures(3).hide()) // length is 3 measures, hidden
7653
7653
  * addExtension(ext => ext.measures(1).notes("8n")) // length is 1 measure + 1 eigth note
7654
7654
  * addExtension(ext => ext.infinity()) // length is as long as possible
7655
- * </pre>
7655
+ * ```
7656
7656
  * @param extensionBuilder - Extension builder function used to build exstension.
7657
7657
  * @returns - This document builder instance.
7658
7658
  */
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.0.0 | (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 v5.0.0 | (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-EYFT3RWB.mjs";
10
10
  import {
11
11
  __publicField
12
- } from "../chunk-5NWLGWHS.mjs";
12
+ } from "../chunk-J3KU3U4W.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": "5.0.0",
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": {
@@ -108,7 +108,7 @@
108
108
  "@types/react-dom": "^18.0.0",
109
109
  "rimraf": "^6.0.1",
110
110
  "tsup": "^8.5.0",
111
- "typedoc": "^0.28.6",
111
+ "typedoc": "^0.28.13",
112
112
  "typescript": "latest"
113
113
  },
114
114
  "workspaces": [