import { Accidental } from './accidental'; import { AccordionRanks, AccordionRegister } from './accordionregister'; import { Annotation, AnnotationHorizontalJustify, AnnotationVerticalJustify } from './annotation'; import { Articulation } from './articulation'; import { BarNote } from './barnote'; import { Beam, FeatheredBeamDirection, PartialBeamDirection } from './beam'; import { Bend } from './bend'; import { ChordSymbol } from './chordsymbol'; import { Clef } from './clef'; import { ClefNote } from './clefnote'; import { Crescendo } from './crescendo'; import { Curve, CurveOptions } from './curve'; import { Dot } from './dot'; import { EasyScore, EasyScoreOptions } from './easyscore'; import { Element } from './element'; import { EngravingProfile } from './engravingprofile'; import { FiguredBass, FiguredBassSpec } from './figuredbass'; import { FontInfo } from './font'; import { Formatter, FormatterOptions } from './formatter'; import { FrenchLuteNote, FrenchLuteNoteStruct } from './frenchlutenote'; import { FretHandFinger } from './frethandfinger'; import { GermanLuteNote, GermanLuteNoteStruct } from './germanlutenote'; import { GhostNote } from './ghostnote'; import { GlyphNote, GlyphNoteOptions } from './glyphnote'; import { GraceNote, GraceNoteStruct } from './gracenote'; import { GraceNoteGroup } from './gracenotegroup'; import { GraceTabNote } from './gracetabnote'; import { KeySignature } from './keysignature'; import { KeySigNote } from './keysignote'; import { KievanNote, KievanNoteStruct } from './kievannote'; import { Modifier } from './modifier'; import { ModifierContext } from './modifiercontext'; import { MultiMeasureRest, MultimeasureRestRenderOptions } from './multimeasurerest'; import { Note, NoteStruct } from './note'; import { NoteSubGroup } from './notesubgroup'; import { Ornament } from './ornament'; import { Parenthesis } from './parenthesis'; import { PedalMarking } from './pedalmarking'; import { RenderContext } from './rendercontext'; import { RepeatNote } from './repeatnote'; import { Sheet, SheetOptions } from './sheet'; import { Stave, StaveOptions } from './stave'; import { Barline, BarlineType } from './stavebarline'; import { StaveConnector, StaveConnectorType } from './staveconnector'; import { StaveHairpin, StaveHairpinRenderOptions } from './stavehairpin'; import { StaveLine } from './staveline'; import { StaveNote, StaveNoteStruct } from './stavenote'; import { Repetition } from './staverepetition'; import { StaveSection } from './stavesection'; import { StaveTempo } from './stavetempo'; import { StaveText } from './stavetext'; import { StaveTie } from './stavetie'; import { Volta } from './stavevolta'; import { StemmableNote } from './stemmablenote'; import { StringNumber } from './stringnumber'; import { Stroke } from './strokes'; import { System, SystemOptions } from './system'; import { TabNote, TabNoteStruct } from './tabnote'; import { TabSlide } from './tabslide'; import { TabStave } from './tabstave'; import { TabTie } from './tabtie'; import { TextBracket } from './textbracket'; import { TextDynamics } from './textdynamics'; import { TextNote, TextNoteStruct } from './textnote'; import { TickContext } from './tickcontext'; import { TimeSignature } from './timesignature'; import { TimeSigNote } from './timesignote'; import { Tremolo } from './tremolo'; import { Tuplet, TupletOptions } from './tuplet'; import { Vibrato } from './vibrato'; import { VibratoBracket } from './vibratobracket'; import { Voice, VoiceTime } from './voice'; /** Explicit drawing role for a native extension adopted into a Factory. */ export type FactoryElementRole = 'note' | 'modifier' | 'staveModifier' | 'drawable'; export interface FactoryOptions { /** Optional per-score pitched notation and beam policy. */ engraving?: EngravingProfile; stave?: { space: number; }; renderer?: { elementId: string | null; backend?: number; width: number; height: number; background?: string; }; } /** * Factory implements a high level API around VexFlow. */ export declare class Factory { /** To enable logging for this class. Set `VexFlow.Factory.DEBUG` to `true`. */ static DEBUG: boolean; /** * Static simplified function to access constructor without providing FactoryOptions * * Example: * * Create an SVG renderer and attach it to the DIV element named "boo" to render using 1200 and 600 * * `const vf: Factory = VexFlow.Factory.newFromElementId('boo', 1200, 600 );` */ static newFromElementId(elementId: string | null, width?: number, height?: number): Factory; protected options: Required> & Pick; protected stave?: Stave; protected context: RenderContext; protected staves: Stave[]; protected voices: Voice[]; protected renderQ: Element[]; protected systems: System[]; protected sheets: Sheet[]; private retained; /** Ownership survives drawing; weak keys do not retain discarded notation. */ private static owners; private constructionScopes; private groupScopes; private static groups; /** A grouped note draws only through its modifier, never through a main voice or queue. */ static getGroup(note: Note): Modifier | undefined; /** Identify the Factory that created an element, without changing its draw role. */ static getOwner(element: Element): Factory | undefined; /** Record ownership independently of whether the element draws itself or attaches to a note. */ private own; /** * Adopt a native extension without guessing its drawing role. Attachment and layout remain explicit. * Repeating adoption cannot enqueue an element twice. Ownership survives draw/reset. */ adopt(element: T, role: FactoryElementRole): T; /** Stage synchronous construction. Failed operations preserve existing queues and registry entries. */ transaction(build: () => T): T; /** Foreground defaults survive reset(), like renderer options. */ protected style: { fillStyle?: string; strokeStyle?: string; }; /** * Example: * * Create an SVG renderer and attach it to the DIV element named "boo" to render using 1200 and 600 * * `const vf: Factory = new VexFlow.Factory({renderer: { elementId: 'boo', width: 1200, height: 600 }});` */ constructor(options?: FactoryOptions); reset(): void; setOptions(options?: FactoryOptions): void; initRenderer(): void; getContext(): RenderContext; setContext(context: RenderContext): this; getStave(): Stave | undefined; getVoices(): Voice[]; /** Set score colors. Explicit element styles override these defaults. */ setStyle(style: { fillStyle?: string; strokeStyle?: string; }): this; /** Create an optional continuous sheet from measure-sized Systems. */ Sheet(options?: Omit): Sheet; /** Return pixels from current stave spacing. */ Stave(params?: { x?: number; y?: number; width?: number; options?: StaveOptions; }): Stave; TabStave(params?: { x?: number; y?: number; width?: number; options?: StaveOptions; }): TabStave; /** Construct a native Bend with an explicit drawing role. */ Bend(...args: ConstructorParameters): Bend; /** Apply a score's music family to glyph elements while retaining their individual sizes. */ private musicGlyph; /** Construct a native Clef with an explicit drawing role. */ Clef(...args: ConstructorParameters): Clef; /** Construct a native KeySignature with an explicit drawing role. */ KeySignature(...args: ConstructorParameters): KeySignature; /** Construct a native TimeSignature with an explicit drawing role. */ TimeSignature(...args: ConstructorParameters): TimeSignature; /** Construct a native Barline with an explicit drawing role. */ Barline(...args: ConstructorParameters): Barline; /** Construct a native Repetition with an explicit drawing role. */ Repetition(...args: ConstructorParameters): Repetition; /** Construct a native Volta with an explicit drawing role. */ Volta(...args: ConstructorParameters): Volta; /** Construct a native StaveSection with an explicit drawing role. */ StaveSection(...args: ConstructorParameters): StaveSection; /** Construct a native StaveTempo with an explicit drawing role. */ StaveTempo(...args: ConstructorParameters): StaveTempo; /** Construct a native StaveText with an explicit drawing role. */ StaveText(...args: ConstructorParameters): StaveText; /** Construct a native TabTie with an explicit drawing role. */ TabTie(...args: ConstructorParameters): TabTie; /** Construct a native TabSlide with an explicit drawing role. */ TabSlide(...args: ConstructorParameters): TabSlide; /** Grace tab children draw through a GraceNoteGroup, never as standalone tickables. */ GraceTabNote(options: TabNoteStruct): GraceTabNote; StaveNote(noteStruct: StaveNoteStruct): StaveNote; /** Place a German lute attack on the current staffless stave. */ GermanLuteNote(spec: GermanLuteNoteStruct): GermanLuteNote; /** Engrave a written pitch with its Kievan half-note form. */ KievanNote(spec: KievanNoteStruct): KievanNote; GlyphNote(glyph: string, noteStruct: NoteStruct, options?: GlyphNoteOptions): GlyphNote; RepeatNote(type: string, noteStruct?: NoteStruct, options?: GlyphNoteOptions): RepeatNote; GhostNote(noteStruct: string | NoteStruct): GhostNote; TextNote(noteStruct: TextNoteStruct): TextNote; BarNote(params?: { type?: BarlineType | string; }): BarNote; ClefNote(params?: { type?: string; options?: { size?: string; annotation?: string; }; }): ClefNote; TimeSigNote(params?: { time?: string; }): TimeSigNote; KeySigNote(params: { key: string; cancelKey?: string; alterKey?: string[]; clef?: string; }): KeySigNote; /** Queue French lute letters and open bass signs on the current tablature stave. */ FrenchLuteNote(noteStruct: FrenchLuteNoteStruct, drawStem?: boolean): FrenchLuteNote; TabNote(noteStruct: TabNoteStruct, drawStem?: boolean): TabNote; GraceNote(noteStruct: GraceNoteStruct): GraceNote; GraceNoteGroup(params: { notes: StemmableNote[]; slur?: boolean; }): GraceNoteGroup; Accidental(params: { type: string; }): Accidental; /** Create a note-attached register mark using this score's music font. */ AccordionRegister(ranks: AccordionRanks): AccordionRegister; Annotation(params?: { text?: string; hJustify?: string | AnnotationHorizontalJustify; vJustify?: string | AnnotationVerticalJustify; font?: FontInfo; }): Annotation; ChordSymbol(params?: { vJustify?: string; hJustify?: string; fontFamily?: string; fontSize?: number; fontWeight?: string; }): ChordSymbol; Articulation(params?: { betweenLines?: boolean; type?: string; position?: string | number; }): Articulation; Ornament(type: string, params?: { position?: string | number; upperAccidental?: string; lowerAccidental?: string; auxiliaryPitch?: string; parenthesized?: boolean; delayed?: boolean; }): Ornament; TextDynamics(params?: Partial): TextDynamics; Fingering(params: { number?: string; position?: string; drawCircle?: boolean; }): FretHandFinger; StringNumber(params: { number: string; position: string; }, drawCircle?: boolean): StringNumber; TickContext(): TickContext; ModifierContext(): ModifierContext; MultiMeasureRest(params: MultimeasureRestRenderOptions): MultiMeasureRest; Voice(params?: { time?: VoiceTime | string; }): Voice; StaveConnector(params: { topStave: Stave; bottomStave: Stave; type: StaveConnectorType; }): StaveConnector; Formatter(options?: FormatterOptions): Formatter; Tuplet(params?: { notes?: Note[]; options?: TupletOptions; }): Tuplet; Beam(params: { notes: StemmableNote[]; options?: { autoStem?: boolean; feathered?: FeatheredBeamDirection; frenchBeams?: boolean; secondaryBeamBreaks?: number[]; partialBeamDirections?: { [noteIndex: number]: PartialBeamDirection; }; }; }): Beam; Curve(params: { from: Note | undefined; to: Note | undefined; options: CurveOptions; }): Curve; StaveTie(params: { from?: Note | null; to?: Note | null; firstIndexes?: number[]; lastIndexes?: number[]; text?: string; options?: { direction?: number; laissezVibrer?: number; }; }): StaveTie; /** Queue independent figured-bass rows beneath their bass notes. */ FiguredBass(spec: FiguredBassSpec): FiguredBass; StaveLine(params: { from: StaveNote; to: StaveNote; firstIndexes: number[]; lastIndexes: number[]; options?: { text?: string; font?: FontInfo; }; }): StaveLine; VibratoBracket(params: { from: Note | null; to: Note | null; options: { code?: number; line?: number; }; }): VibratoBracket; TextBracket(params: { from: Note; to: Note; text: string; options: { superscript: string; position: string; line?: number; font?: FontInfo; }; }): TextBracket; System(params?: SystemOptions): System; /** * Creates EasyScore. Normally the first step after constructing a Factory. For example: * ``` * const vf: Factory = new VexFlow.Factory({renderer: { elementId: 'boo', width: 1200, height: 600 }}); * const score: EasyScore = vf.EasyScore(); * ``` * @param options.factory optional instance of Factory * @param options.builder instance of Builder * @param options.commitHooks function to call after a note element is created * @param options.throwOnError throw error in case of parsing error */ EasyScore(options?: EasyScoreOptions): EasyScore; PedalMarking(params?: { notes?: StaveNote[]; options?: { style: string; }; }): PedalMarking; NoteSubGroup(params?: { notes?: Note[]; }): NoteSubGroup; /** Transfer unvoiced notes to one modifier. Validation happens before native voice assignment. */ groupNotes(notes: Note[], construct: () => T): T; /** Construct a native Dot for attachment; preserve its full constructor options. */ Dot(...args: ConstructorParameters): Dot; /** Construct a native Parenthesis for attachment; preserve its full constructor options. */ Parenthesis(...args: ConstructorParameters): Parenthesis; /** Construct a native Stroke for attachment; preserve its full constructor options. */ Stroke(...args: ConstructorParameters): Stroke; /** Construct a native Tremolo for attachment; preserve its full constructor options. */ Tremolo(...args: ConstructorParameters): Tremolo; /** Construct a native Vibrato for attachment; preserve its full constructor options. */ Vibrato(...args: ConstructorParameters): Vibrato; /** Timed crescendo note; span hairpins have a separate constructor. */ Crescendo(...args: ConstructorParameters): Crescendo; /** Stave-bound hairpin. The native renderer requires both endpoints. */ StaveHairpin(params: { from: Note; to: Note; type: number; options?: Partial; }): StaveHairpin; /** Render the score. */ draw(options?: { retain?: boolean; }): void; }