chordsheetjs 15.0.0 → 15.0.1
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.
- package/lib/bundle.js +1 -1
- package/lib/bundle.min.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +1 -1
- package/lib/module.js +1 -1
- package/lib/module.js.map +1 -1
- package/lib/pdf/index.js +30933 -17401
- package/lib/pdf/index.js.map +1 -0
- package/lib/pdf/main.d.ts +1696 -0
- package/lib/pdf/main.d.ts.map +1 -0
- package/lib/pdf/module.js +30891 -17332
- package/lib/pdf/module.js.map +1 -0
- package/package.json +2 -2
- package/lib/pdf/chord.d.ts +0 -219
- package/lib/pdf/chord_definition/chord_definition.d.ts +0 -66
- package/lib/pdf/chord_definition/chord_definition_set.d.ts +0 -12
- package/lib/pdf/chord_diagram/chord_diagram.d.ts +0 -131
- package/lib/pdf/chord_diagram/js_pdf_renderer.d.ts +0 -40
- package/lib/pdf/chord_diagram/renderer.d.ts +0 -43
- package/lib/pdf/chord_parsing_error.d.ts +0 -2
- package/lib/pdf/chord_sheet/ast_component.d.ts +0 -11
- package/lib/pdf/chord_sheet/ast_type.d.ts +0 -9
- package/lib/pdf/chord_sheet/chord_lyrics_pair.d.ts +0 -60
- package/lib/pdf/chord_sheet/chord_pro/composite.d.ts +0 -11
- package/lib/pdf/chord_sheet/chord_pro/evaluatable.d.ts +0 -7
- package/lib/pdf/chord_sheet/chord_pro/evaluation_error.d.ts +0 -7
- package/lib/pdf/chord_sheet/chord_pro/literal.d.ts +0 -9
- package/lib/pdf/chord_sheet/chord_pro/ternary.d.ts +0 -29
- package/lib/pdf/chord_sheet/comment.d.ts +0 -21
- package/lib/pdf/chord_sheet/font.d.ts +0 -47
- package/lib/pdf/chord_sheet/font_size.d.ts +0 -33
- package/lib/pdf/chord_sheet/font_stack.d.ts +0 -13
- package/lib/pdf/chord_sheet/item.d.ts +0 -7
- package/lib/pdf/chord_sheet/line.d.ts +0 -130
- package/lib/pdf/chord_sheet/line_expander.d.ts +0 -12
- package/lib/pdf/chord_sheet/metadata.d.ts +0 -71
- package/lib/pdf/chord_sheet/metadata_accessors.d.ts +0 -18
- package/lib/pdf/chord_sheet/paragraph.d.ts +0 -48
- package/lib/pdf/chord_sheet/soft_line_break.d.ts +0 -15
- package/lib/pdf/chord_sheet/song.d.ts +0 -253
- package/lib/pdf/chord_sheet/song_mapper.d.ts +0 -15
- package/lib/pdf/chord_sheet/standard_metadata_providers.d.ts +0 -5
- package/lib/pdf/chord_sheet/tag.d.ts +0 -104
- package/lib/pdf/chord_sheet/tag_interpreter.d.ts +0 -14
- package/lib/pdf/chord_sheet/tags.d.ts +0 -259
- package/lib/pdf/chord_sheet/trace_info.d.ts +0 -6
- package/lib/pdf/chord_sheet_serializer.d.ts +0 -49
- package/lib/pdf/constants.d.ts +0 -117
- package/lib/pdf/formatter/chord_pro_formatter.d.ts +0 -39
- package/lib/pdf/formatter/chord_renderer.d.ts +0 -30
- package/lib/pdf/formatter/chords_over_words_formatter.d.ts +0 -33
- package/lib/pdf/formatter/configuration/base_configuration.d.ts +0 -58
- package/lib/pdf/formatter/configuration/default_config_manager.d.ts +0 -31
- package/lib/pdf/formatter/configuration/html_configuration.d.ts +0 -37
- package/lib/pdf/formatter/configuration/index.d.ts +0 -13
- package/lib/pdf/formatter/configuration/measured_html_configuration.d.ts +0 -38
- package/lib/pdf/formatter/configuration/measurement_based_configuration.d.ts +0 -204
- package/lib/pdf/formatter/configuration/pdf_configuration.d.ts +0 -16
- package/lib/pdf/formatter/formatter.d.ts +0 -38
- package/lib/pdf/formatter/formatting_context.d.ts +0 -7
- package/lib/pdf/formatter/html_div_formatter.d.ts +0 -9
- package/lib/pdf/formatter/html_formatter.d.ts +0 -60
- package/lib/pdf/formatter/html_table_formatter.d.ts +0 -10
- package/lib/pdf/formatter/measured_html_formatter.d.ts +0 -43
- package/lib/pdf/formatter/measurement_based_formatter.d.ts +0 -19
- package/lib/pdf/formatter/pdf_formatter/doc_wrapper.d.ts +0 -53
- package/lib/pdf/formatter/pdf_formatter/fonts/NimbusSansLFonts.base64.d.ts +0 -4
- package/lib/pdf/formatter/pdf_formatter/types.d.ts +0 -34
- package/lib/pdf/formatter/pdf_formatter.d.ts +0 -40
- package/lib/pdf/formatter/templates/html_div_formatter.d.ts +0 -3
- package/lib/pdf/formatter/templates/html_table_formatter.d.ts +0 -3
- package/lib/pdf/formatter/text_formatter.d.ts +0 -35
- package/lib/pdf/helpers.d.ts +0 -42
- package/lib/pdf/index.d.ts +0 -126
- package/lib/pdf/key.d.ts +0 -124
- package/lib/pdf/key_config.d.ts +0 -3
- package/lib/pdf/layout/engine/condition.d.ts +0 -25
- package/lib/pdf/layout/engine/dimensions.d.ts +0 -33
- package/lib/pdf/layout/engine/index.d.ts +0 -7
- package/lib/pdf/layout/engine/item_processor.d.ts +0 -70
- package/lib/pdf/layout/engine/layout_engine.d.ts +0 -67
- package/lib/pdf/layout/engine/layout_factory.d.ts +0 -22
- package/lib/pdf/layout/engine/layout_helpers.d.ts +0 -35
- package/lib/pdf/layout/engine/line_breaker.d.ts +0 -54
- package/lib/pdf/layout/engine/paragraph_splitter/index.d.ts +0 -5
- package/lib/pdf/layout/engine/paragraph_splitter/paragraph_splitter.d.ts +0 -5
- package/lib/pdf/layout/engine/paragraph_splitter/strategies/five_or_more_lines_paragraph_split_strategy.d.ts +0 -14
- package/lib/pdf/layout/engine/paragraph_splitter/strategies/four_lines_paragraph_split_strategy.d.ts +0 -8
- package/lib/pdf/layout/engine/paragraph_splitter/strategies/three_or_less_lines_paragraph_split_strategy.d.ts +0 -4
- package/lib/pdf/layout/engine/title_separator_tag.d.ts +0 -8
- package/lib/pdf/layout/engine/types.d.ts +0 -98
- package/lib/pdf/layout/measurement/canvas_measurer.d.ts +0 -18
- package/lib/pdf/layout/measurement/dom_measurer.d.ts +0 -21
- package/lib/pdf/layout/measurement/index.d.ts +0 -4
- package/lib/pdf/layout/measurement/js_pdf_measurer.d.ts +0 -12
- package/lib/pdf/layout/measurement/measurer.d.ts +0 -52
- package/lib/pdf/normalize_mappings/enharmonic-normalize.d.ts +0 -2
- package/lib/pdf/normalize_mappings/suffix-normalize-mapping.d.ts +0 -2
- package/lib/pdf/pango/pango_helpers.d.ts +0 -6
- package/lib/pdf/parser/chord/peg_parser.d.ts +0 -55
- package/lib/pdf/parser/chord_definition/peg_parser.d.ts +0 -55
- package/lib/pdf/parser/chord_pro/helpers.d.ts +0 -15
- package/lib/pdf/parser/chord_pro/peg_parser.d.ts +0 -55
- package/lib/pdf/parser/chord_pro_parser.d.ts +0 -32
- package/lib/pdf/parser/chord_sheet_parser.d.ts +0 -57
- package/lib/pdf/parser/chords_over_words/helpers.d.ts +0 -33
- package/lib/pdf/parser/chords_over_words/peg_parser.d.ts +0 -55
- package/lib/pdf/parser/chords_over_words_parser.d.ts +0 -67
- package/lib/pdf/parser/null_tracer.d.ts +0 -4
- package/lib/pdf/parser/parser_helpers.d.ts +0 -3
- package/lib/pdf/parser/parser_warning.d.ts +0 -33
- package/lib/pdf/parser/ultimate_guitar_parser.d.ts +0 -46
- package/lib/pdf/pdf.d.ts +0 -2
- package/lib/pdf/rendering/html/html_doc_wrapper.d.ts +0 -82
- package/lib/pdf/rendering/html/html_element_styler.d.ts +0 -58
- package/lib/pdf/rendering/html/positioned_html_renderer.d.ts +0 -85
- package/lib/pdf/rendering/pdf/js_pdf_renderer.d.ts +0 -46
- package/lib/pdf/rendering/pdf/pdf_chord_diagram_renderer.d.ts +0 -118
- package/lib/pdf/rendering/renderer.d.ts +0 -273
- package/lib/pdf/rendering/shared/layout_section_renderer.d.ts +0 -93
- package/lib/pdf/scales.d.ts +0 -3
- package/lib/pdf/serialized_types.d.ts +0 -76
- package/lib/pdf/song_builder.d.ts +0 -38
- package/lib/pdf/template_helpers/metadata_processor.d.ts +0 -14
- package/lib/pdf/template_helpers/when.d.ts +0 -13
- package/lib/pdf/template_helpers/when_callback.d.ts +0 -2
- package/lib/pdf/template_helpers/when_clause.d.ts +0 -8
- package/lib/pdf/template_helpers.d.ts +0 -64
- package/lib/pdf/utilities.d.ts +0 -35
- package/lib/pdf/version.d.ts +0 -2
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { SerializedChord, SerializedLine } from '../../serialized_types';
|
|
2
|
-
type CarriageReturn = '\r';
|
|
3
|
-
type LineFeed = '\n';
|
|
4
|
-
type CarriageReturnLineFeed = '\r\n';
|
|
5
|
-
type NewLine = CarriageReturn | LineFeed | CarriageReturnLineFeed;
|
|
6
|
-
type Lyrics = string;
|
|
7
|
-
type Chord = {
|
|
8
|
-
column: number;
|
|
9
|
-
value: string;
|
|
10
|
-
} & SerializedChord;
|
|
11
|
-
interface RhythmSymbol {
|
|
12
|
-
type: 'symbol';
|
|
13
|
-
value: '/' | '|' | '-' | 'x';
|
|
14
|
-
column: number;
|
|
15
|
-
}
|
|
16
|
-
interface NoChord {
|
|
17
|
-
type: 'noChord';
|
|
18
|
-
value: string;
|
|
19
|
-
column: number;
|
|
20
|
-
}
|
|
21
|
-
type DirectionLine = SerializedLine;
|
|
22
|
-
type InlineMetadata = SerializedLine;
|
|
23
|
-
interface ChordsLine {
|
|
24
|
-
type: 'chordsLine';
|
|
25
|
-
items: (Chord | RhythmSymbol | NoChord)[];
|
|
26
|
-
}
|
|
27
|
-
interface LyricsLine {
|
|
28
|
-
type: 'lyricsLine';
|
|
29
|
-
content: Lyrics;
|
|
30
|
-
}
|
|
31
|
-
type ChordSheetLine = DirectionLine | InlineMetadata | ChordsLine | LyricsLine;
|
|
32
|
-
export declare function composeChordSheetContents(newLine: NewLine | null, lines: ChordSheetLine[], trailingLine: ChordSheetLine | null, chopFirstWord: boolean): SerializedLine[];
|
|
33
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export interface FilePosition {
|
|
2
|
-
offset: number;
|
|
3
|
-
line: number;
|
|
4
|
-
column: number;
|
|
5
|
-
}
|
|
6
|
-
export interface FileRange {
|
|
7
|
-
start: FilePosition;
|
|
8
|
-
end: FilePosition;
|
|
9
|
-
source: string;
|
|
10
|
-
}
|
|
11
|
-
export interface LiteralExpectation {
|
|
12
|
-
type: "literal";
|
|
13
|
-
text: string;
|
|
14
|
-
ignoreCase: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface ClassParts extends Array<string | ClassParts> {
|
|
17
|
-
}
|
|
18
|
-
export interface ClassExpectation {
|
|
19
|
-
type: "class";
|
|
20
|
-
parts: ClassParts;
|
|
21
|
-
inverted: boolean;
|
|
22
|
-
ignoreCase: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface AnyExpectation {
|
|
25
|
-
type: "any";
|
|
26
|
-
}
|
|
27
|
-
export interface EndExpectation {
|
|
28
|
-
type: "end";
|
|
29
|
-
}
|
|
30
|
-
export interface OtherExpectation {
|
|
31
|
-
type: "other";
|
|
32
|
-
description: string;
|
|
33
|
-
}
|
|
34
|
-
export type Expectation = LiteralExpectation | ClassExpectation | AnyExpectation | EndExpectation | OtherExpectation;
|
|
35
|
-
export declare class PeggySyntaxError extends Error {
|
|
36
|
-
static buildMessage(expected: Expectation[], found: string | null): string;
|
|
37
|
-
message: string;
|
|
38
|
-
expected: Expectation[];
|
|
39
|
-
found: string | null;
|
|
40
|
-
location: FileRange;
|
|
41
|
-
name: string;
|
|
42
|
-
constructor(message: string, expected: Expectation[], found: string | null, location: FileRange);
|
|
43
|
-
format(sources: {
|
|
44
|
-
grammarSource?: string;
|
|
45
|
-
text: string;
|
|
46
|
-
}[]): string;
|
|
47
|
-
}
|
|
48
|
-
export interface ParseOptions {
|
|
49
|
-
filename?: string;
|
|
50
|
-
startRule?: string;
|
|
51
|
-
tracer?: any;
|
|
52
|
-
[key: string]: any;
|
|
53
|
-
}
|
|
54
|
-
export type ParseFunction = (input: string, options?: ParseOptions) => any;
|
|
55
|
-
export declare const parse: ParseFunction;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import ParserWarning from './parser_warning';
|
|
2
|
-
import Song from '../chord_sheet/song';
|
|
3
|
-
import { ParseOptions } from './chords_over_words/peg_parser';
|
|
4
|
-
export type ChordsOverWordsParserOptions = ParseOptions & {
|
|
5
|
-
softLineBreaks?: boolean;
|
|
6
|
-
chopFirstWord?: boolean;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Parses a chords over words sheet into a song
|
|
10
|
-
*
|
|
11
|
-
* It support "regular" chord sheets:
|
|
12
|
-
*
|
|
13
|
-
* Am C/G F C
|
|
14
|
-
* Let it be, let it be, let it be, let it be
|
|
15
|
-
* C G F C/E Dm C
|
|
16
|
-
* Whisper words of wisdom, let it be
|
|
17
|
-
*
|
|
18
|
-
* Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:
|
|
19
|
-
*
|
|
20
|
-
* {title: Let it be}
|
|
21
|
-
* {key: C}
|
|
22
|
-
* Chorus 1:
|
|
23
|
-
* Am
|
|
24
|
-
* Let it be
|
|
25
|
-
*
|
|
26
|
-
* For convenience, you can leave out the brackets:
|
|
27
|
-
*
|
|
28
|
-
* title: Let it be
|
|
29
|
-
* Chorus 1:
|
|
30
|
-
* Am
|
|
31
|
-
* Let it be
|
|
32
|
-
*
|
|
33
|
-
* You can even use a markdown style frontmatter separator to separate the header from the song:
|
|
34
|
-
*
|
|
35
|
-
* title: Let it be
|
|
36
|
-
* key: C
|
|
37
|
-
* ---
|
|
38
|
-
* Chorus 1:
|
|
39
|
-
* Am C/G F C
|
|
40
|
-
* Let it be, let it be, let it be, let it be
|
|
41
|
-
* C G F C/E Dm C
|
|
42
|
-
* Whisper words of wisdom, let it be
|
|
43
|
-
*
|
|
44
|
-
* `ChordsOverWordsParser` is the better version of `ChordSheetParser`, which is deprecated.
|
|
45
|
-
*/
|
|
46
|
-
declare class ChordsOverWordsParser {
|
|
47
|
-
song?: Song;
|
|
48
|
-
/**
|
|
49
|
-
* All warnings raised during parsing the chord sheet
|
|
50
|
-
* @member
|
|
51
|
-
* @type {ParserWarning[]}
|
|
52
|
-
*/
|
|
53
|
-
get warnings(): ParserWarning[];
|
|
54
|
-
/**
|
|
55
|
-
* Parses a chords over words sheet into a song
|
|
56
|
-
* @param {string} chordSheet the chords over words sheet
|
|
57
|
-
* @param {ChordsOverWordsParserOptions} options Parser options.
|
|
58
|
-
* @param {ChordsOverWordsParserOptions.softLineBreaks} options.softLineBreaks=false If true, a backslash
|
|
59
|
-
* followed by a space is treated as a soft line break
|
|
60
|
-
* @param {ChordsOverWordsParserOptions.chopFirstWord} options.chopFirstWord=true If true, only the first lyric
|
|
61
|
-
* word is paired with the chord, the rest of the lyric is put in a separate chord lyric pair
|
|
62
|
-
* @see https://peggyjs.org/documentation.html#using-the-parser
|
|
63
|
-
* @returns {Song} The parsed song
|
|
64
|
-
*/
|
|
65
|
-
parse(chordSheet: string, options?: ChordsOverWordsParserOptions): Song;
|
|
66
|
-
}
|
|
67
|
-
export default ChordsOverWordsParser;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a parser warning, currently only used by ChordProParser.
|
|
3
|
-
*/
|
|
4
|
-
declare class ParserWarning {
|
|
5
|
-
/**
|
|
6
|
-
* The warning message
|
|
7
|
-
* @member
|
|
8
|
-
* @type {string}
|
|
9
|
-
*/
|
|
10
|
-
message: string;
|
|
11
|
-
/**
|
|
12
|
-
* The chord sheet line number on which the warning occurred
|
|
13
|
-
* @member
|
|
14
|
-
* @type {number}
|
|
15
|
-
*/
|
|
16
|
-
lineNumber: number | null;
|
|
17
|
-
/**
|
|
18
|
-
* The chord sheet column on which the warning occurred
|
|
19
|
-
* @member
|
|
20
|
-
* @type {number}
|
|
21
|
-
*/
|
|
22
|
-
column: number | null;
|
|
23
|
-
/**
|
|
24
|
-
* @hideconstructor
|
|
25
|
-
*/
|
|
26
|
-
constructor(message: string, lineNumber: number | null, column: number | null);
|
|
27
|
-
/**
|
|
28
|
-
* Returns a stringified version of the warning
|
|
29
|
-
* @returns {string} The string warning
|
|
30
|
-
*/
|
|
31
|
-
toString(): string;
|
|
32
|
-
}
|
|
33
|
-
export default ParserWarning;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import ChordSheetParser from './chord_sheet_parser';
|
|
2
|
-
/**
|
|
3
|
-
* Parses an Ultimate Guitar chord sheet with metadata
|
|
4
|
-
* Inherits from {@link ChordSheetParser}
|
|
5
|
-
*/
|
|
6
|
-
declare class UltimateGuitarParser extends ChordSheetParser {
|
|
7
|
-
currentSectionType: string | null;
|
|
8
|
-
pendingRepeatNotation: string | null;
|
|
9
|
-
/**
|
|
10
|
-
* Instantiate a chord sheet parser
|
|
11
|
-
* @param {Object} [options={}] options
|
|
12
|
-
* @param {boolean} [options.preserveWhitespace=true] whether to preserve trailing whitespace for chords
|
|
13
|
-
*/
|
|
14
|
-
constructor({ preserveWhitespace }?: {
|
|
15
|
-
preserveWhitespace?: boolean;
|
|
16
|
-
});
|
|
17
|
-
parseLine(line: string): void;
|
|
18
|
-
private parseRegularLine;
|
|
19
|
-
parseNonEmptyLine(line: string): void;
|
|
20
|
-
private parseChordLineWithNextLine;
|
|
21
|
-
private unreadLine;
|
|
22
|
-
private isNonLyricsLine;
|
|
23
|
-
private parseChordsOnly;
|
|
24
|
-
parseLyricsWithChords(chordsLine: string, lyricsLine: string): void;
|
|
25
|
-
processCharacters(chordsLine: string, lyricsLine: string): number;
|
|
26
|
-
addCharacter(chr: string, nextChar: string): void;
|
|
27
|
-
shouldAddCharacterToChords(nextChar: string): boolean;
|
|
28
|
-
ensureChordLyricsPairInitialized(): void;
|
|
29
|
-
private extractRepeatNotation;
|
|
30
|
-
private applyRepeatNotation;
|
|
31
|
-
parseUGMetadata(line: string): boolean;
|
|
32
|
-
private extractCapoValue;
|
|
33
|
-
parseVerseDirective(line: string): boolean;
|
|
34
|
-
parseChorusDirective(line: string): boolean;
|
|
35
|
-
parseBridgeDirective(line: string): boolean;
|
|
36
|
-
parsePartDirective(line: string): boolean;
|
|
37
|
-
parseMetadata(line: string): boolean;
|
|
38
|
-
isSectionEnd(): boolean;
|
|
39
|
-
endOfSong(): void;
|
|
40
|
-
startSection(sectionType: string, label: string): void;
|
|
41
|
-
endSection({ addNewLine }?: {
|
|
42
|
-
addNewLine?: boolean | undefined;
|
|
43
|
-
}): void;
|
|
44
|
-
startNewLine(): void;
|
|
45
|
-
}
|
|
46
|
-
export default UltimateGuitarParser;
|
package/lib/pdf/pdf.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { DomMeasurer } from '../../layout/measurement';
|
|
2
|
-
import { FontConfiguration } from '../../formatter/configuration';
|
|
3
|
-
declare type HTMLElement = any;
|
|
4
|
-
/**
|
|
5
|
-
* HtmlWrapper is responsible for managing the DOM elements for the chord sheet
|
|
6
|
-
*/
|
|
7
|
-
declare class HtmlDocWrapper {
|
|
8
|
-
container: HTMLElement;
|
|
9
|
-
pages: HTMLElement[];
|
|
10
|
-
currentPage: number;
|
|
11
|
-
totalPages: number;
|
|
12
|
-
pageSize: {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
};
|
|
16
|
-
measurer: DomMeasurer;
|
|
17
|
-
constructor(container: HTMLElement, pageSize: {
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
});
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new page in the container
|
|
23
|
-
*/
|
|
24
|
-
createPage(): HTMLElement;
|
|
25
|
-
get pageStyles(): Record<string, string>;
|
|
26
|
-
/**
|
|
27
|
-
* Creates a new page and advances to it
|
|
28
|
-
*/
|
|
29
|
-
newPage(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Sets the current page
|
|
32
|
-
*/
|
|
33
|
-
setPage(pageNumber: number): void;
|
|
34
|
-
/**
|
|
35
|
-
* Gets the current page element
|
|
36
|
-
*/
|
|
37
|
-
getCurrentPage(): HTMLElement;
|
|
38
|
-
/**
|
|
39
|
-
* Adds an element to the current page at the specified position
|
|
40
|
-
*/
|
|
41
|
-
addElement(element: HTMLElement, x: number, y: number): void;
|
|
42
|
-
/**
|
|
43
|
-
* Gets text dimensions using the DOM measurer
|
|
44
|
-
*/
|
|
45
|
-
getTextDimensions(text: string, font: FontConfiguration): {
|
|
46
|
-
w: number;
|
|
47
|
-
h: number;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Gets text width using the DOM measurer
|
|
51
|
-
*/
|
|
52
|
-
getTextWidth(text: string, font: FontConfiguration): number;
|
|
53
|
-
/**
|
|
54
|
-
* Splits text to fit within a maximum width
|
|
55
|
-
*/
|
|
56
|
-
splitTextToSize(text: string, maxWidth: number, font: FontConfiguration): string[];
|
|
57
|
-
/**
|
|
58
|
-
* Sets the font style (no-op in HTML renderer)
|
|
59
|
-
*/
|
|
60
|
-
setFontStyle(_font: FontConfiguration): void;
|
|
61
|
-
/**
|
|
62
|
-
* Sets line style for drawing (no-op in HTML renderer)
|
|
63
|
-
*/
|
|
64
|
-
setLineStyle(_style: any): void;
|
|
65
|
-
/**
|
|
66
|
-
* Resets line dash style (no-op in HTML renderer)
|
|
67
|
-
*/
|
|
68
|
-
resetDash(): void;
|
|
69
|
-
/**
|
|
70
|
-
* Executes a callback for each page
|
|
71
|
-
*/
|
|
72
|
-
eachPage(callback: (page: HTMLElement, index: number) => void): void;
|
|
73
|
-
/**
|
|
74
|
-
* Gets the container element
|
|
75
|
-
*/
|
|
76
|
-
getContainer(): HTMLElement;
|
|
77
|
-
/**
|
|
78
|
-
* Clean up resources
|
|
79
|
-
*/
|
|
80
|
-
dispose(): void;
|
|
81
|
-
}
|
|
82
|
-
export default HtmlDocWrapper;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { FontConfiguration } from '../../formatter/configuration';
|
|
2
|
-
import { PositionedElement } from '../renderer';
|
|
3
|
-
declare type HTMLElement = any;
|
|
4
|
-
declare type CSSStyleDeclaration = any;
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for HTML element styling
|
|
7
|
-
*/
|
|
8
|
-
export interface HtmlStylerConfig {
|
|
9
|
-
cssClassPrefix?: string;
|
|
10
|
-
cssClasses?: Record<string, string>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Handles styling of HTML elements for the positioned HTML renderer.
|
|
14
|
-
* Extracted to improve modularity and reduce file size.
|
|
15
|
-
*/
|
|
16
|
-
export declare class HtmlElementStyler {
|
|
17
|
-
private config;
|
|
18
|
-
constructor(config: HtmlStylerConfig);
|
|
19
|
-
/**
|
|
20
|
-
* Gets the CSS class prefix
|
|
21
|
-
*/
|
|
22
|
-
get prefix(): string;
|
|
23
|
-
/**
|
|
24
|
-
* Applies styles to an HTML element based on its positioned element data
|
|
25
|
-
*/
|
|
26
|
-
applyElementStyle(htmlElement: HTMLElement, element: PositionedElement): void;
|
|
27
|
-
/**
|
|
28
|
-
* Gets conditional CSS styles from font configuration
|
|
29
|
-
*/
|
|
30
|
-
getConditionalStyles(style: FontConfiguration): Partial<CSSStyleDeclaration>;
|
|
31
|
-
/**
|
|
32
|
-
* Gets type-specific styles for different element types
|
|
33
|
-
*/
|
|
34
|
-
getTypeSpecificStyles(element: PositionedElement): Partial<CSSStyleDeclaration>;
|
|
35
|
-
/**
|
|
36
|
-
* Gets chord-specific styles
|
|
37
|
-
*/
|
|
38
|
-
chordStyles(element: PositionedElement): Partial<CSSStyleDeclaration>;
|
|
39
|
-
/**
|
|
40
|
-
* Applies font styles to an HTML element
|
|
41
|
-
*/
|
|
42
|
-
applyFontStyle(element: HTMLElement, style: FontConfiguration): void;
|
|
43
|
-
/**
|
|
44
|
-
* Applies ellipsis styling to an element
|
|
45
|
-
*/
|
|
46
|
-
applyEllipsisStyle(element: HTMLElement, width: number): void;
|
|
47
|
-
/**
|
|
48
|
-
* Creates a class name string with the configured prefix
|
|
49
|
-
*/
|
|
50
|
-
createClassName(...classes: (string | undefined)[]): string;
|
|
51
|
-
/**
|
|
52
|
-
* Gets the custom CSS class for an element type if configured
|
|
53
|
-
*/
|
|
54
|
-
getCustomClass(elementType: string): string | undefined;
|
|
55
|
-
private getNormalizedFontStyles;
|
|
56
|
-
private normalizeColor;
|
|
57
|
-
}
|
|
58
|
-
export default HtmlElementStyler;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import Dimensions from '../../layout/engine/dimensions';
|
|
2
|
-
import HtmlDocWrapper from './html_doc_wrapper';
|
|
3
|
-
import Song from '../../chord_sheet/song';
|
|
4
|
-
import { LineLayout, MeasuredItem } from '../../layout/engine';
|
|
5
|
-
import Renderer, { ParagraphLayout } from '../renderer';
|
|
6
|
-
import { FontConfiguration, MeasuredHtmlFormatterConfiguration } from '../../formatter/configuration';
|
|
7
|
-
/**
|
|
8
|
-
* HtmlRenderer renders a song as HTML with absolute positioning
|
|
9
|
-
*/
|
|
10
|
-
declare class PositionedHtmlRenderer extends Renderer {
|
|
11
|
-
private configuration;
|
|
12
|
-
private currentLayoutFontStyle;
|
|
13
|
-
private currentLayoutSection;
|
|
14
|
-
private currentLayoutTextItem;
|
|
15
|
-
private currentLineStyle;
|
|
16
|
-
private _dimensions;
|
|
17
|
-
private _dimensionCacheKey;
|
|
18
|
-
private styler;
|
|
19
|
-
container: HTMLElement;
|
|
20
|
-
doc: HtmlDocWrapper;
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new HtmlRenderer
|
|
23
|
-
*/
|
|
24
|
-
constructor(song: Song, container: HTMLElement, configuration: MeasuredHtmlFormatterConfiguration);
|
|
25
|
-
getFontConfiguration(objectType: string): FontConfiguration;
|
|
26
|
-
getDocumentMetadata(): Record<string, any>;
|
|
27
|
-
getDoc(): HtmlDocWrapper;
|
|
28
|
-
getHTML(): HTMLElement;
|
|
29
|
-
dispose(): void;
|
|
30
|
-
protected initializeBackend(): void;
|
|
31
|
-
protected createNewPage(): void;
|
|
32
|
-
protected renderChordDiagrams(): void;
|
|
33
|
-
protected renderHeadersAndFooters(): void;
|
|
34
|
-
private renderLayoutForEachPage;
|
|
35
|
-
private resetLayoutRenderingState;
|
|
36
|
-
private createLayoutRenderer;
|
|
37
|
-
private createLayoutBackend;
|
|
38
|
-
private renderHtmlText;
|
|
39
|
-
private applyLayoutTextClasses;
|
|
40
|
-
private applyLayoutTextStyles;
|
|
41
|
-
private renderHtmlImage;
|
|
42
|
-
private renderHtmlLine;
|
|
43
|
-
protected renderParagraphs(paragraphLayouts: ParagraphLayout[]): void;
|
|
44
|
-
private renderParagraph;
|
|
45
|
-
private groupElementsByPageAndColumn;
|
|
46
|
-
protected renderLineItems(lines: LineLayout[]): void;
|
|
47
|
-
private renderSingleLine;
|
|
48
|
-
private getCurrentContext;
|
|
49
|
-
private handleColumnOverflow;
|
|
50
|
-
private renderLineContent;
|
|
51
|
-
private renderMeasuredItem;
|
|
52
|
-
private renderChordLyricsPairItem;
|
|
53
|
-
private renderTagItem;
|
|
54
|
-
private updatePosition;
|
|
55
|
-
protected addSectionLabel(label: string, x: number, y: number, options?: {
|
|
56
|
-
noUnderline?: boolean;
|
|
57
|
-
}): void;
|
|
58
|
-
protected addComment(comment: string, x: number, y: number, options?: {
|
|
59
|
-
noUnderline?: boolean;
|
|
60
|
-
}): void;
|
|
61
|
-
private addTextElementWithOptions;
|
|
62
|
-
protected measureText(text: string, font: FontConfiguration): {
|
|
63
|
-
width: number;
|
|
64
|
-
height: number;
|
|
65
|
-
};
|
|
66
|
-
protected calculateChordBaseline(yOffset: number, items: MeasuredItem[], chordText: string): number;
|
|
67
|
-
protected finalizeRendering(): void;
|
|
68
|
-
protected getConfiguration(): MeasuredHtmlFormatterConfiguration;
|
|
69
|
-
get dimensions(): Dimensions;
|
|
70
|
-
protected getDocPageSize(): {
|
|
71
|
-
width: number;
|
|
72
|
-
height: number;
|
|
73
|
-
};
|
|
74
|
-
private calculateBounds;
|
|
75
|
-
private createParagraphDiv;
|
|
76
|
-
private createElementGroupDiv;
|
|
77
|
-
private renderElementGroup;
|
|
78
|
-
private renderElement;
|
|
79
|
-
private drawElement;
|
|
80
|
-
private drawTextElement;
|
|
81
|
-
private buildDimensions;
|
|
82
|
-
private generateDimensionCacheKey;
|
|
83
|
-
protected getExtraMetadata(page: number, totalPages: number): Record<string, string | string[]>;
|
|
84
|
-
}
|
|
85
|
-
export default PositionedHtmlRenderer;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Blob } from 'buffer';
|
|
2
|
-
import Dimensions from '../../layout/engine/dimensions';
|
|
3
|
-
import DocWrapper from '../../formatter/pdf_formatter/doc_wrapper';
|
|
4
|
-
import Song from '../../chord_sheet/song';
|
|
5
|
-
import { MeasuredItem } from '../../layout/engine';
|
|
6
|
-
import { PdfConstructor } from '../../formatter/pdf_formatter/types';
|
|
7
|
-
import Renderer from '../renderer';
|
|
8
|
-
import { FontConfiguration, PDFFormatterConfiguration } from '../../formatter/configuration';
|
|
9
|
-
declare class JsPdfRenderer extends Renderer {
|
|
10
|
-
private configuration;
|
|
11
|
-
private _dimensions;
|
|
12
|
-
private _dimensionCacheKey;
|
|
13
|
-
doc: DocWrapper;
|
|
14
|
-
constructor(song: Song, docConstructor: PdfConstructor, configuration: PDFFormatterConfiguration);
|
|
15
|
-
getFontConfiguration(objectType: string): FontConfiguration;
|
|
16
|
-
getDocumentMetadata(): Record<string, any>;
|
|
17
|
-
save(filename: string): void;
|
|
18
|
-
generatePDF(): Promise<Blob>;
|
|
19
|
-
getDoc(): DocWrapper;
|
|
20
|
-
protected initializeBackend(): void;
|
|
21
|
-
protected createNewPage(): void;
|
|
22
|
-
protected renderChordDiagrams(): void;
|
|
23
|
-
private createDiagramContext;
|
|
24
|
-
private createDiagramConfig;
|
|
25
|
-
protected renderHeadersAndFooters(): void;
|
|
26
|
-
private createLayoutRenderer;
|
|
27
|
-
private createLayoutBackend;
|
|
28
|
-
protected measureText(text: string, font: FontConfiguration): {
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
};
|
|
32
|
-
protected calculateChordBaseline(yOffset: number, items: MeasuredItem[], chordText: string): number;
|
|
33
|
-
protected finalizeRendering(): void;
|
|
34
|
-
protected getConfiguration(): PDFFormatterConfiguration;
|
|
35
|
-
protected get dimensions(): Dimensions;
|
|
36
|
-
protected getDocPageSize(): {
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
};
|
|
40
|
-
private drawElement;
|
|
41
|
-
private drawUnderlineIfNeeded;
|
|
42
|
-
private buildDimensions;
|
|
43
|
-
private generateDimensionCacheKey;
|
|
44
|
-
protected getExtraMetadata(page: number, totalPages: number): Record<string, string | string[]>;
|
|
45
|
-
}
|
|
46
|
-
export default JsPdfRenderer;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import DocWrapper from '../../formatter/pdf_formatter/doc_wrapper';
|
|
2
|
-
import Song from '../../chord_sheet/song';
|
|
3
|
-
import { ChordDiagramRenderingConfig } from '../../chord_diagram/chord_diagram';
|
|
4
|
-
import { ChordDiagramFontConfigurations } from '../../formatter/configuration';
|
|
5
|
-
/**
|
|
6
|
-
* Context for chord diagram rendering
|
|
7
|
-
*/
|
|
8
|
-
export interface ChordDiagramRenderingContext {
|
|
9
|
-
song: Song;
|
|
10
|
-
doc: DocWrapper;
|
|
11
|
-
getMinY: () => number;
|
|
12
|
-
getColumnStartX: () => number;
|
|
13
|
-
getColumnBottomY: () => number;
|
|
14
|
-
moveToNextColumn: () => void;
|
|
15
|
-
dimensions: {
|
|
16
|
-
columnWidth: number;
|
|
17
|
-
};
|
|
18
|
-
getX: () => number;
|
|
19
|
-
getY: () => number;
|
|
20
|
-
getCurrentColumn: () => number;
|
|
21
|
-
getCurrentPage: () => number;
|
|
22
|
-
setPosition: (x: number, y: number, column: number, page: number) => void;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Configuration for chord diagram rendering
|
|
26
|
-
*/
|
|
27
|
-
export interface ChordDiagramConfig {
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
renderingConfig?: ChordDiagramRenderingConfig;
|
|
30
|
-
fonts: ChordDiagramFontConfigurations;
|
|
31
|
-
overrides?: {
|
|
32
|
-
global?: Record<string, {
|
|
33
|
-
hide?: boolean;
|
|
34
|
-
definition?: string;
|
|
35
|
-
}>;
|
|
36
|
-
byKey?: Record<string, Record<string, {
|
|
37
|
-
hide?: boolean;
|
|
38
|
-
definition?: string;
|
|
39
|
-
}>>;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Handles chord diagram rendering for PDF output.
|
|
44
|
-
* Extracted from JsPdfRenderer to improve modularity.
|
|
45
|
-
*/
|
|
46
|
-
export declare class ChordDiagramRenderer {
|
|
47
|
-
private context;
|
|
48
|
-
private config;
|
|
49
|
-
constructor(context: ChordDiagramRenderingContext, config: ChordDiagramConfig);
|
|
50
|
-
/**
|
|
51
|
-
* Renders all chord diagrams for the song
|
|
52
|
-
*/
|
|
53
|
-
render(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Calculates layout dimensions for chord diagrams
|
|
56
|
-
*/
|
|
57
|
-
private calculateDiagramLayout;
|
|
58
|
-
/**
|
|
59
|
-
* Initializes position for diagram rendering
|
|
60
|
-
*/
|
|
61
|
-
private initializeDiagramPosition;
|
|
62
|
-
/**
|
|
63
|
-
* Renders a single chord diagram
|
|
64
|
-
*/
|
|
65
|
-
private renderSingleChordDiagram;
|
|
66
|
-
/**
|
|
67
|
-
* Positions for the next diagram, handling row and column breaks
|
|
68
|
-
*/
|
|
69
|
-
private positionForNextDiagram;
|
|
70
|
-
private getInitialPosition;
|
|
71
|
-
private handleRowBreak;
|
|
72
|
-
private handleColumnBreak;
|
|
73
|
-
/**
|
|
74
|
-
* Draws a single chord diagram
|
|
75
|
-
*/
|
|
76
|
-
private drawChordDiagram;
|
|
77
|
-
/**
|
|
78
|
-
* Processes chord overrides from configuration
|
|
79
|
-
*/
|
|
80
|
-
private processChordOverrides;
|
|
81
|
-
/**
|
|
82
|
-
* Extracts override values from configuration
|
|
83
|
-
*/
|
|
84
|
-
private extractOverrideValues;
|
|
85
|
-
/**
|
|
86
|
-
* Gets chord definitions from the song
|
|
87
|
-
*/
|
|
88
|
-
private getChordDefinitions;
|
|
89
|
-
/**
|
|
90
|
-
* Builds a chord diagram from a chord definition
|
|
91
|
-
*/
|
|
92
|
-
private buildChordDiagram;
|
|
93
|
-
/**
|
|
94
|
-
* Processes fingering information and identifies barres
|
|
95
|
-
*/
|
|
96
|
-
private processFingeringAndBarres;
|
|
97
|
-
/**
|
|
98
|
-
* Adds markers without fingering information
|
|
99
|
-
*/
|
|
100
|
-
private addMarkersWithoutFingering;
|
|
101
|
-
/**
|
|
102
|
-
* Groups frets by finger for barre detection
|
|
103
|
-
*/
|
|
104
|
-
private groupFretsByFinger;
|
|
105
|
-
/**
|
|
106
|
-
* Processes grouped frets/fingers into markers and barres
|
|
107
|
-
*/
|
|
108
|
-
private processFretFingerGroups;
|
|
109
|
-
/**
|
|
110
|
-
* Processes a single finger group into either a marker or barre
|
|
111
|
-
*/
|
|
112
|
-
private processFingerGroup;
|
|
113
|
-
/**
|
|
114
|
-
* Adds a barre if string positions are valid
|
|
115
|
-
*/
|
|
116
|
-
private addBarreIfValid;
|
|
117
|
-
}
|
|
118
|
-
export default ChordDiagramRenderer;
|