@cj-tech-master/excelts 9.4.2 → 9.5.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 (618) hide show
  1. package/dist/browser/index.browser.d.ts +8 -5
  2. package/dist/browser/index.browser.js +19 -1
  3. package/dist/browser/index.d.ts +4 -2
  4. package/dist/browser/index.js +9 -1
  5. package/dist/browser/modules/excel/chart/cache-populator.d.ts +49 -0
  6. package/dist/browser/modules/excel/chart/cache-populator.js +1171 -0
  7. package/dist/browser/modules/excel/chart/chart-api.d.ts +92 -0
  8. package/dist/browser/modules/excel/chart/chart-api.js +364 -0
  9. package/dist/browser/modules/excel/chart/chart-builder.d.ts +48 -0
  10. package/dist/browser/modules/excel/chart/chart-builder.js +2432 -0
  11. package/dist/browser/modules/excel/chart/chart-ex-builder.d.ts +36 -0
  12. package/dist/browser/modules/excel/chart/chart-ex-builder.js +903 -0
  13. package/dist/browser/modules/excel/chart/chart-ex-parser.d.ts +8 -0
  14. package/dist/browser/modules/excel/chart/chart-ex-parser.js +1205 -0
  15. package/dist/browser/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
  16. package/dist/browser/modules/excel/chart/chart-ex-renderer.js +5352 -0
  17. package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +531 -0
  18. package/dist/browser/modules/excel/chart/chart-ex-types.js +11 -0
  19. package/dist/browser/modules/excel/chart/chart-images.d.ts +78 -0
  20. package/dist/browser/modules/excel/chart/chart-images.js +363 -0
  21. package/dist/browser/modules/excel/chart/chart-presets.d.ts +392 -0
  22. package/dist/browser/modules/excel/chart/chart-presets.js +179 -0
  23. package/dist/browser/modules/excel/chart/chart-renderer.d.ts +550 -0
  24. package/dist/browser/modules/excel/chart/chart-renderer.js +6440 -0
  25. package/dist/browser/modules/excel/chart/chart-sidecar.d.ts +21 -0
  26. package/dist/browser/modules/excel/chart/chart-sidecar.js +427 -0
  27. package/dist/browser/modules/excel/chart/chart-utils.d.ts +306 -0
  28. package/dist/browser/modules/excel/chart/chart-utils.js +821 -0
  29. package/dist/browser/modules/excel/chart/chart.d.ts +504 -0
  30. package/dist/browser/modules/excel/chart/chart.js +1320 -0
  31. package/dist/browser/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
  32. package/dist/browser/modules/excel/chart/glyph-rasterizer.js +658 -0
  33. package/dist/browser/modules/excel/chart/index.d.ts +54 -0
  34. package/dist/browser/modules/excel/chart/index.js +46 -0
  35. package/dist/browser/modules/excel/chart/install.d.ts +44 -0
  36. package/dist/browser/modules/excel/chart/install.js +91 -0
  37. package/dist/browser/modules/excel/chart/shape-properties.d.ts +156 -0
  38. package/dist/browser/modules/excel/chart/shape-properties.js +1557 -0
  39. package/dist/browser/modules/excel/chart/stroke-font.d.ts +36 -0
  40. package/dist/browser/modules/excel/chart/stroke-font.js +1556 -0
  41. package/dist/browser/modules/excel/chart/topojson.d.ts +98 -0
  42. package/dist/browser/modules/excel/chart/topojson.js +236 -0
  43. package/dist/browser/modules/excel/chart/types.d.ts +2559 -0
  44. package/dist/browser/modules/excel/chart/types.js +8 -0
  45. package/dist/browser/modules/excel/chart-host-registry.d.ts +157 -0
  46. package/dist/browser/modules/excel/chart-host-registry.js +90 -0
  47. package/dist/browser/modules/excel/chartsheet.d.ts +102 -0
  48. package/dist/browser/modules/excel/chartsheet.js +196 -0
  49. package/dist/browser/modules/excel/defined-names.d.ts +35 -0
  50. package/dist/browser/modules/excel/defined-names.js +44 -4
  51. package/dist/browser/modules/excel/errors.d.ts +6 -0
  52. package/dist/browser/modules/excel/errors.js +9 -0
  53. package/dist/browser/modules/excel/form-control.d.ts +6 -0
  54. package/dist/browser/modules/excel/form-control.js +17 -0
  55. package/dist/browser/modules/excel/image.js +12 -2
  56. package/dist/browser/modules/excel/pivot-chart.d.ts +7 -0
  57. package/dist/browser/modules/excel/pivot-chart.js +53 -0
  58. package/dist/browser/modules/excel/pivot-table.d.ts +55 -0
  59. package/dist/browser/modules/excel/pivot-table.js +35 -0
  60. package/dist/browser/modules/excel/range.js +5 -1
  61. package/dist/browser/modules/excel/sparkline/index.d.ts +7 -0
  62. package/dist/browser/modules/excel/sparkline/index.js +7 -0
  63. package/dist/browser/modules/excel/sparkline/sparkline.d.ts +206 -0
  64. package/dist/browser/modules/excel/sparkline/sparkline.js +750 -0
  65. package/dist/browser/modules/excel/stream/worksheet-writer.js +3 -2
  66. package/dist/browser/modules/excel/table.js +42 -6
  67. package/dist/browser/modules/excel/types.d.ts +72 -0
  68. package/dist/browser/modules/excel/utils/address.d.ts +18 -0
  69. package/dist/browser/modules/excel/utils/address.js +28 -0
  70. package/dist/browser/modules/excel/utils/drawing-utils.js +11 -6
  71. package/dist/browser/modules/excel/utils/guid.d.ts +15 -0
  72. package/dist/browser/modules/excel/utils/guid.js +35 -0
  73. package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +74 -0
  74. package/dist/browser/modules/excel/utils/ooxml-paths.js +206 -9
  75. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
  76. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
  77. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
  78. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
  79. package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
  80. package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
  81. package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
  82. package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
  83. package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
  84. package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
  85. package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
  86. package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
  87. package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
  88. package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
  89. package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
  90. package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
  91. package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
  92. package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
  93. package/dist/browser/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
  94. package/dist/browser/modules/excel/utils/ooxml-validator/check-table.js +177 -0
  95. package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
  96. package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
  97. package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
  98. package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
  99. package/dist/browser/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
  100. package/dist/browser/modules/excel/utils/ooxml-validator/context.js +191 -0
  101. package/dist/browser/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
  102. package/dist/browser/modules/excel/utils/ooxml-validator/index.js +102 -0
  103. package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
  104. package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
  105. package/dist/browser/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
  106. package/dist/browser/modules/excel/utils/ooxml-validator/reporter.js +61 -0
  107. package/dist/browser/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
  108. package/dist/browser/modules/excel/utils/ooxml-validator/types.js +12 -0
  109. package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
  110. package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
  111. package/dist/browser/modules/excel/workbook.browser.d.ts +248 -30
  112. package/dist/browser/modules/excel/workbook.browser.js +966 -31
  113. package/dist/browser/modules/excel/workbook.d.ts +43 -0
  114. package/dist/browser/modules/excel/workbook.js +48 -0
  115. package/dist/browser/modules/excel/worksheet.d.ts +157 -3
  116. package/dist/browser/modules/excel/worksheet.js +394 -35
  117. package/dist/browser/modules/excel/xlsx/rel-type.d.ts +40 -0
  118. package/dist/browser/modules/excel/xlsx/rel-type.js +41 -1
  119. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
  120. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  121. package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  122. package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  123. package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
  124. package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
  125. package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
  126. package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
  127. package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
  128. package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  129. package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  130. package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
  131. package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  132. package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
  133. package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
  134. package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
  135. package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  136. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
  137. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  138. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
  139. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  140. package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
  141. package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
  142. package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
  143. package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  144. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
  145. package/dist/browser/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  146. package/dist/browser/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  147. package/dist/browser/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
  148. package/dist/browser/modules/excel/xlsx/xform/xsd-values.js +101 -0
  149. package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
  150. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +4422 -78
  151. package/dist/browser/modules/pdf/builder/document-builder.d.ts +74 -0
  152. package/dist/browser/modules/pdf/builder/document-builder.js +507 -2
  153. package/dist/browser/modules/pdf/builder/pdf-editor.js +48 -3
  154. package/dist/browser/modules/pdf/excel-bridge.d.ts +69 -0
  155. package/dist/browser/modules/pdf/excel-bridge.js +683 -12
  156. package/dist/browser/modules/pdf/font/font-manager.d.ts +25 -0
  157. package/dist/browser/modules/pdf/font/font-manager.js +39 -0
  158. package/dist/browser/modules/pdf/index.d.ts +5 -2
  159. package/dist/browser/modules/pdf/index.js +3 -1
  160. package/dist/browser/modules/pdf/render/chart-surface.d.ts +33 -0
  161. package/dist/browser/modules/pdf/render/chart-surface.js +200 -0
  162. package/dist/browser/modules/pdf/render/layout-engine.d.ts +22 -1
  163. package/dist/browser/modules/pdf/render/layout-engine.js +436 -56
  164. package/dist/browser/modules/pdf/render/page-renderer.js +169 -28
  165. package/dist/browser/modules/pdf/render/pdf-exporter.js +117 -7
  166. package/dist/browser/modules/pdf/types.d.ts +227 -23
  167. package/dist/browser/modules/pdf/types.js +4 -0
  168. package/dist/browser/modules/pdf/word-bridge.d.ts +47 -0
  169. package/dist/browser/modules/pdf/word-bridge.js +304 -0
  170. package/dist/browser/modules/word/constants.d.ts +179 -0
  171. package/dist/browser/modules/word/constants.js +231 -0
  172. package/dist/browser/modules/word/content-types.d.ts +27 -0
  173. package/dist/browser/modules/word/content-types.js +53 -0
  174. package/dist/browser/modules/word/digital-signatures.d.ts +87 -0
  175. package/dist/browser/modules/word/digital-signatures.js +134 -0
  176. package/dist/browser/modules/word/document.d.ts +728 -0
  177. package/dist/browser/modules/word/document.js +1795 -0
  178. package/dist/browser/modules/word/docx-packager.d.ts +14 -0
  179. package/dist/browser/modules/word/docx-packager.js +822 -0
  180. package/dist/browser/modules/word/docx-reader.d.ts +11 -0
  181. package/dist/browser/modules/word/docx-reader.js +4929 -0
  182. package/dist/browser/modules/word/encryption.d.ts +102 -0
  183. package/dist/browser/modules/word/encryption.js +274 -0
  184. package/dist/browser/modules/word/errors.d.ts +49 -0
  185. package/dist/browser/modules/word/errors.js +68 -0
  186. package/dist/browser/modules/word/font-obfuscation.d.ts +31 -0
  187. package/dist/browser/modules/word/font-obfuscation.js +83 -0
  188. package/dist/browser/modules/word/html-renderer.d.ts +38 -0
  189. package/dist/browser/modules/word/html-renderer.js +782 -0
  190. package/dist/browser/modules/word/index.base.d.ts +19 -0
  191. package/dist/browser/modules/word/index.base.js +51 -0
  192. package/dist/browser/modules/word/index.browser.d.ts +4 -0
  193. package/dist/browser/modules/word/index.browser.js +4 -0
  194. package/dist/browser/modules/word/index.d.ts +4 -0
  195. package/dist/browser/modules/word/index.js +4 -0
  196. package/dist/browser/modules/word/internal-utils.d.ts +23 -0
  197. package/dist/browser/modules/word/internal-utils.js +54 -0
  198. package/dist/browser/modules/word/relationships.d.ts +31 -0
  199. package/dist/browser/modules/word/relationships.js +56 -0
  200. package/dist/browser/modules/word/types.d.ts +2325 -0
  201. package/dist/browser/modules/word/types.js +10 -0
  202. package/dist/browser/modules/word/units.d.ts +49 -0
  203. package/dist/browser/modules/word/units.js +111 -0
  204. package/dist/browser/modules/word/writers/chart-writer.d.ts +10 -0
  205. package/dist/browser/modules/word/writers/chart-writer.js +385 -0
  206. package/dist/browser/modules/word/writers/checkbox-writer.d.ts +9 -0
  207. package/dist/browser/modules/word/writers/checkbox-writer.js +42 -0
  208. package/dist/browser/modules/word/writers/comment-writer.d.ts +15 -0
  209. package/dist/browser/modules/word/writers/comment-writer.js +70 -0
  210. package/dist/browser/modules/word/writers/document-writer.d.ts +16 -0
  211. package/dist/browser/modules/word/writers/document-writer.js +461 -0
  212. package/dist/browser/modules/word/writers/footnote-writer.d.ts +11 -0
  213. package/dist/browser/modules/word/writers/footnote-writer.js +72 -0
  214. package/dist/browser/modules/word/writers/header-footer-writer.d.ts +13 -0
  215. package/dist/browser/modules/word/writers/header-footer-writer.js +129 -0
  216. package/dist/browser/modules/word/writers/image-writer.d.ts +10 -0
  217. package/dist/browser/modules/word/writers/image-writer.js +185 -0
  218. package/dist/browser/modules/word/writers/math-writer.d.ts +9 -0
  219. package/dist/browser/modules/word/writers/math-writer.js +428 -0
  220. package/dist/browser/modules/word/writers/numbering-writer.d.ts +10 -0
  221. package/dist/browser/modules/word/writers/numbering-writer.js +125 -0
  222. package/dist/browser/modules/word/writers/paragraph-writer.d.ts +13 -0
  223. package/dist/browser/modules/word/writers/paragraph-writer.js +516 -0
  224. package/dist/browser/modules/word/writers/parts-writer.d.ts +26 -0
  225. package/dist/browser/modules/word/writers/parts-writer.js +660 -0
  226. package/dist/browser/modules/word/writers/run-writer.d.ts +15 -0
  227. package/dist/browser/modules/word/writers/run-writer.js +649 -0
  228. package/dist/browser/modules/word/writers/section-writer.d.ts +10 -0
  229. package/dist/browser/modules/word/writers/section-writer.js +238 -0
  230. package/dist/browser/modules/word/writers/styles-writer.d.ts +10 -0
  231. package/dist/browser/modules/word/writers/styles-writer.js +242 -0
  232. package/dist/browser/modules/word/writers/table-writer.d.ts +10 -0
  233. package/dist/browser/modules/word/writers/table-writer.js +503 -0
  234. package/dist/browser/modules/word/writers/textbox-writer.d.ts +9 -0
  235. package/dist/browser/modules/word/writers/textbox-writer.js +53 -0
  236. package/dist/browser/modules/word/writers/toc-writer.d.ts +9 -0
  237. package/dist/browser/modules/word/writers/toc-writer.js +79 -0
  238. package/dist/browser/modules/xml/encode.d.ts +56 -7
  239. package/dist/browser/modules/xml/encode.js +157 -11
  240. package/dist/cjs/index.js +13 -2
  241. package/dist/cjs/modules/excel/chart/cache-populator.js +1178 -0
  242. package/dist/cjs/modules/excel/chart/chart-api.js +371 -0
  243. package/dist/cjs/modules/excel/chart/chart-builder.js +2440 -0
  244. package/dist/cjs/modules/excel/chart/chart-ex-builder.js +907 -0
  245. package/dist/cjs/modules/excel/chart/chart-ex-parser.js +1208 -0
  246. package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +5364 -0
  247. package/dist/cjs/modules/excel/chart/chart-ex-types.js +12 -0
  248. package/dist/cjs/modules/excel/chart/chart-images.js +366 -0
  249. package/dist/cjs/modules/excel/chart/chart-presets.js +184 -0
  250. package/dist/cjs/modules/excel/chart/chart-renderer.js +6450 -0
  251. package/dist/cjs/modules/excel/chart/chart-sidecar.js +433 -0
  252. package/dist/cjs/modules/excel/chart/chart-utils.js +845 -0
  253. package/dist/cjs/modules/excel/chart/chart.js +1324 -0
  254. package/dist/cjs/modules/excel/chart/glyph-rasterizer.js +664 -0
  255. package/dist/cjs/modules/excel/chart/index.js +101 -0
  256. package/dist/cjs/modules/excel/chart/install.js +95 -0
  257. package/dist/cjs/modules/excel/chart/shape-properties.js +1577 -0
  258. package/dist/cjs/modules/excel/chart/stroke-font.js +1559 -0
  259. package/dist/cjs/modules/excel/chart/topojson.js +239 -0
  260. package/dist/cjs/modules/excel/chart/types.js +9 -0
  261. package/dist/cjs/modules/excel/chart-host-registry.js +96 -0
  262. package/dist/cjs/modules/excel/chartsheet.js +199 -0
  263. package/dist/cjs/modules/excel/defined-names.js +44 -4
  264. package/dist/cjs/modules/excel/errors.js +11 -1
  265. package/dist/cjs/modules/excel/form-control.js +17 -0
  266. package/dist/cjs/modules/excel/image.js +12 -2
  267. package/dist/cjs/modules/excel/pivot-chart.js +56 -0
  268. package/dist/cjs/modules/excel/pivot-table.js +35 -0
  269. package/dist/cjs/modules/excel/range.js +5 -1
  270. package/dist/cjs/modules/excel/sparkline/index.js +23 -0
  271. package/dist/cjs/modules/excel/sparkline/sparkline.js +756 -0
  272. package/dist/cjs/modules/excel/stream/worksheet-writer.js +3 -2
  273. package/dist/cjs/modules/excel/table.js +42 -6
  274. package/dist/cjs/modules/excel/utils/address.js +29 -0
  275. package/dist/cjs/modules/excel/utils/drawing-utils.js +11 -6
  276. package/dist/cjs/modules/excel/utils/guid.js +38 -0
  277. package/dist/cjs/modules/excel/utils/ooxml-paths.js +246 -9
  278. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +103 -0
  279. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart.js +2128 -0
  280. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chartsheet.js +29 -0
  281. package/dist/cjs/modules/excel/utils/ooxml-validator/check-content-types.js +184 -0
  282. package/dist/cjs/modules/excel/utils/ooxml-validator/check-drawing.js +270 -0
  283. package/dist/cjs/modules/excel/utils/ooxml-validator/check-pivot.js +107 -0
  284. package/dist/cjs/modules/excel/utils/ooxml-validator/check-relationships.js +188 -0
  285. package/dist/cjs/modules/excel/utils/ooxml-validator/check-structure.js +60 -0
  286. package/dist/cjs/modules/excel/utils/ooxml-validator/check-styles.js +92 -0
  287. package/dist/cjs/modules/excel/utils/ooxml-validator/check-table.js +180 -0
  288. package/dist/cjs/modules/excel/utils/ooxml-validator/check-workbook.js +166 -0
  289. package/dist/cjs/modules/excel/utils/ooxml-validator/check-worksheet.js +572 -0
  290. package/dist/cjs/modules/excel/utils/ooxml-validator/context.js +196 -0
  291. package/dist/cjs/modules/excel/utils/ooxml-validator/index.js +105 -0
  292. package/dist/cjs/modules/excel/utils/ooxml-validator/path-utils.js +168 -0
  293. package/dist/cjs/modules/excel/utils/ooxml-validator/reporter.js +66 -0
  294. package/dist/cjs/modules/excel/utils/ooxml-validator/types.js +13 -0
  295. package/dist/cjs/modules/excel/utils/ooxml-validator/xml-utils.js +110 -0
  296. package/dist/cjs/modules/excel/workbook.browser.js +973 -38
  297. package/dist/cjs/modules/excel/workbook.js +48 -0
  298. package/dist/cjs/modules/excel/worksheet.js +393 -34
  299. package/dist/cjs/modules/excel/xlsx/rel-type.js +41 -1
  300. package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  301. package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  302. package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  303. package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6003 -0
  304. package/dist/cjs/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +219 -0
  305. package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +149 -10
  306. package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  307. package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  308. package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  309. package/dist/cjs/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +228 -0
  310. package/dist/cjs/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  311. package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  312. package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  313. package/dist/cjs/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +444 -0
  314. package/dist/cjs/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  315. package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +195 -19
  316. package/dist/cjs/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  317. package/dist/cjs/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  318. package/dist/cjs/modules/excel/xlsx/xform/xsd-values.js +106 -0
  319. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +4420 -76
  320. package/dist/cjs/modules/pdf/builder/document-builder.js +506 -1
  321. package/dist/cjs/modules/pdf/builder/pdf-editor.js +48 -3
  322. package/dist/cjs/modules/pdf/excel-bridge.js +684 -12
  323. package/dist/cjs/modules/pdf/font/font-manager.js +39 -0
  324. package/dist/cjs/modules/pdf/index.js +5 -1
  325. package/dist/cjs/modules/pdf/render/chart-surface.js +203 -0
  326. package/dist/cjs/modules/pdf/render/layout-engine.js +437 -56
  327. package/dist/cjs/modules/pdf/render/page-renderer.js +169 -28
  328. package/dist/cjs/modules/pdf/render/pdf-exporter.js +115 -5
  329. package/dist/cjs/modules/pdf/types.js +5 -0
  330. package/dist/cjs/modules/pdf/word-bridge.js +307 -0
  331. package/dist/cjs/modules/word/constants.js +234 -0
  332. package/dist/cjs/modules/word/content-types.js +57 -0
  333. package/dist/cjs/modules/word/digital-signatures.js +140 -0
  334. package/dist/cjs/modules/word/document.js +1909 -0
  335. package/dist/cjs/modules/word/docx-packager.js +825 -0
  336. package/dist/cjs/modules/word/docx-reader.js +4932 -0
  337. package/dist/cjs/modules/word/encryption.js +282 -0
  338. package/dist/cjs/modules/word/errors.js +88 -0
  339. package/dist/cjs/modules/word/font-obfuscation.js +88 -0
  340. package/dist/cjs/modules/word/html-renderer.js +785 -0
  341. package/dist/cjs/modules/word/index.base.js +199 -0
  342. package/dist/cjs/modules/word/index.browser.js +20 -0
  343. package/dist/cjs/modules/word/index.js +20 -0
  344. package/dist/cjs/modules/word/internal-utils.js +59 -0
  345. package/dist/cjs/modules/word/relationships.js +60 -0
  346. package/dist/cjs/modules/word/types.js +11 -0
  347. package/dist/cjs/modules/word/units.js +135 -0
  348. package/dist/cjs/modules/word/writers/chart-writer.js +388 -0
  349. package/dist/cjs/modules/word/writers/checkbox-writer.js +45 -0
  350. package/dist/cjs/modules/word/writers/comment-writer.js +74 -0
  351. package/dist/cjs/modules/word/writers/document-writer.js +465 -0
  352. package/dist/cjs/modules/word/writers/footnote-writer.js +76 -0
  353. package/dist/cjs/modules/word/writers/header-footer-writer.js +134 -0
  354. package/dist/cjs/modules/word/writers/image-writer.js +188 -0
  355. package/dist/cjs/modules/word/writers/math-writer.js +431 -0
  356. package/dist/cjs/modules/word/writers/numbering-writer.js +128 -0
  357. package/dist/cjs/modules/word/writers/paragraph-writer.js +521 -0
  358. package/dist/cjs/modules/word/writers/parts-writer.js +671 -0
  359. package/dist/cjs/modules/word/writers/run-writer.js +655 -0
  360. package/dist/cjs/modules/word/writers/section-writer.js +241 -0
  361. package/dist/cjs/modules/word/writers/styles-writer.js +245 -0
  362. package/dist/cjs/modules/word/writers/table-writer.js +506 -0
  363. package/dist/cjs/modules/word/writers/textbox-writer.js +56 -0
  364. package/dist/cjs/modules/word/writers/toc-writer.js +82 -0
  365. package/dist/cjs/modules/xml/encode.js +158 -11
  366. package/dist/esm/index.browser.js +20 -2
  367. package/dist/esm/index.js +9 -1
  368. package/dist/esm/modules/excel/chart/cache-populator.js +1171 -0
  369. package/dist/esm/modules/excel/chart/chart-api.js +364 -0
  370. package/dist/esm/modules/excel/chart/chart-builder.js +2432 -0
  371. package/dist/esm/modules/excel/chart/chart-ex-builder.js +903 -0
  372. package/dist/esm/modules/excel/chart/chart-ex-parser.js +1205 -0
  373. package/dist/esm/modules/excel/chart/chart-ex-renderer.js +5352 -0
  374. package/dist/esm/modules/excel/chart/chart-ex-types.js +11 -0
  375. package/dist/esm/modules/excel/chart/chart-images.js +363 -0
  376. package/dist/esm/modules/excel/chart/chart-presets.js +179 -0
  377. package/dist/esm/modules/excel/chart/chart-renderer.js +6440 -0
  378. package/dist/esm/modules/excel/chart/chart-sidecar.js +427 -0
  379. package/dist/esm/modules/excel/chart/chart-utils.js +821 -0
  380. package/dist/esm/modules/excel/chart/chart.js +1320 -0
  381. package/dist/esm/modules/excel/chart/glyph-rasterizer.js +658 -0
  382. package/dist/esm/modules/excel/chart/index.js +46 -0
  383. package/dist/esm/modules/excel/chart/install.js +91 -0
  384. package/dist/esm/modules/excel/chart/shape-properties.js +1557 -0
  385. package/dist/esm/modules/excel/chart/stroke-font.js +1556 -0
  386. package/dist/esm/modules/excel/chart/topojson.js +236 -0
  387. package/dist/esm/modules/excel/chart/types.js +8 -0
  388. package/dist/esm/modules/excel/chart-host-registry.js +90 -0
  389. package/dist/esm/modules/excel/chartsheet.js +196 -0
  390. package/dist/esm/modules/excel/defined-names.js +44 -4
  391. package/dist/esm/modules/excel/errors.js +9 -0
  392. package/dist/esm/modules/excel/form-control.js +17 -0
  393. package/dist/esm/modules/excel/image.js +12 -2
  394. package/dist/esm/modules/excel/pivot-chart.js +53 -0
  395. package/dist/esm/modules/excel/pivot-table.js +35 -0
  396. package/dist/esm/modules/excel/range.js +5 -1
  397. package/dist/esm/modules/excel/sparkline/index.js +7 -0
  398. package/dist/esm/modules/excel/sparkline/sparkline.js +750 -0
  399. package/dist/esm/modules/excel/stream/worksheet-writer.js +3 -2
  400. package/dist/esm/modules/excel/table.js +42 -6
  401. package/dist/esm/modules/excel/utils/address.js +28 -0
  402. package/dist/esm/modules/excel/utils/drawing-utils.js +11 -6
  403. package/dist/esm/modules/excel/utils/guid.js +35 -0
  404. package/dist/esm/modules/excel/utils/ooxml-paths.js +206 -9
  405. package/dist/esm/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
  406. package/dist/esm/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
  407. package/dist/esm/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
  408. package/dist/esm/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
  409. package/dist/esm/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
  410. package/dist/esm/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
  411. package/dist/esm/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
  412. package/dist/esm/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
  413. package/dist/esm/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
  414. package/dist/esm/modules/excel/utils/ooxml-validator/check-table.js +177 -0
  415. package/dist/esm/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
  416. package/dist/esm/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
  417. package/dist/esm/modules/excel/utils/ooxml-validator/context.js +191 -0
  418. package/dist/esm/modules/excel/utils/ooxml-validator/index.js +102 -0
  419. package/dist/esm/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
  420. package/dist/esm/modules/excel/utils/ooxml-validator/reporter.js +61 -0
  421. package/dist/esm/modules/excel/utils/ooxml-validator/types.js +12 -0
  422. package/dist/esm/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
  423. package/dist/esm/modules/excel/workbook.browser.js +969 -34
  424. package/dist/esm/modules/excel/workbook.js +48 -0
  425. package/dist/esm/modules/excel/worksheet.js +394 -35
  426. package/dist/esm/modules/excel/xlsx/rel-type.js +41 -1
  427. package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  428. package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  429. package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  430. package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
  431. package/dist/esm/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
  432. package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
  433. package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  434. package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  435. package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  436. package/dist/esm/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
  437. package/dist/esm/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  438. package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  439. package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  440. package/dist/esm/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
  441. package/dist/esm/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  442. package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
  443. package/dist/esm/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  444. package/dist/esm/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  445. package/dist/esm/modules/excel/xlsx/xform/xsd-values.js +101 -0
  446. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +4422 -78
  447. package/dist/esm/modules/pdf/builder/document-builder.js +507 -2
  448. package/dist/esm/modules/pdf/builder/pdf-editor.js +48 -3
  449. package/dist/esm/modules/pdf/excel-bridge.js +683 -12
  450. package/dist/esm/modules/pdf/font/font-manager.js +39 -0
  451. package/dist/esm/modules/pdf/index.js +3 -1
  452. package/dist/esm/modules/pdf/render/chart-surface.js +200 -0
  453. package/dist/esm/modules/pdf/render/layout-engine.js +436 -56
  454. package/dist/esm/modules/pdf/render/page-renderer.js +169 -28
  455. package/dist/esm/modules/pdf/render/pdf-exporter.js +117 -7
  456. package/dist/esm/modules/pdf/types.js +4 -0
  457. package/dist/esm/modules/pdf/word-bridge.js +304 -0
  458. package/dist/esm/modules/word/constants.js +231 -0
  459. package/dist/esm/modules/word/content-types.js +53 -0
  460. package/dist/esm/modules/word/digital-signatures.js +134 -0
  461. package/dist/esm/modules/word/document.js +1795 -0
  462. package/dist/esm/modules/word/docx-packager.js +822 -0
  463. package/dist/esm/modules/word/docx-reader.js +4929 -0
  464. package/dist/esm/modules/word/encryption.js +274 -0
  465. package/dist/esm/modules/word/errors.js +68 -0
  466. package/dist/esm/modules/word/font-obfuscation.js +83 -0
  467. package/dist/esm/modules/word/html-renderer.js +782 -0
  468. package/dist/esm/modules/word/index.base.js +51 -0
  469. package/dist/esm/modules/word/index.browser.js +4 -0
  470. package/dist/esm/modules/word/index.js +4 -0
  471. package/dist/esm/modules/word/internal-utils.js +54 -0
  472. package/dist/esm/modules/word/relationships.js +56 -0
  473. package/dist/esm/modules/word/types.js +10 -0
  474. package/dist/esm/modules/word/units.js +111 -0
  475. package/dist/esm/modules/word/writers/chart-writer.js +385 -0
  476. package/dist/esm/modules/word/writers/checkbox-writer.js +42 -0
  477. package/dist/esm/modules/word/writers/comment-writer.js +70 -0
  478. package/dist/esm/modules/word/writers/document-writer.js +461 -0
  479. package/dist/esm/modules/word/writers/footnote-writer.js +72 -0
  480. package/dist/esm/modules/word/writers/header-footer-writer.js +129 -0
  481. package/dist/esm/modules/word/writers/image-writer.js +185 -0
  482. package/dist/esm/modules/word/writers/math-writer.js +428 -0
  483. package/dist/esm/modules/word/writers/numbering-writer.js +125 -0
  484. package/dist/esm/modules/word/writers/paragraph-writer.js +516 -0
  485. package/dist/esm/modules/word/writers/parts-writer.js +660 -0
  486. package/dist/esm/modules/word/writers/run-writer.js +649 -0
  487. package/dist/esm/modules/word/writers/section-writer.js +238 -0
  488. package/dist/esm/modules/word/writers/styles-writer.js +242 -0
  489. package/dist/esm/modules/word/writers/table-writer.js +503 -0
  490. package/dist/esm/modules/word/writers/textbox-writer.js +53 -0
  491. package/dist/esm/modules/word/writers/toc-writer.js +79 -0
  492. package/dist/esm/modules/xml/encode.js +157 -11
  493. package/dist/iife/excelts.iife.js +11789 -687
  494. package/dist/iife/excelts.iife.js.map +1 -1
  495. package/dist/iife/excelts.iife.min.js +52 -44
  496. package/dist/types/index.browser.d.ts +8 -5
  497. package/dist/types/index.d.ts +4 -2
  498. package/dist/types/modules/excel/chart/cache-populator.d.ts +49 -0
  499. package/dist/types/modules/excel/chart/chart-api.d.ts +92 -0
  500. package/dist/types/modules/excel/chart/chart-builder.d.ts +48 -0
  501. package/dist/types/modules/excel/chart/chart-ex-builder.d.ts +36 -0
  502. package/dist/types/modules/excel/chart/chart-ex-parser.d.ts +8 -0
  503. package/dist/types/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
  504. package/dist/types/modules/excel/chart/chart-ex-types.d.ts +531 -0
  505. package/dist/types/modules/excel/chart/chart-images.d.ts +78 -0
  506. package/dist/types/modules/excel/chart/chart-presets.d.ts +392 -0
  507. package/dist/types/modules/excel/chart/chart-renderer.d.ts +550 -0
  508. package/dist/types/modules/excel/chart/chart-sidecar.d.ts +21 -0
  509. package/dist/types/modules/excel/chart/chart-utils.d.ts +306 -0
  510. package/dist/types/modules/excel/chart/chart.d.ts +504 -0
  511. package/dist/types/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
  512. package/dist/types/modules/excel/chart/index.d.ts +54 -0
  513. package/dist/types/modules/excel/chart/install.d.ts +44 -0
  514. package/dist/types/modules/excel/chart/shape-properties.d.ts +156 -0
  515. package/dist/types/modules/excel/chart/stroke-font.d.ts +36 -0
  516. package/dist/types/modules/excel/chart/topojson.d.ts +98 -0
  517. package/dist/types/modules/excel/chart/types.d.ts +2559 -0
  518. package/dist/types/modules/excel/chart-host-registry.d.ts +157 -0
  519. package/dist/types/modules/excel/chartsheet.d.ts +102 -0
  520. package/dist/types/modules/excel/defined-names.d.ts +35 -0
  521. package/dist/types/modules/excel/errors.d.ts +6 -0
  522. package/dist/types/modules/excel/form-control.d.ts +6 -0
  523. package/dist/types/modules/excel/pivot-chart.d.ts +7 -0
  524. package/dist/types/modules/excel/pivot-table.d.ts +55 -0
  525. package/dist/types/modules/excel/sparkline/index.d.ts +7 -0
  526. package/dist/types/modules/excel/sparkline/sparkline.d.ts +206 -0
  527. package/dist/types/modules/excel/types.d.ts +72 -0
  528. package/dist/types/modules/excel/utils/address.d.ts +18 -0
  529. package/dist/types/modules/excel/utils/guid.d.ts +15 -0
  530. package/dist/types/modules/excel/utils/ooxml-paths.d.ts +74 -0
  531. package/dist/types/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
  532. package/dist/types/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
  533. package/dist/types/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
  534. package/dist/types/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
  535. package/dist/types/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
  536. package/dist/types/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
  537. package/dist/types/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
  538. package/dist/types/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
  539. package/dist/types/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
  540. package/dist/types/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
  541. package/dist/types/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
  542. package/dist/types/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
  543. package/dist/types/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
  544. package/dist/types/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
  545. package/dist/types/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
  546. package/dist/types/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
  547. package/dist/types/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
  548. package/dist/types/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
  549. package/dist/types/modules/excel/workbook.browser.d.ts +248 -30
  550. package/dist/types/modules/excel/workbook.d.ts +43 -0
  551. package/dist/types/modules/excel/worksheet.d.ts +157 -3
  552. package/dist/types/modules/excel/xlsx/rel-type.d.ts +40 -0
  553. package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
  554. package/dist/types/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
  555. package/dist/types/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
  556. package/dist/types/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
  557. package/dist/types/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
  558. package/dist/types/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
  559. package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
  560. package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
  561. package/dist/types/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
  562. package/dist/types/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
  563. package/dist/types/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
  564. package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
  565. package/dist/types/modules/pdf/builder/document-builder.d.ts +74 -0
  566. package/dist/types/modules/pdf/excel-bridge.d.ts +69 -0
  567. package/dist/types/modules/pdf/font/font-manager.d.ts +25 -0
  568. package/dist/types/modules/pdf/index.d.ts +5 -2
  569. package/dist/types/modules/pdf/render/chart-surface.d.ts +33 -0
  570. package/dist/types/modules/pdf/render/layout-engine.d.ts +22 -1
  571. package/dist/types/modules/pdf/types.d.ts +227 -23
  572. package/dist/types/modules/pdf/word-bridge.d.ts +47 -0
  573. package/dist/types/modules/word/constants.d.ts +179 -0
  574. package/dist/types/modules/word/content-types.d.ts +27 -0
  575. package/dist/types/modules/word/digital-signatures.d.ts +87 -0
  576. package/dist/types/modules/word/document.d.ts +728 -0
  577. package/dist/types/modules/word/docx-packager.d.ts +14 -0
  578. package/dist/types/modules/word/docx-reader.d.ts +11 -0
  579. package/dist/types/modules/word/encryption.d.ts +102 -0
  580. package/dist/types/modules/word/errors.d.ts +49 -0
  581. package/dist/types/modules/word/font-obfuscation.d.ts +31 -0
  582. package/dist/types/modules/word/html-renderer.d.ts +38 -0
  583. package/dist/types/modules/word/index.base.d.ts +19 -0
  584. package/dist/types/modules/word/index.browser.d.ts +4 -0
  585. package/dist/types/modules/word/index.d.ts +4 -0
  586. package/dist/types/modules/word/internal-utils.d.ts +23 -0
  587. package/dist/types/modules/word/relationships.d.ts +31 -0
  588. package/dist/types/modules/word/types.d.ts +2325 -0
  589. package/dist/types/modules/word/units.d.ts +49 -0
  590. package/dist/types/modules/word/writers/chart-writer.d.ts +10 -0
  591. package/dist/types/modules/word/writers/checkbox-writer.d.ts +9 -0
  592. package/dist/types/modules/word/writers/comment-writer.d.ts +15 -0
  593. package/dist/types/modules/word/writers/document-writer.d.ts +16 -0
  594. package/dist/types/modules/word/writers/footnote-writer.d.ts +11 -0
  595. package/dist/types/modules/word/writers/header-footer-writer.d.ts +13 -0
  596. package/dist/types/modules/word/writers/image-writer.d.ts +10 -0
  597. package/dist/types/modules/word/writers/math-writer.d.ts +9 -0
  598. package/dist/types/modules/word/writers/numbering-writer.d.ts +10 -0
  599. package/dist/types/modules/word/writers/paragraph-writer.d.ts +13 -0
  600. package/dist/types/modules/word/writers/parts-writer.d.ts +26 -0
  601. package/dist/types/modules/word/writers/run-writer.d.ts +15 -0
  602. package/dist/types/modules/word/writers/section-writer.d.ts +10 -0
  603. package/dist/types/modules/word/writers/styles-writer.d.ts +10 -0
  604. package/dist/types/modules/word/writers/table-writer.d.ts +10 -0
  605. package/dist/types/modules/word/writers/textbox-writer.d.ts +9 -0
  606. package/dist/types/modules/word/writers/toc-writer.d.ts +9 -0
  607. package/dist/types/modules/xml/encode.d.ts +56 -7
  608. package/package.json +29 -11
  609. package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +0 -48
  610. package/dist/browser/modules/excel/utils/ooxml-validator.js +0 -493
  611. package/dist/browser/modules/excel/utils/passthrough-manager.d.ts +0 -77
  612. package/dist/browser/modules/excel/utils/passthrough-manager.js +0 -129
  613. package/dist/cjs/modules/excel/utils/ooxml-validator.js +0 -499
  614. package/dist/cjs/modules/excel/utils/passthrough-manager.js +0 -133
  615. package/dist/esm/modules/excel/utils/ooxml-validator.js +0 -493
  616. package/dist/esm/modules/excel/utils/passthrough-manager.js +0 -129
  617. package/dist/types/modules/excel/utils/ooxml-validator.d.ts +0 -48
  618. package/dist/types/modules/excel/utils/passthrough-manager.d.ts +0 -77
