chordsheetjs 15.0.0 → 15.1.0

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 (132) hide show
  1. package/lib/bundle.js +95 -1
  2. package/lib/bundle.min.js +53 -53
  3. package/lib/index.js +24 -1
  4. package/lib/index.js.map +1 -1
  5. package/lib/main.d.ts +91 -1
  6. package/lib/main.d.ts.map +1 -1
  7. package/lib/module.js +23 -2
  8. package/lib/module.js.map +1 -1
  9. package/lib/pdf/index.js +31007 -17454
  10. package/lib/pdf/index.js.map +1 -0
  11. package/lib/pdf/main.d.ts +1696 -0
  12. package/lib/pdf/main.d.ts.map +1 -0
  13. package/lib/pdf/module.js +30966 -17386
  14. package/lib/pdf/module.js.map +1 -0
  15. package/package.json +2 -2
  16. package/lib/pdf/chord.d.ts +0 -219
  17. package/lib/pdf/chord_definition/chord_definition.d.ts +0 -66
  18. package/lib/pdf/chord_definition/chord_definition_set.d.ts +0 -12
  19. package/lib/pdf/chord_diagram/chord_diagram.d.ts +0 -131
  20. package/lib/pdf/chord_diagram/js_pdf_renderer.d.ts +0 -40
  21. package/lib/pdf/chord_diagram/renderer.d.ts +0 -43
  22. package/lib/pdf/chord_parsing_error.d.ts +0 -2
  23. package/lib/pdf/chord_sheet/ast_component.d.ts +0 -11
  24. package/lib/pdf/chord_sheet/ast_type.d.ts +0 -9
  25. package/lib/pdf/chord_sheet/chord_lyrics_pair.d.ts +0 -60
  26. package/lib/pdf/chord_sheet/chord_pro/composite.d.ts +0 -11
  27. package/lib/pdf/chord_sheet/chord_pro/evaluatable.d.ts +0 -7
  28. package/lib/pdf/chord_sheet/chord_pro/evaluation_error.d.ts +0 -7
  29. package/lib/pdf/chord_sheet/chord_pro/literal.d.ts +0 -9
  30. package/lib/pdf/chord_sheet/chord_pro/ternary.d.ts +0 -29
  31. package/lib/pdf/chord_sheet/comment.d.ts +0 -21
  32. package/lib/pdf/chord_sheet/font.d.ts +0 -47
  33. package/lib/pdf/chord_sheet/font_size.d.ts +0 -33
  34. package/lib/pdf/chord_sheet/font_stack.d.ts +0 -13
  35. package/lib/pdf/chord_sheet/item.d.ts +0 -7
  36. package/lib/pdf/chord_sheet/line.d.ts +0 -130
  37. package/lib/pdf/chord_sheet/line_expander.d.ts +0 -12
  38. package/lib/pdf/chord_sheet/metadata.d.ts +0 -71
  39. package/lib/pdf/chord_sheet/metadata_accessors.d.ts +0 -18
  40. package/lib/pdf/chord_sheet/paragraph.d.ts +0 -48
  41. package/lib/pdf/chord_sheet/soft_line_break.d.ts +0 -15
  42. package/lib/pdf/chord_sheet/song.d.ts +0 -253
  43. package/lib/pdf/chord_sheet/song_mapper.d.ts +0 -15
  44. package/lib/pdf/chord_sheet/standard_metadata_providers.d.ts +0 -5
  45. package/lib/pdf/chord_sheet/tag.d.ts +0 -104
  46. package/lib/pdf/chord_sheet/tag_interpreter.d.ts +0 -14
  47. package/lib/pdf/chord_sheet/tags.d.ts +0 -259
  48. package/lib/pdf/chord_sheet/trace_info.d.ts +0 -6
  49. package/lib/pdf/chord_sheet_serializer.d.ts +0 -49
  50. package/lib/pdf/constants.d.ts +0 -117
  51. package/lib/pdf/formatter/chord_pro_formatter.d.ts +0 -39
  52. package/lib/pdf/formatter/chord_renderer.d.ts +0 -30
  53. package/lib/pdf/formatter/chords_over_words_formatter.d.ts +0 -33
  54. package/lib/pdf/formatter/configuration/base_configuration.d.ts +0 -58
  55. package/lib/pdf/formatter/configuration/default_config_manager.d.ts +0 -31
  56. package/lib/pdf/formatter/configuration/html_configuration.d.ts +0 -37
  57. package/lib/pdf/formatter/configuration/index.d.ts +0 -13
  58. package/lib/pdf/formatter/configuration/measured_html_configuration.d.ts +0 -38
  59. package/lib/pdf/formatter/configuration/measurement_based_configuration.d.ts +0 -204
  60. package/lib/pdf/formatter/configuration/pdf_configuration.d.ts +0 -16
  61. package/lib/pdf/formatter/formatter.d.ts +0 -38
  62. package/lib/pdf/formatter/formatting_context.d.ts +0 -7
  63. package/lib/pdf/formatter/html_div_formatter.d.ts +0 -9
  64. package/lib/pdf/formatter/html_formatter.d.ts +0 -60
  65. package/lib/pdf/formatter/html_table_formatter.d.ts +0 -10
  66. package/lib/pdf/formatter/measured_html_formatter.d.ts +0 -43
  67. package/lib/pdf/formatter/measurement_based_formatter.d.ts +0 -19
  68. package/lib/pdf/formatter/pdf_formatter/doc_wrapper.d.ts +0 -53
  69. package/lib/pdf/formatter/pdf_formatter/fonts/NimbusSansLFonts.base64.d.ts +0 -4
  70. package/lib/pdf/formatter/pdf_formatter/types.d.ts +0 -34
  71. package/lib/pdf/formatter/pdf_formatter.d.ts +0 -40
  72. package/lib/pdf/formatter/templates/html_div_formatter.d.ts +0 -3
  73. package/lib/pdf/formatter/templates/html_table_formatter.d.ts +0 -3
  74. package/lib/pdf/formatter/text_formatter.d.ts +0 -35
  75. package/lib/pdf/helpers.d.ts +0 -42
  76. package/lib/pdf/index.d.ts +0 -126
  77. package/lib/pdf/key.d.ts +0 -124
  78. package/lib/pdf/key_config.d.ts +0 -3
  79. package/lib/pdf/layout/engine/condition.d.ts +0 -25
  80. package/lib/pdf/layout/engine/dimensions.d.ts +0 -33
  81. package/lib/pdf/layout/engine/index.d.ts +0 -7
  82. package/lib/pdf/layout/engine/item_processor.d.ts +0 -70
  83. package/lib/pdf/layout/engine/layout_engine.d.ts +0 -67
  84. package/lib/pdf/layout/engine/layout_factory.d.ts +0 -22
  85. package/lib/pdf/layout/engine/layout_helpers.d.ts +0 -35
  86. package/lib/pdf/layout/engine/line_breaker.d.ts +0 -54
  87. package/lib/pdf/layout/engine/paragraph_splitter/index.d.ts +0 -5
  88. package/lib/pdf/layout/engine/paragraph_splitter/paragraph_splitter.d.ts +0 -5
  89. package/lib/pdf/layout/engine/paragraph_splitter/strategies/five_or_more_lines_paragraph_split_strategy.d.ts +0 -14
  90. package/lib/pdf/layout/engine/paragraph_splitter/strategies/four_lines_paragraph_split_strategy.d.ts +0 -8
  91. package/lib/pdf/layout/engine/paragraph_splitter/strategies/three_or_less_lines_paragraph_split_strategy.d.ts +0 -4
  92. package/lib/pdf/layout/engine/title_separator_tag.d.ts +0 -8
  93. package/lib/pdf/layout/engine/types.d.ts +0 -98
  94. package/lib/pdf/layout/measurement/canvas_measurer.d.ts +0 -18
  95. package/lib/pdf/layout/measurement/dom_measurer.d.ts +0 -21
  96. package/lib/pdf/layout/measurement/index.d.ts +0 -4
  97. package/lib/pdf/layout/measurement/js_pdf_measurer.d.ts +0 -12
  98. package/lib/pdf/layout/measurement/measurer.d.ts +0 -52
  99. package/lib/pdf/normalize_mappings/enharmonic-normalize.d.ts +0 -2
  100. package/lib/pdf/normalize_mappings/suffix-normalize-mapping.d.ts +0 -2
  101. package/lib/pdf/pango/pango_helpers.d.ts +0 -6
  102. package/lib/pdf/parser/chord/peg_parser.d.ts +0 -55
  103. package/lib/pdf/parser/chord_definition/peg_parser.d.ts +0 -55
  104. package/lib/pdf/parser/chord_pro/helpers.d.ts +0 -15
  105. package/lib/pdf/parser/chord_pro/peg_parser.d.ts +0 -55
  106. package/lib/pdf/parser/chord_pro_parser.d.ts +0 -32
  107. package/lib/pdf/parser/chord_sheet_parser.d.ts +0 -57
  108. package/lib/pdf/parser/chords_over_words/helpers.d.ts +0 -33
  109. package/lib/pdf/parser/chords_over_words/peg_parser.d.ts +0 -55
  110. package/lib/pdf/parser/chords_over_words_parser.d.ts +0 -67
  111. package/lib/pdf/parser/null_tracer.d.ts +0 -4
  112. package/lib/pdf/parser/parser_helpers.d.ts +0 -3
  113. package/lib/pdf/parser/parser_warning.d.ts +0 -33
  114. package/lib/pdf/parser/ultimate_guitar_parser.d.ts +0 -46
  115. package/lib/pdf/pdf.d.ts +0 -2
  116. package/lib/pdf/rendering/html/html_doc_wrapper.d.ts +0 -82
  117. package/lib/pdf/rendering/html/html_element_styler.d.ts +0 -58
  118. package/lib/pdf/rendering/html/positioned_html_renderer.d.ts +0 -85
  119. package/lib/pdf/rendering/pdf/js_pdf_renderer.d.ts +0 -46
  120. package/lib/pdf/rendering/pdf/pdf_chord_diagram_renderer.d.ts +0 -118
  121. package/lib/pdf/rendering/renderer.d.ts +0 -273
  122. package/lib/pdf/rendering/shared/layout_section_renderer.d.ts +0 -93
  123. package/lib/pdf/scales.d.ts +0 -3
  124. package/lib/pdf/serialized_types.d.ts +0 -76
  125. package/lib/pdf/song_builder.d.ts +0 -38
  126. package/lib/pdf/template_helpers/metadata_processor.d.ts +0 -14
  127. package/lib/pdf/template_helpers/when.d.ts +0 -13
  128. package/lib/pdf/template_helpers/when_callback.d.ts +0 -2
  129. package/lib/pdf/template_helpers/when_clause.d.ts +0 -8
  130. package/lib/pdf/template_helpers.d.ts +0 -64
  131. package/lib/pdf/utilities.d.ts +0 -35
  132. package/lib/pdf/version.d.ts +0 -2
