@json-to-office/core-docx 1.1.0 → 1.4.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.
Files changed (35) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +483 -148
  4. package/dist/index.js.map +1 -1
  5. package/dist/ir/compiler.d.ts.map +1 -1
  6. package/dist/ir/features.d.ts +1 -1
  7. package/dist/ir/features.d.ts.map +1 -1
  8. package/dist/ir/types.d.ts +46 -1
  9. package/dist/ir/types.d.ts.map +1 -1
  10. package/dist/ir/validation.d.ts.map +1 -1
  11. package/dist/plugin/example/index.js +479 -148
  12. package/dist/plugin/example/index.js.map +1 -1
  13. package/dist/renderers/docxjs/emit.d.ts.map +1 -1
  14. package/dist/renderers/docxjs/index.d.ts.map +1 -1
  15. package/dist/renderers/office-open/chartParts.d.ts +28 -0
  16. package/dist/renderers/office-open/chartParts.d.ts.map +1 -0
  17. package/dist/renderers/office-open/emit.d.ts +10 -1
  18. package/dist/renderers/office-open/emit.d.ts.map +1 -1
  19. package/dist/renderers/office-open/index.d.ts +2 -2
  20. package/dist/renderers/office-open/index.d.ts.map +1 -1
  21. package/dist/renderers/registry.d.ts +18 -4
  22. package/dist/renderers/registry.d.ts.map +1 -1
  23. package/dist/styles/themeToStyles.d.ts +35 -1
  24. package/dist/styles/themeToStyles.d.ts.map +1 -1
  25. package/dist/templates/themes/apex.docx.theme.json +1 -2
  26. package/dist/templates/themes/corporate.docx.theme.json +1 -2
  27. package/dist/templates/themes/devportal.docx.theme.json +1 -2
  28. package/dist/templates/themes/minimal.docx.theme.json +1 -2
  29. package/dist/templates/themes/modern.docx.theme.json +1 -2
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/utils/chartWorkbook.d.ts +19 -0
  32. package/dist/utils/chartWorkbook.d.ts.map +1 -0
  33. package/dist/utils/packageDocument.d.ts +2 -0
  34. package/dist/utils/packageDocument.d.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B,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;AAyB3D,wBAAgB,oBAAoB,IAAI,YAAY,CA0BnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,SAAS,GAAE,aAAyB,GACnC,QAAQ,CA2CV"}
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;AAwC3D,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,EAQX,cAAc,EAId,YAAY,EACZ,eAAe,EACf,eAAe,EACf,yBAAyB,EAGzB,mBAAmB,EACnB,aAAa,EAGb,WAAW,EAKZ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
@@ -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;AAGH,OAAO,KAAK,EACV,MAAM,EAIP,MAAM,gBAAgB,CAAC;AAMxB,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,CA0C1E;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2ClC"}
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;AA8D1E,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"}
@@ -1,15 +1,29 @@
1
1
  /**
2
2
  * DOCX renderer registry.
3
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.
4
+ * Adapters are registered as async factories so a backend is only imported
5
+ * when it is actually selected — choosing `docxjs` never loads
6
+ * `@office-open/docx`, and a backend that cannot be loaded at all (an
7
+ * `--omit=optional` install, a broken tree) surfaces as an actionable install
8
+ * hint rather than a bare module-resolution failure. `statuses()` asks the
9
+ * same question up front, so a discovery surface never advertises a renderer
10
+ * that would fail on the first render.
8
11
  */
12
+ import { type RendererStatus } from '@json-to-office/shared/rendering';
9
13
  import { type DocxRenderer, type DocxRendererId } from './types';
10
14
  /** Resolve a renderer by id, defaulting to `docxjs`. */
11
15
  export declare function resolveDocxRenderer(id?: DocxRendererId): Promise<DocxRenderer>;
12
16
  /** Renderer ids registered for DOCX. */
13
17
  export declare function docxRendererIds(): readonly DocxRendererId[];
18
+ /**
19
+ * Every registered renderer with whether its backend can be loaded here.
20
+ *
21
+ * Registration is not availability: the factory only runs on selection, so an
22
+ * id alone says nothing about whether the render behind it will work. Callers
23
+ * that advertise renderers — `jto_info`, `jto_discover` — report this instead
24
+ * of docxRendererIds() so a renderer that cannot run is never offered as one
25
+ * that can.
26
+ */
27
+ export declare function docxRendererStatuses(): Promise<RendererStatus<DocxRendererId>[]>;
14
28
  export declare function isDocxRendererId(value: string): value is DocxRendererId;
