@json-to-office/core-docx 1.1.0 → 1.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 +262 -7
- package/dist/index.js.map +1 -1
- package/dist/ir/compiler.d.ts.map +1 -1
- package/dist/ir/features.d.ts +1 -1
- package/dist/ir/features.d.ts.map +1 -1
- package/dist/ir/types.d.ts +46 -1
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/validation.d.ts.map +1 -1
- package/dist/plugin/example/index.js +262 -7
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/renderers/docxjs/emit.d.ts.map +1 -1
- package/dist/renderers/docxjs/index.d.ts.map +1 -1
- package/dist/renderers/office-open/chartParts.d.ts +28 -0
- package/dist/renderers/office-open/chartParts.d.ts.map +1 -0
- package/dist/renderers/office-open/emit.d.ts +10 -1
- package/dist/renderers/office-open/emit.d.ts.map +1 -1
- package/dist/renderers/office-open/index.d.ts +2 -2
- package/dist/renderers/office-open/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/chartWorkbook.d.ts +19 -0
- package/dist/utils/chartWorkbook.d.ts.map +1 -0
- package/dist/utils/packageDocument.d.ts +2 -0
- package/dist/utils/packageDocument.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +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,gBAA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,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,CAqKlB;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"}
|
|
@@ -1 +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;
|
|
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;AA6B3D,wBAAgB,oBAAoB,IAAI,YAAY,CA0BnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,SAAS,GAAE,aAAyB,GACnC,QAAQ,CA2CV"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packaging a native chart's missing half, for DOCX.
|
|
3
|
+
*
|
|
4
|
+
* The repairs themselves — the cell references that fill an empty `<c:f/>`, the
|
|
5
|
+
* series colours, the axis titles, the legend position and `c:externalData` —
|
|
6
|
+
* are format-neutral and live in `chart-parts` in
|
|
7
|
+
* `@json-to-office/shared/rendering`, which explains why a chart emitted by
|
|
8
|
+
* `@office-open` needs repairing at all. A `c:chartSpace` is DrawingML: the
|
|
9
|
+
* pptx sibling of this file makes exactly the same edits.
|
|
10
|
+
*
|
|
11
|
+
* What is here is only what a Word package spells its own way — `word/charts`,
|
|
12
|
+
* `word/embeddings`, the chart's rels part, the content-type override — plus
|
|
13
|
+
* adm-zip, which is this core's archive library.
|
|
14
|
+
*/
|
|
15
|
+
import type AdmZip from 'adm-zip';
|
|
16
|
+
import type { DocxIrChartRun } from '../../ir/types';
|
|
17
|
+
/**
|
|
18
|
+
* Give every chart in the package its workbook, colours and axis titles.
|
|
19
|
+
*
|
|
20
|
+
* Parts are matched to IR nodes by content rather than by position: the emitter
|
|
21
|
+
* fills its array while *building* the backend's document object and the
|
|
22
|
+
* backend numbers its parts while *stringifying* that object, and the two walks
|
|
23
|
+
* disagree the moment a chart sits in a header or footer. Pairing by position
|
|
24
|
+
* handed charts another chart's workbook, so a recipient choosing "Edit Data"
|
|
25
|
+
* saw a different chart's numbers.
|
|
26
|
+
*/
|
|
27
|
+
export declare function spliceChartParts(zip: AdmZip, charts: readonly DocxIrChartRun[]): void;
|
|
28
|
+
//# sourceMappingURL=chartParts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartParts.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/chartParts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAQlC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA2CrD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,cAAc,EAAE,GAChC,IAAI,CAkCN"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* called. Reaching a `throw` here is a bug, not a user error.
|
|
14
14
|
*/
|
|
15
15
|
/// <reference types="node" />
|
|
16
|
-
import type { DocxIrBlock, DocxIrFloating, DocxIrInline, DocxIrNumbering, DocxIrParagraph, DocxIrParagraphFormatting, DocxIrRunFormatting, DocxIrSection, DocxIrTable } from '../../ir/types';
|
|
16
|
+
import type { DocxIrBlock, DocxIrChartRun, DocxIrFloating, DocxIrInline, DocxIrNumbering, DocxIrParagraph, DocxIrParagraphFormatting, DocxIrRunFormatting, DocxIrSection, DocxIrTable } from '../../ir/types';
|
|
17
17
|
import { emuToPixels } from '../../ir/units';
|
|
18
18
|
type Opts = Record<string, unknown>;
|
|
19
19
|
/**
|
|
@@ -70,6 +70,15 @@ export interface EmitContext {
|
|
|
70
70
|
pictures: ReadonlyMap<string, ImageMediaFactory>;
|
|
71
71
|
/** Allocate the next `wp:docPr` id for this document. */
|
|
72
72
|
nextDrawingId: () => number;
|
|
73
|
+
/**
|
|
74
|
+
* Charts, in the order they were emitted.
|
|
75
|
+
*
|
|
76
|
+
* The backend numbers `word/charts/chartN.xml` by the order it stringifies
|
|
77
|
+
* chart runs, which is document order — the same order this array fills. The
|
|
78
|
+
* post-generation splice reads it to match each part with the data the
|
|
79
|
+
* backend dropped.
|
|
80
|
+
*/
|
|
81
|
+
charts?: DocxIrChartRun[];
|
|
73
82
|
}
|
|
74
83
|
/** A context for content that holds no drawings, and for tests. */
|
|
75
84
|
export declare function emptyContext(): EmitContext;
|
|
@@ -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,
|
|
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,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAE1D,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C;;;;;;;;;OASG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,iBAAiB,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,WAAW,EAAE,CAAC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* the pipeline reject the document before any bytes exist, instead of shipping
|
|
12
12
|
* a file with content quietly missing.
|
|
13
13
|
*/
|
|
14
|
-
import type { DocxIR } from '../../ir/types';
|
|
14
|
+
import type { DocxIR, DocxIrChartRun } from '../../ir/types';
|
|
15
15
|
import type { DocxRenderer, DocxRendererId } from '../types';
|
|
16
16
|
export declare const OFFICE_OPEN_DOCX_RENDERER_ID: DocxRendererId;
|
|
17
17
|
export declare function createOfficeOpenDocxRenderer(): Promise<DocxRenderer>;
|
|
@@ -21,5 +21,5 @@ export declare function createOfficeOpenDocxRenderer(): Promise<DocxRenderer>;
|
|
|
21
21
|
* Exported for tests: asserting on this object is far cheaper, and far more
|
|
22
22
|
* legible, than unzipping a package.
|
|
23
23
|
*/
|
|
24
|
-
export declare function buildDocumentOptions(ir: DocxIR): Promise<Record<string, unknown>>;
|
|
24
|
+
export declare function buildDocumentOptions(ir: DocxIR, charts?: DocxIrChartRun[]): Promise<Record<string, unknown>>;
|
|
25
25
|
//# 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;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/office-open/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EACV,MAAM,EAEN,cAAc,EAGf,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAWhF,eAAO,MAAM,4BAA4B,EAAE,cAA8B,CAAC;AAwC1E,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,YAAY,CAAC,CAqD1E;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,cAAc,EAAO,GAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA4ClC"}
|