@@ -1,273 +0,0 @@
1
- import Dimensions from '../layout/engine/dimensions';
2
- import Line from '../chord_sheet/line';
3
- import Song from '../chord_sheet/song';
4
- import { LineLayout, MeasuredItem } from '../layout/engine';
5
- import { FontConfiguration, LayoutItem, MeasurementBasedFormatterConfiguration } from '../formatter/configuration';
6
- /**
7
- * Interface representing paragraph layouts from the layout engine
8
- */
9
- export interface ParagraphLayout {
10
- units: LineLayout[][];
11
- addSpacing: boolean;
12
- sectionType: string;
13
- }
14
- /**
15
- * PositionedElement represents an element with absolute positioning
16
- */
17
- export interface PositionedElement {
18
- x: number;
19
- y: number;
20
- width: number;
21
- height: number;
22
- content: any;
23
- type: string;
24
- style?: any;
25
- page: number;
26
- column: number;
27
- }
28
- /**
29
- * Abstract renderer class for absolute-positioned rendering
30
- */
31
- declare abstract class Renderer {
32
- protected song: Song;
33
- protected startTime: number;
34
- protected renderTime: number;
35
- protected x: number;
36
- protected y: number;
37
- protected currentColumn: number;
38
- protected elements: PositionedElement[];
39
- protected currentPage: number;
40
- constructor(song: Song);
41
- /**
42
- * Initialize the renderer with the song
43
- */
44
- initialize(): void;
45
- /**
46
- * Main render method - the only method that formatters should call
47
- * @param paragraphLayouts The layouts to render
48
- * @param config Additional configuration options
49
- */
50
- render(paragraphLayouts: ParagraphLayout[], _config?: any): void;
51
- /**
52
- * Get the bottom Y position available for content
53
- */
54
- getContentBottomY(): number;
55
- /**
56
- * Get metadata about the rendered document
57
- */
58
- abstract getDocumentMetadata(): Record<string, any>;
59
- /**
60
- * Get the font configuration for a specific object type
61
- */
62
- abstract getFontConfiguration(objectType: string): FontConfiguration;
63
- /**
64
- * Get the current rendering time in seconds
65
- */
66
- getRenderTime(): number;
67
- /**
68
- * Renders all paragraph layouts
69
- */
70
- protected renderParagraphs(paragraphLayouts: ParagraphLayout[]): void;
71
- /**
72
- * Render lines of content with chords, lyrics, and other elements
73
- */
74
- protected renderLines(lines: LineLayout[]): void;
75
- private renderLineLayout;
76
- protected hasColumnBreak(lineLayout: LineLayout): boolean;
77
- private renderItem;
78
- private renderChordLyricsPair;
79
- /**
80
- * Move to the next column or page
81
- */
82
- protected moveToNextColumn(): void;
83
- /**
84
- * Start a new page
85
- */
86
- protected startNewPage(): void;
87
- /**
88
- * Calculate chord and lyrics Y offsets based on the line content
89
- */
90
- protected calculateChordLyricYOffsets(items: MeasuredItem[], yOffset: number): {
91
- chordsYOffset: number;
92
- lyricsYOffset: number;
93
- };
94
- /**
95
- * Get the maximum chord height for a line
96
- */
97
- protected getMaxChordHeight(items: MeasuredItem[]): number;
98
- /**
99
- * Process chords for display (handle modifiers, normalization)
100
- */
101
- protected processChords(chords: string, line: Line): string;
102
- /**
103
- * Add a text element to the elements array
104
- */
105
- protected addTextElement(text: string, x: number, y: number, type: string): void;
106
- /**
107
- * Add a section label element
108
- */
109
- protected addSectionLabel(label: string, x: number, y: number): void;
110
- /**
111
- * Add a comment element
112
- */
113
- protected addComment(comment: string, x: number, y: number): void;
114
- /**
115
- * Get the font configuration for a specific element type
116
- */
117
- protected getFontForType(type: string): FontConfiguration;
118
- /**
119
- * Get the total number of pages in the document
120
- */
121
- protected getTotalPages(): number;
122
- /**
123
- * Get the starting X position for the current column
124
- */
125
- protected getColumnStartX(): number;
126
- /**
127
- * Get the bottom Y position for the current column
128
- */
129
- protected getColumnBottomY(): number;
130
- /**
131
- * Get the width of a column
132
- */
133
- protected getColumnWidth(): number;
134
- /**
135
- * Get the minimum X coordinate (left margin)
136
- */
137
- protected getMinX(): number;
138
- /**
139
- * Get the minimum Y coordinate (top margin + header)
140
- */
141
- protected getMinY(): number;
142
- /**
143
- * Record the rendering time
144
- */
145
- protected recordRenderingTime(): void;
146
- /**
147
- * Get the elements for a specific page
148
- */
149
- protected getElementsForPage(page: number): PositionedElement[];
150
- /**
151
- * Initialize the backend rendering system
152
- */
153
- protected abstract initializeBackend(): void;
154
- /**
155
- * Create a new page in the backend
156
- */
157
- protected abstract createNewPage(): void;
158
- /**
159
- * Render chord diagrams
160
- */
161
- protected abstract renderChordDiagrams(): void;
162
- /**
163
- * Render headers and footers
164
- */
165
- protected abstract renderHeadersAndFooters(): void;
166
- /**
167
- * Measure text with the given font
168
- */
169
- protected abstract measureText(text: string, font: FontConfiguration): {
170
- width: number;
171
- height: number;
172
- };
173
- /**
174
- * Calculate chord baseline position
175
- */
176
- protected abstract calculateChordBaseline(yOffset: number, items: MeasuredItem[], chordText: string): number;
177
- /**
178
- * Finalize the rendering process
179
- */
180
- protected abstract finalizeRendering(): void;
181
- /**
182
- * Get the renderer configuration
183
- */
184
- protected abstract getConfiguration(): MeasurementBasedFormatterConfiguration | any;
185
- /**
186
- * Get the dimensions object for layout calculations
187
- */
188
- protected abstract get dimensions(): Dimensions;
189
- /**
190
- * Get the page size from the document wrapper
191
- */
192
- protected abstract getDocPageSize(): {
193
- width: number;
194
- height: number;
195
- };
196
- /**
197
- * Get the layout configuration
198
- */
199
- protected getLayout(): MeasurementBasedFormatterConfiguration['layout'];
200
- /**
201
- * Get the header configuration
202
- */
203
- protected getHeaderConfig(): LayoutItem | undefined;
204
- /**
205
- * Get the footer configuration
206
- */
207
- protected getFooterConfig(): LayoutItem | undefined;
208
- /**
209
- * Get the page width
210
- */
211
- protected getPageWidth(): number;
212
- /**
213
- * Get the page height
214
- */
215
- protected getPageHeight(): number;
216
- /**
217
- * Get the left margin
218
- */
219
- protected getLeftMargin(): number;
220
- /**
221
- * Get the right margin
222
- */
223
- protected getRightMargin(): number;
224
- /**
225
- * Get the top margin
226
- */
227
- protected getTopMargin(): number;
228
- /**
229
- * Get the bottom margin
230
- */
231
- protected getBottomMargin(): number;
232
- /**
233
- * Get the header height
234
- */
235
- protected getHeaderHeight(): number;
236
- /**
237
- * Get the footer height
238
- */
239
- protected getFooterHeight(): number;
240
- /**
241
- * Get the column count
242
- */
243
- protected getColumnCount(): number;
244
- /**
245
- * Get the sections configuration with defaults
246
- */
247
- protected getSectionsConfig(): import("../formatter/configuration").SectionsConfig;
248
- /**
249
- * Get the column spacing
250
- */
251
- protected getColumnSpacing(): number;
252
- /**
253
- * Get the chord-to-lyrics spacing
254
- */
255
- protected getChordLyricSpacing(): number;
256
- /**
257
- * Get the paragraph spacing
258
- */
259
- protected getParagraphSpacing(): number;
260
- /**
261
- * Whether to use Unicode modifiers for chord rendering
262
- */
263
- protected useUnicodeModifiers(): boolean;
264
- /**
265
- * Whether to normalize chords
266
- */
267
- protected normalizeChords(): boolean;
268
- /**
269
- * Whether to render lyrics only (no chords)
270
- */
271
- protected isLyricsOnly(): boolean;
272
- }
273
- export default Renderer;
@@ -1,93 +0,0 @@
1
- import type { ImageCompression } from 'jspdf';
2
- import Metadata from '../../chord_sheet/metadata';
3
- import { Alignment, FontConfiguration, LayoutContentItemWithText, LayoutItem, LayoutSection, Margins } from '../../formatter/configuration';
4
- /**
5
- * Backend abstraction for layout rendering operations.
6
- * Both PDF and HTML renderers implement this interface.
7
- */
8
- export interface LayoutRenderingBackend {
9
- pageSize: {
10
- width: number;
11
- height: number;
12
- };
13
- currentPage: number;
14
- totalPages: number;
15
- text(content: string, x: number, y: number): void;
16
- getTextWidth(text: string, font?: FontConfiguration): number;
17
- splitTextToSize(text: string, maxWidth: number, font?: FontConfiguration): string[];
18
- setFontStyle(style: FontConfiguration): void;
19
- setTextItem?(item: LayoutContentItemWithText): void;
20
- addElement?(element: any, x: number, y: number): void;
21
- addImage(src: string, format: string, x: number, y: number, width: number, height: number, alias?: string, compression?: ImageCompression, rotation?: number): void;
22
- line(x1: number, y1: number, x2: number, y2: number): void;
23
- setLineStyle(style: any): void;
24
- resetDash(): void;
25
- setDrawColor?(color: number): void;
26
- setLineWidth?(width: number): void;
27
- }
28
- /**
29
- * Context for rendering layout sections (headers/footers)
30
- */
31
- export interface LayoutRenderingContext {
32
- metadata: Metadata;
33
- margins: Margins;
34
- extraMetadata: Record<string, string | string[]>;
35
- }
36
- /**
37
- * Renders layout sections (headers and footers) for both PDF and HTML backends.
38
- * This extracts the common layout rendering logic that was duplicated across renderers.
39
- */
40
- export declare class LayoutSectionRenderer {
41
- private backend;
42
- private context;
43
- constructor(backend: LayoutRenderingBackend, context: LayoutRenderingContext);
44
- /**
45
- * Renders a layout section (header or footer)
46
- */
47
- renderLayout(layoutConfig: LayoutItem, section: LayoutSection): void;
48
- /**
49
- * Determines if a content item should be rendered based on conditions
50
- */
51
- private shouldRenderContent;
52
- /**
53
- * Renders a text item
54
- */
55
- private renderTextItem;
56
- /**
57
- * Renders clipped text with optional ellipsis
58
- */
59
- private renderClippedText;
60
- /**
61
- * Clips text with ellipsis if it exceeds the maximum width
62
- */
63
- private clipTextWithEllipsis;
64
- /**
65
- * Clips text to fit within the maximum width
66
- */
67
- clipText(text: string, maxWidth: number, style?: FontConfiguration): string;
68
- /**
69
- * Renders multiline text
70
- */
71
- private renderMultilineText;
72
- /**
73
- * Renders an image
74
- */
75
- private renderImage;
76
- /**
77
- * Renders a line
78
- */
79
- private renderLine;
80
- /**
81
- * Evaluates a template with metadata
82
- */
83
- private evaluateTemplate;
84
- /**
85
- * Calculates the X position based on alignment
86
- */
87
- calculateX(alignment: Alignment | number, width?: number, offsetX?: number): number;
88
- /**
89
- * Gets the available width for content
90
- */
91
- private getAvailableWidth;
92
- }
93
- export default LayoutSectionRenderer;
@@ -1,3 +0,0 @@
1
- import { ChordType, Mode, ModifierMaybe } from './constants';
2
- export declare const KEY_TO_GRADE: Record<ChordType, Record<Mode, Record<ModifierMaybe, Record<string, number>>>>;
3
- export declare const GRADE_TO_KEY: Record<ChordType, Record<Mode, Record<ModifierMaybe, Record<number, string>>>>;
@@ -1,76 +0,0 @@
1
- import { Accidental, ChordType, Fret } from './constants';
2
- export interface SerializedTraceInfo {
3
- location?: {
4
- offset: number | null;
5
- line: number | null;
6
- column: number | null;
7
- };
8
- }
9
- export interface SerializedChord {
10
- type: 'chord';
11
- base: string;
12
- accidental: Accidental | null;
13
- suffix: string | null;
14
- bassBase: string | null;
15
- bassAccidental: Accidental | null;
16
- chordType: ChordType;
17
- optional?: boolean;
18
- }
19
- export interface SerializedChordLyricsPair {
20
- type: 'chordLyricsPair';
21
- chord?: SerializedChord | null;
22
- chords: string;
23
- lyrics: string | null;
24
- annotation?: string | null;
25
- isRhythmSymbol?: boolean;
26
- }
27
- export interface SerializedChordDefinition {
28
- name: string;
29
- baseFret: number;
30
- frets: Fret[];
31
- fingers?: number[];
32
- }
33
- export type SerializedTag = SerializedTraceInfo & {
34
- type: 'tag';
35
- name: string;
36
- value: string;
37
- chordDefinition?: SerializedChordDefinition;
38
- attributes?: Record<string, string>;
39
- selector?: string | null;
40
- isNegated?: boolean;
41
- };
42
- export interface SerializedComment {
43
- type: 'comment';
44
- comment: string;
45
- }
46
- export type ContentType = 'tab' | 'abc' | 'ly' | 'svg' | 'grid' | 'textblock';
47
- export type PartTypes = 'part' | 'intro' | 'instrumental' | 'tag' | 'end';
48
- export interface SerializedSection {
49
- type: 'section';
50
- sectionType: ContentType;
51
- content: string[];
52
- startTag: SerializedTag;
53
- endTag: SerializedTag;
54
- }
55
- export type SerializedLiteral = string;
56
- export interface SerializedTernary extends SerializedTraceInfo {
57
- type: 'ternary';
58
- variable: string | null;
59
- valueTest: string | null;
60
- trueExpression: (SerializedLiteral | SerializedTernary)[];
61
- falseExpression: (SerializedLiteral | SerializedTernary)[];
62
- }
63
- export type SerializedComposite = (SerializedLiteral | SerializedTernary)[];
64
- export interface SerializedSoftLineBreak {
65
- type: 'softLineBreak';
66
- }
67
- export type SerializedItem = SerializedChordLyricsPair | SerializedComment | SerializedLiteral | SerializedSoftLineBreak | SerializedTag | SerializedTernary;
68
- export interface SerializedLine {
69
- type: 'line';
70
- items: SerializedItem[];
71
- }
72
- export interface SerializedSong {
73
- type: 'chordSheet';
74
- lines: SerializedLine[];
75
- }
76
- export type SerializedComponent = SerializedLine | SerializedSong | SerializedChordLyricsPair | SerializedTag | SerializedComment | SerializedTernary | SerializedLiteral | SerializedSection | SerializedSoftLineBreak;
@@ -1,38 +0,0 @@
1
- import FontStack from './chord_sheet/font_stack';
2
- import Item from './chord_sheet/item';
3
- import Metadata from './chord_sheet/metadata';
4
- import ParserWarning from './parser/parser_warning';
5
- import Song from './chord_sheet/song';
6
- import Tag from './chord_sheet/tag';
7
- import TraceInfo from './chord_sheet/trace_info';
8
- import Line from './chord_sheet/line';
9
- declare class SongBuilder {
10
- currentKey: string | null;
11
- currentLine: Line | null;
12
- fontStack: FontStack;
13
- lines: Line[];
14
- metadata: Metadata;
15
- sectionType: string;
16
- selector: string | null;
17
- selectorIsNegated: boolean;
18
- song: Song;
19
- transposeKey: string | null;
20
- warnings: ParserWarning[];
21
- constructor(song: Song);
22
- get previousLine(): Line | null;
23
- addLine(line?: Line): Line;
24
- setCurrentProperties(sectionType: string, selector?: string | null, isNegated?: boolean): void;
25
- addItem(item: Item): void;
26
- chords(chr: string): void;
27
- lyrics(chr: string): void;
28
- addTag(tagContents: string | Tag): Tag;
29
- ensureLine(): void;
30
- private applyTagOnSong;
31
- private applyTagOnLine;
32
- setSectionTypeFromTag(tag: Tag): void;
33
- startSection(sectionType: string, tag: Tag): void;
34
- endSection(sectionType: string, tag: Tag): void;
35
- checkCurrentSectionType(sectionType: string, tag: Tag): void;
36
- addWarning(message: string, { line, column }: TraceInfo): void;
37
- }
38
- export default SongBuilder;
@@ -1,14 +0,0 @@
1
- import { MetadataConfiguration } from '../formatter/configuration';
2
- declare class MetadataProcessor {
3
- metadata: Record<string, string | string[]>;
4
- config: MetadataConfiguration;
5
- processedKeys: Set<string>;
6
- result: [string, string | string[]][];
7
- constructor(metadata: Record<string, string | string[]>, config: MetadataConfiguration);
8
- process(): [string, string | string[]][];
9
- private addMatchingKeys;
10
- private findMatchingKeys;
11
- private addItemByStringKey;
12
- private sortKeys;
13
- }
14
- export default MetadataProcessor;
@@ -1,13 +0,0 @@
1
- import WhenCallback from './when_callback';
2
- import WhenClause from './when_clause';
3
- declare class When {
4
- condition: boolean;
5
- clauses: WhenClause[];
6
- constructor(condition: any, thenCallback?: WhenCallback);
7
- then(thenCallback: WhenCallback): When;
8
- elseWhen(condition: any, callback?: WhenCallback): When;
9
- else(callback: WhenCallback): When;
10
- private add;
11
- toString(): string;
12
- }
13
- export default When;
@@ -1,2 +0,0 @@
1
- type WhenCallback = () => string;
2
- export default WhenCallback;
@@ -1,8 +0,0 @@
1
- import WhenCallback from './when_callback';
2
- declare class WhenClause {
3
- condition: boolean;
4
- callback: WhenCallback;
5
- constructor(condition: any, callback: WhenCallback);
6
- evaluate(otherClauses: WhenClause[]): string;
7
- }
8
- export default WhenClause;
@@ -1,64 +0,0 @@
1
- import Evaluatable from './chord_sheet/chord_pro/evaluatable';
2
- import Font from './chord_sheet/font';
3
- import Item from './chord_sheet/item';
4
- import Line from './chord_sheet/line';
5
- import Metadata from './chord_sheet/metadata';
6
- import { MetadataConfiguration } from './formatter/configuration/base_configuration';
7
- import Paragraph from './chord_sheet/paragraph';
8
- import Tag from './chord_sheet/tag';
9
- import When from './template_helpers/when';
10
- import WhenCallback from './template_helpers/when_callback';
11
- import { renderChord } from './helpers';
12
- import { hasChordContents, isEvaluatable } from './utilities';
13
- import { Configuration, HtmlTemplateCssClasses } from './formatter/configuration';
14
- type EachCallback = (_item: any) => string;
15
- export { hasChordContents, isEvaluatable } from './utilities';
16
- export { renderChord } from './helpers';
17
- import { pangoToHtml, stripPangoMarkup } from './pango/pango_helpers';
18
- export { pangoToHtml, stripPangoMarkup };
19
- export declare function isChordLyricsPair(item: Item): boolean;
20
- export declare function isRhythmSymbol(item: Item): boolean;
21
- export declare function lineHasContents(line: Line): boolean;
22
- export declare function isTag(item: Item): boolean;
23
- export declare function isLiteral(item: Item): boolean;
24
- export declare function isComment(item: Tag): boolean;
25
- export declare function isImage(item: Tag): boolean;
26
- export declare function imageTag(item: Tag): string;
27
- export declare function isColumnBreak(item: Item): boolean;
28
- export declare function isSoftLineBreak(item: Item): boolean;
29
- export declare function stripHTML(string: string): string;
30
- export declare function newlinesToBreaks(string: string): string;
31
- export declare function renderSection(paragraph: Paragraph, configuration: Configuration): string;
32
- export declare function each(collection: any[], callback: EachCallback): string;
33
- export declare function when(condition: any, callback?: WhenCallback): When;
34
- export declare function hasTextContents(line: Line): boolean;
35
- export declare function lineClasses(line: Line, cssClasses: HtmlTemplateCssClasses): string;
36
- export declare function paragraphClasses(paragraph: Paragraph, cssClasses: HtmlTemplateCssClasses): string;
37
- export declare function evaluate(item: Evaluatable, metadata: Metadata, configuration: Configuration): string;
38
- export declare function fontStyleTag(font: Font): string;
39
- export declare function processMetadata(metadata: Record<string, string | string[]>, config: MetadataConfiguration): [string, string | string[]][];
40
- declare const _default: {
41
- isLiteral: typeof isLiteral;
42
- isSoftLineBreak: typeof isSoftLineBreak;
43
- isEvaluatable: typeof isEvaluatable;
44
- isChordLyricsPair: typeof isChordLyricsPair;
45
- lineHasContents: typeof lineHasContents;
46
- isTag: typeof isTag;
47
- isComment: typeof isComment;
48
- isImage: typeof isImage;
49
- isColumnBreak: typeof isColumnBreak;
50
- stripHTML: typeof stripHTML;
51
- each: typeof each;
52
- when: typeof when;
53
- hasTextContents: typeof hasTextContents;
54
- lineClasses: typeof lineClasses;
55
- paragraphClasses: typeof paragraphClasses;
56
- evaluate: typeof evaluate;
57
- fontStyleTag: typeof fontStyleTag;
58
- renderChord: typeof renderChord;
59
- hasChordContents: typeof hasChordContents;
60
- pangoToHtml: typeof pangoToHtml;
61
- stripPangoMarkup: typeof stripPangoMarkup;
62
- processMetadata: typeof processMetadata;
63
- };
64
- export default _default;
@@ -1,35 +0,0 @@
1
- import Item from './chord_sheet/item';
2
- import Line from './chord_sheet/line';
3
- import { Accidental, AccidentalMaybe, ChordType } from './constants';
4
- export declare function callChain<T>(value: T, functions: ((_value: T) => T)[]): T;
5
- export declare function hasChordContents(line: Line): boolean;
6
- export declare function hasRemarkContents(line: Line): boolean;
7
- export declare function isEvaluatable(item: Item): boolean;
8
- export declare function padLeft(string: string, length: number): string;
9
- type ObjectWithLength = any[] | string | null;
10
- export declare function isPresent(object: ObjectWithLength): boolean;
11
- type CssObject = Record<string, Record<string, string>>;
12
- export declare function scopeCss(css: CssObject, scope?: string): string;
13
- export declare function warn(message: string): void;
14
- export declare function deprecate(message: string): void;
15
- export declare function isEmptyString(string: string | null | undefined): boolean;
16
- export declare function isMinor(key: string | number, keyType: ChordType, suffix: any): boolean;
17
- export declare function normalizeLineEndings(string: string): string;
18
- export declare function gradeToKey(options: {
19
- type: ChordType;
20
- accidental: AccidentalMaybe | null;
21
- preferredAccidental: Accidental | null;
22
- grade: number;
23
- minor: boolean;
24
- }): string;
25
- export declare function normalizeChordSuffix(suffix: string | null): string | null;
26
- declare let mergeConfigs: <T>(target: T, source: any) => T;
27
- export { mergeConfigs };
28
- /**
29
- * Utility type that creates a deep partial type
30
- * This makes all properties optional recursively through the entire object
31
- */
32
- export type DeepPartial<T> = T extends object ? {
33
- [P in keyof T]?: DeepPartial<T[P]>;
34
- } : T;
35
- export declare function filterObject<T>(object: Record<string, T>, predicate: (key: string, value: T) => boolean): Record<string, T>;
@@ -1,2 +0,0 @@
1
- declare const _default: "15.0.0";
2
- export default _default;