vexflow 5.0.0-alpha.3 → 5.0.0-beta.0

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 (152) hide show
  1. package/README.md +6 -6
  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 +2066 -1877
  7. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  8. package/build/cjs/vexflow-debug.js +1052 -993
  9. package/build/cjs/vexflow-debug.js.map +1 -1
  10. package/build/cjs/vexflow.js +2 -2
  11. package/build/cjs/vexflow.js.map +1 -1
  12. package/build/esm/src/accidental.js +22 -28
  13. package/build/esm/src/annotation.js +0 -2
  14. package/build/esm/src/barnote.js +3 -3
  15. package/build/esm/src/beam.js +26 -46
  16. package/build/esm/src/bend.js +11 -3
  17. package/build/esm/src/chordsymbol.js +0 -4
  18. package/build/esm/src/clef.js +0 -2
  19. package/build/esm/src/clefnote.js +6 -1
  20. package/build/esm/src/curve.js +8 -5
  21. package/build/esm/src/element.js +94 -118
  22. package/build/esm/src/factory.js +4 -4
  23. package/build/esm/src/flag.js +20 -0
  24. package/build/esm/src/fonts/gonville.js +1 -1
  25. package/build/esm/src/formatter.js +13 -21
  26. package/build/esm/src/fraction.js +15 -22
  27. package/build/esm/src/glyphnote.js +3 -4
  28. package/build/esm/src/gracenote.js +0 -2
  29. package/build/esm/src/gracenotegroup.js +17 -8
  30. package/build/esm/src/index.js +1 -0
  31. package/build/esm/src/keysignature.js +38 -31
  32. package/build/esm/src/keysignote.js +1 -1
  33. package/build/esm/src/metrics.js +58 -7
  34. package/build/esm/src/modifier.js +10 -23
  35. package/build/esm/src/multimeasurerest.js +16 -25
  36. package/build/esm/src/note.js +7 -0
  37. package/build/esm/src/notehead.js +6 -1
  38. package/build/esm/src/ornament.js +0 -2
  39. package/build/esm/src/pedalmarking.js +33 -41
  40. package/build/esm/src/registry.js +5 -19
  41. package/build/esm/src/stave.js +11 -19
  42. package/build/esm/src/stavebarline.js +2 -3
  43. package/build/esm/src/stavehairpin.js +1 -1
  44. package/build/esm/src/staveline.js +0 -4
  45. package/build/esm/src/stavemodifier.js +0 -2
  46. package/build/esm/src/stavenote.js +42 -68
  47. package/build/esm/src/staverepetition.js +3 -2
  48. package/build/esm/src/stavesection.js +13 -15
  49. package/build/esm/src/stavetempo.js +7 -13
  50. package/build/esm/src/stavetext.js +2 -2
  51. package/build/esm/src/stavetie.js +82 -40
  52. package/build/esm/src/stavevolta.js +3 -2
  53. package/build/esm/src/stem.js +0 -4
  54. package/build/esm/src/stemmablenote.js +5 -6
  55. package/build/esm/src/stringnumber.js +0 -2
  56. package/build/esm/src/svgcontext.js +5 -13
  57. package/build/esm/src/tabnote.js +2 -8
  58. package/build/esm/src/textbracket.js +0 -3
  59. package/build/esm/src/textnote.js +0 -2
  60. package/build/esm/src/tickable.js +13 -26
  61. package/build/esm/src/tickcontext.js +20 -2
  62. package/build/esm/src/timesignature.js +2 -4
  63. package/build/esm/src/timesignote.js +2 -0
  64. package/build/esm/src/tuplet.js +37 -30
  65. package/build/esm/src/version.js +3 -3
  66. package/build/esm/src/vexflow.js +6 -2
  67. package/build/esm/src/vibrato.js +6 -1
  68. package/build/esm/tests/accidental_tests.js +30 -17
  69. package/build/esm/tests/annotation_tests.js +12 -12
  70. package/build/esm/tests/articulation_tests.js +13 -13
  71. package/build/esm/tests/auto_beam_formatting_tests.js +33 -33
  72. package/build/esm/tests/beam_tests.js +1 -1
  73. package/build/esm/tests/bend_tests.js +7 -7
  74. package/build/esm/tests/chordsymbol_tests.js +8 -8
  75. package/build/esm/tests/clef_tests.js +5 -1
  76. package/build/esm/tests/curve_tests.js +34 -0
  77. package/build/esm/tests/{bach_tests.js → demo_petzold_tests.js} +7 -7
  78. package/build/esm/tests/dot_tests.js +4 -4
  79. package/build/esm/tests/formatter_tests.js +25 -25
  80. package/build/esm/tests/glyphnote_tests.js +6 -0
  81. package/build/esm/tests/gracenote_tests.js +2 -1
  82. package/build/esm/tests/gracetabnote_tests.js +1 -1
  83. package/build/esm/tests/index.js +1 -1
  84. package/build/esm/tests/key_clef_tests.js +6 -6
  85. package/build/esm/tests/keysignature_tests.js +20 -17
  86. package/build/esm/tests/notehead_tests.js +10 -7
  87. package/build/esm/tests/offscreencanvas_tests.js +1 -1
  88. package/build/esm/tests/ornament_tests.js +8 -8
  89. package/build/esm/tests/pedalmarking_tests.js +27 -0
  90. package/build/esm/tests/percussion_tests.js +6 -3
  91. package/build/esm/tests/renderer_tests.js +1 -1
  92. package/build/esm/tests/rests_tests.js +26 -26
  93. package/build/esm/tests/rhythm_tests.js +15 -15
  94. package/build/esm/tests/stave_tests.js +44 -43
  95. package/build/esm/tests/staveconnector_tests.js +73 -73
  96. package/build/esm/tests/stavehairpin_tests.js +1 -1
  97. package/build/esm/tests/stavemodifier_tests.js +3 -3
  98. package/build/esm/tests/stavenote_tests.js +29 -29
  99. package/build/esm/tests/stavetie_tests.js +29 -0
  100. package/build/esm/tests/stringnumber_tests.js +1 -1
  101. package/build/esm/tests/strokes_tests.js +1 -1
  102. package/build/esm/tests/style_tests.js +1 -1
  103. package/build/esm/tests/tabnote_tests.js +7 -7
  104. package/build/esm/tests/tabslide_tests.js +6 -6
  105. package/build/esm/tests/tabstave_tests.js +2 -1
  106. package/build/esm/tests/tabtie_tests.js +8 -8
  107. package/build/esm/tests/textnote_tests.js +1 -1
  108. package/build/esm/tests/threevoice_tests.js +2 -2
  109. package/build/esm/tests/timesignature_tests.js +23 -13
  110. package/build/esm/tests/vexflow_test_helpers.js +25 -39
  111. package/build/esm/tests/vibrato_tests.js +3 -3
  112. package/build/esm/tests/voice_tests.js +1 -1
  113. package/build/types/src/accidental.d.ts +19 -1
  114. package/build/types/src/annotation.d.ts +1 -1
  115. package/build/types/src/beam.d.ts +12 -1
  116. package/build/types/src/bend.d.ts +6 -0
  117. package/build/types/src/clefnote.d.ts +2 -0
  118. package/build/types/src/curve.d.ts +5 -4
  119. package/build/types/src/element.d.ts +23 -14
  120. package/build/types/src/factory.d.ts +2 -2
  121. package/build/types/src/flag.d.ts +12 -0
  122. package/build/types/src/fonts/gonville.d.ts +1 -1
  123. package/build/types/src/formatter.d.ts +5 -3
  124. package/build/types/src/fraction.d.ts +12 -7
  125. package/build/types/src/frethandfinger.d.ts +1 -1
  126. package/build/types/src/index.d.ts +1 -0
  127. package/build/types/src/keysignature.d.ts +7 -7
  128. package/build/types/src/metrics.d.ts +5 -0
  129. package/build/types/src/modifier.d.ts +3 -2
  130. package/build/types/src/multimeasurerest.d.ts +4 -1
  131. package/build/types/src/note.d.ts +2 -0
  132. package/build/types/src/pedalmarking.d.ts +2 -2
  133. package/build/types/src/registry.d.ts +1 -1
  134. package/build/types/src/stave.d.ts +1 -3
  135. package/build/types/src/stavebarline.d.ts +1 -1
  136. package/build/types/src/staveline.d.ts +1 -1
  137. package/build/types/src/stavemodifier.d.ts +0 -1
  138. package/build/types/src/stavenote.d.ts +2 -1
  139. package/build/types/src/staverepetition.d.ts +1 -1
  140. package/build/types/src/stavesection.d.ts +3 -4
  141. package/build/types/src/stavetempo.d.ts +4 -5
  142. package/build/types/src/stavetext.d.ts +1 -2
  143. package/build/types/src/stavetie.d.ts +39 -2
  144. package/build/types/src/stavevolta.d.ts +1 -2
  145. package/build/types/src/stemmablenote.d.ts +2 -3
  146. package/build/types/src/svgcontext.d.ts +1 -1
  147. package/build/types/src/tickable.d.ts +2 -1
  148. package/build/types/src/tickcontext.d.ts +30 -0
  149. package/build/types/src/tuplet.d.ts +2 -12
  150. package/build/types/src/typeguard.d.ts +1 -0
  151. package/package.json +33 -29
  152. package/tests/flow.html +2 -2
