vexflow 5.0.0 → 5.1.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 (127) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +32 -50
  3. package/build/cjs/vexflow-bravura.js +2 -2
  4. package/build/cjs/vexflow-bravura.js.map +1 -1
  5. package/build/cjs/vexflow-core.js +2 -2
  6. package/build/cjs/vexflow-core.js.map +1 -1
  7. package/build/cjs/vexflow-debug-with-tests.js +3685 -1386
  8. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  9. package/build/cjs/vexflow-debug.js +2443 -980
  10. package/build/cjs/vexflow-debug.js.map +1 -1
  11. package/build/cjs/vexflow.js +2 -2
  12. package/build/cjs/vexflow.js.map +1 -1
  13. package/build/esm/src/accidental.js +1 -0
  14. package/build/esm/src/annotation.js +31 -8
  15. package/build/esm/src/beam.js +4 -2
  16. package/build/esm/src/chordsymbol.js +3 -1
  17. package/build/esm/src/clef.js +3 -1
  18. package/build/esm/src/curve.js +68 -11
  19. package/build/esm/src/easyscore.js +40 -1
  20. package/build/esm/src/element.js +42 -9
  21. package/build/esm/src/factory.js +46 -9
  22. package/build/esm/src/flag.js +3 -1
  23. package/build/esm/src/font.js +17 -0
  24. package/build/esm/src/formatter.js +34 -36
  25. package/build/esm/src/fraction.js +4 -1
  26. package/build/esm/src/glyphnote.js +3 -1
  27. package/build/esm/src/gracenotegroup.js +18 -1
  28. package/build/esm/src/index.js +2 -0
  29. package/build/esm/src/keysignature.js +3 -1
  30. package/build/esm/src/metrics.js +55 -1
  31. package/build/esm/src/modifiercontext.js +15 -1
  32. package/build/esm/src/note.js +2 -2
  33. package/build/esm/src/notehead.js +3 -1
  34. package/build/esm/src/ornament.js +3 -1
  35. package/build/esm/src/pedalmarking.js +44 -5
  36. package/build/esm/src/registry.js +16 -6
  37. package/build/esm/src/rendercontext.js +10 -0
  38. package/build/esm/src/sheet.js +117 -0
  39. package/build/esm/src/stave.js +13 -8
  40. package/build/esm/src/stavebarline.js +53 -1
  41. package/build/esm/src/staveline.js +2 -0
  42. package/build/esm/src/stavenote.js +54 -19
  43. package/build/esm/src/stavetie.js +3 -1
  44. package/build/esm/src/stem.js +2 -1
  45. package/build/esm/src/stemmablenote.js +9 -0
  46. package/build/esm/src/stringnumber.js +0 -1
  47. package/build/esm/src/strokes.js +10 -0
  48. package/build/esm/src/svgcontext.js +14 -4
  49. package/build/esm/src/svgexport.js +68 -0
  50. package/build/esm/src/system.js +14 -0
  51. package/build/esm/src/tables.js +69 -37
  52. package/build/esm/src/tabnote.js +20 -1
  53. package/build/esm/src/textbracket.js +5 -4
  54. package/build/esm/src/textdynamics.js +5 -0
  55. package/build/esm/src/textnote.js +3 -3
  56. package/build/esm/src/tickable.js +56 -22
  57. package/build/esm/src/timesignature.js +30 -9
  58. package/build/esm/src/timesignote.js +3 -1
  59. package/build/esm/src/tuning.js +2 -2
  60. package/build/esm/src/tuplet.js +79 -29
  61. package/build/esm/src/util.js +1 -0
  62. package/build/esm/src/version.js +3 -3
  63. package/build/esm/src/vexflow.js +14 -2
  64. package/build/esm/src/voice.js +44 -8
  65. package/build/esm/tests/accidental_tests.js +52 -0
  66. package/build/esm/tests/annotation_tests.js +38 -0
  67. package/build/esm/tests/articulation_tests.js +34 -0
  68. package/build/esm/tests/beam_tests.js +17 -0
  69. package/build/esm/tests/curve_tests.js +81 -0
  70. package/build/esm/tests/font_tests.js +32 -1
  71. package/build/esm/tests/formatter_tests.js +58 -23
  72. package/build/esm/tests/gracenote_tests.js +58 -0
  73. package/build/esm/tests/gracetabnote_tests.js +40 -0
  74. package/build/esm/tests/keysignature_tests.js +14 -3
  75. package/build/esm/tests/node/package-input-tests.mjs +149 -0
  76. package/build/esm/tests/node/render-metrics-tests.mjs +78 -0
  77. package/build/esm/tests/node/rendering-tests.mjs +75 -0
  78. package/build/esm/tests/node/sheet-tests.mjs +202 -0
  79. package/build/esm/tests/node/svg-export-tests.mjs +182 -0
  80. package/build/esm/tests/pedalmarking_tests.js +25 -0
  81. package/build/esm/tests/rests_tests.js +6 -0
  82. package/build/esm/tests/stave_tests.js +6 -3
  83. package/build/esm/tests/stavenote_tests.js +100 -55
  84. package/build/esm/tests/strokes_tests.js +19 -5
  85. package/build/esm/tests/timesignature_tests.js +19 -0
  86. package/build/esm/tests/tuplet_tests.js +273 -12
  87. package/build/esm/tests/unison_tests.js +13 -13
  88. package/build/esm/tests/voice_tests.js +34 -0
  89. package/build/esm/tools/render-metrics.mjs +49 -0
  90. package/build/esm/tools/score-fixtures.mjs +94 -0
  91. package/build/esm/tools/sheet-fixture.mjs +90 -0
  92. package/build/esm/tools/visual-regression.mjs +106 -0
  93. package/build/types/src/annotation.d.ts +17 -1
  94. package/build/types/src/curve.d.ts +24 -7
  95. package/build/types/src/easyscore.d.ts +8 -0
  96. package/build/types/src/element.d.ts +5 -0
  97. package/build/types/src/factory.d.ts +18 -1
  98. package/build/types/src/font.d.ts +2 -0
  99. package/build/types/src/formatter.d.ts +23 -14
  100. package/build/types/src/gracenotegroup.d.ts +5 -0
  101. package/build/types/src/index.d.ts +2 -0
  102. package/build/types/src/metrics.d.ts +2 -0
  103. package/build/types/src/modifiercontext.d.ts +4 -0
  104. package/build/types/src/pedalmarking.d.ts +4 -1
  105. package/build/types/src/registry.d.ts +2 -0
  106. package/build/types/src/rendercontext.d.ts +12 -0
  107. package/build/types/src/sheet.d.ts +49 -0
  108. package/build/types/src/stave.d.ts +4 -4
  109. package/build/types/src/stavebarline.d.ts +10 -0
  110. package/build/types/src/stavenote.d.ts +11 -0
  111. package/build/types/src/strokes.d.ts +4 -0
  112. package/build/types/src/svgcontext.d.ts +5 -0
  113. package/build/types/src/svgexport.d.ts +22 -0
  114. package/build/types/src/system.d.ts +4 -0
  115. package/build/types/src/tables.d.ts +9 -0
  116. package/build/types/src/tabnote.d.ts +4 -0
  117. package/build/types/src/textbracket.d.ts +1 -1
  118. package/build/types/src/textdynamics.d.ts +3 -0
  119. package/build/types/src/tickable.d.ts +27 -10
  120. package/build/types/src/timesignature.d.ts +4 -0
  121. package/build/types/src/tuplet.d.ts +8 -0
  122. package/build/types/src/util.d.ts +1 -0
  123. package/build/types/src/vexflow.d.ts +8 -1
  124. package/build/types/src/voice.d.ts +6 -0
  125. package/changelog/CHANGELOG.md +94 -0
  126. package/package.json +42 -26
  127. package/tests/flow.html +15 -7
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- VexFlow - A JavaScript library for rendering music notation.
1
+ The MIT License
2
2
 
