vexflow 4.0.1-beta.2 → 4.0.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 (94) hide show
  1. package/README.md +48 -65
  2. package/build/cjs/vexflow-bravura.js +2 -2
  3. package/build/cjs/vexflow-bravura.js.map +1 -1
  4. package/build/cjs/vexflow-core.js +2 -2
  5. package/build/cjs/vexflow-core.js.map +1 -1
  6. package/build/cjs/vexflow-debug-with-tests.js +729 -698
  7. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  8. package/build/cjs/vexflow-debug.js +553 -614
  9. package/build/cjs/vexflow-debug.js.map +1 -1
  10. package/build/cjs/vexflow-gonville.js +2 -2
  11. package/build/cjs/vexflow-gonville.js.map +1 -1
  12. package/build/cjs/vexflow-petaluma.js +2 -2
  13. package/build/cjs/vexflow-petaluma.js.map +1 -1
  14. package/build/cjs/vexflow.js +2 -2
  15. package/build/cjs/vexflow.js.map +1 -1
  16. package/build/esm/entry/vexflow-bravura.js +1 -2
  17. package/build/esm/entry/vexflow-core.js +1 -2
  18. package/build/esm/entry/vexflow-debug-with-tests.js +9 -2
  19. package/build/esm/entry/vexflow-debug.js +7 -2
  20. package/build/esm/entry/vexflow-gonville.js +1 -2
  21. package/build/esm/entry/vexflow-petaluma.js +1 -2
  22. package/build/esm/entry/vexflow.js +1 -2
  23. package/build/esm/src/annotation.js +10 -4
  24. package/build/esm/src/beam.js +20 -6
  25. package/build/esm/src/factory.js +6 -1
  26. package/build/esm/src/flow.js +27 -14
  27. package/build/esm/src/font.js +0 -2
  28. package/build/esm/src/formatter.js +21 -4
  29. package/build/esm/src/glyph.js +6 -0
  30. package/build/esm/src/index.js +1 -3
  31. package/build/esm/src/note.js +1 -1
  32. package/build/esm/src/stave.js +2 -2
  33. package/build/esm/src/staveconnector.js +6 -3
  34. package/build/esm/src/staveline.js +2 -5
  35. package/build/esm/src/stavenote.js +19 -6
  36. package/build/esm/src/stavesection.js +9 -6
  37. package/build/esm/src/stavetext.js +3 -3
  38. package/build/esm/src/system.js +1 -8
  39. package/build/esm/src/textnote.js +12 -14
  40. package/build/esm/src/version.js +3 -3
  41. package/build/esm/tests/annotation_tests.js +14 -1
  42. package/build/esm/tests/beam_tests.js +19 -0
  43. package/build/esm/tests/easyscore_tests.js +5 -2
  44. package/build/esm/tests/formatter_tests.js +62 -10
  45. package/build/esm/tests/stave_tests.js +4 -4
  46. package/build/types/entry/vexflow-bravura.d.ts +1 -2
  47. package/build/types/entry/vexflow-core.d.ts +1 -2
  48. package/build/types/entry/vexflow-debug.d.ts +1 -2
  49. package/build/types/entry/vexflow-gonville.d.ts +1 -2
  50. package/build/types/entry/vexflow-petaluma.d.ts +1 -2
  51. package/build/types/entry/vexflow.d.ts +1 -2
  52. package/build/types/src/annotation.d.ts +1 -0
  53. package/build/types/src/beam.d.ts +30 -1
  54. package/build/types/src/easyscore.d.ts +4 -0
  55. package/build/types/src/factory.d.ts +6 -3
  56. package/build/types/src/flow.d.ts +27 -12
  57. package/build/types/src/font.d.ts +0 -1
  58. package/build/types/src/glyph.d.ts +2 -0
  59. package/build/types/src/index.d.ts +1 -3
  60. package/build/types/src/note.d.ts +1 -0
  61. package/build/types/src/stave.d.ts +1 -1
  62. package/build/types/src/staveconnector.d.ts +13 -15
  63. package/build/types/src/staveline.d.ts +2 -5
  64. package/build/types/src/stavesection.d.ts +2 -1
  65. package/build/types/src/system.d.ts +2 -2
  66. package/build/types/src/textnote.d.ts +4 -4
  67. package/entry/vexflow-bravura.ts +3 -3
  68. package/entry/vexflow-core.ts +3 -3
  69. package/entry/vexflow-debug-with-tests.ts +16 -2
  70. package/entry/vexflow-debug.ts +11 -3
  71. package/entry/vexflow-gonville.ts +3 -3
  72. package/entry/vexflow-petaluma.ts +3 -3
  73. package/entry/vexflow.ts +3 -3
  74. package/package.json +3 -1
  75. package/releases/vexflow-debug.js +30441 -0
  76. package/releases/vexflow-min.js +6 -0
  77. package/src/annotation.ts +15 -4
  78. package/src/beam.ts +55 -6
  79. package/src/easyscore.ts +11 -1
  80. package/src/factory.ts +18 -4
  81. package/src/flow.ts +35 -20
  82. package/src/font.ts +0 -4
  83. package/src/formatter.ts +24 -8
  84. package/src/glyph.ts +8 -0
  85. package/src/index.ts +2 -7
  86. package/src/note.ts +2 -1
  87. package/src/stave.ts +2 -2
  88. package/src/staveconnector.ts +43 -9
  89. package/src/staveline.ts +2 -5
  90. package/src/stavenote.ts +20 -10
  91. package/src/stavesection.ts +10 -6
  92. package/src/stavetext.ts +3 -3
  93. package/src/system.ts +3 -9
  94. package/src/textnote.ts +9 -11
