@mcqj/vexflow 0.0.1-alpha.5 → 0.0.1-alpha.7
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/README.md +15 -1
- 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 +5 -5
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +5 -5
- 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 +5 -12
- package/build/esm/src/version.js +2 -2
- package/build/esm/tests/formatter_tests.js +9 -4
- package/build/playwright-report/index.html +49 -0
- package/package.json +1 -1
|
@@ -6,16 +6,13 @@ import { Stave } from './stave.js';
|
|
|
6
6
|
import { StaveConnector } from './staveconnector.js';
|
|
7
7
|
import { Tables } from './tables.js';
|
|
8
8
|
import { TickContext } from './tickcontext.js';
|
|
9
|
-
import {
|
|
9
|
+
import { isNote, isStaveNote } from './typeguard.js';
|
|
10
10
|
import { defined, log, midLine, RuntimeError, sumArray } from './util.js';
|
|
11
11
|
import { Voice } from './voice.js';
|
|
12
12
|
function L(...args) {
|
|
13
13
|
if (Formatter.DEBUG)
|
|
14
14
|
log('VexFlow.Formatter', args);
|
|
15
15
|
}
|
|
16
|
-
function isBarNote(tickable) {
|
|
17
|
-
return isCategory(tickable, "BarNote");
|
|
18
|
-
}
|
|
19
16
|
function getRestLineForNextNoteGroup(notes, currRestLine, currNoteIndex, compare) {
|
|
20
17
|
let nextRestLine = currRestLine;
|
|
21
18
|
for (let noteIndex = currNoteIndex + 1; noteIndex < notes.length; noteIndex++) {
|
|
@@ -252,9 +249,7 @@ export class Formatter {
|
|
|
252
249
|
staveTickToContextMap[integerTicks] = newContext;
|
|
253
250
|
}
|
|
254
251
|
tickable.addToModifierContext(staveTickToContextMap[integerTicks]);
|
|
255
|
-
|
|
256
|
-
ticksUsed.add(tickable.getTicks());
|
|
257
|
-
}
|
|
252
|
+
ticksUsed.add(tickable.getTicks());
|
|
258
253
|
});
|
|
259
254
|
});
|
|
260
255
|
this.modifierContexts.push({
|
|
@@ -288,9 +283,7 @@ export class Formatter {
|
|
|
288
283
|
}
|
|
289
284
|
const tickContext = tickToContextMap[integerTicks];
|
|
290
285
|
tickContext.addTickable(tickable, voiceIndex, voice.isDependent());
|
|
291
|
-
|
|
292
|
-
ticksUsed.add(tickable.getTicks());
|
|
293
|
-
}
|
|
286
|
+
ticksUsed.add(tickable.getTicks());
|
|
294
287
|
});
|
|
295
288
|
});
|
|
296
289
|
const contexts = {
|
|
@@ -402,9 +395,9 @@ export class Formatter {
|
|
|
402
395
|
let spaceAccum = 0;
|
|
403
396
|
contextList.forEach((tick, index) => {
|
|
404
397
|
const context = contextMap[tick];
|
|
405
|
-
|
|
398
|
+
const ideal = idealDistances[index];
|
|
399
|
+
if (index > 0 && ideal.fromTickable) {
|
|
406
400
|
const contextX = context.getX();
|
|
407
|
-
const ideal = idealDistances[index];
|
|
408
401
|
const errorPx = defined(ideal.fromTickable).getX() + ideal.expectedDistance - (contextX + spaceAccum);
|
|
409
402
|
let negativeShiftPx = 0;
|
|
410
403
|
if (errorPx > 0) {
|
package/build/esm/src/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const VERSION = '0.0.1-alpha.
|
|
1
|
+
export const VERSION = '0.0.1-alpha.7';
|
|
2
2
|
export const ID = 'a4bb5ff157f4570b2d6149b7199b0baa4c7e3775';
|
|
3
|
-
export const DATE = '2026-09-
|
|
3
|
+
export const DATE = '2026-09-14T16:33:09.139Z';
|
|
@@ -84,18 +84,23 @@ function getGlyphWidth(glyph) {
|
|
|
84
84
|
return el.getWidth();
|
|
85
85
|
}
|
|
86
86
|
function ignoredBarNotesPreserveLyricTickAlignment(assert) {
|
|
87
|
-
const musicNotes =
|
|
87
|
+
const musicNotes = [
|
|
88
|
+
...Array.from({ length: 6 }, () => new StaveNote({ keys: ['c/4'], duration: '8' })),
|
|
89
|
+
new BarNote(),
|
|
90
|
+
...Array.from({ length: 6 }, () => new StaveNote({ keys: ['c/4'], duration: '8' })),
|
|
91
|
+
];
|
|
88
92
|
const when = new TextNote({ text: 'When', duration: '8' });
|
|
89
93
|
const lyricNotes = [
|
|
90
94
|
...Array.from({ length: 6 }, () => new GhostNote({ duration: '8' })),
|
|
91
|
-
new
|
|
95
|
+
new GhostNote({ duration: 'b' }),
|
|
92
96
|
when,
|
|
93
97
|
...Array.from({ length: 5 }, () => new TextNote({ text: '', duration: '8' })),
|
|
94
98
|
];
|
|
95
99
|
const musicVoice = new Voice({ numBeats: 6, beatValue: 4 }).addTickables(musicNotes);
|
|
96
|
-
const lyricVoice = new Voice({ numBeats: 6, beatValue: 4 }).addTickables(lyricNotes);
|
|
100
|
+
const lyricVoice = new Voice({ numBeats: 6, beatValue: 4 }).setMode(Voice.Mode.SOFT).addTickables(lyricNotes);
|
|
97
101
|
new Formatter().joinVoices([musicVoice, lyricVoice]).format([musicVoice, lyricVoice], 500);
|
|
98
|
-
assert.
|
|
102
|
+
assert.notStrictEqual(musicNotes[6].getTickContext(), musicNotes[7].getTickContext());
|
|
103
|
+
assert.strictEqual(when.getTickContext(), musicNotes[7].getTickContext());
|
|
99
104
|
}
|
|
100
105
|
function dependentVoicesDoNotAffectMusicLayout(assert) {
|
|
101
106
|
const makeMusicNotes = () => Array.from({ length: 4 }, () => new StaveNote({ keys: ['c/4'], duration: '4' }));
|