vexflow 4.0.1-rc.0 → 4.0.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/README.md +29 -48
- 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 +4 -4
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +4 -4
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow-gonville.js +2 -2
- package/build/cjs/vexflow-gonville.js.map +1 -1
- package/build/cjs/vexflow-petaluma.js +2 -2
- package/build/cjs/vexflow-petaluma.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/version.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
# VexFlow
|
|
2
2
|
|
|
3
|
-
VexFlow is an open-source library for rendering music notation. It is written in TypeScript (compiled to ES6), and outputs scores to HTML
|
|
4
|
-
Canvas and SVG, right in the browser. It also works in Node.js projects (e.g., a command line script to save a score as a PDF).
|
|
3
|
+
VexFlow is an open-source library for rendering music notation. It is written in TypeScript (compiled to ES6), and outputs scores to HTML Canvas and SVG. It works in browsers and also in Node.js projects (e.g., a command line script to save a score as a PDF).
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
If you find VexFlow useful, please consider sponsoring its development: https://github.com/sponsors/0xfe.
|
|
9
|
-
|
|
10
|
-
## Version 3 → 4
|
|
11
|
-
|
|
12
|
-
As of this writing (March 2022), we are nearing the release of a new major version of VexFlow. The guide below refers to VexFlow 4 (the new version). If you need to work with the previous version, follow the [version 3.0.9 tutorial.](https://github.com/0xfe/vexflow/wiki/VexFlow-3.0.9-Tutorial)
|
|
5
|
+
The guide below refers to VexFlow 4. If you need to work with the previous version, follow the [version 3.0.9 tutorial.](https://github.com/0xfe/vexflow/wiki/VexFlow-3.0.9-Tutorial)
|
|
13
6
|
|
|
14
7
|
## Quick Start
|
|
15
8
|
|
|
16
|
-
The quickest way to add VexFlow to
|
|
9
|
+
The quickest way to add VexFlow to a web page is via a `<script>` tag.
|
|
17
10
|
|
|
18
11
|
```html
|
|
19
12
|
<script src="https://cdn.jsdelivr.net/npm/vexflow/build/cjs/vexflow.js"></script>
|
|
@@ -22,42 +15,27 @@ The quickest way to add VexFlow to an HTML page is via a `<script>` tag.
|
|
|
22
15
|
</script>
|
|
23
16
|
```
|
|
24
17
|
|
|
25
|
-
The URL above will work once VexFlow 4 is released. For now, insert `@beta` into the URL:
|
|
26
|
-
|
|
27
|
-
```html
|
|
28
|
-
<!-- BETA URL BELOW -->
|
|
29
|
-
<script src="https://cdn.jsdelivr.net/npm/vexflow@beta/build/cjs/vexflow.js"></script>
|
|
30
|
-
<script>
|
|
31
|
-
// YOUR CODE GOES HERE
|
|
32
|
-
</script>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
18
|
If your project uses a bundler, you can install VexFlow from npm:
|
|
36
19
|
|
|
37
20
|
```sh
|
|
38
21
|
npm install vexflow
|
|
39
22
|
```
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
npm install vexflow@beta
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
[More details on integrating with VexFlow 4.](https://github.com/0xfe/vexflow/wiki/VexFlow-4-Tutorial)
|
|
24
|
+
Read our detailed guide on [integrating with VexFlow.](https://github.com/0xfe/vexflow/wiki/VexFlow-4-Tutorial)
|
|
48
25
|
|
|
49
26
|
## EasyScore
|
|
50
27
|
|
|
51
|
-
EasyScore is VexFlow's high-level API for creating music notation.
|
|
52
|
-
[See a running example here.](https://jsfiddle.net/2pbh9xq0/)
|
|
28
|
+
EasyScore is VexFlow's high-level API for creating music notation. On a web page containing a `<div id="output"></div>`, the following code displays a score:
|
|
53
29
|
|
|
54
30
|
```javascript
|
|
55
|
-
const
|
|
56
|
-
|
|
31
|
+
const { Factory, EasyScore, System } = Vex.Flow;
|
|
32
|
+
|
|
33
|
+
const vf = new Factory({
|
|
34
|
+
renderer: { elementId: 'output', width: 500, height: 200 },
|
|
57
35
|
});
|
|
58
36
|
|
|
59
|
-
const score =
|
|
60
|
-
const system =
|
|
37
|
+
const score = vf.EasyScore();
|
|
38
|
+
const system = vf.System();
|
|
61
39
|
|
|
62
40
|
system
|
|
63
41
|
.addStave({
|
|
@@ -69,30 +47,31 @@ system
|
|
|
69
47
|
.addClef('treble')
|
|
70
48
|
.addTimeSignature('4/4');
|
|
71
49
|
|
|
72
|
-
|
|
50
|
+
vf.draw();
|
|
73
51
|
```
|
|
74
52
|
|
|
53
|
+
[See a running example of EasyScore here.](https://jsfiddle.net/t1672wza/)
|
|
54
|
+
|
|
75
55
|
[Learn more about EasyScore here.](https://github.com/0xfe/vexflow/wiki/Using-EasyScore)
|
|
76
56
|
|
|
77
57
|
## Native API
|
|
78
58
|
|
|
79
|
-
If you need more control, you can use the low-level VexFlow API.
|
|
80
|
-
Below, we render a stave using SVG. [See a running example here.](https://jsfiddle.net/j6dpazx2/)
|
|
59
|
+
If you need more control, you can use the low-level VexFlow API. Below, we render a stave using SVG. [See a running example of the low-level API here.](https://jsfiddle.net/vbu1nto7/)
|
|
81
60
|
|
|
82
61
|
```javascript
|
|
83
|
-
const
|
|
62
|
+
const { Renderer, Stave } = Vex.Flow;
|
|
84
63
|
|
|
85
|
-
// Create an SVG renderer and attach it to the DIV element
|
|
64
|
+
// Create an SVG renderer and attach it to the DIV element with id="output".
|
|
86
65
|
const div = document.getElementById('output');
|
|
87
|
-
const renderer = new
|
|
66
|
+
const renderer = new Renderer(div, Renderer.Backends.SVG);
|
|
88
67
|
|
|
89
68
|
// Configure the rendering context.
|
|
90
69
|
renderer.resize(500, 500);
|
|
91
70
|
const context = renderer.getContext();
|
|
92
71
|
context.setFont('Arial', 10);
|
|
93
72
|
|
|
94
|
-
// Create a stave of width 400 at position 10, 40
|
|
95
|
-
const stave = new
|
|
73
|
+
// Create a stave of width 400 at position 10, 40.
|
|
74
|
+
const stave = new Stave(10, 40, 400);
|
|
96
75
|
|
|
97
76
|
// Add a clef and time signature.
|
|
98
77
|
stave.addClef('treble').addTimeSignature('4/4');
|
|
@@ -107,19 +86,21 @@ stave.setContext(context).draw();
|
|
|
107
86
|
|
|
108
87
|
- Dig into [the unit tests](https://github.com/0xfe/vexflow/tree/master/tests).
|
|
109
88
|
|
|
110
|
-
##
|
|
89
|
+
## More Resources
|
|
111
90
|
|
|
112
|
-
|
|
91
|
+
- If you need help, come join us on the [Vexflow Google Group](https://groups.google.com/forum/?fromgroups#!forum/vexflow).
|
|
113
92
|
|
|
114
|
-
|
|
93
|
+
- Learn more on the [VexFlow wiki](https://github.com/0xfe/vexflow/wiki).
|
|
115
94
|
|
|
116
|
-
-
|
|
95
|
+
- Build VexFlow from scratch by following the [build instructions](https://github.com/0xfe/vexflow/wiki/Build%2C-Test%2C-Release).
|
|
117
96
|
|
|
118
|
-
-
|
|
97
|
+
- [VexFlow](https://vexflow.com) was created by [Mohit Muthanna Cheppudira](https://muthanna.com) in 2010. Since then, many have contributed with code, documentation, bug reports, and feature requests. See the [list of contributors to the repository](https://github.com/0xfe/vexflow/graphs/contributors).
|
|
119
98
|
|
|
120
|
-
- [VexFlow
|
|
99
|
+
- [Projects Using VexFlow](https://github.com/0xfe/vexflow/wiki/Project-Gallery)
|
|
121
100
|
|
|
122
|
-
|
|
101
|
+
## Sponsor this Project
|
|
102
|
+
|
|
103
|
+
If you find VexFlow useful, please consider sponsoring its development: https://github.com/sponsors/0xfe.
|
|
123
104
|
|
|
124
105
|
# MIT License
|
|
125
106
|
|