@mcqj/vexflow 0.0.1-alpha.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 +22 -0
- package/README.md +208 -0
- package/build/cjs/vexflow-bravura.js +2 -0
- package/build/cjs/vexflow-bravura.js.map +1 -0
- package/build/cjs/vexflow-core.js +2 -0
- package/build/cjs/vexflow-core.js.map +1 -0
- package/build/cjs/vexflow-debug-with-tests.js +43475 -0
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -0
- package/build/cjs/vexflow-debug.js +19194 -0
- package/build/cjs/vexflow-debug.js.map +1 -0
- package/build/cjs/vexflow.js +2 -0
- package/build/cjs/vexflow.js.map +1 -0
- package/build/esm/entry/vexflow-bravura.js +17 -0
- package/build/esm/entry/vexflow-core.js +4 -0
- package/build/esm/entry/vexflow-debug-with-tests.js +38 -0
- package/build/esm/entry/vexflow-debug.js +31 -0
- package/build/esm/entry/vexflow.js +31 -0
- package/build/esm/package.json +3 -0
- package/build/esm/src/accidental.js +330 -0
- package/build/esm/src/annotation.js +231 -0
- package/build/esm/src/articulation.js +281 -0
- package/build/esm/src/barnote.js +56 -0
- package/build/esm/src/beam.js +644 -0
- package/build/esm/src/bend.js +186 -0
- package/build/esm/src/boundingbox.js +59 -0
- package/build/esm/src/canvascontext.js +216 -0
- package/build/esm/src/chordsymbol.js +325 -0
- package/build/esm/src/clef.js +120 -0
- package/build/esm/src/clefnote.js +35 -0
- package/build/esm/src/crescendo.js +78 -0
- package/build/esm/src/curve.js +126 -0
- package/build/esm/src/dot.js +129 -0
- package/build/esm/src/easyscore.js +374 -0
- package/build/esm/src/element.js +409 -0
- package/build/esm/src/factory.js +463 -0
- package/build/esm/src/flag.js +22 -0
- package/build/esm/src/font.js +237 -0
- package/build/esm/src/fonts/academico.js +1 -0
- package/build/esm/src/fonts/academicobold.js +1 -0
- package/build/esm/src/fonts/bravura.js +1 -0
- package/build/esm/src/fonts/gonville.js +1 -0
- package/build/esm/src/fonts/petaluma.js +1 -0
- package/build/esm/src/fonts/petalumascript.js +1 -0
- package/build/esm/src/formatter.js +610 -0
- package/build/esm/src/fraction.js +170 -0
- package/build/esm/src/frethandfinger.js +141 -0
- package/build/esm/src/ghostnote.js +50 -0
- package/build/esm/src/glyphnote.js +44 -0
- package/build/esm/src/glyphs.js +2936 -0
- package/build/esm/src/gracenote.js +106 -0
- package/build/esm/src/gracenotegroup.js +138 -0
- package/build/esm/src/gracetabnote.js +11 -0
- package/build/esm/src/index.js +86 -0
- package/build/esm/src/keymanager.js +99 -0
- package/build/esm/src/keysignature.js +220 -0
- package/build/esm/src/keysignote.js +28 -0
- package/build/esm/src/metrics.js +237 -0
- package/build/esm/src/modifier.js +121 -0
- package/build/esm/src/modifiercontext.js +110 -0
- package/build/esm/src/multimeasurerest.js +127 -0
- package/build/esm/src/music.js +322 -0
- package/build/esm/src/note.js +383 -0
- package/build/esm/src/notehead.js +89 -0
- package/build/esm/src/notesubgroup.js +59 -0
- package/build/esm/src/ornament.js +192 -0
- package/build/esm/src/parenthesis.js +61 -0
- package/build/esm/src/parser.js +164 -0
- package/build/esm/src/pedalmarking.js +168 -0
- package/build/esm/src/registry.js +81 -0
- package/build/esm/src/rendercontext.js +20 -0
- package/build/esm/src/renderer.js +112 -0
- package/build/esm/src/repeatnote.js +17 -0
- package/build/esm/src/stave.js +579 -0
- package/build/esm/src/stavebarline.js +237 -0
- package/build/esm/src/staveconnector.js +180 -0
- package/build/esm/src/stavehairpin.js +115 -0
- package/build/esm/src/staveline.js +199 -0
- package/build/esm/src/stavemodifier.js +56 -0
- package/build/esm/src/stavenote.js +861 -0
- package/build/esm/src/staverepetition.js +120 -0
- package/build/esm/src/stavesection.js +36 -0
- package/build/esm/src/stavetempo.js +110 -0
- package/build/esm/src/stavetext.js +55 -0
- package/build/esm/src/stavetie.js +186 -0
- package/build/esm/src/stavevolta.js +53 -0
- package/build/esm/src/stem.js +133 -0
- package/build/esm/src/stemmablenote.js +193 -0
- package/build/esm/src/stringnumber.js +228 -0
- package/build/esm/src/strokes.js +164 -0
- package/build/esm/src/svgcontext.js +402 -0
- package/build/esm/src/system.js +166 -0
- package/build/esm/src/tables.js +696 -0
- package/build/esm/src/tabnote.js +278 -0
- package/build/esm/src/tabslide.js +68 -0
- package/build/esm/src/tabstave.js +17 -0
- package/build/esm/src/tabtie.js +19 -0
- package/build/esm/src/textbracket.js +128 -0
- package/build/esm/src/textdynamics.js +53 -0
- package/build/esm/src/textnote.js +116 -0
- package/build/esm/src/tickable.js +224 -0
- package/build/esm/src/tickcontext.js +189 -0
- package/build/esm/src/timesignature.js +169 -0
- package/build/esm/src/timesignote.js +30 -0
- package/build/esm/src/tremolo.js +30 -0
- package/build/esm/src/tuning.js +55 -0
- package/build/esm/src/tuplet.js +258 -0
- package/build/esm/src/typeguard.js +30 -0
- package/build/esm/src/util.js +67 -0
- package/build/esm/src/version.js +3 -0
- package/build/esm/src/vexflow.js +309 -0
- package/build/esm/src/vibrato.js +68 -0
- package/build/esm/src/vibratobracket.js +44 -0
- package/build/esm/src/voice.js +178 -0
- package/build/esm/src/web.js +15 -0
- package/build/esm/tests/accidental_tests.js +1055 -0
- package/build/esm/tests/annotation_tests.js +381 -0
- package/build/esm/tests/articulation_tests.js +432 -0
- package/build/esm/tests/auto_beam_formatting_tests.js +551 -0
- package/build/esm/tests/barline_tests.js +52 -0
- package/build/esm/tests/beam_tests.js +669 -0
- package/build/esm/tests/bend_tests.js +223 -0
- package/build/esm/tests/boundingbox_tests.js +53 -0
- package/build/esm/tests/browser_test_runner.js +128 -0
- package/build/esm/tests/chordsymbol_tests.js +405 -0
- package/build/esm/tests/clef_tests.js +141 -0
- package/build/esm/tests/crossbeam_tests.js +306 -0
- package/build/esm/tests/curve_tests.js +152 -0
- package/build/esm/tests/demo_petzold_tests.js +335 -0
- package/build/esm/tests/dot_tests.js +119 -0
- package/build/esm/tests/easyscore_tests.js +488 -0
- package/build/esm/tests/factory_tests.js +44 -0
- package/build/esm/tests/font_tests.js +134 -0
- package/build/esm/tests/formatter/framestack.js +61 -0
- package/build/esm/tests/formatter/tests.js +251 -0
- package/build/esm/tests/formatter_tests.js +759 -0
- package/build/esm/tests/fraction_tests.js +72 -0
- package/build/esm/tests/ghostnote_tests.js +77 -0
- package/build/esm/tests/glyphnote_tests.js +119 -0
- package/build/esm/tests/gracenote_tests.js +414 -0
- package/build/esm/tests/gracetabnote_tests.js +79 -0
- package/build/esm/tests/index.js +68 -0
- package/build/esm/tests/key_clef_tests.js +106 -0
- package/build/esm/tests/keymanager_tests.js +68 -0
- package/build/esm/tests/keysignature_tests.js +322 -0
- package/build/esm/tests/mocks.js +70 -0
- package/build/esm/tests/modifier_tests.js +24 -0
- package/build/esm/tests/multimeasurerest_tests.js +141 -0
- package/build/esm/tests/music_tests.js +161 -0
- package/build/esm/tests/node_test_runner.js +31 -0
- package/build/esm/tests/notehead_tests.js +224 -0
- package/build/esm/tests/notesubgroup_tests.js +149 -0
- package/build/esm/tests/offscreencanvas_tests.js +47 -0
- package/build/esm/tests/ornament_tests.js +333 -0
- package/build/esm/tests/parser_tests.js +122 -0
- package/build/esm/tests/pedalmarking_tests.js +91 -0
- package/build/esm/tests/percussion_tests.js +184 -0
- package/build/esm/tests/playwright/flow.spec.js +127 -0
- package/build/esm/tests/playwright/visual_helpers.js +30 -0
- package/build/esm/tests/registry_tests.js +64 -0
- package/build/esm/tests/renderer_tests.js +113 -0
- package/build/esm/tests/rests_tests.js +266 -0
- package/build/esm/tests/rhythm_tests.js +357 -0
- package/build/esm/tests/stave_tests.js +570 -0
- package/build/esm/tests/staveconnector_tests.js +402 -0
- package/build/esm/tests/stavehairpin_tests.js +90 -0
- package/build/esm/tests/staveline_tests.js +123 -0
- package/build/esm/tests/stavemodifier_tests.js +51 -0
- package/build/esm/tests/stavenote_tests.js +936 -0
- package/build/esm/tests/stavetie_tests.js +137 -0
- package/build/esm/tests/stringnumber_tests.js +283 -0
- package/build/esm/tests/strokes_tests.js +289 -0
- package/build/esm/tests/style_tests.js +96 -0
- package/build/esm/tests/tabnote_tests.js +462 -0
- package/build/esm/tests/tabslide_tests.js +133 -0
- package/build/esm/tests/tabstave_tests.js +24 -0
- package/build/esm/tests/tabtie_tests.js +171 -0
- package/build/esm/tests/test_runner.js +23 -0
- package/build/esm/tests/textbracket_tests.js +100 -0
- package/build/esm/tests/textnote_tests.js +216 -0
- package/build/esm/tests/threevoice_tests.js +132 -0
- package/build/esm/tests/tickcontext_tests.js +36 -0
- package/build/esm/tests/timesignature_tests.js +173 -0
- package/build/esm/tests/tremolo_tests.js +34 -0
- package/build/esm/tests/tuning_tests.js +56 -0
- package/build/esm/tests/tuplet_tests.js +711 -0
- package/build/esm/tests/typeguard_tests.js +82 -0
- package/build/esm/tests/unison_tests.js +74 -0
- package/build/esm/tests/vexflow_test_helpers.js +318 -0
- package/build/esm/tests/vf_prefix_tests.js +101 -0
- package/build/esm/tests/vibrato_tests.js +93 -0
- package/build/esm/tests/vibratobracket_tests.js +45 -0
- package/build/esm/tests/vitest/job-0.test.js +2 -0
- package/build/esm/tests/vitest/job-1.test.js +2 -0
- package/build/esm/tests/vitest/job-2.test.js +2 -0
- package/build/esm/tests/vitest/job-3.test.js +2 -0
- package/build/esm/tests/vitest/run.js +5 -0
- package/build/esm/tests/vitest.setup.js +44 -0
- package/build/esm/tests/voice_tests.js +69 -0
- package/build/types/entry/vexflow-bravura.d.ts +3 -0
- package/build/types/entry/vexflow-core.d.ts +3 -0
- package/build/types/entry/vexflow-debug.d.ts +3 -0
- package/build/types/entry/vexflow.d.ts +3 -0
- package/build/types/src/accidental.d.ts +60 -0
- package/build/types/src/annotation.d.ts +58 -0
- package/build/types/src/articulation.d.ts +78 -0
- package/build/types/src/barnote.d.ts +29 -0
- package/build/types/src/beam.d.ts +158 -0
- package/build/types/src/bend.d.ts +67 -0
- package/build/types/src/boundingbox.d.ts +42 -0
- package/build/types/src/canvascontext.d.ts +93 -0
- package/build/types/src/chordsymbol.d.ts +109 -0
- package/build/types/src/clef.d.ts +38 -0
- package/build/types/src/clefnote.d.ts +17 -0
- package/build/types/src/crescendo.d.ts +26 -0
- package/build/types/src/curve.d.ts +42 -0
- package/build/types/src/dot.d.ts +19 -0
- package/build/types/src/easyscore.d.ts +152 -0
- package/build/types/src/element.d.ts +278 -0
- package/build/types/src/factory.d.ts +273 -0
- package/build/types/src/flag.d.ts +12 -0
- package/build/types/src/font.d.ts +96 -0
- package/build/types/src/fonts/academico.d.ts +1 -0
- package/build/types/src/fonts/academicobold.d.ts +1 -0
- package/build/types/src/fonts/bravura.d.ts +1 -0
- package/build/types/src/fonts/gonville.d.ts +1 -0
- package/build/types/src/fonts/petaluma.d.ts +1 -0
- package/build/types/src/fonts/petalumascript.d.ts +1 -0
- package/build/types/src/formatter.d.ts +226 -0
- package/build/types/src/fraction.d.ts +65 -0
- package/build/types/src/frethandfinger.d.ts +19 -0
- package/build/types/src/ghostnote.d.ts +16 -0
- package/build/types/src/glyphnote.d.ts +14 -0
- package/build/types/src/glyphs.d.ts +2935 -0
- package/build/types/src/gracenote.d.ts +17 -0
- package/build/types/src/gracenotegroup.d.ts +33 -0
- package/build/types/src/gracetabnote.d.ts +5 -0
- package/build/types/src/index.d.ts +86 -0
- package/build/types/src/keymanager.d.ts +25 -0
- package/build/types/src/keysignature.d.ts +50 -0
- package/build/types/src/keysignote.d.ts +11 -0
- package/build/types/src/metrics.d.ts +25 -0
- package/build/types/src/modifier.d.ts +90 -0
- package/build/types/src/modifiercontext.d.ts +48 -0
- package/build/types/src/multimeasurerest.d.ts +61 -0
- package/build/types/src/music.d.ts +91 -0
- package/build/types/src/note.d.ts +232 -0
- package/build/types/src/notehead.d.ts +50 -0
- package/build/types/src/notesubgroup.d.ts +18 -0
- package/build/types/src/ornament.d.ts +71 -0
- package/build/types/src/parenthesis.d.ts +21 -0
- package/build/types/src/parser.d.ts +45 -0
- package/build/types/src/pedalmarking.d.ts +63 -0
- package/build/types/src/registry.d.ts +40 -0
- package/build/types/src/rendercontext.d.ts +59 -0
- package/build/types/src/renderer.d.ts +35 -0
- package/build/types/src/repeatnote.d.ts +6 -0
- package/build/types/src/stave.d.ts +181 -0
- package/build/types/src/stavebarline.d.ts +38 -0
- package/build/types/src/staveconnector.d.ts +53 -0
- package/build/types/src/stavehairpin.d.ts +56 -0
- package/build/types/src/staveline.d.ts +49 -0
- package/build/types/src/stavemodifier.d.ts +35 -0
- package/build/types/src/stavenote.d.ts +150 -0
- package/build/types/src/staverepetition.d.ts +30 -0
- package/build/types/src/stavesection.d.ts +8 -0
- package/build/types/src/stavetempo.d.ts +43 -0
- package/build/types/src/stavetext.d.ts +11 -0
- package/build/types/src/stavetie.d.ts +104 -0
- package/build/types/src/stavevolta.d.ts +15 -0
- package/build/types/src/stem.d.ts +58 -0
- package/build/types/src/stemmablenote.d.ts +39 -0
- package/build/types/src/stringnumber.d.ts +26 -0
- package/build/types/src/strokes.d.ts +35 -0
- package/build/types/src/svgcontext.d.ts +135 -0
- package/build/types/src/system.d.ts +121 -0
- package/build/types/src/tables.d.ts +86 -0
- package/build/types/src/tabnote.d.ts +45 -0
- package/build/types/src/tabslide.d.ts +36 -0
- package/build/types/src/tabstave.d.ts +7 -0
- package/build/types/src/tabtie.d.ts +18 -0
- package/build/types/src/textbracket.d.ts +45 -0
- package/build/types/src/textdynamics.d.ts +34 -0
- package/build/types/src/textnote.d.ts +48 -0
- package/build/types/src/tickable.d.ts +149 -0
- package/build/types/src/tickcontext.d.ts +112 -0
- package/build/types/src/timesignature.d.ts +75 -0
- package/build/types/src/timesignote.d.ts +11 -0
- package/build/types/src/tremolo.d.ts +12 -0
- package/build/types/src/tuning.d.ts +23 -0
- package/build/types/src/tuplet.d.ts +98 -0
- package/build/types/src/typeguard.d.ts +100 -0
- package/build/types/src/util.d.ts +42 -0
- package/build/types/src/version.d.ts +3 -0
- package/build/types/src/vexflow.d.ts +261 -0
- package/build/types/src/vibrato.d.ts +20 -0
- package/build/types/src/vibratobracket.d.ts +28 -0
- package/build/types/src/voice.d.ts +109 -0
- package/build/types/src/web.d.ts +2 -0
- package/package.json +145 -0
- package/tests/flow.html +256 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { Beam } from './beam';
|
|
2
|
+
import { BoundingBox } from './boundingbox';
|
|
3
|
+
import { Fraction } from './fraction';
|
|
4
|
+
import { Modifier } from './modifier';
|
|
5
|
+
import { RenderContext } from './rendercontext';
|
|
6
|
+
import { Stave } from './stave';
|
|
7
|
+
import { Stroke } from './strokes';
|
|
8
|
+
import { Tickable } from './tickable';
|
|
9
|
+
import { TickContext } from './tickcontext';
|
|
10
|
+
import { Voice } from './voice';
|
|
11
|
+
export interface GlyphProps {
|
|
12
|
+
codeHead: string;
|
|
13
|
+
stemBeamExtension: number;
|
|
14
|
+
stem: boolean;
|
|
15
|
+
codeFlagUp?: string;
|
|
16
|
+
beamCount: number;
|
|
17
|
+
}
|
|
18
|
+
export interface KeyProps {
|
|
19
|
+
key: string;
|
|
20
|
+
octave: number;
|
|
21
|
+
line: number;
|
|
22
|
+
intValue?: number;
|
|
23
|
+
code?: string;
|
|
24
|
+
displaced: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface NoteMetrics {
|
|
27
|
+
/** The total width of the note (including modifiers). */
|
|
28
|
+
width: number;
|
|
29
|
+
glyphWidth?: number;
|
|
30
|
+
/** The width of the note head only. */
|
|
31
|
+
notePx: number;
|
|
32
|
+
/** Start `X` for left modifiers. */
|
|
33
|
+
modLeftPx: number;
|
|
34
|
+
/** Start `X` for right modifiers. */
|
|
35
|
+
modRightPx: number;
|
|
36
|
+
/** Extra space on left of note. */
|
|
37
|
+
leftDisplacedHeadPx: number;
|
|
38
|
+
glyphPx: number;
|
|
39
|
+
/** Extra space on right of note. */
|
|
40
|
+
rightDisplacedHeadPx: number;
|
|
41
|
+
}
|
|
42
|
+
export interface NoteDuration {
|
|
43
|
+
duration: string;
|
|
44
|
+
dots: number;
|
|
45
|
+
type: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ParsedNote {
|
|
48
|
+
duration: string;
|
|
49
|
+
type: string;
|
|
50
|
+
customTypes: string[];
|
|
51
|
+
dots: number;
|
|
52
|
+
ticks: number;
|
|
53
|
+
}
|
|
54
|
+
export interface NoteStruct {
|
|
55
|
+
/** Array of pitches, e.g: `['c/4', 'e/4', 'g/4']` */
|
|
56
|
+
keys?: string[];
|
|
57
|
+
/** The time length (e.g., `q` for quarter, `h` for half, `8` for eighth etc.). */
|
|
58
|
+
duration: string;
|
|
59
|
+
line?: number;
|
|
60
|
+
/** The number of dots, which affects the duration. */
|
|
61
|
+
dots?: number;
|
|
62
|
+
/** The note type (e.g., `r` for rest, `s` for slash notes, etc.). */
|
|
63
|
+
type?: string;
|
|
64
|
+
alignCenter?: boolean;
|
|
65
|
+
durationOverride?: Fraction;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Note implements an abstract interface for notes and chords that
|
|
69
|
+
* are rendered on a stave. Notes have some common properties: All of them
|
|
70
|
+
* have a value (e.g., pitch, fret, etc.) and a duration (quarter, half, etc.)
|
|
71
|
+
*
|
|
72
|
+
* Some notes have stems, heads, dots, etc. Most notational elements that
|
|
73
|
+
* surround a note are called *modifiers*, and every note has an associated
|
|
74
|
+
* array of them. All notes also have a rendering context and belong to a stave.
|
|
75
|
+
*/
|
|
76
|
+
export declare abstract class Note extends Tickable {
|
|
77
|
+
static get CATEGORY(): string;
|
|
78
|
+
static getGlyphProps(duration: string, type?: string): GlyphProps;
|
|
79
|
+
/** Debug helper. Displays various note metrics for the given note. */
|
|
80
|
+
static plotMetrics(ctx: RenderContext, note: Tickable, yPos: number): void;
|
|
81
|
+
protected static parseDuration(durationString?: string): NoteDuration | undefined;
|
|
82
|
+
protected static parseNoteStruct(noteStruct: NoteStruct): ParsedNote | undefined;
|
|
83
|
+
glyphProps: GlyphProps;
|
|
84
|
+
keys: string[];
|
|
85
|
+
keyProps: KeyProps[];
|
|
86
|
+
protected stave?: Stave;
|
|
87
|
+
renderOptions: {
|
|
88
|
+
drawStemThroughStave?: boolean;
|
|
89
|
+
draw?: boolean;
|
|
90
|
+
drawDots?: boolean;
|
|
91
|
+
drawStem?: boolean;
|
|
92
|
+
yShift: number;
|
|
93
|
+
extendLeft?: number;
|
|
94
|
+
extendRight?: number;
|
|
95
|
+
annotationSpacing: number;
|
|
96
|
+
strokePx: number;
|
|
97
|
+
};
|
|
98
|
+
protected duration: string;
|
|
99
|
+
protected leftDisplacedHeadPx: number;
|
|
100
|
+
protected rightDisplacedHeadPx: number;
|
|
101
|
+
protected noteType: string;
|
|
102
|
+
protected customGlyphs: GlyphProps[];
|
|
103
|
+
protected ys: number[];
|
|
104
|
+
protected customTypes: string[];
|
|
105
|
+
protected playNote?: Note;
|
|
106
|
+
protected beam?: Beam;
|
|
107
|
+
/**
|
|
108
|
+
* Every note is a tickable, i.e., it can be mutated by the `Formatter` class for
|
|
109
|
+
* positioning and layout.
|
|
110
|
+
*
|
|
111
|
+
* @param noteStruct To create a new note you need to provide a `noteStruct`.
|
|
112
|
+
*/
|
|
113
|
+
constructor(noteStruct: NoteStruct);
|
|
114
|
+
/**
|
|
115
|
+
* Get the play note, which is arbitrary data that can be used by an
|
|
116
|
+
* audio player.
|
|
117
|
+
*/
|
|
118
|
+
getPlayNote(): Note | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Set the play note, which is arbitrary data that can be used by an
|
|
121
|
+
* audio player.
|
|
122
|
+
*/
|
|
123
|
+
setPlayNote(note: Note): this;
|
|
124
|
+
/**
|
|
125
|
+
* @returns true if this note is a type of rest.
|
|
126
|
+
*
|
|
127
|
+
* Rests don't have pitches, but take up space in the score.
|
|
128
|
+
* Subclasses should override this default implementation.
|
|
129
|
+
*/
|
|
130
|
+
isRest(): boolean;
|
|
131
|
+
/** Add stroke. */
|
|
132
|
+
addStroke(index: number, stroke: Stroke): this;
|
|
133
|
+
/** Get the target stave. */
|
|
134
|
+
getStave(): Stave | undefined;
|
|
135
|
+
/** Check and get the target stave. */
|
|
136
|
+
checkStave(): Stave;
|
|
137
|
+
/** Set the target stave. */
|
|
138
|
+
setStave(stave: Stave): this;
|
|
139
|
+
/** Get spacing to the left of the notes. */
|
|
140
|
+
getLeftDisplacedHeadPx(): number;
|
|
141
|
+
/** Get spacing to the right of the notes. */
|
|
142
|
+
getRightDisplacedHeadPx(): number;
|
|
143
|
+
/** Set spacing to the left of the notes. */
|
|
144
|
+
setLeftDisplacedHeadPx(x: number): this;
|
|
145
|
+
/** Set spacing to the right of the notes. */
|
|
146
|
+
setRightDisplacedHeadPx(x: number): this;
|
|
147
|
+
/** True if this note has no duration (e.g., bar notes, spacers, etc.). */
|
|
148
|
+
shouldIgnoreTicks(): boolean;
|
|
149
|
+
/** Get the stave line number for the note. */
|
|
150
|
+
getLineNumber(isTopNote?: boolean): number;
|
|
151
|
+
/** Get the stave line number for rest. */
|
|
152
|
+
getLineForRest(): number;
|
|
153
|
+
/** Get the glyph associated with this note. */
|
|
154
|
+
getGlyphProps(): GlyphProps;
|
|
155
|
+
/** Get the glyph width. */
|
|
156
|
+
getGlyphWidth(): number;
|
|
157
|
+
/**
|
|
158
|
+
* Set Y positions for this note. Each Y value is associated with
|
|
159
|
+
* an individual pitch/key within the note/chord.
|
|
160
|
+
*/
|
|
161
|
+
setYs(ys: number[]): this;
|
|
162
|
+
/**
|
|
163
|
+
* Get Y positions for this note. Each Y value is associated with
|
|
164
|
+
* an individual pitch/key within the note/chord.
|
|
165
|
+
*/
|
|
166
|
+
getYs(): number[];
|
|
167
|
+
/**
|
|
168
|
+
* Get the Y position of the space above the stave onto which text can
|
|
169
|
+
* be rendered.
|
|
170
|
+
*/
|
|
171
|
+
getYForTopText(textLine: number): number;
|
|
172
|
+
/** Return the voice that this note belongs in. */
|
|
173
|
+
getVoice(): Voice;
|
|
174
|
+
/** Attach this note to `voice`. */
|
|
175
|
+
setVoice(voice: Voice): this;
|
|
176
|
+
/** Get the `TickContext` for this note. */
|
|
177
|
+
getTickContext(): TickContext;
|
|
178
|
+
/** Set the `TickContext` for this note. */
|
|
179
|
+
setTickContext(tc: TickContext): this;
|
|
180
|
+
/** Accessor to duration. */
|
|
181
|
+
getDuration(): string;
|
|
182
|
+
/** Accessor to isDotted. */
|
|
183
|
+
isDotted(): boolean;
|
|
184
|
+
/** Accessor to hasStem. */
|
|
185
|
+
hasStem(): boolean;
|
|
186
|
+
/** Accessor to note type. */
|
|
187
|
+
getNoteType(): string;
|
|
188
|
+
/** Get the beam. */
|
|
189
|
+
getBeam(): Beam | undefined;
|
|
190
|
+
/** Check and get the beam. */
|
|
191
|
+
checkBeam(): Beam;
|
|
192
|
+
/** Check it has a beam. */
|
|
193
|
+
hasBeam(): boolean;
|
|
194
|
+
/** Set the beam. */
|
|
195
|
+
setBeam(beam: Beam): this;
|
|
196
|
+
/**
|
|
197
|
+
* Attach a modifier to this note.
|
|
198
|
+
* @param modifier the Modifier to add.
|
|
199
|
+
* @param index of the key to modify.
|
|
200
|
+
* @returns this
|
|
201
|
+
*/
|
|
202
|
+
addModifier(modifier: Modifier, index?: number): this;
|
|
203
|
+
/** Get all modifiers of a specific type in `this.modifiers`. */
|
|
204
|
+
getModifiersByType(type: string): Modifier[];
|
|
205
|
+
/** Get the coordinates for where modifiers begin. */
|
|
206
|
+
getModifierStartXY(position?: number, index?: number, options?: any): {
|
|
207
|
+
x: number;
|
|
208
|
+
y: number;
|
|
209
|
+
};
|
|
210
|
+
getRightParenthesisPx(index: number): number;
|
|
211
|
+
getLeftParenthesisPx(index: number): number;
|
|
212
|
+
getFirstDotPx(): number;
|
|
213
|
+
/** Get the metrics for this note. */
|
|
214
|
+
getMetrics(): NoteMetrics;
|
|
215
|
+
/**
|
|
216
|
+
* Get the absolute `X` position of this note's tick context. This
|
|
217
|
+
* excludes xShift, so you'll need to factor it in if you're
|
|
218
|
+
* looking for the post-formatted x-position.
|
|
219
|
+
*/
|
|
220
|
+
getAbsoluteX(): number;
|
|
221
|
+
/** Get the direction of the stem. */
|
|
222
|
+
getStemDirection(): number;
|
|
223
|
+
/** Get the top and bottom `y` values of the stem. */
|
|
224
|
+
getStemExtents(): Record<string, number>;
|
|
225
|
+
/** Get the `x` coordinate to the right of the note. */
|
|
226
|
+
getTieRightX(): number;
|
|
227
|
+
/** Get the `x` coordinate to the left of the note. */
|
|
228
|
+
getTieLeftX(): number;
|
|
229
|
+
getKeys(): string[];
|
|
230
|
+
getKeyProps(): KeyProps[];
|
|
231
|
+
getBoundingBox(): BoundingBox;
|
|
232
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ElementStyle } from './element';
|
|
2
|
+
import { Note, NoteStruct } from './note';
|
|
3
|
+
import { Stave } from './stave';
|
|
4
|
+
export interface NoteHeadStruct extends NoteStruct {
|
|
5
|
+
line?: number;
|
|
6
|
+
slashed?: boolean;
|
|
7
|
+
style?: ElementStyle;
|
|
8
|
+
customGlyphCode?: string;
|
|
9
|
+
stemDirection?: number;
|
|
10
|
+
displaced?: boolean;
|
|
11
|
+
noteType?: string;
|
|
12
|
+
x?: number;
|
|
13
|
+
y?: number;
|
|
14
|
+
index?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* `NoteHeads` are typically not manipulated
|
|
18
|
+
* directly, but used internally in `StaveNote`.
|
|
19
|
+
*
|
|
20
|
+
* See `tests/notehead_tests.ts` for usage examples.
|
|
21
|
+
*/
|
|
22
|
+
export declare class NoteHead extends Note {
|
|
23
|
+
/** To enable logging for this class. Set `VexFlow.NoteHead.DEBUG` to `true`. */
|
|
24
|
+
static DEBUG: boolean;
|
|
25
|
+
static get CATEGORY(): string;
|
|
26
|
+
protected customGlyph: boolean;
|
|
27
|
+
protected displaced: boolean;
|
|
28
|
+
protected stemDirection: number;
|
|
29
|
+
protected line: number;
|
|
30
|
+
protected index?: number;
|
|
31
|
+
protected slashed: boolean;
|
|
32
|
+
protected ledger: Record<string, string>;
|
|
33
|
+
constructor(noteStruct: NoteHeadStruct);
|
|
34
|
+
/** Get the width of the notehead. */
|
|
35
|
+
getWidth(): number;
|
|
36
|
+
/** Determine if the notehead is displaced. */
|
|
37
|
+
isDisplaced(): boolean;
|
|
38
|
+
/** Get the stave line the notehead is placed on. */
|
|
39
|
+
getLine(): number;
|
|
40
|
+
/** Set the stave line the notehead is placed on. */
|
|
41
|
+
setLine(line: number): this;
|
|
42
|
+
/** Get the canvas `x` coordinate position of the notehead. */
|
|
43
|
+
getAbsoluteX(): number;
|
|
44
|
+
/** Set notehead to a provided `stave`. */
|
|
45
|
+
setStave(stave: Stave): this;
|
|
46
|
+
/** Pre-render formatting. */
|
|
47
|
+
preFormat(): this;
|
|
48
|
+
/** Draw the notehead. */
|
|
49
|
+
draw(): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Formatter } from './formatter';
|
|
2
|
+
import { Modifier } from './modifier';
|
|
3
|
+
import { ModifierContextState } from './modifiercontext';
|
|
4
|
+
import { Note } from './note';
|
|
5
|
+
import { Voice } from './voice';
|
|
6
|
+
export declare class NoteSubGroup extends Modifier {
|
|
7
|
+
static get CATEGORY(): string;
|
|
8
|
+
static format(groups: NoteSubGroup[], state: ModifierContextState): boolean;
|
|
9
|
+
protected subNotes: Note[];
|
|
10
|
+
protected preFormatted: boolean;
|
|
11
|
+
protected formatter: Formatter;
|
|
12
|
+
protected voice: Voice;
|
|
13
|
+
constructor(subNotes: Note[]);
|
|
14
|
+
preFormat(): void;
|
|
15
|
+
setWidth(width: number): this;
|
|
16
|
+
getWidth(): number;
|
|
17
|
+
draw(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Element } from './element';
|
|
2
|
+
import { Modifier } from './modifier';
|
|
3
|
+
import { ModifierContextState } from './modifiercontext';
|
|
4
|
+
import { Note } from './note';
|
|
5
|
+
/**
|
|
6
|
+
* Ornament implements ornaments as modifiers that can be
|
|
7
|
+
* attached to notes. The complete list of ornaments is available in
|
|
8
|
+
* `tables.ts` under `VexFlow.ornamentCodes`.
|
|
9
|
+
*
|
|
10
|
+
* See `tests/ornament_tests.ts` for usage examples.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Ornament extends Modifier {
|
|
13
|
+
/** To enable logging for this class. Set `VexFlow.Ornament.DEBUG` to `true`. */
|
|
14
|
+
static DEBUG: boolean;
|
|
15
|
+
/** Ornaments category string. */
|
|
16
|
+
static get CATEGORY(): string;
|
|
17
|
+
static get minPadding(): number;
|
|
18
|
+
protected ornamentAlignWithNoteHead: string[] | boolean;
|
|
19
|
+
protected type: string;
|
|
20
|
+
protected delayed: boolean;
|
|
21
|
+
protected adjustForStemDirection: boolean;
|
|
22
|
+
renderOptions: {
|
|
23
|
+
accidentalUpperPadding: number;
|
|
24
|
+
accidentalLowerPadding: number;
|
|
25
|
+
};
|
|
26
|
+
protected accidentalUpper?: Element;
|
|
27
|
+
protected accidentalLower?: Element;
|
|
28
|
+
protected delayXShift?: number;
|
|
29
|
+
/** Arrange ornaments inside `ModifierContext` */
|
|
30
|
+
static format(ornaments: Ornament[], state: ModifierContextState): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* ornamentNoteTransition means the jazz ornament represents an effect from one note to another,
|
|
33
|
+
* these are generally on the top of the staff.
|
|
34
|
+
*/
|
|
35
|
+
static get ornamentNoteTransition(): string[];
|
|
36
|
+
/**
|
|
37
|
+
* ornamentAttack indicates something that happens in the attach, placed before the note and
|
|
38
|
+
* any accidentals
|
|
39
|
+
*/
|
|
40
|
+
static get ornamentAttack(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* The ornament is aligned based on the note head, but without regard to whether the
|
|
43
|
+
* stem goes up or down.
|
|
44
|
+
*/
|
|
45
|
+
static get ornamentAlignWithNoteHead(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* An ornament that happens on the release of the note, generally placed after the
|
|
48
|
+
* note and overlapping the next beat/measure..
|
|
49
|
+
*/
|
|
50
|
+
static get ornamentRelease(): string[];
|
|
51
|
+
static get ornamentLeft(): string[];
|
|
52
|
+
static get ornamentRight(): string[];
|
|
53
|
+
static get ornamentYShift(): string[];
|
|
54
|
+
/** ornamentArticulation goes above/below the note based on space availablity */
|
|
55
|
+
static get ornamentArticulation(): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Create a new ornament of type `type`, which is an entry in
|
|
58
|
+
* `VexFlow.ornamentCodes` in `tables.ts`.
|
|
59
|
+
*/
|
|
60
|
+
constructor(type: string);
|
|
61
|
+
/** Set note attached to ornament. */
|
|
62
|
+
setNote(note: Note): this;
|
|
63
|
+
/** Set whether the ornament is to be delayed. */
|
|
64
|
+
setDelayed(delayed: boolean): this;
|
|
65
|
+
/** Set the upper accidental for the ornament. */
|
|
66
|
+
setUpperAccidental(accid: string): this;
|
|
67
|
+
/** Set the lower accidental for the ornament. */
|
|
68
|
+
setLowerAccidental(accid: string): this;
|
|
69
|
+
/** Render ornament in position next to note. */
|
|
70
|
+
draw(): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Modifier, ModifierPosition } from './modifier';
|
|
2
|
+
import { ModifierContextState } from './modifiercontext';
|
|
3
|
+
import { Note } from './note';
|
|
4
|
+
/** Parenthesis implements parenthesis modifiers for notes. */
|
|
5
|
+
export declare class Parenthesis extends Modifier {
|
|
6
|
+
static get CATEGORY(): string;
|
|
7
|
+
/** Add parentheses to the notes. */
|
|
8
|
+
static buildAndAttach(notes: Note[]): void;
|
|
9
|
+
/** Arrange parentheses inside a ModifierContext. */
|
|
10
|
+
static format(parentheses: Parenthesis[], state: ModifierContextState): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
*
|
|
14
|
+
* @param position Modifier.Position.LEFT (default) or Modifier.Position.RIGHT
|
|
15
|
+
*/
|
|
16
|
+
constructor(position: ModifierPosition);
|
|
17
|
+
/** Set the associated note. */
|
|
18
|
+
setNote(note: Note): this;
|
|
19
|
+
/** Render the parenthesis. */
|
|
20
|
+
draw(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type Match = string | Match[] | null;
|
|
2
|
+
export type RuleFunction = () => Rule;
|
|
3
|
+
export type TriggerFunction = (state?: {
|
|
4
|
+
matches: Match[];
|
|
5
|
+
}) => void;
|
|
6
|
+
export interface Rule {
|
|
7
|
+
token?: string;
|
|
8
|
+
noSpace?: boolean;
|
|
9
|
+
expect?: RuleFunction[];
|
|
10
|
+
zeroOrMore?: boolean;
|
|
11
|
+
oneOrMore?: boolean;
|
|
12
|
+
maybe?: boolean;
|
|
13
|
+
or?: boolean;
|
|
14
|
+
run?: TriggerFunction;
|
|
15
|
+
}
|
|
16
|
+
export interface Result {
|
|
17
|
+
success: boolean;
|
|
18
|
+
pos?: number;
|
|
19
|
+
incrementPos?: number;
|
|
20
|
+
matchedString?: string;
|
|
21
|
+
matches?: Match[];
|
|
22
|
+
numMatches?: number;
|
|
23
|
+
results?: GroupedResults;
|
|
24
|
+
errorPos?: number;
|
|
25
|
+
}
|
|
26
|
+
export type GroupedResults = (Result | Result[])[];
|
|
27
|
+
export interface Grammar {
|
|
28
|
+
begin(): RuleFunction;
|
|
29
|
+
}
|
|
30
|
+
export declare class Parser {
|
|
31
|
+
static DEBUG: boolean;
|
|
32
|
+
protected grammar: Grammar;
|
|
33
|
+
protected line: string;
|
|
34
|
+
protected pos: number;
|
|
35
|
+
protected errorPos: number;
|
|
36
|
+
constructor(grammar: Grammar);
|
|
37
|
+
parse(line: string): Result;
|
|
38
|
+
matchFail(returnPos: number): void;
|
|
39
|
+
matchSuccess(): void;
|
|
40
|
+
matchToken(token: string, noSpace?: boolean): Result;
|
|
41
|
+
expectOne(rule: Rule, maybe?: boolean): Result;
|
|
42
|
+
expectOneOrMore(rule: Rule, maybe?: boolean): Result;
|
|
43
|
+
expectZeroOrMore(rule: Rule): Result;
|
|
44
|
+
expect(ruleFunc: RuleFunction): Result;
|
|
45
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Element } from './element';
|
|
2
|
+
import { StaveNote } from './stavenote';
|
|
3
|
+
/**
|
|
4
|
+
* PedalMarking implements different types of pedal markings. These notation
|
|
5
|
+
* elements indicate to the performer when to depress and release the a pedal.
|
|
6
|
+
*
|
|
7
|
+
* In order to create "Sostenuto", and "una corda" markings, you must set
|
|
8
|
+
* custom text for the release/depress pedal markings.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PedalMarking extends Element {
|
|
11
|
+
/** To enable logging for this class. Set `VexFlow.PedalMarking.DEBUG` to `true`. */
|
|
12
|
+
static DEBUG: boolean;
|
|
13
|
+
static get CATEGORY(): string;
|
|
14
|
+
protected line: number;
|
|
15
|
+
protected type: number;
|
|
16
|
+
protected depressText: string;
|
|
17
|
+
protected releaseText: string;
|
|
18
|
+
renderOptions: {
|
|
19
|
+
color: string;
|
|
20
|
+
bracketHeight: number;
|
|
21
|
+
textMarginRight: number;
|
|
22
|
+
bracketLineWidth: number;
|
|
23
|
+
};
|
|
24
|
+
protected notes: StaveNote[];
|
|
25
|
+
/** Glyph data */
|
|
26
|
+
static readonly GLYPHS: Record<string, string>;
|
|
27
|
+
/** Pedal type as number. */
|
|
28
|
+
static readonly type: {
|
|
29
|
+
TEXT: number;
|
|
30
|
+
BRACKET: number;
|
|
31
|
+
MIXED: number;
|
|
32
|
+
};
|
|
33
|
+
/** Pedal type as string. */
|
|
34
|
+
static readonly typeString: Record<string, number>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a sustain pedal marking. Returns the defaults PedalMarking.
|
|
37
|
+
* Which uses the traditional "Ped" and "*"" markings.
|
|
38
|
+
*/
|
|
39
|
+
static createSustain(notes: StaveNote[]): PedalMarking;
|
|
40
|
+
/** Create a sostenuto pedal marking */
|
|
41
|
+
static createSostenuto(notes: StaveNote[]): PedalMarking;
|
|
42
|
+
/** Create an una corda pedal marking */
|
|
43
|
+
static createUnaCorda(notes: StaveNote[]): PedalMarking;
|
|
44
|
+
constructor(notes: StaveNote[]);
|
|
45
|
+
/** Set pedal type. */
|
|
46
|
+
setType(type: string | number): this;
|
|
47
|
+
/**
|
|
48
|
+
* Set custom text for the `depress`/`release` pedal markings. No text is
|
|
49
|
+
* set if the parameter is falsy.
|
|
50
|
+
*/
|
|
51
|
+
setCustomText(depress: string, release?: string): this;
|
|
52
|
+
/** Set the staff line to render the markings on. */
|
|
53
|
+
setLine(line: number): this;
|
|
54
|
+
/** Draw the bracket based pedal markings. */
|
|
55
|
+
drawBracketed(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Draw the text based pedal markings. This defaults to the traditional
|
|
58
|
+
* "Ped" and "*"" symbols if no custom text has been provided.
|
|
59
|
+
*/
|
|
60
|
+
drawText(): void;
|
|
61
|
+
/** Render the pedal marking in position on the rendering context. */
|
|
62
|
+
draw(): void;
|
|
63
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Element } from './element';
|
|
2
|
+
declare class Index {
|
|
3
|
+
[key: string]: {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
[key: string]: Element;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export interface RegistryUpdate {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
value: string | undefined;
|
|
14
|
+
oldValue: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare class Registry {
|
|
17
|
+
protected static defaultRegistry?: Registry;
|
|
18
|
+
static getDefaultRegistry(): Registry | undefined;
|
|
19
|
+
static enableDefaultRegistry(registry: Registry): void;
|
|
20
|
+
static disableDefaultRegistry(): void;
|
|
21
|
+
protected index: Index;
|
|
22
|
+
constructor();
|
|
23
|
+
clear(): this;
|
|
24
|
+
setIndexValue(name: string, value: string, id: string, elem: Element): void;
|
|
25
|
+
updateIndex({ id, name, value, oldValue }: RegistryUpdate): void;
|
|
26
|
+
/**
|
|
27
|
+
* Register element `elem` with this registry.
|
|
28
|
+
* This adds the element to its index and watches it for attribute changes.
|
|
29
|
+
* @param elem
|
|
30
|
+
* @param id
|
|
31
|
+
* @returns this
|
|
32
|
+
*/
|
|
33
|
+
register(elem: Element, id?: string): this;
|
|
34
|
+
getElementById(id: string): Element | undefined;
|
|
35
|
+
getElementsByAttribute(attribute: string, value: string): Element[];
|
|
36
|
+
getElementsByType(type: string): Element[];
|
|
37
|
+
getElementsByClass(className: string): Element[];
|
|
38
|
+
onUpdate(info: RegistryUpdate): this;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FontInfo } from './font';
|
|
2
|
+
export interface TextMeasure {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export declare abstract class RenderContext {
|
|
9
|
+
static get CATEGORY(): string;
|
|
10
|
+
abstract clear(): void;
|
|
11
|
+
abstract setFillStyle(style: string): this;
|
|
12
|
+
abstract setBackgroundFillStyle(style: string): this;
|
|
13
|
+
abstract setStrokeStyle(style: string): this;
|
|
14
|
+
abstract setShadowColor(color: string): this;
|
|
15
|
+
abstract setShadowBlur(blur: number): this;
|
|
16
|
+
abstract setLineWidth(width: number): this;
|
|
17
|
+
abstract setLineCap(capType: CanvasLineCap): this;
|
|
18
|
+
abstract setLineDash(dashPattern: number[]): this;
|
|
19
|
+
abstract scale(x: number, y: number): this;
|
|
20
|
+
abstract rect(x: number, y: number, width: number, height: number): this;
|
|
21
|
+
abstract resize(width: number, height: number): this;
|
|
22
|
+
abstract fillRect(x: number, y: number, width: number, height: number): this;
|
|
23
|
+
abstract clearRect(x: number, y: number, width: number, height: number): this;
|
|
24
|
+
abstract pointerRect(x: number, y: number, width: number, height: number): this;
|
|
25
|
+
abstract beginPath(): this;
|
|
26
|
+
abstract moveTo(x: number, y: number): this;
|
|
27
|
+
abstract lineTo(x: number, y: number): this;
|
|
28
|
+
abstract bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): this;
|
|
29
|
+
abstract quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): this;
|
|
30
|
+
abstract arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise: boolean): this;
|
|
31
|
+
abstract fill(attributes?: any): this;
|
|
32
|
+
abstract stroke(): this;
|
|
33
|
+
abstract closePath(): this;
|
|
34
|
+
abstract fillText(text: string, x: number, y: number): this;
|
|
35
|
+
abstract save(): this;
|
|
36
|
+
abstract restore(): this;
|
|
37
|
+
abstract openGroup(cls?: string, id?: string): any;
|
|
38
|
+
abstract closeGroup(): void;
|
|
39
|
+
abstract openRotation(angleDegrees: number, x: number, y: number): void;
|
|
40
|
+
abstract closeRotation(): void;
|
|
41
|
+
abstract add(child: any): void;
|
|
42
|
+
abstract measureText(text: string): TextMeasure;
|
|
43
|
+
abstract set fillStyle(style: string | CanvasGradient | CanvasPattern);
|
|
44
|
+
abstract get fillStyle(): string | CanvasGradient | CanvasPattern;
|
|
45
|
+
abstract set strokeStyle(style: string | CanvasGradient | CanvasPattern);
|
|
46
|
+
abstract get strokeStyle(): string | CanvasGradient | CanvasPattern;
|
|
47
|
+
abstract setFont(f?: string | FontInfo, size?: string | number, weight?: string | number, style?: string): this;
|
|
48
|
+
abstract getFont(): string;
|
|
49
|
+
set font(f: string);
|
|
50
|
+
get font(): string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Draw a tiny dot marker on the specified context. A great debugging aid.
|
|
54
|
+
* @param ctx context
|
|
55
|
+
* @param x dot x coordinate
|
|
56
|
+
* @param y dot y coordinate
|
|
57
|
+
* @param color
|
|
58
|
+
*/
|
|
59
|
+
export declare function drawDot(ctx: RenderContext, x: number, y: number, color?: string): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RenderContext } from './rendercontext';
|
|
2
|
+
export type ContextBuilder = typeof Renderer.getSVGContext | typeof Renderer.getCanvasContext;
|
|
3
|
+
export declare enum RendererBackends {
|
|
4
|
+
CANVAS = 1,
|
|
5
|
+
SVG = 2
|
|
6
|
+
}
|
|
7
|
+
export declare enum RendererLineEndType {
|
|
8
|
+
NONE = 1,// No leg
|
|
9
|
+
UP = 2,// Upward leg
|
|
10
|
+
DOWN = 3
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Support Canvas & SVG rendering contexts.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Renderer {
|
|
16
|
+
static Backends: typeof RendererBackends;
|
|
17
|
+
static LineEndType: typeof RendererLineEndType;
|
|
18
|
+
static lastContext?: RenderContext;
|
|
19
|
+
static buildContext(elementId: string | HTMLCanvasElement | HTMLDivElement, backend: number, width: number, height: number, background?: string): RenderContext;
|
|
20
|
+
static getCanvasContext(elementId: string, width: number, height: number, background?: string): RenderContext;
|
|
21
|
+
static getSVGContext(elementId: string, width: number, height: number, background?: string): RenderContext;
|
|
22
|
+
static drawDashedLine(context: RenderContext, fromX: number, fromY: number, toX: number, toY: number, dashPattern: number[]): void;
|
|
23
|
+
protected ctx: RenderContext;
|
|
24
|
+
/**
|
|
25
|
+
* @param canvasId can be:
|
|
26
|
+
* - a string element ID (of a canvas or div element)
|
|
27
|
+
* - a canvas element
|
|
28
|
+
* - a div element, which will contain the SVG output
|
|
29
|
+
* @param backend Renderer.Backends.CANVAS or Renderer.Backends.SVG
|
|
30
|
+
*/
|
|
31
|
+
constructor(context: RenderContext);
|
|
32
|
+
constructor(canvas: string | HTMLCanvasElement | HTMLDivElement, backend: number);
|
|
33
|
+
resize(width: number, height: number): this;
|
|
34
|
+
getContext(): RenderContext;
|
|
35
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GlyphNote, GlyphNoteOptions } from './glyphnote';
|
|
2
|
+
import { NoteStruct } from './note';
|
|
3
|
+
export declare class RepeatNote extends GlyphNote {
|
|
4
|
+
static get CATEGORY(): string;
|
|
5
|
+
constructor(type: string, noteStruct?: NoteStruct, options?: GlyphNoteOptions);
|
|
6
|
+
}
|