vexflow 4.0.1-beta.1 → 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.
Files changed (353) hide show
  1. package/README.md +48 -65
  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 +724 -697
  7. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  8. package/build/cjs/vexflow-debug.js +550 -610
  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 +10 -0
  19. package/build/esm/entry/vexflow-core.js +53 -0
  20. package/build/esm/entry/vexflow-debug-with-tests.js +11 -0
  21. package/build/esm/entry/vexflow-debug.js +8 -0
  22. package/build/esm/entry/vexflow-font-bravura.js +7 -0
  23. package/build/esm/entry/vexflow-font-custom.js +7 -0
  24. package/build/esm/entry/vexflow-font-gonville.js +7 -0
  25. package/build/esm/entry/vexflow-font-petaluma.js +7 -0
  26. package/build/esm/entry/vexflow-gonville.js +10 -0
  27. package/build/esm/entry/vexflow-petaluma.js +10 -0
  28. package/build/esm/entry/vexflow.js +8 -0
  29. package/build/esm/src/accidental.js +348 -0
  30. package/build/esm/src/annotation.js +238 -0
  31. package/build/esm/src/articulation.js +267 -0
  32. package/build/esm/src/barnote.js +58 -0
  33. package/build/esm/src/beam.js +644 -0
  34. package/build/esm/src/bend.js +202 -0
  35. package/build/esm/src/boundingbox.js +59 -0
  36. package/build/esm/src/boundingboxcomputation.js +107 -0
  37. package/build/esm/src/canvascontext.js +202 -0
  38. package/build/esm/src/chordsymbol.js +578 -0
  39. package/build/esm/src/clef.js +153 -0
  40. package/build/esm/src/clefnote.js +65 -0
  41. package/build/esm/src/crescendo.js +77 -0
  42. package/build/esm/src/curve.js +118 -0
  43. package/build/esm/src/dot.js +137 -0
  44. package/build/esm/src/easyscore.js +374 -0
  45. package/build/esm/src/element.js +216 -0
  46. package/build/esm/src/factory.js +445 -0
  47. package/build/esm/src/flow.js +288 -0
  48. package/build/esm/src/font.js +262 -0
  49. package/build/esm/src/fonts/bravura_glyphs.js +3239 -0
  50. package/build/esm/src/fonts/bravura_metrics.js +507 -0
  51. package/build/esm/src/fonts/custom_glyphs.js +78 -0
  52. package/build/esm/src/fonts/custom_metrics.js +5 -0
  53. package/build/esm/src/fonts/gonville_glyphs.js +828 -0
  54. package/build/esm/src/fonts/gonville_metrics.js +421 -0
  55. package/build/esm/src/fonts/load_all.js +10 -0
  56. package/build/esm/src/fonts/load_bravura.js +6 -0
  57. package/build/esm/src/fonts/load_custom.js +6 -0
  58. package/build/esm/src/fonts/load_gonville.js +6 -0
  59. package/build/esm/src/fonts/load_petaluma.js +6 -0
  60. package/build/esm/src/fonts/petaluma_glyphs.js +1335 -0
  61. package/build/esm/src/fonts/petaluma_metrics.js +536 -0
  62. package/build/esm/src/fonts/petalumascript_glyphs.js +863 -0
  63. package/build/esm/src/fonts/robotoslab_glyphs.js +863 -0
  64. package/build/esm/src/fonts/textfonts.js +44 -0
  65. package/build/esm/src/formatter.js +585 -0
  66. package/build/esm/src/fraction.js +171 -0
  67. package/build/esm/src/frethandfinger.js +156 -0
  68. package/build/esm/src/ghostnote.js +50 -0
  69. package/build/esm/src/glyph.js +337 -0
  70. package/build/esm/src/glyphnote.js +55 -0
  71. package/build/esm/src/gracenote.js +133 -0
  72. package/build/esm/src/gracenotegroup.js +128 -0
  73. package/build/esm/src/gracetabnote.js +12 -0
  74. package/build/esm/src/index.js +89 -0
  75. package/build/esm/src/keymanager.js +99 -0
  76. package/build/esm/src/keysignature.js +250 -0
  77. package/build/esm/src/keysignote.js +28 -0
  78. package/build/esm/src/modifier.js +128 -0
  79. package/build/esm/src/modifiercontext.js +110 -0
  80. package/build/esm/src/multimeasurerest.js +173 -0
  81. package/build/esm/src/music.js +322 -0
  82. package/build/esm/src/note.js +371 -0
  83. package/build/esm/src/notehead.js +169 -0
  84. package/build/esm/src/notesubgroup.js +59 -0
  85. package/build/esm/src/ornament.js +206 -0
  86. package/build/esm/src/parenthesis.js +76 -0
  87. package/build/esm/src/parser.js +164 -0
  88. package/build/esm/src/pedalmarking.js +192 -0
  89. package/build/esm/src/registry.js +81 -0
  90. package/build/esm/src/rendercontext.js +24 -0
  91. package/build/esm/src/renderer.js +112 -0
  92. package/build/esm/src/repeatnote.js +22 -0
  93. package/build/esm/src/stave.js +547 -0
  94. package/build/esm/src/stavebarline.js +182 -0
  95. package/build/esm/src/staveconnector.js +196 -0
  96. package/build/esm/src/stavehairpin.js +120 -0
  97. package/build/esm/src/staveline.js +215 -0
  98. package/build/esm/src/stavemodifier.js +77 -0
  99. package/build/esm/src/stavenote.js +860 -0
  100. package/build/esm/src/staverepetition.js +155 -0
  101. package/build/esm/src/stavesection.js +58 -0
  102. package/build/esm/src/stavetempo.js +91 -0
  103. package/build/esm/src/stavetext.js +82 -0
  104. package/build/esm/src/stavetie.js +141 -0
  105. package/build/esm/src/stavevolta.js +67 -0
  106. package/build/esm/src/stem.js +131 -0
  107. package/build/esm/src/stemmablenote.js +193 -0
  108. package/build/esm/src/stringnumber.js +231 -0
  109. package/build/esm/src/strokes.js +200 -0
  110. package/build/esm/src/svgcontext.js +414 -0
  111. package/build/esm/src/system.js +109 -0
  112. package/build/esm/src/tables.js +1102 -0
  113. package/build/esm/src/tabnote.js +299 -0
  114. package/build/esm/src/tabslide.js +76 -0
  115. package/build/esm/src/tabstave.js +17 -0
  116. package/build/esm/src/tabtie.js +19 -0
  117. package/build/esm/src/textbracket.js +144 -0
  118. package/build/esm/src/textdynamics.js +81 -0
  119. package/build/esm/src/textformatter.js +177 -0
  120. package/build/esm/src/textnote.js +174 -0
  121. package/build/esm/src/tickable.js +214 -0
  122. package/build/esm/src/tickcontext.js +170 -0
  123. package/build/esm/src/timesigglyph.js +85 -0
  124. package/build/esm/src/timesignature.js +89 -0
  125. package/build/esm/src/timesignote.js +32 -0
  126. package/build/esm/src/tremolo.js +47 -0
  127. package/build/esm/src/tuning.js +54 -0
  128. package/build/esm/src/tuplet.js +240 -0
  129. package/build/esm/src/typeguard.js +30 -0
  130. package/build/esm/src/util.js +58 -0
  131. package/build/esm/src/version.js +3 -3
  132. package/build/esm/src/vex.js +51 -0
  133. package/build/esm/src/vibrato.js +100 -0
  134. package/build/esm/src/vibratobracket.js +50 -0
  135. package/build/esm/src/voice.js +187 -0
  136. package/build/esm/src/web.js +15 -0
  137. package/build/esm/tests/accidental_tests.js +974 -0
  138. package/build/esm/tests/annotation_tests.js +390 -0
  139. package/build/esm/tests/articulation_tests.js +365 -0
  140. package/build/esm/tests/auto_beam_formatting_tests.js +548 -0
  141. package/build/esm/tests/bach_tests.js +335 -0
  142. package/build/esm/tests/barline_tests.js +52 -0
  143. package/build/esm/tests/beam_tests.js +614 -0
  144. package/build/esm/tests/bend_tests.js +215 -0
  145. package/build/esm/tests/boundingbox_tests.js +53 -0
  146. package/build/esm/tests/boundingboxcomputation_tests.js +183 -0
  147. package/build/esm/tests/chordsymbol_tests.js +320 -0
  148. package/build/esm/tests/clef_tests.js +131 -0
  149. package/build/esm/tests/curve_tests.js +118 -0
  150. package/build/esm/tests/dot_tests.js +123 -0
  151. package/build/esm/tests/easyscore_tests.js +462 -0
  152. package/build/esm/tests/factory_tests.js +44 -0
  153. package/build/esm/tests/font_tests.js +135 -0
  154. package/build/esm/tests/formatter/framestack.js +61 -0
  155. package/build/esm/tests/formatter/tests.js +203 -0
  156. package/build/esm/tests/formatter_tests.js +670 -0
  157. package/build/esm/tests/fraction_tests.js +72 -0
  158. package/build/esm/tests/ghostnote_tests.js +77 -0
  159. package/build/esm/tests/glyphnote_tests.js +113 -0
  160. package/build/esm/tests/gracenote_tests.js +413 -0
  161. package/build/esm/tests/gracetabnote_tests.js +79 -0
  162. package/build/esm/tests/index.js +68 -0
  163. package/build/esm/tests/key_clef_tests.js +103 -0
  164. package/build/esm/tests/keymanager_tests.js +68 -0
  165. package/build/esm/tests/keysignature_tests.js +308 -0
  166. package/build/esm/tests/mocks.js +71 -0
  167. package/build/esm/tests/modifier_tests.js +24 -0
  168. package/build/esm/tests/multimeasurerest_tests.js +141 -0
  169. package/build/esm/tests/music_tests.js +161 -0
  170. package/build/esm/tests/notehead_tests.js +137 -0
  171. package/build/esm/tests/notesubgroup_tests.js +149 -0
  172. package/build/esm/tests/offscreencanvas_tests.js +47 -0
  173. package/build/esm/tests/ornament_tests.js +298 -0
  174. package/build/esm/tests/parser_tests.js +122 -0
  175. package/build/esm/tests/pedalmarking_tests.js +64 -0
  176. package/build/esm/tests/percussion_tests.js +180 -0
  177. package/build/esm/tests/registry_tests.js +64 -0
  178. package/build/esm/tests/renderer_tests.js +113 -0
  179. package/build/esm/tests/rests_tests.js +248 -0
  180. package/build/esm/tests/rhythm_tests.js +357 -0
  181. package/build/esm/tests/stave_tests.js +560 -0
  182. package/build/esm/tests/staveconnector_tests.js +402 -0
  183. package/build/esm/tests/stavehairpin_tests.js +90 -0
  184. package/build/esm/tests/staveline_tests.js +122 -0
  185. package/build/esm/tests/stavemodifier_tests.js +51 -0
  186. package/build/esm/tests/stavenote_tests.js +867 -0
  187. package/build/esm/tests/stavetie_tests.js +108 -0
  188. package/build/esm/tests/stringnumber_tests.js +259 -0
  189. package/build/esm/tests/strokes_tests.js +275 -0
  190. package/build/esm/tests/style_tests.js +98 -0
  191. package/build/esm/tests/support/qunit.js +2765 -0
  192. package/build/esm/tests/tabnote_tests.js +474 -0
  193. package/build/esm/tests/tabslide_tests.js +135 -0
  194. package/build/esm/tests/tabstave_tests.js +23 -0
  195. package/build/esm/tests/tabtie_tests.js +173 -0
  196. package/build/esm/tests/textbracket_tests.js +100 -0
  197. package/build/esm/tests/textformatter_tests.js +24 -0
  198. package/build/esm/tests/textnote_tests.js +215 -0
  199. package/build/esm/tests/threevoice_tests.js +132 -0
  200. package/build/esm/tests/tickcontext_tests.js +36 -0
  201. package/build/esm/tests/timesignature_tests.js +134 -0
  202. package/build/esm/tests/tremolo_tests.js +75 -0
  203. package/build/esm/tests/tuning_tests.js +56 -0
  204. package/build/esm/tests/tuplet_tests.js +450 -0
  205. package/build/esm/tests/typeguard_tests.js +82 -0
  206. package/build/esm/tests/vexflow_test_helpers.js +266 -0
  207. package/build/esm/tests/vf_prefix_tests.js +115 -0
  208. package/build/esm/tests/vibrato_tests.js +92 -0
  209. package/build/esm/tests/vibratobracket_tests.js +45 -0
  210. package/build/esm/tests/voice_tests.js +69 -0
  211. package/build/types/entry/vexflow-bravura.d.ts +2 -0
  212. package/build/types/entry/vexflow-core.d.ts +2 -0
  213. package/build/types/entry/vexflow-debug.d.ts +2 -0
  214. package/build/types/entry/vexflow-font-bravura.d.ts +3771 -0
  215. package/build/types/entry/vexflow-font-custom.d.ts +86 -0
  216. package/build/types/entry/vexflow-font-gonville.d.ts +1267 -0
  217. package/build/types/entry/vexflow-font-petaluma.d.ts +1896 -0
  218. package/build/types/entry/vexflow-gonville.d.ts +2 -0
  219. package/build/types/entry/vexflow-petaluma.d.ts +2 -0
  220. package/build/types/entry/vexflow.d.ts +2 -0
  221. package/build/types/src/accidental.d.ts +66 -0
  222. package/build/types/src/annotation.d.ts +61 -0
  223. package/build/types/src/articulation.d.ts +62 -0
  224. package/build/types/src/barnote.d.ts +29 -0
  225. package/build/types/src/beam.d.ts +153 -0
  226. package/build/types/src/bend.d.ts +73 -0
  227. package/build/types/src/boundingbox.d.ts +42 -0
  228. package/build/types/src/boundingboxcomputation.d.ts +33 -0
  229. package/build/types/src/canvascontext.d.ts +89 -0
  230. package/build/types/src/chordsymbol.d.ts +149 -0
  231. package/build/types/src/clef.d.ts +48 -0
  232. package/build/types/src/clefnote.d.ts +25 -0
  233. package/build/types/src/crescendo.d.ts +27 -0
  234. package/build/types/src/curve.d.ts +41 -0
  235. package/build/types/src/dot.d.ts +20 -0
  236. package/build/types/src/easyscore.d.ts +152 -0
  237. package/build/types/src/element.d.ts +202 -0
  238. package/build/types/src/factory.d.ts +274 -0
  239. package/build/types/src/flow.d.ts +260 -0
  240. package/build/types/src/font.d.ts +180 -0
  241. package/build/types/src/fonts/bravura_glyphs.d.ts +3239 -0
  242. package/build/types/src/fonts/bravura_metrics.d.ts +533 -0
  243. package/build/types/src/fonts/custom_glyphs.d.ts +78 -0
  244. package/build/types/src/fonts/custom_metrics.d.ts +5 -0
  245. package/build/types/src/fonts/gonville_glyphs.d.ts +828 -0
  246. package/build/types/src/fonts/gonville_metrics.d.ts +440 -0
  247. package/build/types/src/fonts/load_all.d.ts +1 -0
  248. package/build/types/src/fonts/load_bravura.d.ts +1 -0
  249. package/build/types/src/fonts/load_custom.d.ts +1 -0
  250. package/build/types/src/fonts/load_gonville.d.ts +1 -0
  251. package/build/types/src/fonts/load_petaluma.d.ts +1 -0
  252. package/build/types/src/fonts/petaluma_glyphs.d.ts +1335 -0
  253. package/build/types/src/fonts/petaluma_metrics.d.ts +562 -0
  254. package/build/types/src/fonts/petalumascript_glyphs.d.ts +863 -0
  255. package/build/types/src/fonts/robotoslab_glyphs.d.ts +863 -0
  256. package/build/types/src/fonts/textfonts.d.ts +1 -0
  257. package/build/types/src/formatter.d.ts +203 -0
  258. package/build/types/src/fraction.d.ts +62 -0
  259. package/build/types/src/frethandfinger.d.ts +22 -0
  260. package/build/types/src/ghostnote.d.ts +16 -0
  261. package/build/types/src/glyph.d.ts +141 -0
  262. package/build/types/src/glyphnote.d.ts +17 -0
  263. package/build/types/src/gracenote.d.ts +19 -0
  264. package/build/types/src/gracenotegroup.d.ts +33 -0
  265. package/build/types/src/gracetabnote.d.ts +5 -0
  266. package/build/types/src/index.d.ts +89 -0
  267. package/build/types/src/keymanager.d.ts +25 -0
  268. package/build/types/src/keysignature.d.ts +50 -0
  269. package/build/types/src/keysignote.d.ts +11 -0
  270. package/build/types/src/modifier.d.ts +97 -0
  271. package/build/types/src/modifiercontext.d.ts +45 -0
  272. package/build/types/src/multimeasurerest.d.ts +61 -0
  273. package/build/types/src/music.d.ts +91 -0
  274. package/build/types/src/note.d.ts +232 -0
  275. package/build/types/src/notehead.d.ts +70 -0
  276. package/build/types/src/notesubgroup.d.ts +18 -0
  277. package/build/types/src/ornament.d.ts +76 -0
  278. package/build/types/src/parenthesis.d.ts +22 -0
  279. package/build/types/src/parser.d.ts +45 -0
  280. package/build/types/src/pedalmarking.d.ts +69 -0
  281. package/build/types/src/registry.d.ts +40 -0
  282. package/build/types/src/rendercontext.d.ts +64 -0
  283. package/build/types/src/renderer.d.ts +35 -0
  284. package/build/types/src/repeatnote.d.ts +6 -0
  285. package/build/types/src/stave.d.ts +186 -0
  286. package/build/types/src/stavebarline.d.ts +28 -0
  287. package/build/types/src/staveconnector.d.ts +67 -0
  288. package/build/types/src/stavehairpin.d.ts +56 -0
  289. package/build/types/src/staveline.d.ts +54 -0
  290. package/build/types/src/stavemodifier.d.ts +44 -0
  291. package/build/types/src/stavenote.d.ts +154 -0
  292. package/build/types/src/staverepetition.d.ts +32 -0
  293. package/build/types/src/stavesection.d.ts +15 -0
  294. package/build/types/src/stavetempo.d.ts +25 -0
  295. package/build/types/src/stavetext.d.ts +25 -0
  296. package/build/types/src/stavetie.d.ts +59 -0
  297. package/build/types/src/stavevolta.d.ts +21 -0
  298. package/build/types/src/stem.d.ts +58 -0
  299. package/build/types/src/stemmablenote.d.ts +39 -0
  300. package/build/types/src/stringnumber.d.ts +27 -0
  301. package/build/types/src/strokes.d.ts +33 -0
  302. package/build/types/src/svgcontext.d.ts +131 -0
  303. package/build/types/src/system.d.ts +92 -0
  304. package/build/types/src/tables.d.ts +96 -0
  305. package/build/types/src/tabnote.d.ts +44 -0
  306. package/build/types/src/tabslide.d.ts +34 -0
  307. package/build/types/src/tabstave.d.ts +7 -0
  308. package/build/types/src/tabtie.d.ts +18 -0
  309. package/build/types/src/textbracket.d.ts +55 -0
  310. package/build/types/src/textdynamics.d.ts +39 -0
  311. package/build/types/src/textformatter.d.ts +109 -0
  312. package/build/types/src/textnote.d.ts +49 -0
  313. package/build/types/src/tickable.d.ts +140 -0
  314. package/build/types/src/tickcontext.d.ts +82 -0
  315. package/build/types/src/timesigglyph.d.ts +14 -0
  316. package/build/types/src/timesignature.d.ts +26 -0
  317. package/build/types/src/timesignote.d.ts +11 -0
  318. package/build/types/src/tremolo.d.ts +17 -0
  319. package/build/types/src/tuning.d.ts +23 -0
  320. package/build/types/src/tuplet.d.ts +105 -0
  321. package/build/types/src/typeguard.d.ts +99 -0
  322. package/build/types/src/util.d.ts +27 -0
  323. package/build/types/src/version.d.ts +3 -0
  324. package/build/types/src/vex.d.ts +18 -0
  325. package/build/types/src/vibrato.d.ts +29 -0
  326. package/build/types/src/vibratobracket.d.ts +33 -0
  327. package/build/types/src/voice.d.ts +108 -0
  328. package/build/types/src/web.d.ts +2 -0
  329. package/entry/vexflow-bravura.ts +3 -3
  330. package/entry/vexflow-core.ts +3 -3
  331. package/entry/vexflow-debug-with-tests.ts +16 -2
  332. package/entry/vexflow-debug.ts +11 -3
  333. package/entry/vexflow-gonville.ts +3 -3
  334. package/entry/vexflow-petaluma.ts +3 -3
  335. package/entry/vexflow.ts +3 -3
  336. package/package.json +1 -1
  337. package/src/annotation.ts +38 -6
  338. package/src/articulation.ts +8 -2
  339. package/src/beam.ts +53 -6
  340. package/src/easyscore.ts +11 -1
  341. package/src/factory.ts +16 -2
  342. package/src/flow.ts +35 -20
  343. package/src/font.ts +0 -4
  344. package/src/fonts/gonville_glyphs.ts +4 -4
  345. package/src/formatter.ts +24 -8
  346. package/src/glyph.ts +8 -0
  347. package/src/index.ts +2 -7
  348. package/src/note.ts +2 -1
  349. package/src/staveline.ts +2 -5
  350. package/src/stavenote.ts +13 -9
  351. package/src/stavetext.ts +3 -3
  352. package/src/system.ts +1 -7
  353. package/src/textnote.ts +9 -11
