vexflow 4.0.1-beta.1 → 4.0.1-beta.2

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 (331) hide show
  1. package/build/cjs/vexflow-bravura.js +2 -2
  2. package/build/cjs/vexflow-bravura.js.map +1 -1
  3. package/build/cjs/vexflow-core.js +2 -2
  4. package/build/cjs/vexflow-core.js.map +1 -1
  5. package/build/cjs/vexflow-debug-with-tests.js +92 -24
  6. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  7. package/build/cjs/vexflow-debug.js +38 -16
  8. package/build/cjs/vexflow-debug.js.map +1 -1
  9. package/build/cjs/vexflow-font-gonville.js +1 -1
  10. package/build/cjs/vexflow-font-gonville.js.map +1 -1
  11. package/build/cjs/vexflow-gonville.js +2 -2
  12. package/build/cjs/vexflow-gonville.js.map +1 -1
  13. package/build/cjs/vexflow-petaluma.js +2 -2
  14. package/build/cjs/vexflow-petaluma.js.map +1 -1
  15. package/build/cjs/vexflow.js +2 -2
  16. package/build/cjs/vexflow.js.map +1 -1
  17. package/build/esm/entry/vexflow-bravura.js +11 -0
  18. package/build/esm/entry/vexflow-core.js +54 -0
  19. package/build/esm/entry/vexflow-debug-with-tests.js +4 -0
  20. package/build/esm/entry/vexflow-debug.js +3 -0
  21. package/build/esm/entry/vexflow-font-bravura.js +7 -0
  22. package/build/esm/entry/vexflow-font-custom.js +7 -0
  23. package/build/esm/entry/vexflow-font-gonville.js +7 -0
  24. package/build/esm/entry/vexflow-font-petaluma.js +7 -0
  25. package/build/esm/entry/vexflow-gonville.js +11 -0
  26. package/build/esm/entry/vexflow-petaluma.js +11 -0
  27. package/build/esm/entry/vexflow.js +9 -0
  28. package/build/esm/src/accidental.js +348 -0
  29. package/build/esm/src/annotation.js +232 -0
  30. package/build/esm/src/articulation.js +267 -0
  31. package/build/esm/src/barnote.js +58 -0
  32. package/build/esm/src/beam.js +632 -0
  33. package/build/esm/src/bend.js +202 -0
  34. package/build/esm/src/boundingbox.js +59 -0
  35. package/build/esm/src/boundingboxcomputation.js +107 -0
  36. package/build/esm/src/canvascontext.js +202 -0
  37. package/build/esm/src/chordsymbol.js +578 -0
  38. package/build/esm/src/clef.js +153 -0
  39. package/build/esm/src/clefnote.js +65 -0
  40. package/build/esm/src/crescendo.js +77 -0
  41. package/build/esm/src/curve.js +118 -0
  42. package/build/esm/src/dot.js +137 -0
  43. package/build/esm/src/easyscore.js +374 -0
  44. package/build/esm/src/element.js +216 -0
  45. package/build/esm/src/factory.js +440 -0
  46. package/build/esm/src/flow.js +275 -0
  47. package/build/esm/src/font.js +264 -0
  48. package/build/esm/src/fonts/bravura_glyphs.js +3239 -0
  49. package/build/esm/src/fonts/bravura_metrics.js +507 -0
  50. package/build/esm/src/fonts/custom_glyphs.js +78 -0
  51. package/build/esm/src/fonts/custom_metrics.js +5 -0
  52. package/build/esm/src/fonts/gonville_glyphs.js +828 -0
  53. package/build/esm/src/fonts/gonville_metrics.js +421 -0
  54. package/build/esm/src/fonts/load_all.js +10 -0
  55. package/build/esm/src/fonts/load_bravura.js +6 -0
  56. package/build/esm/src/fonts/load_custom.js +6 -0
  57. package/build/esm/src/fonts/load_gonville.js +6 -0
  58. package/build/esm/src/fonts/load_petaluma.js +6 -0
  59. package/build/esm/src/fonts/petaluma_glyphs.js +1335 -0
  60. package/build/esm/src/fonts/petaluma_metrics.js +536 -0
  61. package/build/esm/src/fonts/petalumascript_glyphs.js +863 -0
  62. package/build/esm/src/fonts/robotoslab_glyphs.js +863 -0
  63. package/build/esm/src/fonts/textfonts.js +44 -0
  64. package/build/esm/src/formatter.js +568 -0
  65. package/build/esm/src/fraction.js +171 -0
  66. package/build/esm/src/frethandfinger.js +156 -0
  67. package/build/esm/src/ghostnote.js +50 -0
  68. package/build/esm/src/glyph.js +331 -0
  69. package/build/esm/src/glyphnote.js +55 -0
  70. package/build/esm/src/gracenote.js +133 -0
  71. package/build/esm/src/gracenotegroup.js +128 -0
  72. package/build/esm/src/gracetabnote.js +12 -0
  73. package/build/esm/src/index.js +91 -0
  74. package/build/esm/src/keymanager.js +99 -0
  75. package/build/esm/src/keysignature.js +250 -0
  76. package/build/esm/src/keysignote.js +28 -0
  77. package/build/esm/src/modifier.js +128 -0
  78. package/build/esm/src/modifiercontext.js +110 -0
  79. package/build/esm/src/multimeasurerest.js +173 -0
  80. package/build/esm/src/music.js +322 -0
  81. package/build/esm/src/note.js +371 -0
  82. package/build/esm/src/notehead.js +169 -0
  83. package/build/esm/src/notesubgroup.js +59 -0
  84. package/build/esm/src/ornament.js +206 -0
  85. package/build/esm/src/parenthesis.js +76 -0
  86. package/build/esm/src/parser.js +164 -0
  87. package/build/esm/src/pedalmarking.js +192 -0
  88. package/build/esm/src/registry.js +81 -0
  89. package/build/esm/src/rendercontext.js +24 -0
  90. package/build/esm/src/renderer.js +112 -0
  91. package/build/esm/src/repeatnote.js +22 -0
  92. package/build/esm/src/stave.js +547 -0
  93. package/build/esm/src/stavebarline.js +182 -0
  94. package/build/esm/src/staveconnector.js +196 -0
  95. package/build/esm/src/stavehairpin.js +120 -0
  96. package/build/esm/src/staveline.js +218 -0
  97. package/build/esm/src/stavemodifier.js +77 -0
  98. package/build/esm/src/stavenote.js +855 -0
  99. package/build/esm/src/staverepetition.js +155 -0
  100. package/build/esm/src/stavesection.js +58 -0
  101. package/build/esm/src/stavetempo.js +91 -0
  102. package/build/esm/src/stavetext.js +82 -0
  103. package/build/esm/src/stavetie.js +141 -0
  104. package/build/esm/src/stavevolta.js +67 -0
  105. package/build/esm/src/stem.js +131 -0
  106. package/build/esm/src/stemmablenote.js +193 -0
  107. package/build/esm/src/stringnumber.js +231 -0
  108. package/build/esm/src/strokes.js +200 -0
  109. package/build/esm/src/svgcontext.js +414 -0
  110. package/build/esm/src/system.js +116 -0
  111. package/build/esm/src/tables.js +1102 -0
  112. package/build/esm/src/tabnote.js +299 -0
  113. package/build/esm/src/tabslide.js +76 -0
  114. package/build/esm/src/tabstave.js +17 -0
  115. package/build/esm/src/tabtie.js +19 -0
  116. package/build/esm/src/textbracket.js +144 -0
  117. package/build/esm/src/textdynamics.js +81 -0
  118. package/build/esm/src/textformatter.js +177 -0
  119. package/build/esm/src/textnote.js +176 -0
  120. package/build/esm/src/tickable.js +214 -0
  121. package/build/esm/src/tickcontext.js +170 -0
  122. package/build/esm/src/timesigglyph.js +85 -0
  123. package/build/esm/src/timesignature.js +89 -0
  124. package/build/esm/src/timesignote.js +32 -0
  125. package/build/esm/src/tremolo.js +47 -0
  126. package/build/esm/src/tuning.js +54 -0
  127. package/build/esm/src/tuplet.js +240 -0
  128. package/build/esm/src/typeguard.js +30 -0
  129. package/build/esm/src/util.js +58 -0
  130. package/build/esm/src/version.js +3 -3
  131. package/build/esm/src/vex.js +51 -0
  132. package/build/esm/src/vibrato.js +100 -0
  133. package/build/esm/src/vibratobracket.js +50 -0
  134. package/build/esm/src/voice.js +187 -0
  135. package/build/esm/src/web.js +15 -0
  136. package/build/esm/tests/accidental_tests.js +974 -0
  137. package/build/esm/tests/annotation_tests.js +377 -0
  138. package/build/esm/tests/articulation_tests.js +365 -0
  139. package/build/esm/tests/auto_beam_formatting_tests.js +548 -0
  140. package/build/esm/tests/bach_tests.js +335 -0
  141. package/build/esm/tests/barline_tests.js +52 -0
  142. package/build/esm/tests/beam_tests.js +595 -0
  143. package/build/esm/tests/bend_tests.js +215 -0
  144. package/build/esm/tests/boundingbox_tests.js +53 -0
  145. package/build/esm/tests/boundingboxcomputation_tests.js +183 -0
  146. package/build/esm/tests/chordsymbol_tests.js +320 -0
  147. package/build/esm/tests/clef_tests.js +131 -0
  148. package/build/esm/tests/curve_tests.js +118 -0
  149. package/build/esm/tests/dot_tests.js +123 -0
  150. package/build/esm/tests/easyscore_tests.js +459 -0
  151. package/build/esm/tests/factory_tests.js +44 -0
  152. package/build/esm/tests/font_tests.js +135 -0
  153. package/build/esm/tests/formatter/framestack.js +61 -0
  154. package/build/esm/tests/formatter/tests.js +203 -0
  155. package/build/esm/tests/formatter_tests.js +669 -0
  156. package/build/esm/tests/fraction_tests.js +72 -0
  157. package/build/esm/tests/ghostnote_tests.js +77 -0
  158. package/build/esm/tests/glyphnote_tests.js +113 -0
  159. package/build/esm/tests/gracenote_tests.js +413 -0
  160. package/build/esm/tests/gracetabnote_tests.js +79 -0
  161. package/build/esm/tests/index.js +68 -0
  162. package/build/esm/tests/key_clef_tests.js +103 -0
  163. package/build/esm/tests/keymanager_tests.js +68 -0
  164. package/build/esm/tests/keysignature_tests.js +308 -0
  165. package/build/esm/tests/mocks.js +71 -0
  166. package/build/esm/tests/modifier_tests.js +24 -0
  167. package/build/esm/tests/multimeasurerest_tests.js +141 -0
  168. package/build/esm/tests/music_tests.js +161 -0
  169. package/build/esm/tests/notehead_tests.js +137 -0
  170. package/build/esm/tests/notesubgroup_tests.js +149 -0
  171. package/build/esm/tests/offscreencanvas_tests.js +47 -0
  172. package/build/esm/tests/ornament_tests.js +298 -0
  173. package/build/esm/tests/parser_tests.js +122 -0
  174. package/build/esm/tests/pedalmarking_tests.js +64 -0
  175. package/build/esm/tests/percussion_tests.js +180 -0
  176. package/build/esm/tests/registry_tests.js +64 -0
  177. package/build/esm/tests/renderer_tests.js +113 -0
  178. package/build/esm/tests/rests_tests.js +248 -0
  179. package/build/esm/tests/rhythm_tests.js +357 -0
  180. package/build/esm/tests/stave_tests.js +560 -0
  181. package/build/esm/tests/staveconnector_tests.js +402 -0
  182. package/build/esm/tests/stavehairpin_tests.js +90 -0
  183. package/build/esm/tests/staveline_tests.js +122 -0
  184. package/build/esm/tests/stavemodifier_tests.js +51 -0
  185. package/build/esm/tests/stavenote_tests.js +867 -0
  186. package/build/esm/tests/stavetie_tests.js +108 -0
  187. package/build/esm/tests/stringnumber_tests.js +259 -0
  188. package/build/esm/tests/strokes_tests.js +275 -0
  189. package/build/esm/tests/style_tests.js +98 -0
  190. package/build/esm/tests/support/qunit.js +2765 -0
  191. package/build/esm/tests/tabnote_tests.js +474 -0
  192. package/build/esm/tests/tabslide_tests.js +135 -0
  193. package/build/esm/tests/tabstave_tests.js +23 -0
  194. package/build/esm/tests/tabtie_tests.js +173 -0
  195. package/build/esm/tests/textbracket_tests.js +100 -0
  196. package/build/esm/tests/textformatter_tests.js +24 -0
  197. package/build/esm/tests/textnote_tests.js +215 -0
  198. package/build/esm/tests/threevoice_tests.js +132 -0
  199. package/build/esm/tests/tickcontext_tests.js +36 -0
  200. package/build/esm/tests/timesignature_tests.js +134 -0
  201. package/build/esm/tests/tremolo_tests.js +75 -0
  202. package/build/esm/tests/tuning_tests.js +56 -0
  203. package/build/esm/tests/tuplet_tests.js +450 -0
  204. package/build/esm/tests/typeguard_tests.js +82 -0
  205. package/build/esm/tests/vexflow_test_helpers.js +266 -0
  206. package/build/esm/tests/vf_prefix_tests.js +115 -0
  207. package/build/esm/tests/vibrato_tests.js +92 -0
  208. package/build/esm/tests/vibratobracket_tests.js +45 -0
  209. package/build/esm/tests/voice_tests.js +69 -0
  210. package/build/types/entry/vexflow-bravura.d.ts +3 -0
  211. package/build/types/entry/vexflow-core.d.ts +3 -0
  212. package/build/types/entry/vexflow-debug.d.ts +3 -0
  213. package/build/types/entry/vexflow-font-bravura.d.ts +3771 -0
  214. package/build/types/entry/vexflow-font-custom.d.ts +86 -0
  215. package/build/types/entry/vexflow-font-gonville.d.ts +1267 -0
  216. package/build/types/entry/vexflow-font-petaluma.d.ts +1896 -0
  217. package/build/types/entry/vexflow-gonville.d.ts +3 -0
  218. package/build/types/entry/vexflow-petaluma.d.ts +3 -0
  219. package/build/types/entry/vexflow.d.ts +3 -0
  220. package/build/types/src/accidental.d.ts +66 -0
  221. package/build/types/src/annotation.d.ts +60 -0
  222. package/build/types/src/articulation.d.ts +62 -0
  223. package/build/types/src/barnote.d.ts +29 -0
  224. package/build/types/src/beam.d.ts +124 -0
  225. package/build/types/src/bend.d.ts +73 -0
  226. package/build/types/src/boundingbox.d.ts +42 -0
  227. package/build/types/src/boundingboxcomputation.d.ts +33 -0
  228. package/build/types/src/canvascontext.d.ts +89 -0
  229. package/build/types/src/chordsymbol.d.ts +149 -0
  230. package/build/types/src/clef.d.ts +48 -0
  231. package/build/types/src/clefnote.d.ts +25 -0
  232. package/build/types/src/crescendo.d.ts +27 -0
  233. package/build/types/src/curve.d.ts +41 -0
  234. package/build/types/src/dot.d.ts +20 -0
  235. package/build/types/src/easyscore.d.ts +148 -0
  236. package/build/types/src/element.d.ts +202 -0
  237. package/build/types/src/factory.d.ts +271 -0
  238. package/build/types/src/flow.d.ts +245 -0
  239. package/build/types/src/font.d.ts +181 -0
  240. package/build/types/src/fonts/bravura_glyphs.d.ts +3239 -0
  241. package/build/types/src/fonts/bravura_metrics.d.ts +533 -0
  242. package/build/types/src/fonts/custom_glyphs.d.ts +78 -0
  243. package/build/types/src/fonts/custom_metrics.d.ts +5 -0
  244. package/build/types/src/fonts/gonville_glyphs.d.ts +828 -0
  245. package/build/types/src/fonts/gonville_metrics.d.ts +440 -0
  246. package/build/types/src/fonts/load_all.d.ts +1 -0
  247. package/build/types/src/fonts/load_bravura.d.ts +1 -0
  248. package/build/types/src/fonts/load_custom.d.ts +1 -0
  249. package/build/types/src/fonts/load_gonville.d.ts +1 -0
  250. package/build/types/src/fonts/load_petaluma.d.ts +1 -0
  251. package/build/types/src/fonts/petaluma_glyphs.d.ts +1335 -0
  252. package/build/types/src/fonts/petaluma_metrics.d.ts +562 -0
  253. package/build/types/src/fonts/petalumascript_glyphs.d.ts +863 -0
  254. package/build/types/src/fonts/robotoslab_glyphs.d.ts +863 -0
  255. package/build/types/src/fonts/textfonts.d.ts +1 -0
  256. package/build/types/src/formatter.d.ts +203 -0
  257. package/build/types/src/fraction.d.ts +62 -0
  258. package/build/types/src/frethandfinger.d.ts +22 -0
  259. package/build/types/src/ghostnote.d.ts +16 -0
  260. package/build/types/src/glyph.d.ts +139 -0
  261. package/build/types/src/glyphnote.d.ts +17 -0
  262. package/build/types/src/gracenote.d.ts +19 -0
  263. package/build/types/src/gracenotegroup.d.ts +33 -0
  264. package/build/types/src/gracetabnote.d.ts +5 -0
  265. package/build/types/src/index.d.ts +91 -0
  266. package/build/types/src/keymanager.d.ts +25 -0
  267. package/build/types/src/keysignature.d.ts +50 -0
  268. package/build/types/src/keysignote.d.ts +11 -0
  269. package/build/types/src/modifier.d.ts +97 -0
  270. package/build/types/src/modifiercontext.d.ts +45 -0
  271. package/build/types/src/multimeasurerest.d.ts +61 -0
  272. package/build/types/src/music.d.ts +91 -0
  273. package/build/types/src/note.d.ts +231 -0
  274. package/build/types/src/notehead.d.ts +70 -0
  275. package/build/types/src/notesubgroup.d.ts +18 -0
  276. package/build/types/src/ornament.d.ts +76 -0
  277. package/build/types/src/parenthesis.d.ts +22 -0
  278. package/build/types/src/parser.d.ts +45 -0
  279. package/build/types/src/pedalmarking.d.ts +69 -0
  280. package/build/types/src/registry.d.ts +40 -0
  281. package/build/types/src/rendercontext.d.ts +64 -0
  282. package/build/types/src/renderer.d.ts +35 -0
  283. package/build/types/src/repeatnote.d.ts +6 -0
  284. package/build/types/src/stave.d.ts +186 -0
  285. package/build/types/src/stavebarline.d.ts +28 -0
  286. package/build/types/src/staveconnector.d.ts +67 -0
  287. package/build/types/src/stavehairpin.d.ts +56 -0
  288. package/build/types/src/staveline.d.ts +57 -0
  289. package/build/types/src/stavemodifier.d.ts +44 -0
  290. package/build/types/src/stavenote.d.ts +154 -0
  291. package/build/types/src/staverepetition.d.ts +32 -0
  292. package/build/types/src/stavesection.d.ts +15 -0
  293. package/build/types/src/stavetempo.d.ts +25 -0
  294. package/build/types/src/stavetext.d.ts +25 -0
  295. package/build/types/src/stavetie.d.ts +59 -0
  296. package/build/types/src/stavevolta.d.ts +21 -0
  297. package/build/types/src/stem.d.ts +58 -0
  298. package/build/types/src/stemmablenote.d.ts +39 -0
  299. package/build/types/src/stringnumber.d.ts +27 -0
  300. package/build/types/src/strokes.d.ts +33 -0
  301. package/build/types/src/svgcontext.d.ts +131 -0
  302. package/build/types/src/system.d.ts +92 -0
  303. package/build/types/src/tables.d.ts +96 -0
  304. package/build/types/src/tabnote.d.ts +44 -0
  305. package/build/types/src/tabslide.d.ts +34 -0
  306. package/build/types/src/tabstave.d.ts +7 -0
  307. package/build/types/src/tabtie.d.ts +18 -0
  308. package/build/types/src/textbracket.d.ts +55 -0
  309. package/build/types/src/textdynamics.d.ts +39 -0
  310. package/build/types/src/textformatter.d.ts +109 -0
  311. package/build/types/src/textnote.d.ts +49 -0
  312. package/build/types/src/tickable.d.ts +140 -0
  313. package/build/types/src/tickcontext.d.ts +82 -0
  314. package/build/types/src/timesigglyph.d.ts +14 -0
  315. package/build/types/src/timesignature.d.ts +26 -0
  316. package/build/types/src/timesignote.d.ts +11 -0
  317. package/build/types/src/tremolo.d.ts +17 -0
  318. package/build/types/src/tuning.d.ts +23 -0
  319. package/build/types/src/tuplet.d.ts +105 -0
  320. package/build/types/src/typeguard.d.ts +99 -0
  321. package/build/types/src/util.d.ts +27 -0
  322. package/build/types/src/version.d.ts +3 -0
  323. package/build/types/src/vex.d.ts +18 -0
  324. package/build/types/src/vibrato.d.ts +29 -0
  325. package/build/types/src/vibratobracket.d.ts +33 -0
  326. package/build/types/src/voice.d.ts +108 -0
  327. package/build/types/src/web.d.ts +2 -0
  328. package/package.json +1 -1
  329. package/src/annotation.ts +27 -6
  330. package/src/articulation.ts +8 -2
  331. package/src/fonts/gonville_glyphs.ts +4 -4
