@mcqj/vexflow 0.0.1-alpha.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 (300) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +208 -0
  3. package/build/cjs/vexflow-bravura.js +2 -0
  4. package/build/cjs/vexflow-bravura.js.map +1 -0
  5. package/build/cjs/vexflow-core.js +2 -0
  6. package/build/cjs/vexflow-core.js.map +1 -0
  7. package/build/cjs/vexflow-debug-with-tests.js +43475 -0
  8. package/build/cjs/vexflow-debug-with-tests.js.map +1 -0
  9. package/build/cjs/vexflow-debug.js +19194 -0
  10. package/build/cjs/vexflow-debug.js.map +1 -0
  11. package/build/cjs/vexflow.js +2 -0
  12. package/build/cjs/vexflow.js.map +1 -0
  13. package/build/esm/entry/vexflow-bravura.js +17 -0
  14. package/build/esm/entry/vexflow-core.js +4 -0
  15. package/build/esm/entry/vexflow-debug-with-tests.js +38 -0
  16. package/build/esm/entry/vexflow-debug.js +31 -0
  17. package/build/esm/entry/vexflow.js +31 -0
  18. package/build/esm/package.json +3 -0
  19. package/build/esm/src/accidental.js +330 -0
  20. package/build/esm/src/annotation.js +231 -0
  21. package/build/esm/src/articulation.js +281 -0
  22. package/build/esm/src/barnote.js +56 -0
  23. package/build/esm/src/beam.js +644 -0
  24. package/build/esm/src/bend.js +186 -0
  25. package/build/esm/src/boundingbox.js +59 -0
  26. package/build/esm/src/canvascontext.js +216 -0
  27. package/build/esm/src/chordsymbol.js +325 -0
  28. package/build/esm/src/clef.js +120 -0
  29. package/build/esm/src/clefnote.js +35 -0
  30. package/build/esm/src/crescendo.js +78 -0
  31. package/build/esm/src/curve.js +126 -0
  32. package/build/esm/src/dot.js +129 -0
  33. package/build/esm/src/easyscore.js +374 -0
  34. package/build/esm/src/element.js +409 -0
  35. package/build/esm/src/factory.js +463 -0
  36. package/build/esm/src/flag.js +22 -0
  37. package/build/esm/src/font.js +237 -0
  38. package/build/esm/src/fonts/academico.js +1 -0
  39. package/build/esm/src/fonts/academicobold.js +1 -0
  40. package/build/esm/src/fonts/bravura.js +1 -0
  41. package/build/esm/src/fonts/gonville.js +1 -0
  42. package/build/esm/src/fonts/petaluma.js +1 -0
  43. package/build/esm/src/fonts/petalumascript.js +1 -0
  44. package/build/esm/src/formatter.js +610 -0
  45. package/build/esm/src/fraction.js +170 -0
  46. package/build/esm/src/frethandfinger.js +141 -0
  47. package/build/esm/src/ghostnote.js +50 -0
  48. package/build/esm/src/glyphnote.js +44 -0
  49. package/build/esm/src/glyphs.js +2936 -0
  50. package/build/esm/src/gracenote.js +106 -0
  51. package/build/esm/src/gracenotegroup.js +138 -0
  52. package/build/esm/src/gracetabnote.js +11 -0
  53. package/build/esm/src/index.js +86 -0
  54. package/build/esm/src/keymanager.js +99 -0
  55. package/build/esm/src/keysignature.js +220 -0
  56. package/build/esm/src/keysignote.js +28 -0
  57. package/build/esm/src/metrics.js +237 -0
  58. package/build/esm/src/modifier.js +121 -0
  59. package/build/esm/src/modifiercontext.js +110 -0
  60. package/build/esm/src/multimeasurerest.js +127 -0
  61. package/build/esm/src/music.js +322 -0
  62. package/build/esm/src/note.js +383 -0
  63. package/build/esm/src/notehead.js +89 -0
  64. package/build/esm/src/notesubgroup.js +59 -0
  65. package/build/esm/src/ornament.js +192 -0
  66. package/build/esm/src/parenthesis.js +61 -0
  67. package/build/esm/src/parser.js +164 -0
  68. package/build/esm/src/pedalmarking.js +168 -0
  69. package/build/esm/src/registry.js +81 -0
  70. package/build/esm/src/rendercontext.js +20 -0
  71. package/build/esm/src/renderer.js +112 -0
  72. package/build/esm/src/repeatnote.js +17 -0
  73. package/build/esm/src/stave.js +579 -0
  74. package/build/esm/src/stavebarline.js +237 -0
  75. package/build/esm/src/staveconnector.js +180 -0
  76. package/build/esm/src/stavehairpin.js +115 -0
  77. package/build/esm/src/staveline.js +199 -0
  78. package/build/esm/src/stavemodifier.js +56 -0
  79. package/build/esm/src/stavenote.js +861 -0
  80. package/build/esm/src/staverepetition.js +120 -0
  81. package/build/esm/src/stavesection.js +36 -0
  82. package/build/esm/src/stavetempo.js +110 -0
  83. package/build/esm/src/stavetext.js +55 -0
  84. package/build/esm/src/stavetie.js +186 -0
  85. package/build/esm/src/stavevolta.js +53 -0
  86. package/build/esm/src/stem.js +133 -0
  87. package/build/esm/src/stemmablenote.js +193 -0
  88. package/build/esm/src/stringnumber.js +228 -0
  89. package/build/esm/src/strokes.js +164 -0
  90. package/build/esm/src/svgcontext.js +402 -0
  91. package/build/esm/src/system.js +166 -0
  92. package/build/esm/src/tables.js +696 -0
  93. package/build/esm/src/tabnote.js +278 -0
  94. package/build/esm/src/tabslide.js +68 -0
  95. package/build/esm/src/tabstave.js +17 -0
  96. package/build/esm/src/tabtie.js +19 -0
  97. package/build/esm/src/textbracket.js +128 -0
  98. package/build/esm/src/textdynamics.js +53 -0
  99. package/build/esm/src/textnote.js +116 -0
  100. package/build/esm/src/tickable.js +224 -0
  101. package/build/esm/src/tickcontext.js +189 -0
  102. package/build/esm/src/timesignature.js +169 -0
  103. package/build/esm/src/timesignote.js +30 -0
  104. package/build/esm/src/tremolo.js +30 -0
  105. package/build/esm/src/tuning.js +55 -0
  106. package/build/esm/src/tuplet.js +258 -0
  107. package/build/esm/src/typeguard.js +30 -0
  108. package/build/esm/src/util.js +67 -0
  109. package/build/esm/src/version.js +3 -0
  110. package/build/esm/src/vexflow.js +309 -0
  111. package/build/esm/src/vibrato.js +68 -0
  112. package/build/esm/src/vibratobracket.js +44 -0
  113. package/build/esm/src/voice.js +178 -0
  114. package/build/esm/src/web.js +15 -0
  115. package/build/esm/tests/accidental_tests.js +1055 -0
  116. package/build/esm/tests/annotation_tests.js +381 -0
  117. package/build/esm/tests/articulation_tests.js +432 -0
  118. package/build/esm/tests/auto_beam_formatting_tests.js +551 -0
  119. package/build/esm/tests/barline_tests.js +52 -0
  120. package/build/esm/tests/beam_tests.js +669 -0
  121. package/build/esm/tests/bend_tests.js +223 -0
  122. package/build/esm/tests/boundingbox_tests.js +53 -0
  123. package/build/esm/tests/browser_test_runner.js +128 -0
  124. package/build/esm/tests/chordsymbol_tests.js +405 -0
  125. package/build/esm/tests/clef_tests.js +141 -0
  126. package/build/esm/tests/crossbeam_tests.js +306 -0
  127. package/build/esm/tests/curve_tests.js +152 -0
  128. package/build/esm/tests/demo_petzold_tests.js +335 -0
  129. package/build/esm/tests/dot_tests.js +119 -0
  130. package/build/esm/tests/easyscore_tests.js +488 -0
  131. package/build/esm/tests/factory_tests.js +44 -0
  132. package/build/esm/tests/font_tests.js +134 -0
  133. package/build/esm/tests/formatter/framestack.js +61 -0
  134. package/build/esm/tests/formatter/tests.js +251 -0
  135. package/build/esm/tests/formatter_tests.js +759 -0
  136. package/build/esm/tests/fraction_tests.js +72 -0
  137. package/build/esm/tests/ghostnote_tests.js +77 -0
  138. package/build/esm/tests/glyphnote_tests.js +119 -0
  139. package/build/esm/tests/gracenote_tests.js +414 -0
  140. package/build/esm/tests/gracetabnote_tests.js +79 -0
  141. package/build/esm/tests/index.js +68 -0
  142. package/build/esm/tests/key_clef_tests.js +106 -0
  143. package/build/esm/tests/keymanager_tests.js +68 -0
  144. package/build/esm/tests/keysignature_tests.js +322 -0
  145. package/build/esm/tests/mocks.js +70 -0
  146. package/build/esm/tests/modifier_tests.js +24 -0
  147. package/build/esm/tests/multimeasurerest_tests.js +141 -0
  148. package/build/esm/tests/music_tests.js +161 -0
  149. package/build/esm/tests/node_test_runner.js +31 -0
  150. package/build/esm/tests/notehead_tests.js +224 -0
  151. package/build/esm/tests/notesubgroup_tests.js +149 -0
  152. package/build/esm/tests/offscreencanvas_tests.js +47 -0
  153. package/build/esm/tests/ornament_tests.js +333 -0
  154. package/build/esm/tests/parser_tests.js +122 -0
  155. package/build/esm/tests/pedalmarking_tests.js +91 -0
  156. package/build/esm/tests/percussion_tests.js +184 -0
  157. package/build/esm/tests/playwright/flow.spec.js +127 -0
  158. package/build/esm/tests/playwright/visual_helpers.js +30 -0
  159. package/build/esm/tests/registry_tests.js +64 -0
  160. package/build/esm/tests/renderer_tests.js +113 -0
  161. package/build/esm/tests/rests_tests.js +266 -0
  162. package/build/esm/tests/rhythm_tests.js +357 -0
  163. package/build/esm/tests/stave_tests.js +570 -0
  164. package/build/esm/tests/staveconnector_tests.js +402 -0
  165. package/build/esm/tests/stavehairpin_tests.js +90 -0
  166. package/build/esm/tests/staveline_tests.js +123 -0
  167. package/build/esm/tests/stavemodifier_tests.js +51 -0
  168. package/build/esm/tests/stavenote_tests.js +936 -0
  169. package/build/esm/tests/stavetie_tests.js +137 -0
  170. package/build/esm/tests/stringnumber_tests.js +283 -0
  171. package/build/esm/tests/strokes_tests.js +289 -0
  172. package/build/esm/tests/style_tests.js +96 -0
  173. package/build/esm/tests/tabnote_tests.js +462 -0
  174. package/build/esm/tests/tabslide_tests.js +133 -0
  175. package/build/esm/tests/tabstave_tests.js +24 -0
  176. package/build/esm/tests/tabtie_tests.js +171 -0
  177. package/build/esm/tests/test_runner.js +23 -0
  178. package/build/esm/tests/textbracket_tests.js +100 -0
  179. package/build/esm/tests/textnote_tests.js +216 -0
  180. package/build/esm/tests/threevoice_tests.js +132 -0
  181. package/build/esm/tests/tickcontext_tests.js +36 -0
  182. package/build/esm/tests/timesignature_tests.js +173 -0
  183. package/build/esm/tests/tremolo_tests.js +34 -0
  184. package/build/esm/tests/tuning_tests.js +56 -0
  185. package/build/esm/tests/tuplet_tests.js +711 -0
  186. package/build/esm/tests/typeguard_tests.js +82 -0
  187. package/build/esm/tests/unison_tests.js +74 -0
  188. package/build/esm/tests/vexflow_test_helpers.js +318 -0
  189. package/build/esm/tests/vf_prefix_tests.js +101 -0
  190. package/build/esm/tests/vibrato_tests.js +93 -0
  191. package/build/esm/tests/vibratobracket_tests.js +45 -0
  192. package/build/esm/tests/vitest/job-0.test.js +2 -0
  193. package/build/esm/tests/vitest/job-1.test.js +2 -0
  194. package/build/esm/tests/vitest/job-2.test.js +2 -0
  195. package/build/esm/tests/vitest/job-3.test.js +2 -0
  196. package/build/esm/tests/vitest/run.js +5 -0
  197. package/build/esm/tests/vitest.setup.js +44 -0
  198. package/build/esm/tests/voice_tests.js +69 -0
  199. package/build/types/entry/vexflow-bravura.d.ts +3 -0
  200. package/build/types/entry/vexflow-core.d.ts +3 -0
  201. package/build/types/entry/vexflow-debug.d.ts +3 -0
  202. package/build/types/entry/vexflow.d.ts +3 -0
  203. package/build/types/src/accidental.d.ts +60 -0
  204. package/build/types/src/annotation.d.ts +58 -0
  205. package/build/types/src/articulation.d.ts +78 -0
  206. package/build/types/src/barnote.d.ts +29 -0
  207. package/build/types/src/beam.d.ts +158 -0
  208. package/build/types/src/bend.d.ts +67 -0
  209. package/build/types/src/boundingbox.d.ts +42 -0
  210. package/build/types/src/canvascontext.d.ts +93 -0
  211. package/build/types/src/chordsymbol.d.ts +109 -0
  212. package/build/types/src/clef.d.ts +38 -0
  213. package/build/types/src/clefnote.d.ts +17 -0
  214. package/build/types/src/crescendo.d.ts +26 -0
  215. package/build/types/src/curve.d.ts +42 -0
  216. package/build/types/src/dot.d.ts +19 -0
  217. package/build/types/src/easyscore.d.ts +152 -0
  218. package/build/types/src/element.d.ts +278 -0
  219. package/build/types/src/factory.d.ts +273 -0
  220. package/build/types/src/flag.d.ts +12 -0
  221. package/build/types/src/font.d.ts +96 -0
  222. package/build/types/src/fonts/academico.d.ts +1 -0
  223. package/build/types/src/fonts/academicobold.d.ts +1 -0
  224. package/build/types/src/fonts/bravura.d.ts +1 -0
  225. package/build/types/src/fonts/gonville.d.ts +1 -0
  226. package/build/types/src/fonts/petaluma.d.ts +1 -0
  227. package/build/types/src/fonts/petalumascript.d.ts +1 -0
  228. package/build/types/src/formatter.d.ts +226 -0
  229. package/build/types/src/fraction.d.ts +65 -0
  230. package/build/types/src/frethandfinger.d.ts +19 -0
  231. package/build/types/src/ghostnote.d.ts +16 -0
  232. package/build/types/src/glyphnote.d.ts +14 -0
  233. package/build/types/src/glyphs.d.ts +2935 -0
  234. package/build/types/src/gracenote.d.ts +17 -0
  235. package/build/types/src/gracenotegroup.d.ts +33 -0
  236. package/build/types/src/gracetabnote.d.ts +5 -0
  237. package/build/types/src/index.d.ts +86 -0
  238. package/build/types/src/keymanager.d.ts +25 -0
  239. package/build/types/src/keysignature.d.ts +50 -0
  240. package/build/types/src/keysignote.d.ts +11 -0
  241. package/build/types/src/metrics.d.ts +25 -0
  242. package/build/types/src/modifier.d.ts +90 -0
  243. package/build/types/src/modifiercontext.d.ts +48 -0
  244. package/build/types/src/multimeasurerest.d.ts +61 -0
  245. package/build/types/src/music.d.ts +91 -0
  246. package/build/types/src/note.d.ts +232 -0
  247. package/build/types/src/notehead.d.ts +50 -0
  248. package/build/types/src/notesubgroup.d.ts +18 -0
  249. package/build/types/src/ornament.d.ts +71 -0
  250. package/build/types/src/parenthesis.d.ts +21 -0
  251. package/build/types/src/parser.d.ts +45 -0
  252. package/build/types/src/pedalmarking.d.ts +63 -0
  253. package/build/types/src/registry.d.ts +40 -0
  254. package/build/types/src/rendercontext.d.ts +59 -0
  255. package/build/types/src/renderer.d.ts +35 -0
  256. package/build/types/src/repeatnote.d.ts +6 -0
  257. package/build/types/src/stave.d.ts +181 -0
  258. package/build/types/src/stavebarline.d.ts +38 -0
  259. package/build/types/src/staveconnector.d.ts +53 -0
  260. package/build/types/src/stavehairpin.d.ts +56 -0
  261. package/build/types/src/staveline.d.ts +49 -0
  262. package/build/types/src/stavemodifier.d.ts +35 -0
  263. package/build/types/src/stavenote.d.ts +150 -0
  264. package/build/types/src/staverepetition.d.ts +30 -0
  265. package/build/types/src/stavesection.d.ts +8 -0
  266. package/build/types/src/stavetempo.d.ts +43 -0
  267. package/build/types/src/stavetext.d.ts +11 -0
  268. package/build/types/src/stavetie.d.ts +104 -0
  269. package/build/types/src/stavevolta.d.ts +15 -0
  270. package/build/types/src/stem.d.ts +58 -0
  271. package/build/types/src/stemmablenote.d.ts +39 -0
  272. package/build/types/src/stringnumber.d.ts +26 -0
  273. package/build/types/src/strokes.d.ts +35 -0
  274. package/build/types/src/svgcontext.d.ts +135 -0
  275. package/build/types/src/system.d.ts +121 -0
  276. package/build/types/src/tables.d.ts +86 -0
  277. package/build/types/src/tabnote.d.ts +45 -0
  278. package/build/types/src/tabslide.d.ts +36 -0
  279. package/build/types/src/tabstave.d.ts +7 -0
  280. package/build/types/src/tabtie.d.ts +18 -0
  281. package/build/types/src/textbracket.d.ts +45 -0
  282. package/build/types/src/textdynamics.d.ts +34 -0
  283. package/build/types/src/textnote.d.ts +48 -0
  284. package/build/types/src/tickable.d.ts +149 -0
  285. package/build/types/src/tickcontext.d.ts +112 -0
  286. package/build/types/src/timesignature.d.ts +75 -0
  287. package/build/types/src/timesignote.d.ts +11 -0
  288. package/build/types/src/tremolo.d.ts +12 -0
  289. package/build/types/src/tuning.d.ts +23 -0
  290. package/build/types/src/tuplet.d.ts +98 -0
  291. package/build/types/src/typeguard.d.ts +100 -0
  292. package/build/types/src/util.d.ts +42 -0
  293. package/build/types/src/version.d.ts +3 -0
  294. package/build/types/src/vexflow.d.ts +261 -0
  295. package/build/types/src/vibrato.d.ts +20 -0
  296. package/build/types/src/vibratobracket.d.ts +28 -0
  297. package/build/types/src/voice.d.ts +109 -0
  298. package/build/types/src/web.d.ts +2 -0
  299. package/package.json +145 -0
  300. package/tests/flow.html +256 -0