package/src/flow.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Accidental } from './accidental';
2
- import { Annotation } from './annotation';
2
+ import { Annotation, AnnotationHorizontalJustify, AnnotationVerticalJustify } from './annotation';
3
3
  import { Articulation } from './articulation';
4
4
  import { BarNote } from './barnote';
5
5
  import { Beam } from './beam';
@@ -7,16 +7,22 @@ import { Bend } from './bend';
7
7
  import { BoundingBox } from './boundingbox';
8
8
  import { BoundingBoxComputation } from './boundingboxcomputation';
9
9
  import { CanvasContext } from './canvascontext';
10
- import { ChordSymbol } from './chordsymbol';
10
+ import {
11
+ ChordSymbol,
12
+ ChordSymbolHorizontalJustify,
13
+ ChordSymbolVerticalJustify,
14
+ SymbolModifiers,
15
+ SymbolTypes,
16
+ } from './chordsymbol';
11
17
  import { Clef } from './clef';
12
18
  import { ClefNote } from './clefnote';
13
19
  import { Crescendo } from './crescendo';
14
- import { Curve } from './curve';
20
+ import { Curve, CurvePosition } from './curve';
15
21
  import { Dot } from './dot';
16
22
  import { EasyScore } from './easyscore';
17
23
  import { Element } from './element';
