@tspro/web-music-score 4.0.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 (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  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-D643HZHM.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-XoKiryoV.d.mts → music-objects-DJQ4d2OA.d.mts} +549 -53
  20. package/dist/{interface-7k8qGG44.d.ts → music-objects-Dc3kR-XF.d.ts} +549 -53
  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 +5 -2
  26. package/dist/pieces/index.mjs +6 -3
  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 +299 -46
  34. package/dist/score/index.d.ts +299 -46
  35. package/dist/score/index.js +553 -76
  36. package/dist/score/index.mjs +550 -75
  37. package/dist/{tempo-BAYoZ_Li.d.mts → tempo-CtUhvJbr.d.mts} +187 -5
  38. package/dist/{tempo-r2sb6Ku2.d.ts → tempo-Dt8aHpol.d.ts} +187 -5
  39. package/dist/theory/index.d.mts +29 -13
  40. package/dist/theory/index.d.ts +29 -13
  41. package/dist/theory/index.js +369 -25
  42. package/dist/theory/index.mjs +370 -26
  43. package/package.json +1 -1
  44. package/dist/guitar-DggbM2UL.d.mts +0 -17
  45. package/dist/guitar-cNmE-EvH.d.ts +0 -17
  46. package/dist/note-BFa43I86.d.mts +0 -85
  47. package/dist/note-CcVdUFqS.d.ts +0 -85
  48. package/dist/scale-C2pCNxdE.d.mts +0 -75
  49. package/dist/scale-CvPbJvfN.d.ts +0 -75
