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,58 @@
|
|
|
1
|
+
import { ContentType } from '../../serialized_types';
|
|
2
|
+
import Key from '../../key';
|
|
3
|
+
export type Delegate = (_string: string) => string;
|
|
4
|
+
export declare const defaultDelegate: Delegate;
|
|
5
|
+
export interface MetadataRule {
|
|
6
|
+
match: string | string[] | RegExp | ((key: string) => boolean);
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
sortMethod?: 'preserve' | 'alphabetical' | 'custom';
|
|
9
|
+
customSort?: (a: string, b: string) => number;
|
|
10
|
+
}
|
|
11
|
+
export interface MetadataConfiguration {
|
|
12
|
+
separator: string;
|
|
13
|
+
order: (string | MetadataRule)[];
|
|
14
|
+
}
|
|
15
|
+
export interface InstrumentConfiguration {
|
|
16
|
+
type?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
tuning?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface UserConfigurationProperties {
|
|
21
|
+
name?: string;
|
|
22
|
+
fullname?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const defaultMetadataConfiguration: MetadataConfiguration;
|
|
25
|
+
export interface DelegatesConfiguration {
|
|
26
|
+
abc: Delegate;
|
|
27
|
+
ly: Delegate;
|
|
28
|
+
svg: Delegate;
|
|
29
|
+
tab: Delegate;
|
|
30
|
+
grid: Delegate;
|
|
31
|
+
}
|
|
32
|
+
export declare const defaultDelegatesConfiguration: DelegatesConfiguration;
|
|
33
|
+
export interface BaseFormatterConfiguration {
|
|
34
|
+
decapo: boolean;
|
|
35
|
+
delegates: Partial<Record<ContentType, Delegate>>;
|
|
36
|
+
evaluate: boolean;
|
|
37
|
+
expandChorusDirective: boolean;
|
|
38
|
+
instrument: InstrumentConfiguration | null;
|
|
39
|
+
key: Key | null;
|
|
40
|
+
metadata: MetadataConfiguration;
|
|
41
|
+
normalizeChords: boolean;
|
|
42
|
+
useUnicodeModifiers: boolean;
|
|
43
|
+
user: UserConfigurationProperties | null;
|
|
44
|
+
}
|
|
45
|
+
export type ConfigurationProperties = Record<string, any> & Partial<{
|
|
46
|
+
decapo: boolean;
|
|
47
|
+
delegates: Partial<DelegatesConfiguration>;
|
|
48
|
+
evaluate: boolean;
|
|
49
|
+
expandChorusDirective: boolean;
|
|
50
|
+
instrument: Partial<InstrumentConfiguration>;
|
|
51
|
+
key: Key | string | null;
|
|
52
|
+
metadata: Partial<MetadataConfiguration>;
|
|
53
|
+
normalizeChords: boolean;
|
|
54
|
+
useUnicodeModifiers: boolean;
|
|
55
|
+
user: Partial<UserConfigurationProperties>;
|
|
56
|
+
}>;
|
|
57
|
+
export declare const defaultBaseConfiguration: BaseFormatterConfiguration;
|
|
58
|
+
export default BaseFormatterConfiguration;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseFormatterConfiguration } from './base_configuration';
|
|
2
|
+
import { HTMLFormatterConfiguration } from './html_configuration';
|
|
3
|
+
import { MeasuredHtmlFormatterConfiguration } from './measured_html_configuration';
|
|
4
|
+
import { MeasurementBasedFormatterConfiguration } from './measurement_based_configuration';
|
|
5
|
+
import { PDFFormatterConfiguration } from './pdf_configuration';
|
|
6
|
+
/**
|
|
7
|
+
* Build the inheritance chain for a formatter type
|
|
8
|
+
* @param formatterType The formatter type to build the chain for
|
|
9
|
+
* @returns Array of formatter types in inheritance order (base first)
|
|
10
|
+
*/
|
|
11
|
+
export declare const buildInheritanceChain: (formatterType: string) => string[];
|
|
12
|
+
/**
|
|
13
|
+
* Get the default configuration for a specific formatter type
|
|
14
|
+
* This dynamically composes the full default configuration by merging
|
|
15
|
+
* the defaults from all levels in the inheritance chain
|
|
16
|
+
* @param formatterType The formatter type to get defaults for
|
|
17
|
+
* @returns The fully composed default configuration
|
|
18
|
+
*/
|
|
19
|
+
export declare const getDefaultConfig: <T extends BaseFormatterConfiguration>(formatterType: string) => T;
|
|
20
|
+
export declare const getBaseDefaultConfig: () => BaseFormatterConfiguration;
|
|
21
|
+
export declare const getHTMLDefaultConfig: () => HTMLFormatterConfiguration;
|
|
22
|
+
export declare const getMeasurementDefaultConfig: () => MeasurementBasedFormatterConfiguration;
|
|
23
|
+
export declare const getPDFDefaultConfig: () => PDFFormatterConfiguration;
|
|
24
|
+
export declare const getMeasuredHtmlDefaultConfig: () => MeasuredHtmlFormatterConfiguration;
|
|
25
|
+
/**
|
|
26
|
+
* Register a new formatter type with its specific defaults and inheritance chain
|
|
27
|
+
* @param formatterType The formatter type to register
|
|
28
|
+
* @param specificDefaults The formatter-specific default settings
|
|
29
|
+
* @param inheritsFrom Array of formatter types this one inherits from (in order)
|
|
30
|
+
*/
|
|
31
|
+
export declare const registerFormatterType: (formatterType: string, specificDefaults?: Record<string, any>, inheritsFrom?: string[]) => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseFormatterConfiguration, ConfigurationProperties } from './base_configuration';
|
|
2
|
+
import { PangoRenderer } from '../../pango/pango_helpers';
|
|
3
|
+
export type CSS = Record<string, string | number>;
|
|
4
|
+
export interface HtmlTemplateCssClasses {
|
|
5
|
+
annotation: string;
|
|
6
|
+
chord: string;
|
|
7
|
+
chordSheet: string;
|
|
8
|
+
column: string;
|
|
9
|
+
comment: string;
|
|
10
|
+
emptyLine: string;
|
|
11
|
+
image: string;
|
|
12
|
+
label: string;
|
|
13
|
+
labelWrapper: string;
|
|
14
|
+
line: string;
|
|
15
|
+
literal: string;
|
|
16
|
+
literalContents: string;
|
|
17
|
+
lyrics: string;
|
|
18
|
+
paragraph: string;
|
|
19
|
+
rhythmSymbol: string;
|
|
20
|
+
row: string;
|
|
21
|
+
subtitle: string;
|
|
22
|
+
title: string;
|
|
23
|
+
}
|
|
24
|
+
export interface HTMLFormatterConfiguration extends BaseFormatterConfiguration {
|
|
25
|
+
cssClasses: HtmlTemplateCssClasses;
|
|
26
|
+
customCSS?: CSS;
|
|
27
|
+
pangoRenderer?: PangoRenderer;
|
|
28
|
+
renderBlankLines?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const defaultCssClasses: HtmlTemplateCssClasses;
|
|
31
|
+
export interface HTMLConfigurationProperties extends ConfigurationProperties {
|
|
32
|
+
cssClasses?: Partial<HtmlTemplateCssClasses>;
|
|
33
|
+
customCSS?: CSS;
|
|
34
|
+
pangoRenderer?: PangoRenderer;
|
|
35
|
+
renderBlankLines?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare const htmlSpecificDefaults: Partial<HTMLFormatterConfiguration>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseFormatterConfiguration, ConfigurationProperties, Delegate, DelegatesConfiguration, InstrumentConfiguration, MetadataConfiguration, UserConfigurationProperties, defaultBaseConfiguration, defaultDelegate, defaultDelegatesConfiguration, defaultMetadataConfiguration } from './base_configuration';
|
|
2
|
+
import { CSS, HTMLConfigurationProperties, HTMLFormatterConfiguration, HtmlTemplateCssClasses, defaultCssClasses, htmlSpecificDefaults } from './html_configuration';
|
|
3
|
+
import { Alignment, ChordDiagramFontConfigurations, ChordDiagramOverrides, ChordDiagramsConfig, ColumnConfig, ConditionRule, ConditionalRule, Dimension, FontConfiguration, FontConfigurations, FontSection, ILayoutContentItem, LayoutContentItem, LayoutContentItemWithImage, LayoutContentItemWithLine, LayoutContentItemWithTemplate, LayoutContentItemWithText, LayoutContentItemWithValue, LayoutItem, LayoutSection, LineLayout, LineStyle, Margins, MeasuredItem, MeasurementBasedFormatterConfiguration, MeasurementBasedLayoutConfig, MeasurerType, Position, SectionDisplay, SectionTypeConfig, SectionsConfig, SingleCondition, defaultFontConfigurations, defaultMeasurementBasedLayout, measurementSpecificDefaults } from './measurement_based_configuration';
|
|
4
|
+
import { MeasuredHtmlConfigurationProperties, MeasuredHtmlFormatterConfiguration, MeasuredHtmlLayoutConfig, measuredHtmlSpecificDefaults } from './measured_html_configuration';
|
|
5
|
+
import { PDFConfigurationProperties, PDFFormatterConfiguration, PDFLayoutConfig, pdfSpecificDefaults } from './pdf_configuration';
|
|
6
|
+
import { getDefaultConfig, getHTMLDefaultConfig, getMeasuredHtmlDefaultConfig, getPDFDefaultConfig } from './default_config_manager';
|
|
7
|
+
type Configuration = BaseFormatterConfiguration;
|
|
8
|
+
/**
|
|
9
|
+
* Legacy configuration function for backward compatibility
|
|
10
|
+
*/
|
|
11
|
+
export declare function configure(config: ConfigurationProperties): Configuration;
|
|
12
|
+
export { Delegate, defaultDelegate, MetadataConfiguration, InstrumentConfiguration, UserConfigurationProperties, defaultMetadataConfiguration, DelegatesConfiguration, defaultDelegatesConfiguration, ConfigurationProperties, defaultBaseConfiguration, Margins, FontSection, LayoutSection, Alignment, MeasurerType, ConditionRule, SingleCondition, ConditionalRule, Position, Dimension, FontConfiguration, FontConfigurations, ChordDiagramFontConfigurations, defaultFontConfigurations, SectionDisplay, SectionTypeConfig, ColumnConfig, SectionsConfig, ILayoutContentItem, LayoutContentItem, LayoutContentItemWithText, LayoutContentItemWithValue, LayoutContentItemWithTemplate, LayoutContentItemWithImage, LineStyle, LayoutContentItemWithLine, LayoutItem, ChordDiagramOverrides, ChordDiagramsConfig, MeasuredItem, LineLayout, MeasurementBasedLayoutConfig, defaultMeasurementBasedLayout, measurementSpecificDefaults, MeasurementBasedFormatterConfiguration, MeasuredHtmlLayoutConfig, MeasuredHtmlFormatterConfiguration, MeasuredHtmlConfigurationProperties, measuredHtmlSpecificDefaults, CSS, HtmlTemplateCssClasses, HTMLFormatterConfiguration, defaultCssClasses, HTMLConfigurationProperties, htmlSpecificDefaults, PDFLayoutConfig, PDFFormatterConfiguration, PDFConfigurationProperties, pdfSpecificDefaults, BaseFormatterConfiguration, Configuration, getDefaultConfig, getHTMLDefaultConfig, getMeasuredHtmlDefaultConfig, getPDFDefaultConfig, };
|
|
13
|
+
export default Configuration;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MeasurementBasedConfigurationProperties, MeasurementBasedFormatterConfiguration, MeasurementBasedLayoutConfig, SectionsConfig } from './measurement_based_configuration';
|
|
2
|
+
export interface MeasuredHtmlLayoutConfig extends MeasurementBasedLayoutConfig {
|
|
3
|
+
header: MeasurementBasedLayoutConfig['header'];
|
|
4
|
+
footer: MeasurementBasedLayoutConfig['footer'];
|
|
5
|
+
sections: SectionsConfig;
|
|
6
|
+
}
|
|
7
|
+
export interface MeasuredHtmlFormatterConfiguration extends MeasurementBasedFormatterConfiguration {
|
|
8
|
+
version: string;
|
|
9
|
+
layout: MeasuredHtmlLayoutConfig;
|
|
10
|
+
pageSize: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
cssClassPrefix?: string;
|
|
15
|
+
additionalCss?: string;
|
|
16
|
+
cssClasses?: {
|
|
17
|
+
container?: string;
|
|
18
|
+
page?: string;
|
|
19
|
+
chord?: string;
|
|
20
|
+
lyrics?: string;
|
|
21
|
+
sectionLabel?: string;
|
|
22
|
+
comment?: string;
|
|
23
|
+
header?: string;
|
|
24
|
+
footer?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface MeasuredHtmlConfigurationProperties extends MeasurementBasedConfigurationProperties {
|
|
28
|
+
version?: string;
|
|
29
|
+
layout?: Partial<MeasuredHtmlLayoutConfig>;
|
|
30
|
+
pageSize?: {
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
};
|
|
34
|
+
cssClassPrefix?: string;
|
|
35
|
+
additionalCss?: string;
|
|
36
|
+
cssClasses?: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
export declare const measuredHtmlSpecificDefaults: Partial<MeasuredHtmlFormatterConfiguration>;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { ImageCompression } from 'jspdf';
|
|
2
|
+
import { ChordDiagramRenderingConfig } from '../../chord_diagram/chord_diagram';
|
|
3
|
+
import Item from '../../chord_sheet/item';
|
|
4
|
+
import { ParagraphType } from '../../constants';
|
|
5
|
+
import { BaseFormatterConfiguration, ConfigurationProperties } from './base_configuration';
|
|
6
|
+
import { ChordLyricsPair, Comment, Line, SoftLineBreak, Tag } from '../../index';
|
|
7
|
+
export interface Margins {
|
|
8
|
+
top: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
left: number;
|
|
11
|
+
right: number;
|
|
12
|
+
}
|
|
13
|
+
export type FontSection = 'title' | 'subtitle' | 'metadata' | 'text' | 'chord' | 'comment' | 'annotation' | 'sectionLabel';
|
|
14
|
+
export type LayoutSection = 'header' | 'footer';
|
|
15
|
+
export type Alignment = 'left' | 'center' | 'right' | number;
|
|
16
|
+
export type MeasurerType = 'canvas' | 'dom' | 'jspdf';
|
|
17
|
+
export type ConditionRule = Partial<{
|
|
18
|
+
equals: any;
|
|
19
|
+
not_equals: any;
|
|
20
|
+
greater_than: number;
|
|
21
|
+
greater_than_equal: number;
|
|
22
|
+
less_than: number;
|
|
23
|
+
less_than_equal: number;
|
|
24
|
+
like: string;
|
|
25
|
+
contains: string;
|
|
26
|
+
in: any[];
|
|
27
|
+
not_in: any[];
|
|
28
|
+
all: any[];
|
|
29
|
+
exists: boolean;
|
|
30
|
+
first: boolean;
|
|
31
|
+
last: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
export type SingleCondition = Record<string, ConditionRule>;
|
|
34
|
+
export type ConditionalRule = Partial<{
|
|
35
|
+
and: SingleCondition[];
|
|
36
|
+
or: SingleCondition[];
|
|
37
|
+
}> | SingleCondition;
|
|
38
|
+
export interface Position {
|
|
39
|
+
x: Alignment;
|
|
40
|
+
y: number;
|
|
41
|
+
width?: number;
|
|
42
|
+
height?: number;
|
|
43
|
+
offsetX?: number;
|
|
44
|
+
clip?: boolean;
|
|
45
|
+
ellipsis?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface Dimension {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}
|
|
51
|
+
export interface FontConfiguration {
|
|
52
|
+
name: string;
|
|
53
|
+
style: string;
|
|
54
|
+
weight?: string | number;
|
|
55
|
+
size: number;
|
|
56
|
+
lineHeight?: number;
|
|
57
|
+
color: string | number;
|
|
58
|
+
underline?: boolean;
|
|
59
|
+
inherit?: string;
|
|
60
|
+
textTransform?: string;
|
|
61
|
+
textDecoration?: string;
|
|
62
|
+
letterSpacing?: string;
|
|
63
|
+
}
|
|
64
|
+
export type FontConfigurations = Record<FontSection, FontConfiguration>;
|
|
65
|
+
export type ChordDiagramFontConfigurations = Record<'title' | 'fingerings' | 'baseFret', FontConfiguration>;
|
|
66
|
+
export declare const defaultFontConfigurations: FontConfigurations;
|
|
67
|
+
export interface SectionDisplay {
|
|
68
|
+
labelStyle?: 'uppercase';
|
|
69
|
+
showLabel?: boolean;
|
|
70
|
+
lyricsOnly?: boolean;
|
|
71
|
+
indent?: number;
|
|
72
|
+
compact?: boolean;
|
|
73
|
+
repeatedSections?: 'hide' | 'title_only' | 'lyrics_only' | 'full';
|
|
74
|
+
}
|
|
75
|
+
export interface SectionTypeConfig {
|
|
76
|
+
fonts?: FontConfigurations;
|
|
77
|
+
display?: SectionDisplay;
|
|
78
|
+
overrides?: {
|
|
79
|
+
condition: ConditionalRule;
|
|
80
|
+
display: Partial<SectionDisplay>;
|
|
81
|
+
}[];
|
|
82
|
+
}
|
|
83
|
+
export interface ColumnConfig {
|
|
84
|
+
columnCount?: number;
|
|
85
|
+
columnSpacing: number;
|
|
86
|
+
minColumnWidth?: number;
|
|
87
|
+
maxColumnWidth?: number;
|
|
88
|
+
}
|
|
89
|
+
export interface SectionsConfig {
|
|
90
|
+
global: {
|
|
91
|
+
columnWidth: number;
|
|
92
|
+
spacingBottom?: number;
|
|
93
|
+
spacingAfter?: number;
|
|
94
|
+
chordLyricSpacing: number;
|
|
95
|
+
linePadding: number;
|
|
96
|
+
paragraphSpacing?: number;
|
|
97
|
+
chordSpacing: number;
|
|
98
|
+
} & ColumnConfig;
|
|
99
|
+
base: SectionTypeConfig;
|
|
100
|
+
types?: Record<ParagraphType, SectionTypeConfig | undefined>;
|
|
101
|
+
}
|
|
102
|
+
export interface ILayoutContentItem {
|
|
103
|
+
type: string;
|
|
104
|
+
position: Position;
|
|
105
|
+
condition?: ConditionalRule;
|
|
106
|
+
}
|
|
107
|
+
export interface LayoutContentItemWithText extends ILayoutContentItem {
|
|
108
|
+
type: 'text';
|
|
109
|
+
style: FontConfiguration;
|
|
110
|
+
value?: string;
|
|
111
|
+
template?: string;
|
|
112
|
+
cssClass?: string;
|
|
113
|
+
elementStyle?: Record<string, string>;
|
|
114
|
+
}
|
|
115
|
+
export interface LayoutContentItemWithValue extends LayoutContentItemWithText {
|
|
116
|
+
value: string;
|
|
117
|
+
}
|
|
118
|
+
export interface LayoutContentItemWithTemplate extends LayoutContentItemWithText {
|
|
119
|
+
template: string;
|
|
120
|
+
}
|
|
121
|
+
export interface LayoutContentItemWithImage extends ILayoutContentItem {
|
|
122
|
+
type: 'image';
|
|
123
|
+
src: string;
|
|
124
|
+
position: Position;
|
|
125
|
+
compression: ImageCompression;
|
|
126
|
+
size: Dimension;
|
|
127
|
+
alias?: string;
|
|
128
|
+
rotation?: number;
|
|
129
|
+
}
|
|
130
|
+
export interface LineStyle {
|
|
131
|
+
color: string;
|
|
132
|
+
width: number;
|
|
133
|
+
dash?: number[];
|
|
134
|
+
}
|
|
135
|
+
export interface LayoutContentItemWithLine {
|
|
136
|
+
type: 'line';
|
|
137
|
+
style: LineStyle;
|
|
138
|
+
position: {
|
|
139
|
+
x?: number;
|
|
140
|
+
y: number;
|
|
141
|
+
width: number | 'auto';
|
|
142
|
+
height?: number;
|
|
143
|
+
};
|
|
144
|
+
condition?: ConditionalRule;
|
|
145
|
+
}
|
|
146
|
+
export type LayoutContentItem = LayoutContentItemWithValue | LayoutContentItemWithTemplate | LayoutContentItemWithImage | LayoutContentItemWithLine;
|
|
147
|
+
export interface LayoutItem {
|
|
148
|
+
height: number;
|
|
149
|
+
content: LayoutContentItem[];
|
|
150
|
+
}
|
|
151
|
+
export interface ChordDiagramOverrides {
|
|
152
|
+
hide?: boolean;
|
|
153
|
+
definition?: string;
|
|
154
|
+
}
|
|
155
|
+
export interface ChordDiagramsConfig {
|
|
156
|
+
enabled: boolean;
|
|
157
|
+
renderingConfig?: ChordDiagramRenderingConfig;
|
|
158
|
+
definitions?: {
|
|
159
|
+
hiddenChords: string[];
|
|
160
|
+
};
|
|
161
|
+
overrides?: {
|
|
162
|
+
global?: Record<string, ChordDiagramOverrides>;
|
|
163
|
+
byKey?: Record<string, Record<string, ChordDiagramOverrides>>;
|
|
164
|
+
};
|
|
165
|
+
fonts: ChordDiagramFontConfigurations;
|
|
166
|
+
}
|
|
167
|
+
export interface MeasuredItem {
|
|
168
|
+
item: ChordLyricsPair | Comment | SoftLineBreak | Tag | Item | null;
|
|
169
|
+
width: number;
|
|
170
|
+
chordLyricWidthDifference?: number;
|
|
171
|
+
chordHeight?: number;
|
|
172
|
+
adjustedChord?: string;
|
|
173
|
+
}
|
|
174
|
+
export interface LineLayout {
|
|
175
|
+
type: 'ChordLyricsPair' | 'Comment' | 'Tag' | 'ColumnBreak' | 'SectionLabel';
|
|
176
|
+
items: MeasuredItem[];
|
|
177
|
+
lineHeight: number;
|
|
178
|
+
line?: Line;
|
|
179
|
+
}
|
|
180
|
+
export interface MeasurementBasedLayoutConfig {
|
|
181
|
+
global: {
|
|
182
|
+
margins: Margins;
|
|
183
|
+
};
|
|
184
|
+
header: LayoutItem;
|
|
185
|
+
footer: LayoutItem;
|
|
186
|
+
sections?: SectionsConfig;
|
|
187
|
+
chordDiagrams?: ChordDiagramsConfig;
|
|
188
|
+
}
|
|
189
|
+
export declare const defaultMeasurementBasedLayout: MeasurementBasedLayoutConfig;
|
|
190
|
+
export declare const measurementSpecificDefaults: {
|
|
191
|
+
fonts: FontConfigurations;
|
|
192
|
+
measurer: string;
|
|
193
|
+
layout: MeasurementBasedLayoutConfig;
|
|
194
|
+
};
|
|
195
|
+
export interface MeasurementBasedFormatterConfiguration extends BaseFormatterConfiguration {
|
|
196
|
+
fonts: FontConfigurations;
|
|
197
|
+
measurer: MeasurerType;
|
|
198
|
+
layout: MeasurementBasedLayoutConfig;
|
|
199
|
+
}
|
|
200
|
+
export interface MeasurementBasedConfigurationProperties extends ConfigurationProperties {
|
|
201
|
+
fonts?: Partial<FontConfigurations>;
|
|
202
|
+
measurer?: MeasurerType;
|
|
203
|
+
layout?: Partial<MeasurementBasedLayoutConfig>;
|
|
204
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChordDiagramsConfig, MeasurementBasedConfigurationProperties, MeasurementBasedFormatterConfiguration, MeasurementBasedLayoutConfig, SectionsConfig } from './measurement_based_configuration';
|
|
2
|
+
export interface PDFLayoutConfig extends MeasurementBasedLayoutConfig {
|
|
3
|
+
header: MeasurementBasedLayoutConfig['header'];
|
|
4
|
+
footer: MeasurementBasedLayoutConfig['footer'];
|
|
5
|
+
sections: SectionsConfig;
|
|
6
|
+
chordDiagrams: ChordDiagramsConfig;
|
|
7
|
+
}
|
|
8
|
+
export interface PDFFormatterConfiguration extends MeasurementBasedFormatterConfiguration {
|
|
9
|
+
version: string;
|
|
10
|
+
layout: PDFLayoutConfig;
|
|
11
|
+
}
|
|
12
|
+
export interface PDFConfigurationProperties extends MeasurementBasedConfigurationProperties {
|
|
13
|
+
version?: string;
|
|
14
|
+
layout?: Partial<PDFLayoutConfig>;
|
|
15
|
+
}
|
|
16
|
+
export declare const pdfSpecificDefaults: Partial<PDFFormatterConfiguration>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseFormatterConfiguration } from './configuration/base_configuration';
|
|
2
|
+
import { DeepPartial } from '../utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Base formatter class that provides configuration handling for all formatters
|
|
5
|
+
*/
|
|
6
|
+
declare class Formatter<T extends BaseFormatterConfiguration = BaseFormatterConfiguration> {
|
|
7
|
+
configuration: T;
|
|
8
|
+
/**
|
|
9
|
+
* Instantiate
|
|
10
|
+
* @param {DeepPartial<T>} [configuration={}] options
|
|
11
|
+
* @param {boolean} [configuration.evaluate=false] Whether or not to evaluate meta expressions.
|
|
12
|
+
* For more info about meta expressions, see: https://bit.ly/2SC9c2u
|
|
13
|
+
* @param {object} [configuration.metadata={}]
|
|
14
|
+
* @param {string} [configuration.metadata.separator=", "] The separator to be used when rendering a
|
|
15
|
+
* metadata value that has multiple values. See: https://bit.ly/2SC9c2u
|
|
16
|
+
* @param {Key|string} [configuration.key=null] The key to use for rendering. The chord sheet will be
|
|
17
|
+
* transposed from the song's original key (as indicated by the `{key}` directive) to the specified key.
|
|
18
|
+
* Note that transposing will only work if the original song key is set.
|
|
19
|
+
* @param {boolean} [configuration.expandChorusDirective=false] Whether or not to expand `{chorus}` directives
|
|
20
|
+
* by rendering the last defined chorus inline after the directive.
|
|
21
|
+
* @param {boolean} [configuration.useUnicodeModifiers=false] Whether or not to use unicode flat and sharp
|
|
22
|
+
* symbols.
|
|
23
|
+
* @param {boolean} [configuration.normalizeChords=true] Whether or not to automatically normalize chords
|
|
24
|
+
*/
|
|
25
|
+
constructor(configuration?: DeepPartial<T>);
|
|
26
|
+
/**
|
|
27
|
+
* Configure the formatter with new options
|
|
28
|
+
* @param {DeepPartial<T>} config New configuration options
|
|
29
|
+
* @returns {this} The formatter instance for chaining
|
|
30
|
+
*/
|
|
31
|
+
configure(config: DeepPartial<T>): this;
|
|
32
|
+
/**
|
|
33
|
+
* Get the default configuration for this formatter type
|
|
34
|
+
* Should be implemented by subclasses to return the appropriate default configuration
|
|
35
|
+
*/
|
|
36
|
+
protected getDefaultConfiguration(): T;
|
|
37
|
+
}
|
|
38
|
+
export default Formatter;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import HtmlFormatter, { CSS, Template } from './html_formatter';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.
|
|
4
|
+
*/
|
|
5
|
+
declare class HtmlDivFormatter extends HtmlFormatter {
|
|
6
|
+
get template(): Template;
|
|
7
|
+
get defaultCss(): CSS;
|
|
8
|
+
}
|
|
9
|
+
export default HtmlDivFormatter;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Formatter from './formatter';
|
|
2
|
+
import Metadata from '../chord_sheet/metadata';
|
|
3
|
+
import Paragraph from '../chord_sheet/paragraph';
|
|
4
|
+
import Song from '../chord_sheet/song';
|
|
5
|
+
import { HTMLFormatterConfiguration, HtmlTemplateCssClasses } from './configuration';
|
|
6
|
+
export interface HtmlTemplateArgs {
|
|
7
|
+
configuration: HTMLFormatterConfiguration;
|
|
8
|
+
song: Song;
|
|
9
|
+
metadata: Metadata;
|
|
10
|
+
renderBlankLines?: boolean;
|
|
11
|
+
bodyParagraphs: Paragraph[];
|
|
12
|
+
}
|
|
13
|
+
export type Template = (_args: HtmlTemplateArgs) => string;
|
|
14
|
+
export type CSS = Record<string, Record<string, string>>;
|
|
15
|
+
export declare const defaultCssClasses: HtmlTemplateCssClasses;
|
|
16
|
+
/**
|
|
17
|
+
* Acts as a base class for HTML formatters
|
|
18
|
+
*/
|
|
19
|
+
declare abstract class HtmlFormatter extends Formatter<HTMLFormatterConfiguration> {
|
|
20
|
+
/**
|
|
21
|
+
* Get the default configuration for HTML formatter
|
|
22
|
+
* Uses the HTML-specific default configuration from the configuration manager
|
|
23
|
+
*/
|
|
24
|
+
protected getDefaultConfiguration(): HTMLFormatterConfiguration;
|
|
25
|
+
/**
|
|
26
|
+
* Formats a song into HTML.
|
|
27
|
+
* @param {Song} song The song to be formatted
|
|
28
|
+
* @returns {string} The HTML string
|
|
29
|
+
*/
|
|
30
|
+
format(song: Song): string;
|
|
31
|
+
/**
|
|
32
|
+
* Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output
|
|
33
|
+
*
|
|
34
|
+
* For example, execute cssString('.chordSheetViewer') will result in CSS like:
|
|
35
|
+
*
|
|
36
|
+
* .chordSheetViewer .paragraph {
|
|
37
|
+
* margin-bottom: 1em;
|
|
38
|
+
* }
|
|
39
|
+
*
|
|
40
|
+
* @param scope the CSS scope to use, for example `.chordSheetViewer`
|
|
41
|
+
* @returns {string} the CSS string
|
|
42
|
+
*/
|
|
43
|
+
cssString(scope?: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Basic CSS, in object style à la useStyles, to use with the HTML output
|
|
46
|
+
* For a CSS string see {@link cssString}
|
|
47
|
+
*
|
|
48
|
+
* Example:
|
|
49
|
+
*
|
|
50
|
+
* '.paragraph': {
|
|
51
|
+
* marginBottom: '1em'
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* @return {Object.<string, Object.<string, string>>} the CSS object
|
|
55
|
+
*/
|
|
56
|
+
get cssObject(): CSS;
|
|
57
|
+
abstract get defaultCss(): CSS;
|
|
58
|
+
abstract get template(): Template;
|
|
59
|
+
}
|
|
60
|
+
export default HtmlFormatter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import HtmlFormatter, { CSS, Template } from './html_formatter';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like
|
|
4
|
+
* PDF conversion.
|
|
5
|
+
*/
|
|
6
|
+
declare class HtmlTableFormatter extends HtmlFormatter {
|
|
7
|
+
get template(): Template;
|
|
8
|
+
get defaultCss(): CSS;
|
|
9
|
+
}
|
|
10
|
+
export default HtmlTableFormatter;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { MeasuredHtmlFormatterConfiguration } from './configuration';
|
|
2
|
+
import MeasurementBasedFormatter from './measurement_based_formatter';
|
|
3
|
+
import Song from '../chord_sheet/song';
|
|
4
|
+
declare type HTMLElement = any;
|
|
5
|
+
/**
|
|
6
|
+
* MeasuredHtmlFormatter formats a song into HTML with absolute positioning.
|
|
7
|
+
*/
|
|
8
|
+
declare class MeasuredHtmlFormatter extends MeasurementBasedFormatter<MeasuredHtmlFormatterConfiguration> {
|
|
9
|
+
private song;
|
|
10
|
+
private renderer;
|
|
11
|
+
private readonly container;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new HTML formatter
|
|
14
|
+
* @param container The HTML container element to render into
|
|
15
|
+
*/
|
|
16
|
+
constructor(container: HTMLElement);
|
|
17
|
+
/**
|
|
18
|
+
* Get the default configuration for HTML formatter
|
|
19
|
+
*/
|
|
20
|
+
protected getDefaultConfiguration(): MeasuredHtmlFormatterConfiguration;
|
|
21
|
+
/**
|
|
22
|
+
* Formats a song into HTML with absolute positioning.
|
|
23
|
+
* @param song - The song to format.
|
|
24
|
+
*/
|
|
25
|
+
format(song: Song): void;
|
|
26
|
+
/**
|
|
27
|
+
* Create the layout engine with the appropriate configuration
|
|
28
|
+
*/
|
|
29
|
+
private createLayoutEngine;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the HTML output
|
|
32
|
+
*/
|
|
33
|
+
getHTML(): HTMLElement;
|
|
34
|
+
/**
|
|
35
|
+
* Generates HTML as a string
|
|
36
|
+
*/
|
|
37
|
+
getHTMLString(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Clean up resources when the formatter is no longer needed
|
|
40
|
+
*/
|
|
41
|
+
dispose(): void;
|
|
42
|
+
}
|
|
43
|
+
export default MeasuredHtmlFormatter;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DeepPartial } from '../utilities';
|
|
2
|
+
import Formatter from './formatter';
|
|
3
|
+
import { MeasurementBasedFormatterConfiguration } from './configuration';
|
|
4
|
+
/**
|
|
5
|
+
* Base formatter for formatters that need measurements to position elements
|
|
6
|
+
*/
|
|
7
|
+
declare abstract class MeasurementBasedFormatter<T extends MeasurementBasedFormatterConfiguration = MeasurementBasedFormatterConfiguration> extends Formatter<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Instantiate a measurement-based formatter.
|
|
10
|
+
* @param configuration - The formatter configuration.
|
|
11
|
+
*/
|
|
12
|
+
constructor(configuration?: DeepPartial<T>);
|
|
13
|
+
/**
|
|
14
|
+
* Get the default configuration for this formatter type
|
|
15
|
+
* Uses the measurement-based default configuration
|
|
16
|
+
*/
|
|
17
|
+
protected getDefaultConfiguration(): T;
|
|
18
|
+
}
|
|
19
|
+
export default MeasurementBasedFormatter;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ImageCompression, jsPDFOptions } from 'jspdf';
|
|
2
|
+
import { PdfConstructor } from './types';
|
|
3
|
+
import { FontConfiguration, LineStyle } from '../configuration';
|
|
4
|
+
declare class DocWrapper {
|
|
5
|
+
currentPage: number;
|
|
6
|
+
fontConfiguration: FontConfiguration;
|
|
7
|
+
totalPages: number;
|
|
8
|
+
doc: any;
|
|
9
|
+
static setup(docConstructor: PdfConstructor, options?: jsPDFOptions): DocWrapper;
|
|
10
|
+
constructor(DocConstructor: PdfConstructor, options: jsPDFOptions);
|
|
11
|
+
get pageSize(): {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
save(filename: string): void;
|
|
16
|
+
output(): any;
|
|
17
|
+
eachPage(callback: () => void): void;
|
|
18
|
+
newPage(): void;
|
|
19
|
+
setPage(page: number): void;
|
|
20
|
+
setFont(fontName: string, fontStyle?: string, fontWeight?: string | number): void;
|
|
21
|
+
getFont(): any;
|
|
22
|
+
getFontSize(): any;
|
|
23
|
+
getFillColor(): any;
|
|
24
|
+
setFillColor(color: number | string): void;
|
|
25
|
+
setFontStyle(styleConfig: FontConfiguration): void;
|
|
26
|
+
setFontSize(size: number): void;
|
|
27
|
+
withFontConfiguration(fontConfiguration: FontConfiguration | null, callback: () => any): any;
|
|
28
|
+
setTextColor(color: string | number): void;
|
|
29
|
+
getTextDimensions(text: string, fontStyle?: FontConfiguration): {
|
|
30
|
+
w: number;
|
|
31
|
+
h: number;
|
|
32
|
+
};
|
|
33
|
+
getTextWidth(text: string, fontStyle?: FontConfiguration): number;
|
|
34
|
+
getTextHeight(text: string, fontStyle?: FontConfiguration): number;
|
|
35
|
+
getSpaceWidth(): number;
|
|
36
|
+
text(text: string, x: number, y: number, style?: FontConfiguration): void;
|
|
37
|
+
setDrawColor(color: number | string): void;
|
|
38
|
+
setLineWidth(width: number): void;
|
|
39
|
+
splitTextToSize(text: string | null, maxWidth: number, fontStyle?: FontConfiguration): any;
|
|
40
|
+
addImage(imageData: string, format: string, x: number, y: number, width: number, height: number, alias?: string, compression?: ImageCompression, rotation?: number): void;
|
|
41
|
+
setLineStyle(style: LineStyle): void;
|
|
42
|
+
resetDash(): void;
|
|
43
|
+
line(x1: number, y1: number, x2: number, y2: number): void;
|
|
44
|
+
circle(x: number, y: number, r: number, style?: string | null): void;
|
|
45
|
+
roundedRect(x: number, y: number, w: number, h: number, rx: number, ry: number, style?: string | null): void;
|
|
46
|
+
rect(x: number, y: number, w: number, h: number, style?: string | null): void;
|
|
47
|
+
withDrawColor(drawColor: number | string, callback: () => void): void;
|
|
48
|
+
withFillColor(fillColor: number | string, callback: () => void): void;
|
|
49
|
+
withFontSize(fontSize: number, callback: () => void): void;
|
|
50
|
+
withLineWidth(lineWidth: number, callback: () => void): void;
|
|
51
|
+
private addFonts;
|
|
52
|
+
}
|
|
53
|
+
export default DocWrapper;
|