18
24
  import { Factory } from './factory';
19
- import { Font, FontModule } from './font';
25
+ import { Font, FontModule, FontStyle, FontWeight } from './font';
20
26
  import { Formatter } from './formatter';
21
27
  import { Fraction } from './fraction';
22
28
  import { FretHandFinger } from './frethandfinger';
@@ -42,20 +48,20 @@ import { Parser } from './parser';
42
48
  import { PedalMarking } from './pedalmarking';
43
49
  import { Registry } from './registry';
44
50
  import { RenderContext } from './rendercontext';
45
- import { Renderer } from './renderer';
51
+ import { Renderer, RendererBackends, RendererLineEndType } from './renderer';
46
52
  import { RepeatNote } from './repeatnote';
47
53
  import { Stave } from './stave';
48
54
  import { Barline, BarlineType } from './stavebarline';
49
55
  import { StaveConnector } from './staveconnector';
50
56
  import { StaveHairpin } from './stavehairpin';
51
57
  import { StaveLine } from './staveline';
52
- import { StaveModifier } from './stavemodifier';
58
+ import { StaveModifier, StaveModifierPosition } from './stavemodifier';
53
59
  import { StaveNote } from './stavenote';
54
60
  import { Repetition } from './staverepetition';
55
61
  import { StaveTempo } from './stavetempo';
