@tspro/web-music-score 3.0.1 → 3.1.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 (43) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +63 -20
  3. package/dist/audio/index.d.mts +1 -8
  4. package/dist/audio/index.d.ts +1 -8
  5. package/dist/audio/index.js +1 -1
  6. package/dist/audio/index.mjs +2 -2
  7. package/dist/audio-cg/index.d.mts +0 -1
  8. package/dist/audio-cg/index.d.ts +0 -1
  9. package/dist/audio-cg/index.js +1 -1
  10. package/dist/audio-cg/index.mjs +2 -2
  11. package/dist/{chunk-4AS76G4O.mjs → chunk-PU4J7K4Z.mjs} +2 -2
  12. package/dist/core/index.d.mts +0 -3
  13. package/dist/core/index.d.ts +0 -3
  14. package/dist/core/index.js +2 -2
  15. package/dist/core/index.mjs +3 -3
  16. package/dist/{guitar-BIFwFT31.d.ts → guitar-C2Cp71NZ.d.ts} +1 -8
  17. package/dist/{guitar-zASF7B1g.d.mts → guitar-DggbM2UL.d.mts} +1 -8
  18. package/dist/iife/index.global.js +11 -11
  19. package/dist/{interface-DkUnsAjj.d.mts → interface-Bz_525zj.d.mts} +94 -104
  20. package/dist/{interface-1TQHxSpb.d.ts → interface-Fn8ufBQx.d.ts} +94 -104
  21. package/dist/{note-B5ZtlHc8.d.mts → note-BFa43I86.d.mts} +0 -14
  22. package/dist/{note-B5ZtlHc8.d.ts → note-BFa43I86.d.ts} +0 -14
  23. package/dist/pieces/index.d.mts +3 -6
  24. package/dist/pieces/index.d.ts +3 -6
  25. package/dist/pieces/index.js +1 -1
  26. package/dist/pieces/index.mjs +2 -2
  27. package/dist/react-ui/index.d.mts +5 -23
  28. package/dist/react-ui/index.d.ts +5 -23
  29. package/dist/react-ui/index.js +1 -1
  30. package/dist/react-ui/index.mjs +2 -2
  31. package/dist/{scale-B_2MZaT9.d.ts → scale-DRR-t4Kr.d.mts} +2 -15
  32. package/dist/{scale-C-YS5iVG.d.mts → scale-ebJm37q1.d.ts} +2 -15
  33. package/dist/score/index.d.mts +32 -8
  34. package/dist/score/index.d.ts +32 -8
  35. package/dist/score/index.js +919 -675
  36. package/dist/score/index.mjs +893 -650
  37. package/dist/{tempo-TjQKn46X.d.mts → tempo-B4h5Ktob.d.mts} +1 -17
  38. package/dist/{tempo-DoJd-UYT.d.ts → tempo-DgqDEsn0.d.ts} +1 -17
  39. package/dist/theory/index.d.mts +6 -8
  40. package/dist/theory/index.d.ts +6 -8
  41. package/dist/theory/index.js +1 -1
  42. package/dist/theory/index.mjs +2 -2
  43. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,7 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## [3.0.1] - 2025-09-03
3
+ ## [3.1.1] - 2025-09-10
4
+ ## Fixed
5
+ - Accept array of staff/tab/group for addFermataTo(), addNavigationTo(), addAnnotationTo() and addLabelTo().
6
+ - Better infinite recursion detection for staff groups.
4
7
 
8
+ ## [3.1.0] - 2025-09-09
9
+ ## Added
10
+ - Staff/TabConfig.name.
11
+ - DocumentBuilder.addStaffGroup().
12
+ - DocumentBuilder.addFermataTo(), .addNavigationTo(), .addAnnotationTo() and .addLabelTo().
13
+
14
+ ## [3.0.1] - 2025-09-03
5
15
  ## Fixed
6
16
  - Draw arpeggio curly arrow also to guitar tab.
7
17
 
package/README.md CHANGED
@@ -144,6 +144,7 @@ builder.setScoreConfiguration(config: (Score.StaffConfig | Score.TabConfig)[]);
144
144
  * `type`: "staff"
145
145
  * `clef`: Clef can be `Score.Clef.G` or `Score.Clef.F`.
146
146
  * `isOctaveDown`: boolean (optional)
147
+ * `name`: staff name.
147
148
  * `minNote`: string (optional), minimum note allowed in staff.
148
149
  * `maxNote`: string (optional), maximum note allowed in staff.
149
150
  * `voiceIds`: number[] (optional), array of voice ids are visible on this staff.
