vexflow 5.1.2 → 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/README.md +7 -6
- 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 +5325 -1730
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +4228 -1545
- 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 +13 -3
- package/build/esm/src/articulation.js +51 -20
- package/build/esm/src/beam.js +170 -30
- package/build/esm/src/bend.js +24 -19
- package/build/esm/src/clef.js +3 -0
- package/build/esm/src/clefnote.js +5 -1
- package/build/esm/src/curve.js +27 -53
- package/build/esm/src/dot.js +14 -5
- package/build/esm/src/easyscore/composition.js +336 -0
- package/build/esm/src/easyscore/elementindex.js +81 -0
- package/build/esm/src/easyscore/elements.js +324 -0
- package/build/esm/src/easyscore/policies.js +97 -0
- package/build/esm/src/easyscore/rhythm.js +42 -0
- package/build/esm/src/easyscore.js +448 -26
- package/build/esm/src/element.js +17 -2
- package/build/esm/src/engravinggeometry.js +150 -0
- package/build/esm/src/engravingprofile.js +44 -0
- package/build/esm/src/factory.js +268 -64
- package/build/esm/src/formatter.js +40 -4
- 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 +10 -2
- package/build/esm/src/keysignote.js +2 -2
- package/build/esm/src/modifiercontext.js +11 -0
- package/build/esm/src/note.js +5 -0
- package/build/esm/src/notehead.js +11 -6
- package/build/esm/src/ornament.js +38 -18
- package/build/esm/src/parenthesis.js +1 -1
- package/build/esm/src/parser.js +6 -1
- package/build/esm/src/proportionalformatter.js +234 -0
- package/build/esm/src/registry.js +27 -0
- package/build/esm/src/sheet.js +20 -3
- package/build/esm/src/stave.js +9 -2
- package/build/esm/src/stavenote.js +140 -127
- package/build/esm/src/stavetie.js +39 -7
- package/build/esm/src/stem.js +26 -11
- package/build/esm/src/stemmablenote.js +6 -1
- package/build/esm/src/tickable.js +5 -0
- package/build/esm/src/tickcontext.js +19 -0
- package/build/esm/src/timesignature.js +5 -0
- package/build/esm/src/tuplet.js +60 -19
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +6 -1
- package/build/esm/tests/beam_tests.js +35 -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/easyscore_tests.js +40 -0
- package/build/esm/tests/easyscore_types.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 +51 -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-rendering-tests.mjs +332 -0
- package/build/esm/tests/node/easyscore-tests.mjs +1024 -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 +278 -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/easyscore-api-audit.mjs +58 -0
- package/build/esm/tools/easyscore-composition.mjs +62 -0
- package/build/esm/tools/easyscore-example.mjs +16 -0
- package/build/esm/tools/easyscore-families.mjs +61 -0
- package/build/esm/tools/easyscore-references-example.mjs +26 -0
- package/build/esm/tools/easyscore-rhythm.mjs +58 -0
- package/build/esm/tools/easyscore-structure.mjs +88 -0
- package/build/esm/tools/explorer/catalog/entries.mjs +6 -0
- package/build/esm/tools/explorer/catalog/expression.mjs +68 -0
- package/build/esm/tools/explorer/catalog/helpers.mjs +29 -0
- package/build/esm/tools/explorer/catalog/layout.mjs +109 -0
- package/build/esm/tools/explorer/catalog/notes.mjs +61 -0
- package/build/esm/tools/explorer/catalog/staves.mjs +85 -0
- package/build/esm/tools/explorer/catalog/strings.mjs +25 -0
- package/build/esm/tools/explorer/catalog.mjs +14 -0
- package/build/esm/tools/score-fixtures.mjs +23 -6
- package/build/types/src/accidental.d.ts +6 -0
- package/build/types/src/articulation.d.ts +12 -1
- package/build/types/src/beam.d.ts +16 -0
- package/build/types/src/clef.d.ts +2 -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 +126 -0
- package/build/types/src/easyscore/elementindex.d.ts +30 -0
- package/build/types/src/easyscore/elements.d.ts +156 -0
- package/build/types/src/easyscore/policies.d.ts +12 -0
- package/build/types/src/easyscore/rhythm.d.ts +9 -0
- package/build/types/src/easyscore.d.ts +153 -11
- package/build/types/src/element.d.ts +7 -1
- 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 +97 -9
- package/build/types/src/formatter.d.ts +7 -1
- 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/keysignature.d.ts +3 -0
- package/build/types/src/keysignote.d.ts +1 -1
- package/build/types/src/modifiercontext.d.ts +4 -0
- package/build/types/src/note.d.ts +2 -0
- package/build/types/src/notehead.d.ts +5 -0
- package/build/types/src/ornament.d.ts +7 -0
- package/build/types/src/parser.d.ts +5 -0
- package/build/types/src/proportionalformatter.d.ts +39 -0
- package/build/types/src/registry.d.ts +4 -0
- package/build/types/src/stave.d.ts +2 -0
- package/build/types/src/stavenote.d.ts +21 -3
- package/build/types/src/stavetie.d.ts +4 -0
- package/build/types/src/stem.d.ts +10 -1
- package/build/types/src/stemmablenote.d.ts +6 -1
- package/build/types/src/tickable.d.ts +2 -0
- 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 +6 -1
- package/changelog/CHANGELOG.md +52 -0
- package/package.json +13 -3
- 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
|
@@ -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
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export type Match = string | Match[] | null;
|
|
2
2
|
export type RuleFunction = () => Rule;
|
|
3
|
+
/** Matched rule range uses zero-based, end-exclusive offsets in the input. */
|
|
3
4
|
export type TriggerFunction = (state?: {
|
|
4
5
|
matches: Match[];
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
5
8
|
}) => void;
|
|
6
9
|
export interface Rule {
|
|
7
10
|
token?: string;
|
|
@@ -21,6 +24,7 @@ export interface Result {
|
|
|
21
24
|
matches?: Match[];
|
|
22
25
|
numMatches?: number;
|
|
23
26
|
results?: GroupedResults;
|
|
27
|
+
furthestErrorPos?: number;
|
|
24
28
|
errorPos?: number;
|
|
25
29
|
}
|
|
26
30
|
export type GroupedResults = (Result | Result[])[];
|
|
@@ -33,6 +37,7 @@ export declare class Parser {
|
|
|
33
37
|
protected line: string;
|
|
34
38
|
protected pos: number;
|
|
35
39
|
protected errorPos: number;
|
|
40
|
+
protected furthestErrorPos: number;
|
|
36
41
|
constructor(grammar: Grammar);
|
|
37
42
|
parse(line: string): Result;
|
|
38
43
|
matchFail(returnPos: number): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AlignmentTickContexts } from './formatter';
|
|
2
|
+
import { Voice } from './voice';
|
|
3
|
+
/** Equal durations occupy equal horizontal distances. */
|
|
4
|
+
export interface ProportionalSpacing {
|
|
5
|
+
mode: 'proportional';
|
|
6
|
+
/** Omit to fit the available width, or choose the minimum scale when no width is supplied. */
|
|
7
|
+
pixelsPerQuarter?: number;
|
|
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
|
+
};
|
|
13
|
+
/** Build a common rational timeline without advancing time for clefs or barlines. */
|
|
14
|
+
export declare class ProportionalFormatter {
|
|
15
|
+
readonly contexts: AlignmentTickContexts;
|
|
16
|
+
private readonly anchors;
|
|
17
|
+
private readonly quarterTicks;
|
|
18
|
+
private readonly duration;
|
|
19
|
+
private origin;
|
|
20
|
+
private tail;
|
|
21
|
+
private minimumScale;
|
|
22
|
+
private centeredWidth;
|
|
23
|
+
constructor(voices: Voice[], resolutionMultiplier: number);
|
|
24
|
+
/** Convert an exact timeline key once, at the point where pixels are needed. */
|
|
25
|
+
private quarters;
|
|
26
|
+
/** Measure each stave independently so unrelated onsets on other staves do not compete. */
|
|
27
|
+
private measure;
|
|
28
|
+
/** Compute one scale and validate it before changing any anchor positions. */
|
|
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;
|
|
33
|
+
/** Minimum total width for autoWidth, honoring a supplied exact scale. */
|
|
34
|
+
minimumWidth(spacing: MeasuredSpacing): number;
|
|
35
|
+
/** Convert a single exact time scale into the same placement data as optical spacing. */
|
|
36
|
+
private proportionalLayout;
|
|
37
|
+
/** Place anchors and prefixes, retaining the established centering exception for measure rests. */
|
|
38
|
+
format(spacing: MeasuredSpacing, width: number): number;
|
|
39
|
+
}
|
|
@@ -21,6 +21,10 @@ export declare class Registry {
|
|
|
21
21
|
static enableDefaultRegistry(registry: Registry): void;
|
|
22
22
|
static disableDefaultRegistry(): void;
|
|
23
23
|
protected index: Index;
|
|
24
|
+
/** Registrations made during nested synchronous construction scopes. */
|
|
25
|
+
private transactions;
|
|
26
|
+
/** Restore indexes and detach new elements if construction fails. External mutations are not undone. */
|
|
27
|
+
transaction<T>(build: () => T): T;
|
|
24
28
|
constructor();
|
|
25
29
|
clear(): this;
|
|
26
30
|
setIndexValue(name: string, value: string, id: string, elem: Element): void;
|
|
@@ -7,6 +7,8 @@ export interface StaveLineConfig {
|
|
|
7
7
|
visible?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export interface StaveOptions {
|
|
10
|
+
/** Musical state when a repeated clef glyph is intentionally omitted. */
|
|
11
|
+
clef?: string;
|
|
10
12
|
bottomTextPosition?: number;
|
|
11
13
|
lineConfig?: StaveLineConfig[];
|
|
12
14
|
spaceBelowStaffLn?: number;
|
|
@@ -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,7 +71,13 @@ export declare class StaveNote extends StemmableNote {
|
|
|
65
71
|
autoStem(): void;
|
|
66
72
|
calculateOptimalStemDirection(): number;
|
|
67
73
|
calculateKeyProps(): void;
|
|
68
|
-
|
|
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;
|
|
80
|
+
getBoundingBox(includeModifiers?: boolean): BoundingBox;
|
|
69
81
|
getLineNumber(isTopNote?: boolean): number;
|
|
70
82
|
/**
|
|
71
83
|
* @returns true if this note is a type of rest. Rests don't have pitches, but take up space in the score.
|
|
@@ -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
|
}
|
|
@@ -5,6 +5,8 @@ export declare abstract class StemmableNote extends Note {
|
|
|
5
5
|
static get CATEGORY(): string;
|
|
6
6
|
stemDirection?: number;
|
|
7
7
|
stem?: Stem;
|
|
8
|
+
/** Automatic stems may be resolved again when notes are grouped into a beam. */
|
|
9
|
+
protected autoStemEnabled: boolean;
|
|
8
10
|
protected flag: Flag;
|
|
9
11
|
protected stemExtensionOverride?: number;
|
|
10
12
|
constructor(noteStruct: NoteStruct);
|
|
@@ -18,7 +20,10 @@ export declare abstract class StemmableNote extends Note {
|
|
|
18
20
|
getBeamCount(): number;
|
|
19
21
|
getStemMinimumLength(): number;
|
|
20
22
|
getStemDirection(): number;
|
|
21
|
-
|
|
23
|
+
/** True when layout, rather than the caller, chooses the stem direction. */
|
|
24
|
+
isAutoStem(): boolean;
|
|
25
|
+
/** Set direction; automatic layout passes true to retain the automatic policy. */
|
|
26
|
+
setStemDirection(direction?: number, autoStem?: boolean): this;
|
|
22
27
|
getStemX(): number;
|
|
23
28
|
getCenterGlyphX(): number;
|
|
24
29
|
getStemExtension(): number;
|
|
@@ -68,6 +68,8 @@ export declare abstract class Tickable extends Element {
|
|
|
68
68
|
getVoice(): Voice;
|
|
69
69
|
/** Set the associated voice. */
|
|
70
70
|
setVoice(voice: Voice): void;
|
|
71
|
+
/** Release a temporary voice assignment during managed construction rollback. */
|
|
72
|
+
clearVoice(): this;
|
|
71
73
|
/** Get the Tuplet if any.
|
|
72
74
|
* If there are multiple Tuplets, the most recently added one is returned. */
|
|
73
75
|
getTuplet(): Tuplet | undefined;
|
|
@@ -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
|
}
|
|
@@ -12,8 +12,10 @@ import { ClefNote } from './clefnote';
|
|
|
12
12
|
import { Crescendo } from './crescendo';
|
|
13
13
|
import { Curve, CurvePosition } from './curve';
|
|
14
14
|
import { Dot } from './dot';
|
|
15
|
-
import { EasyScore } from './easyscore';
|
|
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;
|
|
@@ -101,6 +105,7 @@ export declare class VexFlow {
|
|
|
101
105
|
static Curve: typeof Curve;
|
|
102
106
|
static Dot: typeof Dot;
|
|
103
107
|
static EasyScore: typeof EasyScore;
|
|
108
|
+
static EasyScoreError: typeof EasyScoreError;
|
|
104
109
|
static Element: typeof Element;
|
|
105
110
|
static Factory: typeof Factory;
|
|
106
111
|
static Font: typeof Font;
|
package/changelog/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
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
|
+
|
|
18
|
+
# 5.2.0
|
|
19
|
+
|
|
20
|
+
## EasyScore
|
|
21
|
+
|
|
22
|
+
- Add the first typed composition slice: `EasyScore.create()`, annotation/tie constructors, attachment, systems, styling, and drawing.
|
|
23
|
+
- Add pure notation parsing with source diagnostics and rollback for failed strict construction and measure requests.
|
|
24
|
+
- Apply native note options and voice modes, meter objects, resolution, and softmax settings.
|
|
25
|
+
- Support validated articulation aliases, codes, and glyphs. Unknown names no longer silently become staccato.
|
|
26
|
+
- Preserve legacy non-throwing parsing, custom builders, and commit hooks.
|
|
27
|
+
- Add a user guide, Explorer examples, feature coverage checklist, and native-rendering parity tests.
|
|
28
|
+
- Add score-local ID lookup and source provenance, with duplicate checks, rename tracking, and reset/rollback cleanup.
|
|
29
|
+
- Adopt native notes, modifiers, and standalone drawables with explicit roles and ownership checks.
|
|
30
|
+
- Select parsed notation from Explorer clicks without guessing ambiguous or stale editor locations.
|
|
31
|
+
|
|
32
|
+
- Add typed note sequences, percussion heads, native modifier helpers, and single-owner grace/subnote groups.
|
|
33
|
+
- Add pure extension validation, Sheet access, and synchronous construction batches.
|
|
34
|
+
- Preserve native dot and parenthesis fonts without requiring a browser document in Node.
|
|
35
|
+
- Add rhythm and relationship helpers, tablature and staff constructors, and structured composition with explicit responsive layout policies.
|
|
36
|
+
- Preserve clef state across composed key changes and resolve automatic stems for complete beam groups.
|
|
37
|
+
|
|
38
|
+
## Notation
|
|
39
|
+
|
|
40
|
+
- Add strict proportional spacing for shared rhythmic timelines.
|
|
41
|
+
|
|
42
|
+
## Interactive guide
|
|
43
|
+
|
|
44
|
+
- Add Quickstart, EasyScore, native API lessons, and an editable playground with bundled assets.
|
|
45
|
+
- Reuse the loaded VexFlow runtime and fonts across lesson and playground navigation.
|
|
46
|
+
- Add browser coverage for navigation, editing, exports, mobile layouts, and asset reuse.
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
- Add EasyScore consumer-package and declaration checks.
|
|
51
|
+
- Consolidate build, testing, release, and upload instructions.
|
|
52
|
+
|
|
1
53
|
# 5.1.2
|
|
2
54
|
|
|
3
55
|
## Notation
|
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,13 +133,19 @@
|
|
|
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",
|
|
135
140
|
"explorer:upload": "node tools/explorer/upload.mjs",
|
|
136
141
|
"tests:build": "node tools/tests-site.mjs build",
|
|
137
142
|
"tests:upload": "node tools/tests-site.mjs upload",
|
|
138
|
-
"tests:test": "node tools/tests-site.test.mjs"
|
|
143
|
+
"tests:test": "node tools/tests-site.test.mjs",
|
|
144
|
+
"test:easyscore-package": "grunt build:esm build:types build:cjs && node tools/easyscore-package-check.mjs",
|
|
145
|
+
"guide": "node guide/cli.mjs serve",
|
|
146
|
+
"guide:build": "node guide/cli.mjs build",
|
|
147
|
+
"guide:test": "node guide/test.mjs",
|
|
148
|
+
"guide:upload": "node guide/cli.mjs upload"
|
|
139
149
|
},
|
|
140
150
|
"homepage": "https://vexflow.com/",
|
|
141
151
|
"keywords": [
|