@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,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placeholder Processing System
|
|
3
|
+
* Handles dynamic content replacement in text with support for rich text formatting
|
|
4
|
+
*/
|
|
5
|
+
import { TextRun, ExternalHyperlink, InternalHyperlink } from 'docx';
|
|
6
|
+
import { TextStyle } from './textParser';
|
|
7
|
+
type ParagraphChild = TextRun | ExternalHyperlink | InternalHyperlink;
|
|
8
|
+
/**
|
|
9
|
+
* Placeholder handler function type
|
|
10
|
+
*/
|
|
11
|
+
export type PlaceholderHandler = (_context?: PlaceholderContext) => TextRun | TextRun[] | string;
|
|
12
|
+
/**
|
|
13
|
+
* Context passed to placeholder handlers
|
|
14
|
+
*/
|
|
15
|
+
export interface PlaceholderContext {
|
|
16
|
+
style?: TextStyle;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Placeholder registry for managing dynamic content
|
|
21
|
+
*/
|
|
22
|
+
export declare class PlaceholderRegistry {
|
|
23
|
+
private static handlers;
|
|
24
|
+
/**
|
|
25
|
+
* Register a placeholder handler
|
|
26
|
+
*/
|
|
27
|
+
static register(name: string, handler: PlaceholderHandler): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get a placeholder handler
|
|
30
|
+
*/
|
|
31
|
+
static get(name: string): PlaceholderHandler | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Check if a placeholder is registered
|
|
34
|
+
*/
|
|
35
|
+
static has(name: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Get all registered placeholder names
|
|
38
|
+
*/
|
|
39
|
+
static getRegisteredNames(): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Clear all registered placeholders
|
|
42
|
+
*/
|
|
43
|
+
static clear(): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Process text containing placeholders and return array of paragraph children
|
|
47
|
+
*/
|
|
48
|
+
export declare function processPlaceholders(text: string, baseStyle?: TextStyle, context?: PlaceholderContext): ParagraphChild[];
|
|
49
|
+
/**
|
|
50
|
+
* Process text with both decorators and placeholders
|
|
51
|
+
*/
|
|
52
|
+
export declare function processTextWithPlaceholders(text: string, baseStyle?: TextStyle, context?: PlaceholderContext): ParagraphChild[];
|
|
53
|
+
/**
|
|
54
|
+
* Initialize built-in placeholders
|
|
55
|
+
*/
|
|
56
|
+
export declare function initializeBuiltinPlaceholders(): void;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=placeholderProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholderProcessor.d.ts","sourceRoot":"","sources":["../../src/utils/placeholderProcessor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,OAAO,EAEP,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,MAAM,CAAC;AACd,OAAO,EAA2B,SAAS,EAAE,MAAM,cAAc,CAAC;AAIlE,KAAK,cAAc,GAAG,OAAO,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,QAAQ,CAAC,EAAE,kBAAkB,KAC1B,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAyC;IAEhE;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIhE;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIxD;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;OAEG;IACH,MAAM,CAAC,kBAAkB,IAAI,MAAM,EAAE;IAIrC;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;CAGrB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAc,EACzB,OAAO,GAAE,kBAAuB,GAC/B,cAAc,EAAE,CAgDlB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAc,EACzB,OAAO,GAAE,kBAAuB,GAC/B,cAAc,EAAE,CA6FlB;AAmCD;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAsEpD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TextRun, ExternalHyperlink, InternalHyperlink } from 'docx';
|
|
2
|
+
import { PlaceholderContext } from './placeholderProcessor';
|
|
3
|
+
export interface TextStyle {
|
|
4
|
+
font?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
bold?: boolean;
|
|
8
|
+
italics?: boolean;
|
|
9
|
+
underline?: {
|
|
10
|
+
type?: 'single' | 'double' | 'thick' | 'dotted' | 'dash' | 'dotDash' | 'dotDotDash' | 'wave' | 'none' | 'words' | 'dottedHeavy' | 'dashedHeavy' | 'dashLong' | 'dashLongHeavy' | 'dashDotHeavy' | 'dashDotDotHeavy' | 'wavyHeavy' | 'wavyDouble';
|
|
11
|
+
color?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface TextDecoratorOptions {
|
|
15
|
+
boldColor?: string;
|
|
16
|
+
placeholderContext?: PlaceholderContext;
|
|
17
|
+
enableHyperlinks?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parses text with inline markdown-style decorators, placeholders, and newlines, returning an array of TextRun objects
|
|
21
|
+
* Supports:
|
|
22
|
+
* - **bold** or __bold__
|
|
23
|
+
* - *italic* or _italic_
|
|
24
|
+
* - ***bold italic*** or ___bold italic___
|
|
25
|
+
* - \n for line breaks
|
|
26
|
+
* - {PLACEHOLDER} for dynamic content
|
|
27
|
+
* - [link text](url) for hyperlinks (when enableHyperlinks is true)
|
|
28
|
+
*
|
|
29
|
+
* @param text The text to parse
|
|
30
|
+
* @param baseStyle The base style to apply to all text runs
|
|
31
|
+
* @param options Additional options for text decoration
|
|
32
|
+
* @returns Array of TextRun and hyperlink objects with appropriate styling
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseTextWithDecorators(text: string, baseStyle?: TextStyle, options?: TextDecoratorOptions): (TextRun | ExternalHyperlink | InternalHyperlink)[];
|
|
35
|
+
//# sourceMappingURL=textParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textParser.d.ts","sourceRoot":"","sources":["../../src/utils/textParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACrE,OAAO,EAEL,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EACD,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,YAAY,GACZ,MAAM,GACN,MAAM,GACN,OAAO,GACP,aAAa,GACb,aAAa,GACb,UAAU,GACV,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,WAAW,GACX,YAAY,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAc,EACzB,OAAO,GAAE,oBAAyB,GACjC,CAAC,OAAO,GAAG,iBAAiB,GAAG,iBAAiB,CAAC,EAAE,CAmGrD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize text to NFC so composed accented characters are preserved
|
|
3
|
+
* consistently across DOCX renderers (including LibreOffice).
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeUnicodeText(text: string | null | undefined): string;
|
|
6
|
+
//# sourceMappingURL=unicode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unicode.d.ts","sourceRoot":"","sources":["../../src/utils/unicode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warnings Document Generator
|
|
3
|
+
* Utility to generate a document from generation warnings
|
|
4
|
+
*/
|
|
5
|
+
import type { GenerationWarning } from '@json-to-office/shared-docx';
|
|
6
|
+
import type { ReportComponentDefinition } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Generate a report document from warnings
|
|
9
|
+
* Returns null if there are no warnings
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateWarningsDocument(warnings: GenerationWarning[] | null): ReportComponentDefinition | null;
|
|
12
|
+
/**
|
|
13
|
+
* Format warnings as plain text
|
|
14
|
+
* Useful for logging or text output
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatWarningsText(warnings: GenerationWarning[] | null): string;
|
|
17
|
+
//# sourceMappingURL=warningsDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warningsDocument.d.ts","sourceRoot":"","sources":["../../src/utils/warningsDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAuB,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,IAAI,GACnC,yBAAyB,GAAG,IAAI,CA+ElC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,IAAI,GACnC,MAAM,CAoCR"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ThemeConfig } from '../styles';
|
|
2
|
+
/**
|
|
3
|
+
* Compute available page width in twips (page width minus left/right margins)
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAvailableWidthTwips(theme?: ThemeConfig, themeName?: string): number;
|
|
6
|
+
/**
|
|
7
|
+
* Compute full page width in twips (ignores margins)
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPageWidthTwips(theme?: ThemeConfig, themeName?: string): number;
|
|
10
|
+
/**
|
|
11
|
+
* Compute available page height in twips (page height minus top/bottom margins)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAvailableHeightTwips(theme?: ThemeConfig, themeName?: string): number;
|
|
14
|
+
/**
|
|
15
|
+
* Compute full page height in twips (ignores margins)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getPageHeightTwips(theme?: ThemeConfig, themeName?: string): number;
|
|
18
|
+
/**
|
|
19
|
+
* Parse a percentage string like "75%" into a fraction 0..1
|
|
20
|
+
*/
|
|
21
|
+
export declare function parsePercentageStringToFraction(value: string): number | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Convert a numeric (points) or percentage string to twips using available width
|
|
24
|
+
*/
|
|
25
|
+
export declare function relativeLengthToTwips(value: number | string, availableWidthTwips: number): number;
|
|
26
|
+
export declare const __widthUtils = true;
|
|
27
|
+
//# sourceMappingURL=widthUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widthUtils.d.ts","sourceRoot":"","sources":["../../src/utils/widthUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIxC;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,CAAC,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAMpB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,mBAAmB,EAAE,MAAM,GAC1B,MAAM,CAOR;AAED,eAAO,MAAM,YAAY,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@json-to-office/core-docx",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Core DOCX document generation engine",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./*": {
|
|
15
|
+
"types": "./dist/*.d.ts",
|
|
16
|
+
"import": "./dist/*.js",
|
|
17
|
+
"default": "./dist/*.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@sinclair/typebox": "0.34.38",
|
|
22
|
+
"adm-zip": "0.5.16",
|
|
23
|
+
"date-fns": "3.6.0",
|
|
24
|
+
"jszip": "3.10.1",
|
|
25
|
+
"probe-image-size": "7.2.3",
|
|
26
|
+
"@json-to-office/shared": "^0.1.0",
|
|
27
|
+
"@json-to-office/shared-docx": "^0.1.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"docx": "9.5.1",
|
|
31
|
+
"highcharts-export-server": "5.0.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"highcharts-export-server": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/adm-zip": "0.5.7",
|
|
40
|
+
"@types/jszip": "3.4.1",
|
|
41
|
+
"@types/node": "20.11.0",
|
|
42
|
+
"@types/probe-image-size": "7.2.4",
|
|
43
|
+
"tsup": "8.5.0",
|
|
44
|
+
"typescript": "5.3.3"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"author": "Paolo Barbato",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/Wiseair-srl/json-to-office.git",
|
|
51
|
+
"directory": "packages/core-docx"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/Wiseair-srl/json-to-office/tree/main/packages/core-docx",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/Wiseair-srl/json-to-office/issues"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"files": [
|
|
61
|
+
"dist",
|
|
62
|
+
"LICENSE"
|
|
63
|
+
],
|
|
64
|
+
"keywords": [
|
|
65
|
+
"json-to-office",
|
|
66
|
+
"typescript",
|
|
67
|
+
"docx",
|
|
68
|
+
"document",
|
|
69
|
+
"word"
|
|
70
|
+
],
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=20.0.0"
|
|
73
|
+
},
|
|
74
|
+
"scripts": {
|
|
75
|
+
"build": "tsup && tsc --emitDeclarationOnly --declaration",
|
|
76
|
+
"build:js": "tsup",
|
|
77
|
+
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
78
|
+
"dev": "tsup --watch",
|
|
79
|
+
"clean": "rm -rf dist",
|
|
80
|
+
"lint": "eslint src/**/*.ts",
|
|
81
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
82
|
+
"format": "prettier --write src/**/*.ts",
|
|
83
|
+
"typecheck": "tsc --noEmit",
|
|
84
|
+
"test": "vitest run --passWithNoTests",
|
|
85
|
+
"test:watch": "vitest",
|
|
86
|
+
"test:coverage": "vitest run --coverage --passWithNoTests"
|
|
87
|
+
}
|
|
88
|
+
}
|