vexflow 4.0.1-beta.0 → 4.0.1-rc.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.
Files changed (90) hide show
  1. package/README.md +58 -56
  2. package/build/cjs/vexflow-bravura.js +2 -2
  3. package/build/cjs/vexflow-bravura.js.map +1 -1
  4. package/build/cjs/vexflow-core.js +2 -2
  5. package/build/cjs/vexflow-core.js.map +1 -1
  6. package/build/cjs/vexflow-debug-with-tests.js +846 -719
  7. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  8. package/build/cjs/vexflow-debug.js +640 -632
  9. package/build/cjs/vexflow-debug.js.map +1 -1
  10. package/build/cjs/vexflow-font-gonville.js +1 -1
  11. package/build/cjs/vexflow-font-gonville.js.map +1 -1
  12. package/build/cjs/vexflow-gonville.js +2 -2
  13. package/build/cjs/vexflow-gonville.js.map +1 -1
  14. package/build/cjs/vexflow-petaluma.js +2 -2
  15. package/build/cjs/vexflow-petaluma.js.map +1 -1
  16. package/build/cjs/vexflow.js +2 -2
  17. package/build/cjs/vexflow.js.map +1 -1
  18. package/build/esm/entry/vexflow-bravura.js +1 -2
  19. package/build/esm/entry/vexflow-core.js +1 -2
  20. package/build/esm/entry/vexflow-debug-with-tests.js +9 -2
  21. package/build/esm/entry/vexflow-debug.js +7 -2
  22. package/build/esm/entry/vexflow-gonville.js +1 -2
  23. package/build/esm/entry/vexflow-petaluma.js +1 -2
  24. package/build/esm/entry/vexflow.js +1 -2
  25. package/build/esm/src/annotation.js +30 -5
  26. package/build/esm/src/articulation.js +5 -2
  27. package/build/esm/src/beam.js +18 -6
  28. package/build/esm/src/factory.js +6 -1
  29. package/build/esm/src/flow.js +27 -14
  30. package/build/esm/src/font.js +0 -2
  31. package/build/esm/src/fonts/gonville_glyphs.js +4 -4
  32. package/build/esm/src/formatter.js +21 -4
  33. package/build/esm/src/glyph.js +6 -0
  34. package/build/esm/src/index.js +1 -3
  35. package/build/esm/src/note.js +2 -2
  36. package/build/esm/src/staveline.js +2 -5
  37. package/build/esm/src/stavenote.js +83 -22
  38. package/build/esm/src/stavetext.js +3 -3
  39. package/build/esm/src/system.js +1 -8
  40. package/build/esm/src/textnote.js +12 -14
  41. package/build/esm/src/version.js +3 -3
  42. package/build/esm/tests/annotation_tests.js +14 -1
  43. package/build/esm/tests/beam_tests.js +19 -0
  44. package/build/esm/tests/easyscore_tests.js +5 -2
  45. package/build/esm/tests/formatter_tests.js +9 -8
  46. package/build/esm/tests/gracenote_tests.js +43 -0
  47. package/build/esm/tests/stave_tests.js +3 -3
  48. package/build/esm/tests/stavenote_tests.js +32 -0
  49. package/build/types/entry/vexflow-bravura.d.ts +1 -2
  50. package/build/types/entry/vexflow-core.d.ts +1 -2
  51. package/build/types/entry/vexflow-debug.d.ts +1 -2
  52. package/build/types/entry/vexflow-gonville.d.ts +1 -2
  53. package/build/types/entry/vexflow-petaluma.d.ts +1 -2
  54. package/build/types/entry/vexflow.d.ts +1 -2
  55. package/build/types/src/annotation.d.ts +1 -0
  56. package/build/types/src/beam.d.ts +30 -1
  57. package/build/types/src/easyscore.d.ts +4 -0
  58. package/build/types/src/factory.d.ts +4 -1
  59. package/build/types/src/flow.d.ts +27 -12
  60. package/build/types/src/font.d.ts +0 -1
  61. package/build/types/src/glyph.d.ts +2 -0
  62. package/build/types/src/index.d.ts +1 -3
  63. package/build/types/src/note.d.ts +2 -0
  64. package/build/types/src/staveline.d.ts +2 -5
  65. package/build/types/src/textnote.d.ts +4 -4
  66. package/entry/vexflow-bravura.ts +3 -3
  67. package/entry/vexflow-core.ts +3 -3
  68. package/entry/vexflow-debug-with-tests.ts +16 -2
  69. package/entry/vexflow-debug.ts +11 -3
  70. package/entry/vexflow-gonville.ts +3 -3
  71. package/entry/vexflow-petaluma.ts +3 -3
  72. package/entry/vexflow.ts +3 -3
  73. package/package.json +1 -1
  74. package/src/annotation.ts +38 -6
  75. package/src/articulation.ts +8 -2
  76. package/src/beam.ts +53 -6
  77. package/src/easyscore.ts +11 -1
  78. package/src/factory.ts +16 -2
  79. package/src/flow.ts +35 -20
  80. package/src/font.ts +0 -4
  81. package/src/fonts/gonville_glyphs.ts +4 -4
  82. package/src/formatter.ts +24 -8
  83. package/src/glyph.ts +8 -0
  84. package/src/index.ts +2 -7
  85. package/src/note.ts +4 -3
  86. package/src/staveline.ts +2 -5
  87. package/src/stavenote.ts +93 -25
  88. package/src/stavetext.ts +3 -3
  89. package/src/system.ts +1 -7
  90. package/src/textnote.ts +9 -11