@@ -151,6 +152,7 @@ builder.setScoreConfiguration(config: (Score.StaffConfig | Score.TabConfig)[]);
151
152
 
152
153
  `TabConfig` contains following properties:
153
154
  * `type`: "tab"
155
+ * `name`: tab name.
154
156
  * `tuning`: string | string[] (optional), tuning name or array of 6 note names for tuning.
155
157
  * `voiceIds`: number[] (optional), array of voice ids are visible on this tab.
156
158
 
@@ -325,26 +327,6 @@ builder.addFermata(Score.Fermata.AtMeasureEnd);
325
327
  - `Score.Fermata.AtNote`: Adds fermata anchored to previously added note, chord or rest.
326
328
  - `Score.Fermata.AtMeasureEnd`: Adds fermata at the end of measure.
327
329
 
328
- ### Add Connective (tie, slur)
329
-
330
- ```js
331
- // Add tie
332
- builder.addConnective(connective: Score.Connetive.Tie, span?: Score.ConnectiveSpan, noteAnchor?: Score.NoteAnchor);
333
-
334
- // Add slur
335
- builder.addConnective(connective: Score.Connetive.Slur, span?: Score.ConnectiveSpan, noteAnchor?: Score.NoteAnchor);
336
-
337
- // Add slide
338
- builder.addConnective(connective: Score.Connetive.Slide, noteAnchor?: Score.NoteAnchor);
339
- ```
340
-
341
- - `span` describes how many notes the connective is across.
342
- It is integer >= 2 (for tie it can be also `Score.TieType.Stub|ToMeasureEnd`).
343
- Default value is 2.
344
- - `noteAnchor` describes the attach point of connective to note.
345
- It can be `Score.NoteAnchor.Auto|Above|Center|Below|StemTip`.
346
- Default value is `Score.NoteAnchor.Auto`.
347
-
348
330
  ### Add Navigation
349
331
 
350
332
  Add navigational element to measure.
@@ -405,6 +387,47 @@ builder.addAnnotation(Score.Annotation.Tempo, "accel.");
405
387
  * `Score.Annotation.Dynamics`: `text` could be for example `"fff"`, `"cresc."`, `"dim."`, etc.
406
388
  * `Score.Annotation.Tempo`: `text` could be for example `"accel."`, `"rit."`, `"a tempo"`, etc.
407
389
 
390
+ ### Add Elements To Certain Staff Or Tab
391
+
392
+ There are alternatives to these functions:
393
+ - `addFermata` => `addFermataTo`
394
+ - `addNavigation` => `addNavigationTo`
395
+ - `addAnnotation` => `addAnnotationTo`
396
+ - `addLabel` => `addLabelTo`.
397
+
398
+ First argument of these alterate functions is:
399
+
400
+ `staffTabOrGroups: Score.StaffTabOrGroups`.
401
+
402
+ `StaffTabOrGroups` can be:
403
+ - `number`: staff/tab index, 0=top staff/tab, etc.
404
+ - `string`: staff/tab name.
405
+ - `string`: staff group name.
406
+ - `(number | string)[]`: an array of staff/tab indices, names or group names.
407
+
408
+ ```js
409
+ // Example: add label to top staff/tab.
410
+ builder.addLabelTo(0, Score.Label.Chord, "Am");
411
+ ```
412
+
413
+ #### Staff Group
414
+ ```js
415
+ builder.addStaffGroup(groupName: string, staffsTabsAndGroups: number | string | (number | string)[], verticalPosition: Score.VerticalPosition);
416
+ ```
417
+
418
+ Arguments are:
419
+ - `groupName`: Name of new staff group.
420
+ - `staffsTabsAndGroups`: single value or an array of staves, tabs and groups (index or name).
421
+ - `verticalPosition` (optional): Can be `Score.VerticalPosition.Above`/`Below`/`Both`/`Auto` (default).
422
+
423
+ ```js
424
+ // Example: create staff group to add elements below top staff/tab.
425
+ // Add staff group
426
+ builder.addStaffGroup("grp1", [0], Score.VertocalPosition.Below);
427
+ // Use group
428
+ builder.addLabelTo("grp1", Score.Label.Note, "C");
429
+ ```
430
+
408
431
  ### Add Extension
409
432
 
410
433
  Adds extension line to element, for example to previously added annotation.
