vexflow 5.1.1 → 5.2.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 +8 -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 +2916 -484
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +2761 -451
- 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 +3 -0
- package/build/esm/src/articulation.js +27 -14
- package/build/esm/src/beam.js +12 -2
- package/build/esm/src/chordkerning.js +98 -0
- package/build/esm/src/chordsymbol.js +108 -27
- package/build/esm/src/clef.js +3 -0
- package/build/esm/src/clefnote.js +5 -1
- package/build/esm/src/dot.js +1 -1
- package/build/esm/src/easyscore/composition.js +297 -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 +69 -0
- package/build/esm/src/easyscore/rhythm.js +42 -0
- package/build/esm/src/easyscore.js +448 -26
- package/build/esm/src/element.js +13 -2
- package/build/esm/src/factory.js +256 -60
- package/build/esm/src/formatter.js +32 -4
- package/build/esm/src/keysignature.js +9 -1
- package/build/esm/src/keysignote.js +2 -2
- package/build/esm/src/note.js +5 -0
- package/build/esm/src/parenthesis.js +1 -1
- package/build/esm/src/parser.js +6 -1
- package/build/esm/src/proportionalformatter.js +186 -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 +12 -12
- package/build/esm/src/stemmablenote.js +6 -1
- package/build/esm/src/tickable.js +5 -0
- package/build/esm/src/tuplet.js +3 -2
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +2 -1
- package/build/esm/tests/beam_tests.js +35 -0
- package/build/esm/tests/easyscore_tests.js +40 -0
- package/build/esm/tests/easyscore_types.js +65 -0
- package/build/esm/tests/formatter_tests.js +41 -0
- package/build/esm/tests/node/chord-kerning-tests.mjs +173 -0
- package/build/esm/tests/node/easyscore-rendering-tests.mjs +332 -0
- package/build/esm/tests/node/easyscore-tests.mjs +953 -0
- package/build/esm/tests/node/proportional-spacing-tests.mjs +214 -0
- package/build/esm/tests/node/tool-security-tests.mjs +85 -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/types/src/accidental.d.ts +2 -0
- package/build/types/src/articulation.d.ts +6 -0
- package/build/types/src/beam.d.ts +2 -0
- package/build/types/src/chordkerning.d.ts +42 -0
- package/build/types/src/chordsymbol.d.ts +19 -0
- package/build/types/src/clef.d.ts +2 -0
- package/build/types/src/easyscore/composition.d.ts +107 -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 +5 -1
- package/build/types/src/factory.d.ts +91 -8
- package/build/types/src/formatter.d.ts +7 -1
- package/build/types/src/keysignature.d.ts +3 -0
- package/build/types/src/keysignote.d.ts +1 -1
- package/build/types/src/note.d.ts +2 -0
- package/build/types/src/parser.d.ts +5 -0
- package/build/types/src/proportionalformatter.d.ts +30 -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 +1 -1
- package/build/types/src/stemmablenote.d.ts +6 -1
- package/build/types/src/tickable.d.ts +2 -0
- package/build/types/src/vexflow.d.ts +2 -1
- package/changelog/CHANGELOG.md +57 -0
- package/package.json +19 -7
- package/tests/flow.html +10 -3
|
@@ -3,9 +3,13 @@ import { Annotation, AnnotationHorizontalJustify, AnnotationVerticalJustify } fr
|
|
|
3
3
|
import { Articulation } from './articulation';
|
|
4
4
|
import { BarNote } from './barnote';
|
|
5
5
|
import { Beam, PartialBeamDirection } from './beam';
|
|
6
|
+
import { Bend } from './bend';
|
|
6
7
|
import { ChordSymbol } from './chordsymbol';
|
|
8
|
+
import { Clef } from './clef';
|
|
7
9
|
import { ClefNote } from './clefnote';
|
|
10
|
+
import { Crescendo } from './crescendo';
|
|
8
11
|
import { Curve, CurveOptions } from './curve';
|
|
12
|
+
import { Dot } from './dot';
|
|
9
13
|
import { EasyScore, EasyScoreOptions } from './easyscore';
|
|
10
14
|
import { Element } from './element';
|
|
11
15
|
import { FontInfo } from './font';
|
|
@@ -15,35 +19,53 @@ import { GhostNote } from './ghostnote';
|
|
|
15
19
|
import { GlyphNote, GlyphNoteOptions } from './glyphnote';
|
|
16
20
|
import { GraceNote, GraceNoteStruct } from './gracenote';
|
|
17
21
|
import { GraceNoteGroup } from './gracenotegroup';
|
|
22
|
+
import { GraceTabNote } from './gracetabnote';
|
|
23
|
+
import { KeySignature } from './keysignature';
|
|
18
24
|
import { KeySigNote } from './keysignote';
|
|
25
|
+
import { Modifier } from './modifier';
|
|
19
26
|
import { ModifierContext } from './modifiercontext';
|
|
20
27
|
import { MultiMeasureRest, MultimeasureRestRenderOptions } from './multimeasurerest';
|
|
21
28
|
import { Note, NoteStruct } from './note';
|
|
22
29
|
import { NoteSubGroup } from './notesubgroup';
|
|
23
30
|
import { Ornament } from './ornament';
|
|
31
|
+
import { Parenthesis } from './parenthesis';
|
|
24
32
|
import { PedalMarking } from './pedalmarking';
|
|
25
33
|
import { RenderContext } from './rendercontext';
|
|
26
34
|
import { RepeatNote } from './repeatnote';
|
|
27
35
|
import { Sheet, SheetOptions } from './sheet';
|
|
28
36
|
import { Stave, StaveOptions } from './stave';
|
|
29
|
-
import { BarlineType } from './stavebarline';
|
|
37
|
+
import { Barline, BarlineType } from './stavebarline';
|
|
30
38
|
import { StaveConnector, StaveConnectorType } from './staveconnector';
|
|
39
|
+
import { StaveHairpin, StaveHairpinRenderOptions } from './stavehairpin';
|
|
31
40
|
import { StaveLine } from './staveline';
|
|
32
41
|
import { StaveNote, StaveNoteStruct } from './stavenote';
|
|
42
|
+
import { Repetition } from './staverepetition';
|
|
43
|
+
import { StaveSection } from './stavesection';
|
|
44
|
+
import { StaveTempo } from './stavetempo';
|
|
45
|
+
import { StaveText } from './stavetext';
|
|
33
46
|
import { StaveTie } from './stavetie';
|
|
47
|
+
import { Volta } from './stavevolta';
|
|
34
48
|
import { StemmableNote } from './stemmablenote';
|
|
35
49
|
import { StringNumber } from './stringnumber';
|
|
50
|
+
import { Stroke } from './strokes';
|
|
36
51
|
import { System, SystemOptions } from './system';
|
|
37
52
|
import { TabNote, TabNoteStruct } from './tabnote';
|
|
53
|
+
import { TabSlide } from './tabslide';
|
|
38
54
|
import { TabStave } from './tabstave';
|
|
55
|
+
import { TabTie } from './tabtie';
|
|
39
56
|
import { TextBracket } from './textbracket';
|
|
40
57
|
import { TextDynamics } from './textdynamics';
|
|
41
58
|
import { TextNote, TextNoteStruct } from './textnote';
|
|
42
59
|
import { TickContext } from './tickcontext';
|
|
60
|
+
import { TimeSignature } from './timesignature';
|
|
43
61
|
import { TimeSigNote } from './timesignote';
|
|
62
|
+
import { Tremolo } from './tremolo';
|
|
44
63
|
import { Tuplet, TupletOptions } from './tuplet';
|
|
64
|
+
import { Vibrato } from './vibrato';
|
|
45
65
|
import { VibratoBracket } from './vibratobracket';
|
|
46
66
|
import { Voice, VoiceTime } from './voice';
|
|
67
|
+
/** Explicit drawing role for a native extension adopted into a Factory. */
|
|
68
|
+
export type FactoryElementRole = 'note' | 'modifier' | 'staveModifier' | 'drawable';
|
|
47
69
|
export interface FactoryOptions {
|
|
48
70
|
stave?: {
|
|
49
71
|
space: number;
|
|
@@ -81,6 +103,24 @@ export declare class Factory {
|
|
|
81
103
|
protected systems: System[];
|
|
82
104
|
protected sheets: Sheet[];
|
|
83
105
|
private retained;
|
|
106
|
+
/** Ownership survives drawing; weak keys do not retain discarded notation. */
|
|
107
|
+
private static owners;
|
|
108
|
+
private constructionScopes;
|
|
109
|
+
private groupScopes;
|
|
110
|
+
private static groups;
|
|
111
|
+
/** A grouped note draws only through its modifier, never through a main voice or queue. */
|
|
112
|
+
static getGroup(note: Note): Modifier | undefined;
|
|
113
|
+
/** Identify the Factory that created an element, without changing its draw role. */
|
|
114
|
+
static getOwner(element: Element): Factory | undefined;
|
|
115
|
+
/** Record ownership independently of whether the element draws itself or attaches to a note. */
|
|
116
|
+
private own;
|
|
117
|
+
/**
|
|
118
|
+
* Adopt a native extension without guessing its drawing role. Attachment and layout remain explicit.
|
|
119
|
+
* Repeating adoption cannot enqueue an element twice. Ownership survives draw/reset.
|
|
120
|
+
*/
|
|
121
|
+
adopt<T extends Element>(element: T, role: FactoryElementRole): T;
|
|
122
|
+
/** Stage synchronous construction. Failed operations preserve existing queues and registry entries. */
|
|
123
|
+
transaction<T>(build: () => T): T;
|
|
84
124
|
/** Foreground defaults survive reset(), like renderer options. */
|
|
85
125
|
protected style: {
|
|
86
126
|
fillStyle?: string;
|
|
@@ -121,6 +161,32 @@ export declare class Factory {
|
|
|
121
161
|
width?: number;
|
|
122
162
|
options?: StaveOptions;
|
|
123
163
|
}): TabStave;
|
|
164
|
+
/** Construct a native Bend with an explicit drawing role. */
|
|
165
|
+
Bend(...args: ConstructorParameters<typeof Bend>): Bend;
|
|
166
|
+
/** Construct a native Clef with an explicit drawing role. */
|
|
167
|
+
Clef(...args: ConstructorParameters<typeof Clef>): Clef;
|
|
168
|
+
/** Construct a native KeySignature with an explicit drawing role. */
|
|
169
|
+
KeySignature(...args: ConstructorParameters<typeof KeySignature>): KeySignature;
|
|
170
|
+
/** Construct a native TimeSignature with an explicit drawing role. */
|
|
171
|
+
TimeSignature(...args: ConstructorParameters<typeof TimeSignature>): TimeSignature;
|
|
172
|
+
/** Construct a native Barline with an explicit drawing role. */
|
|
173
|
+
Barline(...args: ConstructorParameters<typeof Barline>): Barline;
|
|
174
|
+
/** Construct a native Repetition with an explicit drawing role. */
|
|
175
|
+
Repetition(...args: ConstructorParameters<typeof Repetition>): Repetition;
|
|
176
|
+
/** Construct a native Volta with an explicit drawing role. */
|
|
177
|
+
Volta(...args: ConstructorParameters<typeof Volta>): Volta;
|
|
178
|
+
/** Construct a native StaveSection with an explicit drawing role. */
|
|
179
|
+
StaveSection(...args: ConstructorParameters<typeof StaveSection>): StaveSection;
|
|
180
|
+
/** Construct a native StaveTempo with an explicit drawing role. */
|
|
181
|
+
StaveTempo(...args: ConstructorParameters<typeof StaveTempo>): StaveTempo;
|
|
182
|
+
/** Construct a native StaveText with an explicit drawing role. */
|
|
183
|
+
StaveText(...args: ConstructorParameters<typeof StaveText>): StaveText;
|
|
184
|
+
/** Construct a native TabTie with an explicit drawing role. */
|
|
185
|
+
TabTie(...args: ConstructorParameters<typeof TabTie>): TabTie;
|
|
186
|
+
/** Construct a native TabSlide with an explicit drawing role. */
|
|
187
|
+
TabSlide(...args: ConstructorParameters<typeof TabSlide>): TabSlide;
|
|
188
|
+
/** Grace tab children draw through a GraceNoteGroup, never as standalone tickables. */
|
|
189
|
+
GraceTabNote(options: TabNoteStruct): GraceTabNote;
|
|
124
190
|
StaveNote(noteStruct: StaveNoteStruct): StaveNote;
|
|
125
191
|
GlyphNote(glyph: string, noteStruct: NoteStruct, options?: GlyphNoteOptions): GlyphNote;
|
|
126
192
|
RepeatNote(type: string, noteStruct?: NoteStruct, options?: GlyphNoteOptions): RepeatNote;
|
|
@@ -143,8 +209,9 @@ export declare class Factory {
|
|
|
143
209
|
key: string;
|
|
144
210
|
cancelKey?: string;
|
|
145
211
|
alterKey?: string[];
|
|
212
|
+
clef?: string;
|
|
146
213
|
}): KeySigNote;
|
|
147
|
-
TabNote(noteStruct: TabNoteStruct): TabNote;
|
|
214
|
+
TabNote(noteStruct: TabNoteStruct, drawStem?: boolean): TabNote;
|
|
148
215
|
GraceNote(noteStruct: GraceNoteStruct): GraceNote;
|
|
149
216
|
GraceNoteGroup(params: {
|
|
150
217
|
notes: StemmableNote[];
|
|
@@ -177,12 +244,7 @@ export declare class Factory {
|
|
|
177
244
|
lowerAccidental?: string;
|
|
178
245
|
delayed?: boolean;
|
|
179
246
|
}): Ornament;
|
|
180
|
-
TextDynamics(params?:
|
|
181
|
-
text?: string;
|
|
182
|
-
duration?: string;
|
|
183
|
-
dots?: number;
|
|
184
|
-
line?: number;
|
|
185
|
-
}): TextDynamics;
|
|
247
|
+
TextDynamics(params?: Partial<TextNoteStruct>): TextDynamics;
|
|
186
248
|
Fingering(params: {
|
|
187
249
|
number?: string;
|
|
188
250
|
position?: string;
|
|
@@ -283,6 +345,27 @@ export declare class Factory {
|
|
|
283
345
|
NoteSubGroup(params?: {
|
|
284
346
|
notes?: Note[];
|
|
285
347
|
}): NoteSubGroup;
|
|
348
|
+
/** Transfer unvoiced notes to one modifier. Validation happens before native voice assignment. */
|
|
349
|
+
groupNotes<T extends Modifier>(notes: Note[], construct: () => T): T;
|
|
350
|
+
/** Construct a native Dot for attachment; preserve its full constructor options. */
|
|
351
|
+
Dot(...args: ConstructorParameters<typeof Dot>): Dot;
|
|
352
|
+
/** Construct a native Parenthesis for attachment; preserve its full constructor options. */
|
|
353
|
+
Parenthesis(...args: ConstructorParameters<typeof Parenthesis>): Parenthesis;
|
|
354
|
+
/** Construct a native Stroke for attachment; preserve its full constructor options. */
|
|
355
|
+
Stroke(...args: ConstructorParameters<typeof Stroke>): Stroke;
|
|
356
|
+
/** Construct a native Tremolo for attachment; preserve its full constructor options. */
|
|
357
|
+
Tremolo(...args: ConstructorParameters<typeof Tremolo>): Tremolo;
|
|
358
|
+
/** Construct a native Vibrato for attachment; preserve its full constructor options. */
|
|
359
|
+
Vibrato(...args: ConstructorParameters<typeof Vibrato>): Vibrato;
|
|
360
|
+
/** Timed crescendo note; span hairpins have a separate constructor. */
|
|
361
|
+
Crescendo(...args: ConstructorParameters<typeof Crescendo>): Crescendo;
|
|
362
|
+
/** Stave-bound hairpin. The native renderer requires both endpoints. */
|
|
363
|
+
StaveHairpin(params: {
|
|
364
|
+
from: Note;
|
|
365
|
+
to: Note;
|
|
366
|
+
type: number;
|
|
367
|
+
options?: Partial<StaveHairpinRenderOptions>;
|
|
368
|
+
}): StaveHairpin;
|
|
286
369
|
/** Render the score. */
|
|
287
370
|
draw(options?: {
|
|
288
371
|
retain?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BoundingBox } from './boundingbox';
|
|
2
2
|
import { ModifierContext } from './modifiercontext';
|
|
3
|
+
import { ProportionalSpacing } from './proportionalformatter';
|
|
3
4
|
import { RenderContext } from './rendercontext';
|
|
4
5
|
import { Stave } from './stave';
|
|
5
6
|
import { StemmableNote } from './stemmablenote';
|
|
@@ -8,7 +9,10 @@ import { TabStave } from './tabstave';
|
|
|
8
9
|
import { Tickable } from './tickable';
|
|
9
10
|
import { TickContext } from './tickcontext';
|
|
10
11
|
import { Voice } from './voice';
|
|
12
|
+
export type { ProportionalSpacing } from './proportionalformatter';
|
|
11
13
|
export interface FormatterOptions {
|
|
14
|
+
/** Omit to use the default engraving layout. */
|
|
15
|
+
spacing?: ProportionalSpacing;
|
|
12
16
|
/** Defaults to Tables.SOFTMAX_FACTOR. */
|
|
13
17
|
softmaxFactor?: number;
|
|
14
18
|
/** Defaults to `false`. */
|
|
@@ -69,7 +73,9 @@ export declare class Formatter {
|
|
|
69
73
|
protected totalCost: number;
|
|
70
74
|
protected totalShift: number;
|
|
71
75
|
protected tickContexts: AlignmentTickContexts;
|
|
72
|
-
protected formatterOptions: Required<FormatterOptions>;
|
|
76
|
+
protected formatterOptions: Required<Omit<FormatterOptions, 'spacing'>> & Pick<FormatterOptions, 'spacing'>;
|
|
77
|
+
/** Present only for the opt-in rational timeline. */
|
|
78
|
+
private proportional?;
|
|
73
79
|
protected modifierContexts: AlignmentModifierContexts[];
|
|
74
80
|
protected voices: Voice[];
|
|
75
81
|
protected lossHistory: number[];
|
|
@@ -5,6 +5,7 @@ export declare class KeySignature extends StaveModifier {
|
|
|
5
5
|
static get CATEGORY(): string;
|
|
6
6
|
protected paddingForced: boolean;
|
|
7
7
|
protected formatted?: boolean;
|
|
8
|
+
protected clefOverride?: string;
|
|
8
9
|
protected cancelKeySpec?: string;
|
|
9
10
|
protected accList: {
|
|
10
11
|
type: string;
|
|
@@ -38,6 +39,8 @@ export declare class KeySignature extends StaveModifier {
|
|
|
38
39
|
}[]): void;
|
|
39
40
|
getPadding(index: number): number;
|
|
40
41
|
getWidth(): number;
|
|
42
|
+
/** Override staff clef for an inline signature following an inline clef change. */
|
|
43
|
+
setClef(clef?: string): this;
|
|
41
44
|
setKeySig(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]): this;
|
|
42
45
|
alterKey(alterKeySpec: string[]): this;
|
|
43
46
|
protected convertToAlterAccList(alterKeySpec: string[]): void;
|
|
@@ -4,7 +4,7 @@ import { Note } from './note';
|
|
|
4
4
|
export declare class KeySigNote extends Note {
|
|
5
5
|
static get CATEGORY(): string;
|
|
6
6
|
protected keySignature: KeySignature;
|
|
7
|
-
constructor(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]);
|
|
7
|
+
constructor(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[], clef?: string);
|
|
8
8
|
addToModifierContext(mc: ModifierContext): this;
|
|
9
9
|
preFormat(): this;
|
|
10
10
|
draw(): void;
|
|
@@ -132,6 +132,8 @@ export declare abstract class Note extends Tickable {
|
|
|
132
132
|
addStroke(index: number, stroke: Stroke): this;
|
|
133
133
|
/** Get the target stave. */
|
|
134
134
|
getStave(): Stave | undefined;
|
|
135
|
+
/** Release a staged stave assignment when managed composition fails. */
|
|
136
|
+
clearStave(): this;
|
|
135
137
|
/** Check and get the target stave. */
|
|
136
138
|
checkStave(): Stave;
|
|
137
139
|
/** Set the target stave. */
|
|
@@ -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,30 @@
|
|
|
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
|
+
/** Build a common rational timeline without advancing time for clefs or barlines. */
|
|
10
|
+
export declare class ProportionalFormatter {
|
|
11
|
+
readonly contexts: AlignmentTickContexts;
|
|
12
|
+
private readonly anchors;
|
|
13
|
+
private readonly quarterTicks;
|
|
14
|
+
private readonly duration;
|
|
15
|
+
private origin;
|
|
16
|
+
private tail;
|
|
17
|
+
private minimumScale;
|
|
18
|
+
private centeredWidth;
|
|
19
|
+
constructor(voices: Voice[], resolutionMultiplier: number);
|
|
20
|
+
/** Convert an exact timeline key once, at the point where pixels are needed. */
|
|
21
|
+
private quarters;
|
|
22
|
+
/** Measure each stave independently so unrelated onsets on other staves do not compete. */
|
|
23
|
+
private measure;
|
|
24
|
+
/** Compute one scale and validate it before changing any anchor positions. */
|
|
25
|
+
private dimensions;
|
|
26
|
+
/** Minimum total width for autoWidth, honoring a supplied exact scale. */
|
|
27
|
+
minimumWidth(spacing: ProportionalSpacing): number;
|
|
28
|
+
/** Place anchors and prefixes, retaining the established centering exception for measure rests. */
|
|
29
|
+
format(spacing: ProportionalSpacing, width: number): number;
|
|
30
|
+
}
|
|
@@ -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;
|
|
@@ -65,7 +65,7 @@ export declare class StaveNote extends StemmableNote {
|
|
|
65
65
|
autoStem(): void;
|
|
66
66
|
calculateOptimalStemDirection(): number;
|
|
67
67
|
calculateKeyProps(): void;
|
|
68
|
-
getBoundingBox(): BoundingBox;
|
|
68
|
+
getBoundingBox(includeModifiers?: boolean): BoundingBox;
|
|
69
69
|
getLineNumber(isTopNote?: boolean): number;
|
|
70
70
|
/**
|
|
71
71
|
* @returns true if this note is a type of rest. Rests don't have pitches, but take up space in the score.
|
|
@@ -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;
|
|
@@ -12,7 +12,7 @@ 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
17
|
import { Factory } from './factory';
|
|
18
18
|
import { Font, FontStyle, FontWeight } from './font';
|
|
@@ -101,6 +101,7 @@ export declare class VexFlow {
|
|
|
101
101
|
static Curve: typeof Curve;
|
|
102
102
|
static Dot: typeof Dot;
|
|
103
103
|
static EasyScore: typeof EasyScore;
|
|
104
|
+
static EasyScoreError: typeof EasyScoreError;
|
|
104
105
|
static Element: typeof Element;
|
|
105
106
|
static Factory: typeof Factory;
|
|
106
107
|
static Font: typeof Font;
|
package/changelog/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
+
# 5.2.0
|
|
2
|
+
|
|
3
|
+
## EasyScore
|
|
4
|
+
|
|
5
|
+
- Add the first typed composition slice: `EasyScore.create()`, annotation/tie constructors, attachment, systems, styling, and drawing.
|
|
6
|
+
- Add pure notation parsing with source diagnostics and rollback for failed strict construction and measure requests.
|
|
7
|
+
- Apply native note options and voice modes, meter objects, resolution, and softmax settings.
|
|
8
|
+
- Support validated articulation aliases, codes, and glyphs. Unknown names no longer silently become staccato.
|
|
9
|
+
- Preserve legacy non-throwing parsing, custom builders, and commit hooks.
|
|
10
|
+
- Add a user guide, Explorer examples, feature coverage checklist, and native-rendering parity tests.
|
|
11
|
+
- Add score-local ID lookup and source provenance, with duplicate checks, rename tracking, and reset/rollback cleanup.
|
|
12
|
+
- Adopt native notes, modifiers, and standalone drawables with explicit roles and ownership checks.
|
|
13
|
+
- Select parsed notation from Explorer clicks without guessing ambiguous or stale editor locations.
|
|
14
|
+
|
|
15
|
+
- Add typed note sequences, percussion heads, native modifier helpers, and single-owner grace/subnote groups.
|
|
16
|
+
- Add pure extension validation, Sheet access, and synchronous construction batches.
|
|
17
|
+
- Preserve native dot and parenthesis fonts without requiring a browser document in Node.
|
|
18
|
+
- Add rhythm and relationship helpers, tablature and staff constructors, and structured composition with explicit responsive layout policies.
|
|
19
|
+
- Preserve clef state across composed key changes and resolve automatic stems for complete beam groups.
|
|
20
|
+
|
|
21
|
+
## Notation
|
|
22
|
+
|
|
23
|
+
- Add strict proportional spacing for shared rhythmic timelines.
|
|
24
|
+
|
|
25
|
+
## Interactive guide
|
|
26
|
+
|
|
27
|
+
- Add Quickstart, EasyScore, native API lessons, and an editable playground with bundled assets.
|
|
28
|
+
- Reuse the loaded VexFlow runtime and fonts across lesson and playground navigation.
|
|
29
|
+
- Add browser coverage for navigation, editing, exports, mobile layouts, and asset reuse.
|
|
30
|
+
|
|
31
|
+
## Development
|
|
32
|
+
|
|
33
|
+
- Add EasyScore consumer-package and declaration checks.
|
|
34
|
+
- Consolidate build, testing, release, and upload instructions.
|
|
35
|
+
|
|
36
|
+
# 5.1.2
|
|
37
|
+
|
|
38
|
+
## Notation
|
|
39
|
+
|
|
40
|
+
- Add opt-in chord-symbol kerning for Academico/Bravura and Petaluma Script/Petaluma.
|
|
41
|
+
- Support custom kerning profiles with shared Canvas/SVG positioning and stable script bounds.
|
|
42
|
+
- Add an Explorer comparison for chord kerning.
|
|
43
|
+
|
|
44
|
+
## Testing and deployment
|
|
45
|
+
|
|
46
|
+
- Add `npm run tests:upload` to publish the complete visual test gallery to `vexflow.com/tests/`.
|
|
47
|
+
- Bundle QUnit, the test library, source maps, and fonts with no runtime CDN dependency.
|
|
48
|
+
- Share the Explorer's verified upload path, immutable assets, and short HTML cache.
|
|
49
|
+
- Test the standalone gallery, filtering, and deployment behavior in CI.
|
|
50
|
+
|
|
51
|
+
## Security and tooling
|
|
52
|
+
|
|
53
|
+
- Update development dependencies and remove vulnerable transitive packages.
|
|
54
|
+
- Use argument arrays for release commands and reject invalid version inputs.
|
|
55
|
+
- Render uploaded font metadata as text instead of HTML.
|
|
56
|
+
- Update CI actions and pin Node 26.13.1. Use read-only permissions and audit dependencies in CI.
|
|
57
|
+
|
|
1
58
|
# 5.1.1
|
|
2
59
|
|
|
3
60
|
## Fixes and performance
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vexflow",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "A JavaScript library for rendering music notation and guitar tablature.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -93,13 +93,12 @@
|
|
|
93
93
|
"eslint-plugin-import": "^2.31.0",
|
|
94
94
|
"eslint-plugin-prettier": "^5.4.1",
|
|
95
95
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
96
|
-
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
97
96
|
"globals": "^16.2.0",
|
|
98
97
|
"grunt": "^1.6.1",
|
|
99
98
|
"grunt-cli": "^1.5.0",
|
|
100
99
|
"grunt-contrib-clean": "^2.0.1",
|
|
101
100
|
"grunt-contrib-copy": "^1.0.0",
|
|
102
|
-
"grunt-contrib-qunit": "
|
|
101
|
+
"grunt-contrib-qunit": "11.0.0",
|
|
103
102
|
"grunt-eslint": "^25.0.0",
|
|
104
103
|
"grunt-webpack": "^7.0.0",
|
|
105
104
|
"jsdom": "^26.1.0",
|
|
@@ -108,10 +107,10 @@
|
|
|
108
107
|
"opentype.js": "^1.3.4",
|
|
109
108
|
"prettier": "^3.5.3",
|
|
110
109
|
"prismjs": "1.30.0",
|
|
111
|
-
"puppeteer": "
|
|
110
|
+
"puppeteer": "25.17.0",
|
|
112
111
|
"qunit": "^2.24.1",
|
|
113
112
|
"recursive-copy": "^2.0.14",
|
|
114
|
-
"release-it": "
|
|
113
|
+
"release-it": "21.1.2",
|
|
115
114
|
"string-replace-loader": "^3.1.0",
|
|
116
115
|
"svg2pdf.js": "^2.5.0",
|
|
117
116
|
"terser-webpack-plugin": "^5.3.14",
|
|
@@ -133,7 +132,15 @@
|
|
|
133
132
|
"explorer": "node tools/explorer/cli.mjs serve",
|
|
134
133
|
"explorer:build": "node tools/explorer/cli.mjs build",
|
|
135
134
|
"explorer:test": "node tools/explorer/test.mjs",
|
|
136
|
-
"explorer:upload": "node tools/explorer/upload.mjs"
|
|
135
|
+
"explorer:upload": "node tools/explorer/upload.mjs",
|
|
136
|
+
"tests:build": "node tools/tests-site.mjs build",
|
|
137
|
+
"tests:upload": "node tools/tests-site.mjs upload",
|
|
138
|
+
"tests:test": "node tools/tests-site.test.mjs",
|
|
139
|
+
"test:easyscore-package": "grunt build:esm build:types build:cjs && node tools/easyscore-package-check.mjs",
|
|
140
|
+
"guide": "node guide/cli.mjs serve",
|
|
141
|
+
"guide:build": "node guide/cli.mjs build",
|
|
142
|
+
"guide:test": "node guide/test.mjs",
|
|
143
|
+
"guide:upload": "node guide/cli.mjs upload"
|
|
137
144
|
},
|
|
138
145
|
"homepage": "https://vexflow.com/",
|
|
139
146
|
"keywords": [
|
|
@@ -147,9 +154,14 @@
|
|
|
147
154
|
"structured-clone-es": "^1.0.0"
|
|
148
155
|
},
|
|
149
156
|
"overrides": {
|
|
150
|
-
"undici": "6.23.0",
|
|
151
157
|
"concurrently": {
|
|
152
158
|
"shell-quote": "1.11.0"
|
|
159
|
+
},
|
|
160
|
+
"@typescript-eslint/typescript-estree": {
|
|
161
|
+
"minimatch": "11.0.7"
|
|
162
|
+
},
|
|
163
|
+
"get-uri": {
|
|
164
|
+
"basic-ftp": "6.2.6"
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
167
|
}
|
package/tests/flow.html
CHANGED
|
@@ -124,14 +124,16 @@
|
|
|
124
124
|
// When flow.html is hosted on unpkg.com, the query string is not available.
|
|
125
125
|
// Allow the user to specify params via the # fragment identifier.
|
|
126
126
|
const hashParams = new URLSearchParams(location.hash.substr(1));
|
|
127
|
+
// Static deployments supply a local, fingerprinted bundle. Keep all test filters available.
|
|
128
|
+
const bundledSource = document.querySelector('meta[name="vexflow-test-bundle"]')?.content;
|
|
127
129
|
|
|
128
130
|
// Optional: Specify the QUnit module or filter in the query params or fragment identifier.
|
|
129
131
|
let QUnitModule = queryParams.get('module') ?? hashParams.get('module');
|
|
130
132
|
let QUnitFilter = queryParams.get('filter') ?? hashParams.get('filter');
|
|
131
133
|
|
|
132
134
|
// The `ver` query param chooses which VexFlow version to load. If omitted, `ver` defaults to 'build'.
|
|
133
|
-
const ver = queryParams.get('ver') ?? hashParams.get('ver') ?? 'build';
|
|
134
|
-
let useESM = queryParams.get('esm') === 'true' || hashParams.get('esm') === 'true';
|
|
135
|
+
const ver = bundledSource ? 'bundled build' : (queryParams.get('ver') ?? hashParams.get('ver') ?? 'build');
|
|
136
|
+
let useESM = !bundledSource && (queryParams.get('esm') === 'true' || hashParams.get('esm') === 'true');
|
|
135
137
|
const isFileProtocol = location.protocol === 'file:';
|
|
136
138
|
|
|
137
139
|
// Determine if we are loading VexFlow from a CDN.
|
|
@@ -148,7 +150,9 @@
|
|
|
148
150
|
const pathCJSorESM = (useESM ? 'esm/entry' : 'cjs') + '/vexflow-debug-with-tests.js';
|
|
149
151
|
|
|
150
152
|
let vexPlusTestsURL;
|
|
151
|
-
if (
|
|
153
|
+
if (bundledSource) {
|
|
154
|
+
vexPlusTestsURL = bundledSource;
|
|
155
|
+
} else if (useCDN) {
|
|
152
156
|
// `ver` can specify a version hosted on the unpkg.com / jsdelivr.com CDN. We only support VexFlow 4 or newer:
|
|
153
157
|
// ver=unpkg@4.2.3 => https://unpkg.com/vexflow@4.2.3/build/cjs/vexflow-debug-with-tests.js
|
|
154
158
|
// ver=unpkg@alpha => https://unpkg.com/vexflow@alpha/build/cjs/vexflow-debug-with-tests.js
|
|
@@ -182,11 +186,14 @@
|
|
|
182
186
|
};
|
|
183
187
|
}
|
|
184
188
|
|
|
189
|
+
// Load deployed faces before tests measure them, even when the preload spans are empty.
|
|
190
|
+
if (bundledSource) await Promise.all([...document.fonts].map((face) => face.load()));
|
|
185
191
|
const fontFaceSet = await document.fonts.ready;
|
|
186
192
|
|
|
187
193
|
showFontLoadingStatus();
|
|
188
194
|
|
|
189
195
|
const VF = await loadVexFlow();
|
|
196
|
+
if (bundledSource) await document.fonts.ready;
|
|
190
197
|
|
|
191
198
|
// If you did not load the fonts via the div#font-preload above, you can load them with this API:
|
|
192
199
|
// await VF.loadFonts(); // Load all web fonts that VexFlow knows about (Font.FILES).
|