vexflow 5.3.0 → 5.4.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 +2 -0
- 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 +4189 -772
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +4323 -906
- 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/alternatingtremolo.js +68 -0
- package/build/esm/src/annotation.js +19 -3
- package/build/esm/src/articulation.js +5 -1
- package/build/esm/src/beam.js +13 -0
- package/build/esm/src/bend.js +57 -6
- package/build/esm/src/clef.js +3 -0
- package/build/esm/src/continuouslayout.js +681 -0
- package/build/esm/src/continuousspan.js +159 -0
- package/build/esm/src/curve.js +21 -2
- package/build/esm/src/easyscore/composition.js +13 -2
- package/build/esm/src/easyscore/policies.js +6 -3
- package/build/esm/src/engravinggeometry.js +8 -1
- package/build/esm/src/factory.js +16 -4
- package/build/esm/src/font.js +9 -1
- package/build/esm/src/fretdiagram.js +77 -0
- package/build/esm/src/guitargesture.js +33 -0
- package/build/esm/src/guitarmodifiers.js +26 -0
- package/build/esm/src/index.js +8 -0
- package/build/esm/src/instrumentprofile.js +123 -0
- package/build/esm/src/keysignature.js +23 -1
- package/build/esm/src/notationspelling.js +73 -0
- package/build/esm/src/note.js +3 -0
- package/build/esm/src/ornament.js +5 -0
- package/build/esm/src/pagebreaks.js +58 -0
- package/build/esm/src/pedalmarking.js +39 -17
- package/build/esm/src/phraselayout.js +503 -0
- package/build/esm/src/phraseribbon.js +28 -0
- package/build/esm/src/publication.js +402 -0
- package/build/esm/src/publicationview.js +114 -0
- package/build/esm/src/scorenavigation.js +172 -0
- package/build/esm/src/sheet.js +14 -2
- package/build/esm/src/stave.js +33 -16
- package/build/esm/src/stavebarline.js +5 -7
- package/build/esm/src/staveconnector.js +1 -0
- package/build/esm/src/stavehairpin.js +53 -27
- package/build/esm/src/stavenote.js +6 -1
- package/build/esm/src/stavetie.js +27 -2
- package/build/esm/src/strokes.js +4 -0
- package/build/esm/src/system.js +19 -4
- package/build/esm/src/systembreaks.js +42 -0
- package/build/esm/src/tabnote.js +6 -1
- package/build/esm/src/textbracket.js +24 -5
- package/build/esm/src/timesignature.js +15 -6
- package/build/esm/src/tuplet.js +1 -0
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +16 -0
- package/build/esm/src/voice.js +7 -3
- package/build/esm/tests/engraving/continuous-studies.mjs +140 -0
- package/build/esm/tests/engraving/instrument-studies.mjs +273 -0
- package/build/esm/tests/engraving/phrase-studies.mjs +63 -0
- package/build/esm/tests/engraving/publication-studies.mjs +87 -0
- package/build/esm/tests/engraving/specialist-studies.mjs +347 -0
- package/build/esm/tests/engraving/studies.mjs +88 -0
- package/build/esm/tests/node/continuous-score-tests.mjs +282 -0
- package/build/esm/tests/node/instrument-profile-tests.mjs +224 -0
- package/build/esm/tests/node/phrase-layout-tests.mjs +281 -0
- package/build/esm/tests/node/publication-tests.mjs +219 -0
- package/build/esm/tools/easyscore-structure.mjs +1 -1
- package/build/esm/tools/explorer/catalog/entries.mjs +2 -1
- package/build/esm/tools/explorer/catalog/expression.mjs +14 -9
- package/build/esm/tools/explorer/catalog/guitar.mjs +238 -0
- package/build/esm/tools/explorer/catalog/layout.mjs +8 -6
- package/build/esm/tools/explorer/catalog/notes.mjs +16 -14
- package/build/esm/tools/explorer/catalog/staves.mjs +12 -6
- package/build/esm/tools/explorer/catalog/strings.mjs +10 -7
- package/build/types/src/alternatingtremolo.d.ts +13 -0
- package/build/types/src/annotation.d.ts +9 -0
- package/build/types/src/articulation.d.ts +3 -0
- package/build/types/src/beam.d.ts +2 -0
- package/build/types/src/bend.d.ts +8 -0
- package/build/types/src/clef.d.ts +3 -0
- package/build/types/src/continuouslayout.d.ts +103 -0
- package/build/types/src/continuousspan.d.ts +60 -0
- package/build/types/src/curve.d.ts +11 -0
- package/build/types/src/easyscore/composition.d.ts +8 -0
- package/build/types/src/easyscore/policies.d.ts +1 -1
- package/build/types/src/fretdiagram.d.ts +23 -0
- package/build/types/src/guitargesture.d.ts +26 -0
- package/build/types/src/guitarmodifiers.d.ts +3 -0
- package/build/types/src/index.d.ts +10 -0
- package/build/types/src/instrumentprofile.d.ts +124 -0
- package/build/types/src/keysignature.d.ts +9 -0
- package/build/types/src/notationspelling.d.ts +25 -0
- package/build/types/src/note.d.ts +15 -0
- package/build/types/src/ornament.d.ts +3 -1
- package/build/types/src/pagebreaks.d.ts +26 -0
- package/build/types/src/pedalmarking.d.ts +9 -0
- package/build/types/src/phraselayout.d.ts +87 -0
- package/build/types/src/phraseribbon.d.ts +7 -0
- package/build/types/src/publication.d.ts +61 -0
- package/build/types/src/publicationview.d.ts +27 -0
- package/build/types/src/scorenavigation.d.ts +33 -0
- package/build/types/src/sheet.d.ts +5 -0
- package/build/types/src/stave.d.ts +13 -0
- package/build/types/src/stavehairpin.d.ts +18 -0
- package/build/types/src/stavetie.d.ts +5 -0
- package/build/types/src/system.d.ts +8 -1
- package/build/types/src/systembreaks.d.ts +9 -0
- package/build/types/src/textbracket.d.ts +7 -0
- package/build/types/src/timesignature.d.ts +4 -0
- package/build/types/src/vexflow.d.ts +16 -0
- package/build/types/src/voice.d.ts +2 -0
- package/changelog/CHANGELOG.md +8 -0
- package/package.json +9 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Accidental } from './accidental';
|
|
2
|
+
import { ContinuousSpan, SpanFragment } from './continuousspan';
|
|
3
|
+
import type { EasyScoreComposition, EasyScoreCompositionSpec, EasyScoreStaffState } from './easyscore/composition';
|
|
4
|
+
import { Element } from './element';
|
|
5
|
+
import { RenderContext } from './rendercontext';
|
|
6
|
+
import type { SheetOptions, SheetRow } from './sheet';
|
|
7
|
+
export interface ContinuousBoundary {
|
|
8
|
+
/** One-based source measure number, independent of rest compression. */
|
|
9
|
+
measure: number;
|
|
10
|
+
breakBefore?: 'force' | 'keep';
|
|
11
|
+
rehearsal?: string;
|
|
12
|
+
navigation?: {
|
|
13
|
+
kind: 'segno' | 'coda';
|
|
14
|
+
id: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'dalSegno' | 'toCoda';
|
|
17
|
+
target: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'daCapo' | 'fine';
|
|
20
|
+
};
|
|
21
|
+
repeatStart?: boolean;
|
|
22
|
+
repeatEnd?: boolean;
|
|
23
|
+
keepRest?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ContinuousOptions {
|
|
26
|
+
mode?: 'balanced' | 'greedy';
|
|
27
|
+
boundaries?: readonly ContinuousBoundary[];
|
|
28
|
+
spans?: readonly ContinuousSpan[];
|
|
29
|
+
hideEmptyStaves?: boolean;
|
|
30
|
+
compressRests?: boolean;
|
|
31
|
+
measureNumbers?: boolean;
|
|
32
|
+
courtesy?: boolean;
|
|
33
|
+
/** Unflagged heads on different staves sharing an onset, duration and stem direction. */
|
|
34
|
+
splitChords?: readonly {
|
|
35
|
+
id: string;
|
|
36
|
+
upper: string;
|
|
37
|
+
lower: string;
|
|
38
|
+
}[];
|
|
39
|
+
groups?: readonly {
|
|
40
|
+
first: string;
|
|
41
|
+
last: string;
|
|
42
|
+
type: 'brace' | 'bracket';
|
|
43
|
+
barlines?: boolean;
|
|
44
|
+
}[];
|
|
45
|
+
}
|
|
46
|
+
export interface ContinuousRow extends SheetRow {
|
|
47
|
+
measures: number[];
|
|
48
|
+
visibleStaves: string[];
|
|
49
|
+
restGroups: number[][];
|
|
50
|
+
}
|
|
51
|
+
type State = Required<EasyScoreStaffState>;
|
|
52
|
+
/** A row has one shared staff map. A compressed rest maps back to every original measure. */
|
|
53
|
+
export declare class ContinuousLayout {
|
|
54
|
+
private readonly score;
|
|
55
|
+
private readonly spec;
|
|
56
|
+
readonly hidden: Set<Element>;
|
|
57
|
+
readonly diagnostics: {
|
|
58
|
+
code: 'RowOverflow' | 'CurveCollision' | 'SplitStemAlignment' | 'SpanOverflow' | 'StaffSpacingLimit';
|
|
59
|
+
measures: number[];
|
|
60
|
+
source?: string;
|
|
61
|
+
}[];
|
|
62
|
+
readonly fragments: SpanFragment[];
|
|
63
|
+
readonly rows: ContinuousRow[];
|
|
64
|
+
private readonly marks;
|
|
65
|
+
private readonly boundaries;
|
|
66
|
+
private readonly spans;
|
|
67
|
+
private readonly names;
|
|
68
|
+
private readonly groups;
|
|
69
|
+
private drawing;
|
|
70
|
+
private readonly headerLabels;
|
|
71
|
+
/** Reuse measured labels when a resize moves a measure to another row. */
|
|
72
|
+
private headerLabel;
|
|
73
|
+
private headerParts;
|
|
74
|
+
private readonly splitChords;
|
|
75
|
+
private readonly spelledSpans;
|
|
76
|
+
private readonly options;
|
|
77
|
+
private readonly arrivals;
|
|
78
|
+
constructor(score: EasyScoreComposition, spec: EasyScoreCompositionSpec, starts: State[][], ends: State[][], placed?: Set<Accidental>);
|
|
79
|
+
/** Only undecorated, wholly resting measures can disappear into a numbered rest. */
|
|
80
|
+
private plainRest;
|
|
81
|
+
/** Add cached signs for the candidate boundaries and reserve actual end-modifier width. */
|
|
82
|
+
private boundaryWidth;
|
|
83
|
+
private units;
|
|
84
|
+
private endWidth;
|
|
85
|
+
private install;
|
|
86
|
+
private indent;
|
|
87
|
+
/** Preserve staves carrying a spanning instruction or cross-staff note, including silent middle rows. */
|
|
88
|
+
private visible;
|
|
89
|
+
private suppress;
|
|
90
|
+
format(options: Required<SheetOptions>): ContinuousRow[];
|
|
91
|
+
/** Measure native ink once the horizontal positions and beam fits for this row are known. */
|
|
92
|
+
private measureStaffInk;
|
|
93
|
+
/** Share the largest required staff distance across all measures, bounded to four native refits. */
|
|
94
|
+
private alignStaves;
|
|
95
|
+
/** Reconcile staff envelopes across all measures in a row, then translate the entire solved row once. */
|
|
96
|
+
private layoutRow;
|
|
97
|
+
/** Keep continuation hooks and labels on the correct end when a span crosses a row. */
|
|
98
|
+
private addFragment;
|
|
99
|
+
/** Add labels, connectors and numbered rests after all native positions have settled. */
|
|
100
|
+
private decorate;
|
|
101
|
+
draw(context: RenderContext): void;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Bounds } from './boundingbox';
|
|
2
|
+
import { Element } from './element';
|
|
3
|
+
import { Note } from './note';
|
|
4
|
+
import { RenderContext } from './rendercontext';
|
|
5
|
+
import { Stave } from './stave';
|
|
6
|
+
export type ContinuousSpanKind = 'tie' | 'slur' | 'crescendo' | 'diminuendo' | 'pedal' | 'lyric' | 'hyphen' | 'volta' | 'ottava' | 'trill' | 'tuplet' | 'palmMute';
|
|
7
|
+
export interface ContinuousSpan {
|
|
8
|
+
kind: ContinuousSpanKind;
|
|
9
|
+
/** Required for palmMute. String numbers are one-based. */
|
|
10
|
+
strings?: readonly number[];
|
|
11
|
+
id: string;
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
/** Optional chord-head indices for each end of a tie or slur. */
|
|
15
|
+
fromHead?: number;
|
|
16
|
+
toHead?: number;
|
|
17
|
+
side?: 'above' | 'below';
|
|
18
|
+
/** Syllable, ending number, tuplet ratio or octave label, according to kind. */
|
|
19
|
+
text?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SpanAnchor {
|
|
22
|
+
measure: number;
|
|
23
|
+
staff: number;
|
|
24
|
+
note: Note;
|
|
25
|
+
}
|
|
26
|
+
export interface ResolvedSpan {
|
|
27
|
+
spec: ContinuousSpan;
|
|
28
|
+
first: SpanAnchor;
|
|
29
|
+
last: SpanAnchor;
|
|
30
|
+
label?: Element;
|
|
31
|
+
}
|
|
32
|
+
export interface SpanFragment {
|
|
33
|
+
id: string;
|
|
34
|
+
kind: ContinuousSpanKind;
|
|
35
|
+
row: number;
|
|
36
|
+
part: 'single' | 'first' | 'middle' | 'last';
|
|
37
|
+
x1: number;
|
|
38
|
+
x2: number;
|
|
39
|
+
y1: number;
|
|
40
|
+
y2: number;
|
|
41
|
+
/** Fraction of the drawn span used to interpolate the aperture across a system break. */
|
|
42
|
+
progress: [number, number];
|
|
43
|
+
/** String numbers covered by a palm-mute fragment. */
|
|
44
|
+
strings?: readonly number[];
|
|
45
|
+
/** Authored TAB endpoints appear on the fragments containing them. */
|
|
46
|
+
from?: string;
|
|
47
|
+
to?: string;
|
|
48
|
+
rise?: number;
|
|
49
|
+
above: boolean;
|
|
50
|
+
space: number;
|
|
51
|
+
}
|
|
52
|
+
/** Unlike a glyph sized in a default font, labels contribute their actual current text width to reservations. */
|
|
53
|
+
export declare function spanLabel(spec: ContinuousSpan): Element | undefined;
|
|
54
|
+
export declare function spanAbove(span: ContinuousSpan): boolean;
|
|
55
|
+
/** Retain the written pitch through a clef change at a continuation edge. */
|
|
56
|
+
export declare function continuationPitch(anchor: SpanAnchor, stave: Stave, index?: number): number;
|
|
57
|
+
/** Prefer the shallowest clear curve. Preserve the best finite candidate if the space is infeasible. */
|
|
58
|
+
export declare function fitSpan(f: SpanFragment, obstacles: Bounds[]): boolean;
|
|
59
|
+
/** Draw only the hooks, labels and wedge apertures belonging to this particular segment. */
|
|
60
|
+
export declare function drawSpan(ctx: RenderContext, f: SpanFragment, label?: Element): void;
|
|
@@ -38,6 +38,17 @@ export declare class Curve extends Element {
|
|
|
38
38
|
static get Position(): typeof CurvePosition;
|
|
39
39
|
static get PositionString(): Record<string, number>;
|
|
40
40
|
constructor(from: Note | undefined, to: Note | undefined, options: CurveOptions);
|
|
41
|
+
private layoutRise;
|
|
42
|
+
private readonly authoredControls;
|
|
43
|
+
/** Automatic routing changes only the derived lift, preserving the authored control points. */
|
|
44
|
+
setLayoutRise(rise: number): void;
|
|
45
|
+
hasManualControls(): boolean;
|
|
46
|
+
getNotes(): {
|
|
47
|
+
firstNote?: Note;
|
|
48
|
+
lastNote?: Note;
|
|
49
|
+
};
|
|
50
|
+
/** Subdivided ink of the actual rendered cubic. */
|
|
51
|
+
getRouteParts(): BoundingBox[];
|
|
41
52
|
setNotes(from: Note | undefined, to: Note | undefined): this;
|
|
42
53
|
/**
|
|
43
54
|
* @return {boolean} Returns true if this is a partial bar.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContinuousOptions } from '../continuouslayout';
|
|
1
2
|
import type { EasyScore, EasyScoreVoiceOptions } from '../easyscore';
|
|
2
3
|
import type { Element } from '../element';
|
|
3
4
|
import { Factory } from '../factory';
|
|
@@ -60,12 +61,18 @@ export interface EasyScoreVoiceSpec {
|
|
|
60
61
|
}
|
|
61
62
|
/** span is the actual duration of a pickup; time remains its displayed meter. */
|
|
62
63
|
export interface EasyScoreMeasureSpec extends EasyScoreStaffState {
|
|
64
|
+
instrument?: {
|
|
65
|
+
name: string;
|
|
66
|
+
shortName?: string;
|
|
67
|
+
};
|
|
63
68
|
voices: readonly EasyScoreVoiceSpec[];
|
|
64
69
|
span?: VoiceTime | string;
|
|
65
70
|
}
|
|
66
71
|
/** Staves have aligned measure arrays. Missing or uneven measures are errors. */
|
|
67
72
|
export interface EasyScoreStaveSpec extends EasyScoreStaffState {
|
|
68
73
|
id: string;
|
|
74
|
+
name?: string;
|
|
75
|
+
shortName?: string;
|
|
69
76
|
kind?: 'stave' | 'tab';
|
|
70
77
|
options?: StaveOptions;
|
|
71
78
|
spaceAbove?: number;
|
|
@@ -95,6 +102,7 @@ export type EasyScoreSpanSpec = {
|
|
|
95
102
|
/** Layout policies are explicit. Sheet does not split spans or repeat signatures at row starts. */
|
|
96
103
|
export interface EasyScoreCompositionSpec {
|
|
97
104
|
staves: readonly EasyScoreStaveSpec[];
|
|
105
|
+
continuous?: ContinuousOptions;
|
|
98
106
|
sheet?: Omit<SheetOptions, 'factory'>;
|
|
99
107
|
system?: Omit<SystemOptions, 'factory' | 'width' | 'autoWidth' | 'noJustification'>;
|
|
100
108
|
accidentals?: 'literal' | 'key-aware';
|
|
@@ -9,4 +9,4 @@ export interface KeyChange {
|
|
|
9
9
|
key: string;
|
|
10
10
|
}
|
|
11
11
|
/** Each onset is evaluated against one prior state, so voice ordering cannot change accidental output. */
|
|
12
|
-
export declare function applyCompositionAccidentals(score: EasyScore, voices: Voice[], key: string, changes: KeyChange[], generated: Set<Accidental>, stave: Stave, includeGrace?: boolean): void;
|
|
12
|
+
export declare function applyCompositionAccidentals(score: EasyScore, voices: Voice[], key: string, changes: KeyChange[], generated: Set<Accidental>, stave: Stave, includeGrace?: boolean, placed?: Set<Accidental>): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
2
|
+
import { Element } from './element';
|
|
3
|
+
/** Frets are absolute; 0 = open, 'x' = muted. A barre names one-based string numbers. */
|
|
4
|
+
export interface FretDiagramSpec {
|
|
5
|
+
frets: readonly (number | 'x')[];
|
|
6
|
+
firstFret?: number;
|
|
7
|
+
rows?: number;
|
|
8
|
+
barre?: {
|
|
9
|
+
fret: number;
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare class FretDiagram extends Element {
|
|
15
|
+
private readonly frets;
|
|
16
|
+
private readonly first;
|
|
17
|
+
private readonly rows;
|
|
18
|
+
private readonly barre?;
|
|
19
|
+
constructor(spec: FretDiagramSpec);
|
|
20
|
+
/** The top-left position includes the open-string marks and starting fret label. */
|
|
21
|
+
getBoundingBox(): BoundingBox;
|
|
22
|
+
draw(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { NotationIdentity } from './note';
|
|
2
|
+
/** One right-hand action. Direction follows the physical order of strings for either arrow convention. */
|
|
3
|
+
export interface GuitarStroke {
|
|
4
|
+
finger: 'p' | 'i' | 'm' | 'a' | 'e';
|
|
5
|
+
direction: 'bass-to-treble' | 'treble-to-bass';
|
|
6
|
+
golpe?: boolean;
|
|
7
|
+
/** One freely rolled chord occupies its written value. Individual finger attacks are unspecified. */
|
|
8
|
+
roll?: boolean;
|
|
9
|
+
arrows?: 'strings' | 'hand';
|
|
10
|
+
}
|
|
11
|
+
/** Endpoints are exact fractions of this attack's duration, measured from its onset. */
|
|
12
|
+
export interface TimedStringBend {
|
|
13
|
+
string: number;
|
|
14
|
+
semitones: number;
|
|
15
|
+
rise: readonly [number, number];
|
|
16
|
+
hold?: readonly [number, number];
|
|
17
|
+
release?: readonly [number, number];
|
|
18
|
+
/** Optional written amount, e.g. “½”. Defaults to full, ½ or an explicit semitone count. */
|
|
19
|
+
label?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Normalize the written amount independently of the bend's horizontal length. */
|
|
22
|
+
export declare function bendAmount(bend: TimedStringBend): string;
|
|
23
|
+
/** Validate the performed order before constructing a modifier or changing a note. */
|
|
24
|
+
export declare function copyBend(bend: TimedStringBend): TimedStringBend;
|
|
25
|
+
/** Preserve the action as structured score metadata as well as a spoken description. */
|
|
26
|
+
export declare function strokeIdentity(action: GuitarStroke): NotationIdentity;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './accidental';
|
|
2
|
+
export * from './alternatingtremolo';
|
|
2
3
|
export * from './annotation';
|
|
3
4
|
export * from './articulation';
|
|
4
5
|
export * from './barnote';
|
|
@@ -18,6 +19,9 @@ export * from './engravinggeometry';
|
|
|
18
19
|
export * from './engravingprofile';
|
|
19
20
|
export * from './factory';
|
|
20
21
|
export * from './font';
|
|
22
|
+
export * from './fretdiagram';
|
|
23
|
+
export * from './instrumentprofile';
|
|
24
|
+
export * from './notationspelling';
|
|
21
25
|
export * from './flag';
|
|
22
26
|
export * from './formatter';
|
|
23
27
|
export * from './fraction';
|
|
@@ -42,10 +46,12 @@ export * from './ornament';
|
|
|
42
46
|
export * from './parenthesis';
|
|
43
47
|
export * from './parser';
|
|
44
48
|
export * from './pedalmarking';
|
|
49
|
+
export * from './phraselayout';
|
|
45
50
|
export * from './registry';
|
|
46
51
|
export * from './rendercontext';
|
|
47
52
|
export * from './renderer';
|
|
48
53
|
export * from './repeatnote';
|
|
54
|
+
export * from './scorenavigation';
|
|
49
55
|
export * from './sheet';
|
|
50
56
|
export * from './stave';
|
|
51
57
|
export * from './stavebarline';
|
|
@@ -83,6 +89,10 @@ export * from './tuning';
|
|
|
83
89
|
export * from './tuplet';
|
|
84
90
|
export * from './typeguard';
|
|
85
91
|
export * from './util';
|
|
92
|
+
export * from './continuouslayout';
|
|
93
|
+
export type { ContinuousSpan, ContinuousSpanKind, SpanFragment } from './continuousspan';
|
|
94
|
+
export type { GuitarStroke, TimedStringBend } from './guitargesture';
|
|
95
|
+
export * from './publication';
|
|
86
96
|
export * from './vexflow';
|
|
87
97
|
export * from './vibrato';
|
|
88
98
|
export * from './vibratobracket';
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Fraction } from './fraction';
|
|
2
|
+
import { GuitarStroke, TimedStringBend } from './guitargesture';
|
|
3
|
+
import { NotationIdentity } from './note';
|
|
4
|
+
import { StaveNoteStruct } from './stavenote';
|
|
5
|
+
import { TabNoteStruct } from './tabnote';
|
|
6
|
+
/** A written position uses VexFlow note lines (1 = bottom line, 5 = top on a five-line staff). */
|
|
7
|
+
export interface PercussionInstrument {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
line: number;
|
|
11
|
+
head?: 'normal' | 'cross' | 'circle-cross' | 'triangle';
|
|
12
|
+
stem: 'up' | 'down';
|
|
13
|
+
}
|
|
14
|
+
/** A custom kit and its legend share the same named entries. No playback pitches are inferred. */
|
|
15
|
+
export declare class PercussionMap {
|
|
16
|
+
static readonly kit: readonly PercussionInstrument[];
|
|
17
|
+
readonly instruments: readonly PercussionInstrument[];
|
|
18
|
+
constructor(entries?: readonly PercussionInstrument[]);
|
|
19
|
+
/** The first instrument supplies the default stem. Callers can override it for another voice. */
|
|
20
|
+
note(ids: readonly string[], duration: string, stem?: 'up' | 'down'): StaveNoteStruct;
|
|
21
|
+
}
|
|
22
|
+
/** Paired notation uses written open-string pitches and fret numbers relative to the capo. */
|
|
23
|
+
export declare class FrettedInstrument {
|
|
24
|
+
readonly capo: number;
|
|
25
|
+
private readonly tuning;
|
|
26
|
+
constructor(tuning?: string, capo?: number);
|
|
27
|
+
/** Expand an ordered rasgueado into ordinary paired attacks. Offsets are exact whole-note fractions from its start. */
|
|
28
|
+
rasgueado(positions: readonly {
|
|
29
|
+
str: number;
|
|
30
|
+
fret: number;
|
|
31
|
+
}[], strokes: readonly (GuitarStroke & {
|
|
32
|
+
duration: string;
|
|
33
|
+
})[]): {
|
|
34
|
+
offset: Fraction;
|
|
35
|
+
note: {
|
|
36
|
+
notation: NotationIdentity[];
|
|
37
|
+
musicFont?: string;
|
|
38
|
+
engraving?: import("./engravingprofile").EngravingProfile;
|
|
39
|
+
stemDirection?: number;
|
|
40
|
+
autoStem?: boolean;
|
|
41
|
+
strokePx?: number;
|
|
42
|
+
octaveShift?: number;
|
|
43
|
+
clef?: string;
|
|
44
|
+
keys?: string[];
|
|
45
|
+
duration: string;
|
|
46
|
+
line?: number;
|
|
47
|
+
dots?: number;
|
|
48
|
+
type?: string;
|
|
49
|
+
alignCenter?: boolean;
|
|
50
|
+
durationOverride?: Fraction;
|
|
51
|
+
};
|
|
52
|
+
tab: {
|
|
53
|
+
notation: NotationIdentity[];
|
|
54
|
+
positions: import("./tabnote").TabNotePosition[];
|
|
55
|
+
musicFont?: string;
|
|
56
|
+
engraving?: import("./engravingprofile").EngravingProfile;
|
|
57
|
+
stemDirection?: number;
|
|
58
|
+
autoStem?: boolean;
|
|
59
|
+
strokePx?: number;
|
|
60
|
+
octaveShift?: number;
|
|
61
|
+
clef?: string;
|
|
62
|
+
keys?: string[];
|
|
63
|
+
duration: string;
|
|
64
|
+
line?: number;
|
|
65
|
+
dots?: number;
|
|
66
|
+
type?: string;
|
|
67
|
+
alignCenter?: boolean;
|
|
68
|
+
durationOverride?: Fraction;
|
|
69
|
+
};
|
|
70
|
+
}[];
|
|
71
|
+
/** Attach a bend envelope to one played string. Both views retain its semantics and TAB draws the contour. */
|
|
72
|
+
bentAttack(positions: readonly {
|
|
73
|
+
str: number;
|
|
74
|
+
fret: number;
|
|
75
|
+
}[], duration: string, spec: TimedStringBend): {
|
|
76
|
+
note: {
|
|
77
|
+
notation: NotationIdentity[];
|
|
78
|
+
musicFont?: string;
|
|
79
|
+
engraving?: import("./engravingprofile").EngravingProfile;
|
|
80
|
+
stemDirection?: number;
|
|
81
|
+
autoStem?: boolean;
|
|
82
|
+
strokePx?: number;
|
|
83
|
+
octaveShift?: number;
|
|
84
|
+
clef?: string;
|
|
85
|
+
keys?: string[];
|
|
86
|
+
duration: string;
|
|
87
|
+
line?: number;
|
|
88
|
+
dots?: number;
|
|
89
|
+
type?: string;
|
|
90
|
+
alignCenter?: boolean;
|
|
91
|
+
durationOverride?: Fraction;
|
|
92
|
+
};
|
|
93
|
+
tab: {
|
|
94
|
+
notation: NotationIdentity[];
|
|
95
|
+
positions: import("./tabnote").TabNotePosition[];
|
|
96
|
+
musicFont?: string;
|
|
97
|
+
engraving?: import("./engravingprofile").EngravingProfile;
|
|
98
|
+
stemDirection?: number;
|
|
99
|
+
autoStem?: boolean;
|
|
100
|
+
strokePx?: number;
|
|
101
|
+
octaveShift?: number;
|
|
102
|
+
clef?: string;
|
|
103
|
+
keys?: string[];
|
|
104
|
+
duration: string;
|
|
105
|
+
line?: number;
|
|
106
|
+
dots?: number;
|
|
107
|
+
type?: string;
|
|
108
|
+
alignCenter?: boolean;
|
|
109
|
+
durationOverride?: Fraction;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/** Build independent standard and tab descriptions for the same attack. */
|
|
113
|
+
attack(positions: readonly ({
|
|
114
|
+
str: number;
|
|
115
|
+
fret: number;
|
|
116
|
+
} | {
|
|
117
|
+
str: number;
|
|
118
|
+
fret: 'X';
|
|
119
|
+
displayKey: string;
|
|
120
|
+
})[], duration: string): {
|
|
121
|
+
note: StaveNoteStruct;
|
|
122
|
+
tab: TabNoteStruct;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -3,6 +3,12 @@ import { Stave } from './stave';
|
|
|
3
3
|
import { StaveModifier } from './stavemodifier';
|
|
4
4
|
export declare class KeySignature extends StaveModifier {
|
|
5
5
|
static get CATEGORY(): string;
|
|
6
|
+
/** Explicit positions are already in the target clef, from the top staff line down. */
|
|
7
|
+
private ordered?;
|
|
8
|
+
setOrdered(entries: readonly {
|
|
9
|
+
type: string;
|
|
10
|
+
line: number;
|
|
11
|
+
}[]): this;
|
|
6
12
|
protected paddingForced: boolean;
|
|
7
13
|
protected formatted?: boolean;
|
|
8
14
|
protected clefOverride?: string;
|
|
@@ -49,5 +55,8 @@ export declare class KeySignature extends StaveModifier {
|
|
|
49
55
|
* If no stave is set, a dummy stave is created.
|
|
50
56
|
*/
|
|
51
57
|
format(): void;
|
|
58
|
+
private formattedStaveY?;
|
|
59
|
+
/** Refresh the accidental origins after moving a staff and return each positioned glyph. */
|
|
60
|
+
getInkParts(): BoundingBox[];
|
|
52
61
|
draw(): void;
|
|
53
62
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** One printable segment. tieNext joins a pitched continuation across a requested boundary. */
|
|
2
|
+
export interface RhythmSegment {
|
|
3
|
+
start: number;
|
|
4
|
+
duration: string;
|
|
5
|
+
dots: number;
|
|
6
|
+
tieNext: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class NotationSpelling {
|
|
9
|
+
/** Transpose by both chromatic semitones and diatonic steps, e.g. +2/+1 for B-flat clarinet. */
|
|
10
|
+
static transpose(key: string, semitones: number, steps: number): string;
|
|
11
|
+
/** Preserve the mode while spelling the transposed tonic. Reject unavailable standard signatures. */
|
|
12
|
+
static transposeKey(key: string, semitones: number, steps: number): string;
|
|
13
|
+
/** Spell on a 1/64-note grid. Cuts are absolute barlines or group boundaries supplied by the caller. */
|
|
14
|
+
static rhythm(start: number, length: number, cuts?: readonly number[], rest?: boolean): RhythmSegment[];
|
|
15
|
+
}
|
|
16
|
+
/** Accidental memory for a single staff and bar. A signature maps a letter to a written sign in every octave. */
|
|
17
|
+
export declare class WrittenAccidentalState {
|
|
18
|
+
private readonly seen;
|
|
19
|
+
private readonly signature;
|
|
20
|
+
constructor(signature?: Readonly<Record<string, string>>);
|
|
21
|
+
/** Start a new bar in the same signature. Construct a new state on a signature change. */
|
|
22
|
+
reset(): void;
|
|
23
|
+
/** Return the sign to print. Cautionaries print on request even when the sign is already in force. */
|
|
24
|
+
sign(key: string, sign: string, cautionary?: boolean): string | undefined;
|
|
25
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Beam } from './beam';
|
|
2
2
|
import { BoundingBox } from './boundingbox';
|
|
3
3
|
import { Fraction } from './fraction';
|
|
4
|
+
import { GuitarStroke, TimedStringBend } from './guitargesture';
|
|
4
5
|
import { Modifier } from './modifier';
|
|
5
6
|
import { RenderContext } from './rendercontext';
|
|
6
7
|
import { Stave } from './stave';
|
|
@@ -51,7 +52,19 @@ export interface ParsedNote {
|
|
|
51
52
|
dots: number;
|
|
52
53
|
ticks: number;
|
|
53
54
|
}
|
|
55
|
+
/** Stable score identities for instruments and playing instructions. Display positions can differ from pitches. */
|
|
56
|
+
export interface NotationIdentity {
|
|
57
|
+
kind: 'unpitched' | 'technique' | 'harmony' | 'tuning' | 'tremolo' | 'accidental';
|
|
58
|
+
id: string;
|
|
59
|
+
label: string;
|
|
60
|
+
/** Physical guitar actions survive reflow, navigation and publication metadata. */
|
|
61
|
+
stroke?: GuitarStroke;
|
|
62
|
+
bend?: TimedStringBend;
|
|
63
|
+
/** Head or string position in the source chord, counted from zero. */
|
|
64
|
+
index?: number;
|
|
65
|
+
}
|
|
54
66
|
export interface NoteStruct {
|
|
67
|
+
notation?: readonly NotationIdentity[];
|
|
55
68
|
/** Array of pitches, e.g: `['c/4', 'e/4', 'g/4']` */
|
|
56
69
|
keys?: string[];
|
|
57
70
|
/** The time length (e.g., `q` for quarter, `h` for half, `8` for eighth etc.). */
|
|
@@ -80,6 +93,8 @@ export declare abstract class Note extends Tickable {
|
|
|
80
93
|
static plotMetrics(ctx: RenderContext, note: Tickable, yPos: number): void;
|
|
81
94
|
protected static parseDuration(durationString?: string): NoteDuration | undefined;
|
|
82
95
|
protected static parseNoteStruct(noteStruct: NoteStruct): ParsedNote | undefined;
|
|
96
|
+
/** Source identities survive native drawing, Canvas inspection and print export. */
|
|
97
|
+
readonly notation: readonly NotationIdentity[];
|
|
83
98
|
glyphProps: GlyphProps;
|
|
84
99
|
keys: string[];
|
|
85
100
|
keyProps: KeyProps[];
|
|
@@ -69,7 +69,9 @@ export declare class Ornament extends Modifier {
|
|
|
69
69
|
setUpperAccidental(accid: string): this;
|
|
70
70
|
/** Set the lower accidental for the ornament. */
|
|
71
71
|
setLowerAccidental(accid: string): this;
|
|
72
|
-
|
|
72
|
+
private layoutShiftY;
|
|
73
|
+
/** Move the whole ornament and its auxiliary signs together. */
|
|
74
|
+
setLayoutShiftY(y: number): void;
|
|
73
75
|
/** Recompute delayed and auxiliary positions against the current tick contexts. */
|
|
74
76
|
private positionElements;
|
|
75
77
|
/** Include both auxiliary signs in the measured ornament. */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface PrintableSystem {
|
|
2
|
+
measures: number[];
|
|
3
|
+
height: number;
|
|
4
|
+
restAtEnd: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface PageConstraints {
|
|
7
|
+
firstHeight: number;
|
|
8
|
+
laterHeight: number;
|
|
9
|
+
gap: number;
|
|
10
|
+
maxExtraGap: number;
|
|
11
|
+
justifyLast: boolean;
|
|
12
|
+
part: boolean;
|
|
13
|
+
forceBefore: ReadonlySet<number>;
|
|
14
|
+
preferAfter: ReadonlySet<number>;
|
|
15
|
+
forbidAfter: ReadonlySet<number>;
|
|
16
|
+
}
|
|
17
|
+
/** System indices and offsets from the top of the page's music area. */
|
|
18
|
+
export interface PageBreak {
|
|
19
|
+
first: number;
|
|
20
|
+
end: number;
|
|
21
|
+
offsets: number[];
|
|
22
|
+
overflow: number;
|
|
23
|
+
forbiddenTurn: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Minimize forbidden turns, then pages, then turn difficulty and unused space. */
|
|
26
|
+
export declare function paginate(systems: PrintableSystem[], rules: PageConstraints): PageBreak[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoundingBox } from './boundingbox';
|
|
1
2
|
import { Element } from './element';
|
|
2
3
|
import { Stave } from './stave';
|
|
3
4
|
import { StaveNote } from './stavenote';
|
|
@@ -52,6 +53,14 @@ export declare class PedalMarking extends Element {
|
|
|
52
53
|
setCustomText(depress: string, release?: string): this;
|
|
53
54
|
/** Set the staff line to render the markings on. */
|
|
54
55
|
setLine(line: number): this;
|
|
56
|
+
/** Ordered press, change and release anchors. Repeated notes represent a pedal change. */
|
|
57
|
+
getNotes(): readonly StaveNote[];
|
|
58
|
+
private layoutBaseline?;
|
|
59
|
+
/** A single-stave phrase may supply the pedal baseline after arranging the surrounding lanes. */
|
|
60
|
+
setLayoutBaseline(y?: number): void;
|
|
61
|
+
private releaseX;
|
|
62
|
+
/** Enclose actual pedal text, changes, end hooks and bracket stroke. */
|
|
63
|
+
getBoundingBox(): BoundingBox;
|
|
55
64
|
/** Compute a baseline below annotations in participating voices on this stave. */
|
|
56
65
|
getYForStave(stave: Stave): number;
|
|
57
66
|
/** Draw the bracket based pedal markings. */
|