@@ -420,6 +443,26 @@ builder.addAnnotation(Score.Annotation.Tempo, "accel.").addExtension(Theory.Note
420
443
 
421
444
  `visible` sets visibility of extension line, visible by default (if omitted).
422
445
 
446
+ ### Add Connective (tie, slur, slide)
447
+
448
+ ```js
449
+ // Add tie
450
+ builder.addConnective(connective: Score.Connetive.Tie, span?: Score.ConnectiveSpan, noteAnchor?: Score.NoteAnchor);
451
+
452
+ // Add slur
453
+ builder.addConnective(connective: Score.Connetive.Slur, span?: Score.ConnectiveSpan, noteAnchor?: Score.NoteAnchor);
454
+
455
+ // Add slide
456
+ builder.addConnective(connective: Score.Connetive.Slide, noteAnchor?: Score.NoteAnchor);
457
+ ```
458
+
459
+ - `span` describes how many notes the connective is across.
460
+ It is integer >= 2 (for tie it can be also `Score.TieType.Stub|ToMeasureEnd`).
461
+ Default value is 2.
462
+ - `noteAnchor` describes the attach point of connective to note.
463
+ It can be `Score.NoteAnchor.Auto|Above|Center|Below|StemTip`.
464
+ Default value is `Score.NoteAnchor.Auto`.
465
+
423
466
  ### Guitar Tab
424
467
 
425
468
  This library has preliminary guitar tabs rendering.
@@ -1,22 +1,15 @@
1
- import { N as Note } from '../note-B5ZtlHc8.mjs';
1
+ import { N as Note } from '../note-BFa43I86.mjs';
2
2
 
3
- /** @public */
4
3
  interface Instrument {
5
4
  getName(): string;
6
5
  playNote(note: string, duration?: number, volume?: number): void;
7
6
  stop(): void;
8
7
  }
9
- /** @public */
10
8
  declare function getInstrumentList(): ReadonlyArray<string>;
11
- /** @public */
12
9
  declare function getCurrentInstrument(): string;
13
- /** @public */
14
10
  declare function registerInstrument(instr: Instrument): void;
15
- /** @public */
16
11
  declare function setInstrument(instrName: string): void;
17
- /** @public */
18
12
  declare function playNote(note: Note | string | number, duration?: number, linearVolume?: number): void;
19
- /** @public */
20
13
  declare function stop(): void;
21
14
 
22
15
  export { type Instrument, getCurrentInstrument, getInstrumentList, playNote, registerInstrument, setInstrument, stop };
@@ -1,22 +1,15 @@
1
- import { N as Note } from '../note-B5ZtlHc8.js';
1
+ import { N as Note } from '../note-BFa43I86.js';
2
2
 
3
- /** @public */
4
3
  interface Instrument {
5
4
  getName(): string;
6
5
  playNote(note: string, duration?: number, volume?: number): void;
7
6
  stop(): void;
8
7
  }
9
- /** @public */
10
8
  declare function getInstrumentList(): ReadonlyArray<string>;
11
- /** @public */
12
9
  declare function getCurrentInstrument(): string;
13
- /** @public */
14
10
  declare function registerInstrument(instr: Instrument): void;
15
- /** @public */
16
11
  declare function setInstrument(instrName: string): void;
17
- /** @public */
18
12
  declare function playNote(note: Note | string | number, duration?: number, linearVolume?: number): void;
19
- /** @public */
20
13
  declare function stop(): void;
21
14
 
22
15
  export { type Instrument, getCurrentInstrument, getInstrumentList, playNote, registerInstrument, setInstrument, stop };
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v3.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.1.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;
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v3.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.1.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-4AS76G4O.mjs";
4
+ } from "../chunk-PU4J7K4Z.mjs";
5
5
 
6
6
  // src/audio/index.ts
7
7
  import { Note, PitchNotation, SymbolSet } from "@tspro/web-music-score/theory";
@@ -1,4 +1,3 @@
1
- /** @public */
2
1
  declare function registerClassicalGuitar(): void;
3
2
 
4
3
  export { registerClassicalGuitar };
@@ -1,4 +1,3 @@
1
- /** @public */
2
1
  declare function registerClassicalGuitar(): void;
3
2
 
4
3
  export { registerClassicalGuitar };
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v3.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.1.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;
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v3.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.1.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-4AS76G4O.mjs";
4
+ } from "../chunk-PU4J7K4Z.mjs";
5
5
 
6
6
  // src/audio-cg/index.ts
7
7
  import * as Tone from "tone";
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v3.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.1.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -6,4 +6,4 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6
6
  export {
7
7
  __publicField
8
8
  };
