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,35 +0,0 @@
1
- import { LayoutConfig, LineLayout } from './types';
2
- /**
3
- * Create a column break line layout
4
- */
5
- export declare function createColumnBreakLineLayout(): LineLayout;
6
- /**
7
- * Calculate the total height of a set of line layouts
8
- */
9
- export declare function calculateTotalHeight(lineLayouts: LineLayout[][]): number;
10
- /**
11
- * Check if a line layout represents a column break
12
- */
13
- export declare function isColumnBreakLayout(lineLayout: LineLayout[]): boolean;
14
- /**
15
- * Update the position based on layout content
16
- */
17
- export declare function updatePosition(layout: LineLayout[], currentY: number, currentColumn: number, config: LayoutConfig): {
18
- newY: number;
19
- newColumn: number;
20
- };
21
- /**
22
- * Count different types of lines within layouts
23
- */
24
- export declare function countLineTypes(lineLayouts: LineLayout[][]): {
25
- chordLyricPairLines: number;
26
- commentLines: number;
27
- sectionLabelLines: number;
28
- tagLines: number;
29
- emptyLines: number;
30
- nonLyricLines: number;
31
- };
32
- /**
33
- * Determine if a paragraph should be skipped in lyrics-only mode
34
- */
35
- export declare function shouldSkipParagraph(lineLayouts: LineLayout[][], lyricsOnly?: boolean): boolean;
@@ -1,54 +0,0 @@
1
- import { ItemProcessor } from './item_processor';
2
- import { LayoutFactory } from './layout_factory';
3
- import Line from '../../chord_sheet/line';
4
- import { LineLayout } from './types';
5
- /**
6
- * Handles breaking lines into layouts based on available width
7
- */
8
- export declare class LineBreaker {
9
- private readonly itemProcessor;
10
- private readonly layoutFactory;
11
- constructor(itemProcessor: ItemProcessor, layoutFactory: LayoutFactory);
12
- /**
13
- * Break a line into layouts that fit within the available width
14
- */
15
- breakLineIntoLayouts(line: Line, availableWidth: number, lyricsOnly?: boolean): LineLayout[];
16
- /**
17
- * Recursively break content into layouts that fit within the available width
18
- */
19
- private breakContent;
20
- /**
21
- * Handle content with no soft breaks
22
- */
23
- private handleNoSoftBreaks;
24
- /**
25
- * Consolidate consecutive soft line breaks into single breaks
26
- */
27
- private consolidateConsecutiveSoftBreaks;
28
- private skipConsecutiveSoftBreaks;
29
- private findBreakIndex;
30
- private handleOversizedFirstItem;
31
- private analyzeContent;
32
- private shouldReturnSingleLayout;
33
- private splitAtBestSoftBreak;
34
- private removeTrailingComma;
35
- /**
36
- * Calculate the total width of items up to (but not including) the given index
37
- */
38
- private getWidthUpToIndex;
39
- /**
40
- * Remeasure the width of lyrics after modification
41
- */
42
- private remeasureLyrics;
43
- /**
44
- * Recalculate the full chord-lyric pair width (similar to ItemProcessor logic)
45
- */
46
- private recalculateChordLyricWidth;
47
- private measureChordAndLyricWidths;
48
- private adjustChordWidth;
49
- private shouldSkipChordSpacing;
50
- /**
51
- * Capitalize the first letter of the next item with lyrics
52
- */
53
- private capitalizeNextItem;
54
- }
@@ -1,5 +0,0 @@
1
- export { ParagraphSplitter } from './paragraph_splitter';
2
- export { ParagraphSplitStrategy } from '../types';
3
- export { ThreeOrLessLinesParagraphSplitStrategy } from './strategies/three_or_less_lines_paragraph_split_strategy';
4
- export { FourLinesParagraphSplitStrategy } from './strategies/four_lines_paragraph_split_strategy';
5
- export { FiveOrMoreLinesParagraphSplitStrategy } from './strategies/five_or_more_lines_paragraph_split_strategy';
@@ -1,5 +0,0 @@
1
- import { LineLayout } from '../types';
2
- export declare class ParagraphSplitter {
3
- splitParagraph(lineLayouts: LineLayout[][], currentY: number, columnStartY: number, columnBottomY: number, chordLyricLineCount: number): LineLayout[][];
4
- private createStrategy;
5
- }
@@ -1,14 +0,0 @@
1
- import { LineLayout, ParagraphSplitStrategy } from '../../types';
2
- export declare class FiveOrMoreLinesParagraphSplitStrategy implements ParagraphSplitStrategy {
3
- private chordLyricLineCount;
4
- private totalChordLyricPairLines;
5
- constructor(chordLyricLineCount: number);
6
- splitParagraph(lineLayouts: LineLayout[][], currentY: number, columnStartY: number, columnBottomY: number): LineLayout[][];
7
- private trySplitParagraph;
8
- private selectSplit;
9
- private buildSplitResult;
10
- private flattenLineLayouts;
11
- private findAcceptableSplits;
12
- private partitionLineLayouts;
13
- private partitionReducer;
14
- }
@@ -1,8 +0,0 @@
1
- import { LineLayout, ParagraphSplitStrategy } from '../../types';
2
- export declare class FourLinesParagraphSplitStrategy implements ParagraphSplitStrategy {
3
- splitParagraph(lineLayouts: LineLayout[][], currentY: number, columnStartY: number, columnBottomY: number): LineLayout[][];
4
- private findSplitMetadata;
5
- private summarizeLineLayout;
6
- private buildSplitResult;
7
- private prependColumnBreakIfNeeded;
8
- }
@@ -1,4 +0,0 @@
1
- import { LineLayout, ParagraphSplitStrategy } from '../../types';
2
- export declare class ThreeOrLessLinesParagraphSplitStrategy implements ParagraphSplitStrategy {
3
- splitParagraph(lineLayouts: LineLayout[][], currentY: number, columnStartY: number, columnBottomY: number): LineLayout[][];
4
- }
@@ -1,8 +0,0 @@
1
- import Tag from '../../chord_sheet/tag';
2
- declare class TitleSeparatorTag extends Tag {
3
- constructor();
4
- get value(): string;
5
- set value(newValue: string);
6
- clone(): Tag;
7
- }
8
- export default TitleSeparatorTag;
@@ -1,98 +0,0 @@
1
- import ChordLyricsPair from '../../chord_sheet/chord_lyrics_pair';
2
- import { FontConfiguration } from '../../formatter/configuration';
3
- import Line from '../../chord_sheet/line';
4
- import SoftLineBreak from '../../chord_sheet/soft_line_break';
5
- import Tag from '../../chord_sheet/tag';
6
- export interface Measurer {
7
- measureTextWidth(text: string, font: {
8
- size: number;
9
- lineHeight?: number;
10
- }): number;
11
- measureTextHeight(text: string, font: {
12
- size: number;
13
- lineHeight?: number;
14
- }): number;
15
- splitTextToSize(text: string, maxWidth: number, font: {
16
- size: number;
17
- lineHeight?: number;
18
- }): string[];
19
- }
20
- /**
21
- * Represents a break point in text for line wrapping
22
- */
23
- export interface BreakPoint {
24
- index: number;
25
- type: 'space' | 'hyphen' | 'comma' | 'other';
26
- }
27
- /**
28
- * Represents a measured chord-lyrics pair with position information
29
- */
30
- export interface MeasuredItem {
31
- item: ChordLyricsPair | Tag | SoftLineBreak | null;
32
- width: number;
33
- chordHeight?: number;
34
- chordLyricWidthDifference?: number;
35
- }
36
- /**
37
- * Represents a single line in the layout
38
- */
39
- export interface LineLayout {
40
- type: 'ChordLyricsPair' | 'Comment' | 'SectionLabel' | 'Tag' | 'Empty';
41
- lineHeight: number;
42
- items: MeasuredItem[];
43
- line: Line;
44
- }
45
- /**
46
- * Represents a paragraph in the layout
47
- */
48
- /**
49
- * Complete layout for a song
50
- */
51
- /**
52
- * Configuration for the layout engine
53
- */
54
- export interface LayoutConfig {
55
- width: number;
56
- fonts: {
57
- chord: FontConfiguration;
58
- lyrics: FontConfiguration;
59
- comment: FontConfiguration;
60
- sectionLabel: FontConfiguration;
61
- };
62
- chordSpacing: number;
63
- chordLyricSpacing: number;
64
- linePadding: number;
65
- useUnicodeModifiers: boolean;
66
- normalizeChords: boolean;
67
- minY: number;
68
- columnWidth: number;
69
- columnCount?: number;
70
- columnSpacing: number;
71
- minColumnWidth?: number;
72
- maxColumnWidth?: number;
73
- paragraphSpacing: number;
74
- columnBottomY: number;
75
- displayLyricsOnly?: boolean;
76
- decapo: boolean;
77
- repeatedSections?: 'hide' | 'title_only' | 'lyrics_only' | 'full';
78
- }
79
- export interface ParagraphLayoutResult {
80
- units: LineLayout[][];
81
- addSpacing: boolean;
82
- sectionType: string;
83
- }
84
- /**
85
- * Strategy interface for paragraph splitting
86
- */
87
- export interface ParagraphSplitStrategy {
88
- /**
89
- * Split a paragraph into parts that fit within column constraints
90
- *
91
- * @param lineLayouts - The layout of the paragraph to split
92
- * @param currentY - Current vertical position in the column
93
- * @param columnStartY - The starting Y position of columns
94
- * @param columnBottomY - The bottom Y position of columns
95
- * @returns The layout with column breaks inserted as needed
96
- */
97
- splitParagraph(lineLayouts: LineLayout[][], currentY: number, columnStartY: number, columnBottomY: number): LineLayout[][];
98
- }
@@ -1,18 +0,0 @@
1
- import { FontConfiguration } from '../../formatter/configuration';
2
- import { BaseMeasurer, TextDimensions } from './measurer';
3
- /**
4
- * Measures text using Canvas API
5
- */
6
- export declare class CanvasMeasurer extends BaseMeasurer {
7
- private canvas;
8
- private context;
9
- constructor();
10
- /**
11
- * Sets font configuration on the canvas context
12
- * @param fontConfig The font configuration to apply
13
- */
14
- private setFont;
15
- measureText(text: string, fontConfig: FontConfiguration): TextDimensions;
16
- splitTextToSize(text: string, maxWidth: number, fontConfig: FontConfiguration): string[];
17
- private measureWidth;
18
- }
@@ -1,21 +0,0 @@
1
- import { FontConfiguration } from '../../formatter/configuration';
2
- import { BaseMeasurer, TextDimensions } from './measurer';
3
- /**
4
- * Measures text using DOM elements
5
- */
6
- export declare class DomMeasurer extends BaseMeasurer {
7
- private measureElement;
8
- constructor();
9
- /**
10
- * Cleans up the DOM element when no longer needed
11
- */
12
- dispose(): void;
13
- /**
14
- * Sets font configuration on the measurement element
15
- * @param fontConfig The font configuration to apply
16
- */
17
- private setFont;
18
- measureText(text: string, fontConfig: FontConfiguration): TextDimensions;
19
- splitTextToSize(text: string, maxWidth: number, fontConfig: FontConfiguration): string[];
20
- private measureWidth;
21
- }
@@ -1,4 +0,0 @@
1
- export * from './measurer';
2
- export * from './js_pdf_measurer';
3
- export * from './canvas_measurer';
4
- export * from './dom_measurer';
@@ -1,12 +0,0 @@
1
- import DocWrapper from '../../formatter/pdf_formatter/doc_wrapper';
2
- import { FontConfiguration } from '../../formatter/configuration';
3
- import { BaseMeasurer, TextDimensions } from './measurer';
4
- /**
5
- * Measures text using jsPDF
6
- */
7
- export declare class JsPdfMeasurer extends BaseMeasurer {
8
- private doc;
9
- constructor(doc: DocWrapper);
10
- measureText(text: string, fontConfig: FontConfiguration): TextDimensions;
11
- splitTextToSize(text: string, maxWidth: number, fontConfig: FontConfiguration): string[];
12
- }
@@ -1,52 +0,0 @@
1
- import { FontConfiguration } from '../../formatter/configuration';
2
- export interface TextDimensions {
3
- width: number;
4
- height: number;
5
- }
6
- export interface Measurer {
7
- /**
8
- * Measures the dimensions of text with the given font configuration
9
- * @param text The text to measure
10
- * @param fontConfig The font configuration to apply
11
- * @returns The dimensions of the text
12
- */
13
- measureText(text: string, fontConfig: FontConfiguration): TextDimensions;
14
- /**
15
- * Measures the width of text with the given font configuration
16
- * @param text The text to measure
17
- * @param fontConfig The font configuration to apply
18
- * @returns The width of the text
19
- */
20
- measureTextWidth(text: string, fontConfig: FontConfiguration): number;
21
- /**
22
- * Measures the height of text with the given font configuration
23
- * @param text The text to measure
24
- * @param fontConfig The font configuration to apply
25
- * @returns The height of the text
26
- */
27
- measureTextHeight(text: string, fontConfig: FontConfiguration): number;
28
- /**
29
- * Splits text into lines that fit within the given width
30
- * @param text The text to split
31
- * @param maxWidth The maximum width of each line
32
- * @param fontConfig The font configuration to apply
33
- * @returns The lines of text
34
- */
35
- splitTextToSize(text: string, maxWidth: number, fontConfig: FontConfiguration): string[];
36
- }
37
- /**
38
- * Base class for implementing measurers with common functionality
39
- */
40
- export declare abstract class BaseMeasurer implements Measurer {
41
- abstract measureText(text: string, fontConfig: FontConfiguration): TextDimensions;
42
- measureTextWidth(text: string, fontConfig: FontConfiguration): number;
43
- measureTextHeight(text: string, fontConfig: FontConfiguration): number;
44
- abstract splitTextToSize(text: string, maxWidth: number, fontConfig: FontConfiguration): string[];
45
- protected splitTextWithMeasure(text: string, maxWidth: number, measure: (value: string) => number): string[];
46
- protected wrapParagraph(paragraph: string, maxWidth: number, measure: (value: string) => number): string[];
47
- protected splitWord(word: string, maxWidth: number, measure: (value: string) => number): {
48
- lines: string[];
49
- remainder: string;
50
- };
51
- private accumulateWords;
52
- }
@@ -1,2 +0,0 @@
1
- declare const enharmonics: Record<string, Record<string, string>>;
2
- export default enharmonics;
@@ -1,2 +0,0 @@
1
- declare const mapping: Record<string, string>;
2
- export default mapping;
@@ -1,6 +0,0 @@
1
- export declare function stripPangoMarkup(text: string): string;
2
- export interface PangoRenderer {
3
- convert(text: string): string;
4
- }
5
- export declare function pangoToHtml(text: string): string;
6
- export declare const defaultPangoRenderer: PangoRenderer;
@@ -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,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,15 +0,0 @@
1
- import { SerializedChordLyricsPair, SerializedItem, SerializedLine, SerializedSoftLineBreak, SerializedTag } from '../../serialized_types';
2
- import { FileRange } from './peg_parser';
3
- export declare function buildLine(items: any[]): SerializedLine;
4
- export declare function buildSection(startTag: SerializedTag, endTag: SerializedTag, content: string): SerializedLine[];
5
- export declare function buildTag(name: string, value: Partial<{
6
- value: string | null;
7
- attributes: Record<string, string>;
8
- }> | null, selector: {
9
- value: string | null;
10
- isNegated: boolean;
11
- } | null, location: FileRange): SerializedTag;
12
- export declare function stringSplitReplace(string: string, search: string, replaceMatch: (subString: string) => any, replaceRest?: (subString: string) => any): any[];
13
- export declare function applySoftLineBreaks(lyrics: string): SerializedChordLyricsPair[];
14
- export declare function breakChordLyricsPairOnSoftLineBreak(chords: string, lyrics: string): (SerializedChordLyricsPair | SerializedSoftLineBreak)[];
15
- export declare function combineChordLyricsPairs(items: SerializedItem[], chopFirstWord?: boolean): SerializedItem[];
@@ -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,32 +0,0 @@
1
- import ParserWarning from './parser_warning';
2
- import Song from '../chord_sheet/song';
3
- import { ParseOptions } from './chord_pro/peg_parser';
4
- export type ChordProParserOptions = ParseOptions & {
5
- softLineBreaks?: boolean;
6
- chopFirstWord?: boolean;
7
- };
8
- /**
9
- * Parses a ChordPro chord sheet
10
- */
11
- declare class ChordProParser {
12
- song?: Song;
13
- /**
14
- * All warnings raised during parsing the chord sheet
15
- * @member
16
- * @type {ParserWarning[]}
17
- */
18
- get warnings(): ParserWarning[];
19
- /**
20
- * Parses a ChordPro chord sheet into a song
21
- * @param {string} chordSheet the ChordPro chord sheet
22
- * @param {ChordProParserOptions} options Parser options.
23
- * @param {ChordProParserOptions.softLineBreaks} options.softLineBreaks=false If true, a backslash
24
- * followed by * a space is treated as a soft line break
25
- * @param {ChordProParserOptions.chopFirstWord} options.chopFirstWord=true If true, only the first lyric
26
- * word is paired with the chord, the rest of the lyric is put in a separate chord lyric pair
27
- * @see https://peggyjs.org/documentation.html#using-the-parser
28
- * @returns {Song} The parsed song
29
- */
30
- parse(chordSheet: string, options?: ChordProParserOptions): Song;
31
- }
32
- export default ChordProParser;
@@ -1,57 +0,0 @@
1
- import ChordLyricsPair from '../chord_sheet/chord_lyrics_pair';
2
- import Line from '../chord_sheet/line';
3
- import Song from '../chord_sheet/song';
4
- import SongBuilder from '../song_builder';
5
- /**
6
- * Parses a normal chord sheet
7
- *
8
- * ChordSheetParser is deprecated, please use ChordsOverWordsParser.
9
- *
10
- * ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
11
- * support for many variations. Besides that, some chordpro feature have been ported back
12
- * to ChordsOverWordsParser, which adds some interesting functionality.
13
- */
14
- declare class ChordSheetParser {
15
- processingText: boolean;
16
- preserveWhitespace: boolean;
17
- song: Song;
18
- songBuilder: SongBuilder;
19
- songLine: Line | null;
20
- chordLyricsPair: ChordLyricsPair | null;
21
- lines: string[];
22
- currentLine: number;
23
- lineCount: number;
24
- /**
25
- * Instantiate a chord sheet parser
26
- * ChordSheetParser is deprecated, please use ChordsOverWordsParser.
27
- * @param {Object} [options={}] options
28
- * @param {boolean} [options.preserveWhitespace=true] whether to preserve trailing whitespace for chords
29
- * @deprecated
30
- */
31
- constructor({ preserveWhitespace }?: {
32
- preserveWhitespace?: boolean;
33
- }, showDeprecationWarning?: boolean);
34
- /**
35
- * Parses a chord sheet into a song
36
- * @param {string} chordSheet The ChordPro chord sheet
37
- * @param {Object} [options={}] Optional parser options
38
- * @param {Song} [options.song=null] The {@link Song} to store the song data in
39
- * @returns {Song} The parsed song
40
- */
41
- parse(chordSheet: string, { song }?: {
42
- song?: Song;
43
- }): Song;
44
- endOfSong(): void;
45
- parseLine(line: any): void;
46
- parseNonEmptyLine(line: any): void;
47
- initialize(document: any, song?: Song | null): void;
48
- readLine(): string;
49
- hasNextLine(): boolean;
50
- parseLyricsWithChords(chordsLine: any, lyricsLine: any): void;
51
- processCharacters(chordsLine: any, lyricsLine: any): number;
52
- mapLyricsCharacter(columnMap: number[], column: number, lyricsLine: string, lastIndex: number): number;
53
- addCharacter(chr: any, nextChar: any): void;
54
- shouldAddCharacterToChords(nextChar: any): any;
55
- ensureChordLyricsPairInitialized(): void;
56
- }
57
- export default ChordSheetParser;