import { ArtistRenderer } from './ArtistRenderer'; import { ArticulationBuilder } from './ArticulationBuilder'; import { NoteBuilder } from './NoteBuilder'; import { StaveBuilder } from './StaveBuilder'; import { TextBuilder } from './TextBuilder'; /** * Configuration options accepted by the Artist constructor. */ export type ArtistOptions = { font_face: string; font_size: number; font_style: string | null; bottom_spacing: number; tab_stave_lower_spacing: number; note_stave_lower_spacing: number; scale: number; }; /** * Map of VexTab customization values, normalized to strings/numbers. */ export type CustomizationMap = Record; /** * Represents a grouped pair of staves and their voice/note collections. */ export type StaveGroup = { tab: any | null; note: any | null; tab_voices: any[]; note_voices: any[]; tab_notes: any[]; note_notes: any[]; text_voices: any[]; meter: string; color?: string; key: string; capo: number; tabRhythmSpace: number; voiceSettings: VoiceSettings[]; beam_groups: any; }; /** Formatting settings captured at a stave or voice declaration. */ export interface VoiceSettings { options: CustomizationMap; direction?: string; groups: Array<[number, number]>; } /** * Artist orchestrates the VexFlow rendering pipeline. It tracks mutable state * (staves, durations, bends, fonts) while delegating focused work to helper * classes. The helper classes keep the implementation readable without * changing the public VexTab API. */ export default class Artist { static DEBUG: boolean; /** @deprecated Scores are always unbranded. Retained for existing embeds. */ static NOLOGO: boolean; options: ArtistOptions; customizations: CustomizationMap; tuning: any; key_manager: any; music_api: any; staves: StaveGroup[]; tab_articulations: any[]; stave_articulations: any[]; player_voices: any[]; last_y: number; current_duration: string; current_dots: number; current_head: string; current_clef: string; current_bends: Record; current_octave_shift: number; bend_start_index: number | null; bend_start_strings: number[] | null; rendered: boolean; renderer_context: any; player: any | null; renderer: ArtistRenderer; articulations: ArticulationBuilder; notes: NoteBuilder; stavesBuilder: StaveBuilder; text: TextBuilder; x: number; y: number; width: number; /** * Construct an Artist with initial layout coordinates and options. * Design note: we keep defaults here to isolate configuration in one place. */ constructor(x: number, y: number, width: number, options?: Partial); /** * Conditional logging helper. */ log(...args: any[]): void; /** * Reset the Artist's internal state prior to a new parse/render cycle. * Design note: this is intentionally comprehensive to avoid stale state leaks. */ reset(): void; /** * Attach a playback helper to the Artist. */ attachPlayer(player: any): void; /** * Apply user-provided options and validate known keys. */ setOptions(options: Record, error?: (_key: string, message: string) => Error): void; /** * Return data used by the Player overlay. */ getPlayerData(): { voices: any[]; context: any; scale: number; }; /** * Render the currently parsed score using the provided renderer. */ render(renderer: any): void; /** * Backwards-compatible alias for render(). */ draw(renderer: any): void; /** * Whether render() has been called and finished. */ isRendered(): boolean; /** * @deprecated All scores are unbranded. */ isLogoHidden(): boolean; /** * Set the duration used for subsequent notes. */ setDuration(time: string, dot?: boolean | number): void; /** * Add a barline to the current stave group. */ addBar(type: string): void; /** * Build tuplets for the current voice. */ makeTuplets(tuplets: number, notes?: number): void; /** * Add annotations that will be attached to upcoming notes. */ addAnnotations(annotations: string[]): void; /** * Add articulations that will be attached to upcoming notes. */ addArticulations(articulations: Array): void; /** * Add a decorator (e.g., segno/coda) to upcoming notes. */ addDecorator(decorator?: string | null): void; /** * Add a rest with the given parameters. */ addRest(params: Record): void; /** * Add a chord built from multiple note definitions. */ addChord(chord: any[], chord_articulation?: string | null, chord_decorator?: string | null): void; /** * Add a single note. */ addNote(note: any): void; /** * Add a new text voice (for lyric or annotation lines). */ addTextVoice(): void; /** * Set the font used for subsequent text notes. */ setTextFont(font: string): void; /** * Add a text note to the current text voice. */ addTextNote(text: string, position?: number, justification?: 'center' | 'left' | 'right', smooth?: boolean, ignore_ticks?: boolean): void; /** * Add a new voice to the current stave group. */ addVoice(options?: Record): void; /** * Add a new stave (notation, tablature, or both) to the score. */ addStave(element: string, options: Record): void; /** * Open a bend span between notes (used for tab bends). */ openBends(first_note: any, last_note: any, first_indices: number[], last_indices: number[]): void; /** * Close any open bend spans. */ closeBends(offset?: number): void; /** * Handle dot-prefixed VexTab commands (e.g., octave-shift). */ runCommand(line: string, lineNumber?: number, column?: number): void; }