@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.
Files changed (54) hide show
  1. package/dist/index.js +1647 -427
  2. package/dist/index.js.map +1 -1
  3. package/dist/ir/chartValues.d.ts +16 -0
  4. package/dist/ir/chartValues.d.ts.map +1 -0
  5. package/dist/ir/compiler.d.ts.map +1 -1
  6. package/dist/ir/features.d.ts.map +1 -1
  7. package/dist/ir/theme.d.ts +43 -0
  8. package/dist/ir/theme.d.ts.map +1 -0
  9. package/dist/ir/types.d.ts +45 -3
  10. package/dist/ir/types.d.ts.map +1 -1
  11. package/dist/ir/units.d.ts +12 -0
  12. package/dist/ir/units.d.ts.map +1 -1
  13. package/dist/ir/validation.d.ts +2 -1
  14. package/dist/ir/validation.d.ts.map +1 -1
  15. package/dist/plugin/example/index.js +1644 -424
  16. package/dist/plugin/example/index.js.map +1 -1
  17. package/dist/quality/text-inventory.d.ts +13 -3
  18. package/dist/quality/text-inventory.d.ts.map +1 -1
  19. package/dist/renderers/chartText.d.ts +43 -0
  20. package/dist/renderers/chartText.d.ts.map +1 -0
  21. package/dist/renderers/docxjs/charts.d.ts +45 -0
  22. package/dist/renderers/docxjs/charts.d.ts.map +1 -0
  23. package/dist/renderers/docxjs/docxSubpath.d.ts +34 -0
  24. package/dist/renderers/docxjs/docxSubpath.d.ts.map +1 -0
  25. package/dist/renderers/docxjs/drawingGroup.d.ts +79 -0
  26. package/dist/renderers/docxjs/drawingGroup.d.ts.map +1 -0
  27. package/dist/renderers/docxjs/drawingGroupRepair.d.ts +36 -0
  28. package/dist/renderers/docxjs/drawingGroupRepair.d.ts.map +1 -0
  29. package/dist/renderers/docxjs/emit.d.ts +10 -2
  30. package/dist/renderers/docxjs/emit.d.ts.map +1 -1
  31. package/dist/renderers/docxjs/index.d.ts +2 -1
  32. package/dist/renderers/docxjs/index.d.ts.map +1 -1
  33. package/dist/renderers/docxjs/presetShapes.d.ts +233 -0
  34. package/dist/renderers/docxjs/presetShapes.d.ts.map +1 -0
  35. package/dist/renderers/office-open/chartLook.d.ts +45 -0
  36. package/dist/renderers/office-open/chartLook.d.ts.map +1 -0
  37. package/dist/renderers/office-open/chartParts.d.ts +29 -15
  38. package/dist/renderers/office-open/chartParts.d.ts.map +1 -1
  39. package/dist/renderers/office-open/emit.d.ts +25 -17
  40. package/dist/renderers/office-open/emit.d.ts.map +1 -1
  41. package/dist/renderers/office-open/index.d.ts +16 -3
  42. package/dist/renderers/office-open/index.d.ts.map +1 -1
  43. package/dist/renderers/office-open/themePart.d.ts +28 -0
  44. package/dist/renderers/office-open/themePart.d.ts.map +1 -0
  45. package/dist/styles/themeToStyles.d.ts.map +1 -1
  46. package/dist/styles/utils/styleHelpers.d.ts +3 -1
  47. package/dist/styles/utils/styleHelpers.d.ts.map +1 -1
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/dist/utils/chartWorkbook.d.ts +2 -1
  50. package/dist/utils/chartWorkbook.d.ts.map +1 -1
  51. package/dist/utils/fixFloatingImageIds.d.ts +17 -9
  52. package/dist/utils/fixFloatingImageIds.d.ts.map +1 -1
  53. package/dist/utils/packageDocument.d.ts.map +1 -1
  54. package/package.json +7 -7
@@ -7,6 +7,7 @@
7
7
  * turning those five parts into a ZIP, with adm-zip, which is this core's
8
8
  * archive library and not the other's.
9
9
  */
10
+ import { chartWorkbookParts } from '@json-to-office/shared/rendering';
10
11
  import type { ChartPartSeries } from '@json-to-office/shared/rendering';
11
12
  /**
12
13
  * Build the xlsx package a chart's `c:externalData` points at.
@@ -14,6 +15,6 @@ import type { ChartPartSeries } from '@json-to-office/shared/rendering';
14
15
  * Entry order comes from the shared part list rather than from iteration
15
16
  * order here, so the ZIP central directory is a function of the data alone.
16
17
  */
17
- export declare function buildChartWorkbook(series: readonly ChartPartSeries[]): Uint8Array;
18
+ export declare function buildChartWorkbook(series: readonly ChartPartSeries[], options?: Parameters<typeof chartWorkbookParts>[1]): Uint8Array;
18
19
  export { CHART_WORKBOOK_SHEET_NAME, categoryReference, columnLetter, seriesNameReference, seriesValueReference, } from '@json-to-office/shared/rendering';
