@tspro/web-music-score 3.2.0 → 4.0.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +38 -10
  2. package/README.md +189 -331
  3. package/dist/audio/index.d.mts +40 -1
  4. package/dist/audio/index.d.ts +40 -1
  5. package/dist/audio/index.js +1 -1
  6. package/dist/audio/index.mjs +2 -2
  7. package/dist/audio-cg/index.d.mts +3 -0
  8. package/dist/audio-cg/index.d.ts +3 -0
  9. package/dist/audio-cg/index.js +1 -1
  10. package/dist/audio-cg/index.mjs +2 -2
  11. package/dist/{chunk-LCTM7BID.mjs → chunk-YFPLOHP2.mjs} +2 -2
  12. package/dist/core/index.d.mts +12 -0
  13. package/dist/core/index.d.ts +12 -0
  14. package/dist/core/index.js +3 -2
  15. package/dist/core/index.mjs +4 -3
  16. package/dist/guitar-CaZJDA05.d.ts +35 -0
  17. package/dist/guitar-DdexKdN6.d.mts +35 -0
  18. package/dist/iife/index.global.js +11 -11
  19. package/dist/{interface-Bn5HFt_U.d.mts → music-objects-DJQ4d2OA.d.mts} +640 -136
  20. package/dist/{interface-BlNl69uT.d.ts → music-objects-Dc3kR-XF.d.ts} +640 -136
  21. package/dist/note-eA2xPPiG.d.mts +294 -0
  22. package/dist/note-eA2xPPiG.d.ts +294 -0
  23. package/dist/pieces/index.d.mts +22 -3
  24. package/dist/pieces/index.d.ts +22 -3
  25. package/dist/pieces/index.js +7 -7
  26. package/dist/pieces/index.mjs +11 -11
  27. package/dist/react-ui/index.d.mts +166 -17
  28. package/dist/react-ui/index.d.ts +166 -17
  29. package/dist/react-ui/index.js +78 -1
  30. package/dist/react-ui/index.mjs +79 -2
  31. package/dist/scale-B2Icbetz.d.ts +230 -0
  32. package/dist/scale-BbDJTbrG.d.mts +230 -0
  33. package/dist/score/index.d.mts +359 -39
  34. package/dist/score/index.d.ts +359 -39
  35. package/dist/score/index.js +1252 -594
  36. package/dist/score/index.mjs +1255 -599
  37. package/dist/tempo-CtUhvJbr.d.mts +369 -0
  38. package/dist/tempo-Dt8aHpol.d.ts +369 -0
  39. package/dist/theory/index.d.mts +29 -13
  40. package/dist/theory/index.d.ts +29 -13
  41. package/dist/theory/index.js +583 -96
  42. package/dist/theory/index.mjs +580 -94
  43. package/package.json +2 -2
  44. package/dist/guitar-C2Cp71NZ.d.ts +0 -17
  45. package/dist/guitar-DggbM2UL.d.mts +0 -17
  46. package/dist/note-BFa43I86.d.mts +0 -85
  47. package/dist/note-BFa43I86.d.ts +0 -85
  48. package/dist/scale-DRR-t4Kr.d.mts +0 -74
  49. package/dist/scale-ebJm37q1.d.ts +0 -74
  50. package/dist/tempo-B4h5Ktob.d.mts +0 -104
  51. package/dist/tempo-DgqDEsn0.d.ts +0 -104
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { c as Scale, S as ScaleType } from '../scale-ebJm37q1.js';
4
- import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-BFa43I86.js';
5
- import { H as Handedness } from '../guitar-C2Cp71NZ.js';
6
- import { D as DivRect, M as MDocument, i as ScoreEventListener, W as MRenderer, X as MPlaybackButtons } from '../interface-BlNl69uT.js';
7
- import '../tempo-DgqDEsn0.js';
3
+ import { c as Scale, S as ScaleType } from '../scale-B2Icbetz.js';
4
+ import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-eA2xPPiG.js';
5
+ import { H as Handedness } from '../guitar-CaZJDA05.js';
6
+ import { D as DivRect, M as MDocument, l as ScoreEventListener, n as MRenderer, o as MPlaybackButtons } from '../music-objects-Dc3kR-XF.js';
7
+ import '../tempo-Dt8aHpol.js';
8
8
  import '@tspro/ts-utils-lib';
