@json-to-office/core-docx 0.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.
- package/LICENSE +18 -0
- package/README.md +9 -0
- package/dist/cache/index.d.ts +7 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/key-generator.d.ts +34 -0
- package/dist/cache/key-generator.d.ts.map +1 -0
- package/dist/components/columns.d.ts +12 -0
- package/dist/components/columns.d.ts.map +1 -0
- package/dist/components/footer.d.ts +12 -0
- package/dist/components/footer.d.ts.map +1 -0
- package/dist/components/header.d.ts +12 -0
- package/dist/components/header.d.ts.map +1 -0
- package/dist/components/heading.d.ts +12 -0
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/highcharts.d.ts +21 -0
- package/dist/components/highcharts.d.ts.map +1 -0
- package/dist/components/image.d.ts +12 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/list.d.ts +12 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/paragraph.d.ts +12 -0
- package/dist/components/paragraph.d.ts.map +1 -0
- package/dist/components/section.d.ts +12 -0
- package/dist/components/section.d.ts.map +1 -0
- package/dist/components/statistic.d.ts +12 -0
- package/dist/components/statistic.d.ts.map +1 -0
- package/dist/components/table.d.ts +13 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/text-box.d.ts +9 -0
- package/dist/components/text-box.d.ts.map +1 -0
- package/dist/components/text-space-after.d.ts +35 -0
- package/dist/components/text-space-after.d.ts.map +1 -0
- package/dist/components/toc/index.d.ts +30 -0
- package/dist/components/toc/index.d.ts.map +1 -0
- package/dist/core/cached-render.d.ts +46 -0
- package/dist/core/cached-render.d.ts.map +1 -0
- package/dist/core/content.d.ts +263 -0
- package/dist/core/content.d.ts.map +1 -0
- package/dist/core/generator.d.ts +93 -0
- package/dist/core/generator.d.ts.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/layout.d.ts +107 -0
- package/dist/core/layout.d.ts.map +1 -0
- package/dist/core/render.d.ts +26 -0
- package/dist/core/render.d.ts.map +1 -0
- package/dist/core/structure.d.ts +67 -0
- package/dist/core/structure.d.ts.map +1 -0
- package/dist/examples/test-spacing-debug.d.ts +2 -0
- package/dist/examples/test-spacing-debug.d.ts.map +1 -0
- package/dist/examples/test-spacing.d.ts +6 -0
- package/dist/examples/test-spacing.d.ts.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7726 -0
- package/dist/index.js.map +1 -0
- package/dist/json/filesystem.d.ts +81 -0
- package/dist/json/filesystem.d.ts.map +1 -0
- package/dist/json/index.d.ts +6 -0
- package/dist/json/index.d.ts.map +1 -0
- package/dist/json/normalizer.d.ts +30 -0
- package/dist/json/normalizer.d.ts.map +1 -0
- package/dist/json/parser.d.ts +9 -0
- package/dist/json/parser.d.ts.map +1 -0
- package/dist/plugin/createComponent.d.ts +113 -0
- package/dist/plugin/createComponent.d.ts.map +1 -0
- package/dist/plugin/createDocumentGenerator.d.ts +18 -0
- package/dist/plugin/createDocumentGenerator.d.ts.map +1 -0
- package/dist/plugin/example/columns-layout.component.d.ts +29 -0
- package/dist/plugin/example/columns-layout.component.d.ts.map +1 -0
- package/dist/plugin/example/index.d.ts +6 -0
- package/dist/plugin/example/index.d.ts.map +1 -0
- package/dist/plugin/example/index.js +7449 -0
- package/dist/plugin/example/index.js.map +1 -0
- package/dist/plugin/example/nested-section.component.d.ts +16 -0
- package/dist/plugin/example/nested-section.component.d.ts.map +1 -0
- package/dist/plugin/example/plugin-demo.json +103 -0
- package/dist/plugin/example/text-space-after.component.d.ts +22 -0
- package/dist/plugin/example/text-space-after.component.d.ts.map +1 -0
- package/dist/plugin/example/weather.component.d.ts +29 -0
- package/dist/plugin/example/weather.component.d.ts.map +1 -0
- package/dist/plugin/index.d.ts +35 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/schema.d.ts +30 -0
- package/dist/plugin/schema.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +144 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin/validation.d.ts +45 -0
- package/dist/plugin/validation.d.ts.map +1 -0
- package/dist/plugin/version-resolver.d.ts +10 -0
- package/dist/plugin/version-resolver.d.ts.map +1 -0
- package/dist/styles/index.d.ts +13 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/theme-resolver.d.ts +6 -0
- package/dist/styles/theme-resolver.d.ts.map +1 -0
- package/dist/styles/theme-validator.d.ts +7 -0
- package/dist/styles/theme-validator.d.ts.map +1 -0
- package/dist/styles/themeToDocxAdapter.d.ts +22 -0
- package/dist/styles/themeToDocxAdapter.d.ts.map +1 -0
- package/dist/styles/utils/borderUtils.d.ts +88 -0
- package/dist/styles/utils/borderUtils.d.ts.map +1 -0
- package/dist/styles/utils/cellUtils.d.ts +55 -0
- package/dist/styles/utils/cellUtils.d.ts.map +1 -0
- package/dist/styles/utils/colorUtils.d.ts +27 -0
- package/dist/styles/utils/colorUtils.d.ts.map +1 -0
- package/dist/styles/utils/componentDefaults.d.ts +97 -0
- package/dist/styles/utils/componentDefaults.d.ts.map +1 -0
- package/dist/styles/utils/layoutUtils.d.ts +87 -0
- package/dist/styles/utils/layoutUtils.d.ts.map +1 -0
- package/dist/styles/utils/styleHelpers.d.ts +90 -0
- package/dist/styles/utils/styleHelpers.d.ts.map +1 -0
- package/dist/templates/documents/index.d.ts +34 -0
- package/dist/templates/documents/index.d.ts.map +1 -0
- package/dist/templates/documents/proposal.docx.json +171 -0
- package/dist/templates/documents/quarterly-report.docx.json +117 -0
- package/dist/templates/documents/technical-guide.docx.json +178 -0
- package/dist/templates/themes/corporate.docx.theme.json +118 -0
- package/dist/templates/themes/index.d.ts +5765 -0
- package/dist/templates/themes/index.d.ts.map +1 -0
- package/dist/templates/themes/minimal.docx.theme.json +194 -0
- package/dist/templates/themes/modern.docx.theme.json +115 -0
- package/dist/themes/defaults.d.ts +1300 -0
- package/dist/themes/defaults.d.ts.map +1 -0
- package/dist/themes/json/index.d.ts +44 -0
- package/dist/themes/json/index.d.ts.map +1 -0
- package/dist/themes/json/loader.d.ts +26 -0
- package/dist/themes/json/loader.d.ts.map +1 -0
- package/dist/themes/json/parser.d.ts +25 -0
- package/dist/themes/json/parser.d.ts.map +1 -0
- package/dist/themes/json/validator.d.ts +35 -0
- package/dist/themes/json/validator.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +158 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +67 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/utils/alignmentUtils.d.ts +10 -0
- package/dist/utils/alignmentUtils.d.ts.map +1 -0
- package/dist/utils/bookmarkRegistry.d.ts +49 -0
- package/dist/utils/bookmarkRegistry.d.ts.map +1 -0
- package/dist/utils/docxImagePositioning.d.ts +18 -0
- package/dist/utils/docxImagePositioning.d.ts.map +1 -0
- package/dist/utils/environment.d.ts +14 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/exampleRunner.d.ts +17 -0
- package/dist/utils/exampleRunner.d.ts.map +1 -0
- package/dist/utils/fixFloatingImageIds.d.ts +18 -0
- package/dist/utils/fixFloatingImageIds.d.ts.map +1 -0
- package/dist/utils/formatters.d.ts +2 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/imageUtils.d.ts +84 -0
- package/dist/utils/imageUtils.d.ts.map +1 -0
- package/dist/utils/numberingConfig.d.ts +84 -0
- package/dist/utils/numberingConfig.d.ts.map +1 -0
- package/dist/utils/placeholderImage.d.ts +31 -0
- package/dist/utils/placeholderImage.d.ts.map +1 -0
- package/dist/utils/placeholderProcessor.d.ts +58 -0
- package/dist/utils/placeholderProcessor.d.ts.map +1 -0
- package/dist/utils/textParser.d.ts +35 -0
- package/dist/utils/textParser.d.ts.map +1 -0
- package/dist/utils/unicode.d.ts +6 -0
- package/dist/utils/unicode.d.ts.map +1 -0
- package/dist/utils/warningsDocument.d.ts +17 -0
- package/dist/utils/warningsDocument.d.ts.map +1 -0
- package/dist/utils/widthUtils.d.ts +27 -0
- package/dist/utils/widthUtils.d.ts.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ISectionOptions } from 'docx';
|
|
2
|
+
import type { ThemeName } from '../styles';
|
|
3
|
+
import type { ComponentDefinition as SharedComponentDefinition, ReportComponent, SectionComponent, ColumnsComponent, HeadingComponent, ParagraphComponent, ImageComponent, HighchartsComponent, StatisticComponent, TableComponent, HeaderComponent, FooterComponent, ListComponent, TocComponent, TextBoxComponent, ReportProps as SharedReportProps, SectionProps as SharedSectionProps, HeadingProps as SharedHeadingProps, ParagraphProps as SharedParagraphProps, ColumnsProps as SharedColumnsProps, ImageProps as SharedImageProps, StatisticProps as SharedStatisticProps, TableProps as SharedTableProps, HeaderProps as SharedHeaderProps, FooterProps as SharedFooterProps, ListProps as SharedListProps, TocProps as SharedTocProps, TextBoxProps as SharedTextBoxProps } from '@json-to-office/shared-docx';
|
|
4
|
+
export { isReportComponent, isSectionComponent, isHeadingComponent, isParagraphComponent, isColumnsComponent, isImageComponent, isTextBoxComponent, isStatisticComponent, isTableComponent, isListComponent, isTocComponent, isHeaderComponent, isFooterComponent, isHighchartsComponent, } from '@json-to-office/shared-docx';
|
|
5
|
+
export type ComponentDefinition = SharedComponentDefinition;
|
|
6
|
+
export type ReportComponentDefinition = ReportComponent & {
|
|
7
|
+
/** Optional schema field for JSON validation */
|
|
8
|
+
$schema?: string;
|
|
9
|
+
};
|
|
10
|
+
export type SectionComponentDefinition = SectionComponent;
|
|
11
|
+
export type HeadingComponentDefinition = HeadingComponent;
|
|
12
|
+
export type ParagraphComponentDefinition = ParagraphComponent;
|
|
13
|
+
export type ColumnsComponentDefinition = ColumnsComponent;
|
|
14
|
+
export type ImageComponentDefinition = ImageComponent;
|
|
15
|
+
export type TextBoxComponentDefinition = TextBoxComponent;
|
|
16
|
+
export type StatisticComponentDefinition = StatisticComponent;
|
|
17
|
+
export type TableComponentDefinition = TableComponent;
|
|
18
|
+
export type HeaderComponentDefinition = HeaderComponent;
|
|
19
|
+
export type FooterComponentDefinition = FooterComponent;
|
|
20
|
+
export type ListComponentDefinition = ListComponent;
|
|
21
|
+
export type TocComponentDefinition = TocComponent;
|
|
22
|
+
export type StandardComponentDefinition = ReportComponent | SectionComponent | ColumnsComponent | HeadingComponent | ParagraphComponent | TextBoxComponent | ImageComponent | HighchartsComponent | StatisticComponent | TableComponent | HeaderComponent | FooterComponent | ListComponent | TocComponent;
|
|
23
|
+
export type ReportProps = SharedReportProps;
|
|
24
|
+
export type SectionProps = SharedSectionProps;
|
|
25
|
+
export type HeadingProps = SharedHeadingProps;
|
|
26
|
+
export type ParagraphProps = SharedParagraphProps;
|
|
27
|
+
export type ColumnsProps = SharedColumnsProps;
|
|
28
|
+
export type ImageProps = SharedImageProps;
|
|
29
|
+
export type TextBoxProps = SharedTextBoxProps;
|
|
30
|
+
export type StatisticProps = SharedStatisticProps;
|
|
31
|
+
export type TableProps = SharedTableProps;
|
|
32
|
+
export type HeaderProps = SharedHeaderProps;
|
|
33
|
+
export type FooterProps = SharedFooterProps;
|
|
34
|
+
export type ListProps = SharedListProps;
|
|
35
|
+
export type TocProps = SharedTocProps;
|
|
36
|
+
export type { ThemeName };
|
|
37
|
+
export interface ColumnSettings {
|
|
38
|
+
count: number;
|
|
39
|
+
equalWidth?: boolean;
|
|
40
|
+
space?: number;
|
|
41
|
+
/** Optional explicit column children with widths/spaces in twips */
|
|
42
|
+
children?: {
|
|
43
|
+
width?: number;
|
|
44
|
+
space?: number;
|
|
45
|
+
}[];
|
|
46
|
+
}
|
|
47
|
+
export interface PageSizeOptions {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}
|
|
51
|
+
export interface PageMarginOptions {
|
|
52
|
+
top: number;
|
|
53
|
+
right: number;
|
|
54
|
+
bottom: number;
|
|
55
|
+
left: number;
|
|
56
|
+
header?: number;
|
|
57
|
+
footer?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface PageNumberOptions {
|
|
60
|
+
start?: number;
|
|
61
|
+
formatType?: 'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'lowerLetter';
|
|
62
|
+
}
|
|
63
|
+
export interface PageBorderOptions {
|
|
64
|
+
top?: {
|
|
65
|
+
style: string;
|
|
66
|
+
size: number;
|
|
67
|
+
color: string;
|
|
68
|
+
};
|
|
69
|
+
right?: {
|
|
70
|
+
style: string;
|
|
71
|
+
size: number;
|
|
72
|
+
color: string;
|
|
73
|
+
};
|
|
74
|
+
bottom?: {
|
|
75
|
+
style: string;
|
|
76
|
+
size: number;
|
|
77
|
+
color: string;
|
|
78
|
+
};
|
|
79
|
+
left?: {
|
|
80
|
+
style: string;
|
|
81
|
+
size: number;
|
|
82
|
+
color: string;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export interface SectionProperties {
|
|
86
|
+
page?: {
|
|
87
|
+
size?: PageSizeOptions;
|
|
88
|
+
margin?: PageMarginOptions;
|
|
89
|
+
pageNumbers?: PageNumberOptions;
|
|
90
|
+
borders?: PageBorderOptions;
|
|
91
|
+
textDirection?: 'ltr' | 'rtl';
|
|
92
|
+
};
|
|
93
|
+
column?: ColumnSettings;
|
|
94
|
+
type?: 'continuous' | 'nextColumn' | 'nextPage' | 'evenPage' | 'oddPage';
|
|
95
|
+
headers?: ISectionOptions['headers'];
|
|
96
|
+
footers?: ISectionOptions['footers'];
|
|
97
|
+
}
|
|
98
|
+
export interface ImageContent {
|
|
99
|
+
path: string;
|
|
100
|
+
caption?: string;
|
|
101
|
+
width?: number;
|
|
102
|
+
height?: number;
|
|
103
|
+
alignment?: 'left' | 'center' | 'right';
|
|
104
|
+
}
|
|
105
|
+
export interface StatisticContent {
|
|
106
|
+
number: string;
|
|
107
|
+
description: string;
|
|
108
|
+
alignment?: 'left' | 'center' | 'right';
|
|
109
|
+
}
|
|
110
|
+
export interface TableData {
|
|
111
|
+
headers: string[];
|
|
112
|
+
rows: (string | SharedComponentDefinition)[][];
|
|
113
|
+
style?: 'minimal' | 'classic' | 'minimal';
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Rendering context for components
|
|
117
|
+
*/
|
|
118
|
+
export interface RenderContext {
|
|
119
|
+
theme: {
|
|
120
|
+
name: string;
|
|
121
|
+
colors: Record<string, string>;
|
|
122
|
+
fonts: Record<string, string>;
|
|
123
|
+
spacing: Record<string, number>;
|
|
124
|
+
};
|
|
125
|
+
/** Full theme configuration for custom components */
|
|
126
|
+
fullTheme: import('../styles').ThemeConfig;
|
|
127
|
+
document: {
|
|
128
|
+
title?: string;
|
|
129
|
+
subtitle?: string;
|
|
130
|
+
author?: string;
|
|
131
|
+
company?: string;
|
|
132
|
+
date: Date;
|
|
133
|
+
};
|
|
134
|
+
section: {
|
|
135
|
+
currentLayout: 'single' | 'multi-column';
|
|
136
|
+
columnCount: number;
|
|
137
|
+
pageNumber: number;
|
|
138
|
+
level?: number;
|
|
139
|
+
/** Bookmark ID for section-scoped TOCs (when TOC is inside a section) */
|
|
140
|
+
sectionBookmarkId?: string;
|
|
141
|
+
/** Heading level of the parent section title (used to exclude it from section-scoped TOCs) */
|
|
142
|
+
sectionTitleLevel?: number;
|
|
143
|
+
};
|
|
144
|
+
utils: {
|
|
145
|
+
formatDate: (_date: Date) => string;
|
|
146
|
+
parseText: (_text: string) => {
|
|
147
|
+
text: string;
|
|
148
|
+
}[];
|
|
149
|
+
getStyle: (_name: string) => {
|
|
150
|
+
name: string;
|
|
151
|
+
};
|
|
152
|
+
[key: string]: unknown;
|
|
153
|
+
};
|
|
154
|
+
parent?: SharedComponentDefinition;
|
|
155
|
+
depth: number;
|
|
156
|
+
custom?: Record<string, unknown>;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,KAAK,EACV,mBAAmB,IAAI,yBAAyB,EAChD,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,WAAW,IAAI,iBAAiB,EAChC,YAAY,IAAI,kBAAkB,EAClC,YAAY,IAAI,kBAAkB,EAClC,cAAc,IAAI,oBAAoB,EACtC,YAAY,IAAI,kBAAkB,EAClC,UAAU,IAAI,gBAAgB,EAC9B,cAAc,IAAI,oBAAoB,EACtC,UAAU,IAAI,gBAAgB,EAC9B,WAAW,IAAI,iBAAiB,EAChC,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,QAAQ,IAAI,cAAc,EAC1B,YAAY,IAAI,kBAAkB,EACnC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAC5D,MAAM,MAAM,yBAAyB,GAAG,eAAe,GAAG;IACxD,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,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,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin-specific type definitions
|
|
3
|
+
*/
|
|
4
|
+
import type { TSchema, Static } from '@sinclair/typebox';
|
|
5
|
+
import type { ComponentDefinition } from '@json-to-office/shared-docx';
|
|
6
|
+
import type { AddWarningFunction } from '@json-to-office/shared-docx';
|
|
7
|
+
import type { ThemeConfig } from '../styles';
|
|
8
|
+
/**
|
|
9
|
+
* Render function context - parameters passed to render
|
|
10
|
+
*/
|
|
11
|
+
export interface PluginRenderContext<T> {
|
|
12
|
+
/** The validated props for this component */
|
|
13
|
+
props: T;
|
|
14
|
+
/** The resolved theme configuration */
|
|
15
|
+
theme: ThemeConfig;
|
|
16
|
+
/** Function to add warnings during processing */
|
|
17
|
+
addWarning: AddWarningFunction;
|
|
18
|
+
/** For container components: processed nested children */
|
|
19
|
+
children?: unknown[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Render function that transforms custom component props into standard components.
|
|
23
|
+
* Returns a properly typed array of component definitions with full type inference.
|
|
24
|
+
*/
|
|
25
|
+
export type PluginRenderFunction<T> = (context: PluginRenderContext<T>) => Promise<ComponentDefinition[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Plugin component definition with automatic props type inference from schema
|
|
28
|
+
*/
|
|
29
|
+
export interface PluginComponent<TPropsSchema extends TSchema = TSchema> {
|
|
30
|
+
/** Unique name for the component type */
|
|
31
|
+
name: string;
|
|
32
|
+
/** TypeBox schema for props validation */
|
|
33
|
+
propsSchema: TPropsSchema;
|
|
34
|
+
/** Async render function to transform props into standard components */
|
|
35
|
+
render: PluginRenderFunction<Static<TPropsSchema>>;
|
|
36
|
+
/** Whether this component can contain nested `children` */
|
|
37
|
+
hasChildren?: boolean;
|
|
38
|
+
/** Optional description for documentation */
|
|
39
|
+
description?: string;
|
|
40
|
+
/** Optional version for compatibility tracking */
|
|
41
|
+
version?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Plugin validation error details
|
|
45
|
+
*/
|
|
46
|
+
export interface PluginValidationError {
|
|
47
|
+
/** Path to the error (e.g., "children[2].props.city") */
|
|
48
|
+
path: string;
|
|
49
|
+
/** Human-readable error message */
|
|
50
|
+
message: string;
|
|
51
|
+
/** Error code for programmatic handling */
|
|
52
|
+
code: string;
|
|
53
|
+
/** The actual value that failed validation */
|
|
54
|
+
value?: unknown;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Plugin validation result
|
|
58
|
+
*/
|
|
59
|
+
export interface PluginValidationResult<T = unknown> {
|
|
60
|
+
/** Whether validation succeeded */
|
|
61
|
+
success: boolean;
|
|
62
|
+
/** Validated and typed data */
|
|
63
|
+
data?: T;
|
|
64
|
+
/** List of validation errors if failed */
|
|
65
|
+
errors?: PluginValidationError[];
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,6CAA6C;IAC7C,KAAK,EAAE,CAAC,CAAC;IACT,uCAAuC;IACvC,KAAK,EAAE,WAAW,CAAC;IACnB,iDAAiD;IACjD,UAAU,EAAE,kBAAkB,CAAC;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CACpC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,YAAY,SAAS,OAAO,GAAG,OAAO;IACrE,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,WAAW,EAAE,YAAY,CAAC;IAC1B,wEAAwE;IACxE,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACnD,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO;IACjD,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,0CAA0C;IAC1C,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAC;CAClC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alignment Utilities
|
|
3
|
+
* Shared utilities for converting alignment strings to docx AlignmentType
|
|
4
|
+
*/
|
|
5
|
+
import { AlignmentType } from 'docx';
|
|
6
|
+
/**
|
|
7
|
+
* Convert alignment string to docx AlignmentType
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAlignment(alignment: string): (typeof AlignmentType)[keyof typeof AlignmentType];
|
|
10
|
+
//# sourceMappingURL=alignmentUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignmentUtils.d.ts","sourceRoot":"","sources":["../../src/utils/alignmentUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAErC;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,GAChB,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAWpD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bookmark Registry
|
|
3
|
+
* Utilities for managing document bookmarks for internal hyperlinks
|
|
4
|
+
*/
|
|
5
|
+
export interface BookmarkInfo {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Registry for managing document bookmarks
|
|
12
|
+
* Used to track bookmark IDs and validate internal hyperlink targets
|
|
13
|
+
*/
|
|
14
|
+
export declare class BookmarkRegistry {
|
|
15
|
+
private bookmarks;
|
|
16
|
+
private counter;
|
|
17
|
+
/**
|
|
18
|
+
* Register a bookmark
|
|
19
|
+
*/
|
|
20
|
+
register(id: string, title: string, type: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a unique bookmark ID from text
|
|
23
|
+
* Converts text to a URL-friendly format
|
|
24
|
+
*/
|
|
25
|
+
generateId(text: string, _type?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a bookmark exists
|
|
28
|
+
*/
|
|
29
|
+
exists(id: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Get bookmark info by ID
|
|
32
|
+
*/
|
|
33
|
+
get(id: string): BookmarkInfo | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get all registered bookmarks
|
|
36
|
+
*/
|
|
37
|
+
getAll(): BookmarkInfo[];
|
|
38
|
+
/**
|
|
39
|
+
* Clear all bookmarks
|
|
40
|
+
*/
|
|
41
|
+
clear(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Validate that all internal hyperlink references exist
|
|
44
|
+
* Returns array of missing bookmark IDs
|
|
45
|
+
*/
|
|
46
|
+
validateReferences(referencedIds: string[]): string[];
|
|
47
|
+
}
|
|
48
|
+
export declare const globalBookmarkRegistry: BookmarkRegistry;
|
|
49
|
+
//# sourceMappingURL=bookmarkRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookmarkRegistry.d.ts","sourceRoot":"","sources":["../../src/utils/bookmarkRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,OAAO,CAAK;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IASvD;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAAmB,GAAG,MAAM;IAkB5D;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI3B;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIzC;;OAEG;IACH,MAAM,IAAI,YAAY,EAAE;IAIxB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;OAGG;IACH,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;CAStD;AAGD,eAAO,MAAM,sBAAsB,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ImageProps } from '../types';
|
|
2
|
+
export type FloatingConfig = NonNullable<ImageProps['floating']>;
|
|
3
|
+
export declare function mapHorizontalRelative(rel?: FloatingConfig['horizontalPosition'] extends infer T ? T extends {
|
|
4
|
+
relative?: infer R;
|
|
5
|
+
} ? R : never : never): "page" | "margin" | "character" | "column" | undefined;
|
|
6
|
+
export declare function mapVerticalRelative(rel?: FloatingConfig['verticalPosition'] extends infer T ? T extends {
|
|
7
|
+
relative?: infer R;
|
|
8
|
+
} ? R : never : never): "page" | "paragraph" | "margin" | "line" | undefined;
|
|
9
|
+
export declare function mapHorizontalAlign(align?: 'left' | 'center' | 'right' | 'inside' | 'outside'): "left" | "right" | "center" | "inside" | "outside" | undefined;
|
|
10
|
+
export declare function mapVerticalAlign(align?: 'top' | 'center' | 'bottom' | 'inside' | 'outside'): "top" | "bottom" | "center" | "inside" | "outside" | undefined;
|
|
11
|
+
export declare function mapWrapType(type?: 'none' | 'square' | 'topAndBottom' | 'around' | 'through'): 0 | 1 | 2 | 3 | undefined;
|
|
12
|
+
export declare function mapWrapSide(side?: 'bothSides' | 'left' | 'right' | 'largest'): "left" | "right" | "bothSides" | "largest" | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Map shared floating config to docx ImageRun floating options.
|
|
15
|
+
* Also lifts wrap.margins (if present) to floating.margins as expected by docx.
|
|
16
|
+
*/
|
|
17
|
+
export declare function mapFloatingOptions(floating?: FloatingConfig): any | undefined;
|
|
18
|
+
//# sourceMappingURL=docxImagePositioning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docxImagePositioning.d.ts","sourceRoot":"","sources":["../../src/utils/docxImagePositioning.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;AAajE,wBAAgB,qBAAqB,CACnC,GAAG,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,SAAS,MAAM,CAAC,GACtD,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9B,CAAC,GACD,KAAK,GACP,KAAK,0DAcV;AAED,wBAAgB,mBAAmB,CACjC,GAAG,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,SAAS,MAAM,CAAC,GACpD,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9B,CAAC,GACD,KAAK,GACP,KAAK,wDAcV;AAED,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,kEAgB3D;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,kEAgB3D;AAED,wBAAgB,WAAW,CACzB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,GAAG,SAAS,6BAgBjE;AAED,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,0DAa5E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,GAAG,GAAG,SAAS,CAyH7E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment detection utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Check if the current environment is Node.js
|
|
6
|
+
* This is used to conditionally load Node.js-only modules
|
|
7
|
+
*/
|
|
8
|
+
export declare function isNodeEnvironment(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Check if Node.js built-in modules are available
|
|
11
|
+
* More specific check for modules that require Node.js built-ins
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasNodeBuiltins(): boolean;
|
|
14
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/utils/environment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAQ3C;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAazC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal example runner utility
|
|
3
|
+
* Provides common functionality for running examples
|
|
4
|
+
*/
|
|
5
|
+
import { ReportComponentDefinition } from '../types';
|
|
6
|
+
export interface ExampleRunnerOptions {
|
|
7
|
+
outputFilename?: string;
|
|
8
|
+
outputDir?: string;
|
|
9
|
+
verbose?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Run an example and generate a document
|
|
13
|
+
* @param example - The example definition to run
|
|
14
|
+
* @param options - Options for running the example
|
|
15
|
+
*/
|
|
16
|
+
export declare function runExample(example: ReportComponentDefinition, options?: ExampleRunnerOptions): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=exampleRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exampleRunner.d.ts","sourceRoot":"","sources":["../../src/utils/exampleRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,yBAAyB,EAClC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAsCf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-processing utility to fix docx.js floating image bugs
|
|
3
|
+
*
|
|
4
|
+
* The docx library (as of v9.5.1) has a known issue with floating images:
|
|
5
|
+
* 1. Duplicate wp:docPr IDs (GitHub issue #2719)
|
|
6
|
+
*
|
|
7
|
+
* Historical note: We previously also post-processed relativeHeight and
|
|
8
|
+
* wrapTight elements. Those steps were removed because we always provide a
|
|
9
|
+
* valid zIndex upstream and we do not support 'tight' wrapping.
|
|
10
|
+
*
|
|
11
|
+
* This utility extracts the DOCX, fixes duplicate IDs, and re-packages it.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Fix floating image issues in a generated DOCX file
|
|
15
|
+
* @param docxPath - Path to the DOCX file to fix
|
|
16
|
+
*/
|
|
17
|
+
export declare function fixFloatingImageIds(docxPath: string): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=fixFloatingImageIds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixFloatingImageIds.d.ts","sourceRoot":"","sources":["../../src/utils/fixFloatingImageIds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,SACf,IAAI,iBACI,MAAM,KACnB,MAEF,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export interface ImageDimensions {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CalculatedDimensions {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse width value - accepts either number (pixels) or percentage string
|
|
12
|
+
* @param width - Width value as number or percentage string (e.g., "90%")
|
|
13
|
+
* @param availableWidthPx - Available document width in pixels
|
|
14
|
+
* @returns Width in pixels
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseWidthValue(width: number | string, availableWidthPx: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Parse a generic dimension value (number in px or percentage string)
|
|
19
|
+
* @param value - numeric pixels or percentage string (e.g., "100%")
|
|
20
|
+
* @param availablePx - available pixels for percentage reference
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseDimensionValue(value: number | string, availablePx: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* Check if a string is a valid URL
|
|
25
|
+
*/
|
|
26
|
+
export declare function isValidUrl(string: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a string is a base64 data URI
|
|
29
|
+
* Supports format: data:image/[type];base64,[data]
|
|
30
|
+
*/
|
|
31
|
+
export declare function isBase64Image(string: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Decode base64 data URI to Buffer
|
|
34
|
+
* @param dataUri - Base64 data URI (e.g., "data:image/png;base64,iVBORw0KGgo...")
|
|
35
|
+
* @returns Decoded image buffer
|
|
36
|
+
*/
|
|
37
|
+
export declare function decodeBase64Image(dataUri: string): Buffer;
|
|
38
|
+
/**
|
|
39
|
+
* Extract MIME type from base64 data URI
|
|
40
|
+
* @param dataUri - Base64 data URI (e.g., "data:image/svg+xml;base64,...")
|
|
41
|
+
* @returns MIME type (e.g., "image/svg+xml") or undefined if not found
|
|
42
|
+
*/
|
|
43
|
+
export declare function extractMimeTypeFromDataUri(dataUri: string): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Detect image type from file extension
|
|
46
|
+
* @param path - File path or URL
|
|
47
|
+
* @returns Image type (jpg, png, gif, bmp, svg) or undefined
|
|
48
|
+
*/
|
|
49
|
+
export declare function detectImageTypeFromExtension(path: string): 'jpg' | 'png' | 'gif' | 'bmp' | 'svg' | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Detect image type from MIME type
|
|
52
|
+
* @param mimeType - MIME type string (e.g., "image/svg+xml", "image/png")
|
|
53
|
+
* @returns Image type (jpg, png, gif, bmp, svg) or undefined
|
|
54
|
+
*/
|
|
55
|
+
export declare function detectImageTypeFromMimeType(mimeType: string): 'jpg' | 'png' | 'gif' | 'bmp' | 'svg' | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Detect image type from path or base64 data URI
|
|
58
|
+
* Prioritizes: MIME type from base64 > file extension > default to 'png'
|
|
59
|
+
* @param imagePath - File path, URL, or base64 data URI
|
|
60
|
+
* @returns Image type (jpg, png, gif, bmp, svg)
|
|
61
|
+
*/
|
|
62
|
+
export declare function detectImageType(imagePath: string): 'jpg' | 'png' | 'gif' | 'bmp' | 'svg';
|
|
63
|
+
/**
|
|
64
|
+
* Download image from URL and return buffer
|
|
65
|
+
* Uses native fetch with automatic redirect following and proper headers
|
|
66
|
+
*/
|
|
67
|
+
export declare function downloadImageFromUrl(url: string): Promise<Buffer>;
|
|
68
|
+
/**
|
|
69
|
+
* Get image buffer from base64 data URI, URL, or local file
|
|
70
|
+
*/
|
|
71
|
+
export declare function getImageBuffer(imagePath: string): Promise<Buffer>;
|
|
72
|
+
/**
|
|
73
|
+
* Get the dimensions of an image file or URL
|
|
74
|
+
*/
|
|
75
|
+
export declare function getImageDimensions(imagePath: string): Promise<ImageDimensions>;
|
|
76
|
+
/**
|
|
77
|
+
* Calculate missing dimension while preserving aspect ratio
|
|
78
|
+
*/
|
|
79
|
+
export declare function calculateMissingDimension(originalWidth: number, originalHeight: number, targetWidth?: number, targetHeight?: number): CalculatedDimensions;
|
|
80
|
+
/**
|
|
81
|
+
* Calculate image dimensions with aspect ratio preservation and fallback constraints
|
|
82
|
+
*/
|
|
83
|
+
export declare function calculateImageDimensions(imagePath: string, targetWidth?: number, targetHeight?: number, fallbackWidth?: number, fallbackHeight?: number): Promise<CalculatedDimensions>;
|
|
84
|
+
//# sourceMappingURL=imageUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageUtils.d.ts","sourceRoot":"","sources":["../../src/utils/imageUtils.ts"],"names":[],"mappings":";AAIA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAuBR;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,WAAW,EAAE,MAAM,GAClB,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAazD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAGpB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,GACX,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAiBnD;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GACf,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAQnD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,GAChB,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAgBvC;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuCvE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWvE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC,CAkB1B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,GACpB,oBAAoB,CA0BtB;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,aAAa,GAAE,MAAY,EAC3B,cAAc,GAAE,MAAY,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CA+B/B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numbering Configuration Utilities
|
|
3
|
+
* Utilities for creating and managing docx numbering configurations
|
|
4
|
+
*/
|
|
5
|
+
import type { ILevelsOptions } from 'docx';
|
|
6
|
+
export interface ListLevelConfig {
|
|
7
|
+
level: number;
|
|
8
|
+
format?: string;
|
|
9
|
+
text?: string;
|
|
10
|
+
alignment?: string;
|
|
11
|
+
indent?: {
|
|
12
|
+
left?: number;
|
|
13
|
+
hanging?: number;
|
|
14
|
+
};
|
|
15
|
+
start?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface NumberingConfig {
|
|
18
|
+
reference: string;
|
|
19
|
+
levels: ListLevelConfig[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create numbering configuration from list config
|
|
23
|
+
* Returns a single config item that can be added to INumberingOptions.config array
|
|
24
|
+
*/
|
|
25
|
+
export declare function createNumberingConfig(config: NumberingConfig): {
|
|
26
|
+
levels: ILevelsOptions[];
|
|
27
|
+
reference: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Create a simple bullet list configuration
|
|
31
|
+
*/
|
|
32
|
+
export declare function createBulletListConfig(reference: string, bullet?: string): {
|
|
33
|
+
levels: ILevelsOptions[];
|
|
34
|
+
reference: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Create a simple numbered list configuration
|
|
38
|
+
*/
|
|
39
|
+
export declare function createNumberedListConfig(reference: string, start?: number): {
|
|
40
|
+
levels: ILevelsOptions[];
|
|
41
|
+
reference: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Registry for managing numbering configurations
|
|
45
|
+
*/
|
|
46
|
+
export declare class NumberingRegistry {
|
|
47
|
+
private configs;
|
|
48
|
+
private counter;
|
|
49
|
+
/**
|
|
50
|
+
* Register a numbering configuration
|
|
51
|
+
*/
|
|
52
|
+
register(config: {
|
|
53
|
+
levels: ILevelsOptions[];
|
|
54
|
+
reference: string;
|
|
55
|
+
}): string;
|
|
56
|
+
/**
|
|
57
|
+
* Generate a unique reference ID
|
|
58
|
+
*/
|
|
59
|
+
generateReference(prefix?: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Get all registered configurations as an array suitable for INumberingOptions
|
|
62
|
+
*/
|
|
63
|
+
getAll(): {
|
|
64
|
+
levels: ILevelsOptions[];
|
|
65
|
+
reference: string;
|
|
66
|
+
}[];
|
|
67
|
+
/**
|
|
68
|
+
* Clear all configurations
|
|
69
|
+
*/
|
|
70
|
+
clear(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Check if a reference exists
|
|
73
|
+
*/
|
|
74
|
+
has(reference: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Get a configuration by reference
|
|
77
|
+
*/
|
|
78
|
+
get(reference: string): {
|
|
79
|
+
levels: ILevelsOptions[];
|
|
80
|
+
reference: string;
|
|
81
|
+
} | undefined;
|
|
82
|
+
}
|
|
83
|
+
export declare const globalNumberingRegistry: NumberingRegistry;
|
|
84
|
+
//# sourceMappingURL=numberingConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberingConfig.d.ts","sourceRoot":"","sources":["../../src/utils/numberingConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAgF3C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAiDD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG;IAC9D,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CA8CA;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,MAAY,GACnB;IAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CASjD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,MAAU,GAChB;IAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CASjD;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAGD;IACd,OAAO,CAAC,OAAO,CAAK;IAEpB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAMzE;;OAEG;IACH,iBAAiB,CAAC,MAAM,GAAE,MAAe,GAAG,MAAM;IAIlD;;OAEG;IACH,MAAM,IAAI;QAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE;IAI3D;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI/B;;OAEG;IACH,GAAG,CACD,SAAS,EAAE,MAAM,GAChB;QAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;CAG/D;AAGD,eAAO,MAAM,uBAAuB,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placeholder Image Utility
|
|
3
|
+
* Provides an embedded placeholder image for charts when generation fails or assets are missing
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="node" />
|
|
6
|
+
/**
|
|
7
|
+
* Generate a placeholder image as a Buffer
|
|
8
|
+
* Returns a PNG buffer for compatibility with docx format
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPlaceholderImageBuffer(): Buffer;
|
|
11
|
+
/**
|
|
12
|
+
* Generate a placeholder image and save it to a temporary file
|
|
13
|
+
* Returns the path to the generated placeholder file (reuses existing if available)
|
|
14
|
+
*/
|
|
15
|
+
export declare function createPlaceholderImageFile(): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Get a PNG placeholder as base64-encoded data URL
|
|
18
|
+
* This is a minimal 1x1 transparent PNG for fallback scenarios
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPlaceholderDataUrl(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get a more detailed PNG placeholder as Buffer
|
|
23
|
+
* This creates a simple gray box with "Chart" text
|
|
24
|
+
*/
|
|
25
|
+
export declare function getPlaceholderPngBuffer(): Buffer;
|
|
26
|
+
/**
|
|
27
|
+
* Clean up placeholder files and cached paths
|
|
28
|
+
* Call this when the document generation is complete
|
|
29
|
+
*/
|
|
30
|
+
export declare function cleanupPlaceholders(): Promise<void>;
|
|
31
|
+
//# sourceMappingURL=placeholderImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholderImage.d.ts","sourceRoot":"","sources":["../../src/utils/placeholderImage.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AASH;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAGlD;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC,CA4ClE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAG9C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAMhD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BzD"}
|