@@ -1,7 +1,8 @@
1
1
  /** Fraction represents a rational number. */
2
2
  export declare class Fraction {
3
- #private;
4
3
  static get CATEGORY(): string;
4
+ private static fractionA;
5
+ private static fractionB;
5
6
  /**
6
7
  * GCD: Greatest common divisor using the Euclidean algorithm.
7
8
  * Note: GCD(0, 0) => 0 and GCD(0, n) => n.
@@ -9,7 +10,11 @@ export declare class Fraction {
9
10
  static GCD(a: number, b: number): number;
10
11
  /** LCM: Lowest common multiple. */
11
12
  static LCM(a: number, b: number): number;
12
- /** Lowest common multiple for more than two numbers. */
13
+ /** Lowest common multiple for more than two numbers.
14
+ *
15
+ * Note that the `args` array will be manipulated and shortened recursively during
16
+ * computation.
17
+ */
13
18
  static LCMM(args: number[]): number;
14
19
  numerator: number;
15
20
  denominator: number;
@@ -23,7 +28,7 @@ export declare class Fraction {
23
28
  simplify(): this;
24
29
  /** Add value of another fraction. */
25
30
  add(param1?: Fraction | number, param2?: number): this;
26
- /** Substract value of another fraction. */
31
+ /** Subtract value of another fraction. */
27
32
  subtract(param1?: Fraction | number, param2?: number): this;
28
33
  /** Multiply by value of another fraction. */
29
34
  multiply(param1?: Fraction | number, param2?: number): this;
@@ -43,15 +48,15 @@ export declare class Fraction {
43
48
  clone(): Fraction;
44
49
  /** Copy value of another fraction. */
45
50
  copy(other: Fraction | number): this;
46
- /** Return the integer component (eg. 5/2 => 2). */
51
+ /** Return the integer component (e.g. 5/2 => 2). */
47
52
  quotient(): number;
48
- /** Return the remainder component (eg. 5/2 => 1). */
53
+ /** Return the remainder component (e.g. 5/2 => 1). */
49
54
  remainder(): number;
50
55
  /** Calculate absolute value. */
51
56
  makeAbs(): this;
52
- /** Return a raw string representation (eg. "5/2"). */
57
+ /** Return a raw string representation (e.g. "5/2"). */
53
58
  toString(): string;
54
- /** Return a simplified string respresentation. */
59
+ /** Return a simplified string representation. */
55
60
  toSimplifiedString(): string;
56
61
  /** Return string representation in mixed form. */
57
62
  toMixedString(): string;
@@ -6,7 +6,7 @@ export declare class FretHandFinger extends Modifier {
6
6
  static get CATEGORY(): string;
7
7
  static format(nums: FretHandFinger[], state: ModifierContextState): boolean;
8
8
  static easyScoreHook({ fingerings }: {
9
- fingerings?: string | undefined;
9
+ fingerings?: string;
10
10
  } | undefined, note: StemmableNote, builder: Builder): void;
11
11
  protected xOffset: number;
12
12
  protected yOffset: number;
@@ -16,6 +16,7 @@ export * from './easyscore';
16
16
  export * from './element';
17
17
  export * from './factory';
18
18
  export * from './font';
19
+ export * from './flag';
19
20
  export * from './formatter';
20
21
  export * from './fraction';
21
22
  export * from './frethandfinger';
@@ -1,9 +1,8 @@
1
- import { Element } from './element';
1
+ import { BoundingBox } from './boundingbox';
2
2
  import { Stave } from './stave';
3
3
  import { StaveModifier } from './stavemodifier';
4
4
  export declare class KeySignature extends StaveModifier {
5
5
  static get CATEGORY(): string;
6
- protected glyphs: Element[];
7
6
  protected paddingForced: boolean;
8
7
  protected formatted?: boolean;
9
8
  protected cancelKeySpec?: string;
@@ -14,7 +13,7 @@ export declare class KeySignature extends StaveModifier {
14
13
  protected keySpec?: string;
15
14
  protected alterKeySpec?: string[];
16
15
  constructor(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]);
17
- convertToGlyph(acc: {
16
+ protected convertToGlyph(acc: {
18
17
  type: string;
19
18
  line: number;
20
19
  }, nextAcc: {
@@ -22,7 +21,7 @@ export declare class KeySignature extends StaveModifier {
22
21
  line: number;
23
22
  }, stave: Stave): void;
24
23
  cancelKey(spec: string): this;
25
- convertToCancelAccList(spec: string): {
24
+ protected convertToCancelAccList(spec: string): {
26
25
  type: string;
27
26
  accList: {
28
27
  type: string;
@@ -30,7 +29,9 @@ export declare class KeySignature extends StaveModifier {
30
29
  }[];
31
30
  } | undefined;
32
31
  addToStave(stave: Stave): this;
33
- convertAccLines(clef: string, type?: string, accList?: {
32
+ getBoundingBox(): BoundingBox;
33
+ protected calculateDimensions(): void;
34
+ protected convertAccLines(clef: string, type?: string, accList?: {
34
35
  type: string;
35
36
  line: number;
36
37
  }[]): void;
@@ -38,8 +39,7 @@ export declare class KeySignature extends StaveModifier {
38
39
  getWidth(): number;
39
40
  setKeySig(keySpec: string, cancelKeySpec?: string, alterKeySpec?: string[]): this;
40
41
  alterKey(alterKeySpec: string[]): this;
41
- convertToAlterAccList(alterKeySpec: string[]): void;
42
+ protected convertToAlterAccList(alterKeySpec: string[]): void;
42
43
  format(): void;
43
- protected calculateWidth(): void;
44
44
  draw(): void;
45
45
  }
@@ -1,7 +1,12 @@
1
+ import { ElementStyle } from './element';
1
2
  import { FontInfo } from './font';
2
3
  export declare class Metrics {
4
+ protected static cacheStyle: Map<string, ElementStyle>;
5
+ protected static cacheFont: Map<string, Required<FontInfo>>;
3
6
  /** Use the provided key to look up a FontInfo in CommonMetrics. **/
7
+ static clear(key?: string): void;
4
8
  static getFontInfo(key: string): Required<FontInfo>;
9
+ static getStyle(key: string): ElementStyle;
5
10
  /**
6
11
  * Use the provided key to look up a value in CommonMetrics.
7
12
  *
@@ -21,7 +21,6 @@ export declare enum ModifierPosition {
21
21
  * `ModifierContext`. This ensures that multiple voices don't trample all over each other.
22
22
  */
23
23
  export declare class Modifier extends Element {
24
- #private;
25
24
  /**
26
25
  * Modifiers category string. Every modifier has a different category.
27
26
  * The `ModifierContext` uses this to determine the type and order of the modifiers.
@@ -34,6 +33,8 @@ export declare class Modifier extends Element {
34
33
  protected index?: number;
35
34
  protected textLine: number;
36
35
  protected position: ModifierPosition;
36
+ protected spacingFromNextModifier: number;
37
+ protected modifierContext?: ModifierContext;
37
38
  constructor();
38
39
  /** Called when position changes. */
39
40
  protected reset(): void;
@@ -85,5 +86,5 @@ export declare class Modifier extends Element {
85
86
  getXShift(): number;
86
87
  /** Render the modifier onto the canvas. */
87
88
  draw(): void;
88
- alignSubNotesWithNote(subNotes: Note[], note: Note): void;
89
+ alignSubNotesWithNote(subNotes: Note[], note: Note, position?: ModifierPosition): void;
89
90
  }
@@ -30,7 +30,6 @@ export interface MultimeasureRestRenderOptions {
30
30
  serifThickness?: number;
31
31
  }
32
32
  export declare class MultiMeasureRest extends Element {
33
- #private;
34
33
  static get CATEGORY(): string;
35
34
  renderOptions: Required<MultimeasureRestRenderOptions>;
36
35
  protected xs: {
@@ -39,6 +38,10 @@ export declare class MultiMeasureRest extends Element {
39
38
  };
40
39
  protected numberOfMeasures: number;
41
40
  protected stave?: Stave;
41
+ protected hasPaddingLeft: boolean;
42
+ protected hasPaddingRight: boolean;
43
+ protected hasLineThickness: boolean;
44
+ protected hasSymbolSpacing: boolean;
42
45
  /**
43
46
  *
44
47
  * @param numberOfMeasures Number of measures.
@@ -1,4 +1,5 @@
1
1
  import { Beam } from './beam';
2
+ import { BoundingBox } from './boundingbox';
2
3
  import { Fraction } from './fraction';
3
4
  import { Modifier } from './modifier';
4
5
  import { RenderContext } from './rendercontext';
@@ -227,4 +228,5 @@ export declare abstract class Note extends Tickable {
227
228
  getTieLeftX(): number;
228
229
  getKeys(): string[];
229
230
  getKeyProps(): KeyProps[];
231
+ getBoundingBox(): BoundingBox;
230
232
  }
@@ -13,8 +13,8 @@ export declare class PedalMarking extends Element {
13
13
  static get CATEGORY(): string;
14
14
  protected line: number;
15
15
  protected type: number;
16
- protected customDepressText: string;
17
- protected customReleaseText: string;
16
+ protected depressText: string;
17
+ protected releaseText: string;
18
18
  renderOptions: {
19
19
  color: string;
20
20
  bracketHeight: number;
@@ -14,7 +14,7 @@ export interface RegistryUpdate {
14
14
  oldValue: string | undefined;
15
15
  }
16
16
  export declare class Registry {
17
- #private;
17
+ protected static defaultRegistry?: Registry;
18
18
  static getDefaultRegistry(): Registry | undefined;
19
19
  static enableDefaultRegistry(registry: Registry): void;
20
20
  static disableDefaultRegistry(): void;
@@ -12,7 +12,6 @@ export interface StaveOptions {
12
12
  spaceBelowStaffLn?: number;
13
13
  spaceAboveStaffLn?: number;
14
14
  verticalBarWidth?: number;
15
- fillStyle?: string;
16
15
  leftBar?: boolean;
17
16
  rightBar?: boolean;
18
17
  spacingBetweenLinesPx?: number;
@@ -51,7 +50,6 @@ export declare class Stave extends Element {
51
50
  getBottomLineBottomY(): number;
52
51
  setX(x: number): this;
53
52
  setWidth(width: number): this;
54
- getStyle(): ElementStyle;
55
53
  /**
56
54
  * Set the measure number of this Stave.
57
55
  */
@@ -154,7 +152,7 @@ export declare class Stave extends Element {
154
152
  /**
155
153
  * All drawing functions below need the context to be set.
156
154
  */
157
- draw(): this;
155
+ draw(): void;
158
156
  getVerticalBarWidth(): number;
159
157
  /**
160
158
  * Get the current configuration for the Stave.
@@ -21,7 +21,7 @@ export declare class Barline extends StaveModifier {
21
21
  constructor(type: BarlineType | string);
22
22
  getType(): number;
23
23
  setType(type: string | number): this;
24
- draw(stave: Stave): void;
24
+ draw(): void;
25
25
  drawVerticalBar(stave: Stave, x: number, doubleBar?: boolean): void;
26
26
  drawVerticalEndBar(stave: Stave, x: number): void;
27
27
  drawRepeatBar(stave: Stave, x: number, begin: boolean): void;
@@ -45,5 +45,5 @@ export declare class StaveLine extends Element {
45
45
  x: number;
46
46
  y: number;
47
47
  }): void;
48
- draw(): this;
48
+ draw(): void;
49
49
  }
@@ -32,5 +32,4 @@ export declare class StaveModifier extends Element {
32
32
  setPadding(padding: number): this;
33
33
  setLayoutMetrics(layoutMetrics: LayoutMetrics): this;
34
34
  getLayoutMetrics(): LayoutMetrics | undefined;
35
- draw(...args: any[]): void;
36
35
  }
@@ -40,7 +40,6 @@ export interface StaveNoteStruct extends NoteStruct {
40
40
  clef?: string;
41
41
  }
42
42
  export declare class StaveNote extends StemmableNote {
43
- #private;
44
43
  static DEBUG: boolean;
45
44
  static get CATEGORY(): string;
46
45
  static get LEDGER_LINE_OFFSET(): number;
@@ -56,6 +55,8 @@ export declare class StaveNote extends StemmableNote {
56
55
  protected dotShiftY: number;
57
56
  protected useDefaultHeadX: boolean;
58
57
  protected ledgerLineStyle: ElementStyle;
58
+ private _noteHeads;
59
+ private sortedKeyProps;
59
60
  constructor(noteStruct: StaveNoteStruct);
60
61
  reset(): this;
61
62
  setBeam(beam: Beam): this;
@@ -23,7 +23,7 @@ export declare class Repetition extends StaveModifier {
23
23
  constructor(type: number, x: number, yShift: number);
24
24
  setShiftX(x: number): this;
25
25
  setShiftY(y: number): this;
26
- draw(stave: Stave, x: number): this;
26
+ draw(): void;
27
27
  drawCodaFixed(stave: Stave, x: number): this;
28
28
  drawSegnoFixed(stave: Stave, x: number): this;
29
29
  drawSymbolText(stave: Stave, x: number, text: string, drawCoda: boolean): this;
@@ -1,9 +1,8 @@
1
- import { Stave } from './stave';
2
1
  import { StaveModifier } from './stavemodifier';
3
2
  export declare class StaveSection extends StaveModifier {
4
3
  static get CATEGORY(): string;
5
4
  protected drawRect: boolean;
6
- constructor(section: string, x: number, yShift: number, drawRect?: boolean);
7
- setStaveSection(section: string): this;
8
- draw(stave: Stave, xShift: number): this;
5
+ constructor(section: string, x?: number, yShift?: number, drawRect?: boolean);
6
+ setDrawRect(drawRect: boolean): this;
7
+ draw(): void;
9
8
  }
@@ -1,4 +1,3 @@
1
- import { Stave } from './stave';
2
1
  import { StaveModifier } from './stavemodifier';
3
2
  export interface StaveTempoOptions {
4
3
  /** free text i.e.: 'Adagio', 'Andate grazioso', ... */
@@ -10,7 +9,7 @@ export interface StaveTempoOptions {
10
9
  parenthesis?: boolean;
11
10
  /**
12
11
  * Indicates the graphical note type to use in a metronome mark.
13
- * see: `StaveTempo.#durationToCode`.
12
+ * see: `StaveTempo.durationToCode`.
14
13
  */
15
14
  duration?: string;
16
15
  /**
@@ -25,7 +24,7 @@ export interface StaveTempoOptions {
25
24
  /**
26
25
  * Indicates the graphical note type to use at the right of the equation
27
26
  * in a metronome mark.
28
- * see: `StaveTempo.#durationToCode`.
27
+ * see: `StaveTempo.durationToCode`.
29
28
  */
30
29
  duration2?: string;
31
30
  /**
@@ -35,10 +34,10 @@ export interface StaveTempoOptions {
35
34
  dots2?: number;
36
35
  }
37
36
  export declare class StaveTempo extends StaveModifier {
38
- #private;
39
37
  static get CATEGORY(): string;
40
38
  protected tempo: StaveTempoOptions;
41
39
  constructor(tempo: StaveTempoOptions, x: number, shiftY: number);
40
+ protected durationToCode: Record<string, string>;
42
41
  setTempo(tempo: StaveTempoOptions): this;
43
- draw(stave: Stave, shiftX: number): this;
42
+ draw(): void;
44
43
  }
@@ -1,4 +1,3 @@
1
- import { Stave } from './stave';
2
1
  import { StaveModifier } from './stavemodifier';
3
2
  export declare class StaveText extends StaveModifier {
4
3
  static get CATEGORY(): string;
@@ -8,5 +7,5 @@ export declare class StaveText extends StaveModifier {
8
7
  shiftY?: number;
9
8
  justification?: number;
10
9
  });
11
- draw(stave: Stave): this;
10
+ draw(): void;
12
11
  }
@@ -9,11 +9,14 @@ export interface TieNotes {
9
9
  export declare class StaveTie extends Element {
10
10
  static get CATEGORY(): string;
11
11
  renderOptions: {
12
+ cp1: number;
12
13
  cp2: number;
14
+ shortTieCutoff: number;
15
+ cp1Short: number;
16
+ cp2Short: number;
17
+ firstXShift: number;
13
18
  lastXShift: number;
14
19
  tieSpacing: number;
15
- cp1: number;
16
- firstXShift: number;
17
20
  textShiftX: number;
18
21
  yShift: number;
19
22
  };
@@ -32,6 +35,11 @@ export declare class StaveTie extends Element {
32
35
  * @param text
33
36
  */
34
37
  constructor(notes: TieNotes, text?: string);
38
+ /**
39
+ * Returns either the direction explicitly set with setDirection, or
40
+ * a logical direction based on lastNote or firstNote.
41
+ */
42
+ getDirection(): number;
35
43
  setDirection(direction: number): this;
36
44
  /**
37
45
  * Set the notes to attach this tie to.
@@ -63,5 +71,34 @@ export declare class StaveTie extends Element {
63
71
  * Returns the TieNotes structure of the first and last note this tie connects.
64
72
  */
65
73
  getNotes(): TieNotes;
74
+ /**
75
+ * Returns the X position in pixels that the tie will be drawn starting from;
76
+ * ideally from the firstNote, alternatively from the lastNote, or 0 if all else fails.
77
+ */
78
+ getFirstX(): number;
79
+ /**
80
+ * Returns the X position in pixels that the tie will be drawn ending at;
81
+ * ideally from the firstNote, alternatively from the lastNote, or 0 if all else fails.
82
+ */
83
+ getLastX(): number;
84
+ /**
85
+ * Get the Y positions of the places where a tie needs to be drawn starting from.
86
+ */
87
+ getFirstYs(): number[];
88
+ /**
89
+ * Get the Y positions of the places where a tie needs to be drawn ending at.
90
+ */
91
+ getLastYs(): number[];
92
+ /**
93
+ * If a tie has firstNote and not lastNote, or vice-versa, then their
94
+ * firstIndexes and lastIndexes need to be equal to each other.
95
+ *
96
+ * Does nothing if both notes.firstNote and notes.lastNote are defined (or
97
+ * if neither are)
98
+ *
99
+ * (Note that after doing so they share a common Array object, so any change
100
+ * to one will affect the other; this behavior may change in a future release)
101
+ */
102
+ synchronizeIndexes(): void;
66
103
  draw(): boolean;
67
104
  }
@@ -1,4 +1,3 @@
1
- import { Stave } from './stave';
2
1
  import { StaveModifier } from './stavemodifier';
3
2
  export declare enum VoltaType {
4
3
  NONE = 1,
@@ -12,5 +11,5 @@ export declare class Volta extends StaveModifier {
12
11
  static get type(): typeof VoltaType;
13
12
  protected type: number;
14
13
  constructor(type: number, label: string, x: number, yShift: number);
15
- draw(stave: Stave, x: number): this;
14
+ draw(): void;
16
15
  }
@@ -1,12 +1,11 @@
1
- import { Element, ElementStyle } from './element';
1
+ import { Flag } from './flag';
2
2
  import { GlyphProps, Note, NoteStruct } from './note';
3
3
  import { Stem, StemOptions } from './stem';
4
4
  export declare abstract class StemmableNote extends Note {
5
5
  static get CATEGORY(): string;
6
6
  stemDirection?: number;
7
7
  stem?: Stem;
8
- protected flag: Element;
9
- protected flagStyle: ElementStyle;
8
+ protected flag: Flag;
10
9
  protected stemExtensionOverride?: number;
11
10
  constructor(noteStruct: NoteStruct);
12
11
  getStem(): Stem | undefined;
@@ -18,7 +18,6 @@ export interface State {
18
18
  * SVG rendering context with an API similar to CanvasRenderingContext2D.
19
19
  */
20
20
  export declare class SVGContext extends RenderContext {
21
- #private;
22
21
  protected static measureTextElement: Element;
23
22
  element: HTMLElement;
24
23
  svg: SVGSVGElement;
@@ -109,6 +108,7 @@ export declare class SVGContext extends RenderContext {
109
108
  quadraticCurveTo(x1: number, y1: number, x: number, y: number): this;
110
109
  arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise: boolean): this;
111
110
  closePath(): this;
111
+ protected getShadowStyle(): string;
112
112
  fill(attributes?: Attributes): this;
113
113
  stroke(): this;
114
114
  measureText(text: string): TextMeasure;
@@ -25,7 +25,6 @@ export interface FormatterMetrics {
25
25
  * has a duration, i.e., Tickables occupy space in the musical rendering dimension.
26
26
  */
27
27
  export declare abstract class Tickable extends Element {
28
- #private;
29
28
  static get CATEGORY(): string;
30
29
  protected ignoreTicks: boolean;
31
30
  protected tupletStack: Tuplet[];
@@ -40,6 +39,8 @@ export declare abstract class Tickable extends Element {
40
39
  protected formatterMetrics: FormatterMetrics;
41
40
  protected intrinsicTicks: number;
42
41
  protected alignCenter: boolean;
42
+ private _preFormatted;
43
+ private _postFormatted;
43
44
  constructor();
44
45
  /** Reset the Tickable, this function will be overloaded. */
45
46
  reset(): this;
@@ -10,6 +10,9 @@ export interface TickContextOptions {
10
10
  }
11
11
  /**
12
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.
13
16
  */
14
17
  export declare class TickContext {
15
18
  protected readonly tickID: number;
@@ -42,6 +45,9 @@ export declare class TickContext {
42
45
  right: number;
43
46
  };
44
47
  };
48
+ /**
49
+ * Get the next TickContext from another TickContext, from the `.tContexts` array.
50
+ */
45
51
  static getNextContext(tContext: TickContext): TickContext | undefined;
46
52
  constructor(options?: TickContextOptions);
47
53
  getTickID(): number;
@@ -79,4 +85,28 @@ export declare class TickContext {
79
85
  right: number;
80
86
  };
81
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;
82
112
  }
@@ -50,12 +50,7 @@ export interface TupletOptions {
50
50
  numNotes?: number;
51
51
  ratioed?: boolean;
52
52
  yOffset?: number;
53
- }
54
- export interface TupletMetrics {
55
- noteHeadOffset: number;
56
- stemOffset: number;
57
- bottomLine: number;
58
- topModifierOffset: number;
53
+ textYOffset?: number;
59
54
  }
60
55
  export declare const enum TupletLocation {
61
56
  BOTTOM = -1,
@@ -64,13 +59,8 @@ export declare const enum TupletLocation {
64
59
  export declare class Tuplet extends Element {
65
60
  static get CATEGORY(): string;
66
61
  notes: Note[];
67
- protected options: TupletOptions;
68
- protected numNotes: number;
69
- protected bracketed: boolean;
62
+ protected options: Required<TupletOptions>;
70
63
  protected textElement: Element;
71
- protected location: number;
72
- protected notesOccupied: number;
73
- protected ratioed: boolean;
74
64
  static get LOCATION_TOP(): number;
75
65
  static get LOCATION_BOTTOM(): number;
76
66
  static get NESTING_OFFSET(): number;
@@ -44,6 +44,7 @@ export declare const enum Category {
44
44
  Curve = "Curve",
45
45
  Dot = "Dot",
46
46
  Element = "Element",
47
+ Flag = "Flag",
47
48
  Fraction = "Fraction",
48
49
  FretHandFinger = "FretHandFinger",
49
50
  GhostNote = "GhostNote",