@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
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
VexFlow - A JavaScript library for rendering music notation.
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present VexFlow contributors (see AUTHORS.md).
|
|
4
|
+
Copyright (c) 2010-2022 Mohit Muthanna Cheppudira
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# VexFlow
|
|
2
|
+
|
|
3
|
+
Version of Vexflow that inherits from the original by Mohit Muthanna Cheppudira.
|
|
4
|
+
|
|
5
|
+
VexFlow is an open-source library for rendering sheet music. It is written in TypeScript, and outputs scores to HTML Canvas and SVG. It works in browsers and in Node.js projects (e.g., a command line script to save a score as a PDF).
|
|
6
|
+
|
|
7
|
+
VexFlow targets modern browsers and Node.js 17 or newer, with native `structuredClone()` support.
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
The simplest way to add VexFlow to a web page is via a `<script>` tag.
|
|
12
|
+
|
|
13
|
+
See this example: [https://jsfiddle.net/ck6erLhm/](https://jsfiddle.net/ck6erLhm/)
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<div id="output"></div>
|
|
17
|
+
<script src="vexflow.js"></script>
|
|
18
|
+
<script>
|
|
19
|
+
// YOUR CODE GOES HERE
|
|
20
|
+
</script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The URL above includes a version number <code>vexflow@x.y.z</code>. Specifying a version prevents a future update from breaking your deployment.
|
|
24
|
+
|
|
25
|
+
If your project uses a bundler, you can install VexFlow from npm:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install vexflow
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
[See tutorial](https://vexflow.github.io/vexflow-examples/tutorial).
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
Install the project dependencies with Node.js and npm:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Run
|
|
42
|
+
|
|
43
|
+
Start the Vite development server:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm start
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Vite opens `http://127.0.0.1:5173/`, which redirects to the browser test page. The test page loads the TypeScript source directly and updates modules when source files change. This workflow does not write distributable files to `build/`. Run `npm run dev` to start the same server without opening a browser, then visit `http://127.0.0.1:5173/`.
|
|
50
|
+
|
|
51
|
+
Some examples in `demos/` intentionally exercise generated package artifacts. Run `npm run build` before opening those examples.
|
|
52
|
+
|
|
53
|
+
### Build
|
|
54
|
+
|
|
55
|
+
Create a clean production build:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
npm run build
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This runs linting and generates the CommonJS bundles, ES modules, and TypeScript declarations under `build/`. Individual build stages are also available:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
npm run build:cjs
|
|
65
|
+
npm run build:esm
|
|
66
|
+
npm run build:types
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Test
|
|
70
|
+
|
|
71
|
+
Run the complete Vitest suite once:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npm test
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Run Vitest in watch mode while developing:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
npm run test:watch
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Run source-rendered browser visual regression tests with Playwright. Install its Chromium browser once after installing dependencies:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
npx playwright install chromium
|
|
87
|
+
npm run test:visual
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Update committed visual baselines deliberately after reviewing an intentional rendering change:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
npm run test:visual:update
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Playwright stores failure artifacts in `build/playwright-artifacts/`. The committed snapshots are macOS Chromium baselines, and CI runs the visual suite on macOS to match them.
|
|
97
|
+
|
|
98
|
+
The legacy reference-image workflow generates images with the Playwright backend:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
npm run build:cjs
|
|
102
|
+
npm run generate:current -- --backends=playwright
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Generated images are written to `build/images/current/`. Use `--backends=all` to run both the Playwright and jsdom image generators. The complete reference comparison workflow is available through `npm run test:reference`.
|
|
106
|
+
|
|
107
|
+
Run the linter separately with:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
npm run lint
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Factory and EasyScore
|
|
114
|
+
|
|
115
|
+
Factory and EasyScore are VexFlow's high-level API for creating staves, voices, and notes. On a web page containing a `<div id="output"></div>`, the following code displays a score:
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
const factory = new VexFlow.Factory({
|
|
119
|
+
renderer: { elementId: "output", width: 500, height: 200 },
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const score = factory.EasyScore();
|
|
123
|
+
const system = factory.System();
|
|
124
|
+
|
|
125
|
+
system
|
|
126
|
+
.addStave({
|
|
127
|
+
voices: [
|
|
128
|
+
score.voice(score.notes("C#5/q, B4, A4, G#4", { stem: "up" })),
|
|
129
|
+
score.voice(score.notes("C#4/h, C#4", { stem: "down" })),
|
|
130
|
+
],
|
|
131
|
+
})
|
|
132
|
+
.addClef("treble")
|
|
133
|
+
.addTimeSignature("4/4");
|
|
134
|
+
|
|
135
|
+
factory.draw();
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
[See a version running here.](https://vexflow.github.io/vexflow-examples/getting-started)
|
|
139
|
+
|
|
140
|
+
[Learn more about EasyScore here.](https://github.com/0xfe/vexflow/wiki/Using-EasyScore)
|
|
141
|
+
|
|
142
|
+
## Native API
|
|
143
|
+
|
|
144
|
+
You can use the low-level VexFlow API if you need more control. Below, we render a stave using SVG. [See a running example of the low-level API here.](https://vexflow.github.io/vexflow-examples/getting-started)
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
const { Renderer, Stave } = VexFlow;
|
|
148
|
+
|
|
149
|
+
// Create an SVG renderer and attach it to the DIV element with id="output".
|
|
150
|
+
const div = document.getElementById("output");
|
|
151
|
+
const renderer = new Renderer(div, Renderer.Backends.SVG);
|
|
152
|
+
|
|
153
|
+
// Configure the rendering context.
|
|
154
|
+
renderer.resize(500, 500);
|
|
155
|
+
const context = renderer.getContext();
|
|
156
|
+
|
|
157
|
+
// Create a stave of width 400 at position 10, 40.
|
|
158
|
+
const stave = new Stave(10, 40, 400);
|
|
159
|
+
|
|
160
|
+
// Add a clef and time signature.
|
|
161
|
+
stave.addClef("treble").addTimeSignature("4/4");
|
|
162
|
+
|
|
163
|
+
// Connect it to the rendering context and draw!
|
|
164
|
+
stave.setContext(context).draw();
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Examples
|
|
168
|
+
|
|
169
|
+
A good way to learn the API is to look at our examples & unit tests:
|
|
170
|
+
|
|
171
|
+
- [Examples](https://vexflow.github.io/vexflow-examples)
|
|
172
|
+
|
|
173
|
+
- [Unit Tests](https://github.com/vexflow/vexflow/tree/main/tests)
|
|
174
|
+
|
|
175
|
+
## More Resources
|
|
176
|
+
|
|
177
|
+
- If you need help, start a [GitHub discussion](https://github.com/vexflow/vexflow/discussions).
|
|
178
|
+
|
|
179
|
+
- Learn more on the [VexFlow wiki](https://github.com/vexflow/vexflow/wiki).
|
|
180
|
+
|
|
181
|
+
- Build VexFlow from scratch by following the [build instructions](https://github.com/vexflow/vexflow/wiki/Build).
|
|
182
|
+
|
|
183
|
+
- [VexFlow](https://vexflow.com) was created by [Mohit Muthanna Cheppudira](https://muthanna.com) in 2010. It is currently maintained by [Ron Yeh](https://github.com/ronyeh) and [Rodrigo Vilar](https://github.com/rvilarl). Many others have contributed with code, documentation, bug reports, and feature requests. See the [list of contributors](https://github.com/0xfe/vexflow/graphs/contributors).
|
|
184
|
+
|
|
185
|
+
- [Projects Using VexFlow](https://github.com/0xfe/vexflow/wiki/Project-Gallery)
|
|
186
|
+
|
|
187
|
+
# MIT License
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2023-present VexFlow contributors (see AUTHORS.md).<br />
|
|
190
|
+
Copyright (c) 2010-2022 Mohit Muthanna Cheppudira
|
|
191
|
+
|
|
192
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
193
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
194
|
+
in the Software without restriction, including without limitation the rights
|
|
195
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
196
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
197
|
+
furnished to do so, subject to the following conditions:
|
|
198
|
+
|
|
199
|
+
The above copyright notice and this permission notice shall be included in
|
|
200
|
+
all copies or substantial portions of the Software.
|
|
201
|
+
|
|
202
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
203
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
204
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
205
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
206
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
207
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
208
|
+
THE SOFTWARE.
|