export class Literal { string: string; constructor(expression: any); evaluate(): string; isRenderable(): boolean; clone(): Literal; } /** * Used to mark a paragraph as verse * @constant * @type {string} */ export const VERSE = "verse"; /** * Used to mark a paragraph as chorus * @constant * @type {string} */ export const CHORUS = "chorus"; /** * Used to mark a paragraph as not containing a line marked with a type * @constant * @type {string} */ export const NONE = "none"; /** * Used to mark a paragraph as containing lines with both verse and chorus type * @constant * @type {string} */ export const INDETERMINATE = "indeterminate"; /** * Used to mark a paragraph as tab * @constant * @type {string} */ export const TAB = "tab"; export const SYMBOL = "symbol"; export const NUMERIC = "numeric"; declare class Note { _note: any; type: string; minor: boolean; constructor({ note, type, minor }: { note: any; type: any; minor?: boolean; }); static parse(note: any): Note; toNumeral(): Note; toNumeric(): Note; isMinor(): boolean; equals(otherNote: any): boolean; clone(): Note; up(): Note; down(): Note; isOneOf(...options: any[]): boolean; isNumeric(): boolean; isChordSymbol(): boolean; isNumeral(): boolean; is(noteType: any): boolean; getTransposeDistance(minorKey: any): number; change(delta: any): Note; get note(): any; toString(): string; } export class Key { note: Note; modifier?: string; minor: boolean; static parse(keyString: any): any; static wrap(keyStringOrObject: any): any; static toString(keyStringOrObject: any): string; static distance(oneKey: any, otherKey: any): any; distanceTo(otherKey: any): number; constructor({ note, modifier, minor }: { note: any; modifier?: any; minor?: boolean; }); isMinor(): boolean; clone(): Key; toChordSymbol(key: any): any; toChordSymbolString(key: any): any; is(type: any): boolean; isNumeric(): boolean; isChordSymbol(): boolean; isNumeral(): boolean; equals({ note, modifier }: { note: any; modifier?: any; }): boolean; toNumeric(key?: Key): Key; toNumericString(key?: any): string; toNumeral(key?: any): Key; toNumeralString(key?: any): string; toString({ showMinor }?: { showMinor?: boolean; }): string; transpose(delta: any): Key; transposeUp(): Key; transposeDown(): Key; useModifier(newModifier: any): Key; normalize(): Key; normalizeEnharmonics(key: Key | string): any; } /** * Represents a Chord, consisting of a root, suffix (quality) and bass */ export class Chord { root: Key; suffix?: string; bass?: Key; /** * Tries to parse a chord string into a chord * @param chordString the chord string, eg `Esus4/G#` or `1sus4/#3` * @returns {null|Chord} */ static parse(chordString: any): any; /** * Returns a deep copy of the chord * @returns {Chord} */ clone(): Chord; /** * Converts the chord to a chord symbol, using the supplied key as a reference. * For example, a numeric chord `#4` with reference key `E` will return the chord symbol `A#`. * When the chord is already a chord symbol, it will return a clone of the object. * @param {Key|string} [key=null] the reference key * @returns {Chord} the chord symbol */ toChordSymbol(key?: any): Chord; /** * Converts the chord to a chord symbol string, using the supplied key as a reference. * For example, a numeric chord `#4` with reference key `E` will return the chord symbol `A#`. * When the chord is already a chord symbol, it will return a string version of the chord. * @param {Key|string} [key=null] the reference key * @returns {string} the chord symbol string * @see {toChordSymbol} */ toChordSymbolString(key?: any): string; /** * Determines whether the chord is a chord symbol * @returns {boolean} */ isChordSymbol(): boolean; /** * Converts the chord to a numeric chord, using the supplied key as a reference. * For example, a chord symbol A# with reference key E will return the numeric chord #4. * @param {Key|string} [key=null] the reference key * @returns {Chord} the numeric chord */ toNumeric(key?: any): Chord; /** * Converts the chord to a numeral chord, using the supplied key as a reference. * For example, a chord symbol A# with reference key E will return the numeral chord #IV. * @param {Key|string|null} key the reference key. The key is required when converting a chord symbol * @returns {Chord} the numeral chord */ toNumeral(key?: any): Chord; /** * Converts the chord to a numeral chord string, using the supplied kye as a reference. * For example, a chord symbol A# with reference key E will return the numeral chord #4. * @param {Key|string} [key=null] the reference key * @returns {string} the numeral chord string * @see {toNumeral} */ toNumeralString(key?: any): string; /** * Determines whether the chord is numeric * @returns {boolean} */ isNumeric(): boolean; /** * Converts the chord to a numeric chord string, using the supplied kye as a reference. * For example, a chord symbol A# with reference key E will return the numeric chord #4. * @param {Key|string} [key=null] the reference key * @returns {string} the numeric chord string * @see {toNumeric} */ toNumericString(key?: any): string; /** * Determines whether the chord is a numeral * @returns {boolean} */ isNumeral(): boolean; /** * Converts the chord to a string, eg `Esus4/G#` or `1sus4/#3` * @returns {string} the chord string */ toString(): string; /** * Normalizes the chord root and bass notes: * - Fb becomes E * - Cb becomes B * - B# becomes C * - E# becomes F * - 4b becomes 3 * - 1b becomes 7 * - 7# becomes 1 * - 3# becomes 4 * * Besides that it normalizes the suffix if `normalizeSuffix` is `true`. * For example, `sus2` becomes `2`, `sus4` becomes `sus`. * All suffix normalizations can be found in `src/normalize_mappings/suffix-mapping.txt`. * @param {Key|string} [key=null] the key to normalize to * @param {Object} [options={}] options * @param {boolean} [options.normalizeSuffix=true] whether to normalize the chord suffix after transposing * @returns {Chord} the normalized chord */ normalize(key?: any, { normalizeSuffix }?: { normalizeSuffix?: boolean; }): Chord; /** * Switches to the specified modifier * @param newModifier the modifier to use: `'#'` or `'b'` * @returns {Chord} the new, changed chord */ useModifier(newModifier: any): Chord; /** * Transposes the chord up by 1 semitone. Eg. A becomes A#, Eb becomes E * @returns {Chord} the new, transposed chord */ transposeUp(): Chord; /** * Transposes the chord down by 1 semitone. Eg. A# becomes A, E becomes Eb * @returns {Chord} the new, transposed chord */ transposeDown(): Chord; /** * Transposes the chord by the specified number of semitones * @param delta de number of semitones * @returns {Chord} the new, transposed chord */ transpose(delta: any): Chord; constructor({ base, modifier, suffix, bassBase, bassModifier, root, bass, }: { base?: any; modifier?: any; suffix?: any; bassBase?: any; bassModifier?: any; root?: any; bass?: any; }); makeMinor(): Chord; set(properties: any): Chord; private get rootNote(); } /** * Tries to parse a chord string into a chord * @param chordString the chord string, eg Esus4/G# or 1sus4/#3 * @deprecated Please use {@link Chord.parse} instead * @returns {null|Chord} */ export function parseChord(chordString: any): any; /** * Represents a chord with the corresponding (partial) lyrics */ export class ChordLyricsPair { chords: string; lyrics: string; /** * Initialises a ChordLyricsPair * @param {string} chords The chords * @param {string} lyrics The lyrics */ constructor(chords?: string, lyrics?: string); /** * Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets) * @returns {boolean} */ isRenderable(): boolean; /** * Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song * @returns {ChordLyricsPair} */ clone(): ChordLyricsPair; toString(): string; set(properties: any): ChordLyricsPair; setLyrics(lyrics: string): ChordLyricsPair; transpose(delta: number, key?: string | Key | null, { normalizeChordSuffix }?: { normalizeChordSuffix?: boolean; }): ChordLyricsPair; } interface TraceInfo { line?: number; column?: number; offset?: number; } declare abstract class AstComponent { line?: number; column?: number; offset?: number; protected constructor(traceInfo?: TraceInfo); abstract clone(): any; } /** * Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/ */ export class Tag extends AstComponent { _originalName: string; _name: string; _value?: string; _isMetaTag: boolean; constructor(name: any, value?: string, traceInfo?: TraceInfo); static parse(tag: string | Tag): Tag; static parseWithRegex(tag: string, regex: RegExp): Tag | null; set name(name: string); /** * The tag full name. When the original tag used the short name, `name` will return the full name. * @member * @type {string} */ get name(): string; /** * The original tag name that was used to construct the tag. * @member * @type {string} */ get originalName(): string; set value(value: string); /** * The tag value * @member * @type {string|null} */ get value(): string; /** * Checks whether the tag value is a non-empty string. * @returns {boolean} */ hasValue(): boolean; /** * Checks whether the tag is usually rendered inline. It currently only applies to comment tags. * @returns {boolean} */ isRenderable(): boolean; /** * Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`) * @returns {boolean} */ isMetaTag(): boolean; /** * Returns a clone of the tag. * @returns {Tag} The cloned tag */ clone(): Tag; toString(): string; set({ value }: { value: any; }): Tag; setValue(value: string): Tag; } /** * Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview */ export class Comment { content: string; constructor(content: any); /** * Indicates whether a Comment should be visible in a formatted chord sheet (except for ChordPro sheets) * @returns {boolean} */ isRenderable(): boolean; /** * Returns a deep copy of the Comment, useful when programmatically transforming a song * @returns {Comment} */ clone(): Comment; toString(): string; } declare abstract class MetadataAccessors { abstract getMetadata(_name: string): string | string[]; get key(): string | string[]; get title(): string | string[]; get subtitle(): string | string[]; get capo(): string | string[]; get duration(): string | string[]; get tempo(): string | string[]; get time(): string | string[]; get year(): string | string[]; get album(): string | string[]; get copyright(): string | string[]; get lyricist(): string | string[]; get artist(): string | string[]; get composer(): string | string[]; } /** * Stores song metadata. Properties can be accessed using the get() method: * * const metadata = new Metadata({ author: 'John' }); * metadata.get('author') // => 'John' * * See {@link Metadata#get} */ export class Metadata extends MetadataAccessors { metadata: Record; constructor(metadata?: any); contains(key: any): boolean; add(key: any, value: any): void; set(key: any, value: any): void; getMetadata(name: string): string | string[]; /** * Reads a metadata value by key. This method supports simple value lookup, as fetching single array values. * * This method deprecates direct property access, eg: metadata['author'] * * Examples: * * const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] }); * metadata.get('lyricist') // => 'Pete' * metadata.get('author') // => ['John', 'Mary'] * metadata.get('author.1') // => 'John' * metadata.get('author.2') // => 'Mary' * * Using a negative index will start counting at the end of the list: * * const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] }); * metadata.get('author.-1') // => 'Mary' * metadata.get('author.-2') // => 'John' * * @param prop the property name * @returns {Array|String} the metadata value(s). If there is only one value, it will return a String, * else it returns an array of strings. */ get(prop: any): any; /** * Returns a single metadata value. If the actual value is an array, it returns the first value. Else, it returns * the value. * @ignore * @param {string} prop the property name * @returns {String} The metadata value */ getSingle(prop: any): any; parseArrayKey(prop: any): any[]; getArrayItem(prop: any): string; /** * Returns a deep clone of this Metadata object * @returns {Metadata} the cloned Metadata object */ clone(): Metadata; calculateKeyFromCapo(): any; } declare abstract class Evaluatable extends AstComponent { abstract evaluate(_metadata: Metadata, _metadataSeparator: string, _variable: string): string; } export class Composite { expressions: Evaluatable[]; variable?: string; constructor(expressions: any, variable?: any); evaluate(metadata: any, metadataSeparator: any): string; isRenderable(): boolean; clone(): Composite; } export class Ternary extends AstComponent { variable?: string; valueTest?: string; trueExpression: AstComponent[]; falseExpression: AstComponent[]; constructor({ variable, valueTest, trueExpression, falseExpression, line, column, offset, }?: { variable?: any; valueTest?: any; trueExpression?: any; falseExpression?: any; line?: any; column?: any; offset?: any; }); /** * Evaluate the meta expression * @param {Metadata} metadata The metadata object to use for evaluating the expression * @param {string} [metadataSeparator=null] The metadata separator to use if necessary * @returns {string} The evaluated expression */ evaluate(metadata: any, metadataSeparator?: any, upperContext?: any): any; evaluateToString(value: any, metadataSeparator: any): any; evaluateWithVariable(metadata: any, metadataSeparator: any): any; evaluateForTruthyValue(metadata: any, metadataSeparator: any, value: any): any; isRenderable(): boolean; clone(): Ternary; } type Item = ChordLyricsPair | Comment | Tag | Ternary; /** * Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag */ export class Line { /** * The items ({@link ChordLyricsPair} or {@link Tag} or {@link Comment}) of which the line consists * @member * @type {Array.<(ChordLyricsPair|Tag|Comment)>} */ items: Item[]; /** * The line type, This is set by the ChordProParser when it read tags like {start_of_chorus} or {start_of_verse} * Values can be {@link VERSE}, {@link CHORUS} or {@link NONE} * @member * @type {string} */ type: 'verse' | 'chorus' | 'none'; /** * @ignore * @type {ChordLyricsPair} */ currentChordLyricsPair: ChordLyricsPair; /** * @ignore * @type {string|null} */ key?: string; /** * @ignore * @type {string|null} */ transposeKey?: string; constructor({ type, items }?: { type: 'verse' | 'chorus' | 'none'; items: Item[]; }); /** * Indicates whether the line contains any items * @returns {boolean} */ isEmpty(): boolean; /** * Adds an item ({@link ChordLyricsPair} or {@link Tag}) to the line * @param {ChordLyricsPair|Tag} item The item to be added */ addItem(item: Item): void; /** * Indicates whether the line contains items that are renderable * @returns {boolean} */ hasRenderableItems(): boolean; /** * Returns a deep copy of the line and all of its items * @returns {Line} */ clone(): Line; mapItems(func: any): Line; /** * Indicates whether the line type is {@link VERSE} * @returns {boolean} */ isVerse(): boolean; /** * Indicates whether the line type is {@link CHORUS} * @returns {boolean} */ isChorus(): boolean; /** * Indicates whether the line contains items that are renderable. Please use {@link hasRenderableItems} * @deprecated * @returns {boolean} */ hasContent(): boolean; addChordLyricsPair(chords?: any, lyrics?: any): ChordLyricsPair; ensureChordLyricsPair(): void; chords(chr: any): void; lyrics(chr: any): void; addTag(name: any, value?: any): Tag; addComment(content: any): Comment; set(properties: any): Line; } /** * Represents a paragraph of lines in a chord sheet */ export class Paragraph { /** * The {@link Line} items of which the paragraph consists * @member * @type {Line[]} */ lines: Line[]; addLine(line: any): void; /** * Tries to determine the common type for all lines. If the types for all lines are equal, it returns that type. * If not, it returns {@link INDETERMINATE} * @returns {string} */ get type(): 'verse' | 'chorus' | 'none' | 'indeterminate'; /** * Indicates whether the paragraph contains lines with renderable items. * @see {@link Line.hasRenderableItems} * @returns {boolean} */ hasRenderableItems(): boolean; } /** * Represents a parser warning, currently only used by ChordProParser. */ declare class ParserWarning { /** * The warning message * @member * @type {string} */ message: string; /** * The chord sheet line number on which the warning occurred * @member * @type {number} */ lineNumber: number; /** * The chord sheet column on which the warning occurred * @member * @type {number} */ column: number; /** * @hideconstructor */ constructor(message: string, lineNumber: number, column: number); /** * Returns a stringified version of the warning * @returns {string} The string warning */ toString(): string; } interface MapItemsCallback { (_item: Item): Item | null; } interface MapLinesCallback { (_line: Line): Line | null; } /** * Represents a song in a chord sheet. Currently a chord sheet can only have one song. */ export class Song extends MetadataAccessors { /** * The {@link Line} items of which the song consists * @member {Line[]} */ lines: Line[]; /** * The song's metadata. When there is only one value for an entry, the value is a string. Else, the value is * an array containing all unique values for the entry. * @type {Metadata} */ metadata: Metadata; currentLine?: Line; warnings: ParserWarning[]; sectionType: string; currentKey?: string; transposeKey?: string; /** * Creates a new {Song} instance * @param metadata {Object|Metadata} predefined metadata */ constructor(metadata?: {}); get previousLine(): Line; /** * Returns the song lines, skipping the leading empty lines (empty as in not rendering any content). This is useful * if you want to skip the "header lines": the lines that only contain meta data. * @returns {Line[]} The song body lines */ get bodyLines(): any; /** * Returns the song paragraphs, skipping the paragraphs that only contain empty lines * (empty as in not rendering any content) * @see {@link bodyLines} * @returns {Paragraph[]} */ get bodyParagraphs(): any; selectRenderableItems(targetProp: any, sourceProp: any): any; chords(chr: any): void; lyrics(chr: any): void; addLine(line?: Line): Line; /** * The {@link Paragraph} items of which the song consists * @member {Paragraph[]} */ get paragraphs(): Paragraph[]; setCurrentLineType(sectionType: any): void; ensureLine(): void; addTag(tagContents: string | Tag): Tag; setSectionTypeFromTag(tag: any): void; startSection(sectionType: any, tag: any): void; endSection(sectionType: any, tag: any): void; checkCurrentSectionType(sectionType: any, tag: any): void; addWarning(message: any, { line, column }: { line: any; column: any; }): void; addItem(item: any): void; /** * Returns a deep clone of the song * @returns {Song} The cloned song */ clone(): Song; setMetadata(name: any, value: any): void; /** * The song's metadata. Please use {@link metadata} instead. * @deprecated * @returns {@link Metadata} The metadata */ get metaData(): Metadata; getMetadata(name: any): any; /** * Returns a copy of the song with the key value set to the specified key. It changes: * - the value for `key` in the {@link metadata} set * - any existing `key` directive * @param {number|null} key the key. Passing `null` will: * - remove the current key from {@link metadata} * - remove any `key` directive * @returns {Song} The changed song */ setKey(key: any): Song; /** * Returns a copy of the song with the key value set to the specified capo. It changes: * - the value for `capo` in the {@link metadata} set * - any existing `capo` directive * @param {number|null} capo the capo. Passing `null` will: * - remove the current key from {@link metadata} * - remove any `capo` directive * @returns {Song} The changed song */ setCapo(capo: any): any; /** * Transposes the song by the specified delta. It will: * - transpose all chords, see: {@link Chord#transpose} * - transpose the song key in {@link metadata} * - update any existing `key` directive * @param {number} delta The number of semitones (positive or negative) to transpose with * @param {Object} [options={}] options * @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing * @returns {Song} The transposed song */ transpose(delta: number, { normalizeChordSuffix }?: { normalizeChordSuffix?: boolean; }): Song; /** * Transposes the song up by one semitone. It will: * - transpose all chords, see: {@link Chord#transpose} * - transpose the song key in {@link metadata} * - update any existing `key` directive * @param {Object} [options={}] options * @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing * @returns {Song} The transposed song */ transposeUp({ normalizeChordSuffix }?: { normalizeChordSuffix?: boolean; }): Song; /** * Transposes the song down by one semitone. It will: * - transpose all chords, see: {@link Chord#transpose} * - transpose the song key in {@link metadata} * - update any existing `key` directive * @param {Object} [options={}] options * @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing * @returns {Song} The transposed song */ transposeDown({ normalizeChordSuffix }?: { normalizeChordSuffix?: boolean; }): Song; /** * Returns a copy of the song with the key set to the specified key. It changes: * - the value for `key` in the {@link metadata} set * - any existing `key` directive * - all chords, those are transposed according to the distance between the current and the new key * @param {string} newKey The new key. * @returns {Song} The changed song */ changeKey(newKey: string | Key): Song; getTransposeDistance(newKey: string | Key): any; /** * Returns a copy of the song with the directive value set to the specified value. * - when there is a matching directive in the song, it will update the directive * - when there is no matching directive, it will be inserted * If `value` is `null` it will act as a delete, any directive matching `name` will be removed. * @param {string} name The directive name * @param {string | null} value The value to set, or `null` to remove the directive */ changeMetadata(name: string, value: string | null): any; /** * Change the song contents inline. Return a new {@link Item} to replace it. Return `null` to remove it. * @example * // transpose all chords: * song.mapItems((item) => { * if (item instanceof ChordLyricsPair) { * return item.transpose(2, 'D'); * } * * return item; * }); * @param {MapItemsCallback} func the callback function * @returns {Song} the changed song */ mapItems(func: MapItemsCallback): Song; /** * Change the song contents inline. Return a new {@link Line} to replace it. Return `null` to remove it. * @example * // remove lines with only Tags: * song.mapLines((line) => { * if (line.items.every(item => item instanceof Tag)) { * return null; * } * * return line; * }); * @param {MapLinesCallback} func the callback function * @returns {Song} the changed song */ mapLines(func: MapLinesCallback): Song; } /** * Serializes a song into een plain object, and deserializes the serialized object back into a {@link Song} */ export class ChordSheetSerializer { song?: Song; /** * Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc * Can be deserialized using {@link deserialize} * @returns object A plain JS object containing all chord sheet data */ serialize(song: any): { type: string; lines: any; }; serializeLine(line: any): { type: string; items: any; }; serializeItem(item: any): any; serializeTag(tag: any): { type: string; name: any; value: any; }; serializeChordLyricsPair(chordLyricsPair: any): { type: string; chords: any; lyrics: any; }; serializeTernary(ternary: any): { type: string; variable: any; valueTest: any; trueExpression: any; falseExpression: any; }; serializeLiteral(literal: any): any; serializeExpression(expression: any): any; /** * Deserializes a song that has been serialized using {@link serialize} * @param {object} serializedSong The serialized song * @returns {Song} The deserialized song */ deserialize(serializedSong: any): Song; parseAstComponent(astComponent: any): void | Literal | ChordLyricsPair | Tag | Comment | Ternary; parseChordSheet(astComponent: any): void; parseLine(astComponent: any): void; parseChordLyricsPair(astComponent: any): ChordLyricsPair; parseTag(astComponent: any): Tag; parseComment(astComponent: any): Comment; parseTernary(astComponent: any): Ternary; parseExpression(expression: any): any; } /** * Parses a ChordPro chord sheet */ export class ChordProParser { song?: Song; /** * Parses a ChordPro chord sheet into a song * @param {string} chordProChordSheet the ChordPro chord sheet * @returns {Song} The parsed song */ parse(chordProChordSheet: any): Song; /** * All warnings raised during parsing the ChordPro chord sheet * @member * @type {ParserWarning[]} */ get warnings(): ParserWarning[]; } /** * Parses a normal chord sheet */ export class ChordSheetParser { processingText: boolean; preserveWhitespace: boolean; song?: Song; songLine?: Line; chordLyricsPair?: ChordLyricsPair; lines: string[]; currentLine: number; lineCount: number; /** * Instantiate a chord sheet parser * @param {Object} [options={}] options * @param {boolean} [options.preserveWhitespace=true] whether to preserve trailing whitespace for chords */ constructor({ preserveWhitespace }?: { preserveWhitespace?: boolean; }); /** * Parses a chord sheet into a song * @param {string} chordSheet The ChordPro chord sheet * @param {Object} [options={}] Optional parser options * @param {Song} [options.song=null] The {@link Song} to store the song data in * @returns {Song} The parsed song */ parse(chordSheet: any, { song }?: { song?: any; }): Song; endOfSong(): void; parseLine(line: any): void; parseNonEmptyLine(line: any): void; initialize(document: any, { song }?: { song?: any; }): void; readLine(): string; hasNextLine(): boolean; parseLyricsWithChords(chordsLine: any, lyricsLine: any): void; processCharacters(chordsLine: any, lyricsLine: any): void; addCharacter(chr: any, nextChar: any): void; shouldAddCharacterToChords(nextChar: any): boolean; ensureChordLyricsPairInitialized(): void; } /** * Parses an Ultimate Guitar chord sheet with metadata * Inherits from {@link ChordSheetParser} */ export class UltimateGuitarParser extends ChordSheetParser { currentSectionType?: string; parseLine(line: any): void; isSectionEnd(): boolean; endOfSong(): void; startSection(sectionType: any): void; endSection({ addNewLine }?: { addNewLine?: boolean; }): void; startNewLine(): void; } declare class MetadataConfiguration { separator?: string; constructor({ separator }: { separator: string; }); } declare class Configuration { metadata?: MetadataConfiguration; evaluate: boolean; constructor({ evaluate, metadata }: { evaluate?: boolean; metadata?: { separator: string; }; }); get(key: string): any; } /** * Base class for all formatters, taking care of receiving a configuration wrapping that inside a Configuration object */ declare class Formatter { configuration: Configuration; /** * Instantiate * @param {Object} [configuration={}] options * @param {boolean} [configuration.evaluate=false] Whether or not to evaluate meta expressions. For more info about * meta expressions, see: https://bit.ly/2SC9c2u * @param {object} [configuration.metadata={}] * @param {string} [configuration.metadata.separator=", "] The separator to be used when rendering a metadata value * that has multiple values. See: https://bit.ly/2SC9c2u */ constructor(configuration?: {}); } /** * Formats a song into a plain text chord sheet */ export class TextFormatter extends Formatter { song?: Song; /** * Formats a song into a plain text chord sheet * @param {Song} song The song to be formatted * @returns {string} the chord sheet */ format(song: any): string; formatHeader(): string; formatParagraphs(): any; formatParagraph(paragraph: any, metadata: any): any; formatLine(line: any, metadata: any): string; formatTitle(title: any): string; formatSubTitle(subtitle: any): string; formatLineTop(line: any): any; chordLyricsPairLength(chordLyricsPair: any, line: any): any; formatItemTop(item: any, metadata: any, line: any): any; formatLineBottom(line: any, metadata: any): any; formatLineWithFormatter(line: any, formatter: any, metadata?: any): any; formatItemBottom(item: any, metadata: any, line: any): any; } /** * Acts as a base class for HTML formatters, taking care of whitelisting prototype property access. */ declare class HtmlFormatter extends Formatter { formatWithTemplate(song: any, template: any): any; } /** * Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like * PDF conversion. */ export class HtmlTableFormatter extends HtmlFormatter { /** * Formats a song into HTML. * @param {Song} song The song to be formatted * @returns {string} The HTML string */ format(song: any): any; /** * Generates basic CSS, optionally scoped within the provided selector, to use with output generated by * {@link HtmlTableFormatter} * * For example, execute cssString('.chordSheetViewer') will result in CSS like: * * .chordSheetViewer .paragraph { * margin-bottom: 1em; * } * * @param scope the CSS scope to use, for example `.chordSheetViewer` * @returns {string} the CSS string */ static cssString(scope?: string): string; /** * Basic CSS, in object style à la useStyles, to use with output generated by {@link HtmlTableFormatter} * For a CSS string see {@link cssString} * * Example: * * '.paragraph': { * marginBottom: '1em' * } * * @return {Object.>} the CSS object */ static cssObject(): { h1: { fontSize: string; }; h2: { fontSize: string; }; table: { borderSpacing: string; color: string; }; td: { padding: string; }; '.chord:not(:last-child)': { paddingRight: string; }; '.paragraph': { marginBottom: string; }; }; } /** * Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages. */ export class HtmlDivFormatter extends HtmlFormatter { /** * Formats a song into HTML. * @param {Song} song The song to be formatted * @returns {string} The HTML string */ format(song: any): any; /** * Generates basic CSS, optionally scoped within the provided selector, to use with output generated by * {@link HtmlDivFormatter} * * For example, execute cssString('.chordSheetViewer') will result in CSS like: * * .chordSheetViewer .paragraph { * margin-bottom: 1em; * } * * @param scope the CSS scope to use, for example `.chordSheetViewer` * @returns {string} the CSS string */ static cssString(scope?: string): string; /** * Basic CSS, in object style à la useStyles, to use with output generated by {@link HtmlDivFormatter} * * Example: * * '.paragraph': { * marginBottom: '1em' * } * * For a CSS string see {@link cssString} * @return {Object.>} the CSS object */ static cssObject(): { '.chord:not(:last-child)': { paddingRight: string; }; '.paragraph': { marginBottom: string; }; '.row': { display: string; }; '.chord:after': { content: string; }; '.lyrics:after': { content: string; }; }; } /** * Formats a song into a ChordPro chord sheet */ export class ChordProFormatter extends Formatter { /** * Formats a song into a ChordPro chord sheet. * @param {Song} song The song to be formatted * @returns {string} The ChordPro string */ format(song: any): any; formatLine(line: any, metadata: any): any; formatItem(item: any, metadata: any): any; formatOrEvaluateItem(item: any, metadata: any): any; formatTernary(ternary: any): string; formatValueTest(valueTest: any): string; formatExpressionRange(expressionRange: any): string; formatExpression(expression: any): string; formatTag(tag: any): string; formatChordLyricsPair(chordLyricsPair: any): string; formatChordLyricsPairChords(chordLyricsPair: any): string; formatChordLyricsPairLyrics(chordLyricsPair: any): any; } declare const _default: { ChordProParser: typeof ChordProParser; ChordSheetParser: typeof ChordSheetParser; UltimateGuitarParser: typeof UltimateGuitarParser; TextFormatter: typeof TextFormatter; HtmlTableFormatter: typeof HtmlTableFormatter; HtmlDivFormatter: typeof HtmlDivFormatter; ChordProFormatter: typeof ChordProFormatter; ChordLyricsPair: typeof ChordLyricsPair; Line: typeof Line; Song: typeof Song; Tag: typeof Tag; Comment: typeof Comment; Metadata: typeof Metadata; Paragraph: typeof Paragraph; Ternary: typeof Ternary; Composite: typeof Composite; Literal: typeof Literal; ChordSheetSerializer: typeof ChordSheetSerializer; CHORUS: string; INDETERMINATE: string; TAB: string; VERSE: string; NONE: string; }; export default _default; //# sourceMappingURL=main.d.ts.map