15
29
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/renderers/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAC;AAG1C,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;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAC7C,cAAc,CAAC,cAAc,CAAC,EAAE,CACjC,CAEA;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEvE"}
@@ -6,7 +6,41 @@
6
6
  * shape, so which styles a document defines — and what each one says — is
7
7
  * decided once, here, rather than once per renderer.
8
8
  */
9
- import type { DocxIrStyles } from '../ir/types';
9
+ /**
10
+ * Style ids a `statistic` lowers to.
11
+ *
12
+ * Exported because the compiler names them on every statistic paragraph it
13
+ * emits and the two must not drift: a `w:pStyle` pointing at a style the
14
+ * document does not define is not an error anywhere in OOXML, it just resolves
15
+ * to Normal — which is how the component came to render as two ordinary body
16
+ * paragraphs with nothing to tell the number from its caption.
17
+ */
18
+ export declare const STATISTIC_NUMBER_STYLE_ID = "StatisticNumber";
19
+ export declare const STATISTIC_DESCRIPTION_STYLE_ID = "StatisticDescription";
20
+ /**
21
+ * The number's size, in points, per the component's `size` prop.
22
+ *
23
+ * `medium` is what the style itself carries; the compiler overrides the run
24
+ * for the other two, so a document that never states `size` needs no run
25
+ * properties at all and restyling every statistic stays a one-style edit.
26
+ */
27
+ export declare const STATISTIC_SIZE_POINTS: Readonly<Record<string, number>>;
28
+ import type { DocxIrParagraphStyle, DocxIrStyles } from '../ir/types';
10
29
  import type { ThemeConfig } from './index';
11
30
  export declare function createDocumentStyles(themeNameOrObject?: string | ThemeConfig, language?: string): DocxIrStyles;
31
+ /**
32
+ * The two paragraph styles a `statistic` lowers to.
33
+ *
34
+ * Separate from `createDocumentStyles`, and appended by the compiler only when
35
+ * the document actually contains a statistic. Defining them unconditionally
36
+ * would rewrite `word/styles.xml` in every document ever produced — including
37
+ * the ones with no statistic in them — to fix a component most documents never
38
+ * use, and every recorded golden with it.
39
+ *
40
+ * A theme that names either id under `styles` has already had it emitted as a
41
+ * custom style, so that one is skipped rather than defined twice: two entries
42
+ * with the same id leave the later one winning, and the later one here is the
43
+ * default, not the theme's.
44
+ */
45
+ export declare function createStatisticStyles(theme: ThemeConfig): DocxIrParagraphStyle[];
12
46
  //# sourceMappingURL=themeToStyles.d.ts.map
@@ -1 +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
+ {"version":3,"file":"themeToStyles.d.ts","sourceRoot":"","sources":["../../src/styles/themeToStyles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH;;;;;;;;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,OAAO,KAAK,EAMV,oBAAoB,EAEpB,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;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,GACjB,oBAAoB,EAAE,CAmExB"}
@@ -102,8 +102,7 @@
102
102
  },
103
103
  "list": {
104
104
  "format": "bullet",
105
- "bullet": "\u2022",
106
- "indent": 3
105
+ "bullet": "\u2022"
107
106
  },
108
107
  "image": {
109
108
  "alignment": "center"
@@ -102,8 +102,7 @@
102
102
  },
103
103
  "list": {
104
104
  "format": "bullet",
105
- "bullet": "\u2022",
106
- "indent": 3
105
+ "bullet": "\u2022"
107
106
  },
108
107
  "statistic": {
109
108
  "alignment": "center"
@@ -110,8 +110,7 @@
110
110
  },
111
111
  "list": {
112
112
  "format": "bullet",
113
- "bullet": "\u2013",
114
- "indent": 3
113
+ "bullet": "\u2013"
115
114
  },
116
115
  "image": {
117
116
  "alignment": "center"
@@ -170,8 +170,7 @@
170
170
  },
171
171
  "list": {
172
172
  "format": "bullet",
173
- "bullet": "•",
174
- "indent": 3
173
+ "bullet": "•"
175
174
  },
176
175
  "image": {
177
176
  "alignment": "left"
@@ -94,8 +94,7 @@
94
94
  },
95
95
  "list": {
96
96
  "format": "bullet",
97
- "bullet": "\u2013",
98
- "indent": 3
97
+ "bullet": "\u2013"
99
98
  },
100
99
  "image": {
101
100
  "alignment": "center"