56
62
  import { StaveText } from './stavetext';
57
63
  import { StaveTie } from './stavetie';
58
- import { Volta } from './stavevolta';
64
+ import { Volta, VoltaType } from './stavevolta';
59
65
  import { Stem } from './stem';
60
66
  import { StringNumber } from './stringnumber';
61
67
  import { Stroke } from './strokes';
@@ -66,10 +72,10 @@ import { TabNote } from './tabnote';
66
72
  import { TabSlide } from './tabslide';
67
73
  import { TabStave } from './tabstave';
68
74
  import { TabTie } from './tabtie';
69
- import { TextBracket } from './textbracket';
75
+ import { TextBracket, TextBracketPosition } from './textbracket';
70
76
  import { TextDynamics } from './textdynamics';
71
77
  import { TextFormatter } from './textformatter';
72
- import { TextNote } from './textnote';
78
+ import { TextJustification, TextNote } from './textnote';
73
79
  import { TickContext } from './tickcontext';
74
80
  import { TimeSignature } from './timesignature';
75
81
  import { TimeSigNote } from './timesignote';
@@ -79,7 +85,7 @@ import { Tuplet } from './tuplet';
79
85
  import { DATE, ID, VERSION } from './version';
80
86
  import { Vibrato } from './vibrato';
81
87
  import { VibratoBracket } from './vibratobracket';
