vexflow 5.1.2 → 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 +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 +2633 -415
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +2478 -382
- 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/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/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/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/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 +35 -0
- package/package.json +7 -2
|
@@ -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,38 @@
|
|
|
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
|
+
|
|
1
36
|
# 5.1.2
|
|
2
37
|
|
|
3
38
|
## Notation
|
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
|
".": {
|
|
@@ -135,7 +135,12 @@
|
|
|
135
135
|
"explorer:upload": "node tools/explorer/upload.mjs",
|
|
136
136
|
"tests:build": "node tools/tests-site.mjs build",
|
|
137
137
|
"tests:upload": "node tools/tests-site.mjs upload",
|
|
138
|
-
"tests:test": "node tools/tests-site.test.mjs"
|
|
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"
|
|
139
144
|
},
|
|
140
145
|
"homepage": "https://vexflow.com/",
|
|
141
146
|
"keywords": [
|