package/README.md CHANGED
@@ -1,67 +1,63 @@
1
- # VexFlow 4 (beta)
1
+ # VexFlow
2
2
 
3
- A JavaScript / TypeScript library for rendering music notation.
4
-
5
- Copyright (c) 2010 Mohit Muthanna Cheppudira
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).
6
5
 
7
6
  ## Sponsor this Project
8
7
 
9
- If you use VexFlow in your app, startup, institution, and find it useful, please consider sponsoring its development here: https://github.com/sponsors/0xfe.
10
-
11
- ## Need Help?
12
-
13
- Ask on the [Vexflow Google Group](https://groups.google.com/forum/?fromgroups#!forum/vexflow).
14
-
15
- ## What is VexFlow?
8
+ If you find VexFlow useful, please consider sponsoring its development: https://github.com/sponsors/0xfe.
16
9
 
17
- VexFlow is an open-source web-based music notation rendering API. It is written in TypeScript, and runs right in the browser. VexFlow supports HTML
18
- Canvas and SVG, and runs on all modern browsers.
10
+ ## Version 3 → 4
19
11
 
20
- Go try out [The VexFlow Tutorial](https://github.com/0xfe/vexflow/wiki/Tutorial) to learn how to use VexFlow.
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)
21
13
 
22
14
  ## Quick Start
23
15
 
24
- ### Using npm
16
+ The quickest way to add VexFlow to an HTML page is via a `<script>` tag.
25
17
 
26
- To install version 4.0.0-beta:
27
-
28
- ```shell
29
- $ npm install vexflow@beta
18
+ ```html
19
+ <script src="https://cdn.jsdelivr.net/npm/vexflow/build/cjs/vexflow.js"></script>
20
+ <script>
21
+ // YOUR CODE GOES HERE
22
+ </script>
30
23
  ```
31
24
 
32
- To install version 3.0.9:
25
+ The URL above will work once VexFlow 4 is released. For now, insert `@beta` into the URL:
33
26
 
34
- ```shell
35
- $ npm install vexflow
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>
36
33
  ```
37
34
 
38
- ### Using the HTML `script` Tag
39
-
40
- Releases are served via CDN:
35
+ If your project uses a bundler, you can install VexFlow from npm:
41
36
 
42
- **unpkg**
37
+ ```sh
38
+ npm install vexflow
39
+ ```
43
40
 
44
- - Minified: https://unpkg.com/vexflow@4.0.0/build/vexflow.js
45
- - Debug: https://unpkg.com/vexflow@4.0.0/build/vexflow-debug.js
41
+ The command above currently installs the previous version (3.0.9). At the moment, add `@beta` to get VexFlow 4:
46
42
 
47
- **jsdelivr**
43
+ ```sh
44
+ npm install vexflow@beta
45
+ ```
48
46
 
49
- - Minified: https://cdn.jsdelivr.net/npm/vexflow@4.0.0/build/vexflow.js
50
- - Debug: https://cdn.jsdelivr.net/npm/vexflow@4.0.0/build/vexflow-debug.js
47
+ [More details on integrating with VexFlow 4.](https://github.com/0xfe/vexflow/wiki/VexFlow-4-Tutorial)
51
48
 
52
- ### Using EasyScore
49
+ ## EasyScore
53
50
 
54
- The EasyScore API is a quick way to create simple music notation in VexFlow. See a running example in [this jsfiddle](https://jsfiddle.net/2pbh9xq0/).
51
+ EasyScore is VexFlow's high-level API for creating music notation.
52
+ [See a running example here.](https://jsfiddle.net/2pbh9xq0/)
55
53
 
56
54
  ```javascript
57
- import Vex from 'vexflow';
58
-
59
- const vf = new Vex.Flow.Factory({
55
+ const f = new Vex.Flow.Factory({
60
56
  renderer: { elementId: 'boo', width: 500, height: 200 },
61
57
  });
62
58
 
63
- const score = vf.EasyScore();
64
- const system = vf.System();
59
+ const score = f.EasyScore();
60
+ const system = f.System();
65
61
 
66
62
  system
67
63
  .addStave({
@@ -73,22 +69,21 @@ system
73
69
  .addClef('treble')
74
70
  .addTimeSignature('4/4');
75
71
 
76
- vf.draw();
72
+ f.draw();
77
73
  ```
78
74
 
79
- Learn the EasyScore API in the [Using EasyScore](https://github.com/0xfe/vexflow/wiki/Using-EasyScore) guide.
75
+ [Learn more about EasyScore here.](https://github.com/0xfe/vexflow/wiki/Using-EasyScore)
80
76
 
81
- ### Using the Native API
77
+ ## Native API
82
78
 
83
- The example code below renders a VexFlow stave using SVG. See a running example in this [jsfiddle](https://jsfiddle.net/j6dpazx2/).
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/)
84
81
 
85
82
  ```javascript
86
- import Vex from 'vexflow';
87
-
88
83
  const VF = Vex.Flow;
89
84
 
90
- // Create an SVG renderer and attach it to the DIV element named "vf".
91
- const div = document.getElementById('vf');
85
+ // Create an SVG renderer and attach it to the DIV element named "output".
86
+ const div = document.getElementById('output');
92
87
  const renderer = new VF.Renderer(div, VF.Renderer.Backends.SVG);
93
88
 
94
89
  // Configure the rendering context.
@@ -106,15 +101,27 @@ stave.addClef('treble').addTimeSignature('4/4');
106
101
  stave.setContext(context).draw();
107
102
  ```
108
103
 
109
- ## Resources
104
+ ## Examples
110
105
 
111
- To learn and contribute, check out the [VexFlow Wiki](https://github.com/0xfe/vexflow/wiki).
106
+ - Take a look at [the VexFlow tutorial](https://github.com/0xfe/vexflow/wiki/Tutorial).
112
107
 
113
- To build VexFlow from scratch, read the [Build Instructions](https://github.com/0xfe/vexflow/wiki/Build-And-Release-Instructions).
108
+ - Dig into [the unit tests](https://github.com/0xfe/vexflow/tree/master/tests).
114
109
 
115
- Sponsor Vexflow: https://github.com/sponsors/0xfe
110
+ ## Need Help?
111
+
112
+ Ask on the [Vexflow Google Group](https://groups.google.com/forum/?fromgroups#!forum/vexflow).
113
+
114
+ ## More Resources
115
+
116
+ - Learn and contribute. Check out the [VexFlow Wiki](https://github.com/0xfe/vexflow/wiki).
117
+
118
+ - Build VexFlow from scratch. Read the [Build Instructions](https://github.com/0xfe/vexflow/wiki/Build%2C-Test%2C-Release).
116
119
 
117
- ## MIT License
120
+ - [VexFlow Home](https://vexflow.com)
121
+
122
+ - VexFlow Founder: [Mohit Muthanna Cheppudira](https://muthanna.com)
123
+
124
+ # MIT License
118
125
 
119
126
  Copyright (c) Mohit Muthanna Cheppudira 2010 <br/>
120
127
  0xFE <mohit@muthanna.com> https://www.vexflow.com
@@ -136,8 +143,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
136
143
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
137
144
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
138
145
  THE SOFTWARE.
139
-
140
- ## Links
141
-
142
- - [VexFlow Home](https://vexflow.com)
143
- - [Me](https://muthanna.com)