82
- import { Voice } from './voice';
88
+ import { Voice, VoiceMode } from './voice';
83
89
 
84
90
  export class Flow {
85
91
  static get BUILD() {
@@ -112,13 +118,6 @@ export class Flow {
112
118
  static EasyScore = EasyScore;
113
119
  static Element = Element;
114
120
  static Factory = Factory;
115
- static get Flow() {
116
- // This (circular reference) provides a handy shortcut for importing VexFlow via `require()`.
117
- // For example:
118
- // const Vex = require('vexflow');
119
- // const { Flow, Stave, StaveNote, Formatter, Renderer } = Vex.Flow;
120
- return Flow;
121
- }
122
121
  static Font = Font;
123
122
  static Formatter = Formatter;
124
123
  static Fraction = Fraction;
@@ -181,10 +180,26 @@ export class Flow {
181
180
  static Voice = Voice;
182
181
  static Volta = Volta;
183
182
 
184
- // enums need to be exported too!
185
- static BarlineType = BarlineType;
183
+ // Exported Enums.
184
+ // Sorted by the module / file they are exported from.
185
+ static AnnotationHorizontalJustify = AnnotationHorizontalJustify;
186
+ static AnnotationVerticalJustify = AnnotationVerticalJustify;
187
+ static ChordSymbolHorizontalJustify = ChordSymbolHorizontalJustify;
188
+ static ChordSymbolVerticalJustify = ChordSymbolVerticalJustify;
189
+ static SymbolTypes = SymbolTypes;
190
+ static SymbolModifiers = SymbolModifiers;
191
+ static CurvePosition = CurvePosition;
192
+ static FontWeight = FontWeight;
193
+ static FontStyle = FontStyle;
186
194
  static ModifierPosition = ModifierPosition;
187
- // ... more to come ...
195
+ static RendererBackends = RendererBackends;
196
+ static RendererLineEndType = RendererLineEndType;
197
+ static BarlineType = BarlineType;
198
+ static StaveModifierPosition = StaveModifierPosition;
199
+ static VoltaType = VoltaType;
200
+ static TextBracketPosition = TextBracketPosition;
201
+ static TextJustification = TextJustification;
202
+ static VoiceMode = VoiceMode;
188
203
 
189
204
  /**
190
205
  * Examples:
package/src/font.ts CHANGED
@@ -366,10 +366,6 @@ export class Font {
366
366
  }
367
367
  }
368
368
 
369
- static loadTextFonts(): void {
370
- //
371
- }
372
-
373
369
  /**
374
370
  * @param fontName
375
371
  * @param data optionally set the Font object's `.data` property.
@@ -697,10 +697,10 @@ export const GonvilleFont = {
697
697
  o: 'm -413 173 b -408 174 -412 174 -409 174 b -397 173 -404 174 -400 173 b -308 86 -394 172 -374 151 b -223 0 -261 37 -223 0 b -153 84 -223 0 -191 37 b -77 174 -83 173 -84 172 b -72 174 -76 174 -74 174 b -62 173 -68 174 -63 173 b 25 86 -59 172 -39 151 b 112 0 73 37 111 0 b 181 84 112 0 144 37 b 257 174 251 173 251 172 b 262 174 258 174 261 174 b 273 173 266 174 270 173 b 436 9 276 172 347 101 l 447 -1 l 477 36 b 522 79 511 79 513 79 l 522 79 b 552 51 533 79 539 73 b 596 -112 582 6 596 -51 b 567 -262 596 -161 586 -213 b 539 -322 558 -287 544 -316 b 524 -327 534 -326 529 -327 b 504 -315 515 -327 507 -323 b 503 -308 503 -312 503 -309 b 511 -285 503 -302 504 -297 b 555 -113 540 -227 555 -169 b 544 -34 555 -86 551 -59 b 522 19 540 -16 530 8 l 521 22 l 481 -26 l 405 -122 b 353 -176 366 -172 362 -176 b 349 -176 352 -176 351 -176 b 253 -87 341 -176 347 -180 b 167 0 206 -38 167 0 b 99 -86 167 0 136 -38 b 21 -174 27 -174 28 -173 b 17 -176 20 -176 19 -176 b 6 -174 13 -176 9 -174 b -81 -87 4 -173 -14 -152 b -167 0 -129 -38 -167 0 b -236 -86 -167 0 -198 -38 b -313 -174 -307 -174 -306 -173 b -318 -176 -314 -176 -315 -176 b -328 -174 -321 -176 -325 -174 b -491 -12 -330 -173 -367 -137 l -503 0 l -530 -34 b -570 -77 -562 -73 -564 -76 b -577 -79 -571 -79 -574 -79 b -597 -58 -588 -79 -597 -69 b -596 -49 -597 -55 -597 -52 b -417 172 -593 -43 -423 167 b -413 173 -417 172 -415 173 ',
698
698
  },
699
699
  stringsDownBow: {
700
- x_min: -149.71875,
701
- x_max: 148.359375,
702
- ha: 151,
703
- o: 'm -9 215 b 0 217 -6 217 -4 217 b 19 205 8 217 14 213 b 20 142 20 202 20 201 l 20 84 l 23 84 b 144 -27 81 74 129 30 b 148 -66 147 -40 148 -54 b 36 -213 148 -134 103 -197 b 0 -219 24 -217 12 -219 b -145 -104 -68 -219 -129 -173 b -149 -68 -148 -91 -149 -79 b -24 84 -149 6 -98 74 l -21 84 l -21 142 b -19 205 -20 201 -20 202 b -9 215 -17 209 -13 213 m -21 -15 b -23 41 -21 37 -21 41 b -23 41 -23 41 -23 41 b -76 11 -35 40 -62 26 b -108 -65 -98 -11 -108 -38 b -1 -176 -108 -122 -65 -176 b 107 -65 63 -176 107 -122 b 74 11 107 -38 96 -11 b 20 41 61 26 32 41 b 20 -15 20 41 20 15 b 19 -74 20 -72 20 -72 b 0 -87 14 -83 6 -87 b -19 -74 -8 -87 -16 -83 b -21 -15 -20 -72 -20 -72 ',
700
+ x_min: -228.671875,
701
+ x_max: 227.3125,
702
+ ha: 232,
703
+ o: 'm -217 487 l -213 488 l 0 488 l 212 488 l 216 487 b 225 476 220 484 224 480 l 227 473 l 227 244 l 227 15 l 225 12 b 206 0 223 4 215 0 b 197 1 204 0 200 0 b 187 12 193 4 189 6 l 186 15 l 186 138 l 186 262 l -1 262 l -187 262 l -187 138 l -187 15 l -189 12 b -208 0 -193 4 -200 0 b -227 12 -216 0 -223 4 l -228 15 l -228 244 l -228 473 l -227 476 b -217 487 -225 480 -221 484 ',
704
704
  },
705
705
  stringsUpBow: {
706
706
  x_min: -149.71875,
package/src/formatter.ts CHANGED
@@ -771,12 +771,13 @@ export class Formatter {
771
771
  const musicFont = Tables.currentMusicFont();
772
772
  const configMinPadding = musicFont.lookupMetric('stave.endPaddingMin');
773
773
  const configMaxPadding = musicFont.lookupMetric('stave.endPaddingMax');
774
+ const leftPadding = musicFont.lookupMetric('stave.padding');
774
775
  let targetWidth = adjustedJustifyWidth;
775
776
  const distances = calculateIdealDistances(targetWidth);
776
777
  let actualWidth = shiftToIdealDistances(distances);
777
- // Calculate right justification by finding max of (configured value, min distance between tickables)
778
- // so measures with lots of white space use it evenly, and crowded measures use at least the configured
779
- // space.
778
+
779
+ // Just one context. Done formatting.
780
+ if (contextList.length === 1) return 0;
780
781
  const calcMinDistance = (targetWidth: number, distances: Distance[]) => {
781
782
  let mdCalc = targetWidth / 2;
782
783
  if (distances.length > 1) {
@@ -788,14 +789,27 @@ export class Formatter {
788
789
  };
789
790
  const minDistance = calcMinDistance(targetWidth, distances);
790
791
 
791
- // Just one context. Done formatting.
792
- if (contextList.length === 1) return 0;
793
-
794
792
  // right justify to either the configured padding, or the min distance between notes, whichever is greatest.
795
793
  // This * 2 keeps the existing formatting unless there is 'a lot' of extra whitespace, which won't break
796
794
  // existing visual regression tests.
797
- const paddingMax = configMaxPadding * 2 < minDistance ? minDistance : configMaxPadding;
798
- const paddingMin = paddingMax - (configMaxPadding - configMinPadding);
795
+ const paddingMaxCalc = (curTargetWidth: number) => {
796
+ let lastTickablePadding = 0;
797
+ const lastTickable = lastContext && lastContext.getMaxTickable();
798
+ if (lastTickable) {
799
+ const voice = lastTickable.getVoice();
800
+ // If the number of actual ticks in the measure <> configured ticks, right-justify
801
+ // because the softmax won't yield the correct value
802
+ if (voice.getTicksUsed().value() > voice.getTotalTicks().value()) {
803
+ return configMaxPadding * 2 < minDistance ? minDistance : configMaxPadding;
804
+ }
805
+ const tickWidth = lastTickable.getWidth();
806
+ lastTickablePadding =
807
+ voice.softmax(lastContext.getMaxTicks().value()) * curTargetWidth - (tickWidth + leftPadding);
808
+ }
809
+ return configMaxPadding * 2 < lastTickablePadding ? lastTickablePadding : configMaxPadding;
810
+ };
811
+ let paddingMax = paddingMaxCalc(targetWidth);
812
+ let paddingMin = paddingMax - (configMaxPadding - configMinPadding);
799
813
  const maxX = adjustedJustifyWidth - paddingMin;
800
814
 
801
815
  let iterations = maxIterations;
@@ -803,6 +817,8 @@ export class Formatter {
803
817
  // without going over
804
818
  while ((actualWidth > maxX && iterations > 0) || (actualWidth + paddingMax < maxX && iterations > 1)) {
805
819
  targetWidth -= actualWidth - maxX;
820
+ paddingMax = paddingMaxCalc(targetWidth);
821
+ paddingMin = paddingMax - (configMaxPadding - configMinPadding);
806
822
  actualWidth = shiftToIdealDistances(calculateIdealDistances(targetWidth));
807
823
  iterations--;
808
824
  }
package/src/glyph.ts CHANGED
@@ -427,11 +427,19 @@ export class Glyph extends Element {
427
427
  return this;
428
428
  }
429
429
 
430
+ getXShift(): number {
431
+ return this.x_shift;
432
+ }
433
+
430
434
  setXShift(x_shift: number): this {
431
435
  this.x_shift = x_shift;
432
436
  return this;
433
437
  }
434
438
 
439
+ getYshift(): number {
440
+ return this.y_shift;
441
+ }
442
+
435
443
  setYShift(y_shift: number): this {
436
444
  this.y_shift = y_shift;
437
445
  return this;
package/src/index.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  // [VexFlow](https://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
2
2
  // MIT License
3
3
 
4
- import { Vex } from './vex';
5
-
6
4
  export * from './accidental';
7
5
  export * from './annotation';
8
6
  export * from './articulation';
@@ -89,12 +87,9 @@ export * from './tuning';
89
87
  export * from './tuplet';
90
88
  export * from './typeguard';
91
89
  export * from './util';
92
- // Do not export './version'. It is accessible via Vex.Flow.VERSION & Vex.Flow.BUILD.
90
+ // Do not export './version'. It is accessible via Vex.Flow.BUILD.
91
+ export * from './vex';
93
92
  export * from './vibrato';
94
93
  export * from './vibratobracket';
95
94
  export * from './voice';
96
95
  export * from './web';
97
-
98
- // Export Vex as a named export AND as a default export, to support both ways of importing.
99
- export { Vex };
100
- export default Vex;
package/src/note.ts CHANGED
@@ -224,6 +224,7 @@ export abstract class Note extends Tickable {
224
224
  protected stave?: Stave;
225
225
  public render_options: {
226
226
  draw_stem_through_stave?: boolean;
227
+ draw?: boolean;
227
228
  draw_dots?: boolean;
228
229
  draw_stem?: boolean;
229
230
  y_shift: number;
@@ -575,7 +576,7 @@ export abstract class Note extends Tickable {
575
576
 
576
577
  getLeftParenthesisPx(index: number): number {
577
578
  const props = this.getKeyProps()[index];
578
- return props.displaced ? this.getLeftDisplacedHeadPx() : 0;
579
+ return props.displaced ? this.getLeftDisplacedHeadPx() - this.x_shift : -this.x_shift;
579
580
  }
580
581
 
581
582
  getFirstDotPx(): number {
package/src/staveline.ts CHANGED
@@ -13,6 +13,7 @@ import { FontInfo } from './font';
13
13
  import { RenderContext } from './rendercontext';
14
14
  import { StaveNote } from './stavenote';
15
15
  import { Tables } from './tables';
16
+ import { TextJustification } from './textnote';
16
17
  import { Category } from './typeguard';
17
18
  import { RuntimeError } from './util';
18
19
 
@@ -62,11 +63,7 @@ export class StaveLine extends Element {
62
63
  BOTTOM: 2,
63
64
  };
64
65
 
65
- static readonly TextJustification = {
66
- LEFT: 1,
67
- CENTER: 2,
68
- RIGHT: 3,
69
- };
66
+ static readonly TextJustification = TextJustification;
70
67
 
71
68
  public render_options: {
72
69
  padding_left: number;
package/src/stavenote.ts CHANGED
@@ -184,7 +184,9 @@ export class StaveNote extends StemmableNote {
184
184
  if (voices === 2) {
185
185
  const lineSpacing =
186
186
  noteU.note.hasStem() && noteL.note.hasStem() && noteU.stemDirection === noteL.stemDirection ? 0.0 : 0.5;
187
- if (noteU.minLine <= noteL.maxLine + lineSpacing) {
187
+ if (noteL.isrest && noteU.isrest && noteU.note.duration === noteL.note.duration) {
188
+ noteL.note.render_options.draw = false;
189
+ } else if (noteU.minLine <= noteL.maxLine + lineSpacing) {
188
190
  if (noteU.isrest) {
189
191
  // shift rest up
190
192
  shiftRestVertical(noteU, noteL, 1);
@@ -299,10 +301,10 @@ export class StaveNote extends StemmableNote {
299
301
 
300
302
  // Special case 2 :: all voices are rests
301
303
  if (noteU.isrest && noteM.isrest && noteL.isrest) {
302
- // Shift upper voice rest up
303
- shiftRestVertical(noteU, noteM, 1);
304
- // Shift lower voice rest down
305
- shiftRestVertical(noteL, noteM, -1);
304
+ // Hide upper voice rest
305
+ noteU.note.render_options.draw = false;
306
+ // Hide lower voice rest
307
+ noteL.note.render_options.draw = false;
306
308
  // format complete
307
309
  state.right_shift += xShift;
308
310
  return true;
@@ -310,12 +312,12 @@ export class StaveNote extends StemmableNote {
310
312
 
311
313
  // Test if any other rests can be repositioned
312
314
  if (noteM.isrest && noteU.isrest && noteM.minLine <= noteL.maxLine) {
313
- // Shift middle voice rest up
314
- shiftRestVertical(noteM, noteL, 1);
315
+ // Hide middle voice rest
316
+ noteM.note.render_options.draw = false;
315
317
  }
316
318
  if (noteM.isrest && noteL.isrest && noteU.minLine <= noteM.maxLine) {
317
- // Shift middle voice rest down
318
- shiftRestVertical(noteM, noteU, -1);
319
+ // Hide middle voice rest
320
+ noteM.note.render_options.draw = false;
319
321
  }
320
322
  if (noteU.isrest && noteU.minLine <= noteM.maxLine) {
321
323
  // shift upper voice rest up;
@@ -1206,6 +1208,8 @@ export class StaveNote extends StemmableNote {
1206
1208
 
1207
1209
  // Draws all the `StaveNote` parts. This is the main drawing method.
1208
1210
  draw(): void {
1211
+ if (this.render_options.draw === false) return;
1212
+
1209
1213
  if (this.ys.length === 0) {
1210
1214
  throw new RuntimeError('NoYValues', "Can't draw note without Y values.");
1211
1215
  }
package/src/stavetext.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  import { Font, FontInfo, FontStyle, FontWeight } from './font';
5
5
  import { Stave } from './stave';
6
6
  import { StaveModifier, StaveModifierPosition } from './stavemodifier';
7
- import { Justification, TextNote } from './textnote';
7
+ import { TextJustification, TextNote } from './textnote';
8
8
  import { Category } from './typeguard';
9
9
  import { RuntimeError } from './util';
10
10
 
@@ -94,9 +94,9 @@ export class StaveText extends StaveModifier {
94
94
  case StaveModifierPosition.ABOVE:
95
95
  case StaveModifierPosition.BELOW:
96
96
  x = stave.getX() + this.options.shift_x;
97
- if (this.options.justification === Justification.CENTER) {
97
+ if (this.options.justification === TextJustification.CENTER) {
98
98
  x += stave.getWidth() / 2 - text_width / 2;
99
- } else if (this.options.justification === Justification.RIGHT) {
99
+ } else if (this.options.justification === TextJustification.RIGHT) {
100
100
  x += stave.getWidth() - text_width;
101
101
  }
102
102
 
package/src/system.ts CHANGED
@@ -191,13 +191,7 @@ export class System extends Element {
191
191
  this.parts.forEach((part) => {
192
192
  y = y + part.stave.space(part.spaceAbove);
193
193
  part.stave.setY(y);
194
- if (this.options.autoWidth) {
195
- part.voices.forEach((voice) => {
196
- formatter.joinVoices([voice]);
197
- });
198
- } else {
199
- formatter.joinVoices(part.voices);
200
- }
194
+ formatter.joinVoices(part.voices);
201
195
  y = y + part.stave.space(part.spaceBelow);
202
196
  y = y + part.stave.space(this.options.spaceBetweenStaves);
203
197
  if (part.debugNoteMetrics) {
package/src/textnote.ts CHANGED
@@ -7,7 +7,7 @@ import { Note, NoteStruct } from './note';
7
7
  import { Category } from './typeguard';
8
8
  import { RuntimeError } from './util';
9
9
 
10
- export enum Justification {
10
+ export enum TextJustification {
11
11
  LEFT = 1,
12
12
  CENTER = 2,
13
13
  RIGHT = 3,
@@ -41,9 +41,7 @@ export class TextNote extends Note {
41
41
  style: FontStyle.NORMAL,
42
42
  };
43
43
 
44
- static get Justification(): typeof Justification {
45
- return Justification;
46
- }
44
+ static readonly Justification = TextJustification;
47
45
 
48
46
  /** Glyph data. */
49
47
  static get GLYPHS(): Record<string, { code: string }> {
@@ -112,7 +110,7 @@ export class TextNote extends Note {
112
110
  protected superscript?: string;
113
111
  protected subscript?: string;
114
112
  protected smooth: boolean;
115
- protected justification: Justification;
113
+ protected justification: TextJustification;
116
114
  protected line: number;
117
115
 
118
116
  constructor(noteStruct: TextNoteStruct) {
@@ -125,7 +123,7 @@ export class TextNote extends Note {
125
123
  this.line = noteStruct.line || 0;
126
124
  this.smooth = noteStruct.smooth || false;
127
125
  this.ignore_ticks = noteStruct.ignore_ticks || false;
128
- this.justification = Justification.LEFT;
126
+ this.justification = TextJustification.LEFT;
129
127
 
130
128
  // Determine and set initial note width. Note that the text width is
131
129
  // an approximation and isn't very accurate. The only way to accurately
@@ -142,7 +140,7 @@ export class TextNote extends Note {
142
140
  }
143
141
 
144
142
  /** Set the horizontal justification of the TextNote. */
145
- setJustification(just: Justification): this {
143
+ setJustification(just: TextJustification): this {
146
144
  this.justification = just;
147
145
  return this;
148
146
  }
@@ -170,9 +168,9 @@ export class TextNote extends Note {
170
168
  }
171
169
  }
172
170
 
173
- if (this.justification === Justification.CENTER) {
171
+ if (this.justification === TextJustification.CENTER) {
174
172
  this.leftDisplacedHeadPx = this.width / 2;
175
- } else if (this.justification === Justification.RIGHT) {
173
+ } else if (this.justification === TextJustification.RIGHT) {
176
174
  this.leftDisplacedHeadPx = this.width;
177
175
  }
178
176
 
@@ -198,9 +196,9 @@ export class TextNote extends Note {
198
196
  // Align based on tick-context width.
199
197
  const width = this.getWidth();
200
198
 
201
- if (this.justification === Justification.CENTER) {
199
+ if (this.justification === TextJustification.CENTER) {
202
200
  x -= width / 2;
203
- } else if (this.justification === Justification.RIGHT) {
201
+ } else if (this.justification === TextJustification.RIGHT) {
204
202
  x -= width;
205
203
  }
206
204