@tspro/web-music-score 3.1.0 → 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.
- package/CHANGELOG.md +5 -0
- package/README.md +5 -3
- package/dist/audio/index.d.mts +1 -8
- package/dist/audio/index.d.ts +1 -8
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.mjs +2 -2
- package/dist/audio-cg/index.d.mts +0 -1
- package/dist/audio-cg/index.d.ts +0 -1
- package/dist/audio-cg/index.js +1 -1
- package/dist/audio-cg/index.mjs +2 -2
- package/dist/{chunk-B4J3KED2.mjs → chunk-PU4J7K4Z.mjs} +2 -2
- package/dist/core/index.d.mts +0 -3
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +3 -3
- package/dist/{guitar-BIFwFT31.d.ts → guitar-C2Cp71NZ.d.ts} +1 -8
- package/dist/{guitar-zASF7B1g.d.mts → guitar-DggbM2UL.d.mts} +1 -8
- package/dist/iife/index.global.js +11 -11
- package/dist/{interface-BedxdQDE.d.mts → interface-Bz_525zj.d.mts} +15 -75
- package/dist/{interface-DprVf__B.d.ts → interface-Fn8ufBQx.d.ts} +15 -75
- package/dist/{note-B5ZtlHc8.d.mts → note-BFa43I86.d.mts} +0 -14
- package/dist/{note-B5ZtlHc8.d.ts → note-BFa43I86.d.ts} +0 -14
- package/dist/pieces/index.d.mts +3 -6
- package/dist/pieces/index.d.ts +3 -6
- package/dist/pieces/index.js +1 -1
- package/dist/pieces/index.mjs +2 -2
- package/dist/react-ui/index.d.mts +5 -23
- package/dist/react-ui/index.d.ts +5 -23
- package/dist/react-ui/index.js +1 -1
- package/dist/react-ui/index.mjs +2 -2
- package/dist/{scale-B_2MZaT9.d.ts → scale-DRR-t4Kr.d.mts} +2 -15
- package/dist/{scale-C-YS5iVG.d.mts → scale-ebJm37q1.d.ts} +2 -15
- package/dist/score/index.d.mts +18 -18
- package/dist/score/index.d.ts +18 -18
- package/dist/score/index.js +155 -150
- package/dist/score/index.mjs +156 -151
- package/dist/{tempo-TjQKn46X.d.mts → tempo-B4h5Ktob.d.mts} +1 -17
- package/dist/{tempo-DoJd-UYT.d.ts → tempo-DgqDEsn0.d.ts} +1 -17
- package/dist/theory/index.d.mts +6 -8
- package/dist/theory/index.d.ts +6 -8
- package/dist/theory/index.js +1 -1
- package/dist/theory/index.mjs +2 -2
- package/package.json +1 -1
package/dist/score/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v3.1.
|
|
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;
|
|
@@ -5111,12 +5111,59 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5111
5111
|
this.requestLayout();
|
|
5112
5112
|
this.requestRectUpdate();
|
|
5113
5113
|
}
|
|
5114
|
-
|
|
5114
|
+
forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, addFn) {
|
|
5115
|
+
const lines = this.row.getNotationLines();
|
|
5116
|
+
const addToStaffTabOrGroup = (staffTabOrGroup, vpos, prevGroups = []) => {
|
|
5117
|
+
if (typeof staffTabOrGroup === "number") {
|
|
5118
|
+
if (lines[staffTabOrGroup]) {
|
|
5119
|
+
addFn(lines[staffTabOrGroup], vpos);
|
|
5120
|
+
}
|
|
5121
|
+
} else if (typeof staffTabOrGroup === "string" && staffTabOrGroup.length > 0) {
|
|
5122
|
+
let stavesAndTabs = lines.filter((l) => l.name === staffTabOrGroup);
|
|
5123
|
+
stavesAndTabs.forEach((line) => addFn(line, vpos));
|
|
5124
|
+
if (stavesAndTabs.length === 0) {
|
|
5125
|
+
let grp = this.doc.getStaffGroup(staffTabOrGroup);
|
|
5126
|
+
if (grp && !prevGroups.includes(staffTabOrGroup)) {
|
|
5127
|
+
let curGroups = [...prevGroups, staffTabOrGroup];
|
|
5128
|
+
(import_ts_utils_lib8.Utils.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
|
|
5129
|
+
switch (grp.verticalPosition) {
|
|
5130
|
+
case 0 /* Above */:
|
|
5131
|
+
addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
|
|
5132
|
+
break;
|
|
5133
|
+
case 1 /* Below */:
|
|
5134
|
+
addToStaffTabOrGroup(staffTabOrGroup2, 1 /* Below */, curGroups);
|
|
5135
|
+
break;
|
|
5136
|
+
case 2 /* Both */:
|
|
5137
|
+
addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
|
|
5138
|
+
addToStaffTabOrGroup(staffTabOrGroup2, 1 /* Below */, curGroups);
|
|
5139
|
+
break;
|
|
5140
|
+
case 3 /* Auto */:
|
|
5141
|
+
addToStaffTabOrGroup(staffTabOrGroup2, defaultVerticalPos, curGroups);
|
|
5142
|
+
break;
|
|
5143
|
+
}
|
|
5144
|
+
});
|
|
5145
|
+
}
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
};
|
|
5149
|
+
if (staffTabOrGroups === void 0) {
|
|
5150
|
+
if (lines.length >= 2 && lines[0] instanceof ObjStaff && lines[0].staffConfig.clef === "G" /* G */ && lines[0].isGrand() && lines[1] instanceof ObjStaff && lines[1].staffConfig.clef === "F" /* F */ && lines[1].isGrand()) {
|
|
5151
|
+
addToStaffTabOrGroup(defaultVerticalPos === 1 /* Below */ ? 1 : 0, defaultVerticalPos);
|
|
5152
|
+
} else {
|
|
5153
|
+
addToStaffTabOrGroup(0, defaultVerticalPos);
|
|
5154
|
+
}
|
|
5155
|
+
} else if (import_ts_utils_lib8.Utils.Is.isArray(staffTabOrGroups)) {
|
|
5156
|
+
staffTabOrGroups.forEach((staffTabOrGroup) => addToStaffTabOrGroup(staffTabOrGroup, defaultVerticalPos));
|
|
5157
|
+
} else {
|
|
5158
|
+
addToStaffTabOrGroup(staffTabOrGroups, defaultVerticalPos);
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
addFermata(staffTabOrGroups, fermata) {
|
|
5115
5162
|
let anchor = fermata === 1 /* AtMeasureEnd */ ? this.barLineRight : this.lastAddedRhythmColumn;
|
|
5116
5163
|
if (!anchor) {
|
|
5117
5164
|
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add Fermata because anchor is undefined.");
|
|
5118
5165
|
}
|
|
5119
|
-
this.forEachStaffGroup(
|
|
5166
|
+
this.forEachStaffGroup(staffTabOrGroups, 0 /* Above */, (line, vpos) => {
|
|
5120
5167
|
this.addLayoutObject(new ObjFermata(anchor, vpos), line, 0 /* Fermata */, vpos);
|
|
5121
5168
|
});
|
|
5122
5169
|
this.disableExtension();
|
|
@@ -5125,7 +5172,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5125
5172
|
hasFermata(anchor) {
|
|
5126
5173
|
return this.layoutObjects.some((layoutObj) => layoutObj.musicObj instanceof ObjFermata && layoutObj.anchor === anchor);
|
|
5127
5174
|
}
|
|
5128
|
-
addNavigation(
|
|
5175
|
+
addNavigation(staffTabOrGroups, navigation, ...args) {
|
|
5129
5176
|
let addLayoutObjectProps = void 0;
|
|
5130
5177
|
switch (navigation) {
|
|
5131
5178
|
case 10 /* Ending */:
|
|
@@ -5151,7 +5198,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5151
5198
|
layoutGroupId: 2 /* Navigation */,
|
|
5152
5199
|
defaultVerticalPos: 0 /* Above */
|
|
5153
5200
|
};
|
|
5154
|
-
this.addNavigation(
|
|
5201
|
+
this.addNavigation(staffTabOrGroups, 9 /* EndRepeat */);
|
|
5155
5202
|
this.endSong();
|
|
5156
5203
|
break;
|
|
5157
5204
|
}
|
|
@@ -5204,7 +5251,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5204
5251
|
break;
|
|
5205
5252
|
}
|
|
5206
5253
|
if (addLayoutObjectProps) {
|
|
5207
|
-
this.forEachStaffGroup(
|
|
5254
|
+
this.forEachStaffGroup(staffTabOrGroups, addLayoutObjectProps.defaultVerticalPos, (line, vpos) => {
|
|
5208
5255
|
this.addLayoutObject(addLayoutObjectProps.createObj(), line, addLayoutObjectProps.layoutGroupId, vpos);
|
|
5209
5256
|
});
|
|
5210
5257
|
}
|
|
@@ -5214,135 +5261,108 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5214
5261
|
hasNavigation(n) {
|
|
5215
5262
|
return this.navigationSet.has(n);
|
|
5216
5263
|
}
|
|
5217
|
-
|
|
5218
|
-
return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
|
|
5219
|
-
}
|
|
5220
|
-
getEndRepeatPlayCount() {
|
|
5221
|
-
return this.endRepeatPlayCount;
|
|
5222
|
-
}
|
|
5223
|
-
addConnective(connective, ...args) {
|
|
5224
|
-
let anchor = this.lastAddedRhythmSymbol;
|
|
5225
|
-
if (!(anchor instanceof ObjNoteGroup)) {
|
|
5226
|
-
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Connective can be added to note group only.");
|
|
5227
|
-
}
|
|
5228
|
-
if (connective === 0 /* Tie */) {
|
|
5229
|
-
let tieSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) || import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
|
|
5230
|
-
let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
|
|
5231
|
-
anchor.startConnective(new ConnectiveProps(0 /* Tie */, tieSpan, noteAnchor, anchor));
|
|
5232
|
-
} else if (connective === 1 /* Slur */) {
|
|
5233
|
-
let slurSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) ? args[0] : 2;
|
|
5234
|
-
let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
|
|
5235
|
-
anchor.startConnective(new ConnectiveProps(1 /* Slur */, slurSpan, noteAnchor, anchor));
|
|
5236
|
-
} else if (connective === 2 /* Slide */) {
|
|
5237
|
-
let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : 0 /* Auto */;
|
|
5238
|
-
anchor.startConnective(new ConnectiveProps(2 /* Slide */, 2, noteAnchor, anchor));
|
|
5239
|
-
}
|
|
5240
|
-
}
|
|
5241
|
-
forEachStaffGroup(staffTabOrGroup, defaultVerticalPos, add) {
|
|
5242
|
-
const lines = this.row.getNotationLines();
|
|
5243
|
-
const performAdd = (lineId, vpos, depth) => {
|
|
5244
|
-
if (depth >= 5) {
|
|
5245
|
-
return;
|
|
5246
|
-
}
|
|
5247
|
-
let success = false;
|
|
5248
|
-
if (typeof lineId === "number") {
|
|
5249
|
-
if (lines[lineId]) {
|
|
5250
|
-
add(lines[lineId], vpos);
|
|
5251
|
-
success = true;
|
|
5252
|
-
}
|
|
5253
|
-
} else if (typeof lineId === "string" && lineId.length > 0) {
|
|
5254
|
-
lines.filter((l) => l.name === lineId).forEach((line) => {
|
|
5255
|
-
add(line, vpos);
|
|
5256
|
-
success = true;
|
|
5257
|
-
});
|
|
5258
|
-
}
|
|
5259
|
-
if (typeof lineId === "string" && !success) {
|
|
5260
|
-
let grp = this.doc.getStaffGroup(lineId);
|
|
5261
|
-
if (grp) {
|
|
5262
|
-
(import_ts_utils_lib8.Utils.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((lineId2) => {
|
|
5263
|
-
switch (grp.verticalPosition) {
|
|
5264
|
-
case 0 /* Above */:
|
|
5265
|
-
performAdd(lineId2, 0 /* Above */, depth + 1);
|
|
5266
|
-
break;
|
|
5267
|
-
case 1 /* Below */:
|
|
5268
|
-
performAdd(lineId2, 1 /* Below */, depth + 1);
|
|
5269
|
-
break;
|
|
5270
|
-
case 2 /* Both */:
|
|
5271
|
-
performAdd(lineId2, 0 /* Above */, depth + 1);
|
|
5272
|
-
performAdd(lineId2, 1 /* Below */, depth + 1);
|
|
5273
|
-
break;
|
|
5274
|
-
case 3 /* Auto */:
|
|
5275
|
-
performAdd(lineId2, defaultVerticalPos, depth + 1);
|
|
5276
|
-
break;
|
|
5277
|
-
}
|
|
5278
|
-
});
|
|
5279
|
-
}
|
|
5280
|
-
}
|
|
5281
|
-
};
|
|
5282
|
-
if (staffTabOrGroup === void 0) {
|
|
5283
|
-
if (lines.length >= 2 && lines[0] instanceof ObjStaff && lines[0].staffConfig.clef === "G" /* G */ && lines[0].isGrand() && lines[1] instanceof ObjStaff && lines[1].staffConfig.clef === "F" /* F */ && lines[1].isGrand()) {
|
|
5284
|
-
performAdd(defaultVerticalPos === 1 /* Below */ ? 1 : 0, defaultVerticalPos, 0);
|
|
5285
|
-
} else {
|
|
5286
|
-
performAdd(0, defaultVerticalPos, 0);
|
|
5287
|
-
}
|
|
5288
|
-
} else {
|
|
5289
|
-
performAdd(staffTabOrGroup, defaultVerticalPos, 0);
|
|
5290
|
-
}
|
|
5291
|
-
}
|
|
5292
|
-
addLabel(staffTabOrGroup, label, text) {
|
|
5264
|
+
addAnnotation(staffTabOrGroups, annotation, text) {
|
|
5293
5265
|
let anchor = this.lastAddedRhythmColumn;
|
|
5294
5266
|
if (!anchor) {
|
|
5295
|
-
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add
|
|
5267
|
+
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add annotation because anchor is undefined.");
|
|
5296
5268
|
} else if (text.length === 0) {
|
|
5297
|
-
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add
|
|
5269
|
+
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add annotation because annotation text is empty.");
|
|
5298
5270
|
}
|
|
5299
5271
|
let textProps = { text };
|
|
5300
5272
|
let layoutGroupId;
|
|
5301
5273
|
let defaultVerticalPos;
|
|
5302
|
-
switch (
|
|
5303
|
-
case 0 /*
|
|
5304
|
-
layoutGroupId =
|
|
5305
|
-
defaultVerticalPos =
|
|
5274
|
+
switch (annotation) {
|
|
5275
|
+
case 0 /* Dynamics */:
|
|
5276
|
+
layoutGroupId = 5 /* DynamicsAnnotation */;
|
|
5277
|
+
defaultVerticalPos = 0 /* Above */;
|
|
5278
|
+
textProps.italic = true;
|
|
5306
5279
|
break;
|
|
5307
|
-
case 1 /*
|
|
5308
|
-
layoutGroupId =
|
|
5280
|
+
case 1 /* Tempo */:
|
|
5281
|
+
layoutGroupId = 4 /* TempoAnnotation */;
|
|
5309
5282
|
defaultVerticalPos = 0 /* Above */;
|
|
5283
|
+
textProps.italic = true;
|
|
5310
5284
|
break;
|
|
5311
5285
|
}
|
|
5312
|
-
this.forEachStaffGroup(
|
|
5286
|
+
this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
|
|
5313
5287
|
let textObj = new ObjText(anchor, textProps, 0.5, 1);
|
|
5314
5288
|
this.addLayoutObject(textObj, line, layoutGroupId, vpos);
|
|
5315
5289
|
this.enableExtension(textObj);
|
|
5316
5290
|
});
|
|
5317
5291
|
}
|
|
5318
|
-
|
|
5292
|
+
addLabel(staffTabOrGroups, label, text) {
|
|
5319
5293
|
let anchor = this.lastAddedRhythmColumn;
|
|
5320
5294
|
if (!anchor) {
|
|
5321
|
-
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add
|
|
5295
|
+
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add label because anchor is undefined.");
|
|
5322
5296
|
} else if (text.length === 0) {
|
|
5323
|
-
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add
|
|
5297
|
+
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add label because label text is empty.");
|
|
5324
5298
|
}
|
|
5325
5299
|
let textProps = { text };
|
|
5326
5300
|
let layoutGroupId;
|
|
5327
5301
|
let defaultVerticalPos;
|
|
5328
|
-
switch (
|
|
5329
|
-
case 0 /*
|
|
5330
|
-
layoutGroupId =
|
|
5331
|
-
defaultVerticalPos =
|
|
5332
|
-
textProps.italic = true;
|
|
5302
|
+
switch (label) {
|
|
5303
|
+
case 0 /* Note */:
|
|
5304
|
+
layoutGroupId = 1 /* NoteLabel */;
|
|
5305
|
+
defaultVerticalPos = 1 /* Below */;
|
|
5333
5306
|
break;
|
|
5334
|
-
case 1 /*
|
|
5335
|
-
layoutGroupId =
|
|
5307
|
+
case 1 /* Chord */:
|
|
5308
|
+
layoutGroupId = 6 /* ChordLabel */;
|
|
5336
5309
|
defaultVerticalPos = 0 /* Above */;
|
|
5337
|
-
textProps.italic = true;
|
|
5338
5310
|
break;
|
|
5339
5311
|
}
|
|
5340
|
-
this.forEachStaffGroup(
|
|
5312
|
+
this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
|
|
5341
5313
|
let textObj = new ObjText(anchor, textProps, 0.5, 1);
|
|
5342
5314
|
this.addLayoutObject(textObj, line, layoutGroupId, vpos);
|
|
5343
5315
|
this.enableExtension(textObj);
|
|
5344
5316
|
});
|
|
5345
5317
|
}
|
|
5318
|
+
addConnective(connective, ...args) {
|
|
5319
|
+
let anchor = this.lastAddedRhythmSymbol;
|
|
5320
|
+
if (!(anchor instanceof ObjNoteGroup)) {
|
|
5321
|
+
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Connective can be added to note group only.");
|
|
5322
|
+
}
|
|
5323
|
+
if (connective === 0 /* Tie */) {
|
|
5324
|
+
let tieSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) || import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
|
|
5325
|
+
let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
|
|
5326
|
+
anchor.startConnective(new ConnectiveProps(0 /* Tie */, tieSpan, noteAnchor, anchor));
|
|
5327
|
+
} else if (connective === 1 /* Slur */) {
|
|
5328
|
+
let slurSpan = import_ts_utils_lib8.Utils.Is.isInteger(args[0]) ? args[0] : 2;
|
|
5329
|
+
let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : 0 /* Auto */;
|
|
5330
|
+
anchor.startConnective(new ConnectiveProps(1 /* Slur */, slurSpan, noteAnchor, anchor));
|
|
5331
|
+
} else if (connective === 2 /* Slide */) {
|
|
5332
|
+
let noteAnchor = import_ts_utils_lib8.Utils.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : 0 /* Auto */;
|
|
5333
|
+
anchor.startConnective(new ConnectiveProps(2 /* Slide */, 2, noteAnchor, anchor));
|
|
5334
|
+
}
|
|
5335
|
+
}
|
|
5336
|
+
addExtension(extensionLength, extensionVisible) {
|
|
5337
|
+
this.addExtensionToMusicObjects.forEach((musicObj) => {
|
|
5338
|
+
let anchor = musicObj.getParent();
|
|
5339
|
+
if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
|
|
5340
|
+
let lineStyle = "dashed";
|
|
5341
|
+
let linePos = "bottom";
|
|
5342
|
+
let extension = new Extension(musicObj, anchor, extensionLength, extensionVisible, lineStyle, linePos);
|
|
5343
|
+
musicObj.setLink(extension);
|
|
5344
|
+
} else {
|
|
5345
|
+
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension becaue no compatible music object to attach it to.");
|
|
5346
|
+
}
|
|
5347
|
+
});
|
|
5348
|
+
if (this.addExtensionToMusicObjects.length === 0) {
|
|
5349
|
+
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension because music object to attach it to is undefined.");
|
|
5350
|
+
}
|
|
5351
|
+
this.disableExtension();
|
|
5352
|
+
this.requestLayout();
|
|
5353
|
+
}
|
|
5354
|
+
enableExtension(musicObject) {
|
|
5355
|
+
this.addExtensionToMusicObjects.push(musicObject);
|
|
5356
|
+
}
|
|
5357
|
+
disableExtension() {
|
|
5358
|
+
this.addExtensionToMusicObjects = [];
|
|
5359
|
+
}
|
|
5360
|
+
getEnding() {
|
|
5361
|
+
return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
|
|
5362
|
+
}
|
|
5363
|
+
getEndRepeatPlayCount() {
|
|
5364
|
+
return this.endRepeatPlayCount;
|
|
5365
|
+
}
|
|
5346
5366
|
endSong() {
|
|
5347
5367
|
this.isEndSong = true;
|
|
5348
5368
|
this.requestLayout();
|
|
@@ -5363,30 +5383,6 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5363
5383
|
this.doc.requestNewRow();
|
|
5364
5384
|
this.disableExtension();
|
|
5365
5385
|
}
|
|
5366
|
-
enableExtension(musicObject) {
|
|
5367
|
-
this.addExtensionToMusicObjects.push(musicObject);
|
|
5368
|
-
}
|
|
5369
|
-
disableExtension() {
|
|
5370
|
-
this.addExtensionToMusicObjects = [];
|
|
5371
|
-
}
|
|
5372
|
-
addExtension(extensionLength, extensionVisible) {
|
|
5373
|
-
this.addExtensionToMusicObjects.forEach((musicObj) => {
|
|
5374
|
-
let anchor = musicObj.getParent();
|
|
5375
|
-
if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
|
|
5376
|
-
let lineStyle = "dashed";
|
|
5377
|
-
let linePos = "bottom";
|
|
5378
|
-
let extension = new Extension(musicObj, anchor, extensionLength, extensionVisible, lineStyle, linePos);
|
|
5379
|
-
musicObj.setLink(extension);
|
|
5380
|
-
} else {
|
|
5381
|
-
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension becaue no compatible music object to attach it to.");
|
|
5382
|
-
}
|
|
5383
|
-
});
|
|
5384
|
-
if (this.addExtensionToMusicObjects.length === 0) {
|
|
5385
|
-
throw new import_core13.MusicError(import_core13.MusicErrorType.Score, "Cannot add extension because music object to attach it to is undefined.");
|
|
5386
|
-
}
|
|
5387
|
-
this.disableExtension();
|
|
5388
|
-
this.requestLayout();
|
|
5389
|
-
}
|
|
5390
5386
|
addRhythmSymbol(voiceId, symbol) {
|
|
5391
5387
|
let { col } = symbol;
|
|
5392
5388
|
col.setVoiceSymbol(voiceId, symbol);
|
|
@@ -7012,6 +7008,15 @@ function assertRestOptions(options) {
|
|
|
7012
7008
|
assertArg(import_ts_utils_lib11.Utils.Is.isBooleanOrUndefined(options.hide), "restOptions.hide", options.hide);
|
|
7013
7009
|
assertArg(import_ts_utils_lib11.Utils.Is.isBooleanOrUndefined(options.triplet), "restOptions.triplet", options.triplet);
|
|
7014
7010
|
}
|
|
7011
|
+
function assertStaffTabOrGRoups(staffTabOrGroups) {
|
|
7012
|
+
assertArg(
|
|
7013
|
+
import_ts_utils_lib11.Utils.Is.isStringOrUndefined(staffTabOrGroups) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroups, 0) || import_ts_utils_lib11.Utils.Is.isArray(staffTabOrGroups) && staffTabOrGroups.every(
|
|
7014
|
+
(staffTabOrGroup) => import_ts_utils_lib11.Utils.Is.isString(staffTabOrGroup) || import_ts_utils_lib11.Utils.Is.isIntegerGte(staffTabOrGroup, 0)
|
|
7015
|
+
),
|
|
7016
|
+
"staffTabOrGroup",
|
|
7017
|
+
staffTabOrGroups
|
|
7018
|
+
);
|
|
7019
|
+
}
|
|
7015
7020
|
var DocumentBuilder = class {
|
|
7016
7021
|
constructor() {
|
|
7017
7022
|
__publicField(this, "doc");
|
|
@@ -7113,63 +7118,63 @@ var DocumentBuilder = class {
|
|
|
7113
7118
|
this.getMeasure().addRest(voiceId, restLength, options);
|
|
7114
7119
|
return this;
|
|
7115
7120
|
}
|
|
7116
|
-
addFermataInternal(
|
|
7117
|
-
|
|
7121
|
+
addFermataInternal(staffTabOrGroups, fermata) {
|
|
7122
|
+
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
7118
7123
|
assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(fermata, Fermata), "fermata", fermata);
|
|
7119
|
-
this.getMeasure().addFermata(
|
|
7124
|
+
this.getMeasure().addFermata(staffTabOrGroups, fermata);
|
|
7120
7125
|
return this;
|
|
7121
7126
|
}
|
|
7122
7127
|
addFermata(fermata = 0 /* AtNote */) {
|
|
7123
7128
|
return this.addFermataInternal(void 0, fermata);
|
|
7124
7129
|
}
|
|
7125
|
-
/** @param
|
|
7126
|
-
addFermataTo(
|
|
7127
|
-
return this.addFermataInternal(
|
|
7130
|
+
/** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
|
|
7131
|
+
addFermataTo(staffTabOrGroups, fermata = 0 /* AtNote */) {
|
|
7132
|
+
return this.addFermataInternal(staffTabOrGroups, fermata);
|
|
7128
7133
|
}
|
|
7129
|
-
addNavigationInternal(
|
|
7130
|
-
|
|
7134
|
+
addNavigationInternal(staffTabOrGroups, navigation, ...args) {
|
|
7135
|
+
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
7131
7136
|
assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(navigation, Navigation), "navigation", navigation);
|
|
7132
7137
|
if (navigation === 9 /* EndRepeat */ && args.length > 0) {
|
|
7133
7138
|
assertArg(import_ts_utils_lib11.Utils.Is.isIntegerGte(args[0], 1), "playCount", args[0]);
|
|
7134
7139
|
} else if (navigation === 10 /* Ending */ && args.length > 0) {
|
|
7135
7140
|
assertArg(args.every((passage) => import_ts_utils_lib11.Utils.Is.isIntegerGte(passage, 1)), "passages", args);
|
|
7136
7141
|
}
|
|
7137
|
-
this.getMeasure().addNavigation(
|
|
7142
|
+
this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
|
|
7138
7143
|
return this;
|
|
7139
7144
|
}
|
|
7140
7145
|
addNavigation(navigation, ...args) {
|
|
7141
7146
|
return this.addNavigationInternal(void 0, navigation, ...args);
|
|
7142
7147
|
}
|
|
7143
|
-
addNavigationTo(
|
|
7144
|
-
return this.addNavigationInternal(
|
|
7148
|
+
addNavigationTo(staffTabOrGroups, navigation, ...args) {
|
|
7149
|
+
return this.addNavigationInternal(staffTabOrGroups, navigation, ...args);
|
|
7145
7150
|
}
|
|
7146
|
-
addLabelInternal(
|
|
7147
|
-
|
|
7151
|
+
addLabelInternal(staffTabOrGroups, label, text) {
|
|
7152
|
+
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
7148
7153
|
assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(label, Label), "label", label);
|
|
7149
7154
|
assertArg(import_ts_utils_lib11.Utils.Is.isString(text), "text", text);
|
|
7150
|
-
this.getMeasure().addLabel(
|
|
7155
|
+
this.getMeasure().addLabel(staffTabOrGroups, label, text);
|
|
7151
7156
|
return this;
|
|
7152
7157
|
}
|
|
7153
7158
|
addLabel(label, text) {
|
|
7154
7159
|
return this.addLabelInternal(void 0, label, text);
|
|
7155
7160
|
}
|
|
7156
|
-
/** @param
|
|
7157
|
-
addLabelTo(
|
|
7158
|
-
return this.addLabelInternal(
|
|
7161
|
+
/** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
|
|
7162
|
+
addLabelTo(staffTabOrGroups, label, text) {
|
|
7163
|
+
return this.addLabelInternal(staffTabOrGroups, label, text);
|
|
7159
7164
|
}
|
|
7160
|
-
addAnnotationInternal(
|
|
7161
|
-
|
|
7165
|
+
addAnnotationInternal(staffTabOrGroups, annotation, text) {
|
|
7166
|
+
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
7162
7167
|
assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(annotation, Annotation), "annotation", annotation);
|
|
7163
7168
|
assertArg(import_ts_utils_lib11.Utils.Is.isString(text), "text", text);
|
|
7164
|
-
this.getMeasure().addAnnotation(
|
|
7169
|
+
this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
|
|
7165
7170
|
return this;
|
|
7166
7171
|
}
|
|
7167
7172
|
addAnnotation(annotation, text) {
|
|
7168
7173
|
return this.addAnnotationInternal(void 0, annotation, text);
|
|
7169
7174
|
}
|
|
7170
|
-
/** @param
|
|
7171
|
-
addAnnotationTo(
|
|
7172
|
-
return this.addAnnotationInternal(
|
|
7175
|
+
/** @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name. */
|
|
7176
|
+
addAnnotationTo(staffTabOrGroups, annotation, text) {
|
|
7177
|
+
return this.addAnnotationInternal(staffTabOrGroups, annotation, text);
|
|
7173
7178
|
}
|
|
7174
7179
|
addConnective(connective, ...args) {
|
|
7175
7180
|
assertArg(import_ts_utils_lib11.Utils.Is.isEnumValue(connective, Connective), "connective", connective);
|