@@ -0,0 +1,76 @@
1
+ import { Glyph } from './glyph';
2
+ import { Modifier } from './modifier';
3
+ import { ModifierContextState } from './modifiercontext';
4
+ /**
5
+ * Ornament implements ornaments as modifiers that can be
6
+ * attached to notes. The complete list of ornaments is available in
7
+ * `tables.ts` under `Vex.Flow.ornamentCodes`.
8
+ *
9
+ * See `tests/ornament_tests.ts` for usage examples.
10
+ */
11
+ export declare class Ornament extends Modifier {
12
+ /** To enable logging for this class. Set `Vex.Flow.Ornament.DEBUG` to `true`. */
13
+ static DEBUG: boolean;
14
+ /** Ornaments category string. */
15
+ static get CATEGORY(): string;
16
+ protected ornament: {
17
+ code: string;
18
+ };
19
+ protected stemUpYOffset: number;
20
+ protected ornamentAlignWithNoteHead: string[] | boolean;
21
+ protected type: string;
22
+ protected delayed: boolean;
23
+ protected reportedWidth: number;
24
+ protected adjustForStemDirection: boolean;
25
+ render_options: {
26
+ accidentalUpperPadding: number;
27
+ accidentalLowerPadding: number;
28
+ font_scale: number;
29
+ };
30
+ protected glyph: Glyph;
31
+ protected accidentalUpper?: Glyph;
32
+ protected accidentalLower?: Glyph;
33
+ protected delayXShift?: number;
34
+ /** Arrange ornaments inside `ModifierContext` */
35
+ static format(ornaments: Ornament[], state: ModifierContextState): boolean;
36
+ /**
37
+ * ornamentNoteTransition means the jazz ornament represents an effect from one note to another,
38
+ * these are generally on the top of the staff.
39
+ */
40
+ static get ornamentNoteTransition(): string[];
41
+ /**
42
+ * ornamentAttack indicates something that happens in the attach, placed before the note and
43
+ * any accidentals
44
+ */
45
+ static get ornamentAttack(): string[];
46
+ /**
47
+ * The ornament is aligned based on the note head, but without regard to whether the
48
+ * stem goes up or down.
49
+ */
50
+ static get ornamentAlignWithNoteHead(): string[];
51
+ /**
52
+ * An ornament that happens on the release of the note, generally placed after the
53
+ * note and overlapping the next beat/measure..
54
+ */
55
+ static get ornamentRelease(): string[];
56
+ /** ornamentArticulation goes above/below the note based on space availablity */
57
+ static get ornamentArticulation(): string[];
58
+ /**
59
+ * Legacy ornaments have hard-coded metrics. If additional ornament types are
60
+ * added, get their metrics here.
61
+ */
62
+ getMetrics(): any;
63
+ /**
64
+ * Create a new ornament of type `type`, which is an entry in
65
+ * `Vex.Flow.ornamentCodes` in `tables.ts`.
66
+ */
67
+ constructor(type: string);
68
+ /** Set whether the ornament is to be delayed. */
69
+ setDelayed(delayed: boolean): this;
70
+ /** Set the upper accidental for the ornament. */
71
+ setUpperAccidental(accid: string): this;
72
+ /** Set the lower accidental for the ornament. */
73
+ setLowerAccidental(accid: string): this;
74
+ /** Render ornament in position next to note. */
75
+ draw(): void;
76
+ }
@@ -0,0 +1,22 @@
1
+ import { Modifier, ModifierPosition } from './modifier';
2
+ import { ModifierContextState } from './modifiercontext';
3
+ import { Note } from './note';
4
+ /** Parenthesis implements parenthesis modifiers for notes. */
5
+ export declare class Parenthesis extends Modifier {
6
+ static get CATEGORY(): string;
7
+ protected point: number;
8
+ /** Add parentheses to the notes. */
9
+ static buildAndAttach(notes: Note[]): void;
10
+ /** Arrange parentheses inside a ModifierContext. */
11
+ static format(parentheses: Parenthesis[], state: ModifierContextState): boolean;
12
+ /**
13
+ * Constructor
14
+ *
15
+ * @param position Modifier.Position.LEFT (default) or Modifier.Position.RIGHT
16
+ */
17
+ constructor(position: ModifierPosition);
18
+ /** Set the associated note. */
19
+ setNote(note: Note): this;
20
+ /** Render the parenthesis. */
21
+ draw(): void;
22
+ }
@@ -0,0 +1,45 @@
1
+ export declare type Match = string | Match[] | null;
2
+ export declare type RuleFunction = () => Rule;
3
+ export declare type TriggerFunction = (state?: {
4
+ matches: Match[];
5
+ }) => void;
6
+ export interface Rule {
7
+ token?: string;
8
+ noSpace?: boolean;
9
+ expect?: RuleFunction[];
10
+ zeroOrMore?: boolean;
11
+ oneOrMore?: boolean;
12
+ maybe?: boolean;
13
+ or?: boolean;
14
+ run?: TriggerFunction;
15
+ }
16
+ export interface Result {
17
+ success: boolean;
18
+ pos?: number;
19
+ incrementPos?: number;
20
+ matchedString?: string;
21
+ matches?: Match[];
22
+ numMatches?: number;
23
+ results?: GroupedResults;
24
+ errorPos?: number;
25
+ }
26
+ export declare type GroupedResults = (Result | Result[])[];
27
+ export interface Grammar {
28
+ begin(): RuleFunction;
29
+ }
30
+ export declare class Parser {
31
+ static DEBUG: boolean;
32
+ protected grammar: Grammar;
33
+ protected line: string;
34
+ protected pos: number;
35
+ protected errorPos: number;
36
+ constructor(grammar: Grammar);
37
+ parse(line: string): Result;
38
+ matchFail(returnPos: number): void;
39
+ matchSuccess(): void;
40
+ matchToken(token: string, noSpace?: boolean): Result;
41
+ expectOne(rule: Rule, maybe?: boolean): Result;
42
+ expectOneOrMore(rule: Rule, maybe?: boolean): Result;
43
+ expectZeroOrMore(rule: Rule): Result;
44
+ expect(ruleFunc: RuleFunction): Result;
45
+ }
@@ -0,0 +1,69 @@
1
+ import { Element } from './element';
2
+ import { FontInfo } from './font';
3
+ import { StaveNote } from './stavenote';
4
+ /**
5
+ * PedalMarking implements different types of pedal markings. These notation
6
+ * elements indicate to the performer when to depress and release the a pedal.
7
+ *
8
+ * In order to create "Sostenuto", and "una corda" markings, you must set
9
+ * custom text for the release/depress pedal markings.
10
+ */
11
+ export declare class PedalMarking extends Element {
12
+ /** To enable logging for this class. Set `Vex.Flow.PedalMarking.DEBUG` to `true`. */
13
+ static DEBUG: boolean;
14
+ static get CATEGORY(): string;
15
+ static TEXT_FONT: Required<FontInfo>;
16
+ protected line: number;
17
+ protected type: number;
18
+ protected custom_depress_text: string;
19
+ protected custom_release_text: string;
20
+ render_options: {
21
+ color: string;
22
+ bracket_height: number;
23
+ text_margin_right: number;
24
+ bracket_line_width: number;
25
+ };
26
+ protected notes: StaveNote[];
27
+ /** Glyph data */
28
+ static readonly GLYPHS: Record<string, {
29
+ code: string;
30
+ y_shift: number;
31
+ x_shift: number;
32
+ }>;
33
+ /** Pedal type as number. */
34
+ static readonly type: {
35
+ TEXT: number;
36
+ BRACKET: number;
37
+ MIXED: number;
38
+ };
39
+ /** Pedal type as string. */
40
+ static readonly typeString: Record<string, number>;
41
+ /**
42
+ * Create a sustain pedal marking. Returns the defaults PedalMarking.
43
+ * Which uses the traditional "Ped" and "*"" markings.
44
+ */
45
+ static createSustain(notes: StaveNote[]): PedalMarking;
46
+ /** Create a sostenuto pedal marking */
47
+ static createSostenuto(notes: StaveNote[]): PedalMarking;
48
+ /** Create an una corda pedal marking */
49
+ static createUnaCorda(notes: StaveNote[]): PedalMarking;
50
+ constructor(notes: StaveNote[]);
51
+ /** Set pedal type. */
52
+ setType(type: string | number): this;
53
+ /**
54
+ * Set custom text for the `depress`/`release` pedal markings. No text is
55
+ * set if the parameter is falsy.
56
+ */
57
+ setCustomText(depress: string, release?: string): this;
58
+ /** Set the staff line to render the markings on. */
59
+ setLine(line: number): this;
60
+ /** Draw the bracket based pedal markings. */
61
+ drawBracketed(): void;
62
+ /**
63
+ * Draw the text based pedal markings. This defaults to the traditional
64
+ * "Ped" and "*"" symbols if no custom text has been provided.
65
+ */
66
+ drawText(): void;
67
+ /** Render the pedal marking in position on the rendering context. */
68
+ draw(): void;
69
+ }
@@ -0,0 +1,40 @@
1
+ import { Element } from './element';
2
+ declare class Index {
3
+ [key: string]: {
4
+ [key: string]: {
5
+ [key: string]: Element;
6
+ };
7
+ };
8
+ constructor();
9
+ }
10
+ export interface RegistryUpdate {
11
+ id: string;
12
+ name: string;
13
+ value: string | undefined;
14
+ oldValue: string | undefined;
15
+ }
16
+ export declare class Registry {
17
+ private static defaultRegistry?;
18
+ static getDefaultRegistry(): Registry | undefined;
19
+ static enableDefaultRegistry(registry: Registry): void;
20
+ static disableDefaultRegistry(): void;
21
+ protected index: Index;
22
+ constructor();
23
+ clear(): this;
24
+ setIndexValue(name: string, value: string, id: string, elem: Element): void;
25
+ updateIndex({ id, name, value, oldValue }: RegistryUpdate): void;
26
+ /**
27
+ * Register element `elem` with this registry.
28
+ * This adds the element to its index and watches it for attribute changes.
29
+ * @param elem
30
+ * @param id
31
+ * @returns this
32
+ */
33
+ register(elem: Element, id?: string): this;
34
+ getElementById(id: string): Element | undefined;
35
+ getElementsByAttribute(attribute: string, value: string): Element[];
36
+ getElementsByType(type: string): Element[];
37
+ getElementsByClass(className: string): Element[];
38
+ onUpdate(info: RegistryUpdate): this;
39
+ }
40
+ export {};
@@ -0,0 +1,64 @@
1
+ import { FontInfo } from './font';
2
+ export interface TextMeasure {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export interface GroupAttributes {
9
+ pointerBBox: boolean;
10
+ }
11
+ export declare abstract class RenderContext {
12
+ static get CATEGORY(): string;
13
+ abstract clear(): void;
14
+ abstract setFillStyle(style: string): this;
15
+ abstract setBackgroundFillStyle(style: string): this;
16
+ abstract setStrokeStyle(style: string): this;
17
+ abstract setShadowColor(color: string): this;
18
+ abstract setShadowBlur(blur: number): this;
19
+ abstract setLineWidth(width: number): this;
20
+ abstract setLineCap(capType: CanvasLineCap): this;
21
+ abstract setLineDash(dashPattern: number[]): this;
22
+ abstract scale(x: number, y: number): this;
23
+ abstract rect(x: number, y: number, width: number, height: number): this;
24
+ abstract resize(width: number, height: number): this;
25
+ abstract fillRect(x: number, y: number, width: number, height: number): this;
26
+ abstract clearRect(x: number, y: number, width: number, height: number): this;
27
+ abstract beginPath(): this;
28
+ abstract moveTo(x: number, y: number): this;
29
+ abstract lineTo(x: number, y: number): this;
30
+ abstract bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): this;
31
+ abstract quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): this;
32
+ abstract arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise: boolean): this;
33
+ abstract fill(attributes?: any): this;
34
+ abstract stroke(): this;
35
+ abstract closePath(): this;
36
+ abstract fillText(text: string, x: number, y: number): this;
37
+ abstract save(): this;
38
+ abstract restore(): this;
39
+ abstract openGroup(cls?: string, id?: string, attrs?: GroupAttributes): any;
40
+ abstract closeGroup(): void;
41
+ abstract add(child: any): void;
42
+ abstract measureText(text: string): TextMeasure;
43
+ abstract set fillStyle(style: string | CanvasGradient | CanvasPattern);
44
+ abstract get fillStyle(): string | CanvasGradient | CanvasPattern;
45
+ abstract set strokeStyle(style: string | CanvasGradient | CanvasPattern);
46
+ abstract get strokeStyle(): string | CanvasGradient | CanvasPattern;
47
+ abstract setFont(f?: string | FontInfo, size?: string | number, weight?: string | number, style?: string): this;
48
+ abstract getFont(): string;
49
+ set font(f: string);
50
+ get font(): string;
51
+ /**
52
+ * This is kept for backwards compatibility with 3.0.9.
53
+ * @deprecated use `setFont(...)` instead since it now supports CSS font shorthand.
54
+ */
55
+ setRawFont(f: string): this;
56
+ }
57
+ /**
58
+ * Draw a tiny dot marker on the specified context. A great debugging aid.
59
+ * @param ctx context
60
+ * @param x dot x coordinate
61
+ * @param y dot y coordinate
62
+ * @param color
63
+ */
64
+ export declare function drawDot(ctx: RenderContext, x: number, y: number, color?: string): void;
@@ -0,0 +1,35 @@
1
+ import { RenderContext } from './rendercontext';
2
+ export declare type ContextBuilder = typeof Renderer.getSVGContext | typeof Renderer.getCanvasContext;
3
+ export declare enum RendererBackends {
4
+ CANVAS = 1,
5
+ SVG = 2
6
+ }
7
+ export declare enum RendererLineEndType {
8
+ NONE = 1,
9
+ UP = 2,
10
+ DOWN = 3
11
+ }
12
+ /**
13
+ * Support Canvas & SVG rendering contexts.
14
+ */
15
+ export declare class Renderer {
16
+ static Backends: typeof RendererBackends;
17
+ static LineEndType: typeof RendererLineEndType;
18
+ static lastContext?: RenderContext;
19
+ static buildContext(elementId: string | HTMLCanvasElement | HTMLDivElement, backend: number, width: number, height: number, background?: string): RenderContext;
20
+ static getCanvasContext(elementId: string, width: number, height: number, background?: string): RenderContext;
21
+ static getSVGContext(elementId: string, width: number, height: number, background?: string): RenderContext;
22
+ static drawDashedLine(context: RenderContext, fromX: number, fromY: number, toX: number, toY: number, dashPattern: number[]): void;
23
+ protected ctx: RenderContext;
24
+ /**
25
+ * @param canvasId can be:
26
+ * - a string element ID (of a canvas or div element)
27
+ * - a canvas element
28
+ * - a div element, which will contain the SVG output
29
+ * @param backend Renderer.Backends.CANVAS or Renderer.Backends.SVG
30
+ */
31
+ constructor(context: RenderContext);
32
+ constructor(canvas: string | HTMLCanvasElement | HTMLDivElement, backend: number);
33
+ resize(width: number, height: number): this;
34
+ getContext(): RenderContext;
35
+ }
@@ -0,0 +1,6 @@
1
+ import { GlyphNote, GlyphNoteOptions } from './glyphnote';
2
+ import { NoteStruct } from './note';
3
+ export declare class RepeatNote extends GlyphNote {
4
+ static get CATEGORY(): string;
5
+ constructor(type: string, noteStruct?: NoteStruct, options?: GlyphNoteOptions);
6
+ }
@@ -0,0 +1,186 @@
1
+ import { BoundingBox, Bounds } from './boundingbox';
2
+ import { Element, ElementStyle } from './element';
3
+ import { FontInfo } from './font';
4
+ import { BarlineType } from './stavebarline';
5
+ import { StaveModifier } from './stavemodifier';
6
+ import { StaveTempoOptions } from './stavetempo';
7
+ export interface StaveLineConfig {
8
+ visible?: boolean;
9
+ }
10
+ export interface StaveOptions {
11
+ bottom_text_position?: number;
12
+ line_config?: StaveLineConfig[];
13
+ space_below_staff_ln?: number;
14
+ space_above_staff_ln?: number;
15
+ vertical_bar_width?: number;
16
+ fill_style?: string;
17
+ left_bar?: boolean;
18
+ right_bar?: boolean;
19
+ spacing_between_lines_px?: number;
20
+ top_text_position?: number;
21
+ num_lines?: number;
22
+ }
23
+ export declare class Stave extends Element {
24
+ static get CATEGORY(): string;
25
+ static TEXT_FONT: Required<FontInfo>;
26
+ readonly options: Required<StaveOptions>;
27
+ protected start_x: number;
28
+ protected clef: string;
29
+ protected endClef?: string;
30
+ protected x: number;
31
+ protected y: number;
32
+ protected width: number;
33
+ protected height: number;
34
+ protected formatted: boolean;
35
+ protected end_x: number;
36
+ protected measure: number;
37
+ protected bounds: Bounds;
38
+ protected readonly modifiers: StaveModifier[];
39
+ protected defaultLedgerLineStyle: ElementStyle;
40
+ static get defaultPadding(): number;
41
+ static get rightPadding(): number;
42
+ constructor(x: number, y: number, width: number, options?: StaveOptions);
43
+ /** Set default style for ledger lines. */
44
+ setDefaultLedgerLineStyle(style: ElementStyle): void;
45
+ /** Get default style for ledger lines. */
46
+ getDefaultLedgerLineStyle(): ElementStyle;
47
+ space(spacing: number): number;
48
+ resetLines(): void;
49
+ setNoteStartX(x: number): this;
50
+ getNoteStartX(): number;
51
+ getNoteEndX(): number;
52
+ getTieStartX(): number;
53
+ getTieEndX(): number;
54
+ getX(): number;
55
+ getNumLines(): number;
56
+ setNumLines(n: number): this;
57
+ setY(y: number): this;
58
+ getY(): number;
59
+ getTopLineTopY(): number;
60
+ getBottomLineBottomY(): number;
61
+ setX(x: number): this;
62
+ setWidth(width: number): this;
63
+ getWidth(): number;
64
+ getStyle(): ElementStyle;
65
+ setMeasure(measure: number): this;
66
+ /**
67
+ * Gets the pixels to shift from the beginning of the stave
68
+ * following the modifier at the provided index
69
+ * @param {Number} index The index from which to determine the shift
70
+ * @return {Number} The amount of pixels shifted
71
+ */
72
+ getModifierXShift(index?: number): number;
73
+ /** Coda & Segno Symbol functions */
74
+ setRepetitionType(type: number, yShift?: number): this;
75
+ setVoltaType(type: number, number_t: string, y: number): this;
76
+ setSection(section: string, y: number, xOffset?: number, fontSize?: number): this;
77
+ setTempo(tempo: StaveTempoOptions, y: number): this;
78
+ setText(text: string, position: number, options?: {
79
+ shift_x?: number;
80
+ shift_y?: number;
81
+ justification?: number;
82
+ }): this;
83
+ getHeight(): number;
84
+ getSpacingBetweenLines(): number;
85
+ getBoundingBox(): BoundingBox;
86
+ getBottomY(): number;
87
+ getBottomLineY(): number;
88
+ /** @returns the y for the *center* of a staff line */
89
+ getYForLine(line: number): number;
90
+ getLineForY(y: number): number;
91
+ getYForTopText(line?: number): number;
92
+ getYForBottomText(line?: number): number;
93
+ getYForNote(line: number): number;
94
+ getYForGlyphs(): number;
95
+ addModifier(modifier: StaveModifier, position?: number): this;
96
+ addEndModifier(modifier: StaveModifier): this;
97
+ setBegBarType(type: number | BarlineType): this;
98
+ setEndBarType(type: number | BarlineType): this;
99
+ setClef(clefSpec: string, size?: string, annotation?: string, position?: number): this;
100
+ getClef(): string;
101
+ setEndClef(clefSpec: string, size?: string, annotation?: string): this;
102
+ getEndClef(): string | undefined;
103
+ setKeySignature(keySpec: string, cancelKeySpec?: string, position?: number): this;
104
+ setEndKeySignature(keySpec: string, cancelKeySpec?: string): this;
105
+ setTimeSignature(timeSpec: string, customPadding?: number, position?: number): this;
106
+ setEndTimeSignature(timeSpec: string, customPadding?: number): this;
107
+ /**
108
+ * Add a key signature to the stave.
109
+ *
110
+ * Example:
111
+ * `stave.addKeySignature('Db');`
112
+ * @param keySpec new key specification `[A-G][b|#]?`
113
+ * @param cancelKeySpec
114
+ * @param position
115
+ * @returns
116
+ */
117
+ addKeySignature(keySpec: string, cancelKeySpec?: string, position?: number): this;
118
+ /**
119
+ * Add a clef to the stave.
120
+ *
121
+ * Example:
122
+ *
123
+ * stave.addClef('treble')
124
+ * @param clef clef (treble|bass|...) see {@link Clef.types}
125
+ * @param size
126
+ * @param annotation
127
+ * @param position
128
+ * @returns
129
+ */
130
+ addClef(clef: string, size?: string, annotation?: string, position?: number): this;
131
+ addEndClef(clef: string, size?: string, annotation?: string): this;
132
+ /**
133
+ * Add a time signature to the stave
134
+ *
135
+ * Example:
136
+ *
137
+ * `stave.addTimeSignature('4/4');`
138
+ * @param timeSpec time signature specification `(C\||C|\d\/\d)`
139
+ * @param customPadding
140
+ * @param position
141
+ * @returns
142
+ */
143
+ addTimeSignature(timeSpec: string, customPadding?: number, position?: number): this;
144
+ addEndTimeSignature(timeSpec: string, customPadding?: number): this;
145
+ addTrebleGlyph(): this;
146
+ /**
147
+ * @param position
148
+ * @param category
149
+ * @returns array of StaveModifiers that match the provided position and category.
150
+ */
151
+ getModifiers(position?: number, category?: string): StaveModifier[];
152
+ /**
153
+ * Use the modifier's `getCategory()` as a key for the `order` array.
154
+ * The retrieved value is used to sort modifiers from left to right (0 to to 3).
155
+ */
156
+ sortByCategory(items: StaveModifier[], order: Record<string, number>): void;
157
+ format(): void;
158
+ /**
159
+ * All drawing functions below need the context to be set.
160
+ */
161
+ draw(): this;
162
+ getVerticalBarWidth(): number;
163
+ /**
164
+ * Get the current configuration for the Stave.
165
+ * @return {Array} An array of configuration objects.
166
+ */
167
+ getConfigForLines(): StaveLineConfig[];
168
+ /**
169
+ * Configure properties of the lines in the Stave
170
+ * @param line_number The index of the line to configure.
171
+ * @param line_config An configuration object for the specified line.
172
+ * @throws RuntimeError "StaveConfigError" When the specified line number is out of
173
+ * range of the number of lines specified in the constructor.
174
+ */
175
+ setConfigForLine(line_number: number, line_config: StaveLineConfig): this;
176
+ /**
177
+ * Set the staff line configuration array for all of the lines at once.
178
+ * @param lines_configuration An array of line configuration objects. These objects
179
+ * are of the same format as the single one passed in to setLineConfiguration().
180
+ * The caller can set null for any line config entry if it is desired that the default be used
181
+ * @throws RuntimeError "StaveConfigError" When the lines_configuration array does not have
182
+ * exactly the same number of elements as the num_lines configuration object set in
183
+ * the constructor.
184
+ */
185
+ setConfigForLines(lines_configuration: StaveLineConfig[]): this;
186
+ }
@@ -0,0 +1,28 @@
1
+ import { Stave } from './stave';
2
+ import { LayoutMetrics, StaveModifier } from './stavemodifier';
3
+ export declare enum BarlineType {
4
+ SINGLE = 1,
5
+ DOUBLE = 2,
6
+ END = 3,
7
+ REPEAT_BEGIN = 4,
8
+ REPEAT_END = 5,
9
+ REPEAT_BOTH = 6,
10
+ NONE = 7
11
+ }
12
+ export declare class Barline extends StaveModifier {
13
+ static get CATEGORY(): string;
14
+ protected widths: Record<string, number>;
15
+ protected paddings: Record<string, number>;
16
+ protected layoutMetricsMap: Record<number, LayoutMetrics>;
17
+ protected thickness: number;
18
+ protected type: BarlineType;
19
+ static get type(): typeof BarlineType;
20
+ static get typeString(): Record<string, BarlineType>;
21
+ constructor(type: BarlineType | string);
22
+ getType(): number;
23
+ setType(type: string | number): this;
24
+ draw(stave: Stave): void;
25
+ drawVerticalBar(stave: Stave, x: number, double_bar?: boolean): void;
26
+ drawVerticalEndBar(stave: Stave, x: number): void;
27
+ drawRepeatBar(stave: Stave, x: number, begin: boolean): void;
28
+ }
@@ -0,0 +1,67 @@
1
+ import { Element } from './element';
2
+ import { FontInfo } from './font';
3
+ import { Stave } from './stave';
4
+ /** StaveConnector implements the connector lines between staves of a system. */
5
+ export declare class StaveConnector extends Element {
6
+ static get CATEGORY(): string;
7
+ static TEXT_FONT: Required<FontInfo>;
8
+ /**
9
+ * SINGLE_LEFT and SINGLE are the same value for compatibility
10
+ * with older versions of vexflow which didn't have right sided
11
+ * stave connectors.
12
+ */
13
+ static readonly type: {
14
+ SINGLE_RIGHT: number;
15
+ SINGLE_LEFT: number;
16
+ SINGLE: number;
17
+ DOUBLE: number;
18
+ BRACE: number;
19
+ BRACKET: number;
20
+ BOLD_DOUBLE_LEFT: number;
21
+ BOLD_DOUBLE_RIGHT: number;
22
+ THIN_DOUBLE: number;
23
+ NONE: number;
24
+ };
25
+ /**
26
+ * Connector type:
27
+ * * "singleRight"
28
+ * * "singleLeft"
29
+ * * "single"
30
+ * * "double"
31
+ * * "brace"
32
+ * * "bracket"
33
+ * * "boldDoubleLeft"
34
+ * * "boldDoubleRight"
35
+ * * "thinDouble"
36
+ * * "none"
37
+ */
38
+ static readonly typeString: Record<string, number>;
39
+ protected width: number;
40
+ protected texts: {
41
+ content: string;
42
+ options: {
43
+ shift_x: number;
44
+ shift_y: number;
45
+ };
46
+ }[];
47
+ protected type: number;
48
+ readonly top_stave: Stave;
49
+ readonly bottom_stave: Stave;
50
+ readonly thickness: number;
51
+ protected x_shift: number;
52
+ constructor(top_stave: Stave, bottom_stave: Stave);
53
+ /**
54
+ * Set type.
55
+ * @param type see {@link StaveConnector.type} & {@link StaveConnector.typeString}
56
+ */
57
+ setType(type: number | string): this;
58
+ /** Set optional associated Text. */
59
+ setText(text: string, options?: {
60
+ shift_x?: number;
61
+ shift_y?: number;
62
+ }): this;
63
+ setXShift(x_shift: number): this;
64
+ getXShift(): number;
65
+ /** Render connector and associated text. */
66
+ draw(): void;
67
+ }