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.
Files changed (131) hide show
  1. package/lib/bundle.js +1 -1
  2. package/lib/bundle.min.js +1 -1
  3. package/lib/index.js +1 -1
  4. package/lib/index.js.map +1 -1
  5. package/lib/main.d.ts +1 -1
  6. package/lib/module.js +1 -1
  7. package/lib/module.js.map +1 -1
  8. package/lib/pdf/index.js +30933 -17401
  9. package/lib/pdf/index.js.map +1 -0
  10. package/lib/pdf/main.d.ts +1696 -0
  11. package/lib/pdf/main.d.ts.map +1 -0
  12. package/lib/pdf/module.js +30891 -17332
  13. package/lib/pdf/module.js.map +1 -0
  14. package/package.json +2 -2
  15. package/lib/pdf/chord.d.ts +0 -219
  16. package/lib/pdf/chord_definition/chord_definition.d.ts +0 -66
  17. package/lib/pdf/chord_definition/chord_definition_set.d.ts +0 -12
  18. package/lib/pdf/chord_diagram/chord_diagram.d.ts +0 -131
  19. package/lib/pdf/chord_diagram/js_pdf_renderer.d.ts +0 -40
  20. package/lib/pdf/chord_diagram/renderer.d.ts +0 -43
  21. package/lib/pdf/chord_parsing_error.d.ts +0 -2
  22. package/lib/pdf/chord_sheet/ast_component.d.ts +0 -11
  23. package/lib/pdf/chord_sheet/ast_type.d.ts +0 -9
  24. package/lib/pdf/chord_sheet/chord_lyrics_pair.d.ts +0 -60
  25. package/lib/pdf/chord_sheet/chord_pro/composite.d.ts +0 -11
  26. package/lib/pdf/chord_sheet/chord_pro/evaluatable.d.ts +0 -7
  27. package/lib/pdf/chord_sheet/chord_pro/evaluation_error.d.ts +0 -7
  28. package/lib/pdf/chord_sheet/chord_pro/literal.d.ts +0 -9
  29. package/lib/pdf/chord_sheet/chord_pro/ternary.d.ts +0 -29
  30. package/lib/pdf/chord_sheet/comment.d.ts +0 -21
  31. package/lib/pdf/chord_sheet/font.d.ts +0 -47
  32. package/lib/pdf/chord_sheet/font_size.d.ts +0 -33
  33. package/lib/pdf/chord_sheet/font_stack.d.ts +0 -13
  34. package/lib/pdf/chord_sheet/item.d.ts +0 -7
  35. package/lib/pdf/chord_sheet/line.d.ts +0 -130
  36. package/lib/pdf/chord_sheet/line_expander.d.ts +0 -12
  37. package/lib/pdf/chord_sheet/metadata.d.ts +0 -71
  38. package/lib/pdf/chord_sheet/metadata_accessors.d.ts +0 -18
  39. package/lib/pdf/chord_sheet/paragraph.d.ts +0 -48
  40. package/lib/pdf/chord_sheet/soft_line_break.d.ts +0 -15
  41. package/lib/pdf/chord_sheet/song.d.ts +0 -253
  42. package/lib/pdf/chord_sheet/song_mapper.d.ts +0 -15
  43. package/lib/pdf/chord_sheet/standard_metadata_providers.d.ts +0 -5
  44. package/lib/pdf/chord_sheet/tag.d.ts +0 -104
  45. package/lib/pdf/chord_sheet/tag_interpreter.d.ts +0 -14
  46. package/lib/pdf/chord_sheet/tags.d.ts +0 -259
  47. package/lib/pdf/chord_sheet/trace_info.d.ts +0 -6
  48. package/lib/pdf/chord_sheet_serializer.d.ts +0 -49
  49. package/lib/pdf/constants.d.ts +0 -117
  50. package/lib/pdf/formatter/chord_pro_formatter.d.ts +0 -39
  51. package/lib/pdf/formatter/chord_renderer.d.ts +0 -30
  52. package/lib/pdf/formatter/chords_over_words_formatter.d.ts +0 -33
  53. package/lib/pdf/formatter/configuration/base_configuration.d.ts +0 -58
  54. package/lib/pdf/formatter/configuration/default_config_manager.d.ts +0 -31
  55. package/lib/pdf/formatter/configuration/html_configuration.d.ts +0 -37
  56. package/lib/pdf/formatter/configuration/index.d.ts +0 -13
  57. package/lib/pdf/formatter/configuration/measured_html_configuration.d.ts +0 -38
  58. package/lib/pdf/formatter/configuration/measurement_based_configuration.d.ts +0 -204
  59. package/lib/pdf/formatter/configuration/pdf_configuration.d.ts +0 -16
  60. package/lib/pdf/formatter/formatter.d.ts +0 -38
  61. package/lib/pdf/formatter/formatting_context.d.ts +0 -7
  62. package/lib/pdf/formatter/html_div_formatter.d.ts +0 -9
  63. package/lib/pdf/formatter/html_formatter.d.ts +0 -60
  64. package/lib/pdf/formatter/html_table_formatter.d.ts +0 -10
  65. package/lib/pdf/formatter/measured_html_formatter.d.ts +0 -43
  66. package/lib/pdf/formatter/measurement_based_formatter.d.ts +0 -19
  67. package/lib/pdf/formatter/pdf_formatter/doc_wrapper.d.ts +0 -53
  68. package/lib/pdf/formatter/pdf_formatter/fonts/NimbusSansLFonts.base64.d.ts +0 -4
  69. package/lib/pdf/formatter/pdf_formatter/types.d.ts +0 -34
  70. package/lib/pdf/formatter/pdf_formatter.d.ts +0 -40
  71. package/lib/pdf/formatter/templates/html_div_formatter.d.ts +0 -3
  72. package/lib/pdf/formatter/templates/html_table_formatter.d.ts +0 -3
  73. package/lib/pdf/formatter/text_formatter.d.ts +0 -35
  74. package/lib/pdf/helpers.d.ts +0 -42
  75. package/lib/pdf/index.d.ts +0 -126
  76. package/lib/pdf/key.d.ts +0 -124
  77. package/lib/pdf/key_config.d.ts +0 -3
  78. package/lib/pdf/layout/engine/condition.d.ts +0 -25
  79. package/lib/pdf/layout/engine/dimensions.d.ts +0 -33
  80. package/lib/pdf/layout/engine/index.d.ts +0 -7
  81. package/lib/pdf/layout/engine/item_processor.d.ts +0 -70
  82. package/lib/pdf/layout/engine/layout_engine.d.ts +0 -67
  83. package/lib/pdf/layout/engine/layout_factory.d.ts +0 -22
  84. package/lib/pdf/layout/engine/layout_helpers.d.ts +0 -35
  85. package/lib/pdf/layout/engine/line_breaker.d.ts +0 -54
  86. package/lib/pdf/layout/engine/paragraph_splitter/index.d.ts +0 -5
  87. package/lib/pdf/layout/engine/paragraph_splitter/paragraph_splitter.d.ts +0 -5
  88. package/lib/pdf/layout/engine/paragraph_splitter/strategies/five_or_more_lines_paragraph_split_strategy.d.ts +0 -14
  89. package/lib/pdf/layout/engine/paragraph_splitter/strategies/four_lines_paragraph_split_strategy.d.ts +0 -8
  90. package/lib/pdf/layout/engine/paragraph_splitter/strategies/three_or_less_lines_paragraph_split_strategy.d.ts +0 -4
  91. package/lib/pdf/layout/engine/title_separator_tag.d.ts +0 -8
  92. package/lib/pdf/layout/engine/types.d.ts +0 -98
  93. package/lib/pdf/layout/measurement/canvas_measurer.d.ts +0 -18
  94. package/lib/pdf/layout/measurement/dom_measurer.d.ts +0 -21
  95. package/lib/pdf/layout/measurement/index.d.ts +0 -4
  96. package/lib/pdf/layout/measurement/js_pdf_measurer.d.ts +0 -12
  97. package/lib/pdf/layout/measurement/measurer.d.ts +0 -52
  98. package/lib/pdf/normalize_mappings/enharmonic-normalize.d.ts +0 -2
  99. package/lib/pdf/normalize_mappings/suffix-normalize-mapping.d.ts +0 -2
  100. package/lib/pdf/pango/pango_helpers.d.ts +0 -6
  101. package/lib/pdf/parser/chord/peg_parser.d.ts +0 -55
  102. package/lib/pdf/parser/chord_definition/peg_parser.d.ts +0 -55
  103. package/lib/pdf/parser/chord_pro/helpers.d.ts +0 -15
  104. package/lib/pdf/parser/chord_pro/peg_parser.d.ts +0 -55
  105. package/lib/pdf/parser/chord_pro_parser.d.ts +0 -32
  106. package/lib/pdf/parser/chord_sheet_parser.d.ts +0 -57
  107. package/lib/pdf/parser/chords_over_words/helpers.d.ts +0 -33
  108. package/lib/pdf/parser/chords_over_words/peg_parser.d.ts +0 -55
  109. package/lib/pdf/parser/chords_over_words_parser.d.ts +0 -67
  110. package/lib/pdf/parser/null_tracer.d.ts +0 -4
  111. package/lib/pdf/parser/parser_helpers.d.ts +0 -3
  112. package/lib/pdf/parser/parser_warning.d.ts +0 -33
  113. package/lib/pdf/parser/ultimate_guitar_parser.d.ts +0 -46
  114. package/lib/pdf/pdf.d.ts +0 -2
  115. package/lib/pdf/rendering/html/html_doc_wrapper.d.ts +0 -82
  116. package/lib/pdf/rendering/html/html_element_styler.d.ts +0 -58
  117. package/lib/pdf/rendering/html/positioned_html_renderer.d.ts +0 -85
  118. package/lib/pdf/rendering/pdf/js_pdf_renderer.d.ts +0 -46
  119. package/lib/pdf/rendering/pdf/pdf_chord_diagram_renderer.d.ts +0 -118
  120. package/lib/pdf/rendering/renderer.d.ts +0 -273
  121. package/lib/pdf/rendering/shared/layout_section_renderer.d.ts +0 -93
  122. package/lib/pdf/scales.d.ts +0 -3
  123. package/lib/pdf/serialized_types.d.ts +0 -76
  124. package/lib/pdf/song_builder.d.ts +0 -38
  125. package/lib/pdf/template_helpers/metadata_processor.d.ts +0 -14
  126. package/lib/pdf/template_helpers/when.d.ts +0 -13
  127. package/lib/pdf/template_helpers/when_callback.d.ts +0 -2
  128. package/lib/pdf/template_helpers/when_clause.d.ts +0 -8
  129. package/lib/pdf/template_helpers.d.ts +0 -64
  130. package/lib/pdf/utilities.d.ts +0 -35
  131. package/lib/pdf/version.d.ts +0 -2
