@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,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-CwPOlqFi.js';
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-CwPOlqFi.js';
3
- import { N as Note } from '../note-CgCIBwvR.js';
4
- import { S as ScaleType, c as Scale } from '../scale-CBW4eTz7.js';
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-DMt3iwz9.js';
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-3Esbz7ij.js';
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-3Esbz7ij.js';
3
+ import { N as Note } from '../note-CJuq5aBy.js';
4
+ import { S as ScaleType, c as Scale } from '../scale-DulPFco_.js';
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-BnUjm25M.js';
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 };