9
- //# sourceMappingURL=chunk-4AS76G4O.mjs.map
9
+ //# sourceMappingURL=chunk-PU4J7K4Z.mjs.map
@@ -1,4 +1,3 @@
1
- /** @public */
2
1
  declare enum MusicErrorType {
3
2
  Unknown = 0,
4
3
  InvalidArg = 1,
@@ -8,14 +7,12 @@ declare enum MusicErrorType {
8
7
  Timesignature = 5,
9
8
  Score = 6
10
9
  }
11
- /** @public */
12
10
  declare class MusicError extends Error {
13
11
  readonly type: MusicErrorType;
14
12
  constructor(message: string);
15
13
  constructor(type: MusicErrorType, message: string);
16
14
  }
17
15
 
18
- /** @public */
19
16
  declare function init(): void;
20
17
 
21
18
  export { MusicError, MusicErrorType, init };
@@ -1,4 +1,3 @@
1
- /** @public */
2
1
  declare enum MusicErrorType {
3
2
  Unknown = 0,
4
3
  InvalidArg = 1,
@@ -8,14 +7,12 @@ declare enum MusicErrorType {
8
7
  Timesignature = 5,
9
8
  Score = 6
10
9
  }
11
- /** @public */
12
10
  declare class MusicError extends Error {
13
11
  readonly type: MusicErrorType;
14
12
  constructor(message: string);
15
13
  constructor(type: MusicErrorType, message: string);
16
14
  }
17
15
 
18
- /** @public */
19
16
  declare function init(): void;
20
17
 
21
18
  export { MusicError, MusicErrorType, init };
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v3.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.1.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -61,7 +61,7 @@ function init() {
61
61
  return;
62
62
  }
63
63
  initialized = true;
64
- console.log("%cWebMusicScore v3.0.1 (cjs) initialized.", "background: black; color: white; padding: 2px;");
64
+ console.log("%cWebMusicScore v3.1.1 (cjs) initialized.", "background: black; color: white; padding: 2px;");
65
65
  }
66
66
  // Annotate the CommonJS export names for ESM import in node:
67
67
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
- /* WebMusicScore v3.0.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v3.1.1 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  import {
3
3
  __publicField
4
- } from "../chunk-4AS76G4O.mjs";
4
+ } from "../chunk-PU4J7K4Z.mjs";
5
5
 
6
6
  // src/core/error.ts
7
7
  var MusicErrorType = /* @__PURE__ */ ((MusicErrorType2) => {
@@ -35,7 +35,7 @@ function init() {
35
35
  return;
36
36
  }
37
37
  initialized = true;
38
- console.log("%cWebMusicScore v3.0.1 (esm) initialized.", "background: black; color: white; padding: 2px;");
38
+ console.log("%cWebMusicScore v3.1.1 (esm) initialized.", "background: black; color: white; padding: 2px;");
39
39
  }
40
40
  export {
41
41
  MusicError,
@@ -1,22 +1,15 @@
1
- import { N as Note } from './note-B5ZtlHc8.js';
1
+ import { N as Note } from './note-BFa43I86.js';
2
2
 
3
- /** @public */
4
3
  declare enum Handedness {
5
4
  RightHanded = 0,
6
5
  LeftHanded = 1
7
6
  }
8
- /** @public */
9
7
  declare const DefaultHandedness = Handedness.RightHanded;
10
- /** @public */
11
8
  declare function validateHandedness(h: unknown): Handedness;
12
- /** @public */
13
9
  declare const TuningNameList: ReadonlyArray<string>;
14
- /** @public */
15
10
  declare const DefaultTuningName: string;
16
- /** @public */
17
11
  declare function validateTuningName(tuningName: string): string;
18
12
  /**
19
- * @public
20
13
  * @returns Array of open string notes, note for each string.
21
14
  */
22
15
  declare function getTuningStrings(tuningName: string): ReadonlyArray<Note>;
@@ -1,22 +1,15 @@
1
- import { N as Note } from './note-B5ZtlHc8.mjs';
1
+ import { N as Note } from './note-BFa43I86.mjs';
2
2
 
3
- /** @public */
4
3
  declare enum Handedness {
5
4
  RightHanded = 0,
6
5
  LeftHanded = 1
7
6
  }
8
- /** @public */
9
7
  declare const DefaultHandedness = Handedness.RightHanded;
10
- /** @public */
11
8
  declare function validateHandedness(h: unknown): Handedness;
12
- /** @public */
13
9
  declare const TuningNameList: ReadonlyArray<string>;
14
- /** @public */
15
10
  declare const DefaultTuningName: string;
16
- /** @public */
17
11
  declare function validateTuningName(tuningName: string): string;
18
12
  /**
19
- * @public
20
13
  * @returns Array of open string notes, note for each string.
21
14
  */
22
15
  declare function getTuningStrings(tuningName: string): ReadonlyArray<Note>;