@json-to-office/core-docx 0.38.0 → 1.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/dist/components/highcharts.d.ts +16 -6
- package/dist/components/highcharts.d.ts.map +1 -1
- package/dist/components/index.d.ts +8 -14
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/visual.d.ts +60 -18
- package/dist/components/visual.d.ts.map +1 -1
- package/dist/core/collectTocHeadings.d.ts +15 -1
- package/dist/core/collectTocHeadings.d.ts.map +1 -1
- package/dist/core/componentTransform.d.ts +30 -0
- package/dist/core/componentTransform.d.ts.map +1 -0
- package/dist/core/desugarExternals.d.ts +35 -0
- package/dist/core/desugarExternals.d.ts.map +1 -0
- package/dist/core/flattenVisuals.d.ts.map +1 -1
- package/dist/core/generateFromIr.d.ts +78 -0
- package/dist/core/generateFromIr.d.ts.map +1 -0
- package/dist/core/generationContext.d.ts +2 -2
- package/dist/core/generationContext.d.ts.map +1 -1
- package/dist/core/generator.d.ts +48 -39
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/imageResources.d.ts +35 -0
- package/dist/core/imageResources.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/layout.d.ts +15 -3
- package/dist/core/layout.d.ts.map +1 -1
- package/dist/core/markdownList.d.ts +21 -0
- package/dist/core/markdownList.d.ts.map +1 -0
- package/dist/core/prerasterizeVisuals.d.ts +2 -3
- package/dist/core/prerasterizeVisuals.d.ts.map +1 -1
- package/dist/core/sectionBookmarks.d.ts +15 -40
- package/dist/core/sectionBookmarks.d.ts.map +1 -1
- package/dist/core/tableModel.d.ts +188 -0
- package/dist/core/tableModel.d.ts.map +1 -0
- package/dist/core/tocField.d.ts +70 -0
- package/dist/core/tocField.d.ts.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8060 -7269
- package/dist/index.js.map +1 -1
- package/dist/ir/compiler.d.ts +49 -0
- package/dist/ir/compiler.d.ts.map +1 -0
- package/dist/ir/debug.d.ts +15 -0
- package/dist/ir/debug.d.ts.map +1 -0
- package/dist/ir/features.d.ts +19 -0
- package/dist/ir/features.d.ts.map +1 -0
- package/dist/ir/index.d.ts +16 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/inline.d.ts +126 -0
- package/dist/ir/inline.d.ts.map +1 -0
- package/dist/ir/types.d.ts +774 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/units.d.ts +57 -0
- package/dist/ir/units.d.ts.map +1 -0
- package/dist/ir/validation.d.ts +19 -0
- package/dist/ir/validation.d.ts.map +1 -0
- package/dist/plugin/createDocumentGenerator.d.ts +10 -3
- package/dist/plugin/createDocumentGenerator.d.ts.map +1 -1
- package/dist/plugin/example/index.d.ts.map +1 -1
- package/dist/plugin/example/index.js +8083 -7149
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/schema.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +13 -26
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/renderers/docxjs/emit.d.ts +41 -0
- package/dist/renderers/docxjs/emit.d.ts.map +1 -0
- package/dist/renderers/docxjs/index.d.ts +22 -0
- package/dist/renderers/docxjs/index.d.ts.map +1 -0
- package/dist/renderers/docxjs/styles.d.ts +12 -0
- package/dist/renderers/docxjs/styles.d.ts.map +1 -0
- package/dist/renderers/office-open/emit.d.ts +63 -0
- package/dist/renderers/office-open/emit.d.ts.map +1 -0
- package/dist/renderers/office-open/index.d.ts +25 -0
- package/dist/renderers/office-open/index.d.ts.map +1 -0
- package/dist/renderers/office-open/styles.d.ts +13 -0
- package/dist/renderers/office-open/styles.d.ts.map +1 -0
- package/dist/renderers/registry.d.ts +15 -0
- package/dist/renderers/registry.d.ts.map +1 -0
- package/dist/renderers/types.d.ts +35 -0
- package/dist/renderers/types.d.ts.map +1 -0
- package/dist/styles/themeToStyles.d.ts +12 -0
- package/dist/styles/themeToStyles.d.ts.map +1 -0
- package/dist/styles/utils/borderUtils.d.ts +13 -6
- package/dist/styles/utils/borderUtils.d.ts.map +1 -1
- package/dist/styles/utils/layoutUtils.d.ts +10 -14
- package/dist/styles/utils/layoutUtils.d.ts.map +1 -1
- package/dist/styles/utils/styleHelpers.d.ts +6 -2
- package/dist/styles/utils/styleHelpers.d.ts.map +1 -1
- package/dist/themes/overrides.d.ts +0 -2
- package/dist/themes/overrides.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +18 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/bookmarkRegistry.d.ts +13 -77
- package/dist/utils/bookmarkRegistry.d.ts.map +1 -1
- package/dist/utils/commentRegistry.d.ts +5 -43
- package/dist/utils/commentRegistry.d.ts.map +1 -1
- package/dist/utils/exampleRunner.d.ts.map +1 -1
- package/dist/utils/imageUtils.d.ts +23 -19
- package/dist/utils/imageUtils.d.ts.map +1 -1
- package/dist/utils/numberingConfig.d.ts +7 -87
- package/dist/utils/numberingConfig.d.ts.map +1 -1
- package/dist/utils/packageDocument.d.ts +0 -3
- package/dist/utils/packageDocument.d.ts.map +1 -1
- package/dist/utils/revisionUtils.d.ts +6 -67
- package/dist/utils/revisionUtils.d.ts.map +1 -1
- package/dist/utils/warningsDocument.d.ts.map +1 -1
- package/package.json +12 -4
- package/dist/cache/index.d.ts +0 -7
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/key-generator.d.ts +0 -34
- package/dist/cache/key-generator.d.ts.map +0 -1
- package/dist/components/columns.d.ts +0 -12
- package/dist/components/columns.d.ts.map +0 -1
- package/dist/components/heading.d.ts +0 -12
- package/dist/components/heading.d.ts.map +0 -1
- package/dist/components/image.d.ts +0 -12
- package/dist/components/image.d.ts.map +0 -1
- package/dist/components/list.d.ts +0 -12
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/paragraph.d.ts +0 -12
- package/dist/components/paragraph.d.ts.map +0 -1
- package/dist/components/section.d.ts +0 -12
- package/dist/components/section.d.ts.map +0 -1
- package/dist/components/statistic.d.ts +0 -12
- package/dist/components/statistic.d.ts.map +0 -1
- package/dist/components/table.d.ts +0 -13
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/text-box.d.ts +0 -9
- package/dist/components/text-box.d.ts.map +0 -1
- package/dist/components/toc/index.d.ts +0 -30
- package/dist/components/toc/index.d.ts.map +0 -1
- package/dist/core/cached-render.d.ts +0 -92
- package/dist/core/cached-render.d.ts.map +0 -1
- package/dist/core/content.d.ts +0 -319
- package/dist/core/content.d.ts.map +0 -1
- package/dist/core/render.d.ts +0 -48
- package/dist/core/render.d.ts.map +0 -1
- package/dist/styles/themeToDocxAdapter.d.ts +0 -22
- package/dist/styles/themeToDocxAdapter.d.ts.map +0 -1
- package/dist/styles/utils/cellUtils.d.ts +0 -55
- package/dist/styles/utils/cellUtils.d.ts.map +0 -1
- package/dist/utils/alignmentUtils.d.ts +0 -10
- package/dist/utils/alignmentUtils.d.ts.map +0 -1
- package/dist/utils/commentAnchors.d.ts +0 -39
- package/dist/utils/commentAnchors.d.ts.map +0 -1
- package/dist/utils/componentAnnotations.d.ts +0 -23
- package/dist/utils/componentAnnotations.d.ts.map +0 -1
- package/dist/utils/docxImagePositioning.d.ts +0 -19
- package/dist/utils/docxImagePositioning.d.ts.map +0 -1
- package/dist/utils/noteRegistry.d.ts +0 -43
- package/dist/utils/noteRegistry.d.ts.map +0 -1
- package/dist/utils/noteResolver.d.ts +0 -31
- package/dist/utils/noteResolver.d.ts.map +0 -1
- package/dist/utils/numberedItemsRegistry.d.ts +0 -38
- package/dist/utils/numberedItemsRegistry.d.ts.map +0 -1
- package/dist/utils/placeholderImage.d.ts +0 -31
- package/dist/utils/placeholderImage.d.ts.map +0 -1
- package/dist/utils/placeholderProcessor.d.ts +0 -58
- package/dist/utils/placeholderProcessor.d.ts.map +0 -1
- package/dist/utils/textParser.d.ts +0 -117
- package/dist/utils/textParser.d.ts.map +0 -1
package/dist/plugin/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
export { createComponent, createVersion, type CustomComponent, type ComponentVersion, type ComponentVersionMap, type RenderFunction, type RenderContext, } from './createComponent';
|
|
30
30
|
export { createDocumentGenerator, type DocumentGeneratorOptions, } from './createDocumentGenerator';
|
|
31
|
-
export { type DocumentGenerator, type DocumentGeneratorBuilder, type GenerateOptions, type GenerateFileOptions, type
|
|
31
|
+
export { type DocumentGenerator, type DocumentGeneratorBuilder, type GenerateOptions, type GenerateFileOptions, type BufferGenerationResult, type FileGenerationResult, type StandardDefinitionResult, type ValidationResult, type ExtractCustomComponentType, type CustomComponentUnion, type ExtendedComponentDefinition, type ExtendedReportComponent, type InferCustomComponents, type InferBuilderComponents, type InferDocumentType, type InferComponentDefinition, } from './types';
|
|
32
32
|
export { validateComponentProps, validateDocument, cleanComponentProps, ComponentValidationError, DuplicateComponentError, UnknownPreservedComponentError, type ValidationError, } from './validation';
|
|
33
33
|
export { generatePluginDocumentSchema, exportPluginSchema, generateComponentSchemas, mergeSchemas, createUnionSchema, } from './schema';
|
|
34
34
|
export { resolveComponentVersion } from './version-resolver';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,eAAe,EACf,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,eAAe,EACf,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,8BAA8B,EAC9B,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/plugin/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAW,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/plugin/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAW,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAYzD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,gBAAgB,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAClD,yBAAyB,UAAO,GAC/B,OAAO,CAiCT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAQ7D;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,gBAAgB,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAClD,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IACP,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;CAClB,GACL,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GACjD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA6CzB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,gBAAgB,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAClD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsDzB"}
|
package/dist/plugin/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { CustomComponent } from './createComponent';
|
|
|
7
7
|
import type { ComponentDefinition as BaseComponentDefinition } from '@json-to-office/shared-docx';
|
|
8
8
|
import type { ReportComponent, GenerationWarning } from '@json-to-office/shared-docx';
|
|
9
9
|
import type { ReportComponentDefinition } from '../types';
|
|
10
|
-
import type {
|
|
10
|
+
import type { DocxRendererId } from '../renderers/types';
|
|
11
11
|
/**
|
|
12
12
|
* Helper to infer the versions map type from a CustomComponent
|
|
13
13
|
*/
|
|
@@ -72,7 +72,7 @@ export type InferCustomComponents<T> = T extends {
|
|
|
72
72
|
customComponents: infer M;
|
|
73
73
|
} ? M extends readonly CustomComponent<any, any, any>[] ? M : readonly [] : readonly [];
|
|
74
74
|
/**
|
|
75
|
-
* Per-call options shared by
|
|
75
|
+
* Per-call options shared by generateBuffer/generateFile.
|
|
76
76
|
*
|
|
77
77
|
* `preserveCustomComponents`: list of registered custom-component names whose
|
|
78
78
|
* `{ name, props, children? }` nodes should be kept verbatim in the returned
|
|
@@ -106,6 +106,11 @@ export interface GenerateOptions {
|
|
|
106
106
|
* `process.cwd()` when neither is set (#142).
|
|
107
107
|
*/
|
|
108
108
|
baseDir?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Backend that turns the compiled document into bytes for this call.
|
|
111
|
+
* Overrides the constructor `renderer`; defaults to `docxjs`.
|
|
112
|
+
*/
|
|
113
|
+
renderer?: DocxRendererId;
|
|
109
114
|
}
|
|
110
115
|
/**
|
|
111
116
|
* Per-call options for `generateFile` only — adds a sidecar-path override.
|
|
@@ -118,23 +123,6 @@ export interface GenerateFileOptions extends GenerateOptions {
|
|
|
118
123
|
*/
|
|
119
124
|
preservedOutputPath?: string;
|
|
120
125
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Result of document generation
|
|
123
|
-
*/
|
|
124
|
-
export interface GenerationResult<TCustomComponents extends readonly CustomComponent<any, any, any>[] = readonly []> {
|
|
125
|
-
/** The generated document */
|
|
126
|
-
document: Document;
|
|
127
|
-
/** Warnings collected during generation, null if no warnings */
|
|
128
|
-
warnings: GenerationWarning[] | null;
|
|
129
|
-
/** Post-expansion, post-normalization standard JSON tree (custom plugins resolved). */
|
|
130
|
-
standardDefinition: ReportComponentDefinition;
|
|
131
|
-
/**
|
|
132
|
-
* Partially-expanded tree honoring `preserveCustomComponents`.
|
|
133
|
-
* Present iff the option was passed. Custom-component subtrees listed in
|
|
134
|
-
* the option are kept verbatim (children not recursed); others are expanded.
|
|
135
|
-
*/
|
|
136
|
-
preservedDefinition?: ExtendedReportComponent<TCustomComponents>;
|
|
137
|
-
}
|
|
138
126
|
/**
|
|
139
127
|
* Result of buffer generation
|
|
140
128
|
*/
|
|
@@ -191,14 +179,13 @@ export interface ValidationResult {
|
|
|
191
179
|
* Document generator with custom components and full type safety
|
|
192
180
|
*/
|
|
193
181
|
export interface DocumentGenerator<TCustomComponents extends readonly CustomComponent<any, any, any>[] = readonly []> {
|
|
194
|
-
generate: (document: ExtendedReportComponent<TCustomComponents>, options?: GenerateOptions) => Promise<GenerationResult<TCustomComponents>>;
|
|
195
182
|
generateBuffer: (document: ExtendedReportComponent<TCustomComponents>, options?: GenerateOptions) => Promise<BufferGenerationResult<TCustomComponents>>;
|
|
196
183
|
generateFile: (document: ExtendedReportComponent<TCustomComponents>, outputPath: string, options?: GenerateFileOptions) => Promise<FileGenerationResult<TCustomComponents>>;
|
|
197
184
|
/**
|
|
198
185
|
* Compute only the post-expansion standard definition: validation, theme
|
|
199
186
|
* resolution, custom-component expansion, and normalization — no font
|
|
200
187
|
* resolution, no layout, no rendering, no packaging, no external services.
|
|
201
|
-
* Use this instead of `
|
|
188
|
+
* Use this instead of `generateBuffer()` when you only need the JSON tree.
|
|
202
189
|
*/
|
|
203
190
|
expandStandardDefinition: (document: ExtendedReportComponent<TCustomComponents>, options?: GenerateOptions) => Promise<StandardDefinitionResult>;
|
|
204
191
|
getComponentNames: () => string[];
|
|
@@ -209,11 +196,11 @@ export interface DocumentGenerator<TCustomComponents extends readonly CustomComp
|
|
|
209
196
|
prettyPrint?: boolean;
|
|
210
197
|
}) => Promise<void>;
|
|
211
198
|
/**
|
|
212
|
-
* @deprecated Use `
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* removed in a future major.
|
|
199
|
+
* @deprecated Use `generateBuffer(...).standardDefinition`, or
|
|
200
|
+
* `expandStandardDefinition(...)` when you do not want a document at all.
|
|
201
|
+
* This is a thin wrapper that runs `render()` once per call, so calling it
|
|
202
|
+
* alongside `generateBuffer`/`generateFile` costs a second expansion pass.
|
|
203
|
+
* Kept for backwards compatibility; will be removed in a future major.
|
|
217
204
|
*/
|
|
218
205
|
getStandardComponentsDefinition: (document: ExtendedReportComponent<TCustomComponents>) => Promise<ReportComponentDefinition>;
|
|
219
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,KAAK,EACV,eAAe,EACf,iB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IAC7B,CAAC,SAAS,wBAAwB,CAAC,MAAM,CAAC,CAAC,GACvC,uBAAuB,CAAC,CAAC,CAAC,GAC1B,KAAK,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,IACpC,CAAC,SAAS,wBAAwB,CAAC,MAAM,CAAC,CAAC,GACvC,2BAA2B,CAAC,CAAC,CAAC,GAC9B,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAClC,2BAA2B,CAAC,CAAC,CAAC,GAC9B,KAAK,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DocxIR → docx.js objects.
|
|
3
|
+
*
|
|
4
|
+
* Each function maps one IR node onto the option bag docx.js expects. Every
|
|
5
|
+
* cascade, default and unit conversion already happened in the compiler, so
|
|
6
|
+
* this layer only translates vocabulary — with two exceptions that are
|
|
7
|
+
* genuinely properties of *this* backend:
|
|
8
|
+
*
|
|
9
|
+
* - A line break is not a node here. docx.js expresses it as `break: 1` on the
|
|
10
|
+
* run that follows, so a `lineBreak` in the IR is folded into the next run.
|
|
11
|
+
* - A tab is a run containing a `Tab`, because a tab character inside `<w:t>`
|
|
12
|
+
* is dropped by Word and paragraph tab stops only bind to real tab runs.
|
|
13
|
+
*/
|
|
14
|
+
import { AlignmentType, Paragraph, Table, TableOfContents, type IParagraphOptions, type IRunOptions, type ParagraphChild } from 'docx';
|
|
15
|
+
import type { DocxIrBlock, DocxIrFloating, DocxIrImageRun, DocxIrInline, DocxIrParagraph, DocxIrParagraphFormatting, DocxIrRunFormatting, DocxIrTable } from '../../ir/types';
|
|
16
|
+
export declare const ALIGNMENT: Readonly<Record<string, (typeof AlignmentType)[keyof typeof AlignmentType]>>;
|
|
17
|
+
/**
|
|
18
|
+
* Image runs, keyed by IR resource id.
|
|
19
|
+
*
|
|
20
|
+
* docx.js needs an `ImageRun` object, and building one for a vector image is
|
|
21
|
+
* asynchronous — it rasterises a fallback. So the renderer builds them all
|
|
22
|
+
* before the document, and this layer only places them.
|
|
23
|
+
*/
|
|
24
|
+
export type EmitResources = ReadonlyMap<string, ImageRunFactory>;
|
|
25
|
+
/** Builds the run for one placement, which carries its own size and anchor. */
|
|
26
|
+
export type ImageRunFactory = (image: DocxIrImageRun) => ParagraphChild;
|
|
27
|
+
export declare function runOptions(formatting: DocxIrRunFormatting | undefined): IRunOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Turn inline nodes into paragraph children.
|
|
30
|
+
*
|
|
31
|
+
* `pendingBreaks` carries a run of `lineBreak` nodes forward onto whichever run
|
|
32
|
+
* comes next, which is where docx.js puts them.
|
|
33
|
+
*/
|
|
34
|
+
export declare function inlineChildren(children: readonly DocxIrInline[], resources?: EmitResources): ParagraphChild[];
|
|
35
|
+
/** An IR anchor as docx.js floating options. */
|
|
36
|
+
export declare function floatingOptions(floating: DocxIrFloating): Record<string, unknown>;
|
|
37
|
+
export declare function paragraphOptions(formatting: DocxIrParagraphFormatting | undefined): Partial<IParagraphOptions>;
|
|
38
|
+
export declare function emitParagraph(block: DocxIrParagraph, resources?: EmitResources): Paragraph;
|
|
39
|
+
export declare function emitBlock(block: DocxIrBlock, resources?: EmitResources): Paragraph | Table | TableOfContents;
|
|
40
|
+
export declare function emitTable(block: DocxIrTable, resources?: EmitResources): Table;
|
|
41
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/renderers/docxjs/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,aAAa,EAgBb,SAAS,EAMT,KAAK,EAIL,eAAe,EAQf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEhB,KAAK,cAAc,EACpB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EACV,WAAW,EAEX,cAAc,EAEd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,yBAAyB,EAGzB,mBAAmB,EAEnB,WAAW,EAKZ,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,SAAS,EAAE,QAAQ,CAC9B,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC,CAQnE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEjE,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,cAAc,CAAC;AAmBxE,wBAAgB,UAAU,CACxB,UAAU,EAAE,mBAAmB,GAAG,SAAS,GAC1C,WAAW,CA2Bb;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,SAAS,GAAE,aAAyB,GACnC,cAAc,EAAE,CAoJlB;AAyDD,gDAAgD;AAChD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,cAAc,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwEzB;AA4CD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,yBAAyB,GAAG,SAAS,GAChD,OAAO,CAAC,iBAAiB,CAAC,CAyD5B;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,eAAe,EACtB,SAAS,GAAE,aAAyB,GACnC,SAAS,CAsBX;AAqCD,wBAAgB,SAAS,CACvB,KAAK,EAAE,WAAW,EAClB,SAAS,GAAE,aAAyB,GACnC,SAAS,GAAG,KAAK,GAAG,eAAe,CAWrC;AAyDD,wBAAgB,SAAS,CACvB,KAAK,EAAE,WAAW,EAClB,SAAS,GAAE,aAAyB,GACnC,KAAK,CA8BP"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The docx.js renderer.
|
|
3
|
+
*
|
|
4
|
+
* This is the only place in `core-docx` production code that may import `docx`
|
|
5
|
+
* once the migration completes. It consumes DocxIR and nothing else — no author
|
|
6
|
+
* JSON, no `ProcessedDocument`, no theme lookups.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
import { Document } from 'docx';
|
|
10
|
+
import type { DocxIR } from '../../ir/types';
|
|
11
|
+
import type { DocxRenderer, DocxRendererId } from '../types';
|
|
12
|
+
import { type EmitResources } from './emit';
|
|
13
|
+
export declare const DOCXJS_RENDERER_ID: DocxRendererId;
|
|
14
|
+
export declare function createDocxJsRenderer(): DocxRenderer;
|
|
15
|
+
/**
|
|
16
|
+
* Build the docx.js object graph for an IR document.
|
|
17
|
+
*
|
|
18
|
+
* Exported for tests: asserting on the object graph is far cheaper, and far
|
|
19
|
+
* more legible, than unzipping a package.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildDocument(ir: DocxIR, resources?: EmitResources): Document;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/docxjs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,QAAQ,EAUT,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,EAKL,KAAK,aAAa,EAEnB,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,kBAAkB,EAAE,cAAyB,CAAC;AAoB3D,wBAAgB,oBAAoB,IAAI,YAAY,CA0BnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,SAAS,GAAE,aAAyB,GACnC,QAAQ,CA2CV"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DocxIR styles, as docx.js style options.
|
|
3
|
+
*
|
|
4
|
+
* A mechanical translation: which styles exist and what each one says was
|
|
5
|
+
* decided by the compiler, and this only renames the fields and restores the
|
|
6
|
+
* units docx.js expects. Nothing here reads a theme.
|
|
7
|
+
*/
|
|
8
|
+
import { type IStylesOptions } from 'docx';
|
|
9
|
+
import type { DocxIrStyles } from '../../ir/types';
|
|
10
|
+
/** Turn the IR's style set into the options docx.js builds `styles.xml` from. */
|
|
11
|
+
export declare function emitStyles(styles: DocxIrStyles): IStylesOptions;
|
|
12
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/renderers/docxjs/styles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAMV,YAAY,EACb,MAAM,gBAAgB,CAAC;AAsJxB,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAoD/D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DocxIR → `@office-open/docx` options.
|
|
3
|
+
*
|
|
4
|
+
* The backend takes a plain JSON document rather than an object graph, so this
|
|
5
|
+
* layer is a pure function from IR nodes to option bags. Its vocabulary is
|
|
6
|
+
* close to the docx.js adapter's — both mirror OOXML — but the two are kept
|
|
7
|
+
* separate on purpose: they disagree about enough (tagged section children,
|
|
8
|
+
* `simpleField` instead of a field class, `verticalMerge` instead of a merge
|
|
9
|
+
* enum) that sharing the code would mean a conditional in every function.
|
|
10
|
+
*
|
|
11
|
+
* Backend gaps are handled by *not declaring the capability* in `index.ts`, so
|
|
12
|
+
* anything this module cannot express has already been rejected before it is
|
|
13
|
+
* called. Reaching a `throw` here is a bug, not a user error.
|
|
14
|
+
*/
|
|
15
|
+
import type { DocxIrBlock, DocxIrFloating, DocxIrImageRun, DocxIrInline, DocxIrNumbering, DocxIrParagraph, DocxIrParagraphFormatting, DocxIrRunFormatting, DocxIrSection, DocxIrTable } from '../../ir/types';
|
|
16
|
+
import { emuToPixels } from '../../ir/units';
|
|
17
|
+
type Opts = Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* One prepared picture per placement.
|
|
20
|
+
*
|
|
21
|
+
* A vector image needs a rasterised fallback sized to the placement, and
|
|
22
|
+
* producing it is asynchronous while this layer is not — so the renderer builds
|
|
23
|
+
* the pictures first and this only places them.
|
|
24
|
+
*/
|
|
25
|
+
export type ImagePictureFactory = (image: DocxIrImageRun, drawingId: number) => Opts;
|
|
26
|
+
/**
|
|
27
|
+
* What emitting a document needs beyond the IR itself.
|
|
28
|
+
*
|
|
29
|
+
* `nextDrawingId` exists because the backend numbers `wp:docPr` from a
|
|
30
|
+
* module-level counter whenever a drawing does not state an id. That counter is
|
|
31
|
+
* process-global: the same document rendered twice comes out with different
|
|
32
|
+
* ids, and two rendered at once interleave. Every drawing this adapter emits
|
|
33
|
+
* therefore states its own id, allocated per render in document order — which
|
|
34
|
+
* is deterministic and cannot leak between documents.
|
|
35
|
+
*/
|
|
36
|
+
export interface EmitContext {
|
|
37
|
+
/** Prepared pictures, keyed by IR resource id. */
|
|
38
|
+
pictures: ReadonlyMap<string, ImagePictureFactory>;
|
|
39
|
+
/** Allocate the next `wp:docPr` id for this document. */
|
|
40
|
+
nextDrawingId: () => number;
|
|
41
|
+
}
|
|
42
|
+
/** A context for content that holds no drawings, and for tests. */
|
|
43
|
+
export declare function emptyContext(): EmitContext;
|
|
44
|
+
export declare function runProperties(formatting: DocxIrRunFormatting | undefined): Opts;
|
|
45
|
+
/**
|
|
46
|
+
* Turn inline nodes into paragraph children.
|
|
47
|
+
*
|
|
48
|
+
* `pendingBreaks` carries a run of `lineBreak` nodes forward onto whichever run
|
|
49
|
+
* comes next, which is where the backend puts them — `<w:br/>` is run-inner
|
|
50
|
+
* content, so it has to ride on a run either way.
|
|
51
|
+
*/
|
|
52
|
+
export declare function inlineChildren(children: readonly DocxIrInline[], ctx?: EmitContext): Opts[];
|
|
53
|
+
/** An IR anchor as the backend's floating options. */
|
|
54
|
+
export declare function floatingOptions(floating: DocxIrFloating): Opts;
|
|
55
|
+
export declare function paragraphProperties(formatting: DocxIrParagraphFormatting | undefined): Opts;
|
|
56
|
+
export declare function paragraph(block: DocxIrParagraph, ctx?: EmitContext): Opts;
|
|
57
|
+
/** One IR block as a tagged section child, which is how the backend takes it. */
|
|
58
|
+
export declare function block(value: DocxIrBlock, ctx?: EmitContext): Opts;
|
|
59
|
+
export declare function table(value: DocxIrTable, ctx: EmitContext): Opts;
|
|
60
|
+
export declare function section(value: DocxIrSection, ctx: EmitContext): Opts;
|
|
61
|
+
export declare function numberingConfig(numbering: DocxIrNumbering): Opts;
|
|
62
|
+
export { emuToPixels };
|
|
63
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EACV,WAAW,EAGX,cAAc,EAGd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,eAAe,EACf,yBAAyB,EAGzB,mBAAmB,EACnB,aAAa,EAGb,WAAW,EAKZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAE1D,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,KACd,IAAI,CAAC;AAEV;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACnD,yDAAyD;IACzD,aAAa,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,mEAAmE;AACnE,wBAAgB,YAAY,IAAI,WAAW,CAG1C;AAsBD,wBAAgB,aAAa,CAC3B,UAAU,EAAE,mBAAmB,GAAG,SAAS,GAC1C,IAAI,CAwCN;AAUD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,GAAG,GAAE,WAA4B,GAChC,IAAI,EAAE,CA0HR;AA8CD,sDAAsD;AACtD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAsD9D;AA8DD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,yBAAyB,GAAG,SAAS,GAChD,IAAI,CAgEN;AAOD,wBAAgB,SAAS,CACvB,KAAK,EAAE,eAAe,EACtB,GAAG,GAAE,WAA4B,GAChC,IAAI,CAsBN;AA+CD,iFAAiF;AACjF,wBAAgB,KAAK,CACnB,KAAK,EAAE,WAAW,EAClB,GAAG,GAAE,WAA4B,GAChC,IAAI,CAWN;AA4ED,wBAAgB,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAuBhE;AA0HD,wBAAgB,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CA0FpE;AA4CD,wBAAgB,eAAe,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAgChE;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The experimental `@office-open/docx` renderer.
|
|
3
|
+
*
|
|
4
|
+
* Selecting it is explicit and opt-in; `docxjs` stays the default. The backend
|
|
5
|
+
* is an optional peer dependency, resolved at call time so a missing package
|
|
6
|
+
* surfaces as an install hint rather than a module-resolution failure.
|
|
7
|
+
*
|
|
8
|
+
* The capability set below is deliberately narrow. A feature is listed only
|
|
9
|
+
* when it has been proven against the real package, never from its README, and
|
|
10
|
+
* a gap in the backend is expressed by *omitting* the capability — which makes
|
|
11
|
+
* the pipeline reject the document before any bytes exist, instead of shipping
|
|
12
|
+
* a file with content quietly missing.
|
|
13
|
+
*/
|
|
14
|
+
import type { DocxIR } from '../../ir/types';
|
|
15
|
+
import type { DocxRenderer, DocxRendererId } from '../types';
|
|
16
|
+
export declare const OFFICE_OPEN_DOCX_RENDERER_ID: DocxRendererId;
|
|
17
|
+
export declare function createOfficeOpenDocxRenderer(): Promise<DocxRenderer>;
|
|
18
|
+
/**
|
|
19
|
+
* Build the backend's document object for an IR document.
|
|
20
|
+
*
|
|
21
|
+
* Exported for tests: asserting on this object is far cheaper, and far more
|
|
22
|
+
* legible, than unzipping a package.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildDocumentOptions(ir: DocxIR): Promise<Record<string, unknown>>;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EACV,MAAM,EAIP,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAYhF,eAAO,MAAM,4BAA4B,EAAE,cAA8B,CAAC;AAwC1E,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,YAAY,CAAC,CA0C1E;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2ClC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DocxIR styles, as `@office-open/docx` style options.
|
|
3
|
+
*
|
|
4
|
+
* A mechanical translation: which styles exist and what each one says was
|
|
5
|
+
* decided by the compiler, and this only renames the fields. Nothing here reads
|
|
6
|
+
* a theme.
|
|
7
|
+
*/
|
|
8
|
+
import type { DocxIrStyles } from '../../ir/types';
|
|
9
|
+
type Opts = Record<string, unknown>;
|
|
10
|
+
/** Turn the IR's style set into the options the backend builds `styles.xml` from. */
|
|
11
|
+
export declare function emitStyles(styles: DocxIrStyles): Opts;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/styles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGvE,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAWpC,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAmDrD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOCX renderer registry.
|
|
3
|
+
*
|
|
4
|
+
* Adapters are registered as async factories so an optional backend is only
|
|
5
|
+
* imported when it is actually selected — choosing `docxjs` never loads
|
|
6
|
+
* `@office-open/docx`, and a missing optional dependency surfaces as an
|
|
7
|
+
* actionable install hint rather than a bare module-resolution failure.
|
|
8
|
+
*/
|
|
9
|
+
import { type DocxRenderer, type DocxRendererId } from './types';
|
|
10
|
+
/** Resolve a renderer by id, defaulting to `docxjs`. */
|
|
11
|
+
export declare function resolveDocxRenderer(id?: DocxRendererId): Promise<DocxRenderer>;
|
|
12
|
+
/** Renderer ids registered for DOCX. */
|
|
13
|
+
export declare function docxRendererIds(): readonly DocxRendererId[];
|
|
14
|
+
export declare function isDocxRendererId(value: string): value is DocxRendererId;
|
|
15
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/renderers/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAiBjB,wDAAwD;AACxD,wBAAgB,mBAAmB,CACjC,EAAE,CAAC,EAAE,cAAc,GAClB,OAAO,CAAC,YAAY,CAAC,CAEvB;AAED,wCAAwC;AACxC,wBAAgB,eAAe,IAAI,SAAS,cAAc,EAAE,CAE3D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOCX renderer contracts.
|
|
3
|
+
*
|
|
4
|
+
* Format-specific bindings of the shared `OfficeRenderer` contract. Nothing in
|
|
5
|
+
* this file imports a backend; the adapters under `docxjs/` and `office-open/`
|
|
6
|
+
* do, and they are the only places allowed to.
|
|
7
|
+
*/
|
|
8
|
+
import type { OfficeRenderer, RenderOptions } from '@json-to-office/shared/rendering';
|
|
9
|
+
import type { GenerationWarning } from '@json-to-office/shared';
|
|
10
|
+
import type { DocxFeature } from '../ir/features';
|
|
11
|
+
import type { DocxIR } from '../ir/types';
|
|
12
|
+
import { DEFAULT_DOCX_RENDERER_ID, type DocxRendererId } from '@json-to-office/shared-docx';
|
|
13
|
+
/**
|
|
14
|
+
* Renderer ids available for DOCX.
|
|
15
|
+
*
|
|
16
|
+
* `docxjs` is the default and must keep producing today's output.
|
|
17
|
+
* `office-open` is experimental and opt-in.
|
|
18
|
+
*/
|
|
19
|
+
export { DEFAULT_DOCX_RENDERER_ID };
|
|
20
|
+
export type { DocxRendererId };
|
|
21
|
+
/**
|
|
22
|
+
* Render options for DOCX.
|
|
23
|
+
*
|
|
24
|
+
* Adds a warning sink to the shared contract: post-render repairs can find
|
|
25
|
+
* problems the author should hear about, and those belong in the same
|
|
26
|
+
* structured list as the rest of the pipeline rather than on `console`.
|
|
27
|
+
*/
|
|
28
|
+
export interface DocxRenderOptions extends RenderOptions {
|
|
29
|
+
warnings?: GenerationWarning[];
|
|
30
|
+
}
|
|
31
|
+
export interface DocxRenderer extends OfficeRenderer<DocxIR, DocxFeature, DocxRendererId> {
|
|
32
|
+
render(document: DocxIR, options?: DocxRenderOptions): Promise<Uint8Array>;
|
|
33
|
+
}
|
|
34
|
+
export type { RenderOptions };
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/renderers/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,wBAAwB,EACxB,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAErC;;;;;GAKG;AACH,OAAO,EAAE,wBAAwB,EAAE,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,YACf,SAAQ,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC5E;AAED,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A theme, compiled into the document's style set.
|
|
3
|
+
*
|
|
4
|
+
* The output is DocxIR: style ids and their resolved formatting, in the units
|
|
5
|
+
* OOXML uses, naming no backend. Both adapters map it to their own option
|
|
6
|
+
* shape, so which styles a document defines — and what each one says — is
|
|
7
|
+
* decided once, here, rather than once per renderer.
|
|
8
|
+
*/
|
|
9
|
+
import type { DocxIrStyles } from '../ir/types';
|
|
10
|
+
import type { ThemeConfig } from './index';
|
|
11
|
+
export declare function createDocumentStyles(themeNameOrObject?: string | ThemeConfig, language?: string): DocxIrStyles;
|
|
12
|
+
//# sourceMappingURL=themeToStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeToStyles.d.ts","sourceRoot":"","sources":["../../src/styles/themeToStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,OAAO,KAAK,EAQV,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAoX3C,wBAAgB,oBAAoB,CAClC,iBAAiB,GAAE,MAAM,GAAG,WAAuB,EACnD,QAAQ,CAAC,EAAE,MAAM,GAChB,YAAY,CAgjBd"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Border utilities for consistent border styling across modules
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* OOXML border styles, by name.
|
|
6
|
+
*
|
|
7
|
+
* The literal values rather than a backend's enum: `w:val` on a border is a
|
|
8
|
+
* plain OOXML token, and this module is read by the compiler, which imports no
|
|
9
|
+
* renderer.
|
|
10
|
+
*/
|
|
11
|
+
export type BorderStyleName = 'none' | 'single' | 'double' | 'dashed' | 'dotted' | 'thick';
|
|
5
12
|
import { ThemeConfig } from '../index';
|
|
6
13
|
/**
|
|
7
14
|
* Standard "no borders" configuration for tables
|
|
@@ -40,11 +47,11 @@ export declare const NONE_BORDERS: {
|
|
|
40
47
|
};
|
|
41
48
|
};
|
|
42
49
|
/**
|
|
43
|
-
* Maps border style
|
|
50
|
+
* Maps a theme border style name to its OOXML token
|
|
44
51
|
* @param s - Border style string ('dashed', 'dotted', 'double', 'none', 'single')
|
|
45
|
-
* @returns
|
|
52
|
+
* @returns The `w:val` OOXML writes for it
|
|
46
53
|
*/
|
|
47
|
-
export declare function mapBorderStyle(s?: string):
|
|
54
|
+
export declare function mapBorderStyle(s?: string): BorderStyleName;
|
|
48
55
|
/**
|
|
49
56
|
* Border configuration object
|
|
50
57
|
*/
|
|
@@ -60,7 +67,7 @@ export interface BorderConfig {
|
|
|
60
67
|
* @returns Docx border object or undefined if no border
|
|
61
68
|
*/
|
|
62
69
|
export declare function convertBorder(b: BorderConfig | undefined, theme: ThemeConfig): {
|
|
63
|
-
style:
|
|
70
|
+
style: BorderStyleName;
|
|
64
71
|
size: number;
|
|
65
72
|
color: string;
|
|
66
73
|
} | undefined;
|
|
@@ -81,7 +88,7 @@ export interface BordersConfig {
|
|
|
81
88
|
* @returns Docx borders object or undefined
|
|
82
89
|
*/
|
|
83
90
|
export declare function convertBorders(bordersConfig: BordersConfig | undefined, theme: ThemeConfig): Record<string, {
|
|
84
|
-
style:
|
|
91
|
+
style: BorderStyleName;
|
|
85
92
|
size: number;
|
|
86
93
|
color: string;
|
|
87
94
|
}> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borderUtils.d.ts","sourceRoot":"","sources":["../../../src/styles/utils/borderUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,
|
|
1
|
+
{"version":3,"file":"borderUtils.d.ts","sourceRoot":"","sources":["../../../src/styles/utils/borderUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,CAAC;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOf,CAAC;AAEX;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,eAAe,CAa1D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,YAAY,GAAG,SAAS,EAC3B,KAAK,EAAE,WAAW,GAEhB;IACE,KAAK,EAAE,eAAe,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,GACD,SAAS,CAQZ;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,KAAK,EAAE,WAAW,GAEhB,MAAM,CACJ,MAAM,EACN;IACE,KAAK,EAAE,eAAe,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CACF,GACD,SAAS,CAuBZ"}
|
|
@@ -54,20 +54,16 @@ export declare function getPageDimensions(size: 'A4' | 'A3' | 'LETTER' | 'LEGAL'
|
|
|
54
54
|
*/
|
|
55
55
|
export declare const getTableStyle: (theme?: ThemeConfig, themeName?: string) => {
|
|
56
56
|
cellParagraph: {
|
|
57
|
-
after: number;
|
|
58
|
-
before: number;
|
|
59
57
|
line?: number | undefined;
|
|
60
|
-
lineRule?: "atLeast" | "
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
lineRule?: "atLeast" | "auto" | "exact" | undefined;
|
|
59
|
+
before: number;
|
|
60
|
+
after: number;
|
|
63
61
|
};
|
|
64
62
|
headerParagraph: {
|
|
65
|
-
after: number;
|
|
66
|
-
before: number;
|
|
67
63
|
line?: number | undefined;
|
|
68
|
-
lineRule?: "atLeast" | "
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
lineRule?: "atLeast" | "auto" | "exact" | undefined;
|
|
65
|
+
before: number;
|
|
66
|
+
after: number;
|
|
71
67
|
};
|
|
72
68
|
tableHeader: {
|
|
73
69
|
fill: string;
|
|
@@ -86,22 +82,22 @@ export declare const getTableStyle: (theme?: ThemeConfig, themeName?: string) =>
|
|
|
86
82
|
};
|
|
87
83
|
borders: {
|
|
88
84
|
top: {
|
|
89
|
-
style:
|
|
85
|
+
style: string;
|
|
90
86
|
size: number;
|
|
91
87
|
color: string;
|
|
92
88
|
};
|
|
93
89
|
bottom: {
|
|
94
|
-
style:
|
|
90
|
+
style: string;
|
|
95
91
|
size: number;
|
|
96
92
|
color: string;
|
|
97
93
|
};
|
|
98
94
|
left: {
|
|
99
|
-
style:
|
|
95
|
+
style: string;
|
|
100
96
|
size: number;
|
|
101
97
|
color: string;
|
|
102
98
|
};
|
|
103
99
|
right: {
|
|
104
|
-
style:
|
|
100
|
+
style: string;
|
|
105
101
|
size: number;
|
|
106
102
|
color: string;
|
|
107
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutUtils.d.ts","sourceRoot":"","sources":["../../../src/styles/utils/layoutUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layoutUtils.d.ts","sourceRoot":"","sources":["../../../src/styles/utils/layoutUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AA+CvC;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CAKb,CAAC;AAEX,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzE,cAAc,CAKhB;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,WAAY,WAAW,cAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GpE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,WAAY,WAAW,cAAc,MAAM;;;;;;;;;;;;;;;CAgBzE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WAAY,WAAW,cAAc,MAAM;;;;;;;;;;;;CAoCnE,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ThemeConfig } from '../index';
|
|
2
2
|
import { LineSpacing } from '@json-to-office/shared-docx';
|
|
3
|
-
|
|
3
|
+
/** `w:spacing`'s line height and rule, in the units OOXML uses. */
|
|
4
|
+
export interface LineSpacingProperties {
|
|
5
|
+
line?: number;
|
|
6
|
+
lineRule?: 'auto' | 'exact' | 'atLeast';
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* Convert points to twips for docx spacing
|
|
6
10
|
* @param points - Value in points
|
|
@@ -87,5 +91,5 @@ export declare const getBodyTextStyle: (theme?: ThemeConfig, themeName?: string)
|
|
|
87
91
|
* @param lineSpacing The line spacing object from the theme definition.
|
|
88
92
|
* @returns IParagraphSpacingOptions for docx.
|
|
89
93
|
*/
|
|
90
|
-
export declare function convertLineSpacing(lineSpacing?: LineSpacing | number):
|
|
94
|
+
export declare function convertLineSpacing(lineSpacing?: LineSpacing | number): LineSpacingProperties | undefined;
|
|
91
95
|
//# sourceMappingURL=styleHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleHelpers.d.ts","sourceRoot":"","sources":["../../../src/styles/utils/styleHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"styleHelpers.d.ts","sourceRoot":"","sources":["../../../src/styles/utils/styleHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,mEAAmE;AACnE,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACzC;AAQD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,CAAC,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,GAAG,SAAS,CAazB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAC9C,MAAM,CASR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAC9C,MAAM,GAAG,SAAS,CASpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IACpD,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;QAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAC9C,cAAc,CA2BhB;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,OAAO,CAAC,cAAc,CAAC,EAC3E,SAAS,EAAE,cAAc,EACzB,cAAc,EAAE,CAAC,GAChB,cAAc,GAAG,CAAC,CAgBpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,WAAY,WAAW,cAAc,MAAM;;;;CAoBvE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,GACjC,qBAAqB,GAAG,SAAS,CA4CnC"}
|
|
@@ -18,6 +18,4 @@ export interface ThemeOverrides {
|
|
|
18
18
|
* (spacing, lineSpacing, borders, indent) are replaced wholesale.
|
|
19
19
|
*/
|
|
20
20
|
export declare function applyThemeOverrides(theme: ThemeConfig, overrides: ThemeOverrides | undefined): ThemeConfig;
|
|
21
|
-
/** Short stable digest used to scope theme-keyed caches per override set. */
|
|
22
|
-
export declare function themeOverridesDigest(overrides: ThemeOverrides): string;
|
|
23
21
|
//# sourceMappingURL=overrides.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/themes/overrides.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/themes/overrides.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,cAAc,GAAG,SAAS,GACpC,WAAW,CAoBb"}
|