19
20
  //# sourceMappingURL=chartWorkbook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chartWorkbook.d.ts","sourceRoot":"","sources":["../../src/utils/chartWorkbook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAMxE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,eAAe,EAAE,GACjC,UAAU,CAgBZ;AAED,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"chartWorkbook.d.ts","sourceRoot":"","sources":["../../src/utils/chartWorkbook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAMxE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,OAAO,GAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAM,GACrD,UAAU,CAgBZ;AAED,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC"}
@@ -1,18 +1,26 @@
1
1
  /**
2
- * Post-processing utility to fix docx.js floating image bugs
2
+ * Give every drawing in a docx.js package a deterministic, package-unique
3
+ * `wp:docPr` id.
3
4
  *
4
- * The docx library (as of v9.7.1) has a known issue with floating images:
5
- * 1. Duplicate wp:docPr IDs (GitHub issue #2719)
5
+ * docx 9.8.0 draws `wp:docPr` ids from one counter shared by every drawing in
6
+ * the process (dolanmiu/docx#3521): unique, but the numbers depend on how many
7
+ * drawings were created before this document, so the same document rendered
8
+ * twice produces different bytes. Before 9.8.0 the ids were per instance and
9
+ * every drawing outside `document.xml` carried `id="1"`.
6
10
  *
7
- * Historical note: We previously also post-processed relativeHeight and
8
- * wrapTight elements. Those steps were removed because we always provide a
9
- * valid zIndex upstream and we do not support 'tight' wrapping.
10
- *
11
- * This utility extracts the DOCX, fixes duplicate IDs, and re-packages it.
11
+ * OOXML wants the id unique across the whole document, headers and notes
12
+ * included, so this pass renumbers one sequence across every part that can
13
+ * hold a drawing, in a fixed order: the body first, then headers and footers
14
+ * by number, then footnotes, endnotes and comments. The body's ids are the
15
+ * ones the pre-9.8.0 pass wrote, so a document without chrome drawings is
16
+ * unchanged.
12
17
  */
13
18
  /// <reference types="node" />
14
19
  /// <reference types="node" />
15
- /** Fix duplicate floating-image IDs without touching the filesystem. */
20
+ export declare const DRAWING_PART: RegExp;
21
+ /** The order ids are allocated in: body, headers, footers, notes, comments. */
22
+ export declare function compareDrawingParts(a: string, b: string): number;
23
+ /** Renumber every `wp:docPr` id in the package, one sequence across parts. */
16
24
  export declare function fixFloatingImageIdsInBuffer(buffer: Buffer): Buffer;
17
25
  /**
18
26
  * Fix floating image issues in a generated DOCX file
@@ -1 +1 @@
1
- {"version":3,"file":"fixFloatingImageIds.d.ts","sourceRoot":"","sources":["../../src/utils/fixFloatingImageIds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;;AAKH,wEAAwE;AACxE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAwBlE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE"}
1
+ {"version":3,"file":"fixFloatingImageIds.d.ts","sourceRoot":"","sources":["../../src/utils/fixFloatingImageIds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAKH,eAAO,MAAM,YAAY,QACiD,CAAC;AAU3E,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKhE;AAED,8EAA8E;AAC9E,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA8BlE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"packageDocument.d.ts","sourceRoot":"","sources":["../../src/utils/packageDocument.ts"],"names":[],"mappings":";;AAGA,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,MAAuC,CAAC;AAE5E,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAiB5E;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAU5C;AA0FD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,IAA8B,GAC1C,MAAM,CAgCR;AAED,0EAA0E;AAC1E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG9D"}
1
+ {"version":3,"file":"packageDocument.d.ts","sourceRoot":"","sources":["../../src/utils/packageDocument.ts"],"names":[],"mappings":";;AAGA,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,MAAuC,CAAC;AAE5E,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAiB5E;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAU5C;AA4MD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,IAA8B,GAC1C,MAAM,CA8BR;AAED,0EAA0E;AAC1E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG9D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-to-office/core-docx",
3
- "version": "7.1.2",
3
+ "version": "7.3.0",
4
4
  "description": "Core DOCX document generation engine",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -18,21 +18,21 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@office-open/docx": "0.11.0",
21
+ "@office-open/docx": "0.14.6",
22
22
  "@resvg/resvg-js": "2.6.2",
23
23
  "@sinclair/typebox": "0.34.38",
24
24
  "adm-zip": "0.5.16",
25
25
  "date-fns": "3.6.0",
26
26
  "probe-image-size": "7.2.3",
27
- "@json-to-office/quality": "^7.0.0",
28
- "@json-to-office/shared-docx": "^7.1.2",
29
- "@json-to-office/shared": "^7.0.1"
27
+ "@json-to-office/quality": "^7.2.0",
28
+ "@json-to-office/shared": "^7.3.0",
29
+ "@json-to-office/shared-docx": "^7.3.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "docx": "9.7.1"
32
+ "docx": "9.8.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@office-open/core": "0.11.0",
35
+ "@office-open/core": "0.14.6",
36
36
  "@types/adm-zip": "0.5.7",
37
37
  "@types/node": "22.20.2",
38
38
  "@types/probe-image-size": "7.2.4",