@@ -1,6 +1,10 @@
1
1
  import { Element } from './element';
2
2
  import { FontInfo } from './font';
3
3
  import { Stave } from './stave';
4
+ /**
5
+ * see {@link StaveConnector.type} & {@link StaveConnector.typeString}
6
+ */
7
+ export declare type StaveConnectorType = 'singleRight' | 'singleLeft' | 'single' | 'double' | 'brace' | 'bracket' | 'boldDoubleLeft' | 'boldDoubleRight' | 'thinDouble' | 'none' | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
4
8
  /** StaveConnector implements the connector lines between staves of a system. */
5
9
  export declare class StaveConnector extends Element {
6
10
  static get CATEGORY(): string;
@@ -10,18 +14,7 @@ export declare class StaveConnector extends Element {
10
14
  * with older versions of vexflow which didn't have right sided
11
15
  * stave connectors.
12
16
  */
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
- };
17
+ static readonly type: Record<string, Exclude<StaveConnectorType, string>>;
25
18
  /**
26
19
  * Connector type:
27
20
  * * "singleRight"
@@ -35,7 +28,7 @@ export declare class StaveConnector extends Element {
35
28
  * * "thinDouble"
36
29
  * * "none"
37
30
  */
38
- static readonly typeString: Record<string, number>;
31
+ static readonly typeString: Record<Exclude<StaveConnectorType, number>, Exclude<StaveConnectorType, string>>;
39
32
  protected width: number;
40
33
  protected texts: {
41
34
  content: string;
@@ -44,7 +37,7 @@ export declare class StaveConnector extends Element {
44
37
  shift_y: number;
45
38
  };
46
39
  }[];
47
- protected type: number;
40
+ protected type: typeof StaveConnector['type'][keyof typeof StaveConnector['type']];
48
41
  readonly top_stave: Stave;
49
42
  readonly bottom_stave: Stave;
50
43
  readonly thickness: number;
@@ -54,7 +47,12 @@ export declare class StaveConnector extends Element {
54
47
  * Set type.
55
48
  * @param type see {@link StaveConnector.type} & {@link StaveConnector.typeString}
56
49
  */
57
- setType(type: number | string): this;
50
+ setType(type: StaveConnectorType): this;
51
+ /**
52
+ * Get type.
53
+ * @returns number {@link StaveConnector.type}
54
+ */
55
+ getType(): number;
58
56
  /** Set optional associated Text. */
59
57
  setText(text: string, options?: {
60
58
  shift_x?: number;
@@ -2,6 +2,7 @@ import { Element } from './element';
2
2
  import { FontInfo } from './font';
3
3
  import { RenderContext } from './rendercontext';
4
4
  import { StaveNote } from './stavenote';
5
+ import { TextJustification } from './textnote';
5
6
  export interface StaveLineNotes {
6
7
  first_note: StaveNote;
7
8
  first_indices: number[];
@@ -16,11 +17,7 @@ export declare class StaveLine extends Element {
16
17
  TOP: number;
17
18
  BOTTOM: number;
18
19
  };
19
- static readonly TextJustification: {
20
- LEFT: number;
21
- CENTER: number;
22
- RIGHT: number;
23
- };
20
+ static readonly TextJustification: typeof TextJustification;
24
21
  render_options: {
25
22
  padding_left: number;
26
23
  padding_right: number;
@@ -7,7 +7,8 @@ export declare class StaveSection extends StaveModifier {
7
7
  protected section: string;
8
8
  protected shift_x: number;
9
9
  protected shift_y: number;
10
- constructor(section: string, x: number, shift_y: number);
10
+ protected drawRect: boolean;
11
+ constructor(section: string, x: number, shift_y: number, drawRect?: boolean);
11
12
  setStaveSection(section: string): this;
12
13
  setShiftX(x: number): this;
13
14
  setShiftY(y: number): this;
@@ -3,7 +3,7 @@ import { Factory } from './factory';
3
3
  import { FormatParams, Formatter, FormatterOptions } from './formatter';
4
4
  import { RenderContext } from './rendercontext';
5
5
  import { Stave, StaveOptions } from './stave';
6
- import { StaveConnector } from './staveconnector';
6
+ import { StaveConnector, StaveConnectorType } from './staveconnector';
7
7
  import { Voice } from './voice';
8
8
  export interface SystemFormatterOptions extends FormatterOptions {
9
9
  alpha?: number;
@@ -69,7 +69,7 @@ export declare class System extends Element {
69
69
  * Add connector between staves.
70
70
  * @param type see {@link StaveConnector.typeString}
71
71
  */
72
- addConnector(type?: string): StaveConnector;
72
+ addConnector(type?: StaveConnectorType): StaveConnector;
73
73
  /**
74
74
  * Add a stave to the system.
75
75
  *
@@ -1,6 +1,6 @@
1
1
  import { FontInfo } from './font';
2
2
  import { Note, NoteStruct } from './note';
3
- export declare enum Justification {
3
+ export declare enum TextJustification {
4
4
  LEFT = 1,
5
5
  CENTER = 2,
6
6
  RIGHT = 3
@@ -23,7 +23,7 @@ export interface TextNoteStruct extends NoteStruct {
23
23
  export declare class TextNote extends Note {
24
24
  static get CATEGORY(): string;
25
25
  static TEXT_FONT: Required<FontInfo>;
26
- static get Justification(): typeof Justification;
26
+ static readonly Justification: typeof TextJustification;
27
27
  /** Glyph data. */
28
28
  static get GLYPHS(): Record<string, {
29
29
  code: string;
@@ -32,11 +32,11 @@ export declare class TextNote extends Note {
32
32
  protected superscript?: string;
33
33
  protected subscript?: string;
34
34
  protected smooth: boolean;
35
- protected justification: Justification;
35
+ protected justification: TextJustification;
36
36
  protected line: number;
37
37
  constructor(noteStruct: TextNoteStruct);
38
38
  /** Set the horizontal justification of the TextNote. */
39
- setJustification(just: Justification): this;
39
+ setJustification(just: TextJustification): this;
40
40
  /** Set the Stave line on which the note should be placed. */
41
41
  setLine(line: number): this;
42
42
  /** Pre-render formatting. */
@@ -4,8 +4,6 @@
4
4
  // vexflow-bravura.ts is the entry point for vexflow-bravura.js.
5
5
  // This version bundles the Bravura music engraving font.
6
6
 
7
- import { Vex } from '../src/vex';
8
-
9
7
  import { Flow } from '../src/flow';
10
8
  import { loadBravura } from '../src/fonts/load_bravura';
11
9
  import { loadCustom } from '../src/fonts/load_custom';
@@ -16,8 +14,10 @@ loadCustom();
16
14
  Flow.setMusicFont('Bravura', 'Custom');
17
15
  loadTextFonts();
18
16
 
17
+ // Re-export all exports from index.ts.
19
18
  export * from '../src/index';
20
- export default Vex;
19
+ // Also collect all exports into a default export for CJS projects.
20
+ export * as default from '../src/index';
21
21
 
22
22
  // ADD_MUSIC_FONT
23
23
  // To make a vexflow-xxx.js build that ONLY loads your new music font, copy this file and name it vexflow-xxx.ts.
@@ -9,8 +9,6 @@
9
9
  // All music fonts will be loaded dynamically via: `Flow.fetchMusicFont(fontName)`
10
10
  // Remember to call `Flow.setMusicFont(fontName)` after fetching the font module.
11
11
 
12
- import { Vex } from '../src/vex';
13
-
14
12
  import { Flow } from '../src/flow';
15
13
  import { Font, FontModule } from '../src/font';
16
14
  import { loadTextFonts } from '../src/fonts/textfonts';
@@ -71,5 +69,7 @@ Flow.fetchMusicFont = async (fontName: string, fontModuleOrPath?: string | FontM
71
69
  // Load the two text fonts that ChordSymbol & Annotation use.
72
70
  loadTextFonts();
73
71
 
72
+ // Re-export all exports from index.ts.
74
73
  export * from '../src/index';
75
- export default Vex;
74
+ // Also collect all exports into a default export for CJS projects.
75
+ export * as default from '../src/index';
@@ -5,8 +5,22 @@
5
5
  // It statically bundles all the music engraving fonts, and also includes the tests from vexflow/tests/.
6
6
  // The output file is used by flow.html & flow-headless-browser.html to run the tests.
7
7
 
8
- import { Vex } from './vexflow';
8
+ import * as VexSrc from '../src/index';
9
+ import * as VexTests from '../tests/index';
9
10
 
11
+ import { Flow } from '../src/flow';
12
+ import { loadAllMusicFonts } from '../src/fonts/load_all';
13
+ import { loadTextFonts } from '../src/fonts/textfonts';
14
+
15
+ loadAllMusicFonts();
16
+ Flow.setMusicFont('Bravura', 'Gonville', 'Custom');
17
+ loadTextFonts();
18
+
19
+ // Re-export all exports from src/index.ts and tests/index.ts.
10
20
  export * from '../src/index';
11
21
  export * from '../tests/index';
12
- export default Vex;
22
+ // Also collect all exports into a default export for CJS projects.
23
+ export default {
24
+ ...VexSrc,
25
+ ...VexTests,
26
+ };
@@ -4,12 +4,20 @@
4
4
  // vexflow-debug.ts is the entry point for the build output file vexflow-debug.js.
5
5
  // It statically bundles all the music engraving fonts.
6
6
 
7
- // Currently, it just imports vexflow.ts, but the webpack config inside Gruntfile.js
7
+ // Currently, it is identical to vexflow.ts, but the webpack config inside Gruntfile.js
8
8
  // sets the webpack mode to 'development' to produce an unminified build.
9
9
 
10
10
  // In the future, we could do something different with this entry file, such as turn on flags for logging.
11
11
 
12
- import { Vex } from './vexflow';
12
+ import { Flow } from '../src/flow';
13
+ import { loadAllMusicFonts } from '../src/fonts/load_all';
14
+ import { loadTextFonts } from '../src/fonts/textfonts';
13
15
 
16
+ loadAllMusicFonts();
17
+ Flow.setMusicFont('Bravura', 'Gonville', 'Custom');
18
+ loadTextFonts();
19
+
20
+ // Re-export all exports from index.ts.
14
21
  export * from '../src/index';
15
- export default Vex;
22
+ // Also collect all exports into a default export for CJS projects.
23
+ export * as default from '../src/index';
@@ -4,8 +4,6 @@
4
4
  // vexflow-gonville.ts is the entry point for vexflow-gonville.js.
5
5
  // This version bundles the Gonville music engraving font.
6
6
 
7
- import { Vex } from '../src/vex';
8
-
9
7
  import { Flow } from '../src/flow';
10
8
  import { loadCustom } from '../src/fonts/load_custom';
11
9
  import { loadGonville } from '../src/fonts/load_gonville';
@@ -16,5 +14,7 @@ loadCustom();
16
14
  Flow.setMusicFont('Gonville', 'Custom');
17
15
  loadTextFonts();
18
16
 
17
+ // Re-export all exports from index.ts.
19
18
  export * from '../src/index';
20
- export default Vex;
19
+ // Also collect all exports into a default export for CJS projects.
20
+ export * as default from '../src/index';
@@ -4,8 +4,6 @@
4
4
  // vexflow-petaluma.ts is the entry point for vexflow-petaluma.js.
5
5
  // This version bundles the Petaluma music engraving font.
6
6
 
7
- import { Vex } from '../src/vex';
8
-
9
7
  import { Flow } from '../src/flow';
10
8
  import { loadCustom } from '../src/fonts/load_custom';
11
9
  import { loadPetaluma } from '../src/fonts/load_petaluma';
@@ -16,5 +14,7 @@ loadCustom();
16
14
  Flow.setMusicFont('Petaluma', 'Custom');
17
15
  loadTextFonts();
18
16
 
17
+ // Re-export all exports from index.ts.
19
18
  export * from '../src/index';
20
- export default Vex;
19
+ // Also collect all exports into a default export for CJS projects.
20
+ export * as default from '../src/index';
package/entry/vexflow.ts CHANGED
@@ -7,8 +7,6 @@
7
7
 
8
8
  // The webpack config inside Gruntfile.js sets the mode to 'production' to produce a minified build.
9
9
 
10
- import { Vex } from '../src/vex';
11
-
12
10
  import { Flow } from '../src/flow';
13
11
  import { loadAllMusicFonts } from '../src/fonts/load_all';
14
12
  import { loadTextFonts } from '../src/fonts/textfonts';
@@ -17,5 +15,7 @@ loadAllMusicFonts();
17
15
  Flow.setMusicFont('Bravura', 'Gonville', 'Custom');
18
16
  loadTextFonts();
19
17
 
18
+ // Re-export all exports from index.ts.
20
19
  export * from '../src/index';
21
- export default Vex;
20
+ // Also collect all exports into a default export for CJS projects.
21
+ export * as default from '../src/index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vexflow",
3
- "version": "4.0.1-beta.2",
3
+ "version": "4.0.2",
4
4
  "description": "A JavaScript library for rendering music notation and guitar tablature.",
5
5
  "exports": {
6
6
  ".": {
@@ -72,6 +72,8 @@
72
72
  "tests/flow.html",
73
73
  "tests/flow.css",
74
74
  "tests/support",
75
+ "releases/vexflow-min.js",
76
+ "releases/vexflow-debug.js",
75
77
  "AUTHORS.md"
76
78
  ],
77
79
  "bugs": {