web-music-score 6.0.1 → 6.2.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 +24 -0
- package/README.md +49 -16
- package/dist/audio/index.js +346 -73
- 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-OM25LPIN.mjs → chunk-IUGL627R.mjs} +3 -3
- package/dist/chunk-KX3MD5SH.mjs +28 -0
- package/dist/{chunk-EDHJ4ZRB.mjs → chunk-TZTJWSNU.mjs} +123 -76
- package/dist/{chunk-IW4YD7XE.mjs → chunk-V5OCPI6U.mjs} +2 -2
- package/dist/{chunk-OHH32J6I.mjs → chunk-WTO5SXB5.mjs} +3 -3
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +358 -76
- package/dist/core/index.mjs +42 -10
- package/dist/{music-objects-Bef-fs1f.d.ts → deprecated-C3Cn5vBN.d.ts} +439 -341
- package/dist/iife/audio-cg.js +1 -1
- package/dist/iife/index.js +13 -13
- package/dist/pieces/index.d.ts +1 -1
- package/dist/pieces/index.js +1 -1
- package/dist/pieces/index.mjs +2 -2
- package/dist/react-ui/index.d.ts +59 -22
- package/dist/react-ui/index.js +2085 -28
- package/dist/react-ui/index.mjs +54 -22
- package/dist/score/index.d.ts +2 -2
- package/dist/score/index.js +5078 -4828
- package/dist/score/index.mjs +4956 -4502
- package/dist/theory/index.js +118 -74
- package/dist/theory/index.mjs +256 -21
- package/package.json +4 -5
- package/dist/chunk-IUXO5M6R.mjs +0 -37
- package/dist/chunk-VTNNVMRE.mjs +0 -267
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [6.2.0] - 2026-01-12
|
|
3
|
+
### Added
|
|
4
|
+
- `Core.getLibVersion()`
|
|
5
|
+
- `Core.getLibInfo()`
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Do not export `package.json`
|
|
9
|
+
|
|
10
|
+
## [6.1.0] - 2026-01-10
|
|
11
|
+
### Added
|
|
12
|
+
- Custom HTML elements <wms-view> and <wms-controls>.
|
|
13
|
+
- Document can be undefined in RenderContext/MusicScoreView.
|
|
14
|
+
|
|
15
|
+
### Renamed And Deprecated
|
|
16
|
+
- Score.MRenderContext (deprecated) => Score.WmsView
|
|
17
|
+
- Score.MPlaybackButtons (deprecated) => Score.WmsControls
|
|
18
|
+
- Score.MPlayer (deprecated) => Score.PLayer
|
|
19
|
+
- Score.MRenderContext (deprecated) => Score.WmsView
|
|
20
|
+
- ReactUI.MusicScoreView (deprecated) => ReactUI.WmsView
|
|
21
|
+
- ReactUI.PlaybackButtons (deprecated) => ReactUI.WmsControls
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- Fermata position.
|
|
25
|
+
|
|
2
26
|
## [6.0.1] - 2025-12-31
|
|
3
27
|
### Fixed
|
|
4
28
|
- Set rest position in tuplets if rest does not have its own staffPos.
|
package/README.md
CHANGED
|
@@ -5,32 +5,65 @@ Web Music Score is a TypeScript/JavaScript music notation web component and play
|
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
8
|
+
npm install web-music-score
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Example
|
|
12
|
-
```ts
|
|
13
|
-
import * as Score from "web-music-score/score";
|
|
14
12
|
|
|
13
|
+
Here are simple snippets to give an overview about usage of this lib.
|
|
14
|
+
|
|
15
|
+
### Create Document
|
|
16
|
+
|
|
17
|
+
```ts
|
|
15
18
|
const doc = new Score.DocumentBuilder()
|
|
16
|
-
.setScoreConfiguration("
|
|
17
|
-
.addMeasure()
|
|
19
|
+
.setScoreConfiguration("treble")
|
|
18
20
|
.setKeySignature("C Major")
|
|
19
21
|
.setTimeSignature("3/4")
|
|
20
|
-
.addNote(0, "C4", "4n")
|
|
21
|
-
.
|
|
22
|
-
.
|
|
23
|
-
.endSong()
|
|
22
|
+
.addNote(0, ["C4", "E4", "G4"], "4n")
|
|
23
|
+
.addMeasure()
|
|
24
|
+
.addChord(0, ["C4", "E4", "G4"], "2.", { arpeggio: true })
|
|
24
25
|
.getDocument();
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Render With JSX/TSX And React
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import * as Score from "web-music-score/score";
|
|
32
|
+
import * as ReactUI from "web-music-score/react-ui";
|
|
33
|
+
|
|
34
|
+
function render() {
|
|
35
|
+
return <ReactUI.WmsView doc={doc} />;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Render With Custom HTML Element
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script src="https://unpkg.com/web-music-score@6.2.0/dist/iife/index.js"></script>
|
|
43
|
+
|
|
44
|
+
<wms-view id="view1"></wms-view>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
const { Score } = window.WebMusicScore;
|
|
48
|
+
|
|
49
|
+
doc.bindElement("view1");
|
|
50
|
+
</script>
|
|
51
|
+
```
|
|
52
|
+
### Render With Plain JavaScript
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<script src="https://unpkg.com/web-music-score@6.2.0/dist/iife/index.js"></script>
|
|
56
|
+
|
|
57
|
+
<canvas id="canvas1"></canvas><br />
|
|
25
58
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
setDocument(doc).
|
|
29
|
-
draw();
|
|
59
|
+
<script>
|
|
60
|
+
const { Score } = window.WebMusicScore;
|
|
30
61
|
|
|
31
|
-
new Score.
|
|
32
|
-
|
|
33
|
-
|
|
62
|
+
new Score.WmsView()
|
|
63
|
+
.setCanvas("canvas1")
|
|
64
|
+
.setDocument(doc)
|
|
65
|
+
.draw();
|
|
66
|
+
</script>
|
|
34
67
|
```
|
|
35
68
|
|
|
36
69
|
## Report a Bug
|
package/dist/audio/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
/* WebMusicScore v6.0
|
|
1
|
+
/* WebMusicScore v6.2.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;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
8
|
+
var __typeError = (msg) => {
|
|
9
|
+
throw TypeError(msg);
|
|
10
|
+
};
|
|
7
11
|
var __export = (target, all) => {
|
|
8
12
|
for (var name in all)
|
|
9
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,6 +21,38 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
21
|
return to;
|
|
18
22
|
};
|
|
19
23
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
24
|
+
var __await = function(promise, isYieldStar) {
|
|
25
|
+
this[0] = promise;
|
|
26
|
+
this[1] = isYieldStar;
|
|
27
|
+
};
|
|
28
|
+
var __yieldStar = (value) => {
|
|
29
|
+
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
|
|
30
|
+
if (obj == null) {
|
|
31
|
+
obj = value[__knownSymbol("iterator")]();
|
|
32
|
+
method = (k) => it[k] = (x) => obj[k](x);
|
|
33
|
+
} else {
|
|
34
|
+
obj = obj.call(value);
|
|
35
|
+
method = (k) => it[k] = (v) => {
|
|
36
|
+
if (isAwait) {
|
|
37
|
+
isAwait = false;
|
|
38
|
+
if (k === "throw") throw v;
|
|
39
|
+
return v;
|
|
40
|
+
}
|
|
41
|
+
isAwait = true;
|
|
42
|
+
return {
|
|
43
|
+
done: false,
|
|
44
|
+
value: new __await(new Promise((resolve) => {
|
|
45
|
+
var x = obj[k](v);
|
|
46
|
+
if (!(x instanceof Object)) __typeError("Object expected");
|
|
47
|
+
resolve(x);
|
|
48
|
+
}), 1)
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
|
|
53
|
+
throw x;
|
|
54
|
+
}, "return" in obj && method("return"), it;
|
|
55
|
+
};
|
|
20
56
|
|
|
21
57
|
// src/audio/index.ts
|
|
22
58
|
var audio_exports = {};
|
|
@@ -44,10 +80,12 @@ function linearToDecibels(linearVolume) {
|
|
|
44
80
|
|
|
45
81
|
// node_modules/@tspro/ts-utils-lib/dist/index.mjs
|
|
46
82
|
var __defProp2 = Object.defineProperty;
|
|
83
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
47
84
|
var __export2 = (target, all) => {
|
|
48
85
|
for (var name in all)
|
|
49
86
|
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
50
87
|
};
|
|
88
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
51
89
|
var assert_exports = {};
|
|
52
90
|
__export2(assert_exports, {
|
|
53
91
|
assert: () => assert,
|
|
@@ -1238,26 +1276,39 @@ function eraseAll() {
|
|
|
1238
1276
|
var device_exports = {};
|
|
1239
1277
|
__export2(device_exports, {
|
|
1240
1278
|
DPI: () => DPI,
|
|
1279
|
+
DevicePixelRatio: () => DevicePixelRatio,
|
|
1241
1280
|
FontSize: () => FontSize,
|
|
1242
1281
|
HostAddress: () => HostAddress,
|
|
1243
1282
|
IsMobileDevice: () => IsMobileDevice,
|
|
1244
1283
|
IsTouchDevice: () => IsTouchDevice,
|
|
1245
|
-
PxPerMm: () => PxPerMm,
|
|
1246
1284
|
ScrollbarWidth: () => ScrollbarWidth,
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1285
|
+
pxToUnit: () => pxToUnit,
|
|
1286
|
+
pxToUnitStr: () => pxToUnitStr,
|
|
1287
|
+
unitToPx: () => unitToPx
|
|
1250
1288
|
});
|
|
1251
|
-
|
|
1289
|
+
var CSS_UNIT_RE = /^\s*([+-]?\d*\.?\d+)\s*(px|cm|mm|in|pt|pc|em|rem|vw|vh|vmin|vmax|%)?\s*$/;
|
|
1290
|
+
function parseCssUnit(input) {
|
|
1291
|
+
var _a;
|
|
1292
|
+
const m = CSS_UNIT_RE.exec(input);
|
|
1293
|
+
if (!m) return void 0;
|
|
1294
|
+
return {
|
|
1295
|
+
value: Number(m[1]),
|
|
1296
|
+
unit: (_a = m[2]) != null ? _a : void 0
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
function getDevicePixelRatio() {
|
|
1300
|
+
return typeof window === "undefined" ? 1 : window.devicePixelRatio;
|
|
1301
|
+
}
|
|
1302
|
+
function getPxPerUnit(unit, _default) {
|
|
1252
1303
|
try {
|
|
1253
1304
|
let el = document.createElement("div");
|
|
1254
|
-
el.style.width = "
|
|
1305
|
+
el.style.width = "1" + unit;
|
|
1255
1306
|
document.body.appendChild(el);
|
|
1256
1307
|
let dpi = el.offsetWidth;
|
|
1257
1308
|
el.remove();
|
|
1258
|
-
return dpi ||
|
|
1309
|
+
return dpi || _default;
|
|
1259
1310
|
} catch (e) {
|
|
1260
|
-
return
|
|
1311
|
+
return _default;
|
|
1261
1312
|
}
|
|
1262
1313
|
}
|
|
1263
1314
|
function getScrollBarWidth() {
|
|
@@ -1315,55 +1366,60 @@ function getHostAddress() {
|
|
|
1315
1366
|
}
|
|
1316
1367
|
return `${location.protocol}//${location.host}`;
|
|
1317
1368
|
}
|
|
1318
|
-
var UnitRegExp = /^(mm|cm|in|inch|px|em)$/;
|
|
1319
|
-
var ValueUnitRegExp = /^([0-9\\.]+)(.*)$/;
|
|
1320
|
-
var DPI = getDPI();
|
|
1321
|
-
var PxPerMm = DPI / 25.4;
|
|
1322
1369
|
var ScrollbarWidth = getScrollBarWidth();
|
|
1323
1370
|
var FontSize = getSystemFontSize();
|
|
1324
1371
|
var IsTouchDevice = getIsTouchDevice();
|
|
1325
1372
|
var IsMobileDevice = getIsMobileDevice();
|
|
1326
1373
|
var HostAddress = getHostAddress();
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
function
|
|
1334
|
-
if (typeof
|
|
1335
|
-
return
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
value = parseFloat(match[1]);
|
|
1342
|
-
let unitStr = match[2] ? match[2].toLowerCase() : "undefined";
|
|
1343
|
-
let unitStrOk = UnitRegExp.test(unitStr);
|
|
1344
|
-
unit = unitStrOk ? unitStr : void 0;
|
|
1345
|
-
if (!unit) {
|
|
1346
|
-
console.log("Unknown unit '" + unitStr + "' => using 'px'.");
|
|
1347
|
-
}
|
|
1348
|
-
} else {
|
|
1349
|
-
value = parseFloat(input);
|
|
1350
|
-
}
|
|
1351
|
-
assert_exports.isFinite(value, "value in function toPx");
|
|
1374
|
+
var DevicePixelRatio = getDevicePixelRatio();
|
|
1375
|
+
var DPI = getPxPerUnit("in", 96);
|
|
1376
|
+
var PxPerIn = getPxPerUnit("in", 96);
|
|
1377
|
+
var PxPerMm = getPxPerUnit("mm", 96 / 25.4);
|
|
1378
|
+
var PxPerCm = getPxPerUnit("cm", 96 / 25.4 * 10);
|
|
1379
|
+
var PxPerEm = getPxPerUnit("em", FontSize);
|
|
1380
|
+
function unitToPx(valueUnit) {
|
|
1381
|
+
if (typeof valueUnit === "number")
|
|
1382
|
+
return valueUnit;
|
|
1383
|
+
const p = parseCssUnit(valueUnit);
|
|
1384
|
+
const value = p == null ? void 0 : p.value;
|
|
1385
|
+
const unit = p == null ? void 0 : p.unit;
|
|
1386
|
+
if (!guard_exports.isFinite(value))
|
|
1387
|
+
assert_exports.fail(`Invalid value: ${value}`);
|
|
1352
1388
|
switch (unit) {
|
|
1353
1389
|
case "mm":
|
|
1354
|
-
return
|
|
1390
|
+
return value * PxPerMm;
|
|
1355
1391
|
case "cm":
|
|
1356
|
-
return
|
|
1392
|
+
return value * PxPerCm;
|
|
1357
1393
|
case "in":
|
|
1358
|
-
|
|
1359
|
-
return mmToPx(value) * 25.4;
|
|
1394
|
+
return value * PxPerIn;
|
|
1360
1395
|
case "em":
|
|
1361
|
-
return
|
|
1362
|
-
default:
|
|
1396
|
+
return value * PxPerEm;
|
|
1363
1397
|
case "px":
|
|
1398
|
+
case void 0:
|
|
1364
1399
|
return value;
|
|
1400
|
+
default:
|
|
1401
|
+
assert_exports.fail(`Unsupported CssUnit: ${unit}`);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
function pxToUnit(px, unit) {
|
|
1405
|
+
switch (unit) {
|
|
1406
|
+
case "mm":
|
|
1407
|
+
return px / PxPerMm;
|
|
1408
|
+
case "cm":
|
|
1409
|
+
return px / PxPerCm;
|
|
1410
|
+
case "em":
|
|
1411
|
+
return px / PxPerEm;
|
|
1412
|
+
case "in":
|
|
1413
|
+
return px / PxPerIn;
|
|
1414
|
+
case "px":
|
|
1415
|
+
return px;
|
|
1416
|
+
default:
|
|
1417
|
+
assert_exports.fail(`Unsupported CssUnit: ${unit}`);
|
|
1365
1418
|
}
|
|
1366
1419
|
}
|
|
1420
|
+
function pxToUnitStr(px, unit) {
|
|
1421
|
+
return `${pxToUnit(px, unit)}${unit}`;
|
|
1422
|
+
}
|
|
1367
1423
|
var utils_exports = {};
|
|
1368
1424
|
__export2(utils_exports, {
|
|
1369
1425
|
Arr: () => arr_exports,
|
|
@@ -1473,8 +1529,8 @@ function _getElemById(id) {
|
|
|
1473
1529
|
var _a;
|
|
1474
1530
|
return typeof document === "undefined" ? void 0 : (_a = document.getElementById(id)) != null ? _a : void 0;
|
|
1475
1531
|
}
|
|
1476
|
-
function
|
|
1477
|
-
return value === void 0 ? void 0 : device_exports.
|
|
1532
|
+
function toPx(value) {
|
|
1533
|
+
return value === void 0 ? void 0 : device_exports.unitToPx(value);
|
|
1478
1534
|
}
|
|
1479
1535
|
function hasClass(el, className) {
|
|
1480
1536
|
if (className.length === 0) {
|
|
@@ -1571,38 +1627,38 @@ function getPadding(style) {
|
|
|
1571
1627
|
if (!style) {
|
|
1572
1628
|
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
1573
1629
|
}
|
|
1574
|
-
let top =
|
|
1575
|
-
let right =
|
|
1576
|
-
let bottom =
|
|
1577
|
-
let left =
|
|
1630
|
+
let top = toPx(style.paddingTop);
|
|
1631
|
+
let right = toPx(style.paddingRight);
|
|
1632
|
+
let bottom = toPx(style.paddingBottom);
|
|
1633
|
+
let left = toPx(style.paddingLeft);
|
|
1578
1634
|
let padding = ((_a = style.padding) != null ? _a : "").toString().split(" ").filter((s) => s.length > 0);
|
|
1579
1635
|
switch (padding.length) {
|
|
1580
1636
|
case 0:
|
|
1581
1637
|
break;
|
|
1582
1638
|
case 1:
|
|
1583
|
-
top != null ? top : top =
|
|
1584
|
-
right != null ? right : right =
|
|
1585
|
-
bottom != null ? bottom : bottom =
|
|
1586
|
-
left != null ? left : left =
|
|
1639
|
+
top != null ? top : top = toPx(padding[0]);
|
|
1640
|
+
right != null ? right : right = toPx(padding[0]);
|
|
1641
|
+
bottom != null ? bottom : bottom = toPx(padding[0]);
|
|
1642
|
+
left != null ? left : left = toPx(padding[0]);
|
|
1587
1643
|
break;
|
|
1588
1644
|
case 2:
|
|
1589
|
-
top != null ? top : top =
|
|
1590
|
-
right != null ? right : right =
|
|
1591
|
-
bottom != null ? bottom : bottom =
|
|
1592
|
-
left != null ? left : left =
|
|
1645
|
+
top != null ? top : top = toPx(padding[0]);
|
|
1646
|
+
right != null ? right : right = toPx(padding[1]);
|
|
1647
|
+
bottom != null ? bottom : bottom = toPx(padding[0]);
|
|
1648
|
+
left != null ? left : left = toPx(padding[1]);
|
|
1593
1649
|
break;
|
|
1594
1650
|
case 3:
|
|
1595
|
-
top != null ? top : top =
|
|
1596
|
-
right != null ? right : right =
|
|
1597
|
-
bottom != null ? bottom : bottom =
|
|
1598
|
-
left != null ? left : left =
|
|
1651
|
+
top != null ? top : top = toPx(padding[0]);
|
|
1652
|
+
right != null ? right : right = toPx(padding[1]);
|
|
1653
|
+
bottom != null ? bottom : bottom = toPx(padding[2]);
|
|
1654
|
+
left != null ? left : left = toPx(padding[1]);
|
|
1599
1655
|
break;
|
|
1600
1656
|
case 4:
|
|
1601
1657
|
default:
|
|
1602
|
-
top != null ? top : top =
|
|
1603
|
-
right != null ? right : right =
|
|
1604
|
-
bottom != null ? bottom : bottom =
|
|
1605
|
-
left != null ? left : left =
|
|
1658
|
+
top != null ? top : top = toPx(padding[0]);
|
|
1659
|
+
right != null ? right : right = toPx(padding[1]);
|
|
1660
|
+
bottom != null ? bottom : bottom = toPx(padding[2]);
|
|
1661
|
+
left != null ? left : left = toPx(padding[3]);
|
|
1606
1662
|
break;
|
|
1607
1663
|
}
|
|
1608
1664
|
top != null ? top : top = 0;
|
|
@@ -1612,12 +1668,12 @@ function getPadding(style) {
|
|
|
1612
1668
|
return { top, right, bottom, left };
|
|
1613
1669
|
}
|
|
1614
1670
|
function getDimension(style) {
|
|
1615
|
-
let left =
|
|
1616
|
-
let right =
|
|
1617
|
-
let top =
|
|
1618
|
-
let bottom =
|
|
1619
|
-
let width =
|
|
1620
|
-
let height =
|
|
1671
|
+
let left = toPx(style == null ? void 0 : style.left);
|
|
1672
|
+
let right = toPx(style == null ? void 0 : style.right);
|
|
1673
|
+
let top = toPx(style == null ? void 0 : style.top);
|
|
1674
|
+
let bottom = toPx(style == null ? void 0 : style.bottom);
|
|
1675
|
+
let width = toPx(style == null ? void 0 : style.width);
|
|
1676
|
+
let height = toPx(style == null ? void 0 : style.height);
|
|
1621
1677
|
if (width === void 0 && left !== void 0 && right !== void 0) {
|
|
1622
1678
|
width = right - left;
|
|
1623
1679
|
}
|
|
@@ -1776,6 +1832,223 @@ function avg(...values) {
|
|
|
1776
1832
|
function cmp(a, b) {
|
|
1777
1833
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
1778
1834
|
}
|
|
1835
|
+
var DefaultEqualityFn = (a, b) => a === b;
|
|
1836
|
+
var BaseContainer = class {
|
|
1837
|
+
};
|
|
1838
|
+
var UniMap = class _UniMap extends BaseContainer {
|
|
1839
|
+
constructor(...args) {
|
|
1840
|
+
super();
|
|
1841
|
+
__publicField(this, "map");
|
|
1842
|
+
__publicField(this, "keyEquals");
|
|
1843
|
+
const maybeEquals = args.at(-1);
|
|
1844
|
+
this.keyEquals = isFunction(maybeEquals) ? args.pop() : DefaultEqualityFn;
|
|
1845
|
+
const entries = args[0];
|
|
1846
|
+
this.map = new Map(entries);
|
|
1847
|
+
}
|
|
1848
|
+
static createDeep(arg) {
|
|
1849
|
+
return arg ? new _UniMap(arg, isDeepEqual) : new _UniMap(isDeepEqual);
|
|
1850
|
+
}
|
|
1851
|
+
has(key) {
|
|
1852
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key))
|
|
1853
|
+
return this.map.has(key);
|
|
1854
|
+
for (const [k, v] of this.map)
|
|
1855
|
+
if (this.keyEquals(k, key))
|
|
1856
|
+
return true;
|
|
1857
|
+
return false;
|
|
1858
|
+
}
|
|
1859
|
+
set(key, value) {
|
|
1860
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key)) {
|
|
1861
|
+
this.map.set(key, value);
|
|
1862
|
+
return value;
|
|
1863
|
+
}
|
|
1864
|
+
for (const key2 of this.map.keys())
|
|
1865
|
+
if (this.keyEquals(key2, key)) {
|
|
1866
|
+
this.map.set(key2, value);
|
|
1867
|
+
return value;
|
|
1868
|
+
}
|
|
1869
|
+
this.map.set(key, value);
|
|
1870
|
+
return value;
|
|
1871
|
+
}
|
|
1872
|
+
get(key) {
|
|
1873
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key))
|
|
1874
|
+
return this.map.get(key);
|
|
1875
|
+
for (const [k, v] of this.map)
|
|
1876
|
+
if (this.keyEquals(k, key))
|
|
1877
|
+
return v;
|
|
1878
|
+
return void 0;
|
|
1879
|
+
}
|
|
1880
|
+
delete(key) {
|
|
1881
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key))
|
|
1882
|
+
return this.map.delete(key);
|
|
1883
|
+
for (const k of this.map.keys())
|
|
1884
|
+
if (this.keyEquals(k, key))
|
|
1885
|
+
return this.map.delete(k);
|
|
1886
|
+
return this.map.delete(key);
|
|
1887
|
+
}
|
|
1888
|
+
getOrDefault(key, defaultValue) {
|
|
1889
|
+
var _a;
|
|
1890
|
+
return (_a = this.get(key)) != null ? _a : defaultValue;
|
|
1891
|
+
}
|
|
1892
|
+
getOrCreate(key, creatorOrValue) {
|
|
1893
|
+
if (!this.has(key)) {
|
|
1894
|
+
const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
|
|
1895
|
+
return this.set(key, value);
|
|
1896
|
+
}
|
|
1897
|
+
return this.get(key);
|
|
1898
|
+
}
|
|
1899
|
+
clear() {
|
|
1900
|
+
this.map.clear();
|
|
1901
|
+
}
|
|
1902
|
+
get size() {
|
|
1903
|
+
return this.map.size;
|
|
1904
|
+
}
|
|
1905
|
+
isEmpty() {
|
|
1906
|
+
return this.size === 0;
|
|
1907
|
+
}
|
|
1908
|
+
forEach(callbackfn, thisArg) {
|
|
1909
|
+
this.map.forEach((value, key) => callbackfn.call(thisArg, value, key, this));
|
|
1910
|
+
}
|
|
1911
|
+
*keys() {
|
|
1912
|
+
yield* __yieldStar(this.map.keys());
|
|
1913
|
+
}
|
|
1914
|
+
*values() {
|
|
1915
|
+
yield* __yieldStar(this.map.values());
|
|
1916
|
+
}
|
|
1917
|
+
*entries() {
|
|
1918
|
+
for (const [key, value] of this.map)
|
|
1919
|
+
yield [key, value];
|
|
1920
|
+
}
|
|
1921
|
+
keysArray() {
|
|
1922
|
+
return [...this.keys()];
|
|
1923
|
+
}
|
|
1924
|
+
valuesArray() {
|
|
1925
|
+
return [...this.values()];
|
|
1926
|
+
}
|
|
1927
|
+
entriesArray() {
|
|
1928
|
+
return [...this.entries()];
|
|
1929
|
+
}
|
|
1930
|
+
*kvKeys() {
|
|
1931
|
+
for (const key of this.keys()) {
|
|
1932
|
+
yield [key];
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
*kvValues() {
|
|
1936
|
+
for (const el of this.values()) {
|
|
1937
|
+
yield el;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
*kvEntries() {
|
|
1941
|
+
for (const [key, el] of this.entries()) {
|
|
1942
|
+
yield [[key], el];
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
*[Symbol.iterator]() {
|
|
1946
|
+
yield* __yieldStar(this.entries());
|
|
1947
|
+
}
|
|
1948
|
+
clone() {
|
|
1949
|
+
return new _UniMap(this, this.keyEquals);
|
|
1950
|
+
}
|
|
1951
|
+
merge(other, conflictResolver) {
|
|
1952
|
+
for (const [key, value] of other.entries()) {
|
|
1953
|
+
if (this.has(key) && conflictResolver) {
|
|
1954
|
+
this.set(key, conflictResolver(this.get(key), value, key));
|
|
1955
|
+
} else {
|
|
1956
|
+
this.set(key, value);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
return this;
|
|
1960
|
+
}
|
|
1961
|
+
some(fn) {
|
|
1962
|
+
for (const [key, value] of this.map) {
|
|
1963
|
+
if (fn(value, key)) return true;
|
|
1964
|
+
}
|
|
1965
|
+
return false;
|
|
1966
|
+
}
|
|
1967
|
+
every(fn) {
|
|
1968
|
+
for (const [key, value] of this.map) {
|
|
1969
|
+
if (!fn(value, key)) return false;
|
|
1970
|
+
}
|
|
1971
|
+
return true;
|
|
1972
|
+
}
|
|
1973
|
+
filter(predicate) {
|
|
1974
|
+
const result = new this.constructor();
|
|
1975
|
+
for (const [key, value] of this.map) {
|
|
1976
|
+
if (predicate(value, key, this)) result.set(key, value);
|
|
1977
|
+
}
|
|
1978
|
+
return result;
|
|
1979
|
+
}
|
|
1980
|
+
reduce(fn, init) {
|
|
1981
|
+
let iterator = this.entries();
|
|
1982
|
+
let first = iterator.next();
|
|
1983
|
+
if (first.done) {
|
|
1984
|
+
if (arguments.length < 2) {
|
|
1985
|
+
throw new TypeError("Reduce of empty UniMap with no initial value!");
|
|
1986
|
+
}
|
|
1987
|
+
return init;
|
|
1988
|
+
}
|
|
1989
|
+
let acc;
|
|
1990
|
+
let start;
|
|
1991
|
+
if (arguments.length < 2) {
|
|
1992
|
+
acc = first.value[1];
|
|
1993
|
+
start = iterator.next();
|
|
1994
|
+
} else {
|
|
1995
|
+
acc = init;
|
|
1996
|
+
start = first;
|
|
1997
|
+
}
|
|
1998
|
+
for (let current = start; !current.done; current = iterator.next()) {
|
|
1999
|
+
const [key, value] = current.value;
|
|
2000
|
+
acc = fn(acc, value, key);
|
|
2001
|
+
}
|
|
2002
|
+
return acc;
|
|
2003
|
+
}
|
|
2004
|
+
mapEntries(fn) {
|
|
2005
|
+
let result = [];
|
|
2006
|
+
for (const [key, value] of this.map) {
|
|
2007
|
+
result.push(fn(value, key));
|
|
2008
|
+
}
|
|
2009
|
+
return result;
|
|
2010
|
+
}
|
|
2011
|
+
mapValues(fn) {
|
|
2012
|
+
let result = new _UniMap();
|
|
2013
|
+
for (const [key, value] of this.map) {
|
|
2014
|
+
result.set(key, fn(value, key));
|
|
2015
|
+
}
|
|
2016
|
+
return result;
|
|
2017
|
+
}
|
|
2018
|
+
toMap() {
|
|
2019
|
+
return new Map(this.map);
|
|
2020
|
+
}
|
|
2021
|
+
toString() {
|
|
2022
|
+
const entries = [...this.map].map(([k, v]) => `${stringify(k)} => ${stringify(v)}`).join(", ");
|
|
2023
|
+
return entries.length === 0 ? `Map(${this.size}){ }` : `Map(${this.size}){ ${entries} }`;
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
var _CallTracker = class _CallTracker2 {
|
|
2027
|
+
constructor() {
|
|
2028
|
+
__publicField(this, "counts", new UniMap((a, b) => a === b));
|
|
2029
|
+
}
|
|
2030
|
+
track(value) {
|
|
2031
|
+
const count = this.counts.getOrCreate(value, 0);
|
|
2032
|
+
this.counts.set(value, count + 1);
|
|
2033
|
+
}
|
|
2034
|
+
getCallCountFor(value) {
|
|
2035
|
+
var _a;
|
|
2036
|
+
return (_a = this.counts.get(value)) != null ? _a : 0;
|
|
2037
|
+
}
|
|
2038
|
+
hasBeenCalledWith(value) {
|
|
2039
|
+
return this.getCallCountFor(value) > 0;
|
|
2040
|
+
}
|
|
2041
|
+
static track(value) {
|
|
2042
|
+
this._default.track(value);
|
|
2043
|
+
}
|
|
2044
|
+
static getCallCountFor(value) {
|
|
2045
|
+
return this._default.getCallCountFor(value);
|
|
2046
|
+
}
|
|
2047
|
+
static hasBeenCalledWith(value) {
|
|
2048
|
+
return this._default.hasBeenCalledWith(value);
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
__publicField(_CallTracker, "_default", new _CallTracker());
|
|
1779
2052
|
|
|
1780
2053
|
// src/audio/index.ts
|
|
1781
2054
|
(0, import_core.init)();
|
|
@@ -1860,7 +2133,7 @@ function isMuted() {
|
|
|
1860
2133
|
|
|
1861
2134
|
@tspro/ts-utils-lib/dist/index.mjs:
|
|
1862
2135
|
(*!
|
|
1863
|
-
* TsUtilsLib
|
|
2136
|
+
* TsUtilsLib v3.1.1 (esm)
|
|
1864
2137
|
* (c) 2023-2025 PahkaSoft
|
|
1865
2138
|
* Licensed under the MIT License
|
|
1866
2139
|
*)
|
package/dist/audio/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/* WebMusicScore v6.0
|
|
1
|
+
/* WebMusicScore v6.2.0 | (c) 2023-2025 Stefan Brockmann | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
linearToDecibels
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-V5OCPI6U.mjs";
|
|
5
5
|
import {
|
|
6
6
|
guard_exports,
|
|
7
7
|
utils_exports
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-TZTJWSNU.mjs";
|
|
9
|
+
import "../chunk-IUGL627R.mjs";
|
|
10
10
|
|
|
11
11
|
// src/audio/index.ts
|
|
12
12
|
import { Note, PitchNotation, SymbolSet } from "web-music-score/theory";
|
package/dist/audio-cg/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v6.0
|
|
1
|
+
/* WebMusicScore v6.2.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 __defProps = Object.defineProperties;
|