@@ -0,0 +1,42 @@
1
+ export interface Bounds {
2
+ x: number;
3
+ y: number;
4
+ w: number;
5
+ h: number;
6
+ }
7
+ export declare class BoundingBox implements Bounds {
8
+ x: number;
9
+ y: number;
10
+ w: number;
11
+ h: number;
12
+ /**
13
+ * Create a new copy.
14
+ */
15
+ static copy(that: BoundingBox): BoundingBox;
16
+ constructor(x: number, y: number, w: number, h: number);
17
+ /** Get x position. */
18
+ getX(): number;
19
+ /** Get y position. */
20
+ getY(): number;
21
+ /** Get width. */
22
+ getW(): number;
23
+ /** Get height. */
24
+ getH(): number;
25
+ /** Set x position. */
26
+ setX(x: number): this;
27
+ /** Set y position. */
28
+ setY(y: number): this;
29
+ /** Set width. */
30
+ setW(w: number): this;
31
+ /** Set height. */
32
+ setH(h: number): this;
33
+ /** Move to position. */
34
+ move(x: number, y: number): this;
35
+ /** Clone. */
36
+ clone(): BoundingBox;
37
+ /**
38
+ * Merge my box with given box. Creates a bigger bounding box unless
39
+ * the given box is contained in this one.
40
+ */
41
+ mergeWith(boundingBox: BoundingBox): this;
42
+ }
@@ -0,0 +1,93 @@
1
+ import { FontInfo } from './font';
2
+ import { RenderContext, TextMeasure } from './rendercontext';
3
+ interface OffscreenCanvas extends EventTarget {
4
+ width: number;
5
+ height: number;
6
+ }
7
+ interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, CanvasTextDrawingStyles, CanvasPath {
8
+ readonly canvas: OffscreenCanvas;
9
+ }
10
+ /**
11
+ * A rendering context for the Canvas backend. This class serves as a proxy for the
12
+ * underlying CanvasRenderingContext2D object, part of the browser's API.
13
+ */
14
+ export declare class CanvasContext extends RenderContext {
15
+ /** The 2D rendering context from the Canvas API. Forward method calls to this object. */
16
+ context2D: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
17
+ curTransfrom: DOMMatrix;
18
+ /**
19
+ * The HTMLCanvasElement or OffscreenCanvas that is associated with the above context.
20
+ * If there was no associated `<canvas>` element, just store the default WIDTH / HEIGHT.
21
+ */
22
+ canvas: HTMLCanvasElement | OffscreenCanvas | {
23
+ width: number;
24
+ height: number;
25
+ };
26
+ /** Height of one line of text (in pixels). */
27
+ textHeight: number;
28
+ static get WIDTH(): number;
29
+ static get HEIGHT(): number;
30
+ static get CANVAS_BROWSER_SIZE_LIMIT(): number;
31
+ /**
32
+ * Ensure that width and height do not exceed the browser limit.
33
+ * @returns array of [width, height] clamped to the browser limit.
34
+ */
35
+ static sanitizeCanvasDims(width: number, height: number): [number, number];
36
+ constructor(context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D);
37
+ /**
38
+ * Set all pixels to transparent black rgba(0,0,0,0).
39
+ */
40
+ clear(): void;
41
+ openGroup(cls?: string, id?: string): any;
42
+ closeGroup(): void;
43
+ openRotation(angleDegrees: number, x: number, y: number): void;
44
+ closeRotation(): void;
45
+ add(child: any): void;
46
+ setFillStyle(style: string): this;
47
+ /** CanvasContext ignores `setBackgroundFillStyle()`. */
48
+ setBackgroundFillStyle(style: string): this;
49
+ setStrokeStyle(style: string): this;
50
+ setShadowColor(color: string): this;
51
+ setShadowBlur(blur: number): this;
52
+ setLineWidth(width: number): this;
53
+ setLineCap(capType: CanvasLineCap): this;
54
+ setLineDash(dash: number[]): this;
55
+ scale(x: number, y: number): this;
56
+ resize(width: number, height: number, devicePixelRatio?: number): this;
57
+ rect(x: number, y: number, width: number, height: number): this;
58
+ fillRect(x: number, y: number, width: number, height: number): this;
59
+ pointerRect(x: number, y: number, width: number, height: number): this;
60
+ /**
61
+ * Set the pixels in a rectangular area to transparent black rgba(0,0,0,0).
62
+ */
63
+ clearRect(x: number, y: number, width: number, height: number): this;
64
+ beginPath(): this;
65
+ moveTo(x: number, y: number): this;
66
+ lineTo(x: number, y: number): this;
67
+ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): this;
68
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): this;
69
+ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise: boolean): this;
70
+ fill(): this;
71
+ stroke(): this;
72
+ closePath(): this;
73
+ measureText(text: string): TextMeasure;
74
+ fillText(text: string, x: number, y: number): this;
75
+ save(): this;
76
+ restore(): this;
77
+ set fillStyle(style: string | CanvasGradient | CanvasPattern);
78
+ get fillStyle(): string | CanvasGradient | CanvasPattern;
79
+ set strokeStyle(style: string | CanvasGradient | CanvasPattern);
80
+ get strokeStyle(): string | CanvasGradient | CanvasPattern;
81
+ /**
82
+ * @param f is 1) a `FontInfo` object or
83
+ * 2) a string formatted as CSS font shorthand (e.g., 'bold 10pt Arial') or
84
+ * 3) a string representing the font family (one of `size`, `weight`, or `style` must also be provided).
85
+ * @param size a string specifying the font size and unit (e.g., '16pt'), or a number (the unit is assumed to be 'pt').
86
+ * @param weight is a string (e.g., 'bold', 'normal') or a number (100, 200, ... 900).
87
+ * @param style is a string (e.g., 'italic', 'normal').
88
+ */
89
+ setFont(f?: string | FontInfo, size?: string | number, weight?: string | number, style?: string): this;
90
+ /** Return a string of the form `'italic bold 15pt Arial'` */
91
+ getFont(): string;
92
+ }
93
+ export {};
@@ -0,0 +1,109 @@
1
+ import { BoundingBox } from './boundingbox';
2
+ import { Element } from './element';
3
+ import { Modifier } from './modifier';
4
+ import { ModifierContextState } from './modifiercontext';
5
+ export declare class ChordSymbolBlock extends Element {
6
+ symbolModifier: SymbolModifiers;
7
+ vAlign: boolean;
8
+ constructor(text: string, symbolModifier: SymbolModifiers, xShift: number, yShift: number, vAlign: boolean);
9
+ isSuperscript(): boolean;
10
+ isSubscript(): boolean;
11
+ }
12
+ export declare enum ChordSymbolHorizontalJustify {
13
+ LEFT = 1,
14
+ CENTER = 2,
15
+ RIGHT = 3,
16
+ CENTER_STEM = 4
17
+ }
18
+ export declare enum ChordSymbolVerticalJustify {
19
+ TOP = 1,
20
+ BOTTOM = 2
21
+ }
22
+ export declare enum SymbolModifiers {
23
+ NONE = 1,
24
+ SUBSCRIPT = 2,
25
+ SUPERSCRIPT = 3
26
+ }
27
+ /**
28
+ * ChordSymbol is a modifier that creates a chord symbol above/below a chord.
29
+ * As a modifier, it is attached to an existing note.
30
+ */
31
+ export declare class ChordSymbol extends Modifier {
32
+ static DEBUG: boolean;
33
+ static get CATEGORY(): string;
34
+ static readonly HorizontalJustify: typeof ChordSymbolHorizontalJustify;
35
+ static readonly HorizontalJustifyString: Record<string, ChordSymbolHorizontalJustify>;
36
+ static readonly VerticalJustify: typeof ChordSymbolVerticalJustify;
37
+ static readonly VerticalJustifyString: Record<string, ChordSymbolVerticalJustify>;
38
+ static get superSubRatio(): number;
39
+ static get spacingBetweenBlocks(): number;
40
+ static get superscriptOffset(): number;
41
+ static get subscriptOffset(): number;
42
+ static readonly glyphs: Record<string, string>;
43
+ static readonly symbolModifiers: typeof SymbolModifiers;
44
+ static get minPadding(): number;
45
+ /**
46
+ * Estimate the width of the whole chord symbol, based on the sum of the widths of the individual blocks.
47
+ * Estimate how many lines above/below the staff we need.
48
+ */
49
+ static format(symbols: ChordSymbol[], state: ModifierContextState): boolean;
50
+ protected symbolBlocks: ChordSymbolBlock[];
51
+ protected horizontal: number;
52
+ protected vertical: number;
53
+ protected reportWidth: boolean;
54
+ constructor();
55
+ /**
56
+ * The offset is specified in `em`. Scale this value by the font size in pixels.
57
+ */
58
+ get superscriptOffset(): number;
59
+ get subscriptOffset(): number;
60
+ setReportWidth(value: boolean): this;
61
+ getReportWidth(): boolean;
62
+ /**
63
+ * ChordSymbol allows multiple blocks so we can mix glyphs and font text.
64
+ * Each block can have its own vertical orientation.
65
+ */
66
+ getSymbolBlock(params?: Partial<{
67
+ text: string;
68
+ symbolModifier: SymbolModifiers;
69
+ }>): ChordSymbolBlock;
70
+ /** Add a symbol to this chord, could be text, glyph or line. */
71
+ addSymbolBlock(parameters: Partial<{
72
+ text: string;
73
+ symbolModifier: SymbolModifiers;
74
+ }>): this;
75
+ /** Add a text block. */
76
+ addText(text: string, parameters?: Partial<{
77
+ symbolModifier: SymbolModifiers;
78
+ }>): this;
79
+ /** Add a text block with superscript modifier. */
80
+ addTextSuperscript(text: string): this;
81
+ /** Add a text block with subscript modifier. */
82
+ addTextSubscript(text: string): this;
83
+ /** Add a glyph block with superscript modifier. */
84
+ addGlyphSuperscript(glyph: string): this;
85
+ /** Add a glyph block. */
86
+ addGlyph(glyph: string, params?: Partial<{
87
+ symbolModifier: SymbolModifiers;
88
+ }>): this;
89
+ /**
90
+ * Add a glyph for each character in 'text'. If the glyph is not available, use text from the font.
91
+ * e.g. `addGlyphOrText('(+5#11)')` will use text for the '5' and '11', and glyphs for everything else.
92
+ */
93
+ addGlyphOrText(text: string, params?: Partial<{
94
+ symbolModifier: SymbolModifiers;
95
+ }>): this;
96
+ /** Add a line of the given width, used as a continuation of the previous symbol in analysis, or lyrics, etc. */
97
+ addLine(params?: Partial<{
98
+ symbolModifier: SymbolModifiers;
99
+ }>): this;
100
+ /** Set vertical position of text (above or below stave). */
101
+ setVertical(vj: ChordSymbolVerticalJustify | string | number): this;
102
+ getVertical(): number;
103
+ /** Set horizontal justification. */
104
+ setHorizontal(hj: ChordSymbolHorizontalJustify | string | number): this;
105
+ getHorizontal(): number;
106
+ /** Render text and glyphs above/below the note. */
107
+ draw(): void;
108
+ getBoundingBox(): BoundingBox;
109
+ }
@@ -0,0 +1,38 @@
1
+ import { Stave } from './stave';
2
+ import { StaveModifier } from './stavemodifier';
3
+ /**
4
+ * Clef implements various types of clefs that can be rendered on a stave.
5
+ *
6
+ * See `tests/clef_tests.ts` for usage examples.
7
+ */
8
+ export declare class Clef extends StaveModifier {
9
+ /** To enable logging for this class, set `VexFlow.Clef.DEBUG` to `true`. */
10
+ static DEBUG: boolean;
11
+ static get CATEGORY(): string;
12
+ /**
13
+ * The attribute `clef` must be a key from
14
+ * `Clef.types`
15
+ */
16
+ code: string;
17
+ line: number;
18
+ protected size: string;
19
+ protected type: string;
20
+ /**
21
+ * Every clef name is associated with a glyph code from the font file
22
+ * and a default stave line number.
23
+ */
24
+ static get types(): Record<string, {
25
+ code: string;
26
+ line: number;
27
+ }>;
28
+ /** Create a new clef. */
29
+ constructor(type: string, size?: string, annotation?: string);
30
+ /** Set clef type, size and annotation. */
31
+ setType(type: string, size?: string, annotation?: string): this;
32
+ /** Get point for clefs. */
33
+ static getPoint(size?: string): number;
34
+ /** Set associated stave. */
35
+ setStave(stave: Stave): this;
36
+ /** Render clef. */
37
+ draw(): void;
38
+ }
@@ -0,0 +1,17 @@
1
+ import { BoundingBox } from './boundingbox';
2
+ import { Clef } from './clef';
3
+ import { Note } from './note';
4
+ /** ClefNote implements clef annotations in measures. */
5
+ export declare class ClefNote extends Note {
6
+ static get CATEGORY(): string;
7
+ protected clef: Clef;
8
+ constructor(type: string, size?: string, annotation?: string);
9
+ /** Set clef type, size and annotation. */
10
+ setType(type: string, size: string, annotation?: string): this;
11
+ /** Get associated clef. */
12
+ getClef(): Clef;
13
+ preFormat(): this;
14
+ /** Render clef note. */
15
+ draw(): void;
16
+ getBoundingBox(): BoundingBox;
17
+ }
@@ -0,0 +1,26 @@
1
+ import { Note, NoteStruct } from './note';
2
+ export interface CrescendoParams {
3
+ reverse: boolean;
4
+ height: number;
5
+ y: number;
6
+ beginX: number;
7
+ endX: number;
8
+ }
9
+ export declare class Crescendo extends Note {
10
+ static DEBUG: boolean;
11
+ /** Crescendo category string. */
12
+ static get CATEGORY(): string;
13
+ protected decrescendo: boolean;
14
+ protected line: number;
15
+ protected options: {
16
+ extendLeft: number;
17
+ extendRight: number;
18
+ yShift: number;
19
+ };
20
+ constructor(noteStruct: NoteStruct);
21
+ setLine(line: number): this;
22
+ setHeight(height: number): this;
23
+ setDecrescendo(decresc: boolean): this;
24
+ preFormat(): this;
25
+ draw(): void;
26
+ }
@@ -0,0 +1,42 @@
1
+ import { Element } from './element';
2
+ import { Note } from './note';
3
+ export interface CurveOptions {
4
+ /** Two control points for the bezier curves. */
5
+ cps?: {
6
+ x: number;
7
+ y: number;
8
+ }[];
9
+ thickness?: number;
10
+ xShift?: number;
11
+ yShift?: number;
12
+ position?: string | number;
13
+ positionEnd?: string | number;
14
+ invert?: boolean;
15
+ openingDirection?: 'up' | 'down' | 'auto';
16
+ }
17
+ export declare enum CurvePosition {
18
+ NEAR_HEAD = 1,
19
+ NEAR_TOP = 2
20
+ }
21
+ export declare class Curve extends Element {
22
+ static get CATEGORY(): string;
23
+ renderOptions: Required<CurveOptions>;
24
+ protected from?: Note;
25
+ protected to?: Note;
26
+ static get Position(): typeof CurvePosition;
27
+ static get PositionString(): Record<string, number>;
28
+ constructor(from: Note | undefined, to: Note | undefined, options: CurveOptions);
29
+ setNotes(from: Note | undefined, to: Note | undefined): this;
30
+ /**
31
+ * @return {boolean} Returns true if this is a partial bar.
32
+ */
33
+ isPartial(): boolean;
34
+ renderCurve(params: {
35
+ lastY: number;
36
+ lastX: number;
37
+ firstY: number;
38
+ firstX: number;
39
+ direction: number;
40
+ }): void;
41
+ draw(): boolean;
42
+ }
@@ -0,0 +1,19 @@
1
+ import { Modifier } from './modifier';
2
+ import { ModifierContextState } from './modifiercontext';
3
+ import { Note } from './note';
4
+ export declare class Dot extends Modifier {
5
+ static get CATEGORY(): string;
6
+ protected dotShiftY: number;
7
+ /** Returns the dots associated to a Note. */
8
+ static getDots(note: Note): Dot[];
9
+ /** Add a dot on the specified keys to the notes. */
10
+ static buildAndAttach(notes: Note[], options?: {
11
+ index?: number;
12
+ all?: boolean;
13
+ }): void;
14
+ static format(dots: Dot[], state: ModifierContextState): boolean;
15
+ constructor();
16
+ setNote(note: Note): this;
17
+ setDotShiftY(y: number): this;
18
+ draw(): void;
19
+ }
@@ -0,0 +1,152 @@
1
+ import { Accidental } from './accidental';
2
+ import { PartialBeamDirection } from './beam';
3
+ import { Factory } from './factory';
4
+ import { Note } from './note';
5
+ import { Grammar, Match, Parser, Result, Rule, RuleFunction } from './parser';
6
+ import { RenderContext } from './rendercontext';
7
+ import { StemmableNote } from './stemmablenote';
8
+ import { TupletOptions } from './tuplet';
9
+ import { Voice } from './voice';
10
+ export type CommitHook = (obj: any, note: StemmableNote, builder: Builder) => void;
11
+ export declare class EasyScoreGrammar implements Grammar {
12
+ builder: Builder;
13
+ constructor(builder: Builder);
14
+ begin(): RuleFunction;
15
+ LINE(): Rule;
16
+ PIECE(): Rule;
17
+ PIECES(): Rule;
18
+ PARAMS(): Rule;
19
+ CHORDORNOTE(): Rule;
20
+ CHORD(): Rule;
21
+ NOTES(): Rule;
22
+ NOTE(): Rule;
23
+ SINGLENOTE(): Rule;
24
+ ACCIDENTAL(): Rule;
25
+ DOTS(): Rule;
26
+ TYPE(): Rule;
27
+ DURATION(): Rule;
28
+ OPTS(): Rule;
29
+ KEYVALS(): Rule;
30
+ KEYVAL(): Rule;
31
+ VAL(): Rule;
32
+ KEY(): Rule;
33
+ DVAL(): Rule;
34
+ SVAL(): Rule;
35
+ NOTENAME(): Rule;
36
+ OCTAVE(): Rule;
37
+ ACCIDENTALS(): Rule;
38
+ MICROTONES(): Rule;
39
+ DURATIONS(): Rule;
40
+ TYPES(): Rule;
41
+ LPAREN(): Rule;
42
+ RPAREN(): Rule;
43
+ COMMA(): Rule;
44
+ DOT(): Rule;
45
+ SLASH(): Rule;
46
+ MAYBESLASH(): Rule;
47
+ EQUALS(): Rule;
48
+ LBRACKET(): Rule;
49
+ RBRACKET(): Rule;
50
+ EOL(): Rule;
51
+ }
52
+ export interface NotePiece {
53
+ key: string;
54
+ accid?: string | null;
55
+ octave?: string;
56
+ }
57
+ export declare class Piece {
58
+ chord: NotePiece[];
59
+ duration: string;
60
+ dots: number;
61
+ type?: string;
62
+ options: {
63
+ [x: string]: string;
64
+ };
65
+ constructor(duration: string);
66
+ }
67
+ export interface BuilderElements {
68
+ notes: StemmableNote[];
69
+ accidentals: (Accidental | undefined)[][];
70
+ }
71
+ export interface BuilderOptions extends Record<string, any> {
72
+ stem?: string;
73
+ clef?: string;
74
+ }
75
+ export declare class Builder {
76
+ factory: Factory;
77
+ elements: BuilderElements;
78
+ options: BuilderOptions;
79
+ piece: Piece;
80
+ commitHooks: CommitHook[];
81
+ rollingDuration: string;
82
+ constructor(factory: Factory);
83
+ reset(options?: BuilderOptions): void;
84
+ getFactory(): Factory;
85
+ getElements(): BuilderElements;
86
+ addCommitHook(commitHook: CommitHook): void;
87
+ resetPiece(): void;
88
+ setNoteDots(dots: Match[]): void;
89
+ setNoteDuration(duration?: string): void;
90
+ setNoteType(type?: string): void;
91
+ addNoteOption(key: string, value: string): void;
92
+ addNote(key?: string, accid?: string | null, octave?: string): void;
93
+ addSingleNote(key: string, accid?: string | null, octave?: string): void;
94
+ addChord(notes: Match[]): void;
95
+ commitPiece(): void;
96
+ }
97
+ export interface EasyScoreOptions {
98
+ factory?: Factory;
99
+ builder?: Builder;
100
+ commitHooks?: CommitHook[];
101
+ throwOnError?: boolean;
102
+ }
103
+ export interface EasyScoreDefaults extends Record<string, any> {
104
+ clef?: string;
105
+ time?: string;
106
+ stem?: string;
107
+ }
108
+ /**
109
+ * EasyScore implements a parser for a simple language to generate VexFlow objects.
110
+ */
111
+ export declare class EasyScore {
112
+ static DEBUG: boolean;
113
+ defaults: EasyScoreDefaults;
114
+ options: EasyScoreOptions;
115
+ factory: Factory;
116
+ builder: Builder;
117
+ grammar: EasyScoreGrammar;
118
+ parser: Parser;
119
+ constructor(options?: EasyScoreOptions);
120
+ /**
121
+ * Set the score defaults.
122
+ * clef must be set appropriately to avoid errors when adding Staves.
123
+ * @param defaults.clef default clef ( treble | bass ...) see {@link Clef.types}
124
+ * @param defaults.time default time signature ( 4/4 | 9/8 ...)
125
+ * @param defaults.stem default stem arrangement (auto | up | down)
126
+ * @returns this
127
+ */
128
+ set(defaults: EasyScoreDefaults): this;
129
+ /**
130
+ * @param options.factory is required.
131
+ * @returns this
132
+ */
133
+ setOptions(options: EasyScoreOptions): this;
134
+ setContext(context: RenderContext): this;
135
+ parse(line: string, options?: BuilderOptions): Result;
136
+ beam(notes: StemmableNote[], options?: {
137
+ autoStem?: boolean;
138
+ secondaryBeamBreaks?: number[];
139
+ partialBeamDirections?: {
140
+ [noteIndex: number]: PartialBeamDirection;
141
+ };
142
+ }): StemmableNote[];
143
+ tuplet(notes: StemmableNote[], options?: TupletOptions): StemmableNote[];
144
+ notes(line: string, options?: BuilderOptions): StemmableNote[];
145
+ voice(notes: Note[], options?: {
146
+ time?: string;
147
+ options?: {
148
+ softmaxFactor: number;
149
+ };
150
+ }): Voice;
151
+ addCommitHook(commitHook: CommitHook): void;
152
+ }