@json-to-office/core-docx 7.1.2 → 7.3.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/index.js +1647 -427
- package/dist/index.js.map +1 -1
- package/dist/ir/chartValues.d.ts +16 -0
- package/dist/ir/chartValues.d.ts.map +1 -0
- package/dist/ir/compiler.d.ts.map +1 -1
- package/dist/ir/features.d.ts.map +1 -1
- package/dist/ir/theme.d.ts +43 -0
- package/dist/ir/theme.d.ts.map +1 -0
- package/dist/ir/types.d.ts +45 -3
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/units.d.ts +12 -0
- package/dist/ir/units.d.ts.map +1 -1
- package/dist/ir/validation.d.ts +2 -1
- package/dist/ir/validation.d.ts.map +1 -1
- package/dist/plugin/example/index.js +1644 -424
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/quality/text-inventory.d.ts +13 -3
- package/dist/quality/text-inventory.d.ts.map +1 -1
- package/dist/renderers/chartText.d.ts +43 -0
- package/dist/renderers/chartText.d.ts.map +1 -0
- package/dist/renderers/docxjs/charts.d.ts +45 -0
- package/dist/renderers/docxjs/charts.d.ts.map +1 -0
- package/dist/renderers/docxjs/docxSubpath.d.ts +34 -0
- package/dist/renderers/docxjs/docxSubpath.d.ts.map +1 -0
- package/dist/renderers/docxjs/drawingGroup.d.ts +79 -0
- package/dist/renderers/docxjs/drawingGroup.d.ts.map +1 -0
- package/dist/renderers/docxjs/drawingGroupRepair.d.ts +36 -0
- package/dist/renderers/docxjs/drawingGroupRepair.d.ts.map +1 -0
- package/dist/renderers/docxjs/emit.d.ts +10 -2
- package/dist/renderers/docxjs/emit.d.ts.map +1 -1
- package/dist/renderers/docxjs/index.d.ts +2 -1
- package/dist/renderers/docxjs/index.d.ts.map +1 -1
- package/dist/renderers/docxjs/presetShapes.d.ts +233 -0
- package/dist/renderers/docxjs/presetShapes.d.ts.map +1 -0
- package/dist/renderers/office-open/chartLook.d.ts +45 -0
- package/dist/renderers/office-open/chartLook.d.ts.map +1 -0
- package/dist/renderers/office-open/chartParts.d.ts +29 -15
- package/dist/renderers/office-open/chartParts.d.ts.map +1 -1
- package/dist/renderers/office-open/emit.d.ts +25 -17
- package/dist/renderers/office-open/emit.d.ts.map +1 -1
- package/dist/renderers/office-open/index.d.ts +16 -3
- package/dist/renderers/office-open/index.d.ts.map +1 -1
- package/dist/renderers/office-open/themePart.d.ts +28 -0
- package/dist/renderers/office-open/themePart.d.ts.map +1 -0
- package/dist/styles/themeToStyles.d.ts.map +1 -1
- package/dist/styles/utils/styleHelpers.d.ts +3 -1
- package/dist/styles/utils/styleHelpers.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/chartWorkbook.d.ts +2 -1
- package/dist/utils/chartWorkbook.d.ts.map +1 -1
- package/dist/utils/fixFloatingImageIds.d.ts +17 -9
- package/dist/utils/fixFloatingImageIds.d.ts.map +1 -1
- package/dist/utils/packageDocument.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartLook.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/chartLook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA+CtE,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAC9B,QAAQ,GAAG,QAAQ,GAAG,kBAAkB,CACzC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,eAAe,GAAG,gBAAgB,CAavE;AAwED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAuCvE"}
|
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A native chart's look and references, for DOCX.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `@json-to-office/shared/rendering
|
|
8
|
-
* `@office-open`
|
|
9
|
-
*
|
|
4
|
+
* What a chart needs beyond its type and data — the cell references, the
|
|
5
|
+
* colours, the axes, the fonts, Office's blanks — is format-neutral and is
|
|
6
|
+
* stated as backend options by `chartLook` in
|
|
7
|
+
* `@json-to-office/shared/rendering`; the pptx sibling of this file does the
|
|
8
|
+
* same. `@office-open/docx` 0.14 hands those options to the chart part whole,
|
|
9
|
+
* and embeds the workbook `c:externalData` points at, with its relationship and
|
|
10
|
+
* content type, from `externalData.data` — see `chartOptions` in `emit.ts`.
|
|
10
11
|
*
|
|
11
|
-
* What is here is
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* What is left here is the IR's side of that — `chartInput` — and the one
|
|
13
|
+
* edit no option carries, applied to the emitted parts: a scatter chart's
|
|
14
|
+
* style (`finishChartXml`).
|
|
14
15
|
*/
|
|
15
16
|
import type AdmZip from 'adm-zip';
|
|
17
|
+
import type { ChartPartInput } from '@json-to-office/shared/rendering';
|
|
16
18
|
import type { DocxIrChartRun } from '../../ir/types';
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* One chart run, in the shared look's vocabulary.
|
|
21
|
+
*
|
|
22
|
+
* The docx component exposes a smaller styling surface than the pptx one, so
|
|
23
|
+
* only the axis titles have an authored prop behind them. The theme's chart
|
|
24
|
+
* text style goes on both: as the chart-wide default the tick labels and
|
|
25
|
+
* legend inherit, and on each axis title, which would otherwise take Word's
|
|
26
|
+
* large bold default. The roles themselves — which text takes the style as
|
|
27
|
+
* is, and which adjusts it — are shared with the docx.js renderer
|
|
28
|
+
* (`../chartText`). Everything else is the look docx.js draws, from
|
|
29
|
+
* `chartLook.ts`: gridlines, ticks, axis lines, gaps, markers and borders.
|
|
30
|
+
*/
|
|
31
|
+
export declare function chartInput(chart: DocxIrChartRun): ChartPartInput;
|
|
32
|
+
/**
|
|
33
|
+
* Finish every chart part in the package with what no option says.
|
|
19
34
|
*
|
|
20
35
|
* Parts are matched to IR nodes by content rather than by position: the emitter
|
|
21
36
|
* fills its array while *building* the backend's document object and the
|
|
22
37
|
* backend numbers its parts while *stringifying* that object, and the two walks
|
|
23
|
-
* disagree the moment a chart sits in a header or footer.
|
|
24
|
-
*
|
|
25
|
-
* saw a different chart's numbers.
|
|
38
|
+
* disagree the moment a chart sits in a header or footer. The match also
|
|
39
|
+
* proves every emitted chart reached the package.
|
|
26
40
|
*/
|
|
27
|
-
export declare function
|
|
41
|
+
export declare function finishChartParts(zip: AdmZip, charts: readonly DocxIrChartRun[]): void;
|
|
28
42
|
//# sourceMappingURL=chartParts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chartParts.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/chartParts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chartParts.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/chartParts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAKlC,OAAO,KAAK,EACV,cAAc,EAEf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CA8BhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,cAAc,EAAE,GAChC,IAAI,CAyBN"}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
/// <reference types="node" />
|
|
16
16
|
/// <reference types="node" />
|
|
17
17
|
import type { DocxIrBlock, DocxIrChartRun, DocxIrFloating, DocxIrInline, DocxIrNumbering, DocxIrParagraph, DocxIrParagraphFormatting, DocxIrRunFormatting, DocxIrSection, DocxIrTable } from '../../ir/types';
|
|
18
|
+
import type { DocumentOptions, Floating, ParagraphChild, ParagraphOptions, ParagraphStylePropertiesOptions, PictureOptions, RunStylePropertiesOptions, SectionChild, SectionOptions, TableOptions } from '@office-open/docx';
|
|
18
19
|
import { emuToPixels } from '../../ir/units';
|
|
19
|
-
type Opts = Record<string, unknown>;
|
|
20
20
|
/**
|
|
21
21
|
* One prepared image per placement size.
|
|
22
22
|
*
|
|
@@ -32,11 +32,11 @@ type Opts = Record<string, unknown>;
|
|
|
32
32
|
*/
|
|
33
33
|
export interface PreparedImage {
|
|
34
34
|
/** `png`, `jpg`, `svg`, … — the backend's media type tag. */
|
|
35
|
-
type:
|
|
35
|
+
type: PictureOptions['type'];
|
|
36
36
|
data: Buffer;
|
|
37
37
|
/** The raster Word draws when it cannot draw the vector. */
|
|
38
38
|
fallback?: {
|
|
39
|
-
type:
|
|
39
|
+
type: RasterType;
|
|
40
40
|
data: Buffer;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
@@ -52,6 +52,8 @@ export interface PreparedImage {
|
|
|
52
52
|
fileName: string;
|
|
53
53
|
fallbackFileName?: string;
|
|
54
54
|
}
|
|
55
|
+
/** The picture types the backend takes for a raster, as opposed to `svg`. */
|
|
56
|
+
export type RasterType = Exclude<PictureOptions['type'], 'svg'>;
|
|
55
57
|
export type ImageMediaFactory = (placement: {
|
|
56
58
|
widthEmu: number;
|
|
57
59
|
heightEmu: number;
|
|
@@ -74,10 +76,8 @@ export interface EmitContext {
|
|
|
74
76
|
/**
|
|
75
77
|
* Charts, in the order they were emitted.
|
|
76
78
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* post-generation splice reads it to match each part with the data the
|
|
80
|
-
* backend dropped.
|
|
79
|
+
* A chart's place here names its workbook. The post-generation pass reads
|
|
80
|
+
* it to match each emitted part with its IR node — see `chartParts.ts`.
|
|
81
81
|
*/
|
|
82
82
|
charts?: DocxIrChartRun[];
|
|
83
83
|
}
|
|
@@ -97,7 +97,7 @@ export declare function emptyContext(): EmitContext;
|
|
|
97
97
|
* Its fourth, `w:highlightCs`, is not left out by oversight: OOXML defines no
|
|
98
98
|
* such element, and the compiler never sets a highlight.
|
|
99
99
|
*/
|
|
100
|
-
export declare function runProperties(formatting: DocxIrRunFormatting | undefined):
|
|
100
|
+
export declare function runProperties(formatting: DocxIrRunFormatting | undefined): RunStylePropertiesOptions;
|
|
101
101
|
/**
|
|
102
102
|
* Turn inline nodes into paragraph children.
|
|
103
103
|
*
|
|
@@ -105,15 +105,23 @@ export declare function runProperties(formatting: DocxIrRunFormatting | undefine
|
|
|
105
105
|
* comes next, which is where the backend puts them — `<w:br/>` is run-inner
|
|
106
106
|
* content, so it has to ride on a run either way.
|
|
107
107
|
*/
|
|
108
|
-
export declare function inlineChildren(children: readonly DocxIrInline[], ctx?: EmitContext):
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
export declare function inlineChildren(children: readonly DocxIrInline[], ctx?: EmitContext): ParagraphChild[];
|
|
109
|
+
/**
|
|
110
|
+
* An IR anchor as the backend's floating options.
|
|
111
|
+
*
|
|
112
|
+
* `Floating` requires both positions; the IR states only those the document
|
|
113
|
+
* sets, and the backend writes its default for a missing one, so the object is
|
|
114
|
+
* built as the IR has it and asserted whole.
|
|
115
|
+
*/
|
|
116
|
+
export declare function floatingOptions(floating: DocxIrFloating): Floating;
|
|
117
|
+
export declare function paragraphProperties(formatting: DocxIrParagraphFormatting | undefined): ParagraphStylePropertiesOptions;
|
|
118
|
+
export declare function paragraph(block: DocxIrParagraph, ctx?: EmitContext): ParagraphOptions;
|
|
113
119
|
/** One IR block as a tagged section child, which is how the backend takes it. */
|
|
114
|
-
export declare function block(value: DocxIrBlock, ctx?: EmitContext):
|
|
115
|
-
export declare function table(value: DocxIrTable, ctx: EmitContext):
|
|
116
|
-
export declare function section(value: DocxIrSection, ctx: EmitContext, closesDocument?: boolean):
|
|
117
|
-
export declare function numberingConfig(numbering: DocxIrNumbering):
|
|
120
|
+
export declare function block(value: DocxIrBlock, ctx?: EmitContext): SectionChild;
|
|
121
|
+
export declare function table(value: DocxIrTable, ctx: EmitContext): TableOptions;
|
|
122
|
+
export declare function section(value: DocxIrSection, ctx: EmitContext, closesDocument?: boolean): SectionOptions;
|
|
123
|
+
export declare function numberingConfig(numbering: DocxIrNumbering): NumberingConfig;
|
|
124
|
+
/** One abstract numbering, as `NumberingOptions.abstractNumberings` holds it. */
|
|
125
|
+
export type NumberingConfig = NonNullable<DocumentOptions['numbering']>['abstractNumberings'][number];
|
|
118
126
|
export { emuToPixels };
|
|
119
127
|
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -1 +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,EAMX,cAAc,EAGd,cAAc,EAId,YAAY,EACZ,eAAe,EACf,eAAe,EACf,yBAAyB,EAGzB,mBAAmB,EACnB,aAAa,EAGb,WAAW,EAKZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;;AAGH,OAAO,KAAK,EACV,WAAW,EAMX,cAAc,EAGd,cAAc,EAId,YAAY,EACZ,eAAe,EACf,eAAe,EACf,yBAAyB,EAGzB,mBAAmB,EACnB,aAAa,EAGb,WAAW,EAKZ,MAAM,gBAAgB,CAAC;AACx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;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,GAAG,GAAE,WAA4B,GAChC,cAAc,EAAE,CAmIlB;AAyCD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,CA+DlE;AAoXD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,yBAAyB,GAAG,SAAS,GAChD,+BAA+B,CAmEjC;AAOD,wBAAgB,SAAS,CACvB,KAAK,EAAE,eAAe,EACtB,GAAG,GAAE,WAA4B,GAChC,gBAAgB,CAsBlB;AAuDD,iFAAiF;AACjF,wBAAgB,KAAK,CACnB,KAAK,EAAE,WAAW,EAClB,GAAG,GAAE,WAA4B,GAChC,YAAY,CAWd;AAsED,wBAAgB,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,GAAG,YAAY,CAoCxE;AAoLD,wBAAgB,OAAO,CACrB,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,WAAW,EAChB,cAAc,UAAQ,GACrB,cAAc,CA4GhB;AAoFD,wBAAgB,eAAe,CAAC,SAAS,EAAE,eAAe,GAAG,eAAe,CAsC3E;AAED,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,WAAW,CACvC,eAAe,CAAC,WAAW,CAAC,CAC7B,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* The experimental `@office-open/docx` renderer.
|
|
3
3
|
*
|
|
4
4
|
* Selecting it is explicit and opt-in; `docxjs` stays the default. The backend
|
|
5
|
-
* is
|
|
6
|
-
*
|
|
5
|
+
* is a dependency of this package, loaded at call time: only a document that
|
|
6
|
+
* selects this renderer pays for loading it, and a broken install surfaces as
|
|
7
|
+
* an install hint rather than a module-resolution failure.
|
|
7
8
|
*
|
|
8
9
|
* The capability set below is deliberately narrow. A feature is listed only
|
|
9
10
|
* when it has been proven against the real package, never from its README, and
|
|
@@ -11,9 +12,21 @@
|
|
|
11
12
|
* the pipeline reject the document before any bytes exist, instead of shipping
|
|
12
13
|
* a file with content quietly missing.
|
|
13
14
|
*/
|
|
15
|
+
import type { DocumentOptions } from '@office-open/docx';
|
|
14
16
|
import type { DocxIR, DocxIrChartRun } from '../../ir/types';
|
|
15
17
|
import type { DocxRenderer, DocxRendererId } from '../types';
|
|
16
18
|
export declare const OFFICE_OPEN_DOCX_RENDERER_ID: DocxRendererId;
|
|
19
|
+
/**
|
|
20
|
+
* The `@office-open/docx` release this adapter is built and verified against, and the
|
|
21
|
+
* exact version `package.json` pins (a test holds the two together).
|
|
22
|
+
*
|
|
23
|
+
* The adapter hands the backend its options as data, typed against this
|
|
24
|
+
* release: another one can rename or restructure them with nothing failing
|
|
25
|
+
* until a document comes out with content missing. So a different version
|
|
26
|
+
* installed — an override, a hoisted copy — refuses the renderer by name
|
|
27
|
+
* instead (`RENDERER_BACKEND_VERSION_MISMATCH`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const OFFICE_OPEN_VERSION = "0.14.6";
|
|
17
30
|
export declare function createOfficeOpenDocxRenderer(): Promise<DocxRenderer>;
|
|
18
31
|
/**
|
|
19
32
|
* Build the backend's document object for an IR document.
|
|
@@ -21,5 +34,5 @@ export declare function createOfficeOpenDocxRenderer(): Promise<DocxRenderer>;
|
|
|
21
34
|
* Exported for tests: asserting on this object is far cheaper, and far more
|
|
22
35
|
* legible, than unzipping a package.
|
|
23
36
|
*/
|
|
24
|
-
export declare function buildDocumentOptions(ir: DocxIR, charts?: DocxIrChartRun[], svgRasterFallback?: boolean): Promise<
|
|
37
|
+
export declare function buildDocumentOptions(ir: DocxIR, charts?: DocxIrChartRun[], svgRasterFallback?: boolean): Promise<DocumentOptions>;
|
|
25
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAEV,eAAe,EAGhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,MAAM,EAEN,cAAc,EAGf,MAAM,gBAAgB,CAAC;AAYxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAYhF,eAAO,MAAM,4BAA4B,EAAE,cAA8B,CAAC;AAS1E;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAwE5C,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,YAAY,CAAC,CAmE1E;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,cAAc,EAAO,EAC7B,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,eAAe,CAAC,CAkD1B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The document's Word theme, for the `office-open` backend.
|
|
3
|
+
*
|
|
4
|
+
* `@office-open/docx` always writes Office's theme part and takes no option
|
|
5
|
+
* for another: `createThemeXml()` is called with no arguments, and the only
|
|
6
|
+
* hook, `rawParts`, would replace the whole part, which means owning a
|
|
7
|
+
* complete theme document — format scheme included — instead of the backend.
|
|
8
|
+
* So the IR theme is spliced into the part the backend wrote: its name, the
|
|
9
|
+
* scheme colours it sets and the Latin faces of the major and minor fonts,
|
|
10
|
+
* as docx.js writes them from the same IR. Everything else in the part —
|
|
11
|
+
* hlink and folHlink unless set, the format scheme, the empty East Asian and
|
|
12
|
+
* complex-script faces — stays the backend's.
|
|
13
|
+
*
|
|
14
|
+
* Beyond native charts, whose lines follow Text 1 on both backends, this
|
|
15
|
+
* backend's own output refers to the theme where docx.js's does not: the
|
|
16
|
+
* built-in styles it adds and the first run of every contents field name theme
|
|
17
|
+
* colours and fonts. Replacing Office's theme with the document's is what
|
|
18
|
+
* makes those follow the document rather than Office.
|
|
19
|
+
*
|
|
20
|
+
* Every edit has to find its element exactly once. A part whose shape
|
|
21
|
+
* changed under a backend upgrade fails the render rather than shipping a
|
|
22
|
+
* theme half Office's and half the document's.
|
|
23
|
+
*/
|
|
24
|
+
import type AdmZip from 'adm-zip';
|
|
25
|
+
import type { DocxIrTheme } from '../../ir/types';
|
|
26
|
+
/** Write the IR theme into the theme part the backend wrote. */
|
|
27
|
+
export declare function spliceTheme(zip: AdmZip, theme: DocxIrTheme): void;
|
|
28
|
+
//# sourceMappingURL=themePart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themePart.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/themePart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAwB,MAAM,gBAAgB,CAAC;AAkExE,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAyCjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeToStyles.d.ts","sourceRoot":"","sources":["../../src/styles/themeToStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAC3D,eAAO,MAAM,8BAA8B,yBAAyB,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIlE,CAAC;AAEF,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,kDAAk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aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA2X3C,wBAAgB,oBAAoB,CAClC,iBAAiB,GAAE,MAAM,GAAG,WAA0B,EACtD,QAAQ,CAAC,EAAE,MAAM,GAChB,YAAY,CA6jBd;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,GACjB,oBAAoB,EAAE,CAiFxB"}
|
|
@@ -89,7 +89,9 @@ export declare const getBodyTextStyle: (theme?: ThemeConfig, themeName?: string)
|
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
91
91
|
* Converts line spacing from theme definition to DOCX spacing options.
|
|
92
|
-
* DOCX uses twips (1/20th of a point) for line spacing
|
|
92
|
+
* DOCX uses twips (1/20th of a point) for line spacing, and 240ths of a line
|
|
93
|
+
* for a multiple — whole numbers either way, since `w:line` is an integer and
|
|
94
|
+
* neither backend rounds it: a 1.02-line title is 244.8 of them.
|
|
93
95
|
* @param lineSpacing The line spacing object from the theme definition.
|
|
94
96
|
* @returns IParagraphSpacingOptions for docx.
|
|
95
97
|
*/
|
|
@@ -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;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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