9
9
 
10
10
  interface CircleOfFifthsProps {
@@ -12,61 +12,167 @@ interface CircleOfFifthsProps {
12
12
  scale: Scale;
13
13
  onScaleChange: (scale: Scale) => void;
14
14
  }
15
+ /**
16
+ * Circle of fifths react component.
17
+ * <pre>
18
+ * // Using with React TSX/JSX
19
+ * import * as ScoreUI from "@tspro/web-music-score/react-ui";
20
+ * import * as Theory from "@tspro/web-music-score/theory";
21
+ *
22
+ * // Render function of react component.
23
+ * render() {
24
+ * const curScale = Theory.getScale("C Major");
25
+ *
26
+ * const onChangeScale = (newScale: Theory.Scale) => {
27
+ * console.log("New scale is " + newScale.getScaleName());
28
+ * }
29
+ *
30
+ * return &lt;&gt;
31
+ * &lt;ScoreUI.CircleOfFifths
32
+ * style={{ position: "relative", padding: "0.5em" }}
33
+ * scale={curScale}
34
+ * onScaleChange={onChangeScale} /&gt;
35
+ * &lt;/&gt;;
36
+ * }
37
+ * </pre>
38
+ */
15
39
  declare class CircleOfFifths extends React.Component<CircleOfFifthsProps, {}> {
16
40
  constructor(props: CircleOfFifthsProps);
17
41
  onScaleChange(tonic: string, scaleType: ScaleType): void;
18
42
  render(): react_jsx_runtime.JSX.Element;
19
43
  }
20
44
 
45
+ /** Fret position props. */
21
46
  declare class FretPosition {
22
47
  readonly guitarCtx: GuitarContext;
23
48
  readonly stringId: number;
24
49
  readonly fretId: number;
25
50
  readonly chromaticId: number;
51
+ /** Note of this fret position. */
26
52
  readonly note: Note;
53
+ /** Is note of this fret position a scale note? */
27
54
  readonly isScaleNote: boolean;
55
+ /** Is note of this fret position a scale root note? */
28
56
  readonly isScaleRootNote: boolean;
57
+ /** Is note circle/text of this fret position visible? */
29
58
  isVisible: boolean;
59
+ /** Text (e.g. note name) of this fret position. */
30
60
  text: string;
61
+ /** Text color. */
31
62
  textColor: string;
63
+ /** Fill color of note circle. */
32
64
  fillColor: string | undefined;
65
+ /** Border color of note circle. */
33
66
  borderColor: string | undefined;
67
+ /** Is barre? (Reserved for future) */
34
68
  isBarre: boolean;
69
+ /**
70
+ * Create new fret position object instance.
71
+ * @param guitarCtx - Guitar context.
72
+ * @param stringId - String index in range [0, 5].
73
+ * @param fretId - Fret index, 0 = open string fret position.
74
+ * @param chromaticId - Chromatic id.
75
+ */
35
76
  constructor(guitarCtx: GuitarContext, stringId: number, fretId: number, chromaticId: number);
77
+ /** Chromatic class getter. */
36
78
  get chromaticClass(): number;
79
+ /** Show note circle/text of this fret position. */
37
80
  show(): void;
81
+ /** Hide note circle/text of this fret position. */
38
82
  hide(): void;
83
+ /** Set default note name. */
39
84
  setDefaultText(): void;
85
+ /** Set default fill color of note circle. */
40
86
  setDefaultFillColor(): void;
87
+ /** Set default border color of note circle. */
41
88
  setDefaultBorderColor(showBorder?: boolean): void;
42
89
  }
90
+ /** Guitar context class. */
43
91
  declare class GuitarContext {
44
92
  readonly tuningName: string;
45
93
  readonly scale: Scale;
46
94
  readonly handedness: Handedness;
47
95
  readonly pitchNotation: PitchNotation;
48
96
  readonly guitarNoteLabel: GuitarNoteLabel;
97
+ /** Maximum fret index value. */
49
98
  readonly maxFretId: number;
50
99
  private readonly fretPositionTable;
51
100
  private readonly tuningStrings;
101
+ /**
102
+ * Create new guitar context object instance.
103
+ * @param tuningName - Tuning name (e.g. "Standard").
104
+ * @param scale - Scale.
105
+ * @param handedness - Handedness.
106
+ * @param pitchNotation - Pitch notation.
107
+ * @param guitarNoteLabel - Guitar note label type.
108
+ */
52
109
  constructor(tuningName: string, scale: Scale, handedness: Handedness, pitchNotation: PitchNotation, guitarNoteLabel: GuitarNoteLabel);
110
+ /**
111
+ * Get fret position object.
112
+ * @param stringId - String index in range [0,5].
113
+ * @param fretId - Fret index, 0 = open string fret position.
114
+ * @returns - Fret position object.
115
+ */
53
116
  getFretPosition(stringId: number, fretId: number): Readonly<FretPosition>;
117
+ /**
118
+ * Get tuning value (Note) of given string.
119
+ * @param stringId - STring index in range [0, 5].
120
+ * @returns - Note of given string played unfretted.
121
+ */
54
122
  getStringTuning(stringId: number): Note;
123
+ /**
124
+ * Get tuning overview (e.g. "E2 - A2 - D3 - G3 - B3 - E4").
125
+ * @returns - Tuning overview string.
126
+ */
55
127
  getTuningOverview(): string;
128
+ /**
129
+ * Create copy of this guitar context with new tuning name.
130
+ * @param tuningName - New tuning name.
131
+ * @returns - Guitar context.
132
+ */
56
133
  alterTuningName(tuningName: string): GuitarContext;
134
+ /**
135
+ * Create copy of this guitar context with new scale.
136
+ * @param scale - New scale.
137
+ * @returns - Guitar context.
138
+ */
57
139
  alterScale(scale: Scale): GuitarContext;
140
+ /**
141
+ * Create copy of this guitar context with handedness.
142
+ * @param handedness - New handedness.
143
+ * @returns - Guitar context.
144
+ */
58
145
  alterHandedness(handedness: Handedness): GuitarContext;
146
+ /**
147
+ * Create copy of this guitar context with new pitch notation.
148
+ * @param pitchNotation - New pitch notation.
149
+ * @returns - Guitar context.
150
+ */
59
151
  alterPitchNotation(pitchNotation: PitchNotation): GuitarContext;
152
+ /**
153
+ * Create copy of this guitar context with new guitar note label type.
154
+ * @param guitarNoteLabel - New guitar note label type.
155
+ * @returns - Guitar context.
156
+ */
60
157
  alterGuitarNoteLabel(guitarNoteLabel: GuitarNoteLabel): GuitarContext;
61
158
  }
62
159
 
160
+ /** Data for fret position. */
63
161
  declare class FretPositionData {
64
162
  readonly fretPosition: Readonly<FretPosition>;
65
163
  readonly cellRect: DivRect;
66
164
  readonly noteRect: DivRect;
165
+ /**
166
+ * Create new fret position data instance.
167
+ * @param fretPosition - Fret position.
168
+ * @param cellRect - Rect of fret position cell (space around string and between fret and next fret).
169
+ * @param noteRect - Rect to display note name in circle.
170
+ */
67
171
  constructor(fretPosition: Readonly<FretPosition>, cellRect: DivRect, noteRect: DivRect);
68
172
  }
173
+ /** Update fret position function type. */
69
174
  type UpdateFretPositionFunc = (fretPosition: FretPosition) => void;
175
+ /** Click fret position function type. */
70
176
  type ClickFretPositionFunc = (fretPosition: FretPosition) => void;
71
177
  interface GuitarViewProps {
72
178
  style?: React.CSSProperties;
@@ -79,6 +185,35 @@ interface GuitarViewState {
79
185
  height: number;
80
186
  table: FretPositionData[][];
81
187
  }
188
+ /**
189
+ * Guitar (neck) view react component.
190
+ * <pre>
191
+ * // Using with React TSX/JSX
192
+ * import * as ScoreUI from "@tspro/web-music-score/react-ui";
193
+ * import * as Theory from "@tspro/web-music-score/theory";
194
+ *
195
+ * // Render function of react component.
196
+ * render() {
197
+ * const guitarCtx = new ScoreUI.GuitarContext(
198
+ * "Standard", // Tuning name.
199
+ * Theory.getScale("C Major"), // Scale.
200
+ * Theory.DefaultHandedness, // Guitar handedness.
201
+ * Theory.DefaultPitchNotation, // Pitch notation.
202
+ * Theory.DefaultGuitarNoteLabel); // Guitar note label type.
203
+ *
204
+ * const onUpdateFretPosition: ScoreUI.UpdateFretPositionFunc = (fretPos) => { }
205
+ * const onClickFretPosition: ScoreUI.ClickFretPositionFunc = (fretPos) => { }
206
+ *
207
+ * return &lt;&gt;
208
+ * &lt;ScoreUI.GuitarView
209
+ * style={{ position: "relative", width: 640 }}
210
+ * guitarContext={guitarCtx}
211
+ * onUpdateFretPosition={onUpdateFretPosition}
212
+ * onClickFretPosition={onClickFretPosition} /&gt;
213
+ * &lt;/&gt;;
214
+ * }
215
+ * </pre>
216
+ */
82
217
  declare class GuitarView extends React.Component<GuitarViewProps, GuitarViewState> {
83
218
  state: GuitarViewState;
84
219
  constructor(props: GuitarViewProps);
@@ -98,11 +233,21 @@ interface MusicScoreViewProps {
98
233
  onScoreEvent?: ScoreEventListener;
99
234
  }
100
235
  /**
101
- * Usage:
236
+ * Music score view react component.
237
+ * <pre>
238
+ * // Using with React TSX/JSX
239
+ * import * as Score from "@tspro/web-music-score/react";
240
+ * import * as Pieces from "@tspro/web-music-score/pieces";
102
241
  *
103
- * import * as Score from "\@tspro/web-music-score";
242
+ * // Render function of react component.
243
+ * render() {
244
+ * const doc = Pieces.createFrereJacques();
104
245
  *
105
- * \<Score.MusicScoreView doc=\{doc\} /\>
246
+ * return &lt;&gt;
247
+ * &lt;Score.MusicScoreView doc=\{doc\} /&gt;
248
+ * &lt;/&gt;;
249
+ * }
250
+ * </pre>
106
251
  */
107
252
  declare class MusicScoreView extends React.Component<MusicScoreViewProps, {}> {
108
253
  renderer: MRenderer;
@@ -128,19 +273,23 @@ interface PlaybackButtonsState {
128
273
  }
129
274
  /**
130
275
  * Usage:
276
+ * <pre>
277
+ * // Using with React TSX/JSX
278
+ * import * as Score from "\@tspro/web-music-score/score";
279
+ * import * as Pieces from "@tspro/web-music-score/pieces";
131
280
  *
132
- * import * as Score from "\@tspro/web-music-score";
133
- *
134
- * \<Score.PlaybackButtons doc=\{doc\} /\>
135
- *
136
- * To set custom play, pause and stop labels:
137
- *
138
- * \<Score.PlaybackButtons doc=\{doc\} playLabel="⏵" pauseLabel="⏸" stopLabel="⏹" /\>
281
+ * // Create sample musicdocument.
282
+ * const doc = Pieces.createFrereJacques();
139
283
  *
140
- * To use different button layout.
284
+ * // Create default playback buttons
285
+ * &lt;Score.PlaybackButtons doc={doc} /&gt;
141
286
  *
142
- * \<Score.PlaybackButtons doc=\{doc\} buttonLayout=\{Score.PlaybackButtonsLayout.PlayStopSingle\} /\>
287
+ * // Create playback buttons with custom play, pause and stop labels:
288
+ * &lt;Score.PlaybackButtons doc={doc} playLabel="⏵" pauseLabel="⏸" stopLabel="⏹" /&gt;
143
289
  *
290
+ * // Create playback buttons with different button layout.
291
+ * &lt;Score.PlaybackButtons doc={doc} buttonLayout={Score.PlaybackButtonsLayout.PlayStopSingle} /&gt;
292
+ * </pre>
144
293
  */
145
294
  declare class PlaybackButtons extends React.Component<PlaybackButtonsProps, PlaybackButtonsState> {
146
295
  state: PlaybackButtonsState;
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v3.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.0.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;
@@ -200,34 +200,54 @@ var DefaultColors = {
200
200
  TextColor: "white"
201
201
  };
202
202
  var FretPosition = class {
203
+ /**
204
+ * Create new fret position object instance.
205
+ * @param guitarCtx - Guitar context.
206
+ * @param stringId - String index in range [0, 5].
207
+ * @param fretId - Fret index, 0 = open string fret position.
208
+ * @param chromaticId - Chromatic id.
209
+ */
203
210
  constructor(guitarCtx, stringId, fretId, chromaticId) {
204
211
  this.guitarCtx = guitarCtx;
205
212
  this.stringId = stringId;
206
213
  this.fretId = fretId;
207
214
  this.chromaticId = chromaticId;
215
+ /** Note of this fret position. */
208
216
  __publicField(this, "note");
217
+ /** Is note of this fret position a scale note? */
209
218
  __publicField(this, "isScaleNote");
219
+ /** Is note of this fret position a scale root note? */
210
220
  __publicField(this, "isScaleRootNote");
221
+ /** Is note circle/text of this fret position visible? */
211
222
  __publicField(this, "isVisible", false);
223
+ /** Text (e.g. note name) of this fret position. */
212
224
  __publicField(this, "text", "");
225
+ /** Text color. */
213
226
  __publicField(this, "textColor", DefaultColors.TextColor);
227
+ /** Fill color of note circle. */
214
228
  __publicField(this, "fillColor");
229
+ /** Border color of note circle. */
215
230
  __publicField(this, "borderColor");
231
+ /** Is barre? (Reserved for future) */
216
232
  __publicField(this, "isBarre", false);
217
233
  let { scale } = guitarCtx;
218
234
  this.note = scale.getPreferredChromaticNote(chromaticId);
219
235
  this.isScaleNote = scale.isScaleNote(this.note);
220
236
  this.isScaleRootNote = scale.isScaleRootNote(this.note);
221
237
  }
238
+ /** Chromatic class getter. */
222
239
  get chromaticClass() {
223
240
  return import_theory3.Note.getChromaticClass(this.chromaticId);
224
241
  }
242
+ /** Show note circle/text of this fret position. */
225
243
  show() {
226
244
  this.isVisible = true;
227
245
  }
246
+ /** Hide note circle/text of this fret position. */
228
247
  hide() {
229
248
  this.isVisible = false;
230
249
  }
250
+ /** Set default note name. */
231
251
  setDefaultText() {
232
252
  let { pitchNotation, scale, guitarNoteLabel } = this.guitarCtx;
233
253
  switch (guitarNoteLabel) {
@@ -242,20 +262,31 @@ var FretPosition = class {
242
262
  break;
243
263
  }
244
264
  }
265
+ /** Set default fill color of note circle. */
245
266
  setDefaultFillColor() {
246
267
  this.fillColor = this.isScaleRootNote ? DefaultColors.ScaleRootNoteColor : this.isScaleNote ? DefaultColors.ScaleNoteColor : DefaultColors.NonScaleNoteColor;
247
268
  }
269
+ /** Set default border color of note circle. */
248
270
  setDefaultBorderColor(showBorder = false) {
249
271
  this.borderColor = showBorder ? DefaultColors.DefaultBorderColor : void 0;
250
272
  }
251
273
  };
252
274
  var GuitarContext = class _GuitarContext {
275
+ /**
276
+ * Create new guitar context object instance.
277
+ * @param tuningName - Tuning name (e.g. "Standard").
278
+ * @param scale - Scale.
279
+ * @param handedness - Handedness.
280
+ * @param pitchNotation - Pitch notation.
281
+ * @param guitarNoteLabel - Guitar note label type.
282
+ */
253
283
  constructor(tuningName, scale, handedness, pitchNotation, guitarNoteLabel) {
254
284
  this.tuningName = tuningName;
255
285
  this.scale = scale;
256
286
  this.handedness = handedness;
257
287
  this.pitchNotation = pitchNotation;
258
288
  this.guitarNoteLabel = guitarNoteLabel;
289
+ /** Maximum fret index value. */
259
290
  __publicField(this, "maxFretId");
260
291
  __publicField(this, "fretPositionTable");
261
292
  __publicField(this, "tuningStrings");
@@ -270,6 +301,12 @@ var GuitarContext = class _GuitarContext {
270
301
  }
271
302
  }
272
303
  }
304
+ /**
305
+ * Get fret position object.
306
+ * @param stringId - String index in range [0,5].
307
+ * @param fretId - Fret index, 0 = open string fret position.
308
+ * @returns - Fret position object.
309
+ */
273
310
  getFretPosition(stringId, fretId) {
274
311
  if (!import_ts_utils_lib2.Utils.Is.isInteger(stringId) || stringId < 0 || stringId > 5) {
275
312
  throw new import_core.MusicError(import_core.MusicErrorType.InvalidArg, `Invalid stringId: + ${stringId}`);
@@ -279,24 +316,58 @@ var GuitarContext = class _GuitarContext {
279
316
  return this.fretPositionTable[stringId][fretId];
280
317
  }
281
318
  }
319
+ /**
320
+ * Get tuning value (Note) of given string.
321
+ * @param stringId - STring index in range [0, 5].
322
+ * @returns - Note of given string played unfretted.
323
+ */
282
324
  getStringTuning(stringId) {
283
325
  return this.tuningStrings[stringId];
284
326
  }
327
+ /**
328
+ * Get tuning overview (e.g. "E2 - A2 - D3 - G3 - B3 - E4").
329
+ * @returns - Tuning overview string.
330
+ */
285
331
  getTuningOverview() {
286
332
  return this.tuningStrings.slice().reverse().map((note) => note.format(this.pitchNotation, import_theory2.SymbolSet.Unicode)).join(" - ");
287
333
  }
334
+ /**
335
+ * Create copy of this guitar context with new tuning name.
336
+ * @param tuningName - New tuning name.
337
+ * @returns - Guitar context.
338
+ */
288
339
  alterTuningName(tuningName) {
289
340
  return tuningName === this.tuningName ? this : new _GuitarContext(tuningName, this.scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
290
341
  }
342
+ /**
343
+ * Create copy of this guitar context with new scale.
344
+ * @param scale - New scale.
345
+ * @returns - Guitar context.
346
+ */
291
347
  alterScale(scale) {
292
348
  return import_theory3.Scale.equals(scale, this.scale) ? this : new _GuitarContext(this.tuningName, scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
293
349
  }
350
+ /**
351
+ * Create copy of this guitar context with handedness.
352
+ * @param handedness - New handedness.
353
+ * @returns - Guitar context.
354
+ */
294
355
  alterHandedness(handedness) {
295
356
  return handedness === this.handedness ? this : new _GuitarContext(this.tuningName, this.scale, handedness, this.pitchNotation, this.guitarNoteLabel);
296
357
  }
358
+ /**
359
+ * Create copy of this guitar context with new pitch notation.
360
+ * @param pitchNotation - New pitch notation.
361
+ * @returns - Guitar context.
362
+ */
297
363
  alterPitchNotation(pitchNotation) {
298
364
  return pitchNotation === this.pitchNotation ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, pitchNotation, this.guitarNoteLabel);
299
365
  }
366
+ /**
367
+ * Create copy of this guitar context with new guitar note label type.
368
+ * @param guitarNoteLabel - New guitar note label type.
369
+ * @returns - Guitar context.
370
+ */
300
371
  alterGuitarNoteLabel(guitarNoteLabel) {
301
372
  return guitarNoteLabel === this.guitarNoteLabel ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, this.pitchNotation, guitarNoteLabel);
302
373
  }
@@ -370,6 +441,12 @@ var Fret = class _Fret {
370
441
  }
371
442
  };
372
443
  var FretPositionData = class {
444
+ /**
445
+ * Create new fret position data instance.
446
+ * @param fretPosition - Fret position.
447
+ * @param cellRect - Rect of fret position cell (space around string and between fret and next fret).
448
+ * @param noteRect - Rect to display note name in circle.
449
+ */
373
450
  constructor(fretPosition, cellRect, noteRect) {
374
451
  this.fretPosition = fretPosition;
375
452
  this.cellRect = cellRect;
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v3.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-LCTM7BID.mjs";
4
+ } from "../chunk-YFPLOHP2.mjs";
5
5
 
6
6
  // src/react-ui/circle-of-fifths.tsx
7
7
  import * as React from "react";
@@ -159,34 +159,54 @@ var DefaultColors = {
159
159
  TextColor: "white"
160
160
  };
161
161
  var FretPosition = class {
162
+ /**
163
+ * Create new fret position object instance.
164
+ * @param guitarCtx - Guitar context.
165
+ * @param stringId - String index in range [0, 5].
166
+ * @param fretId - Fret index, 0 = open string fret position.
167
+ * @param chromaticId - Chromatic id.
168
+ */
162
169
  constructor(guitarCtx, stringId, fretId, chromaticId) {
163
170
  this.guitarCtx = guitarCtx;
164
171
  this.stringId = stringId;
165
172
  this.fretId = fretId;
166
173
  this.chromaticId = chromaticId;
174
+ /** Note of this fret position. */
167
175
  __publicField(this, "note");
176
+ /** Is note of this fret position a scale note? */
168
177
  __publicField(this, "isScaleNote");
178
+ /** Is note of this fret position a scale root note? */
169
179
  __publicField(this, "isScaleRootNote");
180
+ /** Is note circle/text of this fret position visible? */
170
181
  __publicField(this, "isVisible", false);
182
+ /** Text (e.g. note name) of this fret position. */
171
183
  __publicField(this, "text", "");
184
+ /** Text color. */
172
185
  __publicField(this, "textColor", DefaultColors.TextColor);
186
+ /** Fill color of note circle. */
173
187
  __publicField(this, "fillColor");
188
+ /** Border color of note circle. */
174
189
  __publicField(this, "borderColor");
190
+ /** Is barre? (Reserved for future) */
175
191
  __publicField(this, "isBarre", false);
176
192
  let { scale } = guitarCtx;
177
193
  this.note = scale.getPreferredChromaticNote(chromaticId);
178
194
  this.isScaleNote = scale.isScaleNote(this.note);
179
195
  this.isScaleRootNote = scale.isScaleRootNote(this.note);
180
196
  }
197
+ /** Chromatic class getter. */
181
198
  get chromaticClass() {
182
199
  return Note2.getChromaticClass(this.chromaticId);
183
200
  }
201
+ /** Show note circle/text of this fret position. */
184
202
  show() {
185
203
  this.isVisible = true;
186
204
  }
205
+ /** Hide note circle/text of this fret position. */
187
206
  hide() {
188
207
  this.isVisible = false;
189
208
  }
209
+ /** Set default note name. */
190
210
  setDefaultText() {
191
211
  let { pitchNotation, scale, guitarNoteLabel } = this.guitarCtx;
192
212
  switch (guitarNoteLabel) {
@@ -201,20 +221,31 @@ var FretPosition = class {
201
221
  break;
202
222
  }
203
223
  }
224
+ /** Set default fill color of note circle. */
204
225
  setDefaultFillColor() {
205
226
  this.fillColor = this.isScaleRootNote ? DefaultColors.ScaleRootNoteColor : this.isScaleNote ? DefaultColors.ScaleNoteColor : DefaultColors.NonScaleNoteColor;
206
227
  }
228
+ /** Set default border color of note circle. */
207
229
  setDefaultBorderColor(showBorder = false) {
208
230
  this.borderColor = showBorder ? DefaultColors.DefaultBorderColor : void 0;
209
231
  }
210
232
  };
211
233
  var GuitarContext = class _GuitarContext {
234
+ /**
235
+ * Create new guitar context object instance.
236
+ * @param tuningName - Tuning name (e.g. "Standard").
237
+ * @param scale - Scale.
238
+ * @param handedness - Handedness.
239
+ * @param pitchNotation - Pitch notation.
240
+ * @param guitarNoteLabel - Guitar note label type.
241
+ */
212
242
  constructor(tuningName, scale, handedness, pitchNotation, guitarNoteLabel) {
213
243
  this.tuningName = tuningName;
214
244
  this.scale = scale;
215
245
  this.handedness = handedness;
216
246
  this.pitchNotation = pitchNotation;
217
247
  this.guitarNoteLabel = guitarNoteLabel;
248
+ /** Maximum fret index value. */
218
249
  __publicField(this, "maxFretId");
219
250
  __publicField(this, "fretPositionTable");
220
251
  __publicField(this, "tuningStrings");
@@ -229,6 +260,12 @@ var GuitarContext = class _GuitarContext {
229
260
  }
230
261
  }
231
262
  }
263
+ /**
264
+ * Get fret position object.
265
+ * @param stringId - String index in range [0,5].
266
+ * @param fretId - Fret index, 0 = open string fret position.
267
+ * @returns - Fret position object.
268
+ */
232
269
  getFretPosition(stringId, fretId) {
233
270
  if (!Utils2.Is.isInteger(stringId) || stringId < 0 || stringId > 5) {
234
271
  throw new MusicError(MusicErrorType.InvalidArg, `Invalid stringId: + ${stringId}`);
@@ -238,24 +275,58 @@ var GuitarContext = class _GuitarContext {
238
275
  return this.fretPositionTable[stringId][fretId];
239
276
  }
240
277
  }
278
+ /**
279
+ * Get tuning value (Note) of given string.
280
+ * @param stringId - STring index in range [0, 5].
281
+ * @returns - Note of given string played unfretted.
282
+ */
241
283
  getStringTuning(stringId) {
242
284
  return this.tuningStrings[stringId];
243
285
  }
286
+ /**
287
+ * Get tuning overview (e.g. "E2 - A2 - D3 - G3 - B3 - E4").
288
+ * @returns - Tuning overview string.
289
+ */
244
290
  getTuningOverview() {
245
291
  return this.tuningStrings.slice().reverse().map((note) => note.format(this.pitchNotation, SymbolSet2.Unicode)).join(" - ");
246
292
  }
293
+ /**
294
+ * Create copy of this guitar context with new tuning name.
295
+ * @param tuningName - New tuning name.
296
+ * @returns - Guitar context.
297
+ */
247
298
  alterTuningName(tuningName) {
248
299
  return tuningName === this.tuningName ? this : new _GuitarContext(tuningName, this.scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
249
300
  }
301
+ /**
302
+ * Create copy of this guitar context with new scale.
303
+ * @param scale - New scale.
304
+ * @returns - Guitar context.
305
+ */
250
306
  alterScale(scale) {
251
307
  return Scale2.equals(scale, this.scale) ? this : new _GuitarContext(this.tuningName, scale, this.handedness, this.pitchNotation, this.guitarNoteLabel);
252
308
  }
309
+ /**
310
+ * Create copy of this guitar context with handedness.
311
+ * @param handedness - New handedness.
312
+ * @returns - Guitar context.
313
+ */
253
314
  alterHandedness(handedness) {
254
315
  return handedness === this.handedness ? this : new _GuitarContext(this.tuningName, this.scale, handedness, this.pitchNotation, this.guitarNoteLabel);
255
316
  }
317
+ /**
318
+ * Create copy of this guitar context with new pitch notation.
319
+ * @param pitchNotation - New pitch notation.
320
+ * @returns - Guitar context.
321
+ */
256
322
  alterPitchNotation(pitchNotation) {
257
323
  return pitchNotation === this.pitchNotation ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, pitchNotation, this.guitarNoteLabel);
258
324
  }
325
+ /**
326
+ * Create copy of this guitar context with new guitar note label type.
327
+ * @param guitarNoteLabel - New guitar note label type.
328
+ * @returns - Guitar context.
329
+ */
259
330
  alterGuitarNoteLabel(guitarNoteLabel) {
260
331
  return guitarNoteLabel === this.guitarNoteLabel ? this : new _GuitarContext(this.tuningName, this.scale, this.handedness, this.pitchNotation, guitarNoteLabel);
261
332
  }
@@ -329,6 +400,12 @@ var Fret = class _Fret {
329
400
  }
330
401
  };
331
402
  var FretPositionData = class {
403
+ /**
404
+ * Create new fret position data instance.
405
+ * @param fretPosition - Fret position.
406
+ * @param cellRect - Rect of fret position cell (space around string and between fret and next fret).
407
+ * @param noteRect - Rect to display note name in circle.
408
+ */
332
409
  constructor(fretPosition, cellRect, noteRect) {
333
410
  this.fretPosition = fretPosition;
334
411
  this.cellRect = cellRect;