vexflow 5.2.0 → 5.3.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/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +2759 -1382
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +1814 -1227
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/accidental.js +10 -3
- package/build/esm/src/articulation.js +24 -6
- package/build/esm/src/beam.js +158 -28
- package/build/esm/src/bend.js +24 -19
- package/build/esm/src/curve.js +27 -53
- package/build/esm/src/dot.js +13 -4
- package/build/esm/src/easyscore/composition.js +40 -1
- package/build/esm/src/easyscore/policies.js +34 -6
- package/build/esm/src/element.js +4 -0
- package/build/esm/src/engravinggeometry.js +150 -0
- package/build/esm/src/engravingprofile.js +44 -0
- package/build/esm/src/factory.js +15 -7
- package/build/esm/src/formatter.js +9 -1
- package/build/esm/src/gracenote.js +43 -38
- package/build/esm/src/gracenotegroup.js +53 -56
- package/build/esm/src/index.js +2 -0
- package/build/esm/src/keysignature.js +1 -1
- package/build/esm/src/modifiercontext.js +11 -0
- package/build/esm/src/notehead.js +11 -6
- package/build/esm/src/ornament.js +38 -18
- package/build/esm/src/proportionalformatter.js +54 -6
- package/build/esm/src/stavenote.js +128 -115
- package/build/esm/src/stavetie.js +39 -7
- package/build/esm/src/stem.js +26 -11
- package/build/esm/src/tickcontext.js +19 -0
- package/build/esm/src/timesignature.js +5 -0
- package/build/esm/src/tuplet.js +57 -17
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +4 -0
- package/build/esm/tests/bend_tests.js +14 -1
- package/build/esm/tests/curve_tests.js +14 -4
- package/build/esm/tests/demo_repertoire_tests.js +27 -0
- package/build/esm/tests/demos/drums.js +54 -0
- package/build/esm/tests/demos/electric.js +63 -0
- package/build/esm/tests/demos/greensleeves.js +90 -0
- package/build/esm/tests/demos/joy.js +61 -0
- package/build/esm/tests/demos/kesh.js +80 -0
- package/build/esm/tests/demos/prelude.js +59 -0
- package/build/esm/tests/demos/quartertones.js +50 -0
- package/build/esm/tests/demos/saints.js +65 -0
- package/build/esm/tests/engraving/score-layout.mjs +75 -0
- package/build/esm/tests/engraving/score-persistence.mjs +262 -0
- package/build/esm/tests/engraving/studies.mjs +279 -0
- package/build/esm/tests/formatter_tests.js +10 -1
- package/build/esm/tests/index.js +1 -0
- package/build/esm/tests/node/audit-dependencies-tests.mjs +42 -0
- package/build/esm/tests/node/easyscore-tests.mjs +71 -0
- package/build/esm/tests/node/engraving-layout-tests.mjs +449 -0
- package/build/esm/tests/node/local-engraving-tests.mjs +128 -0
- package/build/esm/tests/node/proportional-spacing-tests.mjs +64 -0
- package/build/esm/tests/node/rendering-tests.mjs +6 -2
- package/build/esm/tests/threevoice_tests.js +11 -1
- package/build/esm/tests/vexflow_test_helpers.js +19 -10
- package/build/esm/tools/audit-dependencies.mjs +61 -0
- package/build/esm/tools/score-fixtures.mjs +23 -6
- package/build/types/src/accidental.d.ts +4 -0
- package/build/types/src/articulation.d.ts +6 -1
- package/build/types/src/beam.d.ts +14 -0
- package/build/types/src/curve.d.ts +9 -0
- package/build/types/src/dot.d.ts +5 -0
- package/build/types/src/easyscore/composition.d.ts +19 -0
- package/build/types/src/easyscore/policies.d.ts +1 -1
- package/build/types/src/element.d.ts +2 -0
- package/build/types/src/engravinggeometry.d.ts +31 -0
- package/build/types/src/engravingprofile.d.ts +20 -0
- package/build/types/src/factory.d.ts +6 -1
- package/build/types/src/formatter.d.ts +3 -3
- package/build/types/src/gracenote.d.ts +7 -0
- package/build/types/src/gracenotegroup.d.ts +7 -2
- package/build/types/src/index.d.ts +2 -0
- package/build/types/src/modifiercontext.d.ts +4 -0
- package/build/types/src/notehead.d.ts +5 -0
- package/build/types/src/ornament.d.ts +7 -0
- package/build/types/src/proportionalformatter.d.ts +11 -2
- package/build/types/src/stavenote.d.ts +20 -2
- package/build/types/src/stavetie.d.ts +4 -0
- package/build/types/src/stem.d.ts +10 -1
- package/build/types/src/tickcontext.d.ts +5 -0
- package/build/types/src/timesignature.d.ts +2 -0
- package/build/types/src/tuplet.d.ts +5 -48
- package/build/types/src/vexflow.d.ts +4 -0
- package/changelog/CHANGELOG.md +17 -0
- package/package.json +7 -2
- package/tests/all.html +277 -0
- package/tests/demo_petzold_tests.ts +435 -0
- package/tests/demos/drums.ts +55 -0
- package/tests/demos/drums.webp +0 -0
- package/tests/demos/electric.ts +70 -0
- package/tests/demos/electric.webp +0 -0
- package/tests/demos/greensleeves.ts +97 -0
- package/tests/demos/greensleeves.webp +0 -0
- package/tests/demos/joy.ts +65 -0
- package/tests/demos/joy.webp +0 -0
- package/tests/demos/kesh.ts +86 -0
- package/tests/demos/kesh.webp +0 -0
- package/tests/demos/prelude.ts +65 -0
- package/tests/demos/prelude.webp +0 -0
- package/tests/demos/quartertones.ts +51 -0
- package/tests/demos/quartertones.webp +0 -0
- package/tests/demos/saints.ts +70 -0
- package/tests/demos/saints.webp +0 -0
- package/tests/flow.html +550 -239
- package/tests/fonts.css +493 -0
- package/tests/minuet.webp +0 -0
|
@@ -14,6 +14,8 @@ export * from './curve';
|
|
|
14
14
|
export * from './dot';
|
|
15
15
|
export * from './easyscore';
|
|
16
16
|
export * from './element';
|
|
17
|
+
export * from './engravinggeometry';
|
|
18
|
+
export * from './engravingprofile';
|
|
17
19
|
export * from './factory';
|
|
18
20
|
export * from './font';
|
|
19
21
|
export * from './flag';
|
|
@@ -45,6 +45,10 @@ export declare class ModifierContext {
|
|
|
45
45
|
getRightShift(): number;
|
|
46
46
|
/** Ties clear nearby modifiers, but must not start beyond a lyric's text box. */
|
|
47
47
|
getRightShiftForTie(): number;
|
|
48
|
+
private measuredTopLines;
|
|
49
|
+
private measuredBottomLines;
|
|
50
|
+
/** Keep the line allowance for other marks when using actual annotation ink bounds. */
|
|
51
|
+
getUnmeasuredTextLines(above: boolean): number;
|
|
48
52
|
getState(): ModifierContextState;
|
|
49
53
|
getMetrics(): ModifierContextMetrics;
|
|
50
54
|
preFormat(): void;
|
|
@@ -8,6 +8,8 @@ export interface NoteHeadStruct extends NoteStruct {
|
|
|
8
8
|
customGlyphCode?: string;
|
|
9
9
|
stemDirection?: number;
|
|
10
10
|
displaced?: boolean;
|
|
11
|
+
/** Column counted outward from the normal stem-side head. */
|
|
12
|
+
displacementColumn?: number;
|
|
11
13
|
noteType?: string;
|
|
12
14
|
x?: number;
|
|
13
15
|
y?: number;
|
|
@@ -25,6 +27,7 @@ export declare class NoteHead extends Note {
|
|
|
25
27
|
static get CATEGORY(): string;
|
|
26
28
|
protected customGlyph: boolean;
|
|
27
29
|
protected displaced: boolean;
|
|
30
|
+
private readonly displacementColumn;
|
|
28
31
|
protected stemDirection: number;
|
|
29
32
|
protected line: number;
|
|
30
33
|
protected index?: number;
|
|
@@ -41,6 +44,8 @@ export declare class NoteHead extends Note {
|
|
|
41
44
|
setLine(line: number): this;
|
|
42
45
|
/** Get the canvas `x` coordinate position of the notehead. */
|
|
43
46
|
getAbsoluteX(): number;
|
|
47
|
+
/** Offset shared by drawing, head geometry and ledger lines. */
|
|
48
|
+
getDisplacementX(): number;
|
|
44
49
|
/** Set notehead to a provided `stave`. */
|
|
45
50
|
setStave(stave: Stave): this;
|
|
46
51
|
/** Pre-render formatting. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
1
2
|
import { Element } from './element';
|
|
2
3
|
import { Modifier } from './modifier';
|
|
3
4
|
import { ModifierContextState } from './modifiercontext';
|
|
@@ -18,6 +19,8 @@ export declare class Ornament extends Modifier {
|
|
|
18
19
|
protected ornamentAlignWithNoteHead: string[] | boolean;
|
|
19
20
|
protected type: string;
|
|
20
21
|
protected delayed: boolean;
|
|
22
|
+
/** Side spacing is recomputed per format and is independent of authored shifts. */
|
|
23
|
+
private sideOffset;
|
|
21
24
|
protected adjustForStemDirection: boolean;
|
|
22
25
|
renderOptions: {
|
|
23
26
|
accidentalUpperPadding: number;
|
|
@@ -67,5 +70,9 @@ export declare class Ornament extends Modifier {
|
|
|
67
70
|
/** Set the lower accidental for the ornament. */
|
|
68
71
|
setLowerAccidental(accid: string): this;
|
|
69
72
|
/** Render ornament in position next to note. */
|
|
73
|
+
/** Recompute delayed and auxiliary positions against the current tick contexts. */
|
|
74
|
+
private positionElements;
|
|
75
|
+
/** Include both auxiliary signs in the measured ornament. */
|
|
76
|
+
getBoundingBox(): BoundingBox;
|
|
70
77
|
draw(): void;
|
|
71
78
|
}
|
|
@@ -6,6 +6,10 @@ export interface ProportionalSpacing {
|
|
|
6
6
|
/** Omit to fit the available width, or choose the minimum scale when no width is supplied. */
|
|
7
7
|
pixelsPerQuarter?: number;
|
|
8
8
|
}
|
|
9
|
+
/** Optical spacing reserves measured ink first and distributes spare width by square-root duration. */
|
|
10
|
+
export type MeasuredSpacing = ProportionalSpacing | {
|
|
11
|
+
mode: 'optical';
|
|
12
|
+
};
|
|
9
13
|
/** Build a common rational timeline without advancing time for clefs or barlines. */
|
|
10
14
|
export declare class ProportionalFormatter {
|
|
11
15
|
readonly contexts: AlignmentTickContexts;
|
|
@@ -23,8 +27,13 @@ export declare class ProportionalFormatter {
|
|
|
23
27
|
private measure;
|
|
24
28
|
/** Compute one scale and validate it before changing any anchor positions. */
|
|
25
29
|
private dimensions;
|
|
30
|
+
/** Find the earliest legal anchor at each onset. A wide mark still occupies
|
|
31
|
+
* its stave while other staves advance. Extra width can only enlarge gaps. */
|
|
32
|
+
private opticalLayout;
|
|
26
33
|
/** Minimum total width for autoWidth, honoring a supplied exact scale. */
|
|
27
|
-
minimumWidth(spacing:
|
|
34
|
+
minimumWidth(spacing: MeasuredSpacing): number;
|
|
35
|
+
/** Convert a single exact time scale into the same placement data as optical spacing. */
|
|
36
|
+
private proportionalLayout;
|
|
28
37
|
/** Place anchors and prefixes, retaining the established centering exception for measure rests. */
|
|
29
|
-
format(spacing:
|
|
38
|
+
format(spacing: MeasuredSpacing, width: number): number;
|
|
30
39
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Beam } from './beam';
|
|
2
2
|
import { BoundingBox } from './boundingbox';
|
|
3
3
|
import { ElementStyle } from './element';
|
|
4
|
+
import { EngravingProfile } from './engravingprofile';
|
|
4
5
|
import { ModifierContextState } from './modifiercontext';
|
|
5
6
|
import { Note, NoteStruct } from './note';
|
|
6
7
|
import { NoteHead } from './notehead';
|
|
7
8
|
import { Stave } from './stave';
|
|
8
|
-
import { StemOptions } from './stem';
|
|
9
|
+
import { Stem, StemOptions } from './stem';
|
|
9
10
|
import { StemmableNote } from './stemmablenote';
|
|
10
11
|
export interface StaveNoteHeadBounds {
|
|
11
12
|
yTop: number;
|
|
@@ -32,6 +33,9 @@ export interface StaveNoteFormatSettings {
|
|
|
32
33
|
note: StaveNote;
|
|
33
34
|
}
|
|
34
35
|
export interface StaveNoteStruct extends NoteStruct {
|
|
36
|
+
/** Override the music glyph family for this note, its heads and its flag. */
|
|
37
|
+
musicFont?: string;
|
|
38
|
+
engraving?: EngravingProfile;
|
|
35
39
|
/** `Stem.UP` or `Stem.DOWN`. */
|
|
36
40
|
stemDirection?: number;
|
|
37
41
|
autoStem?: boolean;
|
|
@@ -54,9 +58,11 @@ export declare class StaveNote extends StemmableNote {
|
|
|
54
58
|
protected displaced: boolean;
|
|
55
59
|
protected dotShiftY: number;
|
|
56
60
|
protected useDefaultHeadX: boolean;
|
|
61
|
+
private extraHeadColumns;
|
|
57
62
|
protected ledgerLineStyle: ElementStyle;
|
|
58
63
|
private _noteHeads;
|
|
59
64
|
private sortedKeyProps;
|
|
65
|
+
readonly engraving?: EngravingProfile;
|
|
60
66
|
constructor(noteStruct: StaveNoteStruct);
|
|
61
67
|
reset(): this;
|
|
62
68
|
setBeam(beam: Beam): this;
|
|
@@ -65,6 +71,12 @@ export declare class StaveNote extends StemmableNote {
|
|
|
65
71
|
autoStem(): void;
|
|
66
72
|
calculateOptimalStemDirection(): number;
|
|
67
73
|
calculateKeyProps(): void;
|
|
74
|
+
/** Absolute ink of each head after formatting, independent of previous draws. */
|
|
75
|
+
getHeadInk(): BoundingBox[];
|
|
76
|
+
/** Absolute flag ink; beamed notes and rests have no flag. */
|
|
77
|
+
getFlagInk(): BoundingBox | undefined;
|
|
78
|
+
/** Resolve the rendered stem before its parent writes the drawing coordinates. */
|
|
79
|
+
getStemSegment(): ReturnType<Stem['getSegment']> | undefined;
|
|
68
80
|
getBoundingBox(includeModifiers?: boolean): BoundingBox;
|
|
69
81
|
getLineNumber(isTopNote?: boolean): number;
|
|
70
82
|
/**
|
|
@@ -132,10 +144,16 @@ export declare class StaveNote extends StemmableNote {
|
|
|
132
144
|
* Get the staff line and y value for the highest & lowest noteheads
|
|
133
145
|
* @returns {noteHeadBounds}
|
|
134
146
|
*/
|
|
135
|
-
getNoteHeadBounds(): StaveNoteHeadBounds;
|
|
147
|
+
getNoteHeadBounds(layoutX?: boolean): StaveNoteHeadBounds;
|
|
136
148
|
getNoteHeadBeginX(): number;
|
|
137
149
|
getNoteHeadEndX(): number;
|
|
138
150
|
get noteHeads(): NoteHead[];
|
|
151
|
+
/** Shared ledger segments after formatting, in renderer pixels. */
|
|
152
|
+
getLedgerLines(): {
|
|
153
|
+
x: number;
|
|
154
|
+
y: number;
|
|
155
|
+
width: number;
|
|
156
|
+
}[];
|
|
139
157
|
drawLedgerLines(): void;
|
|
140
158
|
drawModifiers(noteheadParam: NoteHead): void;
|
|
141
159
|
shouldDrawFlag(): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
1
2
|
import { Element } from './element';
|
|
2
3
|
import { Note } from './note';
|
|
3
4
|
export interface TieNotes {
|
|
@@ -55,6 +56,9 @@ export declare class StaveTie extends Element {
|
|
|
55
56
|
* @param params.firstX is specified in pixels.
|
|
56
57
|
* @param params.lastX is specified in pixels.
|
|
57
58
|
*/
|
|
59
|
+
private tieCurves;
|
|
60
|
+
/** Conservative convex hull of filled ribbons, excluding optional tie text. */
|
|
61
|
+
getRibbonBounds(): BoundingBox;
|
|
58
62
|
renderTie(params: {
|
|
59
63
|
direction: number;
|
|
60
64
|
firstX: number;
|
|
@@ -45,14 +45,23 @@ export declare class Stem extends Element {
|
|
|
45
45
|
getExtension(): number;
|
|
46
46
|
setYBounds(yTop: number, yBottom: number): void;
|
|
47
47
|
getHeight(): number;
|
|
48
|
-
getBoundingBox(): BoundingBox;
|
|
49
48
|
getExtents(): {
|
|
50
49
|
topY: number;
|
|
51
50
|
baseY: number;
|
|
52
51
|
};
|
|
52
|
+
/** Whether this segment contributes ink. */
|
|
53
|
+
isVisible(): boolean;
|
|
53
54
|
setVisibility(isVisible: boolean): this;
|
|
54
55
|
setStemlet(isStemlet: boolean, stemletHeight: number): this;
|
|
55
56
|
adjustHeightForFlag(): void;
|
|
56
57
|
adjustHeightForBeam(): void;
|
|
58
|
+
/** Endpoints of the visible segment, including stemlets and flag shortening. */
|
|
59
|
+
getSegment(x?: number, adjustment?: number): {
|
|
60
|
+
x: number;
|
|
61
|
+
baseY: number;
|
|
62
|
+
tipY: number;
|
|
63
|
+
};
|
|
64
|
+
/** Bounds of the stroked segment. A hidden stem contributes no area. */
|
|
65
|
+
getBoundingBox(): BoundingBox;
|
|
57
66
|
draw(): void;
|
|
58
67
|
}
|
|
@@ -36,6 +36,11 @@ export declare class TickContext {
|
|
|
36
36
|
protected minTicks?: Fraction;
|
|
37
37
|
protected minTickable?: Tickable;
|
|
38
38
|
tContexts: TickContext[];
|
|
39
|
+
private nextAttack?;
|
|
40
|
+
/** Link musical order independently of the legacy per-voice insertion order. */
|
|
41
|
+
static linkTimeline(contexts: TickContext[]): void;
|
|
42
|
+
/** Visit only the attacks inside this beam, including interleaved voices. */
|
|
43
|
+
through(last: TickContext): Iterable<TickContext>;
|
|
39
44
|
protected preFormatted: boolean;
|
|
40
45
|
protected postFormatted: boolean;
|
|
41
46
|
protected width: number;
|
|
@@ -29,6 +29,8 @@ export declare class TimeSignature extends StaveModifier {
|
|
|
29
29
|
protected botStartX: number;
|
|
30
30
|
protected lineShift: number;
|
|
31
31
|
constructor(timeSpec?: string, customPadding?: number, validateArgs?: boolean);
|
|
32
|
+
/** Apply one family to common-time glyphs and both numeric rows, then remeasure. */
|
|
33
|
+
setMusicFont(family: string): this;
|
|
32
34
|
static getTimeSigCode(key: string, smallSig?: boolean): string;
|
|
33
35
|
/**
|
|
34
36
|
* Returns a new TimeSignatureGlyph (a Glyph subclass that knows how to draw both
|
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ## Description
|
|
3
|
-
*
|
|
4
|
-
* Create a new tuplet from the specified notes. The notes must
|
|
5
|
-
* be part of the same voice. If they are of different rhythmic
|
|
6
|
-
* values, then options.numNotes must be set.
|
|
7
|
-
*
|
|
8
|
-
* @constructor
|
|
9
|
-
* @param {Array.<VexFlow.StaveNote>} A set of notes: staveNotes,
|
|
10
|
-
* notes, etc... any class that inherits stemmableNote at some
|
|
11
|
-
* point in its prototype chain.
|
|
12
|
-
* @param options: object {
|
|
13
|
-
*
|
|
14
|
-
* numNotes: fit this many notes into...
|
|
15
|
-
* notesOccupied: ...the space of this many notes
|
|
16
|
-
*
|
|
17
|
-
* Together, these two properties make up the tuplet ratio
|
|
18
|
-
* in the form of numNotes : notesOccupied.
|
|
19
|
-
* numNotes defaults to the number of notes passed in, so
|
|
20
|
-
* it is important that if you omit this property, all of
|
|
21
|
-
* the notes passed should be of the same note value.
|
|
22
|
-
* notesOccupied defaults to 2 -- so you should almost
|
|
23
|
-
* certainly pass this parameter for anything other than
|
|
24
|
-
* a basic triplet.
|
|
25
|
-
*
|
|
26
|
-
* location:
|
|
27
|
-
* default 1, which is above the notes: ┌─── 3 ───┐
|
|
28
|
-
* -1 is below the notes └─── 3 ───┘
|
|
29
|
-
*
|
|
30
|
-
* bracketed: boolean, draw a bracket around the tuplet number
|
|
31
|
-
* when true: ┌─── 3 ───┐ when false: 3
|
|
32
|
-
* defaults to true if notes are not beamed, false otherwise
|
|
33
|
-
*
|
|
34
|
-
* ratioed: boolean
|
|
35
|
-
* when true: ┌─── 7:8 ───┐, when false: ┌─── 7 ───┐
|
|
36
|
-
* defaults to true if the difference between numNotes and
|
|
37
|
-
* notesOccupied is greater than 1.
|
|
38
|
-
*
|
|
39
|
-
* yOffset: int, default 0
|
|
40
|
-
* manually offset a tuplet, for instance to avoid collisions
|
|
41
|
-
* with articulations, etc...
|
|
42
|
-
*
|
|
43
|
-
* suffix: string
|
|
44
|
-
* suffix to show after ratio.
|
|
45
|
-
* NOTE: any of the Glyphs.met... work well for note glyphs
|
|
46
|
-
* }
|
|
47
|
-
*/
|
|
48
1
|
import { BoundingBox } from './boundingbox';
|
|
49
2
|
import { Element } from './element';
|
|
50
3
|
import { Note } from './note';
|
|
@@ -54,6 +7,8 @@ export interface TupletOptions {
|
|
|
54
7
|
notesOccupied?: number;
|
|
55
8
|
numNotes?: number;
|
|
56
9
|
ratioed?: boolean;
|
|
10
|
+
/** Engraved numerator and denominator, independent of the duration multiplier. */
|
|
11
|
+
displayRatio?: readonly [number, number];
|
|
57
12
|
yOffset?: number;
|
|
58
13
|
textYOffset?: number;
|
|
59
14
|
suffix?: string;
|
|
@@ -65,7 +20,7 @@ export declare const enum TupletLocation {
|
|
|
65
20
|
export declare class Tuplet extends Element {
|
|
66
21
|
static get CATEGORY(): string;
|
|
67
22
|
notes: Note[];
|
|
68
|
-
protected options: Required<TupletOptions>;
|
|
23
|
+
protected options: Required<Omit<TupletOptions, 'displayRatio'>> & Pick<TupletOptions, 'displayRatio'>;
|
|
69
24
|
protected textElement: Element;
|
|
70
25
|
protected suffixElement: Element;
|
|
71
26
|
static get LOCATION_TOP(): number;
|
|
@@ -93,6 +48,8 @@ export declare class Tuplet extends Element {
|
|
|
93
48
|
resolveGlyphs(): void;
|
|
94
49
|
getNestedTupletCount(): number;
|
|
95
50
|
getYPosition(): number;
|
|
51
|
+
/** Position the bracket and label from the current layout, including retained reflow. */
|
|
52
|
+
private positionElements;
|
|
96
53
|
draw(): void;
|
|
97
54
|
getBoundingBox(): BoundingBox;
|
|
98
55
|
}
|
|
@@ -14,6 +14,8 @@ import { Curve, CurvePosition } from './curve';
|
|
|
14
14
|
import { Dot } from './dot';
|
|
15
15
|
import { EasyScore, EasyScoreError } from './easyscore';
|
|
16
16
|
import { Element } from './element';
|
|
17
|
+
import { measureEngraving } from './engravinggeometry';
|
|
18
|
+
import { EngravingProfile } from './engravingprofile';
|
|
17
19
|
import { Factory } from './factory';
|
|
18
20
|
import { Font, FontStyle, FontWeight } from './font';
|
|
19
21
|
import { Formatter } from './formatter';
|
|
@@ -85,6 +87,8 @@ export declare class VexFlow {
|
|
|
85
87
|
DATE: string;
|
|
86
88
|
INFO: string;
|
|
87
89
|
};
|
|
90
|
+
static measureEngraving: typeof measureEngraving;
|
|
91
|
+
static EngravingProfile: typeof EngravingProfile;
|
|
88
92
|
static Accidental: typeof Accidental;
|
|
89
93
|
static Annotation: typeof Annotation;
|
|
90
94
|
static Articulation: typeof Articulation;
|
package/changelog/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# 5.3.0
|
|
2
|
+
|
|
3
|
+
## Engraving
|
|
4
|
+
|
|
5
|
+
- Add score-local engraving profiles for SMuFL stem anchors, beam thickness, and clearance.
|
|
6
|
+
- Expose positioned glyph and beam bounds through `measureEngraving()`.
|
|
7
|
+
- Add opt-in optical spacing and contour-aware beam slopes. Improve beam clearance in multi-voice passages.
|
|
8
|
+
- Separate overlapping voices and altered unison noteheads, keeping accidentals, dots, and ledger lines with their notes.
|
|
9
|
+
- Improve grace-note spacing and slur endpoints. EasyScore can track accidentals in the order of before-graces, host notes, and after-graces.
|
|
10
|
+
- Let tuplets display a ratio independently of playback timing. Improve bracket clearance around ornaments and articulations.
|
|
11
|
+
- Correct slur opening directions and separate simultaneous guitar bends on different strings.
|
|
12
|
+
|
|
13
|
+
## Visual test gallery
|
|
14
|
+
|
|
15
|
+
- Open the gallery on a module index with nine example scores. Each score links to its live rendering and source.
|
|
16
|
+
- Load previews as readers move through the carousel. Run individual test modules from the index or the full suite at `tests/all.html`.
|
|
17
|
+
|
|
1
18
|
# 5.2.0
|
|
2
19
|
|
|
3
20
|
## EasyScore
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vexflow",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "A JavaScript library for rendering music notation and guitar tablature.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -41,7 +41,11 @@
|
|
|
41
41
|
"build/types",
|
|
42
42
|
"changelog/CHANGELOG.md",
|
|
43
43
|
"tests/flow.html",
|
|
44
|
-
"tests/
|
|
44
|
+
"tests/all.html",
|
|
45
|
+
"tests/minuet.webp",
|
|
46
|
+
"tests/demos",
|
|
47
|
+
"tests/demo_petzold_tests.ts",
|
|
48
|
+
"tests/fonts.css",
|
|
45
49
|
"tests/qunit/qunit.css",
|
|
46
50
|
"tests/qunit/qunit.js",
|
|
47
51
|
"AUTHORS.md"
|
|
@@ -129,6 +133,7 @@
|
|
|
129
133
|
"generate:reference": "grunt generate:reference",
|
|
130
134
|
"diff:reference": "grunt diff:reference",
|
|
131
135
|
"lint": "grunt eslint",
|
|
136
|
+
"audit:ci": "node tools/audit-dependencies.mjs",
|
|
132
137
|
"explorer": "node tools/explorer/cli.mjs serve",
|
|
133
138
|
"explorer:build": "node tools/explorer/cli.mjs build",
|
|
134
139
|
"explorer:test": "node tools/explorer/test.mjs",
|
package/tests/all.html
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<!-- QUnit runner for one module, a filtered selection, or the entire visual suite. -->
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta charset="UTF-8" />
|
|
7
|
+
<!--
|
|
8
|
+
IMPORTANT: Always declare the character encoding as UTF-8. Otherwise VexFlow scores may show weird symbols instead of music symbols.
|
|
9
|
+
-->
|
|
10
|
+
<title>VexFlow Tests</title>
|
|
11
|
+
<!-- fonts.css defines the music fonts via @font-face rules. -->
|
|
12
|
+
<link rel="stylesheet" href="fonts.css" type="text/css" media="screen" />
|
|
13
|
+
<link rel="stylesheet" href="qunit/qunit.css" />
|
|
14
|
+
<script src="qunit/qunit.js"></script>
|
|
15
|
+
<style>
|
|
16
|
+
body {
|
|
17
|
+
font-family: system-ui, sans-serif;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
color: #17283c;
|
|
20
|
+
background: #f4f6f9;
|
|
21
|
+
margin: 0px;
|
|
22
|
+
padding: 0px;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Keep QUnit in page flow so its full-screen panel cannot cover gallery navigation. */
|
|
27
|
+
#qunit {
|
|
28
|
+
position: static;
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
#qunit-tests {
|
|
32
|
+
overflow: visible;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
a.button {
|
|
36
|
+
color: #204e78;
|
|
37
|
+
background: #edf4fb;
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
padding: 5px;
|
|
40
|
+
margin: 2px;
|
|
41
|
+
border: 1px solid #c8d8e8;
|
|
42
|
+
border-radius: 6px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
div#error {
|
|
46
|
+
width: 60%;
|
|
47
|
+
padding: 10px;
|
|
48
|
+
color: red;
|
|
49
|
+
background: #faa;
|
|
50
|
+
border: 15px solid #d99;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
div.testcanvas {
|
|
54
|
+
font-size: 18px;
|
|
55
|
+
color: #17283c;
|
|
56
|
+
background: white;
|
|
57
|
+
border: 1px solid #dce3ed;
|
|
58
|
+
border-radius: 8px;
|
|
59
|
+
margin: 16px;
|
|
60
|
+
padding: 16px;
|
|
61
|
+
overflow-x: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
div.testcanvas .vex-tabdiv {
|
|
65
|
+
background: white;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
div.testcanvas .name {
|
|
69
|
+
font-size: 18px;
|
|
70
|
+
color: #204e78;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
p.vf-footer {
|
|
74
|
+
font-size: 14px;
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
77
|
+
</head>
|
|
78
|
+
<body>
|
|
79
|
+
<nav aria-label="Test gallery" style="padding: 1rem; background: white">
|
|
80
|
+
<a id="gallery-link" href="flow.html">← Module index</a>
|
|
81
|
+
</nav>
|
|
82
|
+
<h1 id="run-title" style="margin: 1rem">All visual tests</h1>
|
|
83
|
+
<div id="qunit"></div>
|
|
84
|
+
<div id="qunit-fixture"></div>
|
|
85
|
+
<p style="margin: 1rem"><a id="vex-src"></a></p>
|
|
86
|
+
<div id="font-preload">
|
|
87
|
+
<!--
|
|
88
|
+
Preload fonts and styles for testing.
|
|
89
|
+
The empty tags <b></b>, <i></i>, and <span style="font-weight: xxx"></span> are for loading different font weights/styles.
|
|
90
|
+
-->
|
|
91
|
+
<span style="font-family: Academico"><b></b></span>
|
|
92
|
+
<span style="font-family: Bravura"></span>
|
|
93
|
+
<span style="font-family: Edwin">
|
|
94
|
+
<b></b><i></i><b><i></i></b>
|
|
95
|
+
</span>
|
|
96
|
+
<span style="font-family: Finale Ash"></span>
|
|
97
|
+
<span style="font-family: Finale Ash Text"></span>
|
|
98
|
+
<span style="font-family: Finale Broadway"></span>
|
|
99
|
+
<span style="font-family: Finale Broadway Text"></span>
|
|
100
|
+
<span style="font-family: Finale Jazz"></span>
|
|
101
|
+
<span style="font-family: Finale Jazz Text"></span>
|
|
102
|
+
<span style="font-family: Finale Maestro"></span>
|
|
103
|
+
<span style="font-family: Finale Maestro Text">
|
|
104
|
+
<b></b><i></i><b><i></i></b>
|
|
105
|
+
</span>
|
|
106
|
+
<span style="font-family: Gonville"></span>
|
|
107
|
+
<span style="font-family: Gootville"></span>
|
|
108
|
+
<span style="font-family: Leipzig"></span>
|
|
109
|
+
<span style="font-family: Leland"></span>
|
|
110
|
+
<span style="font-family: MuseJazz"></span>
|
|
111
|
+
<span style="font-family: MuseJazz Text"></span>
|
|
112
|
+
<span style="font-family: Nepomuk">
|
|
113
|
+
<b></b><i></i><b><i></i></b>
|
|
114
|
+
</span>
|
|
115
|
+
<span style="font-family: Petaluma"></span>
|
|
116
|
+
<span style="font-family: Petaluma Script"></span>
|
|
117
|
+
<span style="font-family: Roboto Slab">
|
|
118
|
+
<span style="font-weight: 500"></span><span style="font-weight: 700"></span>
|
|
119
|
+
</span>
|
|
120
|
+
<span style="font-family: Sebastian"></span>
|
|
121
|
+
</div>
|
|
122
|
+
<script type="module">
|
|
123
|
+
QUnit.config.autostart = false;
|
|
124
|
+
|
|
125
|
+
const queryParams = new URLSearchParams(location.search);
|
|
126
|
+
// When flow.html is hosted on unpkg.com, the query string is not available.
|
|
127
|
+
// Allow the user to specify params via the # fragment identifier.
|
|
128
|
+
const hashParams = new URLSearchParams(location.hash.substr(1));
|
|
129
|
+
// Static deployments supply a local, fingerprinted bundle. Keep all test filters available.
|
|
130
|
+
const bundledSource = document.querySelector('meta[name="vexflow-test-bundle"]')?.content;
|
|
131
|
+
|
|
132
|
+
// Optional: Specify the QUnit module or filter in the query params or fragment identifier.
|
|
133
|
+
let QUnitModule = queryParams.get('module') ?? hashParams.get('module');
|
|
134
|
+
let QUnitFilter = queryParams.get('filter') ?? hashParams.get('filter');
|
|
135
|
+
|
|
136
|
+
// The `ver` query param chooses which VexFlow version to load. If omitted, `ver` defaults to 'build'.
|
|
137
|
+
const ver = bundledSource ? 'bundled build' : (queryParams.get('ver') ?? hashParams.get('ver') ?? 'build');
|
|
138
|
+
let useESM = !bundledSource && (queryParams.get('esm') === 'true' || hashParams.get('esm') === 'true');
|
|
139
|
+
const isFileProtocol = location.protocol === 'file:';
|
|
140
|
+
|
|
141
|
+
// Determine if we are loading VexFlow from a CDN.
|
|
142
|
+
let cdnURLPath;
|
|
143
|
+
if (ver.includes('unpkg')) {
|
|
144
|
+
cdnURLPath = 'https://unpkg.com/';
|
|
145
|
+
} else if (ver.includes('jsdelivr')) {
|
|
146
|
+
cdnURLPath = 'https://cdn.jsdelivr.net/npm/';
|
|
147
|
+
}
|
|
148
|
+
const useCDN = typeof cdnURLPath !== 'undefined';
|
|
149
|
+
|
|
150
|
+
// Keep the chosen local or CDN build when returning to the module index.
|
|
151
|
+
const gallery = new URL(document.getElementById('gallery-link').href);
|
|
152
|
+
for (const key of ['ver', 'esm']) {
|
|
153
|
+
const value = queryParams.get(key) ?? hashParams.get(key);
|
|
154
|
+
if (value) gallery.searchParams.set(key, value);
|
|
155
|
+
}
|
|
156
|
+
document.getElementById('gallery-link').href = gallery;
|
|
157
|
+
checkESM_WarnIfNecessary();
|
|
158
|
+
|
|
159
|
+
const pathCJSorESM = (useESM ? 'esm/entry' : 'cjs') + '/vexflow-debug-with-tests.js';
|
|
160
|
+
|
|
161
|
+
let vexPlusTestsURL;
|
|
162
|
+
if (bundledSource) {
|
|
163
|
+
vexPlusTestsURL = bundledSource;
|
|
164
|
+
} else if (useCDN) {
|
|
165
|
+
// `ver` can specify a version hosted on the unpkg.com / jsdelivr.com CDN. We only support VexFlow 4 or newer:
|
|
166
|
+
// ver=unpkg@4.2.3 => https://unpkg.com/vexflow@4.2.3/build/cjs/vexflow-debug-with-tests.js
|
|
167
|
+
// ver=unpkg@alpha => https://unpkg.com/vexflow@alpha/build/cjs/vexflow-debug-with-tests.js
|
|
168
|
+
// ver=jsdelivr@4.2.3 => https://cdn.jsdelivr.net/npm/vexflow@4.2.3/build/cjs/vexflow-debug-with-tests.js
|
|
169
|
+
const versionNumber = ver.split('@')[1];
|
|
170
|
+
vexPlusTestsURL = `${cdnURLPath}vexflow@${versionNumber}/build/${pathCJSorESM}`;
|
|
171
|
+
} else {
|
|
172
|
+
// We are NOT loading from a CDN. Instead, we are loading from the local filesystem.
|
|
173
|
+
// ver=build => vexflow/build/
|
|
174
|
+
// ver=reference => vexflow/reference/
|
|
175
|
+
// ver=releases/4.2.3 => vexflow/releases/4.2.3/
|
|
176
|
+
vexPlusTestsURL = `../${ver}/${pathCJSorESM}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
showVexFlowVersion();
|
|
180
|
+
|
|
181
|
+
let loadVexFlow;
|
|
182
|
+
|
|
183
|
+
if (useESM && !isFileProtocol) {
|
|
184
|
+
console.log('LOADING ESM: ' + vexPlusTestsURL);
|
|
185
|
+
loadVexFlow = async () => {
|
|
186
|
+
const module = await import(vexPlusTestsURL);
|
|
187
|
+
window.VexFlow = module.VexFlow;
|
|
188
|
+
return VexFlow;
|
|
189
|
+
};
|
|
190
|
+
} else {
|
|
191
|
+
console.log('LOADING CJS: ' + vexPlusTestsURL);
|
|
192
|
+
loadVexFlow = async () => {
|
|
193
|
+
await loadScript(vexPlusTestsURL);
|
|
194
|
+
return VexFlow;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Load deployed faces before tests measure them, even when the preload spans are empty.
|
|
199
|
+
if (bundledSource) await Promise.all([...document.fonts].map((face) => face.load()));
|
|
200
|
+
const fontFaceSet = await document.fonts.ready;
|
|
201
|
+
|
|
202
|
+
showFontLoadingStatus();
|
|
203
|
+
|
|
204
|
+
const VF = await loadVexFlow();
|
|
205
|
+
if (bundledSource) await document.fonts.ready;
|
|
206
|
+
|
|
207
|
+
// If you did not load the fonts via the div#font-preload above, you can load them with this API:
|
|
208
|
+
// await VF.loadFonts(); // Load all web fonts that VexFlow knows about (Font.FILES).
|
|
209
|
+
// await VF.loadFonts('Bravura', 'Academico'); // Load only the specified fonts.
|
|
210
|
+
|
|
211
|
+
if (QUnitModule) {
|
|
212
|
+
QUnit.config.module = QUnitModule;
|
|
213
|
+
document.title = `${QUnitModule} · VexFlow Tests`;
|
|
214
|
+
document.getElementById('run-title').textContent = QUnitModule;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (QUnitFilter) {
|
|
218
|
+
QUnit.config.filter = QUnitFilter;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Show only failed tests.
|
|
222
|
+
QUnit.config.hidepassed = true;
|
|
223
|
+
QUnit.config.noglobals = true;
|
|
224
|
+
VF.Test.run();
|
|
225
|
+
QUnit.start();
|
|
226
|
+
|
|
227
|
+
function loadScript(url) {
|
|
228
|
+
return new Promise((resolve, reject) => {
|
|
229
|
+
const script = document.createElement('script');
|
|
230
|
+
script.onload = resolve;
|
|
231
|
+
script.onerror = reject;
|
|
232
|
+
script.src = url;
|
|
233
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Display which VexFlow version we loaded.
|
|
238
|
+
function showVexFlowVersion() {
|
|
239
|
+
const srcLink = document.getElementById('vex-src');
|
|
240
|
+
srcLink.href = vexPlusTestsURL;
|
|
241
|
+
srcLink.innerText = `VexFlow Source [${ver}]`;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ESM version only works if flow.html is accessed from a web server: e.g., `npx http-server` and browse to http://127.0.0.1:8080/tests/flow.html
|
|
245
|
+
function checkESM_WarnIfNecessary() {
|
|
246
|
+
if (useESM) {
|
|
247
|
+
if (!useCDN && isFileProtocol) {
|
|
248
|
+
prompt(
|
|
249
|
+
'ES modules require a web server for testing!\n\n' +
|
|
250
|
+
'Try `npx http-server` and browse to http://127.0.0.1:8080/tests/flow.html?esm=true\n\n' +
|
|
251
|
+
'We will fall back to CJS for now.',
|
|
252
|
+
'npx http-server'
|
|
253
|
+
);
|
|
254
|
+
useESM = false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Show font loading status in the console.
|
|
260
|
+
function showFontLoadingStatus() {
|
|
261
|
+
const fontFaces = [...fontFaceSet];
|
|
262
|
+
for (const fontFace of fontFaces) {
|
|
263
|
+
const fontInfo = fontFace.family + ' / ' + fontFace.weight + ' / ' + fontFace.style;
|
|
264
|
+
if (fontFace.status === 'loaded') {
|
|
265
|
+
console.log(fontInfo + ' loaded!');
|
|
266
|
+
} else if (fontFace.status === 'unloaded') {
|
|
267
|
+
console.warn('*** ' + fontInfo + ' IS NOT LOADED! ***');
|
|
268
|
+
} else if (fontFace.status === 'error') {
|
|
269
|
+
console.error(fontInfo + ' ERROR');
|
|
270
|
+
} else {
|
|
271
|
+
console.log(fontInfo + ' has status: ' + fontFace.status);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
</script>
|
|
276
|
+
</body>
|
|
277
|
+
</html>
|