@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,821 @@
1
+ /**
2
+ * Shared helpers for the chart preview renderers.
3
+ *
4
+ * Both `chart-renderer.ts` (classic `c:chart`) and
5
+ * `chart-ex-renderer.ts` (ChartEx `cx:chart`) used to carry their own
6
+ * copies of the same handful of math / colour / formatting helpers. The
7
+ * duplicates had drifted over time — subtle differences in NaN guards,
8
+ * hex normalisation, theme palettes, etc. — so a fix in one file
9
+ * silently left the other buggy. This module is the single authoritative
10
+ * home for the helpers shared between the two renderers (plus a few
11
+ * internals — `escapeXml`, `escapeXmlAttr` — that had identical copies
12
+ * scattered across the chart pipeline).
13
+ *
14
+ * Design constraints:
15
+ *
16
+ * - **Zero dependencies on chart-renderer / chart-ex-renderer** so
17
+ * this module sits below them in the import graph and does not
18
+ * create cycles. Types-only imports from `./types` are fine.
19
+ * - **Behaviour-preserving** compared with the consolidated
20
+ * implementations. The old files had two classes of helper:
21
+ * (1) strictly identical duplicates and (2) near-duplicates where
22
+ * one version was more defensive than the other. For the latter we
23
+ * kept the defensive variant — graceful degradation on malformed
24
+ * input is always the safer choice for a preview path.
25
+ * - **Structural rect typing**. The renderers use two different
26
+ * concrete rect types (`ChartSceneRect` in chart-renderer,
27
+ * `SvgRect` in chart-ex-renderer) that share the same shape.
28
+ * Helpers here take structural `{ x: number; y: number; width:
29
+ * number; height: number }` so both renderers can call them
30
+ * directly without adapters.
31
+ */
32
+ import { stripXmlIllegalChars as sharedStripXmlIllegalChars } from "../../xml/encode.js";
33
+ // ============================================================================
34
+ // Shared render constants
35
+ // ============================================================================
36
+ /** Default SVG / PNG / PDF canvas width when the caller omits `options.width`. */
37
+ export const DEFAULT_WIDTH = 640;
38
+ /** Default SVG / PNG / PDF canvas height when the caller omits `options.height`. */
39
+ export const DEFAULT_HEIGHT = 360;
40
+ /**
41
+ * Default series colour rotation. Matches the Excel 2019+ Office theme
42
+ * accent1..accent6 palette so a brand-new workbook with no theme XML
43
+ * still renders with the colours Excel would have used.
44
+ */
45
+ export const COLORS = ["#4472C4", "#ED7D31", "#A5A5A5", "#FFC000", "#5B9BD5", "#70AD47"];
46
+ /** Dark grey for axis lines / frame strokes. */
47
+ export const AXIS_COLOR = "#444444";
48
+ /** Light grey for gridlines. */
49
+ export const GRID_COLOR = "#D9D9D9";
50
+ /**
51
+ * Preview-grade DrawingML theme palette (`CT_ColorMapping` order:
52
+ * `dk1` / `lt1` / `dk2` / `lt2` / `accent1..6` / `hlink` / `folHlink`).
53
+ * Values match the Office defaults Excel 2019+ ships with (the "Office"
54
+ * theme). The renderer only consults this when a chart references a
55
+ * theme colour but no `<a:clrScheme>` has been resolved — the full
56
+ * theme lookup chain requires the workbook's `theme.xml`, which the
57
+ * preview path deliberately does not load. Authors who need exact
58
+ * theme-accurate colours should rasterise with a tool that resolves
59
+ * the theme.
60
+ */
61
+ const THEME_PREVIEW_PALETTE = Object.freeze([
62
+ "#000000", // dk1 / tx1
63
+ "#FFFFFF", // lt1 / bg1
64
+ "#44546A", // dk2 / tx2
65
+ "#E7E6E6", // lt2 / bg2
66
+ "#4472C4", // accent1
67
+ "#ED7D31", // accent2
68
+ "#A5A5A5", // accent3
69
+ "#FFC000", // accent4
70
+ "#5B9BD5", // accent5
71
+ "#70AD47", // accent6
72
+ "#0563C1", // hlink
73
+ "#954F72" // folHlink
74
+ ]);
75
+ /**
76
+ * DrawingML theme slot names in the canonical order used by
77
+ * `CT_ColorMapping` (ECMA-376 §20.1.2.3.29). Both parser and writer
78
+ * use this single list so every round-trip picks the same variant of
79
+ * the dk/tx and lt/bg alias pairs (we canonicalise to `dk…` / `lt…`).
80
+ *
81
+ * The parser folds `tx1/bg1/tx2/bg2` into the same indices as
82
+ * `dk1/lt1/dk2/lt2` (they are aliases in the OOXML colour-mapping
83
+ * schema) — see `shape-properties.ts:parseColorFromXml`. The output
84
+ * form therefore uses `dk1/lt1/dk2/lt2`, which is semantically
85
+ * identical to the input.
86
+ */
87
+ const THEME_NAMES = Object.freeze([
88
+ "dk1",
89
+ "lt1",
90
+ "dk2",
91
+ "lt2",
92
+ "accent1",
93
+ "accent2",
94
+ "accent3",
95
+ "accent4",
96
+ "accent5",
97
+ "accent6",
98
+ "hlink",
99
+ "folHlink"
100
+ ]);
101
+ /**
102
+ * Convert a theme-palette index (`ChartColor.theme`) back to its
103
+ * DrawingML `schemeClr` token. Out-of-range indices fall back to
104
+ * `"dk1"` so a malformed model still produces parseable XML Excel
105
+ * renders as the first theme slot rather than XML that contains an
106
+ * `undefined` literal.
107
+ */
108
+ export function themeIndexToName(index) {
109
+ return THEME_NAMES[index] ?? "dk1";
110
+ }
111
+ // ============================================================================
112
+ // Math helpers
113
+ // ============================================================================
114
+ /**
115
+ * Clamp to the closed interval `[0, 1]`. Non-finite input collapses to
116
+ * `0` rather than propagating `NaN` — downstream callers use the
117
+ * result as an interpolation parameter where `NaN` would paint black.
118
+ */
119
+ export function clamp01(value) {
120
+ if (!Number.isFinite(value)) {
121
+ return 0;
122
+ }
123
+ if (value < 0) {
124
+ return 0;
125
+ }
126
+ if (value > 1) {
127
+ return 1;
128
+ }
129
+ return value;
130
+ }
131
+ /**
132
+ * Map a data-space value onto the plot area's y coordinate space (SVG
133
+ * y grows downward, so large `value` ends up near the top of the
134
+ * plot). Guards against `max === min` — a single-point dataset or a
135
+ * range that collapsed for any reason would otherwise produce `NaN`.
136
+ */
137
+ export function valueToY(value, min, max, plot) {
138
+ const span = max - min;
139
+ if (!Number.isFinite(span) || span === 0) {
140
+ return plot.y + plot.height / 2;
141
+ }
142
+ return plot.y + plot.height - ((value - min) / span) * plot.height;
143
+ }
144
+ /**
145
+ * Map a data-space value onto the plot area's x coordinate space. Same
146
+ * `max === min` guard as {@link valueToY}.
147
+ */
148
+ export function valueToX(value, min, max, plot) {
149
+ const span = max - min;
150
+ if (!Number.isFinite(span) || span === 0) {
151
+ return plot.x + plot.width / 2;
152
+ }
153
+ return plot.x + ((value - min) / span) * plot.width;
154
+ }
155
+ /** Convert polar `(radius, angle)` to Cartesian around `(cx, cy)`. */
156
+ export function polar(cx, cy, radius, angle) {
157
+ return { x: cx + Math.cos(angle) * radius, y: cy + Math.sin(angle) * radius };
158
+ }
159
+ /**
160
+ * Shrink a rect by `amount` on each side (uniform inset). Non-finite
161
+ * inputs collapse to zero on all four components rather than
162
+ * propagating `NaN` — `Math.max(0, NaN)` returns `NaN` per ECMAScript,
163
+ * and a `NaN` width feeding downstream math (e.g. `valueToX`) cascades
164
+ * into every rendered coordinate.
165
+ */
166
+ export function insetRect(rect, amount) {
167
+ const safeAmount = Number.isFinite(amount) ? amount : 0;
168
+ const x = Number.isFinite(rect.x) ? rect.x + safeAmount : 0;
169
+ const y = Number.isFinite(rect.y) ? rect.y + safeAmount : 0;
170
+ const w = Number.isFinite(rect.width) ? rect.width - safeAmount * 2 : 0;
171
+ const h = Number.isFinite(rect.height) ? rect.height - safeAmount * 2 : 0;
172
+ return {
173
+ x,
174
+ y,
175
+ width: w > 0 ? w : 0,
176
+ height: h > 0 ? h : 0
177
+ };
178
+ }
179
+ // ============================================================================
180
+ // Number formatting
181
+ // ============================================================================
182
+ /**
183
+ * Format a number for SVG attribute values and inline XML. Two-decimal
184
+ * precision with trailing `.00` stripped (`1.00 → "1"`, `1.50 →
185
+ * "1.50"` — we intentionally keep the second zero to avoid widening the
186
+ * diff against Excel's own byte output on round-trips). Non-finite
187
+ * input returns `"0"` — `Number.toFixed(NaN)` produces the literal
188
+ * string `"NaN"`, which is invalid inside SVG attribute values and
189
+ * breaks downstream parsers.
190
+ */
191
+ export function fmt(value) {
192
+ if (!Number.isFinite(value)) {
193
+ return "0";
194
+ }
195
+ return value.toFixed(2).replace(/\.00$/, "");
196
+ }
197
+ /**
198
+ * Format a numeric attribute value for XML emission. Returns an empty
199
+ * string for `undefined` / `NaN` / `±Infinity` — non-finite values would
200
+ * otherwise serialise as literal `"NaN"` / `"Infinity"` text, which no
201
+ * XSD validator accepts as `xsd:double` and downstream parsers reject.
202
+ * Emit an empty string so the caller's attribute-inclusion guard
203
+ * (`if (attrs.length > 0)` or explicit `!== undefined` check) drops
204
+ * the attribute entirely rather than stamping garbage into the wire
205
+ * format.
206
+ *
207
+ * Uses JavaScript's default `toString()` which is round-trip-safe per
208
+ * IEEE 754 (no precision drift) for both integer and fractional input.
209
+ */
210
+ export function fmtNumAttr(value) {
211
+ if (value === undefined || !Number.isFinite(value)) {
212
+ return "";
213
+ }
214
+ return String(value);
215
+ }
216
+ /**
217
+ * Format a numeric text-node value. Same semantics as {@link fmtNumAttr},
218
+ * but for use inside element content (e.g. `<cx:pt>42.5</cx:pt>`).
219
+ * Non-finite values become `"0"` — a text node must be non-empty to
220
+ * keep the element well-formed, and `0` is the least-surprising
221
+ * fallback for a blank / error cell (matches how most OOXML readers
222
+ * treat empty numeric `<c:v>`).
223
+ */
224
+ export function fmtNumText(value) {
225
+ if (!Number.isFinite(value)) {
226
+ return "0";
227
+ }
228
+ return String(value);
229
+ }
230
+ /**
231
+ * Format a number for user-visible axis tick labels.
232
+ *
233
+ * - Integer values → plain digits (`42` → `"42"`).
234
+ * - `|value| < 0.01` but non-zero → scientific notation with three
235
+ * significant figures (`1.00e-3`). Two-decimal mantissa keeps the
236
+ * label compact while preserving enough precision that tick values
237
+ * remain distinguishable; a single-digit mantissa would collapse
238
+ * consecutive ticks like `1.1e-3` and `1.4e-3` to the same label.
239
+ * - Otherwise → single decimal (`toFixed(1)`).
240
+ * - Non-finite input → `""` (tick position still drawn without
241
+ * label, keeping the chart legible while flagging the upstream
242
+ * computation bug on inspection).
243
+ *
244
+ * This is the "axis-label" formatter — it's intentionally compact and
245
+ * does not apply OOXML number formats. Callers that need the authored
246
+ * format code should resolve it upstream.
247
+ */
248
+ export function formatNumber(value) {
249
+ if (!Number.isFinite(value)) {
250
+ return "";
251
+ }
252
+ if (Number.isInteger(value)) {
253
+ return String(value);
254
+ }
255
+ const abs = Math.abs(value);
256
+ if (abs !== 0 && abs < 0.01) {
257
+ return value.toExponential(2);
258
+ }
259
+ return value.toFixed(1);
260
+ }
261
+ // ============================================================================
262
+ // XML escaping
263
+ // ============================================================================
264
+ //
265
+ // Split into two distinct helpers with different semantics:
266
+ //
267
+ // - `escapeXml` (text content) — escapes `&<>` only. Excel itself
268
+ // writes apostrophes and double-quotes unescaped inside text
269
+ // content (see Excel-authored pivot source names like
270
+ // `<c:name>'Sheet'!Pivot1</c:name>`), so escaping them would make
271
+ // our output diverge visibly at the byte level and break string
272
+ // consumers that do literal matches on quoted sheet names.
273
+ //
274
+ // - `escapeXmlAttr` (attribute values) — full `xmlEncodeAttr` from
275
+ // `@xml/encode`: escapes `&<>"'`, strips C0/C1 control chars and
276
+ // lone surrogates, and encodes `\t\n\r` as numeric character
277
+ // references so attribute round-trip preserves whitespace (XML 1.0
278
+ // §3.3.3 attribute-value normalisation would otherwise flatten
279
+ // them to a single space).
280
+ //
281
+ // chart-renderer, chart-ex-renderer, chart-ex-parser, chart-sidecar
282
+ // and the chart-space xform previously carried five subtly-different
283
+ // local copies; this module is now the single authoritative home for
284
+ // both helpers.
285
+ /**
286
+ * Escape XML text content — `&`, `<`, `>` become `&amp;`, `&lt;`,
287
+ * `&gt;` respectively. XML-illegal characters are stripped up front
288
+ * via the shared {@link stripXmlIllegalChars} helper — that covers
289
+ * the forbidden C0 controls (`0x00-0x08 | 0x0B | 0x0C | 0x0E-0x1F`),
290
+ * DEL (`0x7F`, project-policy strip despite being technically legal
291
+ * XML), lone UTF-16 surrogate halves, and the `0xFFFE` / `0xFFFF`
292
+ * noncharacters.
293
+ *
294
+ * Apostrophe and double-quote pass through unescaped — both are legal
295
+ * inside text content and leaving them alone preserves Excel's byte
296
+ * output (`<c:name>'Sheet'!Pivot1</c:name>` with literal quotes).
297
+ *
298
+ * We keep this separate from {@link xmlEncode} in `@xml/encode`
299
+ * because that helper escapes all five reserved entities; the chart
300
+ * module prefers byte-level parity with Excel's own output, which
301
+ * leaves `'` / `"` alone in text context.
302
+ */
303
+ export function escapeXml(value) {
304
+ // Fast path: most chart text is plain ASCII / BMP with no control
305
+ // chars. A quick scan tells us whether to enter the slow path or
306
+ // just run the cheap three-replace chain. Valid surrogate pairs
307
+ // (any emoji / non-BMP CJK character) must be skipped intact — a
308
+ // naive "any high surrogate triggers strip" would force the slow
309
+ // path on every string containing one, defeating the fast-path.
310
+ let needsStrip = false;
311
+ const len = value.length;
312
+ for (let i = 0; i < len; i++) {
313
+ const code = value.charCodeAt(i);
314
+ if (code < 32) {
315
+ if (code !== 9 && code !== 10 && code !== 13) {
316
+ needsStrip = true;
317
+ break;
318
+ }
319
+ }
320
+ else if (code >= 0xd800 && code <= 0xdbff) {
321
+ const next = i + 1 < len ? value.charCodeAt(i + 1) : 0;
322
+ if (next >= 0xdc00 && next <= 0xdfff) {
323
+ // Valid surrogate pair — consume both halves.
324
+ i++;
325
+ }
326
+ else {
327
+ needsStrip = true;
328
+ break;
329
+ }
330
+ }
331
+ else if (code >= 0xdc00 && code <= 0xdfff) {
332
+ // Lone low surrogate.
333
+ needsStrip = true;
334
+ break;
335
+ }
336
+ else if (code === 0x7f || code === 0xfffe || code === 0xffff) {
337
+ needsStrip = true;
338
+ break;
339
+ }
340
+ }
341
+ const sanitised = needsStrip ? stripXmlIllegalChars(value) : value;
342
+ return sanitised.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
343
+ }
344
+ /**
345
+ * Strip characters that can't appear in XML 1.0 content or attribute
346
+ * values. Re-exported from `@xml/encode` so the chart module and the
347
+ * XML module share a single source of truth; previously each carried a
348
+ * local copy with comment-level disagreements (one called DEL a C1
349
+ * control, the other called it "XML-forbidden" — both inaccurate).
350
+ * See {@link stripXmlIllegalChars} in `@xml/encode` for the canonical
351
+ * rules.
352
+ */
353
+ function stripXmlIllegalChars(value) {
354
+ return sharedStripXmlIllegalChars(value);
355
+ }
356
+ export { xmlEncodeAttr as escapeXmlAttr } from "../../xml/encode.js";
357
+ // ============================================================================
358
+ // Hex colour helpers
359
+ // ============================================================================
360
+ /**
361
+ * Normalise any supported hex input to a 6-digit uppercase value
362
+ * (without the leading `#`). Accepts:
363
+ *
364
+ * - 3-digit shorthand `#FFF` → `FFFFFF` (each nibble duplicated).
365
+ * - 4-digit shorthand `#FFFA` with alpha → `FFFFFF` (alpha dropped;
366
+ * renderer encodes alpha separately).
367
+ * - 6-digit `#112233`.
368
+ * - 8-digit `#11223344` with alpha → `112233` (alpha dropped).
369
+ *
370
+ * Returns `undefined` when the input cannot be coerced — lets callers
371
+ * fall back to a default colour rather than emit `#NaNNaNNaN`.
372
+ */
373
+ export function normalizeHex6(hex) {
374
+ if (!hex) {
375
+ return undefined;
376
+ }
377
+ const clean = hex.replace(/^#/, "").toUpperCase();
378
+ if (/^[0-9A-F]{6}([0-9A-F]{2})?$/.test(clean)) {
379
+ return clean.slice(0, 6);
380
+ }
381
+ if (/^[0-9A-F]{3}([0-9A-F])?$/.test(clean)) {
382
+ return clean
383
+ .slice(0, 3)
384
+ .split("")
385
+ .map(ch => ch + ch)
386
+ .join("");
387
+ }
388
+ return undefined;
389
+ }
390
+ /**
391
+ * Extract the alpha channel from a hex colour string (if present) as
392
+ * a fraction in `[0, 1]`. Accepts `#RGBA` and `#RRGGBBAA`; the 3-
393
+ * and 6-digit forms have no alpha and return `undefined`.
394
+ */
395
+ function hexAlpha(hex) {
396
+ if (!hex) {
397
+ return undefined;
398
+ }
399
+ const clean = hex.replace(/^#/, "").toUpperCase();
400
+ if (/^[0-9A-F]{8}$/.test(clean)) {
401
+ return parseInt(clean.slice(6, 8), 16) / 255;
402
+ }
403
+ if (/^[0-9A-F]{4}$/.test(clean)) {
404
+ const aNibble = clean[3];
405
+ return parseInt(aNibble + aNibble, 16) / 255;
406
+ }
407
+ return undefined;
408
+ }
409
+ /**
410
+ * White-blend `hex` by `alpha` — a cheap opacity approximation for
411
+ * SVG surfaces that don't support per-element `fill-opacity`. Accepts
412
+ * 3/4/6/8-digit hex; returns the input untouched for anything else
413
+ * rather than emit `"#NaNNaNNaN"`.
414
+ */
415
+ export function withAlpha(hex, alpha) {
416
+ const body = normalizeHex6(hex);
417
+ if (!body) {
418
+ return hex;
419
+ }
420
+ const safeAlpha = Number.isFinite(alpha) ? Math.max(0, Math.min(1, alpha)) : 1;
421
+ const mix = (component) => {
422
+ const value = parseInt(component, 16);
423
+ return Math.round(value * safeAlpha + 255 * (1 - safeAlpha))
424
+ .toString(16)
425
+ .padStart(2, "0")
426
+ .toUpperCase();
427
+ };
428
+ return `#${mix(body.slice(0, 2))}${mix(body.slice(2, 4))}${mix(body.slice(4, 6))}`;
429
+ }
430
+ /**
431
+ * Linearly interpolate between two hex colours. `t` is clamped to
432
+ * `[0, 1]`; non-finite `t` falls back to `0`. Malformed hex inputs
433
+ * degrade gracefully (prefer the end colour when `t >= 0.5`; prefer
434
+ * the start colour otherwise) so one bad input channel never produces
435
+ * `"#NaNNaNNaN"`.
436
+ */
437
+ export function interpolateColor(a, b, t) {
438
+ const ca = normalizeHex6(a);
439
+ const cb = normalizeHex6(b);
440
+ const clamped = clamp01(t);
441
+ if (!ca || !cb) {
442
+ return `#${clamped >= 0.5 ? (cb ?? ca ?? "000000") : (ca ?? cb ?? "000000")}`;
443
+ }
444
+ const mix = (i) => {
445
+ // `ca` / `cb` have been normalised to exactly 6 hex digits by
446
+ // `normalizeHex6`, so `parseInt(..., 16)` on a 2-char slice cannot
447
+ // produce `NaN`. We rely on that invariant — don't add a
448
+ // defensive-looking guard that masks a real upstream regression.
449
+ const av = parseInt(ca.slice(i, i + 2), 16);
450
+ const bv = parseInt(cb.slice(i, i + 2), 16);
451
+ return Math.round(av + (bv - av) * clamped)
452
+ .toString(16)
453
+ .padStart(2, "0")
454
+ .toUpperCase();
455
+ };
456
+ return `#${mix(0)}${mix(2)}${mix(4)}`;
457
+ }
458
+ /**
459
+ * Convert a hex colour string to a {@link PdfColor}. Preserves an
460
+ * explicit alpha byte when the caller supplied 4- or 8-digit hex —
461
+ * PDF surfaces that honour `PdfColor.a` (notably `PdfPageBuilder` via
462
+ * `/ExtGState`) then produce real translucency. Malformed input
463
+ * degrades to opaque black rather than producing `NaN` channels, which
464
+ * would emit broken PDF content.
465
+ */
466
+ export function hexToPdfColor(hex) {
467
+ const clean = normalizeHex6(hex);
468
+ if (!clean) {
469
+ return { r: 0, g: 0, b: 0 };
470
+ }
471
+ const alpha = hexAlpha(hex);
472
+ const base = {
473
+ r: parseInt(clean.slice(0, 2), 16) / 255,
474
+ g: parseInt(clean.slice(2, 4), 16) / 255,
475
+ b: parseInt(clean.slice(4, 6), 16) / 255
476
+ };
477
+ return alpha !== undefined ? { ...base, a: alpha } : base;
478
+ }
479
+ /**
480
+ * Like {@link hexToPdfColor} but attaches an explicit alpha value.
481
+ * Callers use this to mirror the SVG path's `withAlpha(color, 0.35)`
482
+ * pattern on the PDF bridge: the hex itself stays opaque, `a` carries
483
+ * the transparency the SVG would paint by white-blending.
484
+ */
485
+ export function hexToPdfColorWithAlpha(hex, alpha) {
486
+ return { ...hexToPdfColor(hex), a: clamp01(alpha) };
487
+ }
488
+ // ============================================================================
489
+ // Shape-properties preview helpers
490
+ // ============================================================================
491
+ /**
492
+ * Resolve a {@link ChartColor} into a preview-grade hex colour. Accepts
493
+ * every DrawingML colour variant Excel emits — `srgb`, `theme` (looked
494
+ * up in {@link THEME_PREVIEW_PALETTE}), `sysClr` (the two Excel keeps
495
+ * meaningful in the preview — `windowText` / `window`), and `prstClr`
496
+ * (the ~140-entry {@link PRESET_COLOR_HEX_TABLE}). Returns `undefined`
497
+ * when the colour is absent or references something this preview cannot
498
+ * resolve (an unknown preset / sysClr, or a theme index outside the
499
+ * 12-entry palette). Callers that need a default coalesce with `??`.
500
+ *
501
+ * Shared by fill, line, and text-property resolvers so a file that
502
+ * sets, say, a gridline colour via `<a:schemeClr val="accent3"/>`
503
+ * paints the correct accent-3 hex — previously the line/text paths
504
+ * only honoured `srgbClr` and silently fell back to the renderer's
505
+ * default grey.
506
+ *
507
+ * Colour modifiers (`tint`, `shade`, `lumMod`, `lumOff`, `alpha`,
508
+ * `satMod`) are intentionally NOT applied — the preview path doesn't
509
+ * model the DrawingML blend pipeline, and approximating one component
510
+ * in isolation produces visibly-wrong results. Authors who need
511
+ * exact theme-derived colours should rasterise with a full DrawingML
512
+ * renderer.
513
+ */
514
+ export function resolveChartColor(color) {
515
+ if (!color) {
516
+ return undefined;
517
+ }
518
+ if (typeof color.srgb === "string") {
519
+ // Validate: OOXML `ST_HexBinary3` is a 6-digit hex (RGB) but we
520
+ // tolerate a leading `#` for backward compatibility. Also honour
521
+ // the 8-digit `RRGGBBAA` form Excel uses when encoding alpha
522
+ // inside the hex — drop the alpha for the preview (alpha is
523
+ // surfaced separately as `color.alpha` on the structured model).
524
+ //
525
+ // If `srgb` is set but malformed, return `undefined` rather than
526
+ // falling through to `theme` / `sysClr` / `prstClr`. Legitimate
527
+ // DrawingML colours set exactly one of those fields, so a
528
+ // fall-through only ever helps malformed data — and when it does,
529
+ // it silently substitutes a different colour source than the
530
+ // author wrote, which is worse than coalescing to a default.
531
+ const clean = color.srgb.replace(/^#/, "");
532
+ if (/^[0-9a-fA-F]{6}$/.test(clean)) {
533
+ return `#${clean.toUpperCase()}`;
534
+ }
535
+ if (/^[0-9a-fA-F]{8}$/.test(clean)) {
536
+ return `#${clean.slice(0, 6).toUpperCase()}`;
537
+ }
538
+ return undefined;
539
+ }
540
+ if (typeof color.theme === "number") {
541
+ // `Number.isInteger` guards against `NaN`, `Infinity`, fractional
542
+ // values, and negative indices — any of which would slip past
543
+ // `typeof === "number"` but produce `undefined` on index access,
544
+ // silently skipping the sysClr / prstClr fallbacks below. On a
545
+ // malformed or out-of-range theme index, fall through so the
546
+ // caller's default resolution still runs.
547
+ if (Number.isInteger(color.theme) &&
548
+ color.theme >= 0 &&
549
+ color.theme < THEME_PREVIEW_PALETTE.length) {
550
+ return THEME_PREVIEW_PALETTE[color.theme];
551
+ }
552
+ }
553
+ if (typeof color.schemeName === "string") {
554
+ // `schemeName` carries a DrawingML scheme token that couldn't be
555
+ // mapped onto a theme slot. The preview has no concept of
556
+ // placeholder colours (e.g. `phClr`), so fall back to `undefined`
557
+ // — caller coalesces to a default. Returning `undefined` here is
558
+ // preferable to guessing a theme colour that may not match the
559
+ // author's intent on a real `<a:clrScheme>` resolver.
560
+ return undefined;
561
+ }
562
+ if (typeof color.sysClr === "string") {
563
+ if (color.sysClr === "windowText") {
564
+ return "#000000";
565
+ }
566
+ if (color.sysClr === "window") {
567
+ return "#FFFFFF";
568
+ }
569
+ return undefined;
570
+ }
571
+ if (typeof color.prstClr === "string") {
572
+ const hex = PRESET_COLOR_HEX_TABLE[color.prstClr];
573
+ return hex ? `#${hex}` : undefined;
574
+ }
575
+ return undefined;
576
+ }
577
+ /**
578
+ * Resolve a {@link ChartFill} into a preview-grade hex colour. Recognises
579
+ * the four `<a:solidFill>` children Excel writes (`srgbClr`, `schemeClr`,
580
+ * `sysClr`, `prstClr`) via the shared {@link resolveChartColor} resolver
581
+ * and the {@link THEME_PREVIEW_PALETTE} / {@link PRESET_COLOR_HEX_TABLE}
582
+ * lookup tables for the theme / preset variants.
583
+ *
584
+ * When the fill cannot be resolved (no fill set, empty `solidFill`,
585
+ * unknown preset / system colour), returns `fallback`. Callers that
586
+ * want `undefined` for misses should pass `undefined` as the fallback;
587
+ * callers that want a palette rotation entry should resolve the
588
+ * fallback themselves and pass it in. This unifies what used to be
589
+ * two almost-identical helpers (`colorFromShapeFill` in
590
+ * chart-renderer.ts and `shapeFillColor` in chart-ex-renderer.ts).
591
+ */
592
+ export function previewShapeFillColor(fill, fallback) {
593
+ return resolveChartColor(fill?.solid) ?? fallback;
594
+ }
595
+ /**
596
+ * Resolve a {@link ShapeProperties.ln} stroke colour to a preview-grade
597
+ * hex string. Honours every DrawingML colour variant on the line's own
598
+ * `<a:solidFill>` via {@link resolveChartColor} — previously only
599
+ * `srgbClr` was read, which silently reverted every theme / preset /
600
+ * sysClr line colour (gridlines, axes, trendlines, error bars) to the
601
+ * renderer's default grey on load.
602
+ */
603
+ export function previewShapeLineColor(line) {
604
+ return resolveChartColor(line?.color);
605
+ }
606
+ /**
607
+ * Resolve a {@link ShapeProperties.ln} stroke width (OOXML EMU) to a
608
+ * preview pixel width. OOXML stores line widths in EMU (1 pt = 12 700
609
+ * EMU); the preview clamps to a minimum of 0.5 px so a tiny authored
610
+ * width still renders as a visible stroke.
611
+ */
612
+ export function previewShapeLineWidthPx(line) {
613
+ return typeof line?.width === "number" ? Math.max(0.5, line.width / 12700) : undefined;
614
+ }
615
+ // ============================================================================
616
+ // Preset colours (DrawingML `ST_PresetColorVal`)
617
+ // ============================================================================
618
+ /**
619
+ * DrawingML preset colour table (`ST_PresetColorVal` from the OOXML
620
+ * schema). ~140 named colours — superset of HTML's X11 palette. The
621
+ * renderers resolve `<a:prstClr val="…"/>` through this table so
622
+ * template-built workbooks with preset colour references (`darkRed`,
623
+ * `navy`, `forestGreen`, …) render with the correct hex instead of
624
+ * rotating through the default series palette.
625
+ *
626
+ * Previously this lived on `chart-renderer.ts` and was imported by
627
+ * `chart-ex-renderer.ts`. Moved here so it sits below both renderers
628
+ * in the import graph.
629
+ */
630
+ export const PRESET_COLOR_HEX_TABLE = Object.freeze({
631
+ aliceBlue: "F0F8FF",
632
+ antiqueWhite: "FAEBD7",
633
+ aqua: "00FFFF",
634
+ aquamarine: "7FFFD4",
635
+ azure: "F0FFFF",
636
+ beige: "F5F5DC",
637
+ bisque: "FFE4C4",
638
+ black: "000000",
639
+ blanchedAlmond: "FFEBCD",
640
+ blue: "0000FF",
641
+ blueViolet: "8A2BE2",
642
+ brown: "A52A2A",
643
+ burlyWood: "DEB887",
644
+ cadetBlue: "5F9EA0",
645
+ chartreuse: "7FFF00",
646
+ chocolate: "D2691E",
647
+ coral: "FF7F50",
648
+ cornflowerBlue: "6495ED",
649
+ cornsilk: "FFF8DC",
650
+ crimson: "DC143C",
651
+ cyan: "00FFFF",
652
+ darkBlue: "00008B",
653
+ darkCyan: "008B8B",
654
+ darkGoldenrod: "B8860B",
655
+ darkGray: "A9A9A9",
656
+ darkGreen: "006400",
657
+ darkGrey: "A9A9A9",
658
+ darkKhaki: "BDB76B",
659
+ darkMagenta: "8B008B",
660
+ darkOliveGreen: "556B2F",
661
+ darkOrange: "FF8C00",
662
+ darkOrchid: "9932CC",
663
+ darkRed: "8B0000",
664
+ darkSalmon: "E9967A",
665
+ darkSeaGreen: "8FBC8F",
666
+ darkSlateBlue: "483D8B",
667
+ darkSlateGray: "2F4F4F",
668
+ darkSlateGrey: "2F4F4F",
669
+ darkTurquoise: "00CED1",
670
+ darkViolet: "9400D3",
671
+ deepPink: "FF1493",
672
+ deepSkyBlue: "00BFFF",
673
+ dimGray: "696969",
674
+ dimGrey: "696969",
675
+ dkBlue: "00008B",
676
+ dkCyan: "008B8B",
677
+ dkGoldenrod: "B8860B",
678
+ dkGray: "A9A9A9",
679
+ dkGreen: "006400",
680
+ dkGrey: "A9A9A9",
681
+ dkKhaki: "BDB76B",
682
+ dkMagenta: "8B008B",
683
+ dkOliveGreen: "556B2F",
684
+ dkOrange: "FF8C00",
685
+ dkOrchid: "9932CC",
686
+ dkRed: "8B0000",
687
+ dkSalmon: "E9967A",
688
+ dkSeaGreen: "8FBC8F",
689
+ dkSlateBlue: "483D8B",
690
+ dkSlateGray: "2F4F4F",
691
+ dkSlateGrey: "2F4F4F",
692
+ dkTurquoise: "00CED1",
693
+ dkViolet: "9400D3",
694
+ dodgerBlue: "1E90FF",
695
+ firebrick: "B22222",
696
+ floralWhite: "FFFAF0",
697
+ forestGreen: "228B22",
698
+ fuchsia: "FF00FF",
699
+ gainsboro: "DCDCDC",
700
+ ghostWhite: "F8F8FF",
701
+ gold: "FFD700",
702
+ goldenrod: "DAA520",
703
+ gray: "808080",
704
+ green: "008000",
705
+ greenYellow: "ADFF2F",
706
+ grey: "808080",
707
+ honeydew: "F0FFF0",
708
+ hotPink: "FF69B4",
709
+ indianRed: "CD5C5C",
710
+ indigo: "4B0082",
711
+ ivory: "FFFFF0",
712
+ khaki: "F0E68C",
713
+ lavender: "E6E6FA",
714
+ lavenderBlush: "FFF0F5",
715
+ lawnGreen: "7CFC00",
716
+ lemonChiffon: "FFFACD",
717
+ lightBlue: "ADD8E6",
718
+ lightCoral: "F08080",
719
+ lightCyan: "E0FFFF",
720
+ lightGoldenrodYellow: "FAFAD2",
721
+ lightGray: "D3D3D3",
722
+ lightGreen: "90EE90",
723
+ lightGrey: "D3D3D3",
724
+ lightPink: "FFB6C1",
725
+ lightSalmon: "FFA07A",
726
+ lightSeaGreen: "20B2AA",
727
+ lightSkyBlue: "87CEFA",
728
+ lightSlateGray: "778899",
729
+ lightSlateGrey: "778899",
730
+ lightSteelBlue: "B0C4DE",
731
+ lightYellow: "FFFFE0",
732
+ ltBlue: "ADD8E6",
733
+ ltCoral: "F08080",
734
+ ltCyan: "E0FFFF",
735
+ ltGoldenrodYellow: "FAFAD2",
736
+ ltGray: "D3D3D3",
737
+ ltGreen: "90EE90",
738
+ ltGrey: "D3D3D3",
739
+ ltPink: "FFB6C1",
740
+ ltSalmon: "FFA07A",
741
+ ltSeaGreen: "20B2AA",
742
+ ltSkyBlue: "87CEFA",
743
+ ltSlateGray: "778899",
744
+ ltSlateGrey: "778899",
745
+ ltSteelBlue: "B0C4DE",
746
+ ltYellow: "FFFFE0",
747
+ lime: "00FF00",
748
+ limeGreen: "32CD32",
749
+ linen: "FAF0E6",
750
+ magenta: "FF00FF",
751
+ maroon: "800000",
752
+ medAquamarine: "66CDAA",
753
+ medBlue: "0000CD",
754
+ medOrchid: "BA55D3",
755
+ medPurple: "9370DB",
756
+ medSeaGreen: "3CB371",
757
+ medSlateBlue: "7B68EE",
758
+ medSpringGreen: "00FA9A",
759
+ medTurquoise: "48D1CC",
760
+ medVioletRed: "C71585",
761
+ mediumAquamarine: "66CDAA",
762
+ mediumBlue: "0000CD",
763
+ mediumOrchid: "BA55D3",
764
+ mediumPurple: "9370DB",
765
+ mediumSeaGreen: "3CB371",
766
+ mediumSlateBlue: "7B68EE",
767
+ mediumSpringGreen: "00FA9A",
768
+ mediumTurquoise: "48D1CC",
769
+ mediumVioletRed: "C71585",
770
+ midnightBlue: "191970",
771
+ mintCream: "F5FFFA",
772
+ mistyRose: "FFE4E1",
773
+ moccasin: "FFE4B5",
774
+ navajoWhite: "FFDEAD",
775
+ navy: "000080",
776
+ oldLace: "FDF5E6",
777
+ olive: "808000",
778
+ oliveDrab: "6B8E23",
779
+ orange: "FFA500",
780
+ orangeRed: "FF4500",
781
+ orchid: "DA70D6",
782
+ paleGoldenrod: "EEE8AA",
783
+ paleGreen: "98FB98",
784
+ paleTurquoise: "AFEEEE",
785
+ paleVioletRed: "DB7093",
786
+ papayaWhip: "FFEFD5",
787
+ peachPuff: "FFDAB9",
788
+ peru: "CD853F",
789
+ pink: "FFC0CB",
790
+ plum: "DDA0DD",
791
+ powderBlue: "B0E0E6",
792
+ purple: "800080",
793
+ red: "FF0000",
794
+ rosyBrown: "BC8F8F",
795
+ royalBlue: "4169E1",
796
+ saddleBrown: "8B4513",
797
+ salmon: "FA8072",
798
+ sandyBrown: "F4A460",
799
+ seaGreen: "2E8B57",
800
+ seaShell: "FFF5EE",
801
+ sienna: "A0522D",
802
+ silver: "C0C0C0",
803
+ skyBlue: "87CEEB",
804
+ slateBlue: "6A5ACD",
805
+ slateGray: "708090",
806
+ slateGrey: "708090",
807
+ snow: "FFFAFA",
808
+ springGreen: "00FF7F",
809
+ steelBlue: "4682B4",
810
+ tan: "D2B48C",
811
+ teal: "008080",
812
+ thistle: "D8BFD8",
813
+ tomato: "FF6347",
814
+ turquoise: "40E0D0",
815
+ violet: "EE82EE",
816
+ wheat: "F5DEB3",
817
+ white: "FFFFFF",
818
+ whiteSmoke: "F5F5F5",
819
+ yellow: "FFFF00",
820
+ yellowGreen: "9ACD32"
821
+ });