vexflow 5.0.0 → 5.1.1
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/LICENSE +3 -3
- package/README.md +46 -53
- 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 +3825 -1396
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +2577 -984
- 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 +1 -0
- package/build/esm/src/annotation.js +31 -8
- package/build/esm/src/beam.js +4 -2
- package/build/esm/src/chordsymbol.js +3 -1
- package/build/esm/src/clef.js +3 -1
- package/build/esm/src/curve.js +68 -11
- package/build/esm/src/easyscore.js +40 -1
- package/build/esm/src/element.js +49 -11
- package/build/esm/src/factory.js +46 -9
- package/build/esm/src/flag.js +3 -1
- package/build/esm/src/font.js +20 -1
- package/build/esm/src/formatter.js +34 -36
- package/build/esm/src/fraction.js +4 -1
- package/build/esm/src/glyphnote.js +3 -1
- package/build/esm/src/gracenotegroup.js +18 -1
- package/build/esm/src/index.js +2 -0
- package/build/esm/src/keysignature.js +3 -1
- package/build/esm/src/metrics.js +58 -3
- package/build/esm/src/modifiercontext.js +15 -1
- package/build/esm/src/note.js +2 -2
- package/build/esm/src/notehead.js +3 -1
- package/build/esm/src/ornament.js +3 -1
- package/build/esm/src/pedalmarking.js +44 -5
- package/build/esm/src/registry.js +16 -6
- package/build/esm/src/rendercontext.js +10 -0
- package/build/esm/src/sheet.js +117 -0
- package/build/esm/src/stave.js +13 -8
- package/build/esm/src/stavebarline.js +53 -1
- package/build/esm/src/staveline.js +2 -0
- package/build/esm/src/stavenote.js +54 -19
- package/build/esm/src/stavetie.js +3 -1
- package/build/esm/src/stem.js +2 -1
- package/build/esm/src/stemmablenote.js +9 -0
- package/build/esm/src/stringnumber.js +0 -1
- package/build/esm/src/strokes.js +10 -0
- package/build/esm/src/svgcontext.js +14 -4
- package/build/esm/src/svgexport.js +68 -0
- package/build/esm/src/system.js +14 -0
- package/build/esm/src/tables.js +69 -37
- package/build/esm/src/tabnote.js +20 -1
- package/build/esm/src/textbracket.js +5 -4
- package/build/esm/src/textdynamics.js +5 -0
- package/build/esm/src/textmetricscache.js +93 -0
- package/build/esm/src/textnote.js +3 -3
- package/build/esm/src/tickable.js +56 -22
- package/build/esm/src/timesignature.js +30 -9
- package/build/esm/src/timesignote.js +3 -1
- package/build/esm/src/tuning.js +2 -2
- package/build/esm/src/tuplet.js +79 -29
- package/build/esm/src/util.js +1 -0
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +14 -2
- package/build/esm/src/voice.js +44 -8
- package/build/esm/tests/accidental_tests.js +52 -0
- package/build/esm/tests/annotation_tests.js +38 -0
- package/build/esm/tests/articulation_tests.js +34 -0
- package/build/esm/tests/beam_tests.js +17 -0
- package/build/esm/tests/curve_tests.js +81 -0
- package/build/esm/tests/font_tests.js +32 -1
- package/build/esm/tests/formatter_tests.js +58 -23
- package/build/esm/tests/gracenote_tests.js +58 -0
- package/build/esm/tests/gracetabnote_tests.js +40 -0
- package/build/esm/tests/keysignature_tests.js +14 -3
- package/build/esm/tests/node/metrics-tests.mjs +278 -0
- package/build/esm/tests/node/package-input-tests.mjs +149 -0
- package/build/esm/tests/node/render-metrics-tests.mjs +78 -0
- package/build/esm/tests/node/rendering-tests.mjs +75 -0
- package/build/esm/tests/node/sheet-tests.mjs +202 -0
- package/build/esm/tests/node/svg-export-tests.mjs +182 -0
- package/build/esm/tests/pedalmarking_tests.js +25 -0
- package/build/esm/tests/rests_tests.js +6 -0
- package/build/esm/tests/stave_tests.js +6 -3
- package/build/esm/tests/stavenote_tests.js +100 -55
- package/build/esm/tests/strokes_tests.js +19 -5
- package/build/esm/tests/timesignature_tests.js +19 -0
- package/build/esm/tests/tuplet_tests.js +273 -12
- package/build/esm/tests/unison_tests.js +13 -13
- package/build/esm/tests/voice_tests.js +34 -0
- package/build/esm/tools/render-metrics.mjs +49 -0
- package/build/esm/tools/score-fixtures.mjs +94 -0
- package/build/esm/tools/sheet-fixture.mjs +90 -0
- package/build/esm/tools/visual-regression.mjs +106 -0
- package/build/types/src/annotation.d.ts +17 -1
- package/build/types/src/curve.d.ts +24 -7
- package/build/types/src/easyscore.d.ts +8 -0
- package/build/types/src/element.d.ts +7 -0
- package/build/types/src/factory.d.ts +18 -1
- package/build/types/src/font.d.ts +2 -0
- package/build/types/src/formatter.d.ts +23 -14
- package/build/types/src/gracenotegroup.d.ts +5 -0
- package/build/types/src/index.d.ts +2 -0
- package/build/types/src/metrics.d.ts +2 -0
- package/build/types/src/modifiercontext.d.ts +4 -0
- package/build/types/src/pedalmarking.d.ts +4 -1
- package/build/types/src/registry.d.ts +2 -0
- package/build/types/src/rendercontext.d.ts +12 -0
- package/build/types/src/sheet.d.ts +49 -0
- package/build/types/src/stave.d.ts +4 -4
- package/build/types/src/stavebarline.d.ts +10 -0
- package/build/types/src/stavenote.d.ts +11 -0
- package/build/types/src/strokes.d.ts +4 -0
- package/build/types/src/svgcontext.d.ts +5 -0
- package/build/types/src/svgexport.d.ts +22 -0
- package/build/types/src/system.d.ts +4 -0
- package/build/types/src/tables.d.ts +9 -0
- package/build/types/src/tabnote.d.ts +4 -0
- package/build/types/src/textbracket.d.ts +1 -1
- package/build/types/src/textdynamics.d.ts +3 -0
- package/build/types/src/textmetricscache.d.ts +21 -0
- package/build/types/src/tickable.d.ts +27 -10
- package/build/types/src/timesignature.d.ts +4 -0
- package/build/types/src/tuplet.d.ts +8 -0
- package/build/types/src/util.d.ts +1 -0
- package/build/types/src/vexflow.d.ts +8 -1
- package/build/types/src/voice.d.ts +6 -0
- package/changelog/CHANGELOG.md +109 -0
- package/package.json +44 -26
- package/tests/flow.html +15 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoundingBox, Bounds } from './boundingbox';
|
|
2
2
|
import { Element, ElementStyle } from './element';
|
|
3
|
-
import { BarlineType } from './stavebarline';
|
|
3
|
+
import { BarlineType, RepeatBracketType } from './stavebarline';
|
|
4
4
|
import { StaveModifier } from './stavemodifier';
|
|
5
5
|
import { StaveTempoOptions } from './stavetempo';
|
|
6
6
|
export interface StaveLineConfig {
|
|
@@ -88,8 +88,8 @@ export declare class Stave extends Element {
|
|
|
88
88
|
getYForGlyphs(): number;
|
|
89
89
|
addModifier(modifier: StaveModifier, position?: number): this;
|
|
90
90
|
addEndModifier(modifier: StaveModifier): this;
|
|
91
|
-
setBegBarType(type: number | BarlineType): this;
|
|
92
|
-
setEndBarType(type: number | BarlineType): this;
|
|
91
|
+
setBegBarType(type: number | BarlineType, repeatBracket?: RepeatBracketType): this;
|
|
92
|
+
setEndBarType(type: number | BarlineType, repeatBracket?: RepeatBracketType): this;
|
|
93
93
|
setClef(clefSpec: string, size?: string, annotation?: string, position?: number): this;
|
|
94
94
|
getClef(): string;
|
|
95
95
|
setEndClef(clefSpec: string, size?: string, annotation?: string): this;
|
|
@@ -103,7 +103,7 @@ export declare class Stave extends Element {
|
|
|
103
103
|
*
|
|
104
104
|
* Example:
|
|
105
105
|
* `stave.addKeySignature('Db');`
|
|
106
|
-
* @param keySpec new key specification `[A-G][b|#]?`
|
|
106
|
+
* @param keySpec new key specification `[A-G][b|#]?` or `[flats|sharps]_[0-14]?`
|
|
107
107
|
* @param cancelKeySpec
|
|
108
108
|
* @param position
|
|
109
109
|
* @returns
|
|
@@ -9,20 +9,30 @@ export declare enum BarlineType {
|
|
|
9
9
|
REPEAT_BOTH = 6,
|
|
10
10
|
NONE = 7
|
|
11
11
|
}
|
|
12
|
+
export declare enum RepeatBracketType {
|
|
13
|
+
NONE = 0,
|
|
14
|
+
STRAIGHT = 1,
|
|
15
|
+
CURVED = 2
|
|
16
|
+
}
|
|
12
17
|
export declare class Barline extends StaveModifier {
|
|
13
18
|
static get CATEGORY(): string;
|
|
14
19
|
protected widths: Record<string, number>;
|
|
15
20
|
protected paddings: Record<string, number>;
|
|
16
21
|
protected layoutMetricsMap: Record<number, LayoutMetrics>;
|
|
22
|
+
protected repeatBrackets: RepeatBracketType;
|
|
17
23
|
protected thickness: number;
|
|
18
24
|
protected type: BarlineType;
|
|
19
25
|
static get type(): typeof BarlineType;
|
|
20
26
|
static get typeString(): Record<string, BarlineType>;
|
|
21
27
|
constructor(type: BarlineType | string);
|
|
28
|
+
setRepeatBracket(val: RepeatBracketType): void;
|
|
29
|
+
getRepeatBrackets(): RepeatBracketType;
|
|
22
30
|
getType(): number;
|
|
23
31
|
setType(type: string | number): this;
|
|
24
32
|
draw(): void;
|
|
25
33
|
drawVerticalBar(stave: Stave, x: number, doubleBar?: boolean): void;
|
|
26
34
|
drawVerticalEndBar(stave: Stave, x: number): void;
|
|
35
|
+
drawStraightBrackets(stave: Stave, startX: number, startY: number, yDirection: number, xDirection: number): void;
|
|
36
|
+
drawCurvedBrackets(stave: Stave, startX: number, startY: number, yDirection: number, xDirection: number): void;
|
|
27
37
|
drawRepeatBar(stave: Stave, x: number, begin: boolean): void;
|
|
28
38
|
}
|
|
@@ -119,6 +119,15 @@ export declare class StaveNote extends StemmableNote {
|
|
|
119
119
|
* @property {number} highestNonDisplacedLine
|
|
120
120
|
* @property {number} lowestNonDisplacedLine
|
|
121
121
|
*/
|
|
122
|
+
/**
|
|
123
|
+
* Get Y bounds for the stem, adjusted for SMuFL stem anchor offsets defined in
|
|
124
|
+
* Tables.noteHeadStemYOffsets. This ensures stems attach at the correct point
|
|
125
|
+
* on the notehead (e.g. the arm tip of an X notehead) rather than the center.
|
|
126
|
+
*/
|
|
127
|
+
protected getStemYBounds(): {
|
|
128
|
+
yTop: number;
|
|
129
|
+
yBottom: number;
|
|
130
|
+
};
|
|
122
131
|
/**
|
|
123
132
|
* Get the staff line and y value for the highest & lowest noteheads
|
|
124
133
|
* @returns {noteHeadBounds}
|
|
@@ -130,6 +139,8 @@ export declare class StaveNote extends StemmableNote {
|
|
|
130
139
|
drawLedgerLines(): void;
|
|
131
140
|
drawModifiers(noteheadParam: NoteHead): void;
|
|
132
141
|
shouldDrawFlag(): boolean;
|
|
142
|
+
/** Share flag coordinates between measurement and drawing. */
|
|
143
|
+
private getFlagPosition;
|
|
133
144
|
drawFlag(): void;
|
|
134
145
|
drawNoteHeads(): void;
|
|
135
146
|
drawStem(stemOptions?: StemOptions): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
1
2
|
import { Modifier } from './modifier';
|
|
2
3
|
import { ModifierContextState } from './modifiercontext';
|
|
3
4
|
import { Note } from './note';
|
|
@@ -22,10 +23,13 @@ export declare class Stroke extends Modifier {
|
|
|
22
23
|
renderOptions: {
|
|
23
24
|
fontScale: number;
|
|
24
25
|
};
|
|
26
|
+
protected boundingBox: BoundingBox;
|
|
25
27
|
constructor(type: number, options?: {
|
|
26
28
|
allVoices: boolean;
|
|
27
29
|
});
|
|
28
30
|
getPosition(): number;
|
|
29
31
|
addEndNote(note: Note): this;
|
|
30
32
|
draw(): void;
|
|
33
|
+
/** Get the boundingBox. */
|
|
34
|
+
getBoundingBox(): BoundingBox;
|
|
31
35
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Element } from './element';
|
|
2
2
|
import { FontInfo } from './font';
|
|
3
3
|
import { RenderContext, TextMeasure } from './rendercontext';
|
|
4
|
+
import { SVGFont } from './svgexport';
|
|
4
5
|
export type Attributes = {
|
|
5
6
|
[name: string]: string | number | undefined;
|
|
6
7
|
'font-family'?: string;
|
|
@@ -19,6 +20,10 @@ export interface State {
|
|
|
19
20
|
*/
|
|
20
21
|
export declare class SVGContext extends RenderContext {
|
|
21
22
|
protected static measureTextElement: Element;
|
|
23
|
+
/** Serialize a drawing. Supplying fonts converts all text to portable paths. */
|
|
24
|
+
static toSVG(svg: SVGSVGElement, fonts?: SVGFont[]): string;
|
|
25
|
+
/** Export without modifying the live drawing. See docs/portable-svg.md for font setup. */
|
|
26
|
+
toSVG(fonts?: SVGFont[]): string;
|
|
22
27
|
element: HTMLElement;
|
|
23
28
|
svg: SVGSVGElement;
|
|
24
29
|
width: number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The small part of an opentype.js Font needed for portable SVG export. */
|
|
2
|
+
export interface SVGOutlineFont {
|
|
3
|
+
charToGlyphIndex(character: string): number;
|
|
4
|
+
getAdvanceWidth(text: string, size: number): number;
|
|
5
|
+
getPath(text: string, x: number, y: number, size: number): {
|
|
6
|
+
toPathData(decimalPlaces: number): string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/** A loaded font face. Supply the same fonts used to lay out the score. */
|
|
10
|
+
export interface SVGFont {
|
|
11
|
+
family: string;
|
|
12
|
+
font: SVGOutlineFont;
|
|
13
|
+
/** Defaults to normal. Supply a separate face for bold text. */
|
|
14
|
+
weight?: string | number;
|
|
15
|
+
/** Defaults to normal. Supply a separate face for italic text. */
|
|
16
|
+
style?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Clone a VexFlow SVG and replace all text with paths. Fail if any glyph is missing.
|
|
20
|
+
* This accepts SVGs produced by SVGContext, not arbitrary SVG text layouts or CSS.
|
|
21
|
+
*/
|
|
22
|
+
export declare function svgWithFontPaths(svg: SVGSVGElement, fonts: SVGFont[]): SVGSVGElement;
|
|
@@ -85,6 +85,10 @@ export declare class System extends Element {
|
|
|
85
85
|
getStaves(): Stave[];
|
|
86
86
|
/** Get associated voices. */
|
|
87
87
|
getVoices(): Voice[];
|
|
88
|
+
/** Set a fixed layout width, or request the minimum width when omitted. */
|
|
89
|
+
setWidth(width?: number): this;
|
|
90
|
+
/** Width assigned by the latest layout. */
|
|
91
|
+
getWidth(): number;
|
|
88
92
|
/** Set associated context. */
|
|
89
93
|
setContext(context: RenderContext): this;
|
|
90
94
|
/**
|
|
@@ -14,6 +14,15 @@ export declare class Tables {
|
|
|
14
14
|
static TABLATURE_FONT_SCALE: number;
|
|
15
15
|
static SLASH_NOTEHEAD_WIDTH: number;
|
|
16
16
|
static STAVE_LINE_DISTANCE: number;
|
|
17
|
+
/**
|
|
18
|
+
* SMuFL stem anchor Y offsets for noteheads, in staff spaces (positive = above notehead center).
|
|
19
|
+
* Sourced from Bravura metadata `glyphsWithAnchors`: `stemUpSE[1]` (up) and `stemDownNW[1]` (down).
|
|
20
|
+
* Used to position the stem base at the correct SMuFL attachment point rather than the notehead center.
|
|
21
|
+
*/
|
|
22
|
+
static readonly noteHeadStemYOffsets: Record<string, {
|
|
23
|
+
up: number;
|
|
24
|
+
down: number;
|
|
25
|
+
}>;
|
|
17
26
|
static TEXT_HEIGHT_OFFSET_HACK: number;
|
|
18
27
|
static clefProperties(clef: string): {
|
|
19
28
|
lineShift: number;
|
|
@@ -14,6 +14,8 @@ export declare class TabNote extends StemmableNote {
|
|
|
14
14
|
protected ghost: boolean;
|
|
15
15
|
protected fretElement: Element[];
|
|
16
16
|
protected positions: TabNotePosition[];
|
|
17
|
+
/** Explicit fret size; otherwise use text metrics and this note's grace scale. */
|
|
18
|
+
protected fretFontSize?: string | number;
|
|
17
19
|
constructor(noteStruct: TabNoteStruct, drawStem?: boolean);
|
|
18
20
|
greatestString: () => number;
|
|
19
21
|
leastString: () => number;
|
|
@@ -22,6 +24,8 @@ export declare class TabNote extends StemmableNote {
|
|
|
22
24
|
hasStem(): boolean;
|
|
23
25
|
getStemExtension(): number;
|
|
24
26
|
static tabToElement(fret: string): Element;
|
|
27
|
+
/** Resize fret text as well as the parent. Set sizes before formatting the voice. */
|
|
28
|
+
setFontSize(size?: string | number): this;
|
|
25
29
|
updateWidth(): void;
|
|
26
30
|
setStave(stave: Stave): this;
|
|
27
31
|
getPositions(): TabNotePosition[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
1
2
|
import { Note } from './note';
|
|
2
3
|
import { TextNoteStruct } from './textnote';
|
|
3
4
|
/**
|
|
@@ -29,6 +30,8 @@ export declare class TextDynamics extends Note {
|
|
|
29
30
|
setLine(line: number): this;
|
|
30
31
|
/** Preformat the dynamics text. */
|
|
31
32
|
preFormat(): this;
|
|
33
|
+
/** Measure at the same page coordinates used by draw(), after voice formatting. */
|
|
34
|
+
getBoundingBox(): BoundingBox;
|
|
32
35
|
/** Draw the dynamics text on the rendering context. */
|
|
33
36
|
draw(): void;
|
|
34
37
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type MeasurementContext = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
2
|
+
/** Internal cache shared by Element.measureText() and Element.measureWidth(). */
|
|
3
|
+
export declare class TextMetricsCache {
|
|
4
|
+
private static readonly maxEntries;
|
|
5
|
+
private static readonly maxKeyLength;
|
|
6
|
+
private static entries;
|
|
7
|
+
private static context?;
|
|
8
|
+
private static fonts?;
|
|
9
|
+
private static fontCount?;
|
|
10
|
+
private static fontStatus?;
|
|
11
|
+
private static readonly onFontsChanged;
|
|
12
|
+
/** Also used by Metrics.clear() and explicit canvas/font replacement. */
|
|
13
|
+
static clear(): void;
|
|
14
|
+
/** Track document/worker fonts without retaining listeners on a replaced document. */
|
|
15
|
+
private static fontsReady;
|
|
16
|
+
/** Preserve all TextMetrics fields, which are prototype getters in browsers. */
|
|
17
|
+
private static snapshot;
|
|
18
|
+
/** Key shaping and bounds settings as well as font/text; never cache fallback during loading. */
|
|
19
|
+
static measure(context: MeasurementContext, text: string): Readonly<TextMetrics>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -28,7 +28,6 @@ export declare abstract class Tickable extends Element {
|
|
|
28
28
|
static get CATEGORY(): string;
|
|
29
29
|
protected ignoreTicks: boolean;
|
|
30
30
|
protected tupletStack: Tuplet[];
|
|
31
|
-
protected tuplet?: Tuplet;
|
|
32
31
|
protected ticks: Fraction;
|
|
33
32
|
protected centerXShift: number;
|
|
34
33
|
protected voice?: Voice;
|
|
@@ -69,18 +68,36 @@ export declare abstract class Tickable extends Element {
|
|
|
69
68
|
getVoice(): Voice;
|
|
70
69
|
/** Set the associated voice. */
|
|
71
70
|
setVoice(voice: Voice): void;
|
|
72
|
-
/** Get the
|
|
71
|
+
/** Get the Tuplet if any.
|
|
72
|
+
* If there are multiple Tuplets, the most recently added one is returned. */
|
|
73
73
|
getTuplet(): Tuplet | undefined;
|
|
74
|
-
/** Return a
|
|
75
|
-
getTupletStack(): Tuplet[];
|
|
74
|
+
/** Return a readonly array of Tuplets (might be empty). */
|
|
75
|
+
getTupletStack(): readonly Tuplet[];
|
|
76
76
|
/**
|
|
77
|
+
* Remove the given tuplet; raises an Error if the tuplet is not in the TupletStack.
|
|
78
|
+
*/
|
|
79
|
+
removeTuplet(tuplet: Tuplet): this;
|
|
80
|
+
/**
|
|
81
|
+
* Remove all tuplets from the tickable.
|
|
82
|
+
*/
|
|
83
|
+
clearTuplets(): this;
|
|
84
|
+
/**
|
|
85
|
+
* Deprecated, to be removed in v6. Use `removeTuplet(tuplet)` or `clearTuplets()` instead.
|
|
77
86
|
* Reset the specific Tuplet (if this is not provided, all tuplets are reset).
|
|
78
87
|
* Remove any prior tuplets from the tick calculation and
|
|
79
88
|
* reset the intrinsic tick value.
|
|
80
89
|
*/
|
|
81
90
|
resetTuplet(tuplet?: Tuplet): this;
|
|
82
|
-
/**
|
|
91
|
+
/** Set the tuplet to the given Tuplet. If there are existing tuplets clears them first. */
|
|
83
92
|
setTuplet(tuplet: Tuplet): this;
|
|
93
|
+
/** Add the given Tuplet to the tupletStack without clearing it first. */
|
|
94
|
+
addTuplet(tuplet: Tuplet): this;
|
|
95
|
+
/**
|
|
96
|
+
* Sets all the tuplets on the tickable to the given tupletStack. Note that
|
|
97
|
+
* a new array is created on the tickable, so manipulating the array that is
|
|
98
|
+
* passed in will not affect the tupletStack used by the tickable.
|
|
99
|
+
*/
|
|
100
|
+
setTupletStack(tupletStack: Tuplet[]): this;
|
|
84
101
|
/**
|
|
85
102
|
* Add self to the provided ModifierContext `mc`.
|
|
86
103
|
* If this tickable has modifiers, set modifierContext.
|
|
@@ -89,7 +106,6 @@ export declare abstract class Tickable extends Element {
|
|
|
89
106
|
addToModifierContext(mc: ModifierContext): this;
|
|
90
107
|
/**
|
|
91
108
|
* Optional, if tickable has modifiers, associate a Modifier.
|
|
92
|
-
* @param mod the modifier
|
|
93
109
|
*/
|
|
94
110
|
addModifier(modifier: Modifier, index?: number): this;
|
|
95
111
|
/** Get the list of associated modifiers. */
|
|
@@ -107,13 +123,14 @@ export declare abstract class Tickable extends Element {
|
|
|
107
123
|
/** Set postformatted status. */
|
|
108
124
|
set postFormatted(value: boolean);
|
|
109
125
|
get postFormatted(): boolean;
|
|
110
|
-
/** Return the intrinsic ticks. */
|
|
126
|
+
/** Return the intrinsic ticks as an integer. */
|
|
111
127
|
getIntrinsicTicks(): number;
|
|
112
|
-
/** Set the intrinsic ticks. */
|
|
128
|
+
/** Set the intrinsic ticks as an integer. */
|
|
113
129
|
setIntrinsicTicks(intrinsicTicks: number): void;
|
|
114
|
-
/** Get the tick multiplier. */
|
|
130
|
+
/** Get the tick multiplier as a Fraction. Defaults to Fraction(1, 1). */
|
|
115
131
|
getTickMultiplier(): Fraction;
|
|
116
|
-
/** Apply a tick multiplier
|
|
132
|
+
/** Apply a tick multiplier, by multiplying the current tickMultiplier by
|
|
133
|
+
* the numerator and denominator given here. Updates ticks. */
|
|
117
134
|
applyTickMultiplier(numerator: number, denominator: number): void;
|
|
118
135
|
/** Set the duration. */
|
|
119
136
|
setDuration(duration: Fraction): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
1
2
|
import { Element } from './element';
|
|
2
3
|
import { RenderContext } from './rendercontext';
|
|
3
4
|
import { Stave } from './stave';
|
|
@@ -16,6 +17,8 @@ export declare class TimeSignature extends StaveModifier {
|
|
|
16
17
|
static get CATEGORY(): string;
|
|
17
18
|
bottomLine: number;
|
|
18
19
|
topLine: number;
|
|
20
|
+
protected topRenderY: number;
|
|
21
|
+
protected botRenderY: number;
|
|
19
22
|
protected timeSpec: string;
|
|
20
23
|
protected line: number;
|
|
21
24
|
protected topText: Element;
|
|
@@ -68,4 +71,5 @@ export declare class TimeSignature extends StaveModifier {
|
|
|
68
71
|
*/
|
|
69
72
|
draw(): void;
|
|
70
73
|
drawAt(ctx: RenderContext, stave: Stave, x: number): void;
|
|
74
|
+
getBoundingBox(): BoundingBox;
|
|
71
75
|
}
|
|
@@ -39,8 +39,13 @@
|
|
|
39
39
|
* yOffset: int, default 0
|
|
40
40
|
* manually offset a tuplet, for instance to avoid collisions
|
|
41
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
|
|
42
46
|
* }
|
|
43
47
|
*/
|
|
48
|
+
import { BoundingBox } from './boundingbox';
|
|
44
49
|
import { Element } from './element';
|
|
45
50
|
import { Note } from './note';
|
|
46
51
|
export interface TupletOptions {
|
|
@@ -51,6 +56,7 @@ export interface TupletOptions {
|
|
|
51
56
|
ratioed?: boolean;
|
|
52
57
|
yOffset?: number;
|
|
53
58
|
textYOffset?: number;
|
|
59
|
+
suffix?: string;
|
|
54
60
|
}
|
|
55
61
|
export declare const enum TupletLocation {
|
|
56
62
|
BOTTOM = -1,
|
|
@@ -61,6 +67,7 @@ export declare class Tuplet extends Element {
|
|
|
61
67
|
notes: Note[];
|
|
62
68
|
protected options: Required<TupletOptions>;
|
|
63
69
|
protected textElement: Element;
|
|
70
|
+
protected suffixElement: Element;
|
|
64
71
|
static get LOCATION_TOP(): number;
|
|
65
72
|
static get LOCATION_BOTTOM(): number;
|
|
66
73
|
static get NESTING_OFFSET(): number;
|
|
@@ -87,4 +94,5 @@ export declare class Tuplet extends Element {
|
|
|
87
94
|
getNestedTupletCount(): number;
|
|
88
95
|
getYPosition(): number;
|
|
89
96
|
draw(): void;
|
|
97
|
+
getBoundingBox(): BoundingBox;
|
|
90
98
|
}
|
|
@@ -43,8 +43,9 @@ import { Registry } from './registry';
|
|
|
43
43
|
import { RenderContext } from './rendercontext';
|
|
44
44
|
import { Renderer, RendererBackends, RendererLineEndType } from './renderer';
|
|
45
45
|
import { RepeatNote } from './repeatnote';
|
|
46
|
+
import { Sheet } from './sheet';
|
|
46
47
|
import { Stave } from './stave';
|
|
47
|
-
import { Barline, BarlineType } from './stavebarline';
|
|
48
|
+
import { Barline, BarlineType, RepeatBracketType } from './stavebarline';
|
|
48
49
|
import { StaveConnector } from './staveconnector';
|
|
49
50
|
import { StaveHairpin } from './stavehairpin';
|
|
50
51
|
import { StaveLine } from './staveline';
|
|
@@ -144,6 +145,7 @@ export declare class VexFlow {
|
|
|
144
145
|
static Stroke: typeof Stroke;
|
|
145
146
|
static SVGContext: typeof SVGContext;
|
|
146
147
|
static System: typeof System;
|
|
148
|
+
static Sheet: typeof Sheet;
|
|
147
149
|
static TabNote: typeof TabNote;
|
|
148
150
|
static TabSlide: typeof TabSlide;
|
|
149
151
|
static TabStave: typeof TabStave;
|
|
@@ -176,6 +178,7 @@ export declare class VexFlow {
|
|
|
176
178
|
static RendererBackends: typeof RendererBackends;
|
|
177
179
|
static RendererLineEndType: typeof RendererLineEndType;
|
|
178
180
|
static BarlineType: typeof BarlineType;
|
|
181
|
+
static RepeatBracketType: typeof RepeatBracketType;
|
|
179
182
|
static StaveModifierPosition: typeof StaveModifierPosition;
|
|
180
183
|
static VoltaType: typeof VoltaType;
|
|
181
184
|
static TextBracketPosition: typeof TextBracketPosition;
|
|
@@ -218,6 +221,10 @@ export declare class VexFlow {
|
|
|
218
221
|
* See `demos/fonts/` for more examples.
|
|
219
222
|
*/
|
|
220
223
|
static setFonts(...fontNames: string[]): void;
|
|
224
|
+
/** Choose text faces independently. Music fonts remain available for mixed glyph strings. */
|
|
225
|
+
static setTextFonts(...fontNames: string[]): void;
|
|
226
|
+
/** Return the text-first stack used by new text elements. */
|
|
227
|
+
static getTextFonts(): string[];
|
|
221
228
|
static getFonts(): string[];
|
|
222
229
|
static get RENDER_PRECISION_PLACES(): number;
|
|
223
230
|
static set RENDER_PRECISION_PLACES(precision: number);
|
|
@@ -33,6 +33,8 @@ export declare class Voice extends Element {
|
|
|
33
33
|
protected mode: VoiceMode;
|
|
34
34
|
protected expTicksUsed?: number;
|
|
35
35
|
protected preFormatted: boolean;
|
|
36
|
+
/** Durations can change after insertion, for example when attaching tuplets. */
|
|
37
|
+
private ticksDirty;
|
|
36
38
|
protected options: {
|
|
37
39
|
softmaxFactor: number;
|
|
38
40
|
};
|
|
@@ -90,6 +92,10 @@ export declare class Voice extends Element {
|
|
|
90
92
|
protected reCalculateExpTicksUsed(): number;
|
|
91
93
|
/** Get the softmax-scaled value of a tick duration. 'tickValue' is a number. */
|
|
92
94
|
softmax(tickValue: number): number;
|
|
95
|
+
/** Invalidate cached duration totals when a member's duration changes. */
|
|
96
|
+
invalidateTicks(): void;
|
|
97
|
+
/** Recount once after a batch of duration edits; avoid partial-tuplet validation. */
|
|
98
|
+
private refreshTicks;
|
|
93
99
|
/** Add a tickable to the voice. */
|
|
94
100
|
addTickable(tickable: Tickable): this;
|
|
95
101
|
/** Add an array of tickables to the voice. */
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# 5.1.1
|
|
2
|
+
|
|
3
|
+
## Fixes and performance
|
|
4
|
+
|
|
5
|
+
- Cache repeated text measurements with bounded storage and clear cached metrics when fonts change.
|
|
6
|
+
- Keep copied metrics and styles independent without deep-cloning unrelated state.
|
|
7
|
+
- Document UTF-8 encoding in the HTML setup example.
|
|
8
|
+
|
|
9
|
+
## Explorer
|
|
10
|
+
|
|
11
|
+
- Use a compact layout with an 80% preview and the inspector beside the score.
|
|
12
|
+
- Add locally bundled CodeJar editing and Prism syntax highlighting.
|
|
13
|
+
- Format all examples consistently and add explanatory comments.
|
|
14
|
+
- Fix the keyboard shortcut regression test and isolate browser state between tests.
|
|
15
|
+
|
|
16
|
+
# 5.1.0
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Add `Sheet` and `EasyScore.measures()` for multi-measure scores that wrap to a chosen width.
|
|
21
|
+
- Add retained Factory drawing and inherited score styles for reflow and theme changes.
|
|
22
|
+
- Add portable SVG export with text and music glyphs converted to paths.
|
|
23
|
+
- Add separate text-font selection and explicit lyric baselines.
|
|
24
|
+
- Add optional repeat brackets, more key signatures, and tuplet label suffixes.
|
|
25
|
+
- Support longa, maxima, and 256th, 512th, and 1024th note durations.
|
|
26
|
+
- Add the [VexFlow Explorer](https://vexflow.com/explorer/) with editable examples, a glyph atlas, and visual inspection tools.
|
|
27
|
+
|
|
28
|
+
## Fixes
|
|
29
|
+
|
|
30
|
+
- Fix native ESM imports and package entry points.
|
|
31
|
+
- Correct accidental ordering across voices and rest collisions.
|
|
32
|
+
- Improve grace-note spacing, pedal placement, and ties near lyrics.
|
|
33
|
+
- Fix nested tuplet timing and refresh voice totals when durations change.
|
|
34
|
+
- Improve bounding boxes and keep repeated drawing stable.
|
|
35
|
+
- Correct stem placement on cross noteheads.
|
|
36
|
+
- Reject malformed durations, meters, and fractions. Protect Registry indexes from prototype-related keys.
|
|
37
|
+
- Update dependencies, including critical security fixes in development tooling.
|
|
38
|
+
|
|
39
|
+
## Upgrade notes
|
|
40
|
+
|
|
41
|
+
- `setTuplet()` now replaces existing tuplets. Use `addTuplet()` to stack them.
|
|
42
|
+
- `getTupletStack()` returns a readonly array in TypeScript. Use the tuplet methods to change it.
|
|
43
|
+
- `resetTuplet()` is deprecated. Use `removeTuplet()` or `clearTuplets()`.
|
|
44
|
+
- Text now prefers a text font. Call `setTextFonts()` after `setFonts()` to choose a custom face.
|
|
45
|
+
- Invalid inputs may now throw instead of being accepted. Layout fixes can change existing renderings.
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
- Add geometry, overlap, color, and image-difference regression checks.
|
|
50
|
+
- Add rendering benchmarks and update the Node/jsdom test setup.
|
|
51
|
+
- Keep explorer output and generated reports out of the npm package.
|
|
52
|
+
|
|
53
|
+
# 5.0.0
|
|
54
|
+
|
|
55
|
+
- `vex.ts` and `flow.ts` modules are merged into vexflow.ts, which exports the `VexFlow` class.
|
|
56
|
+
|
|
57
|
+
# 4.0.1
|
|
58
|
+
|
|
59
|
+
Detailed changes are listed on the wiki: https://github.com/0xfe/vexflow/wiki/Changelog-ver-4.0
|
|
60
|
+
|
|
61
|
+
## Features
|
|
62
|
+
|
|
63
|
+
- VexFlow is written in **TypeScript** with a ES6 target.
|
|
64
|
+
- Supports ES module in addition to CommonJS environments.
|
|
65
|
+
- Improved automatic layout of notes.
|
|
66
|
+
- Improved handling of music fonts and text fonts.
|
|
67
|
+
- Supports lazy loading of music fonts.
|
|
68
|
+
- Improved `setFont(...)` method in Element class.
|
|
69
|
+
|
|
70
|
+
## Breaking
|
|
71
|
+
|
|
72
|
+
- The tsconfig.json `compilerOptions.target` has been updated to ES6 / ES2015.
|
|
73
|
+
- `Stave.setNumLines(n: number)` requires a number. Previously, a string would also work. See: [stave.ts](https://github.com/0xfe/vexflow/blob/master/src/stave.ts) and [#1083](https://github.com/0xfe/vexflow/issues/1083).
|
|
74
|
+
- `Note.addModifier(modifier: Modifier, index?: number): this` now throws a RuntimeError if the parameters are reversed.
|
|
75
|
+
- `TickContext.getTickableForVoice(voiceIndex: number): Tickable` was previously named `getTickablesForVoice(voiceIndex: number): Note`. We removed the `s` because the method returns a single Tickable. You will need to update calls to this function if you are upgrading from a build from between April 2020 to August 2021.
|
|
76
|
+
- `Element` and its subclasses have a static `CATEGORY` string property, used by VexFlow internally to differentiate objects. This string has been standardized to be singular, with UpperCamelCase capitalization.
|
|
77
|
+
- Examples:
|
|
78
|
+
- `Accidental.CATEGORY` is now `'Accidental'` instead of `'accidentals'`.
|
|
79
|
+
- `Modifier.CATEGORY` is now `'Modifier'` instead of `'none'`.
|
|
80
|
+
- **ChordSymbol**
|
|
81
|
+
- `ChordSymbol.NO_TEXT_FORMAT` was previously named `ChordSymbol.NOTEXTFORMAT`.
|
|
82
|
+
- `ChordSymbol.metrics` was previously named `ChordSymbol.chordSymbolMetrics`.
|
|
83
|
+
- `StaveNote.LEDGER_LINE_OFFSET` was previously named `StaveNote.DEFAULT_LEDGER_LINE_OFFSET`.
|
|
84
|
+
- **Fonts**
|
|
85
|
+
|
|
86
|
+
- `TextFontMetrics` has been merged into `FontGlyph` due to substantial overlap.
|
|
87
|
+
- `Flow.NOTATION_FONT_SCALE` was previously named `Flow.DEFAULT_NOTATION_FONT_SCALE`.
|
|
88
|
+
- `setFont(...)` in `CanvasContext` and `SVGContext` previously took arguments: `family`, `size`, `weight`. The `weight` argument allowed strings like `'italic bold'`. This no longer works, and `'italic'` must now be passed into the `style` argument.
|
|
89
|
+
|
|
90
|
+
- **Build Process**
|
|
91
|
+
- Gruntfile environment variable `VEX_DEVTOOL` was previously named `VEX_GENMAP`. This environment variable sets the [webpack devtool configuration option](https://webpack.js.org/configuration/devtool/).
|
|
92
|
+
|
|
93
|
+
# 3.0.9 / 2020-04-21
|
|
94
|
+
|
|
95
|
+
- Support [Bravura](https://github.com/steinbergmedia/bravura), the reference font for [Standard Music Font Layout](https://w3c.github.io/smufl/latest/index.html).
|
|
96
|
+
|
|
97
|
+
# 1.2.84 / 2017-08-01
|
|
98
|
+
|
|
99
|
+
- `Accidental.ApplyAccidentals()` no longer breaks on `Notes` that ignore ticks (ie: `TimeSigNote`)
|
|
100
|
+
- `Accidental.applyAccidentals()` now applies accidentals to `GraceNotes`
|
|
101
|
+
- Fix a `BoundingBox#mergeWith` case when one box contains another
|
|
102
|
+
- Fix blurry canvas rendering on retina screens
|
|
103
|
+
- Rebuild noteheads after `StaveNote#setKeyLine` is called
|
|
104
|
+
- Ensure `StaveNote.extraLeftPx` and `StaveNote.extraRightPx` get recalculated in `StaveNote#reset`
|
|
105
|
+
- `Factory` exposes a lot more elements -- **API is subject to change**
|
|
106
|
+
- `Factory` constructor `options.renderer.selector` renamed to `options.renderer.elementId` to more appropriately reflect the what the string represents
|
|
107
|
+
- Sori and koron microtonal accidentals have been added
|
|
108
|
+
- Tests have been refactored to use `Factory` and `EasyScore`
|
|
109
|
+
- The font transformation tool (`transform.html`) has been refactored, and generates a font by combining both the `Gonville` and `Microtonal` fonts.
|