@@ -0,0 +1,903 @@
1
+ /**
2
+ * ChartEx builder — constructs a ChartExModel from simplified AddChartExOptions.
3
+ *
4
+ * Each layoutId corresponds to a distinct chart type. The builder produces a
5
+ * structured model that the renderer serialises to `cx:chart` XML.
6
+ */
7
+ import { ChartOptionsError } from "../errors.js";
8
+ import { hexToColor, toShapeProperties } from "./chart-builder.js";
9
+ function parseColumnRef(formula) {
10
+ // Match: optional sheet (quoted or bare) + !$COL$ROW:$COL$ROW
11
+ const match = /^\s*(?:'([^'\r\n]+)'|([A-Za-z_][A-Za-z0-9_. ]*))!\$([A-Z]{1,3})\$(\d+):\$([A-Z]{1,3})\$(\d+)\s*$/.exec(formula);
12
+ if (!match) {
13
+ return null;
14
+ }
15
+ // Groups: 1=quoted sheet, 2=bare sheet, 3=colStart, 4=rowStart,
16
+ // 5=colEnd, 6=rowEnd. The row/col pair alternates — the `:`
17
+ // delimiter is between the start address (cols + rows, i.e.
18
+ // `$COL$ROW`) and the end address.
19
+ return {
20
+ sheet: match[1] ?? match[2],
21
+ quotedSheet: !!match[1],
22
+ colStart: match[3],
23
+ colEnd: match[5],
24
+ rowStart: parseInt(match[4], 10),
25
+ rowEnd: parseInt(match[6], 10)
26
+ };
27
+ }
28
+ function colLettersToIndex(letters) {
29
+ let n = 0;
30
+ for (let i = 0; i < letters.length; i++) {
31
+ n = n * 26 + (letters.charCodeAt(i) - 64);
32
+ }
33
+ return n;
34
+ }
35
+ function colIndexToLetters(index) {
36
+ let n = index;
37
+ let out = "";
38
+ while (n > 0) {
39
+ const rem = (n - 1) % 26;
40
+ out = String.fromCharCode(65 + rem) + out;
41
+ n = Math.floor((n - 1) / 26);
42
+ }
43
+ return out;
44
+ }
45
+ /**
46
+ * Combine multiple single-column range formulas (first item is the
47
+ * OUTERMOST hierarchy level, last item is the leaf level / primary
48
+ * category) into a single multi-column range that Excel's hierarchical
49
+ * chartEx loader accepts.
50
+ *
51
+ * Microsoft Excel's treemap / sunburst writer emits ONE `<cx:strDim>`
52
+ * whose `<cx:f>` points at a contiguous multi-column range spanning
53
+ * every hierarchy level (e.g. `Sheet1!$A$2:$C$8` for a Region / Country
54
+ * / City breakdown). The chart reader derives the hierarchy from the
55
+ * column ORDER within that range — the first column is the root and
56
+ * the last is the leaf. Emitting per-level `<cx:strDim>` siblings (one
57
+ * per formula) is schema-legal but makes Excel draw an empty plot
58
+ * area: verified against `reference-hierarchy.xlsx` (Excel-authored
59
+ * sample) where the same hierarchy renders correctly only when the
60
+ * columns live under a single `<cx:f>`.
61
+ *
62
+ * Returns the combined formula when every input formula lives on the
63
+ * same sheet with identical row spans and contiguous ascending columns
64
+ * (the common case when authors lay their hierarchy out in adjacent
65
+ * worksheet columns). Returns `null` otherwise — the caller should
66
+ * fall back to per-level caching because Excel has no way to express
67
+ * a non-contiguous hierarchy as a single range.
68
+ */
69
+ export function combineHierarchyFormulas(formulas) {
70
+ if (formulas.length === 0) {
71
+ return null;
72
+ }
73
+ if (formulas.length === 1) {
74
+ return formulas[0];
75
+ }
76
+ const parsed = [];
77
+ for (const f of formulas) {
78
+ const p = parseColumnRef(f);
79
+ if (!p) {
80
+ return null;
81
+ }
82
+ // Only single-column ranges are combinable. Multi-column inputs
83
+ // can't be meaningfully merged with another column without
84
+ // overlap / ambiguity.
85
+ if (p.colStart !== p.colEnd) {
86
+ return null;
87
+ }
88
+ parsed.push(p);
89
+ }
90
+ const first = parsed[0];
91
+ let prevCol = colLettersToIndex(first.colStart);
92
+ for (let i = 1; i < parsed.length; i++) {
93
+ const p = parsed[i];
94
+ if (p.sheet !== first.sheet) {
95
+ return null;
96
+ }
97
+ if (p.rowStart !== first.rowStart || p.rowEnd !== first.rowEnd) {
98
+ return null;
99
+ }
100
+ const curCol = colLettersToIndex(p.colStart);
101
+ if (curCol !== prevCol + 1) {
102
+ return null;
103
+ }
104
+ prevCol = curCol;
105
+ }
106
+ const startCol = first.colStart;
107
+ const endCol = colIndexToLetters(prevCol);
108
+ const sheetRef = first.quotedSheet ? `'${first.sheet}'` : first.sheet;
109
+ return `${sheetRef}!$${startCol}$${first.rowStart}:$${endCol}$${first.rowEnd}`;
110
+ }
111
+ /**
112
+ * Build a structured ChartExModel from high-level options.
113
+ */
114
+ export function buildChartExModel(opts) {
115
+ validateChartExOptions(opts);
116
+ const layoutId = mapChartTypeToLayoutId(opts.type);
117
+ // Build data entries — one cx:data per reference the series need.
118
+ const data = [];
119
+ const dataIdCounter = { value: 0 };
120
+ // Categories share a single data entry for all series (like classic charts).
121
+ let catDataId;
122
+ if (opts.categories) {
123
+ catDataId = dataIdCounter.value++;
124
+ data.push({
125
+ id: catDataId,
126
+ strDim: {
127
+ type: "cat",
128
+ formula: opts.categories,
129
+ levels: [{ ptCount: 0, points: [] }]
130
+ }
131
+ });
132
+ }
133
+ else {
134
+ // No chart-level `categories` formula — check whether the series
135
+ // bundle carries a `literalCategories` array we can hoist up and
136
+ // share. Classic charts and Excel-authored ChartEx both store
137
+ // categories as a single axis-wide entry; the previous code
138
+ // allocated a fresh cat `cx:data` entry inside each series' branch
139
+ // below, producing `N` parallel category dimensions for `N` series
140
+ // and breaking the "shared category axis" invariant Excel readers
141
+ // expect. Find the first series that carries a non-empty
142
+ // `literalCategories` and use it as the shared entry. Subsequent
143
+ // series that redefine `literalCategories` to a different shape
144
+ // throw — mixing-and-matching per-series category axes is not
145
+ // supported by Chart2014.
146
+ const firstLiteral = opts.series.find(so => so.literalCategories?.length)?.literalCategories;
147
+ if (firstLiteral && firstLiteral.length > 0) {
148
+ // Validate that every other series with `literalCategories`
149
+ // carries the same array (by deep equality). Divergence is a
150
+ // caller bug — the schema has no way to express per-series
151
+ // category axes in a ChartEx plot area region.
152
+ for (const so of opts.series) {
153
+ if (!so.literalCategories) {
154
+ continue;
155
+ }
156
+ if (!arraysEqual(so.literalCategories, firstLiteral)) {
157
+ throw new ChartOptionsError("AddChartExOptions.series[*].literalCategories must be the same across all series; " +
158
+ "ChartEx stores categories on a shared category axis (see `opts.categories` for the " +
159
+ "formula-based alternative).");
160
+ }
161
+ }
162
+ catDataId = dataIdCounter.value++;
163
+ data.push({
164
+ id: catDataId,
165
+ strDim: {
166
+ type: "cat",
167
+ levels: [
168
+ {
169
+ ptCount: firstLiteral.length,
170
+ points: firstLiteral.map((value, index) => ({ index, value }))
171
+ }
172
+ ]
173
+ }
174
+ });
175
+ }
176
+ }
177
+ // Build series — each gets its own cx:data entries for values (and any
178
+ // extras like hierarchy levels).
179
+ const series = [];
180
+ for (let i = 0; i < opts.series.length; i++) {
181
+ const so = opts.series[i];
182
+ const built = buildSeriesAndData(so, i, layoutId, catDataId, data, dataIdCounter, opts);
183
+ series.push(built);
184
+ }
185
+ // Build axes — needed for histogram, pareto, waterfall, funnel, boxWhisker.
186
+ const axes = [];
187
+ if (needsAxes(opts.type)) {
188
+ // Match Microsoft Excel's convention: chartEx axes are numbered
189
+ // 0 and 1 (cat / val), not `100000000+` like classic charts.
190
+ // Excel writes axes this way for every chartEx it authors —
191
+ // using small sequential ids keeps our output byte-compatible
192
+ // with Excel 2016+ for a fresh chartEx. Classic charts still
193
+ // use the `100000000` seed to avoid collisions with loaded
194
+ // files that happened to allocate small ids; chartEx is a
195
+ // separate part and cannot collide with classic chart axes.
196
+ const catAxisId = 0;
197
+ const valAxisId = 1;
198
+ // Match Excel's default cat-axis `gapWidth` + `<cx:tickLabels/>`
199
+ // and val-axis `<cx:majorGridlines/>` + `<cx:tickLabels/>` so
200
+ // freshly-built chartEx charts look identical to what Excel
201
+ // itself emits for the same chart type. Excel uses
202
+ // `gapWidth="0"` for histogram + pareto (bars touching —
203
+ // histograms traditionally render with zero gap between bins)
204
+ // and `gapWidth="0.5"` for waterfall / boxWhisker / funnel
205
+ // (narrower categorical bars). Users who set `layout.gapWidth`
206
+ // override the default.
207
+ const defaultGapWidth = opts.type === "histogram" || opts.type === "pareto" ? 0 : 0.5;
208
+ axes.push({
209
+ axisId: catAxisId,
210
+ type: "cat",
211
+ catScaling: { gapWidth: defaultGapWidth },
212
+ tickLabels: {}
213
+ });
214
+ axes.push({
215
+ axisId: valAxisId,
216
+ type: "val",
217
+ majorGridlines: {},
218
+ tickLabels: {}
219
+ });
220
+ // Excel does NOT emit `<cx:axisId>` children on `<cx:series>` —
221
+ // it expects the axis binding to come from the axes in
222
+ // `cx:plotArea/cx:axis` directly. Leaving `s.axisId` unset
223
+ // matches Excel's output exactly. (The renderer still emits
224
+ // any `axisId` array populated by the parser for round-tripped
225
+ // files, so existing files that DO carry these references
226
+ // survive load → save without drift.)
227
+ }
228
+ const model = {
229
+ chartSpace: {
230
+ chartData: { data },
231
+ // Chart-frame styling lives on `CT_ChartSpace/spPr` per
232
+ // ECMA-376 / Chart2014 — `CT_Chart` itself has no `spPr` child.
233
+ // Route `opts.spPr` here so the writer's schema-compliant path
234
+ // receives it. (Users can still pass either the structured
235
+ // `ShapeProperties` form or the ergonomic hex-colour shorthand;
236
+ // `toShapeProperties` normalises both.)
237
+ spPr: toShapeProperties(opts.spPr),
238
+ chart: {
239
+ title: buildChartExTitle(opts.title),
240
+ // Leave `autoTitleDeleted` undefined when the caller did not
241
+ // supply a title. Setting it to `true` whenever `opts.title`
242
+ // is absent tells Excel "the author explicitly deleted the
243
+ // auto-title", suppressing the automatic chart title Excel
244
+ // normally shows for single-series charts. Pass
245
+ // `title: null` (or an empty rich-text wrapper) to request
246
+ // explicit suppression; omitting the option preserves Excel's
247
+ // default auto-title behaviour.
248
+ autoTitleDeleted: opts.title === null ? true : undefined,
249
+ plotArea: {
250
+ plotAreaRegion: {
251
+ series
252
+ },
253
+ axis: axes.length > 0 ? axes : undefined
254
+ },
255
+ // Legend: Excel omits the `<cx:legend>` element entirely for
256
+ // histogram charts (a histogram has a single unnamed series,
257
+ // nothing to legend — emitting an empty legend placeholder
258
+ // causes Excel 2016+ to render the chart as a blank frame).
259
+ // Respect `opts.showLegend === false` for other types.
260
+ // Match Excel's legend attribute defaults otherwise:
261
+ // `pos="t" align="ctr" overlay="0"` — Excel's own output
262
+ // for a newly-inserted waterfall / funnel / boxWhisker uses
263
+ // top-centre placement. Users who pass `opts.legendPosition`
264
+ // still override `pos`.
265
+ legend: opts.showLegend === false || opts.type === "histogram"
266
+ ? undefined
267
+ : {
268
+ legendPos: opts.legendPosition ?? "t",
269
+ align: "ctr",
270
+ overlay: false
271
+ }
272
+ }
273
+ },
274
+ // ChartEx ALWAYS ships with a `chartStyle` + `chartColorStyle`
275
+ // sidecar, linked from `chartEx1.xml.rels`. Without them Excel
276
+ // 2016+ discards the chartEx part on load ("Removed Part:
277
+ // /xl/drawings/drawingN.xml (Drawing shape)"). When the caller
278
+ // hasn't supplied structured style / colors, we emit the
279
+ // id-only minimal form — `<cs:chartStyle id="395"/>` and
280
+ // `<cs:colorStyle meth="cycle" id="10"/>` — which Excel's
281
+ // default style table resolves to a sensible built-in palette.
282
+ // Style id 395 + colors id 10 are the defaults Excel itself
283
+ // uses for a freshly-inserted waterfall (verified against a
284
+ // reference xlsx authored by Excel 2021).
285
+ //
286
+ // Callers who want custom styling pass `opts.chartStyle` /
287
+ // `opts.chartColors`; those paths short-circuit this default.
288
+ style: opts.chartStyle ?? { id: 395 },
289
+ colors: opts.chartColors ?? { id: 10, method: "cycle" }
290
+ };
291
+ return model;
292
+ }
293
+ /**
294
+ * Normalise a ChartEx title option into the structured `ChartTitle` shape.
295
+ * Accepts the same three forms as the classic chart builder: a plain string,
296
+ * a rich-text description, or a `{ formula: "Sheet1!$A$1" }` reference. This
297
+ * keeps the classic / ChartEx APIs symmetric — previously ChartEx only
298
+ * supported strings and silently ignored formula / rich-text input.
299
+ */
300
+ function buildChartExTitle(input) {
301
+ // `null` signals "explicitly suppress auto-title" — the caller has
302
+ // already promoted this to `autoTitleDeleted: true` at the call site,
303
+ // so we emit no title element.
304
+ if (input === undefined || input === null) {
305
+ return undefined;
306
+ }
307
+ if (typeof input === "string") {
308
+ return {
309
+ text: { paragraphs: [{ runs: [{ text: input }] }] },
310
+ overlay: false
311
+ };
312
+ }
313
+ if ("formula" in input && typeof input.formula === "string") {
314
+ return {
315
+ // `ChartTitle.strRef` is the classic `StringReference` shape
316
+ // (`{ formula, cache: { points: [] } }`) because ChartEx titles
317
+ // reuse the classic `ChartTitle` type. Distinct from the ChartEx
318
+ // series `tx.strRef` which uses `{ formula, cached? }`.
319
+ strRef: { formula: input.formula, cache: { points: [] } },
320
+ overlay: false
321
+ };
322
+ }
323
+ if ("paragraphs" in input) {
324
+ return {
325
+ text: input,
326
+ overlay: false
327
+ };
328
+ }
329
+ throw new ChartOptionsError("chartEx.title must be a string, a { formula: string } reference, or a ChartRichText object.");
330
+ }
331
+ function buildSeriesAndData(so, idx, layoutId, catDataId, data, counter, opts) {
332
+ // `idx` is the caller-facing 0-based series index within the chart.
333
+ // The OOXML Chart2014 schema routes series ordering through
334
+ // `<cx:dataId>` / `<cx:axisId>` references rather than a dedicated
335
+ // series-index attribute, so there is no field to populate on the
336
+ // model — the parser never reads it and both the renderer and the
337
+ // writer key everything off `layoutId` / `dataRefs`. Keeping `idx`
338
+ // as a documented parameter so the caller's intent is preserved in
339
+ // tracing output if a future schema extension ever needs it.
340
+ void idx;
341
+ const series = {
342
+ layoutId,
343
+ dataRefs: []
344
+ };
345
+ if (so.name !== undefined) {
346
+ // Dispatch on the `name` shape. Plain strings become literal
347
+ // captions; `{ formula }` routes through `tx.strRef` so the writer
348
+ // emits `<cx:f>` (worksheet reference); rich-text structures pass
349
+ // through unchanged. Matches `AddChartSeriesOptions.name` handling
350
+ // on the classic side — previously the chartEx builder only
351
+ // accepted plain strings and silently dropped the other forms.
352
+ if (typeof so.name === "string") {
353
+ series.tx = { value: so.name };
354
+ }
355
+ else if ("formula" in so.name) {
356
+ // Use the canonical object form `{ formula, cached? }` rather
357
+ // than the legacy bare-string variant. The writer at
358
+ // `chart-ex-renderer.ts:renderSeries` handles both, but
359
+ // storing the object uniformly keeps the typed model
360
+ // consistent across builder-produced and parser-produced
361
+ // series — downstream consumers can treat `tx.strRef` as
362
+ // always object-shaped after this round of builder work.
363
+ series.tx = { strRef: { formula: so.name.formula } };
364
+ }
365
+ else {
366
+ series.tx = { rich: so.name };
367
+ }
368
+ }
369
+ // ------------------------------------------------------------------
370
+ // Data ref order for sunburst / treemap
371
+ //
372
+ // Excel-authored sunburst and treemap charts group ALL string
373
+ // dimensions (categories + hierarchy levels) before the numeric
374
+ // value dimension. The previous builder order was
375
+ // [category, value, hierarchy...]
376
+ // which opens in Excel but doesn't match the canonical layout —
377
+ // some readers (Excel's own chartEx parser that wraps the charts API)
378
+ // expect contiguous strDim refs before numDim.
379
+ //
380
+ // For non-hierarchical types (funnel, waterfall, histogram, pareto,
381
+ // boxWhisker, regionMap, clusteredColumn) the order category, value
382
+ // is already canonical, so the hierarchy branch below is a no-op.
383
+ // ------------------------------------------------------------------
384
+ const isHierarchical = layoutId === "sunburst" || layoutId === "treemap";
385
+ // Categories binding. `buildChartExModel` hoists any shared
386
+ // `literalCategories` into a single `catDataId` before calling us, so
387
+ // by the time we're here the only cases are:
388
+ // 1. `catDataId !== undefined` → the chart has a shared cat axis
389
+ // (either from `opts.categories` or hoisted literals); reuse it.
390
+ // 2. `catDataId === undefined` → no category axis; omit the ref.
391
+ // The previous fallback that allocated a fresh per-series `cx:data`
392
+ // entry from `so.literalCategories` has been removed — it produced
393
+ // N duplicated cat axes for N series, breaking the shared-axis
394
+ // invariant. Any literal-category hoisting / validation is done in
395
+ // `buildChartExModel`.
396
+ if (catDataId !== undefined) {
397
+ series.dataRefs.push({ dataId: catDataId });
398
+ }
399
+ // For sunburst / treemap, Excel expects a SINGLE `<cx:strDim>`
400
+ // whose `<cx:f>` points to a contiguous MULTI-COLUMN range that
401
+ // spans every hierarchy level (outer → inner, root column first,
402
+ // leaf column last). See `combineHierarchyFormulas` for the
403
+ // rationale + the reference fixture (`reference-hierarchy.xlsx`)
404
+ // where the same layout rendered blank under the previous
405
+ // "one data entry per level" approach. When the caller's
406
+ // `categories` + `hierarchy` live in adjacent worksheet columns
407
+ // with matching row ranges we rewrite `catDataId`'s strDim with
408
+ // the combined range and skip per-level data entries. When the
409
+ // ranges can't be combined (different sheets, non-contiguous
410
+ // columns, …) we leave the entries as-is and accept that Excel
411
+ // may draw the chart blank — manual reshaping by the author is
412
+ // the only way to recover.
413
+ let hierarchyCombined = false;
414
+ if (isHierarchical) {
415
+ const hierarchyFormulas = so.hierarchy;
416
+ if (hierarchyFormulas && catDataId !== undefined && opts.categories) {
417
+ // Root → leaf: `[...hierarchy, categories]` matches Excel's
418
+ // left-to-right column reading order.
419
+ const combined = combineHierarchyFormulas([...hierarchyFormulas, opts.categories]);
420
+ if (combined) {
421
+ hierarchyCombined = true;
422
+ const catEntry = data.find(d => d.id === catDataId);
423
+ if (catEntry?.strDim) {
424
+ catEntry.strDim.formula = combined;
425
+ // Clear any seeded empty-level placeholder: Excel's writer
426
+ // emits no `<cx:lvl>` cache for hierarchical charts and
427
+ // reads fresh from the referenced cells on open.
428
+ catEntry.strDim.levels = undefined;
429
+ // Suppress cache population for this dimension. A flat
430
+ // `<cx:lvl>` of width × height points across the multi-column
431
+ // range would confuse Excel's hierarchical renderer (the
432
+ // chart draws empty). See `hasChartExStringPoints`.
433
+ catEntry.strDim._skipCache = true;
434
+ }
435
+ }
436
+ else {
437
+ // Ranges aren't combinable — fall back to per-level data
438
+ // entries in OUTER→INNER order so at least the schema is
439
+ // valid. (Excel renders blank in this fallback; emit with a
440
+ // console warning in non-production so the author can
441
+ // diagnose why their hierarchical chart is empty.)
442
+ if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
443
+ console.warn("[excelts] Treemap/sunburst hierarchy + categories could not be combined into a " +
444
+ "contiguous multi-column range. Excel will render the chart as an empty plot area. " +
445
+ "Lay your leaf + hierarchy columns contiguously on the same sheet with matching rows.");
446
+ }
447
+ for (let i = hierarchyFormulas.length - 1; i >= 0; i--) {
448
+ const h = hierarchyFormulas[i];
449
+ const hId = counter.value++;
450
+ data.push({
451
+ id: hId,
452
+ strDim: {
453
+ type: "cat",
454
+ formula: h,
455
+ levels: [{ ptCount: 0, points: [] }]
456
+ }
457
+ });
458
+ series.dataRefs.push({ dataId: hId });
459
+ }
460
+ }
461
+ }
462
+ if (so.literalHierarchy) {
463
+ // Literal hierarchy (no worksheet cells to reference) — cache
464
+ // every level's values inside a single strDim's `levels` array
465
+ // so `consolidateDataForRender` can flatten them into one
466
+ // `<cx:strDim>` with multiple `<cx:lvl>` children at render
467
+ // time. This does not match Excel's own "single multi-column
468
+ // <cx:f>" output verbatim but is what the schema allows when
469
+ // there are no real cells to point at.
470
+ for (let i = so.literalHierarchy.length - 1; i >= 0; i--) {
471
+ const level = so.literalHierarchy[i];
472
+ const hId = counter.value++;
473
+ data.push({
474
+ id: hId,
475
+ strDim: {
476
+ type: "cat",
477
+ levels: [
478
+ {
479
+ ptCount: level.length,
480
+ points: level.map((value, index) => ({ index, value }))
481
+ }
482
+ ]
483
+ }
484
+ });
485
+ series.dataRefs.push({ dataId: hId });
486
+ }
487
+ }
488
+ }
489
+ // Values — always create a fresh numDim entry.
490
+ const valId = counter.value++;
491
+ // Microsoft Excel uses `type="val"` for MOST chartEx numeric
492
+ // dimensions (histogram + pareto binning inputs, funnel values,
493
+ // box-whisker samples, waterfall deltas, regionMap values), but
494
+ // **sunburst and treemap use `type="size"`** — the hierarchy rings
495
+ // / tiles are sized by the numeric column, and Excel's loader
496
+ // keys the hierarchical layout engine off this attribute. Reference
497
+ // fixture `tmp/reference-hierarchy.xlsx` (Excel-authored) writes
498
+ // `<cx:numDim type="size">` on both its treemap and sunburst
499
+ // charts; the previous `type="val"` caused Excel to open the
500
+ // chart with an empty plot area (schema-valid but semantically
501
+ // wrong for the hierarchical renderer).
502
+ //
503
+ // Other layouts still use `"val"` — the alternative `"x"` is in
504
+ // `ST_NumDimType` but Excel 2016+ renders the chart as a blank
505
+ // frame when the dimension is labelled `"x"` (verified against
506
+ // an Excel 2021-authored histogram reference, `tmp/aaaaa.xlsx`).
507
+ const numDimType = isHierarchical ? "size" : "val";
508
+ data.push({
509
+ id: valId,
510
+ numDim: {
511
+ type: numDimType,
512
+ formula: so.values,
513
+ levels: so.literalValues?.length
514
+ ? [
515
+ {
516
+ ptCount: so.literalValues.length,
517
+ points: so.literalValues.map((value, index) => ({ index, value }))
518
+ }
519
+ ]
520
+ : [{ ptCount: 0, points: [] }],
521
+ // Hierarchical charts that successfully combined their leaf +
522
+ // hierarchy formulas into a single multi-column `<cx:f>` ship
523
+ // the numeric dimension without a `<cx:lvl>` cache — same
524
+ // rationale as the `_skipCache` marker on the category strDim
525
+ // above. A simple sunburst with no hierarchy, or a combine
526
+ // that failed (non-contiguous columns), still caches normally
527
+ // so the chart at least has something to paint from.
528
+ ...(hierarchyCombined ? { _skipCache: true } : {})
529
+ }
530
+ });
531
+ series.dataRefs.push({ dataId: valId });
532
+ if (hierarchyCombined) {
533
+ // Skipping the cache populator means the placeholder level we seed
534
+ // above never gets replaced with real values. Clear it so the
535
+ // renderer emits just the `<cx:f>` reference, matching Excel's
536
+ // writer output for treemap + sunburst.
537
+ const valEntry = data.find(d => d.id === valId);
538
+ if (valEntry?.numDim && !so.literalValues?.length) {
539
+ valEntry.numDim.levels = undefined;
540
+ }
541
+ }
542
+ // Waterfall subtotals. `subtotalPoints` is an alternative spelling
543
+ // accepted by the public API; we normalise both into the
544
+ // `layoutPr.subtotals` array expected by the renderer. Any additional
545
+ // fields present on `subtotalPoints[]` (beyond `idx`) are currently not
546
+ // preserved because the structured model only carries the index — we
547
+ // surface this limitation clearly rather than letting extra metadata
548
+ // disappear silently.
549
+ //
550
+ // When both `subtotals` and `subtotalPoints` are provided, merge
551
+ // them (deduped by `idx`) rather than silently dropping one.
552
+ // Previously `subtotalPoints` was ignored entirely when `subtotals`
553
+ // was set — users mixing the two forms lost state with no
554
+ // diagnostic.
555
+ const subtotalPoints = so.subtotalPoints;
556
+ const mergedSubtotals = (() => {
557
+ if (so.subtotals && subtotalPoints) {
558
+ const indexSet = new Set([...so.subtotals, ...subtotalPoints.map(p => p.idx)]);
559
+ return Array.from(indexSet).sort((a, b) => a - b);
560
+ }
561
+ return so.subtotals ?? subtotalPoints?.map(p => p.idx);
562
+ })();
563
+ if (layoutId === "waterfall") {
564
+ // Excel emits `<cx:layoutPr><cx:subtotals/></cx:layoutPr>` on
565
+ // EVERY waterfall series, even when the user has not marked any
566
+ // subtotal points. The empty `subtotals` element is treated as
567
+ // a "no subtotals but waterfall-aware" marker; without it Excel
568
+ // falls back to generic series rendering and, at load time,
569
+ // may reject the chartEx as malformed. Seed `layoutPr.subtotals`
570
+ // with an empty array here so the writer always emits the
571
+ // element — then merge in any explicit user-provided subtotal
572
+ // indices on top.
573
+ series.layoutPr = {
574
+ subtotals: mergedSubtotals ? mergedSubtotals.map(i => ({ idx: i })) : []
575
+ };
576
+ }
577
+ if (layoutId === "treemap" || layoutId === "sunburst") {
578
+ // Excel 2016+ will NOT render a sunburst / treemap that lacks a
579
+ // `<cx:layoutPr>` child — the frame is drawn but the plot area
580
+ // shows a completely blank canvas (the hierarchy arcs / tiles
581
+ // are computed but never painted). Verified against
582
+ // `tmp/ttttt.xlsx` (Excel-authored sunburst reference) — every
583
+ // Excel-authored hierarchical chartEx carries at least an empty
584
+ // `<cx:layoutPr/>`, and treemap charts additionally carry a
585
+ // `<cx:parentLabelLayout val="overlapping"/>` (the default) so
586
+ // the engine has something to reach for when deciding how to
587
+ // stack parent labels. Seed a minimal default here so freshly
588
+ // authored sunburst/treemap charts render on open; the caller's
589
+ // `layout.parentLabelLayout` (applied below via `opts.layout`
590
+ // merge) overrides the default when set.
591
+ series.layoutPr = {
592
+ ...(series.layoutPr ?? {}),
593
+ ...(layoutId === "treemap" ? { parentLabelLayout: "overlapping" } : {})
594
+ };
595
+ }
596
+ // Apply chart-level layout options to this series when appropriate.
597
+ // Note: `{ ...a, ...b }` does **not** skip `undefined` values on `b`,
598
+ // which means a user passing `opts.layout = { subtotals: undefined }`
599
+ // would wipe out an earlier `series.layoutPr.subtotals` set from
600
+ // `so.subtotals`. Use `mergeDefined` so only keys with defined values
601
+ // overwrite the base.
602
+ if (opts.layout) {
603
+ series.layoutPr = mergeDefined(series.layoutPr ?? {}, opts.layout);
604
+ }
605
+ if (opts.binning) {
606
+ // Merge user-supplied binning on top of anything the `opts.layout`
607
+ // branch above carried through (e.g. `layout.binning.intervalClosed`).
608
+ // The previous spread-replace (`{ ...existing, binning: opts.binning }`)
609
+ // discarded every field the user didn't re-specify, so
610
+ // `{ layout: { binning: { intervalClosed: "r" } }, binning: { binType: "manual" } }`
611
+ // silently dropped `intervalClosed`.
612
+ series.layoutPr = {
613
+ ...(series.layoutPr ?? {}),
614
+ binning: mergeDefined(series.layoutPr?.binning ?? {}, opts.binning)
615
+ };
616
+ }
617
+ if ((opts.type === "histogram" || opts.type === "pareto") && !series.layoutPr?.binning) {
618
+ // Excel's default `<cx:binning>` for a freshly-inserted
619
+ // histogram carries `intervalClosed="r"` — meaning "right-
620
+ // closed bin boundaries" (bins are `[a, b]`, not `[a, b)`).
621
+ // Emitting the element without the attribute is spec-legal
622
+ // (ST_IntervalClosedSide has a schema default of `"r"`) but
623
+ // Excel 2016+ treats the absence as "auto-compute binning"
624
+ // AND sometimes renders the chart as a blank frame when the
625
+ // binning has no explicit side. Verified against
626
+ // `tmp/aaaaa.xlsx` (Excel-authored histogram reference).
627
+ series.layoutPr = {
628
+ ...(series.layoutPr ?? {}),
629
+ binning: { binType: "auto", intervalClosed: "r" }
630
+ };
631
+ }
632
+ if (opts.type === "pareto") {
633
+ // Only default `paretoLine` to `true` when the caller hasn't
634
+ // explicitly set it. A user passing `layout: { paretoLine: false }`
635
+ // (valid per the validator) was previously overridden here,
636
+ // re-enabling the cumulative-percent line against explicit intent.
637
+ if (series.layoutPr?.paretoLine === undefined) {
638
+ series.layoutPr = {
639
+ ...(series.layoutPr ?? {}),
640
+ paretoLine: true
641
+ };
642
+ }
643
+ }
644
+ // Shape properties. `spPr` takes precedence over the `fill` / `border`
645
+ // hex shortcuts. Both inputs accept either a structured `ShapeProperties`
646
+ // or an `AddShapeFillOptions` bundle (normalised by `toShapeProperties`).
647
+ const normalisedSpPr = toShapeProperties(so.spPr);
648
+ if (normalisedSpPr) {
649
+ series.spPr = normalisedSpPr;
650
+ }
651
+ else if (so.fill || so.border) {
652
+ series.spPr = {};
653
+ if (so.fill) {
654
+ series.spPr.fill = { solid: hexToColor(so.fill) };
655
+ }
656
+ if (so.border) {
657
+ // Default to 9525 EMU (0.75pt) — Excel's default line width
658
+ // for chart series borders. Without an explicit `w`, DrawingML
659
+ // readers treat `<a:ln>` as hairline (effectively invisible
660
+ // on screen, sometimes 1px on print). Users setting `border:
661
+ // "#FF0000"` expect a visible red border, not a transparent
662
+ // colour on an invisible line.
663
+ series.spPr.line = {
664
+ color: hexToColor(so.border),
665
+ width: 9525
666
+ };
667
+ }
668
+ }
669
+ // Data labels
670
+ if (so.dataLabels) {
671
+ const dl = so.dataLabels;
672
+ series.dataLabels = {
673
+ visibility: {
674
+ value: dl.showValue,
675
+ categoryName: dl.showCategory,
676
+ seriesName: dl.showSeriesName,
677
+ // Map the public `showNumFmt` flag onto the internal
678
+ // visibility slot so readers can distinguish "render the
679
+ // number with its format" from "no numeric display at all".
680
+ // Previously the field had no way to be set from the public
681
+ // builder — the internal model exposed it, but the public
682
+ // options dropped it silently.
683
+ numFmt: dl.showNumFmt
684
+ },
685
+ position: dl.position,
686
+ separator: dl.separator,
687
+ numFmt: dl.numFmt,
688
+ // `spPr` / `txPr` route through to the rendered `<cx:spPr>` /
689
+ // `<cx:txPr>` children. Accept both the structured
690
+ // `ShapeProperties` and the ergonomic `AddShapeFillOptions`
691
+ // bundle via `toShapeProperties`, matching the classic
692
+ // `buildDataLabelsFromOpts` helper.
693
+ spPr: toShapeProperties(dl.spPr),
694
+ txPr: dl.txPr
695
+ };
696
+ }
697
+ // Default dataLabels for chartEx types where Excel always emits
698
+ // them. Match Excel's exact defaults so our output is byte-close
699
+ // to what a freshly-inserted chart looks like:
700
+ //
701
+ // <cx:dataLabels pos="outEnd">
702
+ // <cx:visibility seriesName="0" categoryName="0" value="1"/>
703
+ // </cx:dataLabels>
704
+ //
705
+ // Only applied when the caller did NOT supply `so.dataLabels` —
706
+ // user-driven customisation is preserved. The branches cover
707
+ // every 2014+ layout for which Excel emits a default block;
708
+ // sunburst / treemap typically show only the category name, so
709
+ // their defaults differ. (Pareto is handled on the pareto line
710
+ // series via a separate pass.)
711
+ if (!series.dataLabels) {
712
+ if (layoutId === "waterfall" || layoutId === "funnel") {
713
+ series.dataLabels = {
714
+ position: "outEnd",
715
+ visibility: { seriesName: false, categoryName: false, value: true }
716
+ };
717
+ }
718
+ else if (layoutId === "sunburst" || layoutId === "treemap") {
719
+ series.dataLabels = {
720
+ visibility: { seriesName: false, categoryName: true, value: false }
721
+ };
722
+ }
723
+ }
724
+ return series;
725
+ }
726
+ /**
727
+ * Merge `patch` onto `base`, ignoring keys on `patch` whose value is
728
+ * `undefined`. JavaScript's native object spread (`{ ...a, ...b }`) does
729
+ * NOT skip `undefined` values on `b`, so `{ x: 1, ...{ x: undefined } }`
730
+ * produces `{ x: undefined }` — unintuitive and a frequent source of
731
+ * layering bugs. Use this helper whenever merging option objects where
732
+ * "undefined means don't change" is the expected semantics.
733
+ */
734
+ function mergeDefined(base, patch) {
735
+ const result = { ...base };
736
+ for (const [key, value] of Object.entries(patch)) {
737
+ if (value !== undefined) {
738
+ result[key] = value;
739
+ }
740
+ }
741
+ return result;
742
+ }
743
+ /**
744
+ * Shallow element-wise string array equality. Used to verify that
745
+ * `literalCategories` arrays declared on multiple series in the same
746
+ * ChartEx bundle are identical, so the builder can safely hoist them
747
+ * into a single shared category `cx:data` entry.
748
+ */
749
+ function arraysEqual(a, b) {
750
+ if (a === b) {
751
+ return true;
752
+ }
753
+ if (a.length !== b.length) {
754
+ return false;
755
+ }
756
+ for (let i = 0; i < a.length; i++) {
757
+ if (a[i] !== b[i]) {
758
+ return false;
759
+ }
760
+ }
761
+ return true;
762
+ }
763
+ function validateChartExOptions(opts) {
764
+ if (!opts || typeof opts !== "object") {
765
+ throw new ChartOptionsError("chartEx options are required.");
766
+ }
767
+ if (!opts.type) {
768
+ throw new ChartOptionsError("chartEx.type is required.");
769
+ }
770
+ if (!Array.isArray(opts.series) || opts.series.length === 0) {
771
+ throw new ChartOptionsError("chartEx.series must contain at least one series.");
772
+ }
773
+ if (opts.binning && opts.type !== "histogram" && opts.type !== "pareto") {
774
+ throw new ChartOptionsError(`chartEx.binning is only valid for histogram and pareto charts, not ${opts.type}.`);
775
+ }
776
+ validateLayoutOptions(opts);
777
+ const binning = opts.binning ?? opts.layout?.binning;
778
+ if (binning) {
779
+ validateBinning(binning);
780
+ }
781
+ opts.series.forEach((series, i) => {
782
+ if (!series.values) {
783
+ throw new ChartOptionsError(`chartEx.series[${i}].values is required.`);
784
+ }
785
+ if (series.literalValues?.some(value => !Number.isFinite(value))) {
786
+ throw new ChartOptionsError(`chartEx.series[${i}].literalValues must contain only finite numbers.`);
787
+ }
788
+ if (series.literalCategories &&
789
+ series.literalValues &&
790
+ series.literalCategories.length !== series.literalValues.length) {
791
+ throw new ChartOptionsError(`chartEx.series[${i}].literalCategories length must match literalValues length.`);
792
+ }
793
+ if (series.hierarchy && opts.type !== "sunburst" && opts.type !== "treemap") {
794
+ throw new ChartOptionsError(`chartEx.series[${i}].hierarchy is only valid for sunburst and treemap charts.`);
795
+ }
796
+ if (series.literalHierarchy && opts.type !== "sunburst" && opts.type !== "treemap") {
797
+ throw new ChartOptionsError(`chartEx.series[${i}].literalHierarchy is only valid for sunburst and treemap charts.`);
798
+ }
799
+ if (series.literalHierarchy && series.literalValues) {
800
+ for (let level = 0; level < series.literalHierarchy.length; level++) {
801
+ if (series.literalHierarchy[level].length !== series.literalValues.length) {
802
+ throw new ChartOptionsError(`chartEx.series[${i}].literalHierarchy[${level}] length must match literalValues length.`);
803
+ }
804
+ }
805
+ }
806
+ if ((series.subtotals || series.subtotalPoints) && opts.type !== "waterfall") {
807
+ throw new ChartOptionsError(`chartEx.series[${i}].subtotals is only valid for waterfall charts.`);
808
+ }
809
+ if (series.subtotals?.some(idx => !Number.isInteger(idx) || idx < 0)) {
810
+ throw new ChartOptionsError(`chartEx.series[${i}].subtotals must contain non-negative integer indices.`);
811
+ }
812
+ if (series.subtotalPoints?.some(point => !Number.isInteger(point.idx) || point.idx < 0)) {
813
+ throw new ChartOptionsError(`chartEx.series[${i}].subtotalPoints must contain non-negative integer indices.`);
814
+ }
815
+ });
816
+ }
817
+ function validateLayoutOptions(opts) {
818
+ const layout = opts.layout;
819
+ if (!layout) {
820
+ return;
821
+ }
822
+ if (layout.binning && opts.type !== "histogram" && opts.type !== "pareto") {
823
+ throw new ChartOptionsError(`chartEx.layout.binning is only valid for histogram and pareto charts.`);
824
+ }
825
+ if (layout.subtotals && opts.type !== "waterfall") {
826
+ throw new ChartOptionsError(`chartEx.layout.subtotals is only valid for waterfall charts.`);
827
+ }
828
+ const waterfallFields = [
829
+ layout.connectorLines,
830
+ layout.increaseSpPr,
831
+ layout.decreaseSpPr,
832
+ layout.totalSpPr
833
+ ];
834
+ if (waterfallFields.some(value => value !== undefined) && opts.type !== "waterfall") {
835
+ throw new ChartOptionsError(`chartEx.layout waterfall fields are only valid for waterfall charts.`);
836
+ }
837
+ const hierarchyLayout = layout.parentLabelLayout !== undefined;
838
+ if (hierarchyLayout && opts.type !== "sunburst" && opts.type !== "treemap") {
839
+ throw new ChartOptionsError(`chartEx.layout.parentLabelLayout is only valid for sunburst and treemap charts.`);
840
+ }
841
+ const boxWhiskerFields = [
842
+ layout.quartileMethod,
843
+ layout.showMeanLine,
844
+ layout.showMeanMarker,
845
+ layout.showInnerPoints,
846
+ layout.showOutlierPoints
847
+ ];
848
+ if (boxWhiskerFields.some(value => value !== undefined) && opts.type !== "boxWhisker") {
849
+ throw new ChartOptionsError(`chartEx.layout box-whisker fields are only valid for boxWhisker charts.`);
850
+ }
851
+ const regionMapFields = [layout.projection, layout.regionLabels, layout.geoMappingLevel];
852
+ if (regionMapFields.some(value => value !== undefined) && opts.type !== "regionMap") {
853
+ throw new ChartOptionsError(`chartEx.layout region-map fields are only valid for regionMap charts.`);
854
+ }
855
+ if (layout.paretoLine !== undefined && opts.type !== "pareto") {
856
+ throw new ChartOptionsError(`chartEx.layout.paretoLine is only valid for pareto charts.`);
857
+ }
858
+ }
859
+ function validateBinning(binning) {
860
+ if (binning.binSize !== undefined && binning.binSize <= 0) {
861
+ throw new ChartOptionsError("chartEx.binning.binSize must be greater than 0.");
862
+ }
863
+ if (binning.binCount !== undefined &&
864
+ (!Number.isInteger(binning.binCount) || binning.binCount <= 0)) {
865
+ throw new ChartOptionsError("chartEx.binning.binCount must be a positive integer.");
866
+ }
867
+ if (binning.underflow !== undefined &&
868
+ binning.overflow !== undefined &&
869
+ binning.underflow >= binning.overflow) {
870
+ throw new ChartOptionsError("chartEx.binning.underflow must be less than overflow.");
871
+ }
872
+ }
873
+ function mapChartTypeToLayoutId(type) {
874
+ switch (type) {
875
+ case "sunburst":
876
+ return "sunburst";
877
+ case "treemap":
878
+ return "treemap";
879
+ case "waterfall":
880
+ return "waterfall";
881
+ case "funnel":
882
+ return "funnel";
883
+ case "histogram":
884
+ case "pareto":
885
+ // Histogram and pareto both project onto the same `clusteredColumn`
886
+ // layout — pareto additionally renders a line overlay (flagged via
887
+ // `layoutPr.paretoLine`), histogram supplies the binning metadata.
888
+ return "clusteredColumn";
889
+ case "boxWhisker":
890
+ return "boxWhisker";
891
+ case "regionMap":
892
+ return "regionMap";
893
+ default: {
894
+ const _never = type;
895
+ throw new ChartOptionsError(`Unsupported chartEx type: ${String(_never)}.`);
896
+ }
897
+ }
898
+ }
899
+ function needsAxes(type) {
900
+ // Sunburst, treemap, funnel, regionMap don't use traditional axes;
901
+ // histogram/pareto/waterfall/boxWhisker do.
902
+ return type === "histogram" || type === "pareto" || type === "waterfall" || type === "boxWhisker";
903
+ }