chordsheetjs 14.6.1 → 15.0.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.
- package/README.md +12 -3
- package/lib/bundle.js +25728 -66671
- package/lib/bundle.min.js +148 -7118
- package/lib/index.js +1 -7770
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +2 -131
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +2 -7769
- package/lib/module.js.map +1 -1
- package/lib/pdf/chord.d.ts +219 -0
- package/lib/pdf/chord_definition/chord_definition.d.ts +66 -0
- package/lib/pdf/chord_definition/chord_definition_set.d.ts +12 -0
- package/lib/pdf/chord_diagram/chord_diagram.d.ts +131 -0
- package/lib/pdf/chord_diagram/js_pdf_renderer.d.ts +40 -0
- package/lib/pdf/chord_diagram/renderer.d.ts +43 -0
- package/lib/pdf/chord_parsing_error.d.ts +2 -0
- package/lib/pdf/chord_sheet/ast_component.d.ts +11 -0
- package/lib/pdf/chord_sheet/ast_type.d.ts +9 -0
- package/lib/pdf/chord_sheet/chord_lyrics_pair.d.ts +60 -0
- package/lib/pdf/chord_sheet/chord_pro/composite.d.ts +11 -0
- package/lib/pdf/chord_sheet/chord_pro/evaluatable.d.ts +7 -0
- package/lib/pdf/chord_sheet/chord_pro/evaluation_error.d.ts +7 -0
- package/lib/pdf/chord_sheet/chord_pro/literal.d.ts +9 -0
- package/lib/pdf/chord_sheet/chord_pro/ternary.d.ts +29 -0
- package/lib/pdf/chord_sheet/comment.d.ts +21 -0
- package/lib/pdf/chord_sheet/font.d.ts +47 -0
- package/lib/pdf/chord_sheet/font_size.d.ts +33 -0
- package/lib/pdf/chord_sheet/font_stack.d.ts +13 -0
- package/lib/pdf/chord_sheet/item.d.ts +7 -0
- package/lib/pdf/chord_sheet/line.d.ts +130 -0
- package/lib/pdf/chord_sheet/line_expander.d.ts +12 -0
- package/lib/pdf/chord_sheet/metadata.d.ts +71 -0
- package/lib/pdf/chord_sheet/metadata_accessors.d.ts +18 -0
- package/lib/pdf/chord_sheet/paragraph.d.ts +48 -0
- package/lib/pdf/chord_sheet/soft_line_break.d.ts +15 -0
- package/lib/pdf/chord_sheet/song.d.ts +253 -0
- package/lib/pdf/chord_sheet/song_mapper.d.ts +15 -0
- package/lib/pdf/chord_sheet/standard_metadata_providers.d.ts +5 -0
- package/lib/pdf/chord_sheet/tag.d.ts +104 -0
- package/lib/pdf/chord_sheet/tag_interpreter.d.ts +14 -0
- package/lib/pdf/chord_sheet/tags.d.ts +259 -0
- package/lib/pdf/chord_sheet/trace_info.d.ts +6 -0
- package/lib/pdf/chord_sheet_serializer.d.ts +49 -0
- package/lib/pdf/constants.d.ts +117 -0
- package/lib/pdf/formatter/chord_pro_formatter.d.ts +39 -0
- package/lib/pdf/formatter/chord_renderer.d.ts +30 -0
- package/lib/pdf/formatter/chords_over_words_formatter.d.ts +33 -0
- package/lib/pdf/formatter/configuration/base_configuration.d.ts +58 -0
- package/lib/pdf/formatter/configuration/default_config_manager.d.ts +31 -0
- package/lib/pdf/formatter/configuration/html_configuration.d.ts +37 -0
- package/lib/pdf/formatter/configuration/index.d.ts +13 -0
- package/lib/pdf/formatter/configuration/measured_html_configuration.d.ts +38 -0
- package/lib/pdf/formatter/configuration/measurement_based_configuration.d.ts +204 -0
- package/lib/pdf/formatter/configuration/pdf_configuration.d.ts +16 -0
- package/lib/pdf/formatter/formatter.d.ts +38 -0
- package/lib/pdf/formatter/formatting_context.d.ts +7 -0
- package/lib/pdf/formatter/html_div_formatter.d.ts +9 -0
- package/lib/pdf/formatter/html_formatter.d.ts +60 -0
- package/lib/pdf/formatter/html_table_formatter.d.ts +10 -0
- package/lib/pdf/formatter/measured_html_formatter.d.ts +43 -0
- package/lib/pdf/formatter/measurement_based_formatter.d.ts +19 -0
- package/lib/pdf/formatter/pdf_formatter/doc_wrapper.d.ts +53 -0
- package/lib/pdf/formatter/pdf_formatter/fonts/NimbusSansLFonts.base64.d.ts +4 -0
- package/lib/pdf/formatter/pdf_formatter/types.d.ts +34 -0
- package/lib/pdf/formatter/pdf_formatter.d.ts +40 -0
- package/lib/pdf/formatter/templates/html_div_formatter.d.ts +3 -0
- package/lib/pdf/formatter/templates/html_table_formatter.d.ts +3 -0
- package/lib/pdf/formatter/text_formatter.d.ts +35 -0
- package/lib/pdf/helpers.d.ts +42 -0
- package/lib/pdf/index.d.ts +126 -0
- package/lib/pdf/index.js +24369 -0
- package/lib/pdf/key.d.ts +124 -0
- package/lib/pdf/key_config.d.ts +3 -0
- package/lib/pdf/layout/engine/condition.d.ts +25 -0
- package/lib/pdf/layout/engine/dimensions.d.ts +33 -0
- package/lib/pdf/layout/engine/index.d.ts +7 -0
- package/lib/pdf/layout/engine/item_processor.d.ts +70 -0
- package/lib/pdf/layout/engine/layout_engine.d.ts +67 -0
- package/lib/pdf/layout/engine/layout_factory.d.ts +22 -0
- package/lib/pdf/layout/engine/layout_helpers.d.ts +35 -0
- package/lib/pdf/layout/engine/line_breaker.d.ts +54 -0
- package/lib/pdf/layout/engine/paragraph_splitter/index.d.ts +5 -0
- package/lib/pdf/layout/engine/paragraph_splitter/paragraph_splitter.d.ts +5 -0
- package/lib/pdf/layout/engine/paragraph_splitter/strategies/five_or_more_lines_paragraph_split_strategy.d.ts +14 -0
- package/lib/pdf/layout/engine/paragraph_splitter/strategies/four_lines_paragraph_split_strategy.d.ts +8 -0
- package/lib/pdf/layout/engine/paragraph_splitter/strategies/three_or_less_lines_paragraph_split_strategy.d.ts +4 -0
- package/lib/pdf/layout/engine/title_separator_tag.d.ts +8 -0
- package/lib/pdf/layout/engine/types.d.ts +98 -0
- package/lib/pdf/layout/measurement/canvas_measurer.d.ts +18 -0
- package/lib/pdf/layout/measurement/dom_measurer.d.ts +21 -0
- package/lib/pdf/layout/measurement/index.d.ts +4 -0
- package/lib/pdf/layout/measurement/js_pdf_measurer.d.ts +12 -0
- package/lib/pdf/layout/measurement/measurer.d.ts +52 -0
- package/lib/pdf/module.js +24336 -0
- package/lib/pdf/normalize_mappings/enharmonic-normalize.d.ts +2 -0
- package/lib/pdf/normalize_mappings/suffix-normalize-mapping.d.ts +2 -0
- package/lib/pdf/pango/pango_helpers.d.ts +6 -0
- package/lib/pdf/parser/chord/peg_parser.d.ts +55 -0
- package/lib/pdf/parser/chord_definition/peg_parser.d.ts +55 -0
- package/lib/pdf/parser/chord_pro/helpers.d.ts +15 -0
- package/lib/pdf/parser/chord_pro/peg_parser.d.ts +55 -0
- package/lib/pdf/parser/chord_pro_parser.d.ts +32 -0
- package/lib/pdf/parser/chord_sheet_parser.d.ts +57 -0
- package/lib/pdf/parser/chords_over_words/helpers.d.ts +33 -0
- package/lib/pdf/parser/chords_over_words/peg_parser.d.ts +55 -0
- package/lib/pdf/parser/chords_over_words_parser.d.ts +67 -0
- package/lib/pdf/parser/null_tracer.d.ts +4 -0
- package/lib/pdf/parser/parser_helpers.d.ts +3 -0
- package/lib/pdf/parser/parser_warning.d.ts +33 -0
- package/lib/pdf/parser/ultimate_guitar_parser.d.ts +46 -0
- package/lib/pdf/pdf.d.ts +2 -0
- package/lib/pdf/rendering/html/html_doc_wrapper.d.ts +82 -0
- package/lib/pdf/rendering/html/html_element_styler.d.ts +58 -0
- package/lib/pdf/rendering/html/positioned_html_renderer.d.ts +85 -0
- package/lib/pdf/rendering/pdf/js_pdf_renderer.d.ts +46 -0
- package/lib/pdf/rendering/pdf/pdf_chord_diagram_renderer.d.ts +118 -0
- package/lib/pdf/rendering/renderer.d.ts +273 -0
- package/lib/pdf/rendering/shared/layout_section_renderer.d.ts +93 -0
- package/lib/pdf/scales.d.ts +3 -0
- package/lib/pdf/serialized_types.d.ts +76 -0
- package/lib/pdf/song_builder.d.ts +38 -0
- package/lib/pdf/template_helpers/metadata_processor.d.ts +14 -0
- package/lib/pdf/template_helpers/when.d.ts +13 -0
- package/lib/pdf/template_helpers/when_callback.d.ts +2 -0
- package/lib/pdf/template_helpers/when_clause.d.ts +8 -0
- package/lib/pdf/template_helpers.d.ts +64 -0
- package/lib/pdf/utilities.d.ts +35 -0
- package/lib/pdf/version.d.ts +2 -0
- package/package.json +20 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Item from './item';
|
|
2
|
+
import Song from './song';
|
|
3
|
+
export type MapItemsCallback = (_item: Item) => Item | Item[] | null;
|
|
4
|
+
declare class SongMapper {
|
|
5
|
+
private song;
|
|
6
|
+
private clonedSong;
|
|
7
|
+
private builder;
|
|
8
|
+
private addedLine;
|
|
9
|
+
constructor(song: Song);
|
|
10
|
+
mapItems(func: MapItemsCallback): Song;
|
|
11
|
+
private mapLineItems;
|
|
12
|
+
private mapItem;
|
|
13
|
+
ensureLine(): void;
|
|
14
|
+
}
|
|
15
|
+
export default SongMapper;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Configuration from '../formatter/configuration';
|
|
2
|
+
type Provider = () => string | null;
|
|
3
|
+
export declare function staticProviders(): Map<string, Provider>;
|
|
4
|
+
export declare function configurationProviders(configuration: Configuration): Map<string, Provider>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import AstComponent from './ast_component';
|
|
2
|
+
import ChordDefinition from '../chord_definition/chord_definition';
|
|
3
|
+
import TraceInfo from './trace_info';
|
|
4
|
+
export declare const META_TAGS: string[];
|
|
5
|
+
export declare const READ_ONLY_TAGS: string[];
|
|
6
|
+
export declare function isReadonlyTag(tagName: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/
|
|
9
|
+
*/
|
|
10
|
+
declare class Tag extends AstComponent {
|
|
11
|
+
_isMetaTag: boolean;
|
|
12
|
+
_originalName: string;
|
|
13
|
+
_name: string;
|
|
14
|
+
_value: string;
|
|
15
|
+
chordDefinition?: ChordDefinition;
|
|
16
|
+
selector: string | null;
|
|
17
|
+
isNegated: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The tag attributes. For example, section related tags can have a label:
|
|
20
|
+
* `{start_of_verse: label="Verse 1"}`
|
|
21
|
+
* @type {Record<string, string>}
|
|
22
|
+
*/
|
|
23
|
+
attributes: Record<string, string>;
|
|
24
|
+
constructor(name: string, value?: string | null, traceInfo?: TraceInfo | null, attributes?: Record<string, string>, selector?: string | null, isNegated?: boolean);
|
|
25
|
+
private parseNameValue;
|
|
26
|
+
private parseMetaTag;
|
|
27
|
+
static parse(tag: string | Tag): Tag | null;
|
|
28
|
+
static parseWithRegex(tag: string, regex: RegExp): Tag | null;
|
|
29
|
+
static parseOrFail(tag: string | Tag): Tag;
|
|
30
|
+
get label(): string;
|
|
31
|
+
isSectionDelimiter(): boolean;
|
|
32
|
+
isSectionStart(): boolean;
|
|
33
|
+
isSectionEnd(): boolean;
|
|
34
|
+
isInlineFontTag(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Checks whether the tag is a comment tag ({comment} or {c}).
|
|
37
|
+
*/
|
|
38
|
+
isComment(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Checks whether the tag is an image tag ({image}).
|
|
41
|
+
*/
|
|
42
|
+
isImage(): boolean;
|
|
43
|
+
set name(name: string);
|
|
44
|
+
/**
|
|
45
|
+
* The tag full name. When the original tag used the short name, `name` will return the full name.
|
|
46
|
+
* @member
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
49
|
+
get name(): string;
|
|
50
|
+
/**
|
|
51
|
+
* The original tag name that was used to construct the tag.
|
|
52
|
+
* @member
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
get originalName(): string;
|
|
56
|
+
set value(value: string);
|
|
57
|
+
/**
|
|
58
|
+
* The tag value
|
|
59
|
+
* @member
|
|
60
|
+
* @type {string}
|
|
61
|
+
*/
|
|
62
|
+
get value(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Checks whether the tag value is a non-empty string.
|
|
65
|
+
* @returns {boolean}
|
|
66
|
+
*/
|
|
67
|
+
hasValue(): boolean;
|
|
68
|
+
hasAttributes(): boolean;
|
|
69
|
+
hasLabel(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Checks whether the tag is usually rendered inline. It currently only applies to comment tags.
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
isRenderable(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Check whether this tag's label (if any) should be rendered, as applicable to tags like
|
|
77
|
+
* `start_of_verse` and `start_of_chorus`.
|
|
78
|
+
* See https://chordpro.org/chordpro/directives-env_chorus/, https://chordpro.org/chordpro/directives-env_verse/,
|
|
79
|
+
* https://chordpro.org/chordpro/directives-env_bridge/, https://chordpro.org/chordpro/directives-env_tab/
|
|
80
|
+
*/
|
|
81
|
+
hasRenderableLabel(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Checks whether the tag is a standard meta tag, a custom meta directive (`{x_some_name}`)
|
|
84
|
+
* or a non-standard meta tag (`{meta: name value}`)
|
|
85
|
+
* @returns {boolean}
|
|
86
|
+
*/
|
|
87
|
+
isMetaTag(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Checks whether this tag is a standard meta tag or a custom meta directive (`{x_some_name}`)
|
|
90
|
+
* @returns {boolean}
|
|
91
|
+
*/
|
|
92
|
+
isStandardOrCustomMetaTag(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Returns a clone of the tag.
|
|
95
|
+
* @returns {Tag} The cloned tag
|
|
96
|
+
*/
|
|
97
|
+
clone(): Tag;
|
|
98
|
+
toString(): string;
|
|
99
|
+
set({ value }: {
|
|
100
|
+
value: string;
|
|
101
|
+
}): Tag;
|
|
102
|
+
setAttribute(name: string, value: string): Tag;
|
|
103
|
+
}
|
|
104
|
+
export default Tag;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class TagInterpreter {
|
|
2
|
+
tagName: string;
|
|
3
|
+
tagValue: string;
|
|
4
|
+
static interpret(tagName: string, tagValue: string): [string | null, string | null];
|
|
5
|
+
constructor(tagName: string, tagValue: string);
|
|
6
|
+
interpret(): [string | null, string | null];
|
|
7
|
+
startOfPart(): [string, string] | null;
|
|
8
|
+
endOfPart(): [string, string] | null;
|
|
9
|
+
sectionStart(): [string, string] | null;
|
|
10
|
+
sectionEnd(): [string, string] | null;
|
|
11
|
+
startOfSection(): [string, string] | null;
|
|
12
|
+
endOfSection(): [string, string] | null;
|
|
13
|
+
}
|
|
14
|
+
export default TagInterpreter;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Album meta directive. See https://www.chordpro.org/chordpro/directives-album/
|
|
3
|
+
* @type {string}
|
|
4
|
+
*/
|
|
5
|
+
export declare const ALBUM = "album";
|
|
6
|
+
/**
|
|
7
|
+
* Arranger meta directive. See https://chordpro.org/chordpro/directives-arranger/
|
|
8
|
+
* @type {string}
|
|
9
|
+
*/
|
|
10
|
+
export declare const ARRANGER = "arranger";
|
|
11
|
+
/**
|
|
12
|
+
* Artist meta directive. See https://www.chordpro.org/chordpro/directives-artist/
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
export declare const ARTIST = "artist";
|
|
16
|
+
/**
|
|
17
|
+
* Capo meta directive. See https://www.chordpro.org/chordpro/directives-capo/
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
export declare const CAPO = "capo";
|
|
21
|
+
/**
|
|
22
|
+
* Comment directive. See https://www.chordpro.org/chordpro/directives-comment/
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
export declare const COMMENT = "comment";
|
|
26
|
+
/**
|
|
27
|
+
* Composer meta directive. See https://www.chordpro.org/chordpro/directives-composer/
|
|
28
|
+
* @type {string}
|
|
29
|
+
*/
|
|
30
|
+
export declare const COMPOSER = "composer";
|
|
31
|
+
/**
|
|
32
|
+
* Copyright meta directive. See https://www.chordpro.org/chordpro/directives-copyright/
|
|
33
|
+
* @type {string}
|
|
34
|
+
*/
|
|
35
|
+
export declare const COPYRIGHT = "copyright";
|
|
36
|
+
/**
|
|
37
|
+
* Duration meta directive. See https://www.chordpro.org/chordpro/directives-duration/
|
|
38
|
+
* @type {string}
|
|
39
|
+
*/
|
|
40
|
+
export declare const DURATION = "duration";
|
|
41
|
+
/**
|
|
42
|
+
* Image directive. See https://www.chordpro.org/chordpro/directives-image/
|
|
43
|
+
* @type {string}
|
|
44
|
+
*/
|
|
45
|
+
export declare const IMAGE = "image";
|
|
46
|
+
/**
|
|
47
|
+
* End of ABC music notation section See https://chordpro.org/chordpro/directives-env_abc/
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
export declare const END_OF_ABC = "end_of_abc";
|
|
51
|
+
/**
|
|
52
|
+
* End of bridge directive. See https://chordpro.org/chordpro/directives-env_bridge/
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
export declare const END_OF_BRIDGE = "end_of_bridge";
|
|
56
|
+
/**
|
|
57
|
+
* End of chorus directive. See https://www.chordpro.org/chordpro/directives-env_chorus/
|
|
58
|
+
* @type {string}
|
|
59
|
+
*/
|
|
60
|
+
export declare const END_OF_CHORUS = "end_of_chorus";
|
|
61
|
+
/**
|
|
62
|
+
* End of grid directive. See https://www.chordpro.org/chordpro/directives-env_grid/
|
|
63
|
+
* @type {string}
|
|
64
|
+
*/
|
|
65
|
+
export declare const END_OF_GRID = "end_of_grid";
|
|
66
|
+
/**
|
|
67
|
+
* End of Lilypond music notation section See https://chordpro.org/chordpro/directives-env_ly/
|
|
68
|
+
* @type {string}
|
|
69
|
+
*/
|
|
70
|
+
export declare const END_OF_LY = "end_of_ly";
|
|
71
|
+
/**
|
|
72
|
+
* End of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/
|
|
73
|
+
* @type {string}
|
|
74
|
+
*/
|
|
75
|
+
export declare const END_OF_TAB = "end_of_tab";
|
|
76
|
+
/**
|
|
77
|
+
* End of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/
|
|
78
|
+
* @type {string}
|
|
79
|
+
*/
|
|
80
|
+
export declare const END_OF_VERSE = "end_of_verse";
|
|
81
|
+
/**
|
|
82
|
+
* End of part directive.
|
|
83
|
+
* @type {string}
|
|
84
|
+
*/
|
|
85
|
+
export declare const END_OF_PART = "end_of_part";
|
|
86
|
+
/**
|
|
87
|
+
* Key meta directive. See https://www.chordpro.org/chordpro/directives-key/
|
|
88
|
+
* @type {string}
|
|
89
|
+
*/
|
|
90
|
+
export declare const KEY = "key";
|
|
91
|
+
/**
|
|
92
|
+
* _Key meta directive. Reflects the key as transposed by the capo value
|
|
93
|
+
* See https://www.chordpro.org/chordpro/directives-key/
|
|
94
|
+
* @type {string}
|
|
95
|
+
*/
|
|
96
|
+
export declare const _KEY = "_key";
|
|
97
|
+
/**
|
|
98
|
+
* Lyricist meta directive. See https://www.chordpro.org/chordpro/directives-lyricist/
|
|
99
|
+
* @type {string}
|
|
100
|
+
*/
|
|
101
|
+
export declare const LYRICIST = "lyricist";
|
|
102
|
+
/**
|
|
103
|
+
* Sorttitle meta directive. See https://chordpro.org/chordpro/directives-sorttitle/
|
|
104
|
+
* @type {string}
|
|
105
|
+
*/
|
|
106
|
+
export declare const SORTTITLE = "sorttitle";
|
|
107
|
+
/**
|
|
108
|
+
* Start of ABC music notation section See https://chordpro.org/chordpro/directives-env_abc/
|
|
109
|
+
* @type {string}
|
|
110
|
+
*/
|
|
111
|
+
export declare const START_OF_ABC = "start_of_abc";
|
|
112
|
+
/**
|
|
113
|
+
* Start of bridge directive. See https://chordpro.org/chordpro/directives-env_bridge/
|
|
114
|
+
* @type {string}
|
|
115
|
+
*/
|
|
116
|
+
export declare const START_OF_BRIDGE = "start_of_bridge";
|
|
117
|
+
/**
|
|
118
|
+
* Start of chorus directive. See https://www.chordpro.org/chordpro/directives-env_chorus/
|
|
119
|
+
* @type {string}
|
|
120
|
+
*/
|
|
121
|
+
export declare const START_OF_CHORUS = "start_of_chorus";
|
|
122
|
+
/**
|
|
123
|
+
* Start of grid directive. See https://www.chordpro.org/chordpro/directives-env_grid/
|
|
124
|
+
* @type {string}
|
|
125
|
+
*/
|
|
126
|
+
export declare const START_OF_GRID = "start_of_grid";
|
|
127
|
+
/**
|
|
128
|
+
* Start of Lilypond music notation section See https://chordpro.org/chordpro/directives-env_ly/
|
|
129
|
+
* @type {string}
|
|
130
|
+
*/
|
|
131
|
+
export declare const START_OF_LY = "start_of_ly";
|
|
132
|
+
/**
|
|
133
|
+
* Start of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/
|
|
134
|
+
* @type {string}
|
|
135
|
+
*/
|
|
136
|
+
export declare const START_OF_TAB = "start_of_tab";
|
|
137
|
+
/**
|
|
138
|
+
* Start of SVG section. See https://www.chordpro.org/chordpro/directives-env_svg/
|
|
139
|
+
* @type {string}
|
|
140
|
+
*/
|
|
141
|
+
export declare const START_OF_SVG = "start_of_svg";
|
|
142
|
+
/**
|
|
143
|
+
* End of SVG section. See https://www.chordpro.org/chordpro/directives-env_svg/
|
|
144
|
+
* @type {string}
|
|
145
|
+
*/
|
|
146
|
+
export declare const END_OF_SVG = "end_of_svg";
|
|
147
|
+
/**
|
|
148
|
+
* Start of textblock directive. See https://chordpro.org/chordpro/directives-env_textblock/
|
|
149
|
+
* @type {string}
|
|
150
|
+
*/
|
|
151
|
+
export declare const START_OF_TEXTBLOCK = "start_of_textblock";
|
|
152
|
+
/**
|
|
153
|
+
* End of textblock directive. See https://chordpro.org/chordpro/directives-env_textblock/
|
|
154
|
+
* @type {string}
|
|
155
|
+
*/
|
|
156
|
+
export declare const END_OF_TEXTBLOCK = "end_of_textblock";
|
|
157
|
+
/**
|
|
158
|
+
* Start of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/
|
|
159
|
+
* @type {string}
|
|
160
|
+
*/
|
|
161
|
+
export declare const START_OF_VERSE = "start_of_verse";
|
|
162
|
+
/**
|
|
163
|
+
* Start of part
|
|
164
|
+
* @type {string}
|
|
165
|
+
*/
|
|
166
|
+
export declare const START_OF_PART = "start_of_part";
|
|
167
|
+
/**
|
|
168
|
+
* Subtitle meta directive. See https://www.chordpro.org/chordpro/directives-subtitle/
|
|
169
|
+
* @type {string}
|
|
170
|
+
*/
|
|
171
|
+
export declare const SUBTITLE = "subtitle";
|
|
172
|
+
/**
|
|
173
|
+
* Tempo meta directive. See https://www.chordpro.org/chordpro/directives-tempo/
|
|
174
|
+
* @type {string}
|
|
175
|
+
*/
|
|
176
|
+
export declare const TEMPO = "tempo";
|
|
177
|
+
/**
|
|
178
|
+
* Time meta directive. See https://www.chordpro.org/chordpro/directives-time/
|
|
179
|
+
* @type {string}
|
|
180
|
+
*/
|
|
181
|
+
export declare const TIME = "time";
|
|
182
|
+
/**
|
|
183
|
+
* Title meta directive. See https://www.chordpro.org/chordpro/directives-title/
|
|
184
|
+
* @type {string}
|
|
185
|
+
*/
|
|
186
|
+
export declare const TITLE = "title";
|
|
187
|
+
/**
|
|
188
|
+
* Transpose meta directive. See: https://www.chordpro.org/chordpro/directives-transpose/
|
|
189
|
+
* @type {string}
|
|
190
|
+
*/
|
|
191
|
+
export declare const TRANSPOSE = "transpose";
|
|
192
|
+
/**
|
|
193
|
+
* New Key meta directive. See: https://github.com/BetterMusic/ChordSheetJS/issues/53
|
|
194
|
+
* @type {string}
|
|
195
|
+
*/
|
|
196
|
+
export declare const NEW_KEY = "new_key";
|
|
197
|
+
/**
|
|
198
|
+
* Year meta directive. See https://www.chordpro.org/chordpro/directives-year/
|
|
199
|
+
* @type {string}
|
|
200
|
+
*/
|
|
201
|
+
export declare const YEAR = "year";
|
|
202
|
+
/**
|
|
203
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_chord_legacy/
|
|
204
|
+
* @type {string}
|
|
205
|
+
*/
|
|
206
|
+
export declare const CHORDFONT = "chordfont";
|
|
207
|
+
/**
|
|
208
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_chord_legacy/
|
|
209
|
+
* @type {string}
|
|
210
|
+
*/
|
|
211
|
+
export declare const CHORDSIZE = "chordsize";
|
|
212
|
+
/**
|
|
213
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_chord_legacy/
|
|
214
|
+
* @type {string}
|
|
215
|
+
*/
|
|
216
|
+
export declare const CHORDCOLOUR = "chordcolour";
|
|
217
|
+
/**
|
|
218
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_text_legacy/
|
|
219
|
+
* @type {string}
|
|
220
|
+
*/
|
|
221
|
+
export declare const TEXTFONT = "textfont";
|
|
222
|
+
/**
|
|
223
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_text_legacy/
|
|
224
|
+
* @type {string}
|
|
225
|
+
*/
|
|
226
|
+
export declare const TEXTSIZE = "textsize";
|
|
227
|
+
/**
|
|
228
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_text_legacy/
|
|
229
|
+
* @type {string}
|
|
230
|
+
*/
|
|
231
|
+
export declare const TEXTCOLOUR = "textcolour";
|
|
232
|
+
/**
|
|
233
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_title_legacy/
|
|
234
|
+
* @type {string}
|
|
235
|
+
*/
|
|
236
|
+
export declare const TITLEFONT = "titlefont";
|
|
237
|
+
/**
|
|
238
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_title_legacy/
|
|
239
|
+
* @type {string}
|
|
240
|
+
*/
|
|
241
|
+
export declare const TITLESIZE = "titlesize";
|
|
242
|
+
/**
|
|
243
|
+
* Chordfont directive. See https://www.chordpro.org/chordpro/directives-props_title_legacy/
|
|
244
|
+
* @type {string}
|
|
245
|
+
*/
|
|
246
|
+
export declare const TITLECOLOUR = "titlecolour";
|
|
247
|
+
/**
|
|
248
|
+
* Chorus directive. Support repeating an earlier defined section.
|
|
249
|
+
* See https://www.chordpro.org/chordpro/directives-env_chorus/
|
|
250
|
+
* @type {string}
|
|
251
|
+
*/
|
|
252
|
+
export declare const CHORUS = "chorus";
|
|
253
|
+
/**
|
|
254
|
+
* Chord type directive. Determines the type of chords used in the rendered chord sheet.
|
|
255
|
+
* Possible values are 'solfege', 'symbol', 'numeral' and 'number'
|
|
256
|
+
* @see https://github.com/bettermusic/ChordSheetJS/issues/352
|
|
257
|
+
* @type {string}
|
|
258
|
+
*/
|
|
259
|
+
export declare const CHORD_STYLE = "chord_style";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import AstType from './chord_sheet/ast_type';
|
|
2
|
+
import ChordDefinition from './chord_definition/chord_definition';
|
|
3
|
+
import ChordLyricsPair from './chord_sheet/chord_lyrics_pair';
|
|
4
|
+
import Comment from './chord_sheet/comment';
|
|
5
|
+
import Line from './chord_sheet/line';
|
|
6
|
+
import Literal from './chord_sheet/chord_pro/literal';
|
|
7
|
+
import SoftLineBreak from './chord_sheet/soft_line_break';
|
|
8
|
+
import Song from './chord_sheet/song';
|
|
9
|
+
import SongBuilder from './song_builder';
|
|
10
|
+
import Tag from './chord_sheet/tag';
|
|
11
|
+
import Ternary from './chord_sheet/chord_pro/ternary';
|
|
12
|
+
import { SerializedChordDefinition, SerializedChordLyricsPair, SerializedComment, SerializedComponent, SerializedLine, SerializedLiteral, SerializedSong, SerializedTag, SerializedTernary } from './serialized_types';
|
|
13
|
+
/**
|
|
14
|
+
* Serializes a song into een plain object, and deserializes the serialized object back into a {@link Song}
|
|
15
|
+
*/
|
|
16
|
+
declare class ChordSheetSerializer {
|
|
17
|
+
song: Song;
|
|
18
|
+
songBuilder: SongBuilder;
|
|
19
|
+
/**
|
|
20
|
+
* Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc
|
|
21
|
+
* Can be deserialized using {@link deserialize}
|
|
22
|
+
* @returns object A plain JS object containing all chord sheet data
|
|
23
|
+
*/
|
|
24
|
+
serialize(song: Song): SerializedSong;
|
|
25
|
+
serializeLine(line: Line): SerializedLine;
|
|
26
|
+
serializeItem(item: AstType): SerializedComponent;
|
|
27
|
+
serializeChordDefinition(chordDefinition: ChordDefinition): SerializedChordDefinition;
|
|
28
|
+
serializeTag(tag: Tag): SerializedTag;
|
|
29
|
+
serializeChordLyricsPair(chordLyricsPair: ChordLyricsPair): SerializedChordLyricsPair;
|
|
30
|
+
serializeTernary(ternary: Ternary): object;
|
|
31
|
+
serializeLiteral(literal: Literal): string;
|
|
32
|
+
serializeExpression(expression: AstType[]): SerializedComponent[];
|
|
33
|
+
serializeComment(comment: Comment): SerializedComment;
|
|
34
|
+
/**
|
|
35
|
+
* Deserializes a song that has been serialized using {@link serialize}
|
|
36
|
+
* @param {object} serializedSong The serialized song
|
|
37
|
+
* @returns {Song} The deserialized song
|
|
38
|
+
*/
|
|
39
|
+
deserialize(serializedSong: SerializedSong): Song;
|
|
40
|
+
parseAstComponent(astComponent: SerializedComponent): null | ChordLyricsPair | Tag | Comment | Ternary | Literal | SoftLineBreak;
|
|
41
|
+
parseChordSheet(astComponent: SerializedSong): void;
|
|
42
|
+
parseLine(astComponent: SerializedLine): void;
|
|
43
|
+
parseChordLyricsPair(astComponent: SerializedChordLyricsPair): ChordLyricsPair;
|
|
44
|
+
parseTag(astComponent: SerializedTag): Tag;
|
|
45
|
+
parseComment(astComponent: SerializedComment): Comment;
|
|
46
|
+
parseTernary(astComponent: SerializedTernary): Ternary;
|
|
47
|
+
parseExpression(expression: (SerializedLiteral | SerializedTernary)[]): (AstType | null)[];
|
|
48
|
+
}
|
|
49
|
+
export default ChordSheetSerializer;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to mark a paragraph as bridge
|
|
3
|
+
* @constant
|
|
4
|
+
* @type {string}
|
|
5
|
+
*/
|
|
6
|
+
export declare const BRIDGE = "bridge";
|
|
7
|
+
/**
|
|
8
|
+
* Used to mark a paragraph as chorus
|
|
9
|
+
* @constant
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
export declare const CHORUS = "chorus";
|
|
13
|
+
/**
|
|
14
|
+
* Used to mark a paragraph as grid
|
|
15
|
+
* @constant
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
export declare const GRID = "grid";
|
|
19
|
+
/**
|
|
20
|
+
* Used to mark a paragraph as containing lines with both verse and chorus type
|
|
21
|
+
* @constant
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
export declare const INDETERMINATE = "indeterminate";
|
|
25
|
+
/**
|
|
26
|
+
* Used to mark a paragraph as not containing a line marked with a type
|
|
27
|
+
* @constant
|
|
28
|
+
* @type {string}
|
|
29
|
+
*/
|
|
30
|
+
export declare const NONE = "none";
|
|
31
|
+
/**
|
|
32
|
+
* Used to mark a paragraph as tab
|
|
33
|
+
* @constant
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
export declare const TAB = "tab";
|
|
37
|
+
/**
|
|
38
|
+
* Used to mark a paragraph as verse
|
|
39
|
+
* @constant
|
|
40
|
+
* @type {string}
|
|
41
|
+
*/
|
|
42
|
+
export declare const VERSE = "verse";
|
|
43
|
+
/**
|
|
44
|
+
* Used to mark a paragraph as part
|
|
45
|
+
* @constant
|
|
46
|
+
* @type {string}
|
|
47
|
+
*/
|
|
48
|
+
export declare const PART = "part";
|
|
49
|
+
/**
|
|
50
|
+
* Used to mark a section as Lilypond notation
|
|
51
|
+
* @constant
|
|
52
|
+
* @type {string}
|
|
53
|
+
*/
|
|
54
|
+
export declare const LILYPOND = "ly";
|
|
55
|
+
/**
|
|
56
|
+
* Used to mark a section as ABC music notation
|
|
57
|
+
* @constant
|
|
58
|
+
* @type {string}
|
|
59
|
+
*/
|
|
60
|
+
export declare const ABC = "abc";
|
|
61
|
+
/**
|
|
62
|
+
* Used to mark a section as SVG image
|
|
63
|
+
* @constant
|
|
64
|
+
* @type {string}
|
|
65
|
+
*/
|
|
66
|
+
export declare const SVG = "svg";
|
|
67
|
+
/**
|
|
68
|
+
* Used to mark a paragraph as textblock
|
|
69
|
+
* @constant
|
|
70
|
+
* @type {string}
|
|
71
|
+
*/
|
|
72
|
+
export declare const TEXTBLOCK = "textblock";
|
|
73
|
+
export type ParagraphType = 'abc' | 'bridge' | 'chorus' | 'grid' | 'indeterminate' | 'ly' | 'none' | 'svg' | 'tab' | 'textblock' | 'verse' | 'part' | string;
|
|
74
|
+
export declare const SYMBOL = "symbol";
|
|
75
|
+
export declare const NUMERIC = "numeric";
|
|
76
|
+
export declare const NUMERAL = "numeral";
|
|
77
|
+
export declare const SOLFEGE = "solfege";
|
|
78
|
+
export declare const ROMAN_NUMERALS: string[];
|
|
79
|
+
export declare const FLAT = "b";
|
|
80
|
+
export declare const SHARP = "#";
|
|
81
|
+
export type Accidental = '#' | 'b';
|
|
82
|
+
export declare const NO_ACCIDENTAL = "NM";
|
|
83
|
+
export type NoAccidental = 'NM';
|
|
84
|
+
export type AccidentalMaybe = Accidental | NoAccidental;
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated Use Accidental instead
|
|
87
|
+
*/
|
|
88
|
+
export type Modifier = Accidental;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Use NO_ACCIDENTAL instead
|
|
91
|
+
*/
|
|
92
|
+
export declare const NO_MODIFIER = "NM";
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Use NoAccidental instead
|
|
95
|
+
*/
|
|
96
|
+
export type NoModifier = NoAccidental;
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated Use AccidentalMaybe instead
|
|
99
|
+
*/
|
|
100
|
+
export type ModifierMaybe = AccidentalMaybe;
|
|
101
|
+
export type ChordType = 'symbol' | 'solfege' | 'numeric' | 'numeral';
|
|
102
|
+
export type ChordStyle = 'symbol' | 'solfege' | 'number' | 'numeral';
|
|
103
|
+
export type NullableChordStyle = ChordStyle | null;
|
|
104
|
+
export declare const MINOR = "m";
|
|
105
|
+
export declare const MAJOR = "M";
|
|
106
|
+
export type Mode = 'M' | 'm';
|
|
107
|
+
export type FretNumber = number;
|
|
108
|
+
export type OpenFret = 0;
|
|
109
|
+
export type NonSoundingString = '-1' | 'N' | 'x';
|
|
110
|
+
export type StringNumber = 1 | 2 | 3 | 4 | 5 | 6;
|
|
111
|
+
export type FingerNumber = 1 | 2 | 3 | 4 | 5 | OpenFret;
|
|
112
|
+
export declare const nonSoundingString: NonSoundingString[];
|
|
113
|
+
export declare const openFret: OpenFret;
|
|
114
|
+
export type Fret = FretNumber | OpenFret | NonSoundingString;
|
|
115
|
+
export declare const START_TAG = "start_tag";
|
|
116
|
+
export declare const END_TAG = "end_tag";
|
|
117
|
+
export declare const AUTO = "auto";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ChordLyricsPair from '../chord_sheet/chord_lyrics_pair';
|
|
2
|
+
import Comment from '../chord_sheet/comment';
|
|
3
|
+
import Evaluatable from '../chord_sheet/chord_pro/evaluatable';
|
|
4
|
+
import Formatter from './formatter';
|
|
5
|
+
import Item from '../chord_sheet/item';
|
|
6
|
+
import Line from '../chord_sheet/line';
|
|
7
|
+
import Metadata from '../chord_sheet/metadata';
|
|
8
|
+
import Song from '../chord_sheet/song';
|
|
9
|
+
import Tag from '../chord_sheet/tag';
|
|
10
|
+
import Ternary from '../chord_sheet/chord_pro/ternary';
|
|
11
|
+
/**
|
|
12
|
+
* Formats a song into a ChordPro chord sheet
|
|
13
|
+
*/
|
|
14
|
+
declare class ChordProFormatter extends Formatter {
|
|
15
|
+
/**
|
|
16
|
+
* Formats a song into a ChordPro chord sheet.
|
|
17
|
+
* @param {Song} song The song to be formatted
|
|
18
|
+
* @returns {string} The ChordPro string
|
|
19
|
+
*/
|
|
20
|
+
format(song: Song): string;
|
|
21
|
+
private separateMetadataFromContent;
|
|
22
|
+
private formatMetadataSection;
|
|
23
|
+
private formatContentSection;
|
|
24
|
+
private combineMetadataAndContent;
|
|
25
|
+
formatLine(line: Line, metadata: Metadata): string;
|
|
26
|
+
formatItem(item: Item, metadata: Metadata): string;
|
|
27
|
+
formatOrEvaluateItem(item: Evaluatable, metadata: Metadata): string;
|
|
28
|
+
formatTernary(ternary: Ternary): string;
|
|
29
|
+
formatValueTest(valueTest: string | null): string;
|
|
30
|
+
formatExpressionRange(expressionRange: Evaluatable[]): string;
|
|
31
|
+
formatExpression(expression: Evaluatable): string;
|
|
32
|
+
formatTag(tag: Tag): string;
|
|
33
|
+
formatTagAttributes(tag: Tag): string;
|
|
34
|
+
formatChordLyricsPair(chordLyricsPair: ChordLyricsPair): string;
|
|
35
|
+
formatChordLyricsPairChords(chordLyricsPair: ChordLyricsPair): string;
|
|
36
|
+
formatChordLyricsPairLyrics(chordLyricsPair: ChordLyricsPair): string;
|
|
37
|
+
formatComment(comment: Comment): string;
|
|
38
|
+
}
|
|
39
|
+
export default ChordProFormatter;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Key from '../key';
|
|
2
|
+
import { NullableChordStyle } from '../constants';
|
|
3
|
+
interface ConstructorOptions {
|
|
4
|
+
capo: number;
|
|
5
|
+
contextKey: Key | null;
|
|
6
|
+
decapo: boolean;
|
|
7
|
+
normalizeChords: boolean;
|
|
8
|
+
renderKey: Key | null;
|
|
9
|
+
songKey: Key | null;
|
|
10
|
+
style: NullableChordStyle;
|
|
11
|
+
transposeKey: string | null;
|
|
12
|
+
useUnicodeModifier: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare class ChordRenderer {
|
|
15
|
+
capo: number;
|
|
16
|
+
contextKey: Key | null;
|
|
17
|
+
normalizeChords: boolean;
|
|
18
|
+
renderKey: Key | null;
|
|
19
|
+
songKey: Key | null;
|
|
20
|
+
style: NullableChordStyle;
|
|
21
|
+
transposeKey: string | null;
|
|
22
|
+
useUnicodeModifier: boolean;
|
|
23
|
+
constructor(options?: Partial<ConstructorOptions>);
|
|
24
|
+
render(chordString: string): string;
|
|
25
|
+
private changeChordType;
|
|
26
|
+
private get accidental();
|
|
27
|
+
private get effectiveKey();
|
|
28
|
+
private get effectiveTransposeDistance();
|
|
29
|
+
}
|
|
30
|
+
export default ChordRenderer;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 ChordsOverWordsFormatter extends Formatter {
|
|
12
|
+
song: Song;
|
|
13
|
+
/**
|
|
14
|
+
* Formats a song into a plain text chord sheet
|
|
15
|
+
* @param {Song} song The song to be formatted
|
|
16
|
+
* @returns {string} the chord sheet
|
|
17
|
+
*/
|
|
18
|
+
format(song: Song): string;
|
|
19
|
+
formatHeader(): string;
|
|
20
|
+
formatParagraphs(): string;
|
|
21
|
+
formatParagraph(paragraph: Paragraph, metadata: Metadata): string;
|
|
22
|
+
formatLine(line: Line, metadata: Metadata): string;
|
|
23
|
+
formatLineTop(line: Line, metadata: Metadata): string | null;
|
|
24
|
+
chordLyricsPairLength(chordLyricsPair: ChordLyricsPair, line: Line): number;
|
|
25
|
+
formatItemTop(item: Item, _metadata: Metadata, line: Line): string;
|
|
26
|
+
renderChord(item: ChordLyricsPair, line: Line): string;
|
|
27
|
+
formatLineBottom(line: any, metadata: any): string | null;
|
|
28
|
+
formatLineWithFormatter(line: Line, formatter: (_item: Item, _metadata: Metadata, _line: Line) => string, metadata: Metadata): string;
|
|
29
|
+
formatItemBottom(item: Item, metadata: Metadata, line: Line): string;
|
|
30
|
+
private formatEvaluatable;
|
|
31
|
+
private formatChordLyricsPair;
|
|
32
|
+
}
|
|
33
|
+
export default ChordsOverWordsFormatter;
|