3
- Copyright (c) 2023-present VexFlow contributors (see AUTHORS.md).
3
+ Copyright (c) 2023-2026 VexFlow contributors (see AUTHORS.md)
4
4
  Copyright (c) 2010-2022 Mohit Muthanna Cheppudira
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
19
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
20
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
22
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,43 +1,22 @@
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 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).
4
-
5
- The guide below refers to VexFlow 5.
3
+ 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
4
 
7
5
  ## Quick Start
8
6
 
9
- The quickest way to add VexFlow to a web page is via a `<script>` tag.
7
+ The simplest way to add VexFlow to a web page is via a `<script>` tag.
8
+
9
+ See this example: [https://jsfiddle.net/ck6erLhm/](https://jsfiddle.net/ck6erLhm/)
10
10
 
11
11
  ```html
12
- <!-- Load Bravura and Academico (see vexflow-fonts for available fonts) -->
13
- <style>
14
- @font-face {
15
- font-family: 'Bravura';
16
- src: url(https://cdn.jsdelivr.net/npm/@vexflow-fonts/bravura/bravura.woff2) format(woff2);
17
- }
18
- @font-face {
19
- font-family: 'Academico';
20
- src: url(https://cdn.jsdelivr.net/npm/@vexflow-fonts/academico/academico.woff2) format(woff2);
21
- }
22
- </style>
23
- <span style="font-family: Academico"></span>
24
- <span style="font-family: Bravura"></span>
25
-
26
- <!-- Div where the scores will be output -->
27
12
  <div id="output"></div>
28
-
29
- <!-- Load library -->
30
- <script src="https://cdn.jsdelivr.net/npm/vexflow@5.0.0-alpha.4/build/cjs/vexflow.js"></script>
31
-
13
+ <script src="https://cdn.jsdelivr.net/npm/vexflow@5.1.0/build/cjs/vexflow.js"></script>
32
14
  <script>
33
- document.fonts.ready.then(() => {
34
- VexFlow.setFonts('Bravura', 'Academico');
35
- // YOUR CODE GOES HERE
36
- });
15
+ // YOUR CODE GOES HERE
37
16
  </script>
38
17
  ```
39
18
 
40
- The URL above includes a version number <code>vexflow@x.y.z</code>. Specifying a particular version is good practice, to prevent rare issues with a future update breaking your deployment. During development &amp; testing, feel free to use the latest release by omitting the version number: https://cdn.jsdelivr.net/npm/vexflow/build/cjs/vexflow.js
19
+ The URL above includes a version number <code>vexflow@x.y.z</code>. Specifying a version prevents a future update from breaking your deployment.
41
20
 
42
21
  If your project uses a bundler, you can install VexFlow from npm:
43
22
 
@@ -45,20 +24,19 @@ If your project uses a bundler, you can install VexFlow from npm:
45
24
  npm install vexflow
46
25
  ```
47
26
 
48
- Read our detailed guide on [integrating with VexFlow.](https://vexflow.github.io/vexflow-examples/tutorial)
27
+ [See our tutorial](https://vexflow.github.io/vexflow-examples/guides/tutorial).
49
28
 
50
- ## Factory (with EasyScore)
29
+ ## Factory and EasyScore
51
30
 
52
- Factory is VexFlow's recommended API for creating music notation. EasyScore is VexFlow's high-level API for creating voices and notes. On a web page containing a `<div id="output"></div>`, the following code displays a score:
31
+ 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:
53
32
 
54
33
  ```javascript
55
- const { Factory } = VexFlow;
56
- const vf = new Factory({
34
+ const factory = new VexFlow.Factory({
57
35
  renderer: { elementId: 'output', width: 500, height: 200 },
58
36
  });
59
37
 
60
- const score = vf.EasyScore();
61
- const system = vf.System();
38
+ const score = factory.EasyScore();
39
+ const system = factory.System();
62
40
 
63
41
  system
64
42
  .addStave({
@@ -70,16 +48,16 @@ system
70
48
  .addClef('treble')
71
49
  .addTimeSignature('4/4');
72
50
 
73
- vf.draw();
51
+ factory.draw();
74
52
  ```
75
53
 
76
- [See it running here.](https://vexflow.github.io/vexflow-examples/getting-started)
54
+ [See it running here.](https://vexflow.github.io/vexflow-examples/guides/getting-started/)
77
55
 
78
56
  [Learn more about EasyScore here.](https://github.com/0xfe/vexflow/wiki/Using-EasyScore)
79
57
 
80
58
  ## Native API
81
59
 
82
- 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://vexflow.github.io/vexflow-examples/getting-started)
60
+ 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/guides/getting-started/)
83
61
 
84
62
  ```javascript
85
63
  const { Renderer, Stave } = VexFlow;
@@ -91,7 +69,6 @@ const renderer = new Renderer(div, Renderer.Backends.SVG);
91
69
  // Configure the rendering context.
92
70
  renderer.resize(500, 500);
93
71
  const context = renderer.getContext();
94
- context.setFont('Arial', 10);
95
72
 
96
73
  // Create a stave of width 400 at position 10, 40.
97
74
  const stave = new Stave(10, 40, 400);
@@ -105,29 +82,34 @@ stave.setContext(context).draw();
105
82
 
106
83
  ## Examples
107
84
 
108
- - Take a look at [the VexFlow Examples](https://vexflow.github.io/vexflow-examples).
85
+ To save SVGs that display without installed fonts, see [portable SVG export](docs/portable-svg.md).
109
86
 
110
- - Dig into [the unit tests](https://github.com/vexflow/vexflow/tree/main/tests).
87
+ A good way to learn the API is to look at our examples & unit tests:
111
88
 
112
- ## More Resources
89
+ - [Examples](https://vexflow.github.io/vexflow-examples)
113
90
 
114
- - If you need help, come join us on the [Vexflow Google Group](https://groups.google.com/forum/?fromgroups#!forum/vexflow).
91
+ - [Unit Tests](https://github.com/vexflow/vexflow/tree/main/tests)
115
92
 
116
- - Learn more on the [VexFlow wiki](https://github.com/0xfe/vexflow/wiki).
93
+ ## More Resources
117
94
 
118
- - Build VexFlow from scratch by following the [build instructions](https://github.com/0xfe/vexflow/wiki/Build%2C-Test%2C-Release).
95
+ - [Text fonts and lyric layout](docs/text-and-lyrics.md), [jsdom rendering](docs/jsdom.md), and [score benchmarks](docs/benchmarks.md).
96
+ - [Score layout](docs/score-layout.md) and [responsive sheets and themes](docs/sheets-and-themes.md).
97
+ - [Rendering tests and visual comparisons](docs/testing.md).
98
+ - [VexFlow Explorer](tools/explorer/README.md): run `npm run explorer` to browse and edit notation.
119
99
 
120
- - [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).
100
+ - If you need help, start a [GitHub discussion](https://github.com/vexflow/vexflow/discussions).
121
101
 
122
- - [Projects Using VexFlow](https://github.com/0xfe/vexflow/wiki/Project-Gallery)
102
+ - Learn more on the [VexFlow wiki](https://github.com/vexflow/vexflow/wiki).
123
103
 
124
- ## Sponsor this Project
104
+ - Build VexFlow from scratch by following the [build instructions](https://github.com/vexflow/vexflow/wiki/Build).
125
105
 
126
- If you find VexFlow useful, please consider sponsoring its development: https://github.com/sponsors/vexflow.
106
+ - [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).
107
+
108
+ - [Projects Using VexFlow](https://github.com/0xfe/vexflow/wiki/Project-Gallery)
127
109
 
128
110
  # MIT License
129
111
 
130
- Copyright (c) 2023-present VexFlow contributors (see AUTHORS.md).
112
+ Copyright (c) 2023-present VexFlow contributors (see AUTHORS.md).<br />
131
113
  Copyright (c) 2010-2022 Mohit Muthanna Cheppudira
132
114
 
133
115
  Permission is hereby granted, free of charge, to any person obtaining a copy