import { VexFlowBackend } from "./../MusicalScore/Graphical/VexFlow/VexFlowBackend"; import { GraphicalMusicSheet } from "./../MusicalScore/Graphical/GraphicalMusicSheet"; import { VexFlowMusicSheetDrawer } from "./../MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer"; import { MusicSheet } from "./../MusicalScore/MusicSheet"; import { Cursor } from "./Cursor"; import { DrawingParameters } from "../MusicalScore/Graphical/DrawingParameters"; import { IOSMDOptions, BackendType, CursorOptions } from "./OSMDOptions"; import { EngravingRules, PageFormat } from "../MusicalScore/Graphical/EngravingRules"; import { GraphicalMusicPage } from "../MusicalScore/Graphical/GraphicalMusicPage"; import { ITransposeCalculator } from "../MusicalScore/Interfaces/ITransposeCalculator"; /** * The main class and control point of OpenSheetMusicDisplay.
* It can display MusicXML sheet music files in an HTML element container.
* After the constructor, use load() and render() to load and render a MusicXML file. */ export declare class OpenSheetMusicDisplay { protected version: string; /** * Creates and attaches an OpenSheetMusicDisplay object to an HTML element container.
* After the constructor, use load() and render() to load and render a MusicXML file. * @param container The container element OSMD will be rendered into.
* Either a string specifying the ID of an HTML container element,
* or a reference to the HTML element itself (e.g. div) * @param options An object for rendering options like the backend (svg/canvas) or autoResize.
* For defaults see the OSMDOptionsStandard method in the [[OSMDOptions]] class. */ constructor(container: string | HTMLElement, options?: IOSMDOptions); /** Options from which OSMD creates cursors in enableOrDisableCursors(). */ cursorsOptions: CursorOptions[]; cursors: Cursor[]; get cursor(): Cursor; get Cursor(): Cursor; zoom: number; protected zoomUpdated: boolean; /** Timeout in milliseconds used in osmd.load(string) when string is a URL. */ loadUrlTimeout: number; protected container: HTMLElement; protected backendType: BackendType; protected needBackendUpdate: boolean; protected sheet: MusicSheet; protected drawer: VexFlowMusicSheetDrawer; protected drawBoundingBox: string; protected drawSkyLine: boolean; protected drawBottomLine: boolean; protected graphic: GraphicalMusicSheet; protected drawingParameters: DrawingParameters; protected rules: EngravingRules; protected autoResizeEnabled: boolean; protected resizeHandlerAttached: boolean; protected followCursor: boolean; /** A function that is executed when the XML has been read. * The return value will be used as the actual XML OSMD parses, * so you can make modifications to the xml that OSMD will use. * Note that this is (re-)set on osmd.setOptions as `{return xml}`, unless you specify the function in the options. */ OnXMLRead: (xml: string) => string; /** * Load a MusicXML file * @param content is either the url of a file, or the root node of a MusicXML document, * or the string content of a .xml/.mxl file, or a file blob. * @param tempTitle is used as the title for the piece if there is no title in the XML. */ load(content: string | Document | Blob, tempTitle?: string): Promise<{}>; /** * (Re-)creates the graphic sheet from the music sheet */ updateGraphic(): void; /** Render the loaded music sheet to the container. */ render(): void; protected createOrRefreshRenderBackend(): void; exportSVG(): void; /** States whether the render() function can be safely called. */ IsReadyToRender(): boolean; /** Clears what OSMD has drawn on its canvas. */ clear(): void; /** Set OSMD rendering options using an IOSMDOptions object. * Can be called during runtime. Also called by constructor. * For example, setOptions({autoResize: false}) will disable autoResize even during runtime. */ setOptions(options: IOSMDOptions): void; setColoringMode(options: IOSMDOptions): void; /** * Sets the logging level for this OSMD instance. By default, this is set to `warn`. * * @param: content can be `trace`, `debug`, `info`, `warn` or `error`. */ setLogLevel(level: string): void; getLogLevel(): number; /** * Initialize this object to default values * FIXME: Probably unnecessary */ protected reset(): void; /** * Attach the appropriate handler to the window.onResize event */ protected autoResize(): void; /** Re-render and scroll back to previous scroll bar y position in percent. * If the document keeps the same height/length, the scroll bar position will basically be unchanged. * For example, if you scroll to the bottom of the page, resize by one pixel (or enable dark mode) and call this, * for the human eye there will be no detectable scrolling or change in the scroll position at all. * If you just call render() instead of renderAndScrollBack(), * it will scroll you back to the top of the page, even if you were scrolled to the bottom before. */ renderAndScrollBack(): void; /** * Helper function for managing window's onResize events * @param startCallback is the function called when resizing starts * @param endCallback is the function called when resizing (kind-of) ends */ protected handleResize(startCallback: () => void, endCallback: () => void): void; /** Enable or disable (hide) the cursor. * @param enable whether to enable (true) or disable (false) the cursor */ enableOrDisableCursors(enable: boolean): void; createBackend(type: BackendType, page: GraphicalMusicPage): VexFlowBackend; /** Standard page format options like A4 or Letter, in portrait and landscape. E.g. PageFormatStandards["A4_P"] or PageFormatStandards["Letter_L"]. */ static PageFormatStandards: { [type: string]: PageFormat; }; static StringToPageFormat(pageFormatString: string): PageFormat; /** Sets page format by string. Used by setOptions({pageFormat: "A4_P"}) for example. */ setPageFormat(formatId: string): void; setCustomPageFormat(width: number, height: number): void; set DrawSkyLine(value: boolean); get DrawSkyLine(): boolean; set DrawBottomLine(value: boolean); get DrawBottomLine(): boolean; set DrawBoundingBox(value: string); get DrawBoundingBox(): string; setDrawBoundingBox(value: string, render?: boolean): void; get AutoResizeEnabled(): boolean; set AutoResizeEnabled(value: boolean); get Zoom(): number; set Zoom(value: number); set FollowCursor(value: boolean); get FollowCursor(): boolean; set TransposeCalculator(calculator: ITransposeCalculator); get TransposeCalculator(): ITransposeCalculator; get Sheet(): MusicSheet; get Drawer(): VexFlowMusicSheetDrawer; get GraphicSheet(): GraphicalMusicSheet; get DrawingParameters(): DrawingParameters; get EngravingRules(): EngravingRules; /** Returns the version of OSMD this object is built from (the version you are using). */ get Version(): string; }