@@ -1,10 +1,13 @@
1
- /* WebMusicScore v4.0.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
- import "../chunk-D643HZHM.mjs";
1
+ /* WebMusicScore v4.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
+ import "../chunk-YFPLOHP2.mjs";
3
3
 
4
4
  // src/pieces/frere-jacques.ts
5
5
  import { DocumentBuilder } from "@tspro/web-music-score/score";
6
6
  function createFrereJacques() {
7
- return new DocumentBuilder().setScoreConfiguration("guitarTreble").setHeader("Frere Jacques").addMeasure().setKeySignature("G", "Major").setTimeSignature("4/4").addNote(0, "G3", "4n").addNote(0, "A3", "4n").addNote(0, "B3", "4n").addNote(0, "G3", "4n").addMeasure().addNote(0, "G3", "4n").addNote(0, "A3", "4n").addNote(0, "B3", "4n").addNote(0, "G3", "4n").addMeasure().addNote(0, "B3", "4n").addNote(0, "C4", "4n").addNote(0, "D4", "2n").endRow().addMeasure().addNote(0, "B3", "4n").addNote(0, "C4", "4n").addNote(0, "D4", "2n").addMeasure().addNote(0, "D4", "8n").addNote(0, "E4", "8n").addNote(0, "D4", "8n").addNote(0, "C4", "8n").addNote(0, "B3", "4n").addNote(0, "G3", "4n").endRow().addMeasure().addNote(0, "D4", "8n").addNote(0, "E4", "8n").addNote(0, "D4", "8n").addNote(0, "C4", "8n").addNote(0, "B3", "4n").addNote(0, "G3", "4n").addMeasure().addNote(0, "G3", "4n").addNote(0, "D3", "4n").addNote(0, "G3", "2n").addMeasure().addNote(0, "G3", "4n").addNote(0, "D3", "4n").addNote(0, "G3", "2n").getDocument();
7
+ return new DocumentBuilder().setHeader("Frere Jacques").setScoreConfiguration([
8
+ { type: "staff", clef: "G", voiceIds: [0] },
9
+ { type: "staff", clef: "F", voiceIds: [1] }
10
+ ]).setMeasuresPerRow(2).addMeasure().setKeySignature("D Major").setTimeSignature("4/4").addNote(0, "D4", "4n", { stem: "up" }).addNote(0, "E4", "4n").addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addRest(1, "1n", { staffPos: "F3" }).addMeasure().addNote(0, "D4", "4n").addNote(0, "E4", "4n").addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addRest(1, "1n", { staffPos: "F3" }).addMeasure().addNavigation("startRepeat").addNote(0, "F#4", "4n").addNote(0, "G4", "4n").addNote(0, "A4", "2n").addNote(1, "D3", "4n", { stem: "down" }).addNote(1, "E3", "4n").addNote(1, "F#3", "4n").addNote(1, "D3", "4n").addMeasure().addNote(0, "F#4", "4n").addNote(0, "G4", "4n").addNote(0, "A4", "2n").addNote(1, "D3", "4n").addNote(1, "E3", "4n").addNote(1, "F#3", "4n").addNote(1, "D3", "4n").addMeasure().addNote(0, "A4", "8n").addNote(0, "B4", "8n").addNote(0, "A4", "8n").addNote(0, "G4", "8n").addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addNote(1, "F#3", "4n").addNote(1, "G3", "4n").addNote(1, "A3", "2n").addMeasure().addNote(0, "A4", "8n").addNote(0, "B4", "8n").addNote(0, "A4", "8n").addNote(0, "G4", "8n").addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addNote(1, "F#3", "4n").addNote(1, "G3", "4n").addNote(1, "A3", "2n").addMeasure().addNote(0, "D4", "4n").addChord(0, ["C#4", "A4"], "4n").addNote(0, "D4", "4n").addRest(0, "4n").addNote(1, "A3", "8n").addNote(1, "B3", "8n").addNote(1, "A3", "8n").addNote(1, "G3", "8n").addNote(1, "F#3", "4n").addNote(1, "D3", "4n").addMeasure().addNote(0, "D4", "4n").addChord(0, ["C#4", "A4"], "4n").addNote(0, "D4", "4n").addRest(0, "4n").addNote(1, "A3", "8n").addNote(1, "B3", "8n").addNote(1, "A3", "8n").addNote(1, "G3", "8n").addNote(1, "F#3", "4n").addNote(1, "D3", "4n").addMeasure().setMeasuresPerRow(4).addNavigation("ending", 1).addNote(0, "D4", "4n").addNote(0, "E4", "4n").addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addNote(1, "D3", "4n").addChord(1, ["C#3", "A3"], "4n").addNote(1, "D3", "4n").addRest(1, "4n").addMeasure().addNavigation("endRepeat").addNote(0, "D4", "4n").addNote(0, "E4", "4n").addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addNote(1, "D3", "4n").addChord(1, ["C#3", "A3"], "4n").addNote(1, "D3", "4n").addRest(1, "4n").addMeasure().addNavigation("ending", 2).addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addNote(0, "F#4", "4n").addNote(0, "D4", "4n").addNote(1, "A3", "4n").addNote(1, "F#3", "4n").addNote(1, "A3", "4n").addNote(1, "F#3", "4n").addMeasure().addNote(0, "A3", "4n").addNote(0, "C#4", "8n").addNote(0, "C#4", "8n").addNote(0, "D4", "2n").addNote(1, "D3", "4n").addNote(1, "E3", "4n").addNote(1, "F#3", "2n").getDocument();
8
11
  }
9
12
 
10
13
  // src/pieces/greensleeves.ts
@@ -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-C2pCNxdE.mjs';
4
- import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-BFa43I86.mjs';
5
- import { H as Handedness } from '../guitar-DggbM2UL.mjs';
6
- import { D as DivRect, M as MDocument, k as ScoreEventListener, Y as MRenderer, Z as MPlaybackButtons } from '../interface-XoKiryoV.mjs';
7
- import '../tempo-BAYoZ_Li.mjs';
3
+ import { c as Scale, S as ScaleType } from '../scale-BbDJTbrG.mjs';
4
+ import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-eA2xPPiG.mjs';
5
+ import { H as Handedness } from '../guitar-DdexKdN6.mjs';
6
+ import { D as DivRect, M as MDocument, l as ScoreEventListener, n as MRenderer, o as MPlaybackButtons } from '../music-objects-DJQ4d2OA.mjs';
7
+ import '../tempo-CtUhvJbr.mjs';
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,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-CvPbJvfN.js';
4
- import { b as PitchNotation, G as GuitarNoteLabel, N as Note } from '../note-CcVdUFqS.js';
5
- import { H as Handedness } from '../guitar-cNmE-EvH.js';
6
- import { D as DivRect, M as MDocument, k as ScoreEventListener, Y as MRenderer, Z as MPlaybackButtons } from '../interface-7k8qGG44.js';
7
- import '../tempo-r2sb6Ku2.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;