web-music-score 6.0.0-pre.4 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.mjs +4 -4
- package/dist/audio-cg/index.js +1 -1
- package/dist/audio-cg/index.mjs +4 -4
- package/dist/audio-synth/index.js +1 -1
- package/dist/audio-synth/index.mjs +4 -4
- package/dist/{chunk-KFBULED3.mjs → chunk-422QLXBR.mjs} +3 -3
- package/dist/{chunk-DVKR62RS.mjs → chunk-7N2CWRTL.mjs} +3 -3
- package/dist/{chunk-6BEFVAAS.mjs → chunk-EYZOBMDN.mjs} +3 -3
- package/dist/{chunk-UAVXEHYM.mjs → chunk-JOXUFYNU.mjs} +4 -4
- package/dist/{chunk-GNCSH24V.mjs → chunk-YSFFUB4F.mjs} +2 -2
- package/dist/{chunk-GNFDJFUO.mjs → chunk-ZAPOJP2K.mjs} +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +5 -5
- package/dist/iife/audio-cg.js +1 -1
- package/dist/iife/index.js +12 -12
- package/dist/{music-objects-ChAdqdR8.d.ts → music-objects-CHp-dh_J.d.ts} +6 -4
- package/dist/{note-RVXvpfyV.d.ts → note-CJuq5aBy.d.ts} +1 -1
- package/dist/pieces/index.d.ts +3 -3
- package/dist/pieces/index.js +3 -3
- package/dist/pieces/index.mjs +4 -4
- package/dist/react-ui/index.d.ts +3 -3
- package/dist/react-ui/index.js +1 -1
- package/dist/react-ui/index.mjs +2 -2
- package/dist/{scale-B1M10_fu.d.ts → scale-DxGqFxlv.d.ts} +2 -2
- package/dist/score/index.d.ts +18 -11
- package/dist/score/index.js +81 -36
- package/dist/score/index.mjs +85 -40
- package/dist/{tempo-D-JF-8b_.d.ts → tempo-pCAa6qgo.d.ts} +1 -1
- package/dist/theory/index.d.ts +5 -5
- package/dist/theory/index.js +1 -1
- package/dist/theory/index.mjs +4 -4
- package/package.json +1 -1
package/dist/score/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v6.0.0
|
|
1
|
+
/* WebMusicScore v6.0.0 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -7022,17 +7022,15 @@ var _Extension = class _Extension extends MusicObjectLink {
|
|
|
7022
7022
|
let range = new ExtensionRange(curColumn);
|
|
7023
7023
|
let ticksLeft = length;
|
|
7024
7024
|
while (true) {
|
|
7025
|
-
if (ticksLeft <= 0) return range;
|
|
7025
|
+
if (!curColumn || ticksLeft <= 0) return range;
|
|
7026
7026
|
const stopObject = this.whatStopped(curColumn);
|
|
7027
7027
|
if (stopObject !== void 0) {
|
|
7028
7028
|
range.setStopObject(stopObject);
|
|
7029
7029
|
return range;
|
|
7030
7030
|
}
|
|
7031
|
+
range.addColumn(curColumn);
|
|
7031
7032
|
ticksLeft -= curColumn.getTicksToNextColumn();
|
|
7032
7033
|
curColumn = curColumn.getNextColumn();
|
|
7033
|
-
if (!curColumn) return range;
|
|
7034
|
-
if (ticksLeft > 0)
|
|
7035
|
-
range.addColumn(curColumn);
|
|
7036
7034
|
}
|
|
7037
7035
|
}
|
|
7038
7036
|
};
|
|
@@ -7062,6 +7060,9 @@ function getNavigationString(navigation) {
|
|
|
7062
7060
|
return navigation[0].toUpperCase() + navigation.substring(1);
|
|
7063
7061
|
}
|
|
7064
7062
|
}
|
|
7063
|
+
function isDynamicsText(text) {
|
|
7064
|
+
return guard_exports.isEnumValue(text, DynamicsAnnotation);
|
|
7065
|
+
}
|
|
7065
7066
|
function getDynamicsVolume(text) {
|
|
7066
7067
|
if (/^(p+|f+|m|mp|mf)$/.test(text)) {
|
|
7067
7068
|
let volume = 0.5 - utils_exports.Str.charCount(text, "p") * 0.1 + utils_exports.Str.charCount(text, "f") * 0.1;
|
|
@@ -7070,6 +7071,9 @@ function getDynamicsVolume(text) {
|
|
|
7070
7071
|
return void 0;
|
|
7071
7072
|
}
|
|
7072
7073
|
}
|
|
7074
|
+
function isTempoText(text) {
|
|
7075
|
+
return guard_exports.isEnumValue(text, TempoAnnotation);
|
|
7076
|
+
}
|
|
7073
7077
|
function getAnnotation(text) {
|
|
7074
7078
|
if (guard_exports.isEnumValue(text, DynamicsAnnotation)) {
|
|
7075
7079
|
return "dynamics" /* Dynamics */;
|
|
@@ -7278,7 +7282,7 @@ var Player = class _Player {
|
|
|
7278
7282
|
let volumeMap = new UniMap();
|
|
7279
7283
|
const pushSpeed = (col, speed) => speedMap.getOrCreate(col, []).push(speed);
|
|
7280
7284
|
const pushVolume = (col, volume) => volumeMap.getOrCreate(col, []).push(volume);
|
|
7281
|
-
this.playerColumnSequence.forEach((col) => {
|
|
7285
|
+
this.playerColumnSequence.forEach((col, colId) => {
|
|
7282
7286
|
if (!(col instanceof ObjRhythmColumn)) {
|
|
7283
7287
|
return;
|
|
7284
7288
|
}
|
|
@@ -7289,8 +7293,8 @@ var Player = class _Player {
|
|
|
7289
7293
|
curSpeed = 1;
|
|
7290
7294
|
} else if ((vol = getDynamicsVolume(text)) !== void 0) {
|
|
7291
7295
|
curVolume = vol;
|
|
7292
|
-
} else if (
|
|
7293
|
-
let extension = layoutObj.musicObj.getLink();
|
|
7296
|
+
} else if (isTempoText(text) || isDynamicsText(text)) {
|
|
7297
|
+
let extension = layoutObj.musicObj.getLink() instanceof Extension ? layoutObj.musicObj.getLink() : new Extension(layoutObj, col, Infinity, false, "solid", "bottom");
|
|
7294
7298
|
const range = extension.getRange();
|
|
7295
7299
|
const stopText = range.stopObject ? getTextContent(range.stopObject) : "";
|
|
7296
7300
|
let totalTicks = utils_exports.Math.sum(range.columnRange.map((c) => c.getTicksToNextColumn()));
|
|
@@ -8364,6 +8368,17 @@ var ObjFermata = class extends MusicObject {
|
|
|
8364
8368
|
};
|
|
8365
8369
|
|
|
8366
8370
|
// src/score/engine/obj-extension-line.ts
|
|
8371
|
+
function getRow(obj) {
|
|
8372
|
+
let o = obj;
|
|
8373
|
+
while (o) {
|
|
8374
|
+
if (o.row instanceof ObjScoreRow)
|
|
8375
|
+
return o.row;
|
|
8376
|
+
if (o.measure instanceof ObjMeasure)
|
|
8377
|
+
return o.measure.row;
|
|
8378
|
+
o = o.getParent();
|
|
8379
|
+
}
|
|
8380
|
+
return void 0;
|
|
8381
|
+
}
|
|
8367
8382
|
function isExtensionStartObject(obj) {
|
|
8368
8383
|
return obj instanceof ObjText || obj instanceof ObjSpecialText;
|
|
8369
8384
|
}
|
|
@@ -8387,8 +8402,11 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
8387
8402
|
getMusicInterface() {
|
|
8388
8403
|
return this.mi;
|
|
8389
8404
|
}
|
|
8405
|
+
getLeftObj() {
|
|
8406
|
+
return this.cols[0];
|
|
8407
|
+
}
|
|
8390
8408
|
getLineLeft(ctx) {
|
|
8391
|
-
let obj = this.
|
|
8409
|
+
let obj = this.getLeftObj();
|
|
8392
8410
|
if (isExtensionStartObject(obj))
|
|
8393
8411
|
return obj.getRect().right + ctx.unitSize;
|
|
8394
8412
|
if (obj instanceof ObjBarLineLeft)
|
|
@@ -8400,8 +8418,18 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
8400
8418
|
}
|
|
8401
8419
|
return obj.getRect().right;
|
|
8402
8420
|
}
|
|
8421
|
+
getRightObj() {
|
|
8422
|
+
const obj = this.cols[this.cols.length - 1];
|
|
8423
|
+
if (isExtensionStopObject(obj)) {
|
|
8424
|
+
const objRow = getRow(obj);
|
|
8425
|
+
const prevObj = this.cols[this.cols.length - 2];
|
|
8426
|
+
const prevObjRow = getRow(prevObj);
|
|
8427
|
+
return objRow && prevObjRow && objRow !== prevObjRow ? prevObj : obj;
|
|
8428
|
+
}
|
|
8429
|
+
return obj;
|
|
8430
|
+
}
|
|
8403
8431
|
getLineRight(ctx) {
|
|
8404
|
-
let obj = this.
|
|
8432
|
+
let obj = this.getRightObj();
|
|
8405
8433
|
if (isExtensionStopObject(obj))
|
|
8406
8434
|
return obj.getRect().left - ctx.unitSize;
|
|
8407
8435
|
if (obj instanceof ObjRhythmColumn) {
|
|
@@ -8441,7 +8469,7 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
8441
8469
|
ctx.setLineDash([]);
|
|
8442
8470
|
let tails = this.extension.getTails();
|
|
8443
8471
|
let last = tails[tails.length - 1];
|
|
8444
|
-
if (this === last && !isExtensionStopObject(this.
|
|
8472
|
+
if (this === last && !isExtensionStopObject(this.getRightObj())) {
|
|
8445
8473
|
let tipH = rect.anchorY > this.line.getRect().anchorY ? -ctx.unitSize : ctx.unitSize;
|
|
8446
8474
|
ctx.strokeLine(rect.right, rect.anchorY, rect.right, rect.anchorY + tipH);
|
|
8447
8475
|
}
|
|
@@ -9708,7 +9736,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
9708
9736
|
this.addRhythmSymbol(rest);
|
|
9709
9737
|
return rest;
|
|
9710
9738
|
}
|
|
9711
|
-
addLyrics(staffTabOrGroups, verse,
|
|
9739
|
+
addLyrics(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
9712
9740
|
this.forEachStaffGroup(staffTabOrGroups, 1 /* Below */, (line, vpos) => {
|
|
9713
9741
|
var _a;
|
|
9714
9742
|
let col = this.getRhythmColumn({ verse, line, vpos });
|
|
@@ -9968,21 +9996,22 @@ var ObjMeasure = class extends MusicObject {
|
|
|
9968
9996
|
getVoiceSymbols(voiceId) {
|
|
9969
9997
|
return this.voiceSymbols.getAll(voiceId);
|
|
9970
9998
|
}
|
|
9971
|
-
|
|
9972
|
-
if (voiceId ===
|
|
9999
|
+
fillWithRests(...voiceId) {
|
|
10000
|
+
if (voiceId.length === 0) {
|
|
9973
10001
|
if (this.getConsumedTicks() === 0) {
|
|
9974
|
-
this.
|
|
10002
|
+
this.fillWithRests(0);
|
|
9975
10003
|
} else {
|
|
9976
|
-
this.
|
|
10004
|
+
this.fillWithRests(...getVoiceIds().filter((id) => this.getConsumedTicks(id) > 0));
|
|
9977
10005
|
}
|
|
9978
10006
|
return;
|
|
9979
|
-
} else if (
|
|
9980
|
-
voiceId.forEach((id) => this.
|
|
10007
|
+
} else if (voiceId.length > 1) {
|
|
10008
|
+
voiceId.forEach((id) => this.fillWithRests(id));
|
|
9981
10009
|
return;
|
|
9982
10010
|
} else {
|
|
9983
|
-
|
|
10011
|
+
const id = voiceId[0];
|
|
10012
|
+
validateVoiceId(id);
|
|
9984
10013
|
let measureTicks = this.getMeasureTicks();
|
|
9985
|
-
let consumedTicks = this.getConsumedTicks(
|
|
10014
|
+
let consumedTicks = this.getConsumedTicks(id);
|
|
9986
10015
|
let remainingTicks = measureTicks - consumedTicks;
|
|
9987
10016
|
let rests = [];
|
|
9988
10017
|
while (remainingTicks > 0) {
|
|
@@ -9997,7 +10026,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
9997
10026
|
}
|
|
9998
10027
|
}
|
|
9999
10028
|
}
|
|
10000
|
-
rests.reverse().forEach((rest) => this.addRest(
|
|
10029
|
+
rests.reverse().forEach((rest) => this.addRest(id, import_theory9.NoteLengthProps.create(rest.noteLength, rest.dotCount).noteLength));
|
|
10001
10030
|
}
|
|
10002
10031
|
}
|
|
10003
10032
|
requestLayout() {
|
|
@@ -11550,7 +11579,7 @@ var import_theory13 = require("web-music-score/theory");
|
|
|
11550
11579
|
var import_core16 = require("web-music-score/core");
|
|
11551
11580
|
var assertingFunction = "";
|
|
11552
11581
|
function setAssertFunction(fnName, ...fnArgs) {
|
|
11553
|
-
let argsStr = fnArgs.map((arg) =>
|
|
11582
|
+
let argsStr = fnArgs.map((arg) => utils_exports.Str.stringify(arg)).join(", ");
|
|
11554
11583
|
assertingFunction = `DocumentBuilder.${fnName}(${argsStr})`;
|
|
11555
11584
|
}
|
|
11556
11585
|
function assertArg(...conditions) {
|
|
@@ -11892,7 +11921,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
11892
11921
|
ObjBeamGroup.createTuplet(tupletSymbols, tupletRatio);
|
|
11893
11922
|
return this;
|
|
11894
11923
|
}
|
|
11895
|
-
addLyricsInternal(staffTabOrGroups, verse,
|
|
11924
|
+
addLyricsInternal(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
11896
11925
|
var _a;
|
|
11897
11926
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
11898
11927
|
assertArg(
|
|
@@ -11908,36 +11937,36 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
11908
11937
|
(_a = lyricsOptions.align) != null ? _a : lyricsOptions.align = this.currentLyricsAlign;
|
|
11909
11938
|
}
|
|
11910
11939
|
if (guard_exports.isArray(lyricsText)) {
|
|
11911
|
-
lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse,
|
|
11940
|
+
lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse, text, lyricsLength, lyricsOptions));
|
|
11912
11941
|
} else {
|
|
11913
|
-
this.getMeasure().addLyrics(staffTabOrGroups, verse,
|
|
11942
|
+
this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions);
|
|
11914
11943
|
}
|
|
11915
11944
|
return this;
|
|
11916
11945
|
}
|
|
11917
11946
|
/**
|
|
11918
11947
|
* Add lyrics to current measure.
|
|
11919
11948
|
* @param verse - Verse number (e.g. 1).
|
|
11920
|
-
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
11921
11949
|
* @param lyricsText - Lyrics text (empty space if omitted), single value or array.
|
|
11950
|
+
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
11922
11951
|
* @param lyricsOptions - Lyrics options.
|
|
11923
11952
|
* @returns - This document builder instance.
|
|
11924
11953
|
*/
|
|
11925
|
-
addLyrics(verse,
|
|
11954
|
+
addLyrics(verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
11926
11955
|
setAssertFunction("addLyrics", verse, lyricsLength, lyricsText, lyricsOptions);
|
|
11927
|
-
return this.addLyricsInternal(void 0, verse,
|
|
11956
|
+
return this.addLyricsInternal(void 0, verse, lyricsText, lyricsLength, lyricsOptions);
|
|
11928
11957
|
}
|
|
11929
11958
|
/**
|
|
11930
11959
|
* Add lyrics to current measure to given staff/tab/group.
|
|
11931
11960
|
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
11932
11961
|
* @param verse - Verse number (e.g. 1).
|
|
11933
|
-
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
11934
11962
|
* @param lyricsText - Lyrics text (empty space if omitted), single value or array.
|
|
11963
|
+
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
11935
11964
|
* @param lyricsOptions - Lyrics options.
|
|
11936
11965
|
* @returns - This document builder instance.
|
|
11937
11966
|
*/
|
|
11938
|
-
addLyricsTo(staffTabOrGroups, verse,
|
|
11967
|
+
addLyricsTo(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
11939
11968
|
setAssertFunction("addLyricsTo", verse, lyricsLength, lyricsText, lyricsOptions);
|
|
11940
|
-
return this.addLyricsInternal(staffTabOrGroups, verse,
|
|
11969
|
+
return this.addLyricsInternal(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions);
|
|
11941
11970
|
}
|
|
11942
11971
|
addFermataInternal(staffTabOrGroups, fermata) {
|
|
11943
11972
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
@@ -12157,14 +12186,14 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
12157
12186
|
return this;
|
|
12158
12187
|
}
|
|
12159
12188
|
/**
|
|
12160
|
-
*
|
|
12189
|
+
* Fill current measure with rests.
|
|
12161
12190
|
* @param voiceId - Voice id to add rests to. Single value, array or all if omitted.
|
|
12162
12191
|
* @returns - This document builder instance.
|
|
12163
12192
|
*/
|
|
12164
|
-
|
|
12165
|
-
setAssertFunction("
|
|
12166
|
-
assertArg(guard_exports.
|
|
12167
|
-
this.getMeasure().
|
|
12193
|
+
fillWithRests(...voiceId) {
|
|
12194
|
+
setAssertFunction("fillWithRests", ...voiceId);
|
|
12195
|
+
assertArg(guard_exports.isArray(voiceId) && (voiceId.length === 0 || voiceId.every((id) => isVoiceId(id))));
|
|
12196
|
+
this.getMeasure().fillWithRests(...voiceId);
|
|
12168
12197
|
return this;
|
|
12169
12198
|
}
|
|
12170
12199
|
/**
|
|
@@ -12192,6 +12221,22 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
12192
12221
|
}
|
|
12193
12222
|
return this;
|
|
12194
12223
|
}
|
|
12224
|
+
/**
|
|
12225
|
+
* Add and repeat builder section.
|
|
12226
|
+
* @param times - Repeat count.
|
|
12227
|
+
* @param repeatCreator - Repeat creator function.
|
|
12228
|
+
* @returns - This document builder instance.
|
|
12229
|
+
*/
|
|
12230
|
+
repeat(times, repeatCreator) {
|
|
12231
|
+
setAssertFunction("repeat", repeatCreator);
|
|
12232
|
+
assertArg(
|
|
12233
|
+
guard_exports.isIntegerGte(times, 0),
|
|
12234
|
+
guard_exports.isFunction(repeatCreator)
|
|
12235
|
+
);
|
|
12236
|
+
for (let i = 0; i < times; i++)
|
|
12237
|
+
repeatCreator(this);
|
|
12238
|
+
return this;
|
|
12239
|
+
}
|
|
12195
12240
|
};
|
|
12196
12241
|
__publicField(_DocumentBuilder, "DefaultMeasureOptions", {});
|
|
12197
12242
|
var DocumentBuilder = _DocumentBuilder;
|
package/dist/score/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/* WebMusicScore v6.0.0
|
|
1
|
+
/* WebMusicScore v6.0.0 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
MusicError
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-422QLXBR.mjs";
|
|
5
5
|
import {
|
|
6
6
|
NoteLengthProps,
|
|
7
7
|
RhythmProps,
|
|
8
8
|
validateNoteLength
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-JOXUFYNU.mjs";
|
|
10
10
|
import {
|
|
11
11
|
AnchoredRect,
|
|
12
12
|
BiMap,
|
|
@@ -20,12 +20,12 @@ import {
|
|
|
20
20
|
device_exports,
|
|
21
21
|
guard_exports,
|
|
22
22
|
utils_exports
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-7N2CWRTL.mjs";
|
|
24
24
|
import {
|
|
25
25
|
__publicField,
|
|
26
26
|
__spreadProps,
|
|
27
27
|
__spreadValues
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-ZAPOJP2K.mjs";
|
|
29
29
|
|
|
30
30
|
// src/score/pub/types.ts
|
|
31
31
|
var StaffPreset = /* @__PURE__ */ ((StaffPreset2) => {
|
|
@@ -3149,17 +3149,15 @@ var _Extension = class _Extension extends MusicObjectLink {
|
|
|
3149
3149
|
let range = new ExtensionRange(curColumn);
|
|
3150
3150
|
let ticksLeft = length;
|
|
3151
3151
|
while (true) {
|
|
3152
|
-
if (ticksLeft <= 0) return range;
|
|
3152
|
+
if (!curColumn || ticksLeft <= 0) return range;
|
|
3153
3153
|
const stopObject = this.whatStopped(curColumn);
|
|
3154
3154
|
if (stopObject !== void 0) {
|
|
3155
3155
|
range.setStopObject(stopObject);
|
|
3156
3156
|
return range;
|
|
3157
3157
|
}
|
|
3158
|
+
range.addColumn(curColumn);
|
|
3158
3159
|
ticksLeft -= curColumn.getTicksToNextColumn();
|
|
3159
3160
|
curColumn = curColumn.getNextColumn();
|
|
3160
|
-
if (!curColumn) return range;
|
|
3161
|
-
if (ticksLeft > 0)
|
|
3162
|
-
range.addColumn(curColumn);
|
|
3163
3161
|
}
|
|
3164
3162
|
}
|
|
3165
3163
|
};
|
|
@@ -3189,6 +3187,9 @@ function getNavigationString(navigation) {
|
|
|
3189
3187
|
return navigation[0].toUpperCase() + navigation.substring(1);
|
|
3190
3188
|
}
|
|
3191
3189
|
}
|
|
3190
|
+
function isDynamicsText(text) {
|
|
3191
|
+
return guard_exports.isEnumValue(text, DynamicsAnnotation);
|
|
3192
|
+
}
|
|
3192
3193
|
function getDynamicsVolume(text) {
|
|
3193
3194
|
if (/^(p+|f+|m|mp|mf)$/.test(text)) {
|
|
3194
3195
|
let volume = 0.5 - utils_exports.Str.charCount(text, "p") * 0.1 + utils_exports.Str.charCount(text, "f") * 0.1;
|
|
@@ -3197,6 +3198,9 @@ function getDynamicsVolume(text) {
|
|
|
3197
3198
|
return void 0;
|
|
3198
3199
|
}
|
|
3199
3200
|
}
|
|
3201
|
+
function isTempoText(text) {
|
|
3202
|
+
return guard_exports.isEnumValue(text, TempoAnnotation);
|
|
3203
|
+
}
|
|
3200
3204
|
function getAnnotation(text) {
|
|
3201
3205
|
if (guard_exports.isEnumValue(text, DynamicsAnnotation)) {
|
|
3202
3206
|
return "dynamics" /* Dynamics */;
|
|
@@ -3405,7 +3409,7 @@ var Player = class _Player {
|
|
|
3405
3409
|
let volumeMap = new UniMap();
|
|
3406
3410
|
const pushSpeed = (col, speed) => speedMap.getOrCreate(col, []).push(speed);
|
|
3407
3411
|
const pushVolume = (col, volume) => volumeMap.getOrCreate(col, []).push(volume);
|
|
3408
|
-
this.playerColumnSequence.forEach((col) => {
|
|
3412
|
+
this.playerColumnSequence.forEach((col, colId) => {
|
|
3409
3413
|
if (!(col instanceof ObjRhythmColumn)) {
|
|
3410
3414
|
return;
|
|
3411
3415
|
}
|
|
@@ -3416,8 +3420,8 @@ var Player = class _Player {
|
|
|
3416
3420
|
curSpeed = 1;
|
|
3417
3421
|
} else if ((vol = getDynamicsVolume(text)) !== void 0) {
|
|
3418
3422
|
curVolume = vol;
|
|
3419
|
-
} else if (
|
|
3420
|
-
let extension = layoutObj.musicObj.getLink();
|
|
3423
|
+
} else if (isTempoText(text) || isDynamicsText(text)) {
|
|
3424
|
+
let extension = layoutObj.musicObj.getLink() instanceof Extension ? layoutObj.musicObj.getLink() : new Extension(layoutObj, col, Infinity, false, "solid", "bottom");
|
|
3421
3425
|
const range = extension.getRange();
|
|
3422
3426
|
const stopText = range.stopObject ? getTextContent(range.stopObject) : "";
|
|
3423
3427
|
let totalTicks = utils_exports.Math.sum(range.columnRange.map((c) => c.getTicksToNextColumn()));
|
|
@@ -4491,6 +4495,17 @@ var ObjFermata = class extends MusicObject {
|
|
|
4491
4495
|
};
|
|
4492
4496
|
|
|
4493
4497
|
// src/score/engine/obj-extension-line.ts
|
|
4498
|
+
function getRow(obj) {
|
|
4499
|
+
let o = obj;
|
|
4500
|
+
while (o) {
|
|
4501
|
+
if (o.row instanceof ObjScoreRow)
|
|
4502
|
+
return o.row;
|
|
4503
|
+
if (o.measure instanceof ObjMeasure)
|
|
4504
|
+
return o.measure.row;
|
|
4505
|
+
o = o.getParent();
|
|
4506
|
+
}
|
|
4507
|
+
return void 0;
|
|
4508
|
+
}
|
|
4494
4509
|
function isExtensionStartObject(obj) {
|
|
4495
4510
|
return obj instanceof ObjText || obj instanceof ObjSpecialText;
|
|
4496
4511
|
}
|
|
@@ -4514,8 +4529,11 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
4514
4529
|
getMusicInterface() {
|
|
4515
4530
|
return this.mi;
|
|
4516
4531
|
}
|
|
4532
|
+
getLeftObj() {
|
|
4533
|
+
return this.cols[0];
|
|
4534
|
+
}
|
|
4517
4535
|
getLineLeft(ctx) {
|
|
4518
|
-
let obj = this.
|
|
4536
|
+
let obj = this.getLeftObj();
|
|
4519
4537
|
if (isExtensionStartObject(obj))
|
|
4520
4538
|
return obj.getRect().right + ctx.unitSize;
|
|
4521
4539
|
if (obj instanceof ObjBarLineLeft)
|
|
@@ -4527,8 +4545,18 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
4527
4545
|
}
|
|
4528
4546
|
return obj.getRect().right;
|
|
4529
4547
|
}
|
|
4548
|
+
getRightObj() {
|
|
4549
|
+
const obj = this.cols[this.cols.length - 1];
|
|
4550
|
+
if (isExtensionStopObject(obj)) {
|
|
4551
|
+
const objRow = getRow(obj);
|
|
4552
|
+
const prevObj = this.cols[this.cols.length - 2];
|
|
4553
|
+
const prevObjRow = getRow(prevObj);
|
|
4554
|
+
return objRow && prevObjRow && objRow !== prevObjRow ? prevObj : obj;
|
|
4555
|
+
}
|
|
4556
|
+
return obj;
|
|
4557
|
+
}
|
|
4530
4558
|
getLineRight(ctx) {
|
|
4531
|
-
let obj = this.
|
|
4559
|
+
let obj = this.getRightObj();
|
|
4532
4560
|
if (isExtensionStopObject(obj))
|
|
4533
4561
|
return obj.getRect().left - ctx.unitSize;
|
|
4534
4562
|
if (obj instanceof ObjRhythmColumn) {
|
|
@@ -4568,7 +4596,7 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
4568
4596
|
ctx.setLineDash([]);
|
|
4569
4597
|
let tails = this.extension.getTails();
|
|
4570
4598
|
let last = tails[tails.length - 1];
|
|
4571
|
-
if (this === last && !isExtensionStopObject(this.
|
|
4599
|
+
if (this === last && !isExtensionStopObject(this.getRightObj())) {
|
|
4572
4600
|
let tipH = rect.anchorY > this.line.getRect().anchorY ? -ctx.unitSize : ctx.unitSize;
|
|
4573
4601
|
ctx.strokeLine(rect.right, rect.anchorY, rect.right, rect.anchorY + tipH);
|
|
4574
4602
|
}
|
|
@@ -5835,7 +5863,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5835
5863
|
this.addRhythmSymbol(rest);
|
|
5836
5864
|
return rest;
|
|
5837
5865
|
}
|
|
5838
|
-
addLyrics(staffTabOrGroups, verse,
|
|
5866
|
+
addLyrics(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
5839
5867
|
this.forEachStaffGroup(staffTabOrGroups, 1 /* Below */, (line, vpos) => {
|
|
5840
5868
|
var _a;
|
|
5841
5869
|
let col = this.getRhythmColumn({ verse, line, vpos });
|
|
@@ -6095,21 +6123,22 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6095
6123
|
getVoiceSymbols(voiceId) {
|
|
6096
6124
|
return this.voiceSymbols.getAll(voiceId);
|
|
6097
6125
|
}
|
|
6098
|
-
|
|
6099
|
-
if (voiceId ===
|
|
6126
|
+
fillWithRests(...voiceId) {
|
|
6127
|
+
if (voiceId.length === 0) {
|
|
6100
6128
|
if (this.getConsumedTicks() === 0) {
|
|
6101
|
-
this.
|
|
6129
|
+
this.fillWithRests(0);
|
|
6102
6130
|
} else {
|
|
6103
|
-
this.
|
|
6131
|
+
this.fillWithRests(...getVoiceIds().filter((id) => this.getConsumedTicks(id) > 0));
|
|
6104
6132
|
}
|
|
6105
6133
|
return;
|
|
6106
|
-
} else if (
|
|
6107
|
-
voiceId.forEach((id) => this.
|
|
6134
|
+
} else if (voiceId.length > 1) {
|
|
6135
|
+
voiceId.forEach((id) => this.fillWithRests(id));
|
|
6108
6136
|
return;
|
|
6109
6137
|
} else {
|
|
6110
|
-
|
|
6138
|
+
const id = voiceId[0];
|
|
6139
|
+
validateVoiceId(id);
|
|
6111
6140
|
let measureTicks = this.getMeasureTicks();
|
|
6112
|
-
let consumedTicks = this.getConsumedTicks(
|
|
6141
|
+
let consumedTicks = this.getConsumedTicks(id);
|
|
6113
6142
|
let remainingTicks = measureTicks - consumedTicks;
|
|
6114
6143
|
let rests = [];
|
|
6115
6144
|
while (remainingTicks > 0) {
|
|
@@ -6124,7 +6153,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6124
6153
|
}
|
|
6125
6154
|
}
|
|
6126
6155
|
}
|
|
6127
|
-
rests.reverse().forEach((rest) => this.addRest(
|
|
6156
|
+
rests.reverse().forEach((rest) => this.addRest(id, NoteLengthProps5.create(rest.noteLength, rest.dotCount).noteLength));
|
|
6128
6157
|
}
|
|
6129
6158
|
}
|
|
6130
6159
|
requestLayout() {
|
|
@@ -7677,7 +7706,7 @@ import { BeamGrouping, isNoteLength, isTupletRatio, KeySignature as KeySignature
|
|
|
7677
7706
|
import { MusicError as MusicError16, MusicErrorType as MusicErrorType16 } from "web-music-score/core";
|
|
7678
7707
|
var assertingFunction = "";
|
|
7679
7708
|
function setAssertFunction(fnName, ...fnArgs) {
|
|
7680
|
-
let argsStr = fnArgs.map((arg) =>
|
|
7709
|
+
let argsStr = fnArgs.map((arg) => utils_exports.Str.stringify(arg)).join(", ");
|
|
7681
7710
|
assertingFunction = `DocumentBuilder.${fnName}(${argsStr})`;
|
|
7682
7711
|
}
|
|
7683
7712
|
function assertArg(...conditions) {
|
|
@@ -8019,7 +8048,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8019
8048
|
ObjBeamGroup.createTuplet(tupletSymbols, tupletRatio);
|
|
8020
8049
|
return this;
|
|
8021
8050
|
}
|
|
8022
|
-
addLyricsInternal(staffTabOrGroups, verse,
|
|
8051
|
+
addLyricsInternal(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
8023
8052
|
var _a;
|
|
8024
8053
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
8025
8054
|
assertArg(
|
|
@@ -8035,36 +8064,36 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8035
8064
|
(_a = lyricsOptions.align) != null ? _a : lyricsOptions.align = this.currentLyricsAlign;
|
|
8036
8065
|
}
|
|
8037
8066
|
if (guard_exports.isArray(lyricsText)) {
|
|
8038
|
-
lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse,
|
|
8067
|
+
lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse, text, lyricsLength, lyricsOptions));
|
|
8039
8068
|
} else {
|
|
8040
|
-
this.getMeasure().addLyrics(staffTabOrGroups, verse,
|
|
8069
|
+
this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions);
|
|
8041
8070
|
}
|
|
8042
8071
|
return this;
|
|
8043
8072
|
}
|
|
8044
8073
|
/**
|
|
8045
8074
|
* Add lyrics to current measure.
|
|
8046
8075
|
* @param verse - Verse number (e.g. 1).
|
|
8047
|
-
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
8048
8076
|
* @param lyricsText - Lyrics text (empty space if omitted), single value or array.
|
|
8077
|
+
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
8049
8078
|
* @param lyricsOptions - Lyrics options.
|
|
8050
8079
|
* @returns - This document builder instance.
|
|
8051
8080
|
*/
|
|
8052
|
-
addLyrics(verse,
|
|
8081
|
+
addLyrics(verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
8053
8082
|
setAssertFunction("addLyrics", verse, lyricsLength, lyricsText, lyricsOptions);
|
|
8054
|
-
return this.addLyricsInternal(void 0, verse,
|
|
8083
|
+
return this.addLyricsInternal(void 0, verse, lyricsText, lyricsLength, lyricsOptions);
|
|
8055
8084
|
}
|
|
8056
8085
|
/**
|
|
8057
8086
|
* Add lyrics to current measure to given staff/tab/group.
|
|
8058
8087
|
* @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
|
|
8059
8088
|
* @param verse - Verse number (e.g. 1).
|
|
8060
|
-
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
8061
8089
|
* @param lyricsText - Lyrics text (empty space if omitted), single value or array.
|
|
8090
|
+
* @param lyricsLength - Lyrics text length (e.g. "2n").
|
|
8062
8091
|
* @param lyricsOptions - Lyrics options.
|
|
8063
8092
|
* @returns - This document builder instance.
|
|
8064
8093
|
*/
|
|
8065
|
-
addLyricsTo(staffTabOrGroups, verse,
|
|
8094
|
+
addLyricsTo(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions) {
|
|
8066
8095
|
setAssertFunction("addLyricsTo", verse, lyricsLength, lyricsText, lyricsOptions);
|
|
8067
|
-
return this.addLyricsInternal(staffTabOrGroups, verse,
|
|
8096
|
+
return this.addLyricsInternal(staffTabOrGroups, verse, lyricsText, lyricsLength, lyricsOptions);
|
|
8068
8097
|
}
|
|
8069
8098
|
addFermataInternal(staffTabOrGroups, fermata) {
|
|
8070
8099
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
@@ -8284,14 +8313,14 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8284
8313
|
return this;
|
|
8285
8314
|
}
|
|
8286
8315
|
/**
|
|
8287
|
-
*
|
|
8316
|
+
* Fill current measure with rests.
|
|
8288
8317
|
* @param voiceId - Voice id to add rests to. Single value, array or all if omitted.
|
|
8289
8318
|
* @returns - This document builder instance.
|
|
8290
8319
|
*/
|
|
8291
|
-
|
|
8292
|
-
setAssertFunction("
|
|
8293
|
-
assertArg(guard_exports.
|
|
8294
|
-
this.getMeasure().
|
|
8320
|
+
fillWithRests(...voiceId) {
|
|
8321
|
+
setAssertFunction("fillWithRests", ...voiceId);
|
|
8322
|
+
assertArg(guard_exports.isArray(voiceId) && (voiceId.length === 0 || voiceId.every((id) => isVoiceId(id))));
|
|
8323
|
+
this.getMeasure().fillWithRests(...voiceId);
|
|
8295
8324
|
return this;
|
|
8296
8325
|
}
|
|
8297
8326
|
/**
|
|
@@ -8319,6 +8348,22 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8319
8348
|
}
|
|
8320
8349
|
return this;
|
|
8321
8350
|
}
|
|
8351
|
+
/**
|
|
8352
|
+
* Add and repeat builder section.
|
|
8353
|
+
* @param times - Repeat count.
|
|
8354
|
+
* @param repeatCreator - Repeat creator function.
|
|
8355
|
+
* @returns - This document builder instance.
|
|
8356
|
+
*/
|
|
8357
|
+
repeat(times, repeatCreator) {
|
|
8358
|
+
setAssertFunction("repeat", repeatCreator);
|
|
8359
|
+
assertArg(
|
|
8360
|
+
guard_exports.isIntegerGte(times, 0),
|
|
8361
|
+
guard_exports.isFunction(repeatCreator)
|
|
8362
|
+
);
|
|
8363
|
+
for (let i = 0; i < times; i++)
|
|
8364
|
+
repeatCreator(this);
|
|
8365
|
+
return this;
|
|
8366
|
+
}
|
|
8322
8367
|
};
|
|
8323
8368
|
__publicField(_DocumentBuilder, "DefaultMeasureOptions", {});
|
|
8324
8369
|
var DocumentBuilder = _DocumentBuilder;
|
package/dist/theory/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { N as Note } from '../note-
|
|
2
|
-
export { A as Accidental, d as DefaultGuitarNoteLabel, D as DefaultPitchNotation, G as GuitarNoteLabel, e as GuitarNoteLabelList, a as NoteLetter, P as ParsedNote, b as PitchNotation, c as PitchNotationList, S as SymbolSet, g as getPitchNotationName, f as validateGuitarNoteLabel, v as validatePitchNotation } from '../note-
|
|
3
|
-
import { D as Degree } from '../scale-
|
|
4
|
-
export { b as Interval, I as IntervalDirection, a as IntervalQuality, c as Scale, d as ScaleFactory, S as ScaleType, i as getDefaultScale, h as getScale, e as getScaleFactory, g as getScaleFactoryList, v as validateIntervalQuality, f as validateScaleType } from '../scale-
|
|
5
|
-
export { A as AccidentalType, B as BeamGrouping, K as KeySignature, M as Mode, N as NoteLength, j as NoteLengthProps, h as NoteLengthStr, R as RhythmProps, c as Tempo, a as TimeSignature, T as TimeSignatures, n as Tuplet, k as TupletRatio, f as alterTempoSpeed, g as getDefaultKeySignature, d as getDefaultTempo, b as getDefaultTimeSignature, e as getTempoString, i as isNoteLength, l as isTupletRatio, v as validateNoteLength, m as validateTupletRatio } from '../tempo-
|
|
1
|
+
import { N as Note } from '../note-CJuq5aBy.js';
|
|
2
|
+
export { A as Accidental, d as DefaultGuitarNoteLabel, D as DefaultPitchNotation, G as GuitarNoteLabel, e as GuitarNoteLabelList, a as NoteLetter, P as ParsedNote, b as PitchNotation, c as PitchNotationList, S as SymbolSet, g as getPitchNotationName, f as validateGuitarNoteLabel, v as validatePitchNotation } from '../note-CJuq5aBy.js';
|
|
3
|
+
import { D as Degree } from '../scale-DxGqFxlv.js';
|
|
4
|
+
export { b as Interval, I as IntervalDirection, a as IntervalQuality, c as Scale, d as ScaleFactory, S as ScaleType, i as getDefaultScale, h as getScale, e as getScaleFactory, g as getScaleFactoryList, v as validateIntervalQuality, f as validateScaleType } from '../scale-DxGqFxlv.js';
|
|
5
|
+
export { A as AccidentalType, B as BeamGrouping, K as KeySignature, M as Mode, N as NoteLength, j as NoteLengthProps, h as NoteLengthStr, R as RhythmProps, c as Tempo, a as TimeSignature, T as TimeSignatures, n as Tuplet, k as TupletRatio, f as alterTempoSpeed, g as getDefaultKeySignature, d as getDefaultTempo, b as getDefaultTimeSignature, e as getTempoString, i as isNoteLength, l as isTupletRatio, v as validateNoteLength, m as validateTupletRatio } from '../tempo-pCAa6qgo.js';
|
|
6
6
|
|
|
7
7
|
/** Chord info type. */
|
|
8
8
|
type ChordInfo = {
|
package/dist/theory/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v6.0.0
|
|
1
|
+
/* WebMusicScore v6.0.0 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/theory/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v6.0.0
|
|
1
|
+
/* WebMusicScore v6.0.0 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
NoteLength,
|
|
4
4
|
NoteLengthProps,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
isTupletRatio,
|
|
9
9
|
validateNoteLength,
|
|
10
10
|
validateTupletRatio
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-JOXUFYNU.mjs";
|
|
12
12
|
import {
|
|
13
13
|
IndexArray,
|
|
14
14
|
LRUCache,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
UniMap,
|
|
17
17
|
guard_exports,
|
|
18
18
|
utils_exports
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-7N2CWRTL.mjs";
|
|
20
20
|
import {
|
|
21
21
|
__publicField
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-ZAPOJP2K.mjs";
|
|
23
23
|
|
|
24
24
|
// src/theory/types.ts
|
|
25
25
|
import { MusicError, MusicErrorType } from "web-music-score/core";
|