@tspro/web-music-score 5.2.0 → 5.4.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 (45) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +15 -12
  3. package/dist/audio/index.d.mts +1 -1
  4. package/dist/audio/index.d.ts +1 -1
  5. package/dist/audio/index.js +3 -3
  6. package/dist/audio/index.mjs +6 -6
  7. package/dist/audio-cg/index.js +1 -1
  8. package/dist/audio-cg/index.mjs +3 -3
  9. package/dist/audio-synth/index.js +1 -1
  10. package/dist/audio-synth/index.mjs +3 -3
  11. package/dist/{chunk-LC5JMIVF.mjs → chunk-AUT4C6TY.mjs} +2 -2
  12. package/dist/{chunk-XUGM7SCC.mjs → chunk-MHDBTCVG.mjs} +21 -21
  13. package/dist/{chunk-6S5BDSCM.mjs → chunk-QGMOI7AP.mjs} +2 -2
  14. package/dist/chunk-ZWUBO5EW.mjs +37 -0
  15. package/dist/core/index.js +2 -2
  16. package/dist/core/index.mjs +6 -31
  17. package/dist/{guitar-BsSayRsH.d.ts → guitar-CarHGDAt.d.ts} +1 -1
  18. package/dist/{guitar-DdexKdN6.d.mts → guitar-DXlB-9vK.d.mts} +1 -1
  19. package/dist/iife/audio-cg.global.js +1 -1
  20. package/dist/iife/index.global.js +18 -11
  21. package/dist/{music-objects-CwPOlqFi.d.ts → music-objects-3Esbz7ij.d.ts} +261 -381
  22. package/dist/{music-objects-CB05XryE.d.mts → music-objects-ONIuVUgs.d.mts} +261 -381
  23. package/dist/{note-CgCIBwvR.d.ts → note-CJuq5aBy.d.ts} +13 -1
  24. package/dist/{note-eA2xPPiG.d.mts → note-RVXvpfyV.d.mts} +13 -1
  25. package/dist/pieces/index.d.mts +13 -4
  26. package/dist/pieces/index.d.ts +13 -4
  27. package/dist/pieces/index.js +20 -9
  28. package/dist/pieces/index.mjs +20 -10
  29. package/dist/react-ui/index.d.mts +10 -10
  30. package/dist/react-ui/index.d.ts +10 -10
  31. package/dist/react-ui/index.js +19 -21
  32. package/dist/react-ui/index.mjs +23 -25
  33. package/dist/{scale-CBW4eTz7.d.ts → scale-C8gHC448.d.mts} +3 -3
  34. package/dist/{scale-DQP3b9Zx.d.mts → scale-DulPFco_.d.ts} +3 -3
  35. package/dist/score/index.d.mts +235 -7
  36. package/dist/score/index.d.ts +235 -7
  37. package/dist/score/index.js +2064 -1807
  38. package/dist/score/index.mjs +1897 -1671
  39. package/dist/{tempo-dkctPkCS.d.mts → tempo-BlCGZuYg.d.mts} +14 -2
  40. package/dist/{tempo-DMt3iwz9.d.ts → tempo-BnUjm25M.d.ts} +14 -2
  41. package/dist/theory/index.d.mts +6 -6
  42. package/dist/theory/index.d.ts +6 -6
  43. package/dist/theory/index.js +88 -86
  44. package/dist/theory/index.mjs +85 -81
  45. package/package.json +5 -4
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v5.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.4.0 | (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;
@@ -47,7 +47,6 @@ module.exports = __toCommonJS(react_ui_exports);
47
47
  // src/react-ui/circle-of-fifths.tsx
48
48
  var React = __toESM(require("react"));
49
49
  var import_theory = require("@tspro/web-music-score/theory");
50
- var import_score = require("@tspro/web-music-score/score");
51
50
  var import_ts_utils_lib = require("@tspro/ts-utils-lib");
52
51
  var import_jsx_runtime = require("react/jsx-runtime");
53
52
  var SelectedColor = "#0A0";
@@ -99,7 +98,7 @@ var CircleOfFifths = class extends React.Component {
99
98
  let width = (_a = dim.width) != null ? _a : defaultSize;
100
99
  let height = (_b = dim.height) != null ? _b : defaultSize;
101
100
  style = Object.assign({}, style, { width, height });
102
- let circleRect = new import_score.DivRect(0, width, 0, height).scaleCopy(0.65);
101
+ let circleRect = new import_ts_utils_lib.Rect(0, 0, width, height).scaleCopy(0.65);
103
102
  let lineWidth = Math.max(1, circleRect.width / 100);
104
103
  let fontSize = circleRect.width / 15;
105
104
  let tonicSize = fontSize * 2;
@@ -308,9 +307,9 @@ var GuitarContext = class _GuitarContext {
308
307
  * @returns - Fret position object.
309
308
  */
310
309
  getFretPosition(stringId, fretId) {
311
- if (!import_ts_utils_lib2.Utils.Is.isInteger(stringId) || stringId < 0 || stringId > 5) {
310
+ if (!import_ts_utils_lib2.Guard.isInteger(stringId) || stringId < 0 || stringId > 5) {
312
311
  throw new import_core.MusicError(import_core.MusicErrorType.InvalidArg, `Invalid stringId: + ${stringId}`);
313
- } else if (!import_ts_utils_lib2.Utils.Is.isInteger(fretId) || fretId < 0 || fretId > this.maxFretId) {
312
+ } else if (!import_ts_utils_lib2.Guard.isInteger(fretId) || fretId < 0 || fretId > this.maxFretId) {
314
313
  throw new import_core.MusicError(import_core.MusicErrorType.InvalidArg, `Invalid fretId: ${fretId}`);
315
314
  } else {
316
315
  return this.fretPositionTable[stringId][fretId];
@@ -376,7 +375,6 @@ var GuitarContext = class _GuitarContext {
376
375
  // src/react-ui/guitar-view.tsx
377
376
  var React2 = __toESM(require("react"));
378
377
  var import_ts_utils_lib3 = require("@tspro/ts-utils-lib");
379
- var import_score2 = require("@tspro/web-music-score/score");
380
378
  var import_theory4 = require("@tspro/web-music-score/theory");
381
379
 
382
380
  // src/react-ui/assets/guitar.png
@@ -414,7 +412,7 @@ var t_table = [
414
412
  0.75
415
413
  ];
416
414
  function fret_t(fretId) {
417
- if (!import_ts_utils_lib3.Utils.Is.isInteger(fretId) || fretId < 0 || fretId > t_table.length - 1) {
415
+ if (!import_ts_utils_lib3.Guard.isInteger(fretId) || fretId < 0 || fretId > t_table.length - 1) {
418
416
  throw new import_core2.MusicError(import_core2.MusicErrorType.InvalidArg, `Invalid fretId: ${fretId}`);
419
417
  } else {
420
418
  return t_table[fretId] * 2;
@@ -485,16 +483,16 @@ var GuitarView = class extends React2.Component {
485
483
  let left = frets[fretId];
486
484
  let right = (_b = frets[fretId - 1]) != null ? _b : new Fret(width, left.topStringY, left.bottomStringY);
487
485
  let cellHeight = (left.bottomStringY - left.topStringY) / 5;
488
- let cellRect = import_score2.DivRect.create(
486
+ let cellRect = new import_ts_utils_lib3.Rect(
489
487
  left.x,
490
488
  left.bottomStringY - cellHeight * (stringId + 0.5),
491
489
  right.x - left.x,
492
490
  cellHeight
493
491
  );
494
492
  if (guitarCtx.handedness === import_theory4.Handedness.LeftHanded) {
495
- cellRect = new import_score2.DivRect(width - cellRect.right, width - cellRect.left, cellRect.top, cellRect.bottom);
493
+ cellRect = new import_ts_utils_lib3.Rect(width - cellRect.right, cellRect.top, cellRect.width, cellRect.height);
496
494
  }
497
- let noteRect = import_score2.DivRect.create(
495
+ let noteRect = new import_ts_utils_lib3.Rect(
498
496
  cellRect.left + (guitarCtx.handedness === import_theory4.Handedness.LeftHanded ? cellRect.width - noteWidth : 0),
499
497
  cellRect.top,
500
498
  noteWidth,
@@ -596,29 +594,29 @@ var GuitarView = class extends React2.Component {
596
594
 
597
595
  // src/react-ui/music-score-view.tsx
598
596
  var React3 = __toESM(require("react"));
599
- var import_score3 = require("@tspro/web-music-score/score");
597
+ var import_score = require("@tspro/web-music-score/score");
600
598
  var import_jsx_runtime3 = require("react/jsx-runtime");
601
599
  var MusicScoreView = class extends React3.Component {
602
600
  constructor(props) {
603
601
  super(props);
604
- __publicField(this, "renderer");
605
- this.renderer = new import_score3.MRenderer();
606
- this.renderer.setDocument(props.doc);
602
+ __publicField(this, "ctx");
603
+ this.ctx = new import_score.MRenderContext();
604
+ this.ctx.setDocument(props.doc);
607
605
  if (props.onScoreEvent) {
608
- this.renderer.setScoreEventListener(props.onScoreEvent);
606
+ this.ctx.setScoreEventListener(props.onScoreEvent);
609
607
  }
610
608
  }
611
609
  componentDidUpdate(prevProps, prevState) {
612
610
  if (prevProps.doc !== this.props.doc) {
613
- this.renderer.setDocument(this.props.doc);
614
- this.renderer.draw();
611
+ this.ctx.setDocument(this.props.doc);
612
+ this.ctx.draw();
615
613
  }
616
614
  }
617
615
  render() {
618
616
  const setCanvas = (canvas) => {
619
617
  if (canvas) {
620
- this.renderer.setCanvas(canvas);
621
- this.renderer.draw();
618
+ this.ctx.setCanvas(canvas);
619
+ this.ctx.draw();
622
620
  }
623
621
  };
624
622
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("canvas", { style: { position: "relative" }, ref: setCanvas, children: "Your browser does not support the HTML canvas tag." });
@@ -627,7 +625,7 @@ var MusicScoreView = class extends React3.Component {
627
625
 
628
626
  // src/react-ui/playback-buttons.tsx
629
627
  var React4 = __toESM(require("react"));
630
- var import_score4 = require("@tspro/web-music-score/score");
628
+ var import_score2 = require("@tspro/web-music-score/score");
631
629
  var import_jsx_runtime4 = require("react/jsx-runtime");
632
630
  var PlaybackButtonsLayout = /* @__PURE__ */ ((PlaybackButtonsLayout2) => {
633
631
  PlaybackButtonsLayout2[PlaybackButtonsLayout2["PlayStopSingle"] = 0] = "PlayStopSingle";
@@ -640,7 +638,7 @@ var PlaybackButtons = class extends React4.Component {
640
638
  super(props);
641
639
  __publicField(this, "state");
642
640
  this.state = {
643
- controller: new import_score4.MPlaybackButtons().setDocument(props.doc)
641
+ controller: new import_score2.MPlaybackButtons().setDocument(props.doc)
644
642
  };
645
643
  }
646
644
  componentDidUpdate(prevProps) {
@@ -1,13 +1,12 @@
1
- /* WebMusicScore v5.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.4.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-LC5JMIVF.mjs";
4
+ } from "../chunk-AUT4C6TY.mjs";
5
5
 
6
6
  // src/react-ui/circle-of-fifths.tsx
7
7
  import * as React from "react";
8
8
  import { Note, SymbolSet, getScale, ScaleType } from "@tspro/web-music-score/theory";
9
- import { DivRect } from "@tspro/web-music-score/score";
10
- import { Device, Utils } from "@tspro/ts-utils-lib";
9
+ import { Device, Rect, Utils } from "@tspro/ts-utils-lib";
11
10
  import { jsx } from "react/jsx-runtime";
12
11
  var SelectedColor = "#0A0";
13
12
  var MajorScaleTonics = [
@@ -58,7 +57,7 @@ var CircleOfFifths = class extends React.Component {
58
57
  let width = (_a = dim.width) != null ? _a : defaultSize;
59
58
  let height = (_b = dim.height) != null ? _b : defaultSize;
60
59
  style = Object.assign({}, style, { width, height });
61
- let circleRect = new DivRect(0, width, 0, height).scaleCopy(0.65);
60
+ let circleRect = new Rect(0, 0, width, height).scaleCopy(0.65);
62
61
  let lineWidth = Math.max(1, circleRect.width / 100);
63
62
  let fontSize = circleRect.width / 15;
64
63
  let tonicSize = fontSize * 2;
@@ -150,7 +149,7 @@ var guitar_default = {
150
149
 
151
150
  // src/react-ui/guitar-context.ts
152
151
  import { MusicError, MusicErrorType } from "@tspro/web-music-score/core";
153
- import { Utils as Utils2 } from "@tspro/ts-utils-lib";
152
+ import { Guard } from "@tspro/ts-utils-lib";
154
153
  var DefaultColors = {
155
154
  ScaleNoteColor: "#0A0",
156
155
  ScaleRootNoteColor: "#00A",
@@ -267,9 +266,9 @@ var GuitarContext = class _GuitarContext {
267
266
  * @returns - Fret position object.
268
267
  */
269
268
  getFretPosition(stringId, fretId) {
270
- if (!Utils2.Is.isInteger(stringId) || stringId < 0 || stringId > 5) {
269
+ if (!Guard.isInteger(stringId) || stringId < 0 || stringId > 5) {
271
270
  throw new MusicError(MusicErrorType.InvalidArg, `Invalid stringId: + ${stringId}`);
272
- } else if (!Utils2.Is.isInteger(fretId) || fretId < 0 || fretId > this.maxFretId) {
271
+ } else if (!Guard.isInteger(fretId) || fretId < 0 || fretId > this.maxFretId) {
273
272
  throw new MusicError(MusicErrorType.InvalidArg, `Invalid fretId: ${fretId}`);
274
273
  } else {
275
274
  return this.fretPositionTable[stringId][fretId];
@@ -334,8 +333,7 @@ var GuitarContext = class _GuitarContext {
334
333
 
335
334
  // src/react-ui/guitar-view.tsx
336
335
  import * as React2 from "react";
337
- import { Utils as Utils3 } from "@tspro/ts-utils-lib";
338
- import { DivRect as DivRect2 } from "@tspro/web-music-score/score";
336
+ import { Guard as Guard2, Rect as Rect2, Utils as Utils2 } from "@tspro/ts-utils-lib";
339
337
  import { Handedness as Handedness2 } from "@tspro/web-music-score/theory";
340
338
 
341
339
  // src/react-ui/assets/guitar.png
@@ -373,7 +371,7 @@ var t_table = [
373
371
  0.75
374
372
  ];
375
373
  function fret_t(fretId) {
376
- if (!Utils3.Is.isInteger(fretId) || fretId < 0 || fretId > t_table.length - 1) {
374
+ if (!Guard2.isInteger(fretId) || fretId < 0 || fretId > t_table.length - 1) {
377
375
  throw new MusicError2(MusicErrorType2.InvalidArg, `Invalid fretId: ${fretId}`);
378
376
  } else {
379
377
  return t_table[fretId] * 2;
@@ -420,14 +418,14 @@ var GuitarView = class extends React2.Component {
420
418
  }
421
419
  componentDidUpdate(prevProps) {
422
420
  let { style, guitarContext: guitarCtx } = this.props;
423
- if (Utils3.Dom.styleLayoutChanged(style, prevProps.style) || guitarCtx !== prevProps.guitarContext) {
421
+ if (Utils2.Dom.styleLayoutChanged(style, prevProps.style) || guitarCtx !== prevProps.guitarContext) {
424
422
  this.setState(this.getLayoutState());
425
423
  }
426
424
  }
427
425
  getLayoutState() {
428
426
  var _a, _b;
429
427
  let { guitarContext: guitarCtx, style } = this.props;
430
- let dim = Utils3.Dom.getDimension(style);
428
+ let dim = Utils2.Dom.getDimension(style);
431
429
  let width = (_a = dim.width) != null ? _a : window.innerWidth;
432
430
  let height = guitar_default.height * width / guitar_default.width;
433
431
  let s = width / guitar_default.width;
@@ -444,16 +442,16 @@ var GuitarView = class extends React2.Component {
444
442
  let left = frets[fretId];
445
443
  let right = (_b = frets[fretId - 1]) != null ? _b : new Fret(width, left.topStringY, left.bottomStringY);
446
444
  let cellHeight = (left.bottomStringY - left.topStringY) / 5;
447
- let cellRect = DivRect2.create(
445
+ let cellRect = new Rect2(
448
446
  left.x,
449
447
  left.bottomStringY - cellHeight * (stringId + 0.5),
450
448
  right.x - left.x,
451
449
  cellHeight
452
450
  );
453
451
  if (guitarCtx.handedness === Handedness2.LeftHanded) {
454
- cellRect = new DivRect2(width - cellRect.right, width - cellRect.left, cellRect.top, cellRect.bottom);
452
+ cellRect = new Rect2(width - cellRect.right, cellRect.top, cellRect.width, cellRect.height);
455
453
  }
456
- let noteRect = DivRect2.create(
454
+ let noteRect = new Rect2(
457
455
  cellRect.left + (guitarCtx.handedness === Handedness2.LeftHanded ? cellRect.width - noteWidth : 0),
458
456
  cellRect.top,
459
457
  noteWidth,
@@ -555,29 +553,29 @@ var GuitarView = class extends React2.Component {
555
553
 
556
554
  // src/react-ui/music-score-view.tsx
557
555
  import * as React3 from "react";
558
- import { MRenderer } from "@tspro/web-music-score/score";
556
+ import { MRenderContext } from "@tspro/web-music-score/score";
559
557
  import { jsx as jsx3 } from "react/jsx-runtime";
560
558
  var MusicScoreView = class extends React3.Component {
561
559
  constructor(props) {
562
560
  super(props);
563
- __publicField(this, "renderer");
564
- this.renderer = new MRenderer();
565
- this.renderer.setDocument(props.doc);
561
+ __publicField(this, "ctx");
562
+ this.ctx = new MRenderContext();
563
+ this.ctx.setDocument(props.doc);
566
564
  if (props.onScoreEvent) {
567
- this.renderer.setScoreEventListener(props.onScoreEvent);
565
+ this.ctx.setScoreEventListener(props.onScoreEvent);
568
566
  }
569
567
  }
570
568
  componentDidUpdate(prevProps, prevState) {
571
569
  if (prevProps.doc !== this.props.doc) {
572
- this.renderer.setDocument(this.props.doc);
573
- this.renderer.draw();
570
+ this.ctx.setDocument(this.props.doc);
571
+ this.ctx.draw();
574
572
  }
575
573
  }
576
574
  render() {
577
575
  const setCanvas = (canvas) => {
578
576
  if (canvas) {
579
- this.renderer.setCanvas(canvas);
580
- this.renderer.draw();
577
+ this.ctx.setCanvas(canvas);
578
+ this.ctx.draw();
581
579
  }
582
580
  };
583
581
  return /* @__PURE__ */ jsx3("canvas", { style: { position: "relative" }, ref: setCanvas, children: "Your browser does not support the HTML canvas tag." });
@@ -1,5 +1,5 @@
1
- import { N as Note, S as SymbolSet } from './note-CgCIBwvR.js';
2
- import { K as KeySignature } from './tempo-DMt3iwz9.js';
1
+ import { N as Note, S as SymbolSet } from './note-RVXvpfyV.mjs';
2
+ import { K as KeySignature } from './tempo-BlCGZuYg.mjs';
3
3
 
4
4
  /** Interval direction type. */
5
5
  type IntervalDirection = "Unison" | "Ascending" | "Descending";
@@ -147,7 +147,7 @@ declare class Scale extends KeySignature {
147
147
  * @returns - Interval.
148
148
  */
149
149
  getIntervalFromRootNote(note: Note): Interval;
150
- private preferredChromaticNoteCache;
150
+ private preferredChromaticIdNoteCache;
151
151
  /**
152
152
  * Get preferred chromatic note from given chromatic id.
153
153
  * @param chromaticId - Chromatic id.
@@ -1,5 +1,5 @@
1
- import { N as Note, S as SymbolSet } from './note-eA2xPPiG.mjs';
2
- import { K as KeySignature } from './tempo-dkctPkCS.mjs';
1
+ import { N as Note, S as SymbolSet } from './note-CJuq5aBy.js';
2
+ import { K as KeySignature } from './tempo-BnUjm25M.js';
3
3
 
4
4
  /** Interval direction type. */
5
5
  type IntervalDirection = "Unison" | "Ascending" | "Descending";
@@ -147,7 +147,7 @@ declare class Scale extends KeySignature {
147
147
  * @returns - Interval.
148
148
  */
149
149
  getIntervalFromRootNote(note: Note): Interval;
150
- private preferredChromaticNoteCache;
150
+ private preferredChromaticIdNoteCache;
151
151
  /**
152
152
  * Get preferred chromatic note from given chromatic id.
153
153
  * @param chromaticId - Chromatic id.
@@ -1,10 +1,236 @@
1
- import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, b as VerseNumber, L as LyricsOptions, c as StaffTabOrGroups, F as Fermata, d as Navigation, A as AnnotationText, e as Annotation, f as Label, C as Connective, g as TieType, h as NoteAnchor, i as VerticalPosition } from '../music-objects-CB05XryE.mjs';
2
- export { ad as Arpeggio, a5 as BaseConfig, a4 as Clef, D as DivRect, ah as DynamicsAnnotation, af as LyricsAlign, ag as LyricsHyphen, s as MAccidental, u as MArpeggio, H as MBarLineLeft, G as MBarLineRight, v as MBeamGroup, t as MConnective, x as MEnding, a3 as MExtensionLine, y as MFermata, z as MHeader, B as MImage, a2 as MLyrics, E as MMeasure, J as MNoteGroup, q as MPlaybackButtons, o as MPlayer, p as MRenderer, P as MRest, U as MRhythmColumn, W as MScoreRow, a0 as MSpecialText, X as MStaff, w as MStaffBeamGroup, K as MStaffNoteGroup, Q as MStaffRest, Z as MStaffSignature, I as MStaffTabBarLine, Y as MTab, O as MTabNoteGroup, $ as MTabRhythm, _ as MTabSignature, a1 as MText, r as MusicInterface, aj as PlayState, ak as PlayStateChangeListener, k as ScoreEvent, n as ScoreEventListener, j as ScoreEventType, m as ScoreObjectEvent, l as ScoreStaffPosEvent, a6 as StaffConfig, ae as StaffTabOrGroup, ac as Stem, a9 as StringNumber, a7 as TabConfig, ai as TempoAnnotation, aa as getStringNumbers, ab as getVerseNumbers, a8 as getVoiceIds } from '../music-objects-CB05XryE.mjs';
3
- import { N as Note } from '../note-eA2xPPiG.mjs';
4
- import { S as ScaleType, c as Scale } from '../scale-DQP3b9Zx.mjs';
5
- import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, k as TupletRatio } from '../tempo-dkctPkCS.mjs';
1
+ import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, b as MeasureOptions, V as VoiceId, T as TupletOptions, c as VerseNumber, L as LyricsOptions, d as StaffTabOrGroups, F as Fermata, e as Navigation, A as AnnotationText, f as Annotation, g as Label, C as Connective, h as TieType, i as NoteAnchor, j as VerticalPosition } from '../music-objects-ONIuVUgs.mjs';
2
+ export { ak as Arpeggio, a6 as BaseConfig, a5 as Clef, ao as DynamicsAnnotation, am as LyricsAlign, an as LyricsHyphen, u as MAccidental, w as MArpeggio, I as MBarLineLeft, H as MBarLineRight, x as MBeamGroup, v as MConnective, z as MEnding, a4 as MExtensionLine, B as MFermata, D as MHeader, E as MImage, a3 as MLyrics, G as MMeasure, K as MNoteGroup, s as MPlaybackButtons, p as MPlayer, q as MRenderContext, r as MRenderer, Q as MRest, W as MRhythmColumn, X as MScoreRow, a1 as MSpecialText, Y as MStaff, y as MStaffBeamGroup, O as MStaffNoteGroup, U as MStaffRest, _ as MStaffSignature, J as MStaffTabBarLine, Z as MTab, P as MTabNoteGroup, a0 as MTabRhythm, $ as MTabSignature, a2 as MText, t as MusicInterface, aq as PlayState, ar as PlayStateChangeListener, l as ScoreEvent, o as ScoreEventListener, k as ScoreEventType, n as ScoreObjectEvent, m as ScoreStaffPosEvent, a7 as StaffConfig, al as StaffTabOrGroup, aj as Stem, ac as StringNumber, a8 as TabConfig, ap as TempoAnnotation, ad as getStringNumbers, ag as getVerseNumbers, a9 as getVoiceIds, ae as isStringNumber, ah as isVerseNumber, aa as isVoiceId, af as validateStringNumber, ai as validateVerseNumber, ab as validateVoiceId } from '../music-objects-ONIuVUgs.mjs';
3
+ import { N as Note } from '../note-RVXvpfyV.mjs';
4
+ import { S as ScaleType, c as Scale } from '../scale-C8gHC448.mjs';
5
+ import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, l as TupletRatio } from '../tempo-BlCGZuYg.mjs';
6
6
  import '@tspro/ts-utils-lib';
7
7
 
8
+ /**
9
+ * @deprecated - Will be removed in `v6.0.0`. Use `AnchoredRect` from `@tspro/ts-utils-lib` instead.
10
+ *
11
+ * DivRect class, left, top, right, bottom rectangle divided into four sections by anchorX, anchorY.
12
+ */
13
+ declare class DivRect {
14
+ left: number;
15
+ anchorX: number;
16
+ right: number;
17
+ top: number;
18
+ anchorY: number;
19
+ bottom: number;
20
+ /**
21
+ * Create rectangle with all zero values.
22
+ */
23
+ constructor();
24
+ /**
25
+ * Create rectangle with left, right, top, bottom.
26
+ * Properties anchorX and anchorY will be centered in the middle.
27
+ *
28
+ * @param left - Left coordinate.
29
+ * @param right - Right coordinate.
30
+ * @param top - Top coordinate.
31
+ * @param bottom - Bottom coordinate.
32
+ */
33
+ constructor(left: number, right: number, top: number, bottom: number);
34
+ /**
35
+ * Create rectangle with full arguments.
36
+ *
37
+ * @param left - Left coordinate.
38
+ * @param anchorX - Center x-coordinate.
39
+ * @param right - Right coordinate.
40
+ * @param top - Top coordinate.
41
+ * @param anchorY - Center y-coordinate.
42
+ * @param bottom - Bottom coordinate.
43
+ */
44
+ constructor(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number);
45
+ /**
46
+ * Create rect from basic left, top, width and height arguments.
47
+ *
48
+ * @param left - Left coordinate.
49
+ * @param top - Top coordinate.
50
+ * @param width - Width.
51
+ * @param height - Height.
52
+ * @returns - DivRect.
53
+ */
54
+ static create(left: number, top: number, width: number, height: number): DivRect;
55
+ /**
56
+ * Create rect from anchorX, anchorY, width, height arguments.
57
+ *
58
+ * @param centerX - Center x-coordinate.
59
+ * @param centerY - Center y-coordinate.
60
+ * @param width - Width.
61
+ * @param height - Height.
62
+ * @returns - DivRect.
63
+ */
64
+ static createCentered(centerX: number, centerY: number, width: number, height: number): DivRect;
65
+ /**
66
+ * Create rect from sections.
67
+ *
68
+ * @param leftw - Left section width.
69
+ * @param rightw - Right section width.
70
+ * @param toph - Top section height.
71
+ * @param bottomh - Bottomsection height.
72
+ * @returns - DivRect.
73
+ */
74
+ static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
75
+ /** @deprecated - Renamed to anchorX. */
76
+ get centerX(): number;
77
+ /** @deprecated - Renamed to anchorX. */
78
+ set centerX(x: number);
79
+ /** @deprecated - Renamed to anchorY. */
80
+ get centerY(): number;
81
+ /** @deprecated - Renamed to anchorY. */
82
+ set centerY(y: number);
83
+ /**
84
+ * Width getter.
85
+ */
86
+ get width(): number;
87
+ /**
88
+ * Height getter.
89
+ */
90
+ get height(): number;
91
+ /**
92
+ * Left section width getter.
93
+ */
94
+ get leftw(): number;
95
+ /**
96
+ * Right section width getter.
97
+ */
98
+ get rightw(): number;
99
+ /**
100
+ * Top section height getter.
101
+ */
102
+ get toph(): number;
103
+ /**
104
+ * Bottom section height getter.
105
+ */
106
+ get bottomh(): number;
107
+ /**
108
+ * Does this Rect contain given (x, y)-point?
109
+ *
110
+ * @param x - X-coordinate.
111
+ * @param y - Y-coordinate.
112
+ * @returns - True/false.
113
+ */
114
+ contains(x: number, y: number): boolean;
115
+ /**
116
+ * Do a and b rects overlap?
117
+ *
118
+ * @param a - DivRect a.
119
+ * @param b - DivRect b.
120
+ * @returns - True/false.
121
+ */
122
+ static overlap(a: DivRect, b: DivRect): boolean;
123
+ /**
124
+ * Do horizontal measures of a and b rects overlap?
125
+ *
126
+ * @param a - DivRect a.
127
+ * @param b - DivRect b.
128
+ * @returns - True/false.
129
+ */
130
+ static overlapX(a: DivRect, b: DivRect): boolean;
131
+ /**
132
+ * Check if given rects are equal.
133
+ * @param a - DivRect a.
134
+ * @param b - DivRect b.
135
+ * @returns - True/false.
136
+ */
137
+ static equals(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
138
+ /**
139
+ * Check if this rect equals with another rect.
140
+ * @param other - The other rect.
141
+ * @returns - True/false.
142
+ */
143
+ equals(other: DivRect): boolean;
144
+ /**
145
+ * Check if edges of given rects are equal, ignoring anchorX and anchorY.
146
+ *
147
+ * @param a - DivRect a.
148
+ * @param b - DivRect b.
149
+ * @returns - True/false.
150
+ */
151
+ static equalsEdges(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
152
+ /**
153
+ * Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
154
+ *
155
+ * @param other - The other DivRect.
156
+ * @returns - True/false.
157
+ */
158
+ equalsEdges(other: DivRect): boolean;
159
+ /** @deprecated - Use `DivRect.equalsEdges()` instead. */
160
+ static equalsFrame(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
161
+ /**
162
+ * Created duplicate of this Rect.
163
+ *
164
+ * @returns - Duplicate.
165
+ */
166
+ copy(): DivRect;
167
+ /**
168
+ * Move this rect by (dx, dy). Modifies this Rect.
169
+ *
170
+ * @param dx - Offset amount in x-direction.
171
+ * @param dy - Offset amount in y-direction.
172
+ * @returns - This DivRect instance.
173
+ */
174
+ offsetInPlace(dx: number, dy: number): DivRect;
175
+ /**
176
+ * Move this rect by (dx, dy). Immutable, returns modified copy.
177
+ *
178
+ * @param dx - Offset amount in x-direction.
179
+ * @param dy - Offset amount in y-direction.
180
+ * @returns - DivRect copy with applied offset.
181
+ */
182
+ offsetCopy(dx: number, dy: number): DivRect;
183
+ /**
184
+ * Expand this Rect by given Rect. Modifies this Rect.
185
+ *
186
+ * @param rect - DivRect to expand this instance with.
187
+ * @returns - This DivRect instance.
188
+ */
189
+ expandInPlace(rect: DivRect): DivRect;
190
+ /**
191
+ * Expand this Rect by given Rect. Immutable, returns modified copy.
192
+ *
193
+ * @param rect - DivRect to expand this instance with.
194
+ * @returns - Expanded copy of this DivRect.
195
+ */
196
+ expandCopy(rect: DivRect): DivRect;
197
+ /**
198
+ * Clip this Rect by given Rect. Mmodifies this Rect.
199
+ *
200
+ * @param clipRect - DivRect to clip this instance with.
201
+ * @returns - This DivRect instance.
202
+ */
203
+ clipInPlace(clipRect: DivRect): DivRect;
204
+ /**
205
+ * Clip this Rect by given Rect. Immutable, return modified copy.
206
+ *
207
+ * @param clipRect - DivRecto to clip this instance with.
208
+ * @returns - Clipped DivRect copy.
209
+ */
210
+ clipCopy(clipRect: DivRect): DivRect;
211
+ /**
212
+ * Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
213
+ *
214
+ * @param scaleX - Scale x-amount.
215
+ * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
216
+ * @returns This DivRect instance.
217
+ */
218
+ scaleInPlace(scaleX: number, scaleY?: number): DivRect;
219
+ /**
220
+ * Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
221
+ *
222
+ * @param scaleX - Scale x-amount.
223
+ * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
224
+ * @returns Scaled copy of this DivRect.
225
+ */
226
+ scaleCopy(scaleX: number, scaleY?: number): DivRect;
227
+ /**
228
+ * Get this DivRect instance.
229
+ * @returns - This DivRect instance.
230
+ */
231
+ getRect(): DivRect;
232
+ }
233
+
8
234
  /** Tuplet builder type. */
9
235
  type TupletBuilder = {
10
236
  /**
@@ -88,6 +314,7 @@ declare class DocumentBuilder {
88
314
  * @param config - Score configuration (e.g. { type: "staff", clef: "G", isOctavewDown: true }).
89
315
  */
90
316
  setScoreConfiguration(config: ScoreConfiguration): DocumentBuilder;
317
+ private static DefaultMeasureOptions;
91
318
  private getMeasure;
92
319
  /**
93
320
  * Get music document after finished building.
@@ -110,9 +337,10 @@ declare class DocumentBuilder {
110
337
  setMeasuresPerRow(measuresPerRow: number): DocumentBuilder;
111
338
  /**
112
339
  * Add new measure.
340
+ * @param measureOptions - Measure options.
113
341
  * @returns - This document builder instance.
114
342
  */
115
- addMeasure(): DocumentBuilder;
343
+ addMeasure(measureOptions?: MeasureOptions): DocumentBuilder;
116
344
  /**
117
345
  * Set key signature for current measure and forward.
118
346
  * @param tonic - Tonic note (e.g. "C").
@@ -421,4 +649,4 @@ declare class DocumentBuilder {
421
649
  addScaleArpeggio(scale: Scale, bottomNote: string, numOctaves: number): DocumentBuilder;
422
650
  }
423
651
 
424
- export { Annotation, AnnotationText, Connective, DocumentBuilder, type ExtensionBuilder, Fermata, Label, LyricsOptions, MDocument, Navigation, NoteAnchor, NoteOptions, RestOptions, ScoreConfiguration, StaffPreset, StaffTabOrGroups, TieType, type TupletBuilder, TupletOptions, VerseNumber, VerticalPosition, VoiceId };
652
+ export { Annotation, AnnotationText, Connective, DivRect, DocumentBuilder, type ExtensionBuilder, Fermata, Label, LyricsOptions, MDocument, MeasureOptions, Navigation, NoteAnchor, NoteOptions, RestOptions, ScoreConfiguration, StaffPreset, StaffTabOrGroups, TieType, type TupletBuilder, TupletOptions, VerseNumber, VerticalPosition, VoiceId };