@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,36 @@
1
+ import { TieNotes } from './stavetie';
2
+ import { TabTie } from './tabtie';
3
+ export declare class TabSlide extends TabTie {
4
+ static get CATEGORY(): string;
5
+ static get SLIDE_UP(): number;
6
+ static get SLIDE_DOWN(): number;
7
+ static createSlideUp(notes: TieNotes): TabSlide;
8
+ static createSlideDown(notes: TieNotes): TabSlide;
9
+ /**
10
+ * @param notes is a struct of the form:
11
+ * {
12
+ * firstNote: Note,
13
+ * lastNote: Note,
14
+ * firstIndexes: [n1, n2, n3],
15
+ * lastIndexes: [n1, n2, n3]
16
+ * }
17
+ * @param notes.firstNote the starting note of the slide
18
+ * @param notes.lastNote the ending note of the slide
19
+ * @param notes.firstIndexes specifies which string + fret positions of the TabNote are used in this slide. zero indexed.
20
+ * @param notes.lastIndexes currently unused. we assume it's the same as firstIndexes.
21
+ *
22
+ * @param direction TabSlide.SLIDE_UP or TabSlide.SLIDE_DOWN
23
+ */
24
+ constructor(notes: TieNotes, direction?: number);
25
+ /**
26
+ * @param params.firstX is specified in pixels.
27
+ * @param params.lastX is specified in pixels.
28
+ */
29
+ renderTie(params: {
30
+ direction: number;
31
+ firstX: number;
32
+ lastX: number;
33
+ lastYs: number[];
34
+ firstYs: number[];
35
+ }): void;
36
+ }
@@ -0,0 +1,7 @@
1
+ import { Stave, StaveOptions } from './stave';
2
+ export declare class TabStave extends Stave {
3
+ static get CATEGORY(): string;
4
+ constructor(x: number, y: number, width: number, options?: StaveOptions);
5
+ getYForGlyphs(): number;
6
+ addTabGlyph(): this;
7
+ }
@@ -0,0 +1,18 @@
1
+ import { StaveTie, TieNotes } from './stavetie';
2
+ export declare class TabTie extends StaveTie {
3
+ static get CATEGORY(): string;
4
+ static createHammeron(notes: TieNotes): TabTie;
5
+ static createPulloff(notes: TieNotes): TabTie;
6
+ /**
7
+ * @param notes is a struct that has:
8
+ * {
9
+ * firstNote: Note,
10
+ * lastNote: Note,
11
+ * firstIndexes: [n1, n2, n3],
12
+ * lastIndexes: [n1, n2, n3]
13
+ * }
14
+ *
15
+ * @param text
16
+ */
17
+ constructor(notes: TieNotes, text?: string);
18
+ }
@@ -0,0 +1,45 @@
1
+ import { Element } from './element';
2
+ import { Note } from './note';
3
+ import { RenderContext } from './rendercontext';
4
+ export interface TextBracketParams {
5
+ start: Note;
6
+ stop: Note;
7
+ text?: string;
8
+ superscript?: string;
9
+ position?: number | string;
10
+ }
11
+ export declare enum TextBracketPosition {
12
+ TOP = 1,
13
+ BOTTOM = -1
14
+ }
15
+ export declare class TextBracket extends Element {
16
+ static DEBUG: boolean;
17
+ static get CATEGORY(): string;
18
+ renderOptions: {
19
+ dashed: boolean;
20
+ color: string;
21
+ lineWidth: number;
22
+ underlineSuperscript: boolean;
23
+ showBracket: boolean;
24
+ dash: number[];
25
+ bracketHeight: number;
26
+ };
27
+ protected textElement: Element;
28
+ protected superscriptElement: Element;
29
+ protected line: number;
30
+ readonly position: TextBracketPosition;
31
+ readonly start: Note;
32
+ readonly stop: Note;
33
+ static get Position(): typeof TextBracketPosition;
34
+ static get PositionString(): Record<string, number>;
35
+ constructor({ start, stop, text, superscript, position }: TextBracketParams);
36
+ /**
37
+ * Apply the text backet styling to the provided context.
38
+ * @param ctx
39
+ * @returns this
40
+ */
41
+ applyStyle(ctx: RenderContext): this;
42
+ setDashed(dashed: boolean, dash?: number[]): this;
43
+ setLine(line: number): this;
44
+ draw(): void;
45
+ }
@@ -0,0 +1,34 @@
1
+ import { Note } from './note';
2
+ import { TextNoteStruct } from './textnote';
3
+ /**
4
+ * `TextDynamics` renders traditional
5
+ * text dynamics markings, **ie: p, f, sfz, rfz, ppp**
6
+ *
7
+ * You can render any dynamics string that contains a combination of
8
+ * the following letters: P, M, F, Z, R, S
9
+ */
10
+ export declare class TextDynamics extends Note {
11
+ /** To enable logging for this class. Set `VexFlow.TextDynamics.DEBUG` to `true`. */
12
+ static DEBUG: boolean;
13
+ static get CATEGORY(): string;
14
+ protected sequence: string;
15
+ protected line: number;
16
+ /** The glyph data for each dynamics letter. */
17
+ static get GLYPHS(): Record<string, string>;
18
+ /**
19
+ * Create the dynamics marking.
20
+ *
21
+ * A `TextDynamics` object inherits from `Note` so that it can be formatted
22
+ * within a `Voice`.
23
+ *
24
+ * @param noteStruct an object that contains a `duration` property and a
25
+ * `sequence` of letters that represents the letters to render.
26
+ */
27
+ constructor(noteStruct: TextNoteStruct);
28
+ /** Set the Stave line on which the note should be placed. */
29
+ setLine(line: number): this;
30
+ /** Preformat the dynamics text. */
31
+ preFormat(): this;
32
+ /** Draw the dynamics text on the rendering context. */
33
+ draw(): void;
34
+ }
@@ -0,0 +1,48 @@
1
+ import { Element } from './element';
2
+ import { FontInfo } from './font';
3
+ import { Note, NoteStruct } from './note';
4
+ export declare enum TextJustification {
5
+ LEFT = 1,
6
+ CENTER = 2,
7
+ RIGHT = 3
8
+ }
9
+ export interface TextNoteStruct extends NoteStruct {
10
+ text?: string;
11
+ glyph?: string;
12
+ ignoreTicks?: boolean;
13
+ smooth?: boolean;
14
+ font?: FontInfo;
15
+ subscript?: string;
16
+ superscript?: string;
17
+ }
18
+ /**
19
+ * `TextNote` is a notation element that is positioned in time. Generally
20
+ * meant for objects that sit above/below the staff and inline with each other.
21
+ * `TextNote` has to be assigned to a `Stave` before rendering by means of `setStave`.
22
+ * Examples of this would be such as dynamics, lyrics, chord changes, etc.
23
+ */
24
+ export declare class TextNote extends Note {
25
+ static get CATEGORY(): string;
26
+ static readonly Justification: typeof TextJustification;
27
+ /** Glyph data. */
28
+ static get GLYPHS(): Record<string, string>;
29
+ protected superscript?: Element;
30
+ protected subscript?: Element;
31
+ protected smooth: boolean;
32
+ protected justification: TextJustification;
33
+ protected line: number;
34
+ constructor(noteStruct: TextNoteStruct);
35
+ /** Set the horizontal justification of the TextNote. */
36
+ setJustification(just: TextJustification): this;
37
+ /** Set the Stave line on which the note should be placed. */
38
+ setLine(line: number): this;
39
+ /** Return the Stave line on which the TextNote is placed. */
40
+ getLine(): number;
41
+ /** Pre-render formatting. */
42
+ preFormat(): void;
43
+ /**
44
+ * Renders the TextNote.
45
+ * `TextNote` has to be assigned to a `Stave` before rendering by means of `setStave`.
46
+ */
47
+ draw(): void;
48
+ }
@@ -0,0 +1,149 @@
1
+ import { Element } from './element';
2
+ import { Fraction } from './fraction';
3
+ import { Modifier } from './modifier';
4
+ import { ModifierContext } from './modifiercontext';
5
+ import { Stave } from './stave';
6
+ import { TickContext } from './tickcontext';
7
+ import { Tuplet } from './tuplet';
8
+ import { Voice } from './voice';
9
+ /** Formatter metrics interface */
10
+ export interface FormatterMetrics {
11
+ duration: string;
12
+ freedom: {
13
+ left: number;
14
+ right: number;
15
+ };
16
+ iterations: number;
17
+ space: {
18
+ used: number;
19
+ mean: number;
20
+ deviation: number;
21
+ };
22
+ }
23
+ /**
24
+ * Tickable represents a element that sit on a score and
25
+ * has a duration, i.e., Tickables occupy space in the musical rendering dimension.
26
+ */
27
+ export declare abstract class Tickable extends Element {
28
+ static get CATEGORY(): string;
29
+ protected ignoreTicks: boolean;
30
+ protected tupletStack: Tuplet[];
31
+ protected ticks: Fraction;
32
+ protected centerXShift: number;
33
+ protected voice?: Voice;
34
+ protected modifierContext?: ModifierContext;
35
+ protected tickContext?: TickContext;
36
+ protected modifiers: Modifier[];
37
+ protected tickMultiplier: Fraction;
38
+ protected formatterMetrics: FormatterMetrics;
39
+ protected intrinsicTicks: number;
40
+ protected alignCenter: boolean;
41
+ private _preFormatted;
42
+ private _postFormatted;
43
+ constructor();
44
+ /** Reset the Tickable, this function will be overloaded. */
45
+ reset(): this;
46
+ /** Return the ticks. */
47
+ getTicks(): Fraction;
48
+ /** Check if it ignores the ticks. */
49
+ shouldIgnoreTicks(): boolean;
50
+ /** Ignore the ticks. */
51
+ setIgnoreTicks(flag: boolean): this;
52
+ /** Get width of note. Used by the formatter for positioning. */
53
+ getWidth(): number;
54
+ /** Get `x` position of this tick context. */
55
+ getX(): number;
56
+ /** Return the formatterMetrics. */
57
+ getFormatterMetrics(): FormatterMetrics;
58
+ /** Return the center `x` shift. */
59
+ getCenterXShift(): number;
60
+ /** Set the center `x` shift. */
61
+ setCenterXShift(centerXShift: number): this;
62
+ isCenterAligned(): boolean;
63
+ setCenterAlignment(alignCenter: boolean): this;
64
+ /**
65
+ * Return the associated voice. Every tickable must be associated with a voice.
66
+ * This allows formatters and preFormatter to associate them with the right modifierContexts.
67
+ */
68
+ getVoice(): Voice;
69
+ /** Set the associated voice. */
70
+ setVoice(voice: Voice): void;
71
+ /** Get the Tuplet if any.
72
+ * If there are multiple Tuplets, the most recently added one is returned. */
73
+ getTuplet(): Tuplet | undefined;
74
+ /** Return a readonly array of Tuplets (might be empty). */
75
+ getTupletStack(): readonly Tuplet[];
76
+ /**
77
+ * Remove the given tuplet; raises an Error if the tuplet is not in the TupletStack.
78
+ */
79
+ removeTuplet(tuplet: Tuplet): this;
80
+ /**
81
+ * Remove all tuplets from the tickable.
82
+ */
83
+ clearTuplets(): this;
84
+ /**
85
+ * Deprecated, to be removed in v6. Use `removeTuplet(tuplet)` or `clearTuplets()` instead.
86
+ * Reset the specific Tuplet (if this is not provided, all tuplets are reset).
87
+ * Remove any prior tuplets from the tick calculation and
88
+ * reset the intrinsic tick value.
89
+ */
90
+ resetTuplet(tuplet?: Tuplet): this;
91
+ /** Set the tuplet to the given Tuplet. If there are existing tuplets clears them first. */
92
+ setTuplet(tuplet: Tuplet): this;
93
+ /** Add the given Tuplet to the tupletStack without clearing it first. */
94
+ addTuplet(tuplet: Tuplet): this;
95
+ /**
96
+ * Sets all the tuplets on the tickable to the given tupletStack. Note that
97
+ * a new array is created on the tickable, so manipulating the array that is
98
+ * passed in will not affect the tupletStack used by the tickable.
99
+ */
100
+ setTupletStack(tupletStack: Tuplet[]): this;
101
+ /**
102
+ * Add self to the provided ModifierContext `mc`.
103
+ * If this tickable has modifiers, set modifierContext.
104
+ * @returns this
105
+ */
106
+ addToModifierContext(mc: ModifierContext): this;
107
+ /**
108
+ * Optional, if tickable has modifiers, associate a Modifier.
109
+ */
110
+ addModifier(modifier: Modifier, index?: number): this;
111
+ /** Get the list of associated modifiers. */
112
+ getModifiers(): Modifier[];
113
+ /** Set the Tick Context. */
114
+ setTickContext(tc: TickContext): void;
115
+ checkTickContext(message?: string): TickContext;
116
+ /** Preformat the Tickable. */
117
+ preFormat(): void;
118
+ /** Set preformatted status. */
119
+ set preFormatted(value: boolean);
120
+ get preFormatted(): boolean;
121
+ /** Postformat the Tickable. */
122
+ postFormat(): this;
123
+ /** Set postformatted status. */
124
+ set postFormatted(value: boolean);
125
+ get postFormatted(): boolean;
126
+ /** Return the intrinsic ticks as an integer. */
127
+ getIntrinsicTicks(): number;
128
+ /** Set the intrinsic ticks as an integer. */
129
+ setIntrinsicTicks(intrinsicTicks: number): void;
130
+ /** Get the tick multiplier as a Fraction. Defaults to Fraction(1, 1). */
131
+ getTickMultiplier(): Fraction;
132
+ /** Apply a tick multiplier, by multiplying the current tickMultiplier by
133
+ * the numerator and denominator given here. Updates ticks. */
134
+ applyTickMultiplier(numerator: number, denominator: number): void;
135
+ /** Set the duration. */
136
+ setDuration(duration: Fraction): void;
137
+ getAbsoluteX(): number;
138
+ /** Attach this note to a modifier context. */
139
+ setModifierContext(mc?: ModifierContext): this;
140
+ /** Get `ModifierContext`. */
141
+ getModifierContext(): ModifierContext | undefined;
142
+ /** Check and get `ModifierContext`. */
143
+ checkModifierContext(): ModifierContext;
144
+ /** Get the target stave. */
145
+ abstract getStave(): Stave | undefined;
146
+ /** Set the target stave. */
147
+ abstract setStave(stave: Stave): this;
148
+ abstract getMetrics(): any;
149
+ }
@@ -0,0 +1,112 @@
1
+ import { Fraction } from './fraction';
2
+ import { NoteMetrics } from './note';
3
+ import { Tickable } from './tickable';
4
+ export interface TickContextMetrics extends NoteMetrics {
5
+ totalLeftPx: number;
6
+ totalRightPx: number;
7
+ }
8
+ export interface TickContextOptions {
9
+ tickID: number;
10
+ }
11
+ /**
12
+ * TickContext formats abstract tickable objects, such as notes, chords, tabs, etc.
13
+ *
14
+ * It has a public attribute of `tContexts` which is a parent array of the TickContexts
15
+ * in which this TickContext belongs.
16
+ */
17
+ export declare class TickContext {
18
+ protected readonly tickID: number;
19
+ protected readonly tickables: Tickable[];
20
+ protected readonly tickablesByVoice: Record<string, Tickable>;
21
+ protected currentTick: Fraction;
22
+ protected maxTicks: Fraction;
23
+ protected padding: number;
24
+ protected xBase: number;
25
+ protected x: number;
26
+ protected xOffset: number;
27
+ protected notePx: number;
28
+ protected glyphPx: number;
29
+ protected leftDisplacedHeadPx: number;
30
+ protected rightDisplacedHeadPx: number;
31
+ protected modLeftPx: number;
32
+ protected modRightPx: number;
33
+ protected totalLeftPx: number;
34
+ protected totalRightPx: number;
35
+ protected maxTickable?: Tickable;
36
+ protected minTicks?: Fraction;
37
+ protected minTickable?: Tickable;
38
+ tContexts: TickContext[];
39
+ protected preFormatted: boolean;
40
+ protected postFormatted: boolean;
41
+ protected width: number;
42
+ protected formatterMetrics: {
43
+ freedom: {
44
+ left: number;
45
+ right: number;
46
+ };
47
+ };
48
+ /**
49
+ * Get the next TickContext from another TickContext, from the `.tContexts` array.
50
+ */
51
+ static getNextContext(tContext: TickContext): TickContext | undefined;
52
+ constructor(options?: TickContextOptions);
53
+ getTickID(): number;
54
+ getX(): number;
55
+ setX(x: number): this;
56
+ getXBase(): number;
57
+ setXBase(xBase: number): void;
58
+ getXOffset(): number;
59
+ setXOffset(xOffset: number): void;
60
+ getWidth(): number;
61
+ setPadding(padding: number): this;
62
+ getMaxTicks(): Fraction;
63
+ getMinTicks(): Fraction | undefined;
64
+ getMaxTickable(): Tickable | undefined;
65
+ getMinTickable(): Tickable | undefined;
66
+ getTickables(): Tickable[];
67
+ /**
68
+ * Introduced on 2020-04-17 as getTickablesForVoice(voiceIndex).
69
+ * https://github.com/0xfe/vexflow/blame/dc97b0cc5bb93171c0038638c34362dc958222ca/src/tickcontext.js#L63
70
+ * Renamed on 2021-08-05 to getTickableForVoice(voiceIndex). Method renamed to singular, since it returns one Tickable.
71
+ */
72
+ getTickableForVoice(voiceIndex: number): Tickable;
73
+ getTickablesByVoice(): Record<string, Tickable>;
74
+ getCenterAlignedTickables(): Tickable[];
75
+ /** Gets widths context, note and left/right modifiers for formatting. */
76
+ getMetrics(): TickContextMetrics;
77
+ getCurrentTick(): Fraction;
78
+ setCurrentTick(tick: Fraction): void;
79
+ addTickable(tickable: Tickable, voiceIndex?: number): this;
80
+ preFormat(): this;
81
+ postFormat(): this;
82
+ getFormatterMetrics(): {
83
+ freedom: {
84
+ left: number;
85
+ right: number;
86
+ };
87
+ };
88
+ /**
89
+ * Move this tick context by `shift` pixels rightward, and adjust the
90
+ * freedom on adjacent tickcontexts.
91
+ * @param shift pixels to shift rightward.
92
+ * @param prev the previous TickContext, whose right freedom will be increased by `shift`.
93
+ * @param next the next TickContext, whose left freedom will be decreased by `shift`.
94
+ */
95
+ move(shift: number, prev?: TickContext, next?: TickContext): void;
96
+ /**
97
+ * Return the total cost of space deviations from formatter metrics for
98
+ * each tickable in the context. Used by formatters.
99
+ *
100
+ * Since FormatterMetrics.space.deviation is the amount each tickable is smaller
101
+ * (negative) or wider (positive) than the mean amount of space allocated to that
102
+ * duration, a negative return value means the tickables at this position are on average
103
+ * getting less space than they should, while a positive number means they are getting
104
+ * more space than they should.
105
+ */
106
+ getDeviationCost(): number;
107
+ /**
108
+ * Like getDeviationCost, but averages the cost of space deviations so that TickContexts
109
+ * with more Tickables are not weighted more heavily.
110
+ */
111
+ getAverageDeviationCost(): number;
112
+ }
@@ -0,0 +1,75 @@
1
+ import { BoundingBox } from './boundingbox';
2
+ import { Element } from './element';
3
+ import { RenderContext } from './rendercontext';
4
+ import { Stave } from './stave';
5
+ import { StaveModifier } from './stavemodifier';
6
+ export interface TimeSignatureInfo {
7
+ glyph: string;
8
+ line: number;
9
+ num: boolean;
10
+ }
11
+ /**
12
+ * A TimeSignature is a StaveModifier that can make its appropriate Glyphs directly from
13
+ * a provided "timeSpec" such as "4/4", "C|" (cut time), or even something more advanced
14
+ * such as "3/4(6/8)" or "2/4+5/8".
15
+ */
16
+ export declare class TimeSignature extends StaveModifier {
17
+ static get CATEGORY(): string;
18
+ bottomLine: number;
19
+ topLine: number;
20
+ protected topRenderY: number;
21
+ protected botRenderY: number;
22
+ protected timeSpec: string;
23
+ protected line: number;
24
+ protected topText: Element;
25
+ protected botText: Element;
26
+ protected isNumeric: boolean;
27
+ protected validateArgs: boolean;
28
+ protected topStartX: number;
29
+ protected botStartX: number;
30
+ protected lineShift: number;
31
+ constructor(timeSpec?: string, customPadding?: number, validateArgs?: boolean);
32
+ static getTimeSigCode(key: string, smallSig?: boolean): string;
33
+ /**
34
+ * Returns a new TimeSignatureGlyph (a Glyph subclass that knows how to draw both
35
+ * top and bottom digits along with plus signs etc.)
36
+ */
37
+ makeTimeSignatureGlyph(topDigits: string, botDigits: string): void;
38
+ /**
39
+ * Set a new time signature specification without changing customPadding, etc.
40
+ *
41
+ * The getter for this is `getTimeSpec` not `getTimeSig`.
42
+ */
43
+ setTimeSig(timeSpec: string): this;
44
+ /**
45
+ * Return the timeSpec (such as '4/4' or 'C|' or even '2/4+3/8') of the TimeSignature
46
+ */
47
+ getTimeSpec(): string;
48
+ /**
49
+ * Return the staff line that the TimeSignature sits on. Generally 0 for numerator/
50
+ * denominator time signatures such as 3/4 and 2 for cut/common.
51
+ */
52
+ getLine(): number;
53
+ /**
54
+ * Set the line number that the TimeSignature sits on. Half-values are acceptable
55
+ * for spaces, etc. Can be altered, for instance, for signatures that sit above the
56
+ * staff in large orchestral scores.
57
+ */
58
+ setLine(line: number): void;
59
+ /**
60
+ * Return a boolean on whether this TimeSignature is drawn with one or more numbers
61
+ * (such as 4/4) or not (as in cut time).
62
+ */
63
+ getIsNumeric(): boolean;
64
+ /**
65
+ * Set whether this TimeSignature is drawn with one or more numbers.
66
+ */
67
+ setIsNumeric(isNumeric: boolean): void;
68
+ /**
69
+ * Draw the time signature on a Stave using its RenderContext. Both setStave
70
+ * and setContext must already be run.
71
+ */
72
+ draw(): void;
73
+ drawAt(ctx: RenderContext, stave: Stave, x: number): void;
74
+ getBoundingBox(): BoundingBox;
75
+ }
@@ -0,0 +1,11 @@
1
+ import { ModifierContext } from './modifiercontext';
2
+ import { Note } from './note';
3
+ import { TimeSignature } from './timesignature';
4
+ export declare class TimeSigNote extends Note {
5
+ static get CATEGORY(): string;
6
+ protected timeSig: TimeSignature;
7
+ constructor(timeSpec: string, customPadding?: number);
8
+ addToModifierContext(mc: ModifierContext): this;
9
+ preFormat(): this;
10
+ draw(): void;
11
+ }
@@ -0,0 +1,12 @@
1
+ import { Modifier } from './modifier';
2
+ /** Tremolo implements tremolo notation. */
3
+ export declare class Tremolo extends Modifier {
4
+ static get CATEGORY(): string;
5
+ protected readonly num: number;
6
+ /**
7
+ * @param num number of bars
8
+ */
9
+ constructor(num: number);
10
+ /** Draw the tremolo on the rendering context. */
11
+ draw(): void;
12
+ }
@@ -0,0 +1,23 @@
1
+ /** `Tuning` implements varies types of tunings for tablature. */
2
+ export declare class Tuning {
3
+ protected tuningValues: number[];
4
+ static get names(): Record<string, string>;
5
+ /**
6
+ * Constructor.
7
+ * @param tuningString tuning name (eg. 'dagdad') or comma separated note strings
8
+ */
9
+ constructor(tuningString?: string);
10
+ /** Return the note number associated to the note string. */
11
+ noteToInteger(noteString: string): number;
12
+ /**
13
+ * Set tuning identified by tuning name (eg. 'dagdad')
14
+ * @param tuningString tuning name (eg. 'dagdad') or comma separated note strings
15
+ */
16
+ setTuning(tuningString: string): void;
17
+ /** Return the note number associated with a tablature string. */
18
+ getValueForString(stringNum: string | number): number;
19
+ /** Return the note number associated with a tablature string and fret. */
20
+ getValueForFret(fretNum: string | number, stringNum: string | number): number;
21
+ /** Return the note string associated with tablature string and fret. */
22
+ getNoteForFret(fretNum: string | number, stringNum: string | number): string;
23
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * ## Description
3
+ *
4
+ * Create a new tuplet from the specified notes. The notes must
5
+ * be part of the same voice. If they are of different rhythmic
6
+ * values, then options.numNotes must be set.
7
+ *
8
+ * @constructor
9
+ * @param {Array.<VexFlow.StaveNote>} A set of notes: staveNotes,
10
+ * notes, etc... any class that inherits stemmableNote at some
11
+ * point in its prototype chain.
12
+ * @param options: object {
13
+ *
14
+ * numNotes: fit this many notes into...
15
+ * notesOccupied: ...the space of this many notes
16
+ *
17
+ * Together, these two properties make up the tuplet ratio
18
+ * in the form of numNotes : notesOccupied.
19
+ * numNotes defaults to the number of notes passed in, so
20
+ * it is important that if you omit this property, all of
21
+ * the notes passed should be of the same note value.
22
+ * notesOccupied defaults to 2 -- so you should almost
23
+ * certainly pass this parameter for anything other than
24
+ * a basic triplet.
25
+ *
26
+ * location:
27
+ * default 1, which is above the notes: ┌─── 3 ───┐
28
+ * -1 is below the notes └─── 3 ───┘
29
+ *
30
+ * bracketed: boolean, draw a bracket around the tuplet number
31
+ * when true: ┌─── 3 ───┐ when false: 3
32
+ * defaults to true if notes are not beamed, false otherwise
33
+ *
34
+ * ratioed: boolean
35
+ * when true: ┌─── 7:8 ───┐, when false: ┌─── 7 ───┐
36
+ * defaults to true if the difference between numNotes and
37
+ * notesOccupied is greater than 1.
38
+ *
39
+ * yOffset: int, default 0
40
+ * manually offset a tuplet, for instance to avoid collisions
41
+ * with articulations, etc...
42
+ *
43
+ * suffix: string
44
+ * suffix to show after ratio.
45
+ * NOTE: any of the Glyphs.met... work well for note glyphs
46
+ * }
47
+ */
48
+ import { BoundingBox } from './boundingbox';
49
+ import { Element } from './element';
50
+ import { Note } from './note';
51
+ export interface TupletOptions {
52
+ bracketed?: boolean;
53
+ location?: number;
54
+ notesOccupied?: number;
55
+ numNotes?: number;
56
+ ratioed?: boolean;
57
+ yOffset?: number;
58
+ textYOffset?: number;
59
+ suffix?: string;
60
+ }
61
+ export declare const enum TupletLocation {
62
+ BOTTOM = -1,
63
+ TOP = 1
64
+ }
65
+ export declare class Tuplet extends Element {
66
+ static get CATEGORY(): string;
67
+ notes: Note[];
68
+ protected options: Required<TupletOptions>;
69
+ protected textElement: Element;
70
+ protected suffixElement: Element;
71
+ static get LOCATION_TOP(): number;
72
+ static get LOCATION_BOTTOM(): number;
73
+ static get NESTING_OFFSET(): number;
74
+ constructor(notes: Note[], options?: TupletOptions);
75
+ attach(): void;
76
+ detach(): void;
77
+ /**
78
+ * Set whether or not the bracket is drawn.
79
+ */
80
+ setBracketed(bracketed: boolean): this;
81
+ /**
82
+ * Set whether or not the ratio is shown.
83
+ */
84
+ setRatioed(ratioed: boolean): this;
85
+ /**
86
+ * Set the tuplet indicator to be displayed either on the top or bottom of the stave.
87
+ */
88
+ setTupletLocation(location: number): this;
89
+ getNotes(): Note[];
90
+ getNoteCount(): number;
91
+ getNotesOccupied(): number;
92
+ setNotesOccupied(notes: number): void;
93
+ resolveGlyphs(): void;
94
+ getNestedTupletCount(): number;
95
+ getYPosition(): number;
96
+ draw(): void;
97
+ getBoundingBox(): BoundingBox;
98
+ }