@mcqj/vexflow 0.0.1-alpha.8 → 0.0.1-alpha.9
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/build/cjs/vexflow-bravura.js +1 -1
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +1 -1
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +54 -7
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +23 -7
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +1 -1
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/formatter.js +26 -2
- package/build/esm/src/version.js +2 -2
- package/build/esm/tests/formatter_tests.js +26 -0
- package/build/playwright-artifacts/.last-run.json +4 -0
- package/build/playwright-report/index.html +49 -0
- package/build/types/src/formatter.d.ts +3 -1
- package/package.json +10 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! VexFlow 0.0.1-alpha.8 2026-11-
|
|
1
|
+
/*! VexFlow 0.0.1-alpha.8 2026-11-23T01:19:49.490Z beeb3933573a1cbf00a85d294d8524fabba6f406
|
|
2
2
|
Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/vexflow/blob/main/AUTHORS.md). */
|
|
3
3
|
(function(global, factory) {
|
|
4
4
|
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define([], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.VexFlow = factory());
|
|
@@ -14395,6 +14395,7 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
|
|
|
14395
14395
|
const contexts = this.tickContexts;
|
|
14396
14396
|
if (!contexts) throw new RuntimeError("NoTickContexts", "preFormat requires TickContexts");
|
|
14397
14397
|
const { spacingList: contextList, map: contextMap } = contexts;
|
|
14398
|
+
this.justifyWidth = justifyWidth;
|
|
14398
14399
|
this.lossHistory = [];
|
|
14399
14400
|
if (voicesParam && stave) voicesParam.forEach((voice) => voice.setStave(stave).preFormat());
|
|
14400
14401
|
let x = 0;
|
|
@@ -14533,7 +14534,6 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
|
|
|
14533
14534
|
actualWidth = shiftToIdealDistances(calculateIdealDistances(targetWidth));
|
|
14534
14535
|
iterations--;
|
|
14535
14536
|
}
|
|
14536
|
-
this.justifyWidth = justifyWidth;
|
|
14537
14537
|
this.positionDependentContexts();
|
|
14538
14538
|
return this.evaluate();
|
|
14539
14539
|
}
|
|
@@ -14543,13 +14543,21 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
|
|
|
14543
14543
|
* Dependent voices follow the layout of the other voices, so their contexts
|
|
14544
14544
|
* are not part of the spacing list. Instead, place each one between the
|
|
14545
14545
|
* surrounding spacing contexts, interpolating by tick. Contexts before the
|
|
14546
|
-
* first
|
|
14546
|
+
* first spacing context are aligned with it, and trailing contexts are
|
|
14547
|
+
* interpolated across the final note's remaining duration toward the end of
|
|
14548
|
+
* the justified layout.
|
|
14547
14549
|
*/
|
|
14548
14550
|
positionDependentContexts() {
|
|
14549
14551
|
const contexts = this.tickContexts;
|
|
14550
14552
|
if (!contexts) return;
|
|
14551
14553
|
const { spacingList, dependentList, map } = contexts;
|
|
14552
14554
|
if (spacingList.length === 0 || dependentList.length === 0) return;
|
|
14555
|
+
const firstSpacingContext = map[spacingList[0]];
|
|
14556
|
+
const lastSpacingTick = spacingList[spacingList.length - 1];
|
|
14557
|
+
const lastSpacingContext = map[lastSpacingTick];
|
|
14558
|
+
const finalTick = lastSpacingTick + lastSpacingContext.getMaxTicks().value();
|
|
14559
|
+
const centerX = this.justifyWidth > 0 ? (this.justifyWidth - lastSpacingContext.getMetrics().notePx - lastSpacingContext.getMetrics().totalRightPx - firstSpacingContext.getMetrics().totalLeftPx) / 2 : void 0;
|
|
14560
|
+
const endX = this.justifyWidth > 0 ? this.justifyWidth : void 0;
|
|
14553
14561
|
let nextIndex = 0;
|
|
14554
14562
|
dependentList.forEach((tick) => {
|
|
14555
14563
|
while (nextIndex < spacingList.length && spacingList[nextIndex] < tick) nextIndex++;
|
|
@@ -14562,8 +14570,16 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
|
|
|
14562
14570
|
const nextX = map[nextTick].getX();
|
|
14563
14571
|
const ratio = (tick - prevTick) / (nextTick - prevTick);
|
|
14564
14572
|
context.setX(prevX + (nextX - prevX) * ratio);
|
|
14565
|
-
} else if (prevTick !== void 0)
|
|
14566
|
-
|
|
14573
|
+
} else if (prevTick !== void 0) {
|
|
14574
|
+
const prevX = map[prevTick].getX();
|
|
14575
|
+
if (endX !== void 0 && finalTick > prevTick) {
|
|
14576
|
+
const ratio = Math.min(1, (tick - prevTick) / (finalTick - prevTick));
|
|
14577
|
+
context.setX(prevX + (endX - prevX) * ratio);
|
|
14578
|
+
} else context.setX(prevX);
|
|
14579
|
+
} else if (nextTick !== void 0) context.setX(map[nextTick].getX());
|
|
14580
|
+
if (centerX !== void 0) context.getCenterAlignedTickables().forEach((tickable) => {
|
|
14581
|
+
tickable.setCenterXShift(centerX - context.getX());
|
|
14582
|
+
});
|
|
14567
14583
|
});
|
|
14568
14584
|
}
|
|
14569
14585
|
/** Calculate the total cost of this formatting decision. */
|
|
@@ -18703,8 +18719,8 @@ Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/
|
|
|
18703
18719
|
};
|
|
18704
18720
|
// src/version.ts
|
|
18705
18721
|
var VERSION = "0.0.1-alpha.8";
|
|
18706
|
-
var ID = "
|
|
18707
|
-
var DATE = "2026-11-
|
|
18722
|
+
var ID = "beeb3933573a1cbf00a85d294d8524fabba6f406";
|
|
18723
|
+
var DATE = "2026-11-23T01:19:49.490Z";
|
|
18708
18724
|
// src/vexflow.ts
|
|
18709
18725
|
var VexFlow = class {
|
|
18710
18726
|
static {
|