@@ -1,34 +0,0 @@
1
- import { ImageCompression, ImageOptions, RGBAData, TextOptionsLight, jsPDFOptions } from 'jspdf';
2
- export interface PdfDoc {
3
- get internal(): {
4
- pageSize: {
5
- getWidth(): number;
6
- };
7
- };
8
- addImage(imageData: string | HTMLImageElement | HTMLCanvasElement | Uint8Array | RGBAData, format: string, x: number, y: number, width: number, height: number, alias?: string, compression?: ImageCompression, rotation?: number): PdfDoc;
9
- addImage(imageData: string | HTMLImageElement | HTMLCanvasElement | Uint8Array | RGBAData, x: number, y: number, width: number, height: number, alias?: string, compression?: ImageCompression, rotation?: number): PdfDoc;
10
- addImage(options: ImageOptions): PdfDoc;
11
- circle(x: number, y: number, r: number, style?: string | null): PdfDoc;
12
- getTextDimensions(text: string, options?: TextOptionsLight): {
13
- w: number;
14
- h: number;
15
- };
16
- line(x1: number, y1: number, x2: number, y2: number, style?: string | null): PdfDoc;
17
- roundedRect(x: number, y: number, w: number, h: number, rx: number, ry: number, style?: string | null): PdfDoc;
18
- save(filename: string, options: {
19
- returnPromise: true;
20
- }): Promise<void>;
21
- save(filename?: string): PdfDoc;
22
- setDrawColor(ch1: string | number, ch2?: number, ch3?: number, ch4?: number): PdfDoc;
23
- setFont(fontName: string, fontStyle?: string, fontWeight?: string | number): PdfDoc;
24
- setFontSize(size: number): PdfDoc;
25
- setPage(page: number): PdfDoc;
26
- setLineWidth(width: number): PdfDoc;
27
- setTextColor(ch1: string): PdfDoc;
28
- setTextColor(ch1: number): PdfDoc;
29
- setTextColor(ch1: number, ch2: number, ch3: number, ch4?: number): PdfDoc;
30
- text(text: string | string[], x: number, y: number, options?: TextOptionsLight, transform?: any): PdfDoc;
31
- addFileToVFS(fileName: string, data: string): PdfDoc;
32
- addFont(postScriptName: string, id: string, fontStyle: string, fontWeight?: string | number, encoding?: 'StandardEncoding' | 'MacRomanEncoding' | 'Identity-H' | 'WinAnsiEncoding', isStandardFont?: boolean): string;
33
- }
34
- export type PdfConstructor = new (options?: jsPDFOptions) => PdfDoc;
@@ -1,40 +0,0 @@
1
- import { Blob } from 'buffer';
2
- import DocWrapper from './pdf_formatter/doc_wrapper';
3
- import MeasurementBasedFormatter from './measurement_based_formatter';
4
- import { PDFFormatterConfiguration } from './configuration';
5
- import { PdfConstructor } from './pdf_formatter/types';
6
- import Song from '../chord_sheet/song';
7
- /**
8
- * PdfFormatter formats a song into a PDF document.
9
- */
10
- declare class PdfFormatter extends MeasurementBasedFormatter<PDFFormatterConfiguration> {
11
- private song;
12
- private renderer;
13
- /**
14
- * Get the default configuration for PDF formatter
15
- */
16
- protected getDefaultConfiguration(): PDFFormatterConfiguration;
17
- /**
18
- * Formats a song into a PDF.
19
- * @param song - The song to format.
20
- * @param docConstructor - The PDF document constructor.
21
- */
22
- format(song: Song, docConstructor?: PdfConstructor): void;
23
- /**
24
- * Create the layout engine with the appropriate configuration
25
- */
26
- private createLayoutEngine;
27
- /**
28
- * Save the formatted document as a PDF file
29
- */
30
- save(): void;
31
- /**
32
- * Generate the PDF as a Blob object
33
- */
34
- generatePDF(): Promise<Blob>;
35
- /**
36
- * Get the document wrapper - primarily for testing purposes.
37
- */
38
- getDocumentWrapper(): DocWrapper;
39
- }
40
- export default PdfFormatter;
@@ -1,3 +0,0 @@
1
- import { HtmlTemplateArgs } from '../html_formatter';
2
- declare const _default: ({ configuration, configuration: { key, cssClasses: c, }, song, metadata, renderBlankLines, song: { title, subtitle, }, bodyParagraphs, }: HtmlTemplateArgs) => string;
3
- export default _default;
@@ -1,3 +0,0 @@
1
- import { HtmlTemplateArgs } from '../html_formatter';
2
- declare const _default: ({ configuration, configuration: { key, cssClasses: c, }, song, metadata, renderBlankLines, song: { title, subtitle, bodyLines, }, bodyParagraphs, }: HtmlTemplateArgs) => string;
3
- export default _default;
@@ -1,35 +0,0 @@
1
- import ChordLyricsPair from '../chord_sheet/chord_lyrics_pair';
2
- import Formatter from './formatter';
3
- import Item from '../chord_sheet/item';
4
- import Line from '../chord_sheet/line';
5
- import Metadata from '../chord_sheet/metadata';
6
- import Paragraph from '../chord_sheet/paragraph';
7
- import Song from '../chord_sheet/song';
8
- /**
9
- * Formats a song into a plain text chord sheet
10
- */
11
- declare class TextFormatter extends Formatter {
12
- song: Song;
13
- metadata: Metadata;
14
- /**
15
- * Formats a song into a plain text chord sheet
16
- * @param {Song} song The song to be formatted
17
- * @param {Metadata} metadata Optional override of metadata used for formatting
18
- * @returns {string} the chord sheet
19
- */
20
- format(song: Song, metadata?: Metadata): string;
21
- formatHeader(): string;
22
- formatParagraphs(): string;
23
- formatParagraph(paragraph: Paragraph, metadata: Metadata): string;
24
- formatLine(line: Line, metadata: Metadata): string;
25
- formatTitle(title: string | null): string;
26
- formatSubTitle(subtitle: string | null): string;
27
- formatLineTop(line: Line, metadata: Metadata): string | null;
28
- chordLyricsPairLength(chordLyricsPair: ChordLyricsPair, line: Line): number;
29
- private renderChords;
30
- formatItemTop(item: Item, _metadata: Metadata, line: Line): string;
31
- formatLineBottom(line: Line, metadata: Metadata): string;
32
- formatLineWithFormatter(line: Line, formatter: (_item: Item, _metadata: Metadata, _line: Line) => string, metadata: Metadata): string;
33
- formatItemBottom(item: Item, metadata: Metadata, line: Line): string;
34
- }
35
- export default TextFormatter;
@@ -1,42 +0,0 @@
1
- import FormattingContext from './formatter/formatting_context';
2
- import Key from './key';
3
- import Line from './chord_sheet/line';
4
- import Song from './chord_sheet/song';
5
- export declare function transposeDistance(transposeKey: string, songKey: string | Key): number;
6
- interface RenderChordOptions {
7
- renderKey?: Key | null;
8
- useUnicodeModifier?: boolean;
9
- normalizeChords?: boolean;
10
- decapo?: boolean;
11
- }
12
- /**
13
- * Renders a chord in the context of a line and song and taking into account some options
14
- * @param chordString The chord to render
15
- * @param line The line the chord is in
16
- * @param song The song the line is in
17
- * @param renderKey The key to render the chord in. If not provided, the line key will be used,
18
- * or the song key if the line key is not provided.
19
- * @param useUnicodeModifier Whether to use unicode modifiers ('\u266f'/'\u266d') or plain text ('#'/'b').
20
- * Default `false`.
21
- * @param normalizeChords Whether to normalize the chord to the key (default `true`)
22
- * @param decapo Whether to transpose all chords to eliminate the capo (default `false`)
23
- */
24
- export declare function renderChord(chordString: string, line: Line, song: Song, { renderKey, useUnicodeModifier, normalizeChords, decapo, }?: RenderChordOptions): string;
25
- /**
26
- * Returns applicable capos for the provided key
27
- * @param {Key|string} key The key to get capos for
28
- * @returns {Object.<string, string>} The available capos, where the keys are capo numbers and the
29
- * values are the effective key for that capo.
30
- */
31
- export declare function getCapos(key: Key | string): Record<string, string>;
32
- /**
33
- * Returns applicable keys to transpose to from the provided key
34
- * @param {Key|string} key The key to get keys for
35
- * @returns {Array<string>} The available keys
36
- */
37
- export declare function getKeys(key: Key | string): string[];
38
- export declare function testSelector({ selector, isNegated }: {
39
- selector: string;
40
- isNegated: boolean;
41
- }, { configuration, metadata }: FormattingContext): boolean;
42
- export {};
@@ -1,126 +0,0 @@
1
- import Chord from './chord';
2
- import ChordDefinition from './chord_definition/chord_definition';
3
- import ChordLyricsPair from './chord_sheet/chord_lyrics_pair';
4
- import ChordProFormatter from './formatter/chord_pro_formatter';
5
- import ChordProParser from './parser/chord_pro_parser';
6
- import ChordSheetParser from './parser/chord_sheet_parser';
7
- import ChordSheetSerializer from './chord_sheet_serializer';
8
- import ChordsOverWordsFormatter from './formatter/chords_over_words_formatter';
9
- import ChordsOverWordsParser from './parser/chords_over_words_parser';
10
- import Comment from './chord_sheet/comment';
11
- import Composite from './chord_sheet/chord_pro/composite';
12
- import HtmlDivFormatter from './formatter/html_div_formatter';
13
- import HtmlTableFormatter from './formatter/html_table_formatter';
14
- import Line from './chord_sheet/line';
15
- import Literal from './chord_sheet/chord_pro/literal';
16
- import MeasuredHtmlFormatter from './formatter/measured_html_formatter';
17
- import Metadata from './chord_sheet/metadata';
18
- import Paragraph from './chord_sheet/paragraph';
19
- import SoftLineBreak from './chord_sheet/soft_line_break';
20
- import Song from './chord_sheet/song';
21
- import Tag from './chord_sheet/tag';
22
- import Ternary from './chord_sheet/chord_pro/ternary';
23
- import TextFormatter from './formatter/text_formatter';
24
- import UltimateGuitarParser from './parser/ultimate_guitar_parser';
25
- import { each, evaluate, fontStyleTag, hasChordContents, hasTextContents, isChordLyricsPair, isComment, isEvaluatable, isImage, isTag, lineClasses, lineHasContents, pangoToHtml, paragraphClasses, renderChord, stripHTML, stripPangoMarkup, when } from './template_helpers';
26
- import { BaseMeasurer } from './layout/measurement';
27
- import { CanvasMeasurer } from './layout/measurement';
28
- import { DomMeasurer } from './layout/measurement';
29
- import { LayoutEngine } from './layout/engine';
30
- export { default as Chord } from './chord';
31
- export { default as ChordDefinition } from './chord_definition/chord_definition';
32
- export { default as ChordLyricsPair } from './chord_sheet/chord_lyrics_pair';
33
- export { default as ChordProFormatter } from './formatter/chord_pro_formatter';
34
- export { default as MeasuredHtmlFormatter } from './formatter/measured_html_formatter';
35
- export { default as ChordProParser } from './parser/chord_pro_parser';
36
- export { default as ChordSheetParser } from './parser/chord_sheet_parser';
37
- export { default as ChordSheetSerializer } from './chord_sheet_serializer';
38
- export { default as ChordsOverWordsFormatter } from './formatter/chords_over_words_formatter';
39
- export { default as ChordsOverWordsParser } from './parser/chords_over_words_parser';
40
- export { default as Comment } from './chord_sheet/comment';
41
- export { default as Composite } from './chord_sheet/chord_pro/composite';
42
- export { default as Formatter } from './formatter/formatter';
43
- export { default as HtmlDivFormatter } from './formatter/html_div_formatter';
44
- export { default as HtmlFormatter } from './formatter/html_formatter';
45
- export { default as HtmlTableFormatter } from './formatter/html_table_formatter';
46
- export { default as Key } from './key';
47
- export { default as Line } from './chord_sheet/line';
48
- export { default as Literal } from './chord_sheet/chord_pro/literal';
49
- export { default as Metadata } from './chord_sheet/metadata';
50
- export { default as Paragraph } from './chord_sheet/paragraph';
51
- export { default as SoftLineBreak } from './chord_sheet/soft_line_break';
52
- export { default as Song } from './chord_sheet/song';
53
- export { default as Tag } from './chord_sheet/tag';
54
- export { default as Ternary } from './chord_sheet/chord_pro/ternary';
55
- export { default as TextFormatter } from './formatter/text_formatter';
56
- export { default as UltimateGuitarParser } from './parser/ultimate_guitar_parser';
57
- export { default as templateHelpers } from './template_helpers';
58
- export { default as version } from './version';
59
- export { IMAGE } from './chord_sheet/tags';
60
- export { defaultPangoRenderer, pangoToHtml, stripPangoMarkup } from './pango/pango_helpers';
61
- export type { PangoRenderer } from './pango/pango_helpers';
62
- export * from './serialized_types';
63
- export { BaseMeasurer } from './layout/measurement/measurer';
64
- export { DomMeasurer } from './layout/measurement';
65
- export { CanvasMeasurer } from './layout/measurement';
66
- export { LayoutEngine } from './layout/engine/layout_engine';
67
- export { ABC, CHORUS, INDETERMINATE, LILYPOND, NONE, SVG, NUMERIC, SOLFEGE, SYMBOL, TAB, TEXTBLOCK, VERSE, PART, NUMERAL, } from './constants';
68
- declare const _default: {
69
- CHORUS: string;
70
- Chord: typeof Chord;
71
- ChordDefinition: typeof ChordDefinition;
72
- ChordLyricsPair: typeof ChordLyricsPair;
73
- ChordProFormatter: typeof ChordProFormatter;
74
- MeasuredHtmlFormatter: typeof MeasuredHtmlFormatter;
75
- ChordProParser: typeof ChordProParser;
76
- ChordSheetParser: typeof ChordSheetParser;
77
- ChordSheetSerializer: typeof ChordSheetSerializer;
78
- ChordsOverWordsFormatter: typeof ChordsOverWordsFormatter;
79
- ChordsOverWordsParser: typeof ChordsOverWordsParser;
80
- Comment: typeof Comment;
81
- Composite: typeof Composite;
82
- HtmlDivFormatter: typeof HtmlDivFormatter;
83
- HtmlTableFormatter: typeof HtmlTableFormatter;
84
- INDETERMINATE: string;
85
- Line: typeof Line;
86
- Literal: typeof Literal;
87
- Metadata: typeof Metadata;
88
- NONE: string;
89
- Paragraph: typeof Paragraph;
90
- PART: string;
91
- SoftLineBreak: typeof SoftLineBreak;
92
- Song: typeof Song;
93
- TAB: string;
94
- TEXTBLOCK: string;
95
- Tag: typeof Tag;
96
- Ternary: typeof Ternary;
97
- TextFormatter: typeof TextFormatter;
98
- UltimateGuitarParser: typeof UltimateGuitarParser;
99
- VERSE: string;
100
- BaseMeasurer: typeof BaseMeasurer;
101
- DomMeasurer: typeof DomMeasurer;
102
- CanvasMeasurer: typeof CanvasMeasurer;
103
- LayoutEngine: typeof LayoutEngine;
104
- version: string;
105
- templateHelpers: {
106
- isEvaluatable: typeof isEvaluatable;
107
- isChordLyricsPair: typeof isChordLyricsPair;
108
- lineHasContents: typeof lineHasContents;
109
- isTag: typeof isTag;
110
- isComment: typeof isComment;
111
- isImage: typeof isImage;
112
- stripHTML: typeof stripHTML;
113
- each: typeof each;
114
- when: typeof when;
115
- hasTextContents: typeof hasTextContents;
116
- lineClasses: typeof lineClasses;
117
- paragraphClasses: typeof paragraphClasses;
118
- evaluate: typeof evaluate;
119
- fontStyleTag: typeof fontStyleTag;
120
- renderChord: typeof renderChord;
121
- hasChordContents: typeof hasChordContents;
122
- pangoToHtml: typeof pangoToHtml;
123
- stripPangoMarkup: typeof stripPangoMarkup;
124
- };
125
- };
126
- export default _default;
package/lib/pdf/key.d.ts DELETED
@@ -1,124 +0,0 @@
1
- import { Accidental, AccidentalMaybe, ChordType } from './constants';
2
- interface KeyProperties {
3
- grade?: number | null;
4
- number?: number | null;
5
- type?: ChordType;
6
- minor?: boolean;
7
- accidental?: Accidental | null;
8
- referenceKeyGrade?: number | null;
9
- referenceKeyMode?: string | null;
10
- preferredAccidental?: Accidental | null;
11
- explicitAccidental?: boolean;
12
- }
13
- interface ConstructorOptions {
14
- grade?: number | null;
15
- number?: number | null;
16
- minor: boolean;
17
- type: ChordType;
18
- accidental: Accidental | null;
19
- referenceKeyGrade?: number | null;
20
- referenceKeyMode?: string | null;
21
- originalKeyString?: string | null;
22
- preferredAccidental: Accidental | null;
23
- explicitAccidental?: boolean;
24
- }
25
- /**
26
- * Represents a key, such as Eb (symbol), #3 (numeric) or VII (numeral).
27
- *
28
- * The only function considered public API is `Key.distance`
29
- */
30
- declare class Key implements KeyProperties {
31
- grade: number | null;
32
- number: number | null;
33
- accidental: Accidental | null;
34
- type: ChordType;
35
- get unicodeAccidental(): string | null;
36
- /** @deprecated Use unicodeAccidental instead */
37
- get unicodeModifier(): string | null;
38
- /** @deprecated Use accidental instead */
39
- get modifier(): Accidental | null;
40
- /** @deprecated Use preferredAccidental instead */
41
- get preferredModifier(): Accidental | null;
42
- minor: boolean;
43
- referenceKeyGrade: number | null;
44
- referenceKeyMode: string | null;
45
- originalKeyString: string | null;
46
- preferredAccidental: Accidental | null;
47
- explicitAccidental: boolean;
48
- static parse(keyString: string | null): null | Key;
49
- static parseAsType(trimmed: string, keyType: ChordType): Key | null;
50
- static resolve({ key, keyType, minor, accidental, }: {
51
- key: string | number;
52
- keyType: ChordType;
53
- minor: string | boolean;
54
- accidental: Accidental | null;
55
- }): Key | null;
56
- static getNumberFromKey(keyString: string, keyType: ChordType): number;
57
- static keyWithAccidental(key: string, accidental: Accidental | null, type: ChordType): string;
58
- /** @deprecated Use keyWithAccidental instead */
59
- static keyWithModifier(key: string, accidental: Accidental | null, type: ChordType): string;
60
- static toGrade(key: string, accidental: AccidentalMaybe, type: ChordType, isMinor: boolean): number | null;
61
- static isMinor(key: string, keyType: ChordType, minor: string | undefined | boolean): boolean;
62
- static parseOrFail(keyString: string | null): Key;
63
- static wrap(keyStringOrObject: Key | string | null): Key | null;
64
- static wrapOrFail(keyStringOrObject?: Key | string | null): Key;
65
- static toString(keyStringOrObject: Key | string): string;
66
- /**
67
- * Calculates the distance in semitones between one key and another.
68
- * @param {Key | string} oneKey the key
69
- * @param {Key | string} otherKey the other key
70
- * @return {number} the distance in semitones
71
- */
72
- static distance(oneKey: Key | string, otherKey: Key | string): number;
73
- constructor({ grade, number, minor, type, accidental, referenceKeyGrade, referenceKeyMode, originalKeyString, preferredAccidental, explicitAccidental, }: ConstructorOptions);
74
- distanceTo(otherKey: Key | string): number;
75
- get effectiveGrade(): number;
76
- isMinor(): boolean;
77
- makeMinor(): Key;
78
- get relativeMajor(): Key;
79
- get relativeMinor(): Key;
80
- toMajor(): Key;
81
- clone(): Key;
82
- private ensureGrade;
83
- private calculateGradeFromNumber;
84
- toChordSymbol(key: Key | string | null, referenceKeyWasMinor?: boolean): Key;
85
- toChordSolfege(key: Key | string | null, referenceKeyWasMinor?: boolean): Key;
86
- private convertToChordType;
87
- private handleMinorKeyConversion;
88
- toChordSymbolString(key: Key): string;
89
- toChordSolfegeString(key: Key): string;
90
- is(type: ChordType): boolean;
91
- isNumeric(): boolean;
92
- isChordSymbol(): boolean;
93
- isChordSolfege(): boolean;
94
- isNumeral(): boolean;
95
- equals(otherKey: Key): boolean;
96
- static equals(oneKey: Key | null, otherKey: Key | null): boolean;
97
- toNumeric(key?: Key | string | null): Key;
98
- toNumericString(key?: Key | null): string;
99
- toNumeral(key?: Key | string | null): Key;
100
- toNumeralString(key?: Key | null): string;
101
- toString({ showMinor, useUnicodeModifier }?: {
102
- showMinor?: boolean | undefined;
103
- useUnicodeModifier?: boolean | undefined;
104
- }): string;
105
- get note(): string;
106
- private getNoteForNumber;
107
- get minorSign(): "" | "m";
108
- private isNaturalMinor;
109
- transpose(delta: number): Key;
110
- changeGrade(delta: any): Key;
111
- transposeUp(): Key;
112
- transposeDown(): Key;
113
- canBeFlat(): boolean;
114
- canBeSharp(): boolean;
115
- setGrade(newGrade: number): Key;
116
- static shiftGrade(grade: number): number;
117
- useAccidental(newAccidental: Accidental | null): Key;
118
- /** @deprecated Use useAccidental instead */
119
- useModifier(newAccidental: Accidental | null): Key;
120
- normalize(): Key;
121
- normalizeEnharmonics(key: Key | string | null): Key;
122
- private set;
123
- }
124
- export default Key;
@@ -1,3 +0,0 @@
1
- export declare const majorKeys: Record<'symbol' | 'solfege', string[]>;
2
- export declare const minorKeys: Record<'symbol' | 'solfege', string[]>;
3
- export declare const capos: Record<'symbol' | 'solfege', Record<string, Record<string, string>>>;
@@ -1,25 +0,0 @@
1
- import { ConditionalRule } from '../../formatter/configuration';
2
- declare class Condition {
3
- rule: ConditionalRule;
4
- metadata: Record<string, any>;
5
- constructor(rule: ConditionalRule, metadata: Record<string, any>);
6
- evaluate(): boolean;
7
- private evaluateSingleCondition;
8
- private all;
9
- private and;
10
- private contains;
11
- private equals;
12
- private exists;
13
- private firstPage;
14
- private greaterThan;
15
- private greaterThanEqual;
16
- private in;
17
- private lastPage;
18
- private lessThan;
19
- private lessThanEqual;
20
- private like;
21
- private notEquals;
22
- private notIn;
23
- private or;
24
- }
25
- export default Condition;
@@ -1,33 +0,0 @@
1
- import { ColumnConfig, Margins, MeasurementBasedLayoutConfig } from '../../formatter/configuration';
2
- declare class Dimensions {
3
- pageWidth: number;
4
- pageHeight: number;
5
- layoutConfig: MeasurementBasedLayoutConfig;
6
- columns: ColumnConfig;
7
- constructor(pageWidth: number, pageHeight: number, layoutConfig: MeasurementBasedLayoutConfig, columns: ColumnConfig);
8
- get margins(): Margins;
9
- get minX(): number;
10
- get maxX(): number;
11
- get minY(): number;
12
- get maxY(): number;
13
- /**
14
- * Calculates the optimal number of columns based on available width and column constraints
15
- */
16
- calculateOptimalColumnCount(availableWidth: number, columnSpacing: number, minColumnWidth?: number, maxColumnWidth?: number): number;
17
- private findMaxColumnsWithinBounds;
18
- private evaluateColumnCount;
19
- private fitMaxColumnsWithMinWidth;
20
- private fitMaxColumns;
21
- /**
22
- * Calculates the effective column spacing, adjusting it when columns would exceed maxColumnWidth
23
- * Note: Single columns are not constrained by maxColumnWidth and use full available width
24
- * When only minColumnWidth is specified, columns expand to fill available space equally
25
- */
26
- calculateEffectiveColumnSpacing(columnCount: number, availableWidth: number, baseColumnSpacing: number, maxColumnWidth?: number, minColumnWidth?: number): number;
27
- private calculateAdjustedSpacing;
28
- get effectiveColumnCount(): number;
29
- get effectiveColumnSpacing(): number;
30
- get availableSpace(): number;
31
- get columnWidth(): number;
32
- }
33
- export default Dimensions;
@@ -1,7 +0,0 @@
1
- export { LayoutEngine } from './layout_engine';
2
- export { ItemProcessor } from './item_processor';
3
- export { LayoutFactory } from './layout_factory';
4
- export { LineBreaker } from './line_breaker';
5
- export * from './layout_helpers';
6
- export { BreakPoint, MeasuredItem, LineLayout, LayoutConfig, ParagraphLayoutResult, } from './types';
7
- export { ParagraphSplitter } from './paragraph_splitter';
@@ -1,70 +0,0 @@
1
- import ChordLyricsPair from '../../chord_sheet/chord_lyrics_pair';
2
- import Line from '../../chord_sheet/line';
3
- import { Measurer } from '../measurement';
4
- import SoftLineBreak from '../../chord_sheet/soft_line_break';
5
- import Song from '../../chord_sheet/song';
6
- import Tag from '../../chord_sheet/tag';
7
- import { LayoutConfig, MeasuredItem } from './types';
8
- /**
9
- * Processes and measures different types of items in a chord sheet
10
- */
11
- export declare class ItemProcessor {
12
- readonly measurer: Measurer;
13
- readonly config: LayoutConfig;
14
- private readonly song;
15
- constructor(measurer: Measurer, config: LayoutConfig, song: Song);
16
- /**
17
- * Measure all items in a line
18
- */
19
- measureLineItems(line: Line, lyricsOnly?: boolean): MeasuredItem[];
20
- /**
21
- * Process a chord-lyrics pair
22
- */
23
- processChordLyricsPair(pair: ChordLyricsPair, nextItemParam: any, line: Line, lyricsOnly?: boolean): MeasuredItem[];
24
- private handleLyricsOnlyMode;
25
- private cleanNextItemHyphens;
26
- private processSplitItems;
27
- private processSingleSplitItem;
28
- private measureChordLyricsPair;
29
- private getAdjustedChordsAndLyrics;
30
- private renderChordText;
31
- private calculateMeasurements;
32
- private getAdjustedChordWidth;
33
- /**
34
- * Process a soft line break
35
- */
36
- processSoftLineBreak(softLineBreak: SoftLineBreak): MeasuredItem;
37
- /**
38
- * Process a tag (comment or section delimiter)
39
- */
40
- processTag(tag: Tag): MeasuredItem[];
41
- private createMeasuredTagItem;
42
- /**
43
- * Split a measured item if it doesn't fit in the available width
44
- */
45
- splitMeasuredItem(item: MeasuredItem, availableWidth: number): [MeasuredItem, MeasuredItem | null];
46
- /**
47
- * Removes hyphens from lyrics for lyrics-only mode
48
- */
49
- removeHyphens(lyrics: string): string;
50
- /**
51
- * Split a chord-lyrics pair at natural break points (commas)
52
- */
53
- splitChordLyricsPair(pair: ChordLyricsPair, lyricsOnly?: boolean): (ChordLyricsPair | SoftLineBreak)[];
54
- /**
55
- * Find the next item with lyrics
56
- */
57
- findNextItemWithLyrics(currentLine: MeasuredItem[], items: MeasuredItem[], index: number): MeasuredItem | null;
58
- /**
59
- * Capitalize the first word of lyrics
60
- */
61
- capitalizeFirstWord(lyrics: string): string;
62
- /**
63
- * Get the width of a space character
64
- */
65
- private getSpaceWidth;
66
- /**
67
- * Get chord spacing as a string of spaces
68
- */
69
- private getChordSpacingAsSpaces;
70
- }
@@ -1,67 +0,0 @@
1
- import { Measurer } from '../measurement';
2
- import Song from '../../chord_sheet/song';
3
- import { LayoutConfig, ParagraphLayoutResult } from './types';
4
- /**
5
- * Engine for layout calculations
6
- */
7
- export declare class LayoutEngine {
8
- private song;
9
- private measurer;
10
- private config;
11
- private paragraphSplitter;
12
- private itemProcessor;
13
- private layoutFactory;
14
- private lineBreaker;
15
- private sectionCache;
16
- constructor(song: Song, measurer: Measurer, config: LayoutConfig);
17
- /**
18
- * Normalize section label by removing repeat indicators like "(2x)", "(3x)", etc.
19
- * @param label The section label to normalize
20
- * @returns The normalized label
21
- */
22
- private normalizeSectionLabel;
23
- /**
24
- * Get the cache key for a section based on its normalized label
25
- * @param paragraph The paragraph to get the cache key for
26
- * @returns The cache key or null if the paragraph doesn't have a label
27
- */
28
- private getSectionCacheKey;
29
- private extractLabelFromFirstItem;
30
- /**
31
- * Process repeated sections by modifying the song's bodyParagraphs array
32
- * This is called in the constructor to preprocess the song before layout computation
33
- */
34
- private processRepeatedSections;
35
- private processParagraph;
36
- private shouldSkipParagraphIndex;
37
- private addUncachedParagraph;
38
- private handleParagraphWithCacheKey;
39
- private cacheFirstOccurrence;
40
- private handleRepeatedSection;
41
- private handleTitleOnlyMode;
42
- private collectTitleParagraphs;
43
- private shouldIncludeTitle;
44
- private resolveTitleOnlyParagraph;
45
- private handleFullMode;
46
- private buildFullModeLines;
47
- private consolidateTitles;
48
- private addTitleSeparator;
49
- private buildTitleSeparatorItems;
50
- private createTitleOnlyParagraph;
51
- private cloneParagraph;
52
- private cloneItem;
53
- /**
54
- * Compute layouts for all paragraphs in the song
55
- */
56
- computeParagraphLayouts(): ParagraphLayoutResult[];
57
- private processParagraphLayout;
58
- private computeLineTypeCounts;
59
- private shouldSkipParagraphLayout;
60
- private adjustParagraphLayouts;
61
- private calculateNextSimulationState;
62
- private addParagraphLayout;
63
- /**
64
- * Compute layout for a single paragraph
65
- */
66
- private computeParagraphLayout;
67
- }
@@ -1,22 +0,0 @@
1
- import Line from '../../chord_sheet/line';
2
- import { LayoutConfig, LineLayout, MeasuredItem } from './types';
3
- /**
4
- * Factory for creating different types of layouts
5
- */
6
- export declare class LayoutFactory {
7
- private readonly config;
8
- constructor(config: LayoutConfig);
9
- /**
10
- * Create a line layout from measured items
11
- */
12
- createLineLayout(items: MeasuredItem[], line: Line): LineLayout;
13
- private analyzeLineContent;
14
- private determineLineType;
15
- private calculateLineHeight;
16
- private getBaseHeightAndFont;
17
- private addFontHeight;
18
- /**
19
- * Create a column break line layout
20
- */
21
- createColumnBreakLayout(): LineLayout;
22
- }