reamkit 1.15.0 → 1.15.2

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 (316) hide show
  1. package/dist/esm/core/arc-to-bezier.d.ts +23 -0
  2. package/dist/esm/core/arc-to-bezier.js +23 -0
  3. package/dist/esm/core/bidi/algorithm.d.ts +26 -0
  4. package/dist/esm/core/bidi/algorithm.js +21 -0
  5. package/dist/esm/core/bidi/char-types.d.ts +17 -0
  6. package/dist/esm/core/bidi/char-types.js +10 -0
  7. package/dist/esm/core/bidi/index.d.ts +42 -0
  8. package/dist/esm/core/bidi/index.js +27 -0
  9. package/dist/esm/core/bidi/segments.d.ts +22 -0
  10. package/dist/esm/core/bidi/segments.js +14 -0
  11. package/dist/esm/core/bytes.d.ts +9 -0
  12. package/dist/esm/core/bytes.js +9 -0
  13. package/dist/esm/core/converter/facade.d.ts +38 -1
  14. package/dist/esm/core/converter/facade.js +25 -0
  15. package/dist/esm/core/converter/project.d.ts +12 -0
  16. package/dist/esm/core/converter/project.js +11 -0
  17. package/dist/esm/core/converter/ream.d.ts +107 -0
  18. package/dist/esm/core/converter/ream.js +76 -0
  19. package/dist/esm/core/crypto/asn1.d.ts +77 -0
  20. package/dist/esm/core/crypto/asn1.js +65 -0
  21. package/dist/esm/core/crypto/cms.d.ts +25 -0
  22. package/dist/esm/core/crypto/cms.js +8 -0
  23. package/dist/esm/core/document-model/index.d.ts +7 -0
  24. package/dist/esm/core/document-model/types.d.ts +328 -0
  25. package/dist/esm/core/drawingml/chart-geometry.d.ts +125 -0
  26. package/dist/esm/core/drawingml/chart-geometry.js +96 -0
  27. package/dist/esm/core/drawingml/chart-parser.d.ts +34 -0
  28. package/dist/esm/core/drawingml/chart-parser.js +34 -0
  29. package/dist/esm/core/drawingml/chart-serializer.d.ts +12 -0
  30. package/dist/esm/core/drawingml/chart-serializer.js +12 -0
  31. package/dist/esm/core/drawingml/colors.d.ts +53 -0
  32. package/dist/esm/core/drawingml/colors.js +41 -0
  33. package/dist/esm/core/drawingml/preset-geometry.d.ts +30 -0
  34. package/dist/esm/core/drawingml/preset-geometry.js +30 -0
  35. package/dist/esm/core/drawingml/shape-render.d.ts +54 -0
  36. package/dist/esm/core/drawingml/shape-render.js +54 -0
  37. package/dist/esm/core/drawingml/sparkline-geometry.d.ts +15 -0
  38. package/dist/esm/core/drawingml/sparkline-geometry.js +13 -0
  39. package/dist/esm/core/drawingml/theme-parser.d.ts +11 -0
  40. package/dist/esm/core/drawingml/theme-parser.js +11 -0
  41. package/dist/esm/core/font/arabic-joining.d.ts +21 -0
  42. package/dist/esm/core/font/arabic-joining.js +16 -0
  43. package/dist/esm/core/font/binary-reader.d.ts +17 -0
  44. package/dist/esm/core/font/binary-reader.js +17 -0
  45. package/dist/esm/core/font/font-registry.d.ts +37 -0
  46. package/dist/esm/core/font/font-registry.js +31 -0
  47. package/dist/esm/core/font/measure.d.ts +20 -0
  48. package/dist/esm/core/font/measure.js +11 -0
  49. package/dist/esm/core/font/opentype-layout.d.ts +49 -0
  50. package/dist/esm/core/font/opentype-layout.js +37 -0
  51. package/dist/esm/core/font/ttf-parser.d.ts +32 -0
  52. package/dist/esm/core/font/ttf-parser.js +7 -0
  53. package/dist/esm/core/font/ttf-subset.d.ts +21 -0
  54. package/dist/esm/core/font/ttf-subset.js +21 -0
  55. package/dist/esm/core/fonts/provider.d.ts +8 -1
  56. package/dist/esm/core/fonts/provider.js +1 -0
  57. package/dist/esm/core/fonts/remote-fonts.d.ts +22 -0
  58. package/dist/esm/core/fonts/remote-fonts.js +16 -0
  59. package/dist/esm/core/hyphenation/index.d.ts +25 -0
  60. package/dist/esm/core/hyphenation/index.js +17 -0
  61. package/dist/esm/core/hyphenation/liang.d.ts +27 -0
  62. package/dist/esm/core/hyphenation/liang.js +14 -0
  63. package/dist/esm/core/images.d.ts +32 -0
  64. package/dist/esm/core/images.js +12 -0
  65. package/dist/esm/core/ir/adapters.d.ts +23 -0
  66. package/dist/esm/core/ir/features.d.ts +8 -0
  67. package/dist/esm/core/ir/features.js +1 -0
  68. package/dist/esm/core/ir/flow.d.ts +20 -0
  69. package/dist/esm/core/ir/index.d.ts +7 -0
  70. package/dist/esm/core/ir/loss.d.ts +12 -0
  71. package/dist/esm/core/ir/loss.js +8 -0
  72. package/dist/esm/core/ir/resources.d.ts +12 -0
  73. package/dist/esm/core/ir/resources.js +11 -0
  74. package/dist/esm/core/ir/sheet.d.ts +81 -0
  75. package/dist/esm/core/ir/units.d.ts +9 -0
  76. package/dist/esm/core/ir/units.js +2 -0
  77. package/dist/esm/core/line-breaker/cjk.d.ts +26 -0
  78. package/dist/esm/core/line-breaker/cjk.js +60 -0
  79. package/dist/esm/core/line-breaker/greedy.d.ts +14 -0
  80. package/dist/esm/core/line-breaker/greedy.js +14 -0
  81. package/dist/esm/core/line-breaker/index.d.ts +1 -0
  82. package/dist/esm/core/line-breaker/index.js +3 -0
  83. package/dist/esm/core/line-breaker/knuth-plass.d.ts +29 -5
  84. package/dist/esm/core/line-breaker/knuth-plass.js +10 -5
  85. package/dist/esm/core/numbering/apply.d.ts +19 -0
  86. package/dist/esm/core/numbering/apply.js +19 -0
  87. package/dist/esm/core/numbering/state.d.ts +15 -0
  88. package/dist/esm/core/numbering/state.js +15 -0
  89. package/dist/esm/core/ole/cfb.d.ts +19 -0
  90. package/dist/esm/core/ole/cfb.js +50 -4
  91. package/dist/esm/core/opc/core-properties.d.ts +12 -0
  92. package/dist/esm/core/opc/core-properties.js +5 -0
  93. package/dist/esm/core/opc/opc-writer.d.ts +24 -4
  94. package/dist/esm/core/opc/opc-writer.js +12 -0
  95. package/dist/esm/core/opc/package.d.ts +55 -0
  96. package/dist/esm/core/opc/package.js +46 -0
  97. package/dist/esm/core/opc/relationship-types.d.ts +8 -0
  98. package/dist/esm/core/opc/relationship-types.js +5 -0
  99. package/dist/esm/core/opc/relationships.d.ts +12 -0
  100. package/dist/esm/core/opc/relationships.js +7 -0
  101. package/dist/esm/core/po-helpers.d.ts +38 -0
  102. package/dist/esm/core/po-helpers.js +33 -0
  103. package/dist/esm/core/spreadsheet-model/types.d.ts +281 -0
  104. package/dist/esm/core/style-cascade/resolver.d.ts +31 -0
  105. package/dist/esm/core/style-cascade/resolver.js +31 -0
  106. package/dist/esm/core/style-cascade/table.d.ts +7 -0
  107. package/dist/esm/core/style-cascade/table.js +7 -0
  108. package/dist/esm/core/style-cascade/types.d.ts +27 -0
  109. package/dist/esm/core/style-cascade/types.js +2 -0
  110. package/dist/esm/core/vector.d.ts +67 -0
  111. package/dist/esm/core/vector.js +23 -0
  112. package/dist/esm/excel/activex-parser.d.ts +31 -0
  113. package/dist/esm/excel/activex-parser.js +24 -0
  114. package/dist/esm/excel/cell-reference.d.ts +14 -0
  115. package/dist/esm/excel/cell-reference.js +9 -0
  116. package/dist/esm/excel/column-bands.d.ts +29 -0
  117. package/dist/esm/excel/column-bands.js +26 -0
  118. package/dist/esm/excel/comments-parser.d.ts +19 -0
  119. package/dist/esm/excel/comments-parser.js +19 -0
  120. package/dist/esm/excel/conditional-format.d.ts +38 -0
  121. package/dist/esm/excel/conditional-format.js +25 -0
  122. package/dist/esm/excel/defined-name-ref.d.ts +21 -0
  123. package/dist/esm/excel/defined-name-ref.js +20 -0
  124. package/dist/esm/excel/form-control-parser.d.ts +13 -0
  125. package/dist/esm/excel/form-control-parser.js +5 -0
  126. package/dist/esm/excel/formula/context.d.ts +37 -0
  127. package/dist/esm/excel/formula/dates.d.ts +23 -0
  128. package/dist/esm/excel/formula/dates.js +20 -0
  129. package/dist/esm/excel/formula/eval.d.ts +21 -0
  130. package/dist/esm/excel/formula/eval.js +11 -0
  131. package/dist/esm/excel/formula/functions.d.ts +12 -0
  132. package/dist/esm/excel/formula/functions.js +12 -0
  133. package/dist/esm/excel/formula/index.d.ts +21 -0
  134. package/dist/esm/excel/formula/index.js +16 -0
  135. package/dist/esm/excel/formula/lexer.d.ts +12 -0
  136. package/dist/esm/excel/formula/lexer.js +10 -0
  137. package/dist/esm/excel/formula/parser.d.ts +20 -0
  138. package/dist/esm/excel/formula/parser.js +53 -0
  139. package/dist/esm/excel/formula/value.d.ts +53 -0
  140. package/dist/esm/excel/formula/value.js +30 -0
  141. package/dist/esm/excel/header-footer.d.ts +9 -0
  142. package/dist/esm/excel/header-footer.js +9 -0
  143. package/dist/esm/excel/number-format.d.ts +34 -0
  144. package/dist/esm/excel/number-format.js +34 -0
  145. package/dist/esm/excel/pivot-table-parser.d.ts +8 -0
  146. package/dist/esm/excel/pivot-table-parser.js +8 -0
  147. package/dist/esm/excel/print-model.d.ts +56 -0
  148. package/dist/esm/excel/print-model.js +43 -0
  149. package/dist/esm/excel/shared-strings-parser.d.ts +13 -0
  150. package/dist/esm/excel/shared-strings-parser.js +5 -0
  151. package/dist/esm/excel/sheet-drawing.d.ts +34 -0
  152. package/dist/esm/excel/sheet-drawing.js +21 -0
  153. package/dist/esm/excel/sheet-shape-parser.d.ts +12 -0
  154. package/dist/esm/excel/sheet-shape-parser.js +12 -0
  155. package/dist/esm/excel/sheet-to-flow.d.ts +19 -0
  156. package/dist/esm/excel/sheet-to-flow.js +10 -0
  157. package/dist/esm/excel/slicer-parser.d.ts +23 -0
  158. package/dist/esm/excel/slicer-parser.js +10 -0
  159. package/dist/esm/excel/styles-parser.d.ts +8 -0
  160. package/dist/esm/excel/styles-parser.js +8 -0
  161. package/dist/esm/excel/table-parser.d.ts +24 -0
  162. package/dist/esm/excel/table-parser.js +5 -0
  163. package/dist/esm/excel/workbook-parser.d.ts +17 -0
  164. package/dist/esm/excel/workbook-parser.js +5 -0
  165. package/dist/esm/excel/worksheet-parser.d.ts +9 -0
  166. package/dist/esm/excel/worksheet-parser.js +9 -0
  167. package/dist/esm/excel/xls/biff-chart.d.ts +10 -0
  168. package/dist/esm/excel/xls/biff-chart.js +10 -0
  169. package/dist/esm/excel/xls/biff-reader.d.ts +27 -0
  170. package/dist/esm/excel/xls/biff-reader.js +44 -0
  171. package/dist/esm/excel/xls/biff-styles.d.ts +20 -0
  172. package/dist/esm/excel/xls/biff-styles.js +20 -0
  173. package/dist/esm/excel/xls/escher.d.ts +27 -0
  174. package/dist/esm/excel/xls/escher.js +18 -0
  175. package/dist/esm/excel/xls/xls-reader.d.ts +6 -0
  176. package/dist/esm/excel/xls/xls-reader.js +6 -0
  177. package/dist/esm/excel/xlsx-reader.d.ts +26 -0
  178. package/dist/esm/excel/xlsx-reader.js +26 -0
  179. package/dist/esm/excel/xlsx-to-pdf.d.ts +27 -0
  180. package/dist/esm/excel/xlsx-writer.d.ts +14 -0
  181. package/dist/esm/excel/xlsx-writer.js +13 -0
  182. package/dist/esm/html/html-writer.d.ts +18 -0
  183. package/dist/esm/html/html-writer.js +18 -0
  184. package/dist/esm/index.d.ts +23 -0
  185. package/dist/esm/layout/math-layout.d.ts +39 -0
  186. package/dist/esm/layout/math-layout.js +18 -0
  187. package/dist/esm/layout/page-doc.d.ts +91 -0
  188. package/dist/esm/layout/styled-layout.d.ts +175 -0
  189. package/dist/esm/layout/styled-layout.js +117 -2
  190. package/dist/esm/pdf/builtin-fonts.d.ts +5 -0
  191. package/dist/esm/pdf/cid-font.d.ts +22 -0
  192. package/dist/esm/pdf/cid-font.js +10 -0
  193. package/dist/esm/pdf/embedded-file.d.ts +16 -0
  194. package/dist/esm/pdf/embedded-file.js +9 -0
  195. package/dist/esm/pdf/encryption.d.ts +59 -0
  196. package/dist/esm/pdf/encryption.js +37 -0
  197. package/dist/esm/pdf/icc-profile.d.ts +8 -0
  198. package/dist/esm/pdf/icc-profile.js +8 -0
  199. package/dist/esm/pdf/image-xobject.d.ts +19 -0
  200. package/dist/esm/pdf/image-xobject.js +9 -0
  201. package/dist/esm/pdf/objects.d.ts +40 -0
  202. package/dist/esm/pdf/objects.js +36 -0
  203. package/dist/esm/pdf/serialize.d.ts +18 -0
  204. package/dist/esm/pdf/serialize.js +18 -0
  205. package/dist/esm/pdf/shading.d.ts +16 -0
  206. package/dist/esm/pdf/shading.js +16 -0
  207. package/dist/esm/pdf/signature.d.ts +36 -0
  208. package/dist/esm/pdf/signature.js +22 -0
  209. package/dist/esm/pdf/struct-tree.d.ts +64 -0
  210. package/dist/esm/pdf/struct-tree.js +60 -0
  211. package/dist/esm/pdf/styled-page-emitter.d.ts +33 -0
  212. package/dist/esm/pdf/styled-page-emitter.js +21 -0
  213. package/dist/esm/pdf/styled-page-renderer.d.ts +18 -0
  214. package/dist/esm/pdf/styled-page-renderer.js +18 -0
  215. package/dist/esm/pdf/text-encoding.d.ts +16 -0
  216. package/dist/esm/pdf/text-page-renderer.d.ts +11 -0
  217. package/dist/esm/pdf/vector-graphics.d.ts +12 -0
  218. package/dist/esm/pdf/vector-graphics.js +12 -0
  219. package/dist/esm/pdf/writer.d.ts +39 -0
  220. package/dist/esm/pdf/writer.js +27 -0
  221. package/dist/esm/pdf/xmp.d.ts +16 -0
  222. package/dist/esm/pdf/xmp.js +9 -0
  223. package/dist/esm/pdf-reader/ccitt.d.ts +25 -0
  224. package/dist/esm/pdf-reader/ccitt.js +15 -0
  225. package/dist/esm/pdf-reader/cmap.d.ts +12 -0
  226. package/dist/esm/pdf-reader/cmap.js +9 -0
  227. package/dist/esm/pdf-reader/content.d.ts +69 -0
  228. package/dist/esm/pdf-reader/content.js +16 -0
  229. package/dist/esm/pdf-reader/crypto.d.ts +5 -0
  230. package/dist/esm/pdf-reader/crypto.js +5 -0
  231. package/dist/esm/pdf-reader/decrypt.d.ts +17 -0
  232. package/dist/esm/pdf-reader/decrypt.js +12 -0
  233. package/dist/esm/pdf-reader/document.d.ts +53 -0
  234. package/dist/esm/pdf-reader/document.js +50 -0
  235. package/dist/esm/pdf-reader/flow-build.d.ts +51 -2
  236. package/dist/esm/pdf-reader/flow-build.js +67 -2
  237. package/dist/esm/pdf-reader/font.d.ts +12 -0
  238. package/dist/esm/pdf-reader/font.js +12 -0
  239. package/dist/esm/pdf-reader/image-decode.d.ts +21 -0
  240. package/dist/esm/pdf-reader/image-decode.js +14 -0
  241. package/dist/esm/pdf-reader/images.d.ts +19 -0
  242. package/dist/esm/pdf-reader/images.js +9 -0
  243. package/dist/esm/pdf-reader/layout.d.ts +15 -0
  244. package/dist/esm/pdf-reader/layout.js +17 -2
  245. package/dist/esm/pdf-reader/lexer.d.ts +43 -0
  246. package/dist/esm/pdf-reader/lexer.js +38 -0
  247. package/dist/esm/pdf-reader/parser.d.ts +15 -0
  248. package/dist/esm/pdf-reader/parser.js +8 -0
  249. package/dist/esm/pdf-reader/png-encode.d.ts +9 -0
  250. package/dist/esm/pdf-reader/png-encode.js +8 -0
  251. package/dist/esm/pdf-reader/predictor.d.ts +9 -0
  252. package/dist/esm/pdf-reader/predictor.js +8 -0
  253. package/dist/esm/pdf-reader/reader.d.ts +16 -0
  254. package/dist/esm/pdf-reader/reader.js +16 -0
  255. package/dist/esm/pdf-reader/shading.d.ts +10 -0
  256. package/dist/esm/pdf-reader/shading.js +10 -0
  257. package/dist/esm/pdf-reader/struct-tree.d.ts +24 -0
  258. package/dist/esm/pdf-reader/struct-tree.js +12 -0
  259. package/dist/esm/pdf-reader/tagged.d.ts +13 -0
  260. package/dist/esm/pdf-reader/tagged.js +15 -2
  261. package/dist/esm/pdf-reader/text.d.ts +11 -0
  262. package/dist/esm/pdf-reader/text.js +11 -0
  263. package/dist/esm/pdf-reader/vector.d.ts +19 -0
  264. package/dist/esm/pdf-reader/vector.js +9 -0
  265. package/dist/esm/pptx/placeholder-cascade.d.ts +21 -0
  266. package/dist/esm/pptx/placeholder-cascade.js +10 -0
  267. package/dist/esm/pptx/ppt/ppt-reader.d.ts +16 -0
  268. package/dist/esm/pptx/ppt/ppt-reader.js +16 -0
  269. package/dist/esm/pptx/ppt/ppt-text.d.ts +55 -0
  270. package/dist/esm/pptx/ppt/ppt-text.js +14 -0
  271. package/dist/esm/pptx/pptx-reader.d.ts +21 -0
  272. package/dist/esm/pptx/pptx-reader.js +37 -1
  273. package/dist/esm/pptx/slide-parser.d.ts +102 -0
  274. package/dist/esm/pptx/slide-parser.js +78 -0
  275. package/dist/esm/pptx/sp-helpers.d.ts +28 -0
  276. package/dist/esm/pptx/sp-helpers.js +22 -0
  277. package/dist/esm/svg/svg-writer.d.ts +17 -0
  278. package/dist/esm/svg/svg-writer.js +16 -0
  279. package/dist/esm/word/doc/doc-reader.d.ts +16 -0
  280. package/dist/esm/word/doc/doc-reader.js +26 -4
  281. package/dist/esm/word/doc/doc-text.d.ts +81 -0
  282. package/dist/esm/word/doc/doc-text.js +38 -0
  283. package/dist/esm/word/document-parser.d.ts +134 -0
  284. package/dist/esm/word/document-parser.js +86 -0
  285. package/dist/esm/word/docx-reader.d.ts +16 -0
  286. package/dist/esm/word/docx-reader.js +16 -0
  287. package/dist/esm/word/docx-to-pdf.d.ts +52 -0
  288. package/dist/esm/word/docx-to-pdf.js +21 -0
  289. package/dist/esm/word/docx-writer.d.ts +17 -0
  290. package/dist/esm/word/docx-writer.js +17 -0
  291. package/dist/esm/word/drawing-parser.d.ts +88 -0
  292. package/dist/esm/word/drawing-parser.js +68 -0
  293. package/dist/esm/word/font-table.d.ts +24 -0
  294. package/dist/esm/word/font-table.js +24 -0
  295. package/dist/esm/word/numbering-parser.d.ts +11 -0
  296. package/dist/esm/word/numbering-parser.js +11 -0
  297. package/dist/esm/word/omml-parser.d.ts +15 -0
  298. package/dist/esm/word/omml-parser.js +15 -0
  299. package/dist/esm/word/omml-serializer.d.ts +9 -0
  300. package/dist/esm/word/omml-serializer.js +9 -0
  301. package/dist/esm/word/paragraph-properties.d.ts +10 -0
  302. package/dist/esm/word/paragraph-properties.js +10 -0
  303. package/dist/esm/word/po-to-flat.d.ts +11 -0
  304. package/dist/esm/word/po-to-flat.js +11 -0
  305. package/dist/esm/word/run-properties.d.ts +10 -0
  306. package/dist/esm/word/run-properties.js +10 -0
  307. package/dist/esm/word/settings-parser.d.ts +13 -0
  308. package/dist/esm/word/settings-parser.js +8 -0
  309. package/dist/esm/word/styles-parser.d.ts +10 -0
  310. package/dist/esm/word/styles-parser.js +10 -0
  311. package/dist/esm/word/table-parser.d.ts +11 -0
  312. package/dist/esm/word/table-parser.js +11 -0
  313. package/dist/esm/word/text-extractor.d.ts +9 -0
  314. package/dist/esm/word/xml-helpers.d.ts +44 -0
  315. package/dist/esm/word/xml-helpers.js +38 -0
  316. package/package.json +1 -1
@@ -1,25 +1,35 @@
1
1
  //#region src/core/po-helpers.ts
2
2
  var ATTRS_KEY = ":@";
3
3
  var TEXT_KEY = "#text";
4
+ /** The element's tag name (the one key that is neither `:@` nor `#text`), or undefined. */
4
5
  function poTag(node) {
5
6
  if (!node || typeof node !== "object") return void 0;
6
7
  for (const key of Object.keys(node)) if (key !== ATTRS_KEY && key !== TEXT_KEY) return key;
7
8
  }
9
+ /** Whether the node's tag equals `tag` exactly (prefix-sensitive). */
8
10
  function poIs(node, tag) {
9
11
  return poTag(node) === tag;
10
12
  }
13
+ /** The node's child elements (the value under its tag key), or `[]`. */
11
14
  function poChildren(node) {
12
15
  const tag = poTag(node);
13
16
  if (!tag || !node) return [];
14
17
  const arr = node[tag];
15
18
  return Array.isArray(arr) ? arr : [];
16
19
  }
20
+ /** The node's direct children with tag `tag`. */
17
21
  function poChildrenWith(node, tag) {
18
22
  return poChildren(node).filter((c) => poIs(c, tag));
19
23
  }
24
+ /** The node's first direct child with tag `tag`, or undefined. */
20
25
  function poFirstChild(node, tag) {
21
26
  return poChildren(node).find((c) => poIs(c, tag));
22
27
  }
28
+ /**
29
+ * An attribute value by local `name`, trying the common OOXML namespace prefixes
30
+ * (`w:`/`r:`/`m:`/`xml:`, then bare) in priority order. Returns undefined when
31
+ * absent or non-string.
32
+ */
23
33
  function poAttr(node, name) {
24
34
  if (!node || typeof node !== "object") return void 0;
25
35
  const attrs = node[ATTRS_KEY];
@@ -28,6 +38,11 @@ function poAttr(node, name) {
28
38
  const v = a[`@_w:${name}`] ?? a[`@_r:${name}`] ?? a[`@_m:${name}`] ?? a[`@_xml:${name}`] ?? a[`@_${name}`];
29
39
  return typeof v === "string" ? v : void 0;
30
40
  }
41
+ /**
42
+ * Like `poAttr` but matches by LOCAL name regardless of the prefix — for vendor
43
+ * extensions whose namespace `poAttr` does not special-case (e.g. `w14:paraId`,
44
+ * `w15:done`, `w15:paraIdParent`).
45
+ */
31
46
  function poAttrLocal(node, name) {
32
47
  if (!node || typeof node !== "object") return void 0;
33
48
  const attrs = node[ATTRS_KEY];
@@ -37,25 +52,37 @@ function poAttrLocal(node, name) {
37
52
  if (k.slice(2).split(":").pop() === name && typeof v === "string") return v;
38
53
  }
39
54
  }
55
+ /**
56
+ * Like `poIs` but matches a tag by LOCAL name, so an element authored under any
57
+ * prefix (`w15:commentsEx`, `mc:commentsEx`, …) still resolves.
58
+ */
40
59
  function poIsLocal(node, name) {
41
60
  const tag = poTag(node);
42
61
  return tag !== void 0 && (tag === name || tag.split(":").pop() === name);
43
62
  }
63
+ /** {@link poAttr} parsed as a finite number, or undefined when absent/non-numeric. */
44
64
  function poIntAttr(node, name) {
45
65
  const v = poAttr(node, name);
46
66
  if (v === void 0) return void 0;
47
67
  const n = Number(v);
48
68
  return Number.isFinite(n) ? n : void 0;
49
69
  }
70
+ /** Shorthand for the `val` attribute (`@w:val`/…). */
50
71
  function poVal(node) {
51
72
  return poAttr(node, "val");
52
73
  }
74
+ /**
75
+ * Read an OOXML boolean toggle property (§17.17.4): a present element with no
76
+ * `val` (or `val` true/1/on) is `true`; `false`/`0`/`off` is `false`; an absent
77
+ * element (`node` undefined) is undefined ("inherit").
78
+ */
53
79
  function poToggle(node) {
54
80
  if (!node) return void 0;
55
81
  const v = poAttr(node, "val");
56
82
  if (v === void 0) return true;
57
83
  return !(v === "false" || v === "0" || v === "off");
58
84
  }
85
+ /** Concatenate the node's direct `#text` leaf children into a single string. */
59
86
  function poText(node) {
60
87
  if (!node) return "";
61
88
  const children = poChildren(node);
@@ -67,6 +94,11 @@ function poText(node) {
67
94
  }
68
95
  return out;
69
96
  }
97
+ /**
98
+ * Walk a chain of tags from the tree root, descending into the first child that
99
+ * matches each successive `path` segment. Returns the node at the path end, or
100
+ * undefined if any segment is missing.
101
+ */
70
102
  function poFindByPath(tree, path) {
71
103
  let cursor = tree;
72
104
  let current;
@@ -77,6 +109,7 @@ function poFindByPath(tree, path) {
77
109
  }
78
110
  return current;
79
111
  }
112
+ /** Depth-first search for the first descendant with the given `tag`. */
80
113
  function poFindDescendant(node, tag) {
81
114
  if (!node) return void 0;
82
115
  for (const child of poChildren(node)) {
@@ -1,28 +1,41 @@
1
+ /** ECMA-376 §18.3.1.4 — `<c t="...">` cell value type. */
1
2
  export type CellType = 'n' | 's' | 'str' | 'b' | 'd' | 'e' | 'inlineStr';
3
+ /** §18.3.1.4 `<c>` — one parsed cell: its position, type, raw value and style index. */
2
4
  export interface WorksheetCell {
3
5
  readonly column: number;
4
6
  readonly row: number;
5
7
  readonly type: CellType;
8
+ /** Raw stored value; renderer/converter looks up shared strings + formats. */
6
9
  readonly rawValue: string;
10
+ /** For `inlineStr` the stored text lives in `<is><t>` rather than `<v>`. */
7
11
  readonly inlineText?: string;
12
+ /** Index into the workbook's `cellXfs` (`xl/styles.xml`). 0 means default style. */
8
13
  readonly styleIndex?: number;
9
14
  }
15
+ /** §18.3.1.13 `<col>` — a width (in character units) for the column span `min..max`. */
10
16
  export interface ColumnWidth {
11
17
  readonly min: number;
12
18
  readonly max: number;
13
19
  readonly widthChars: number;
14
20
  }
21
+ /** §18.3.1.55 `<mergeCell>` — a merged cell rectangle (0-indexed, inclusive bounds). */
15
22
  export interface MergedRange {
16
23
  readonly startColumn: number;
17
24
  readonly startRow: number;
18
25
  readonly endColumn: number;
19
26
  readonly endRow: number;
20
27
  }
28
+ /**
29
+ * ECMA-376 Part 1 §18.3.1.73 — `<row ht="...">`. The `ht` attribute is measured
30
+ * in points (not twips); `customHeight="1"` means the user pinned the height
31
+ * explicitly. Without `customHeight`, the height is content-driven.
32
+ */
21
33
  export interface RowHeight {
22
34
  readonly row: number;
23
35
  readonly heightPt: number;
24
36
  readonly customHeight: boolean;
25
37
  }
38
+ /** ECMA-376 Part 1 §18.3.1.62 — `<pageMargins>`. All attributes are in inches. */
26
39
  export interface XlsxPageMargins {
27
40
  readonly leftInches: number;
28
41
  readonly rightInches: number;
@@ -31,18 +44,38 @@ export interface XlsxPageMargins {
31
44
  readonly headerInches?: number;
32
45
  readonly footerInches?: number;
33
46
  }
47
+ /**
48
+ * ECMA-376 Part 1 §18.3.1.63 — `<pageSetup>`. `paperSize` is a numeric id from
49
+ * the printer paper size enumeration (1=Letter, 9=A4, ...). `orientation`
50
+ * values: `'default'` (effectively portrait), `'portrait'`, `'landscape'`.
51
+ * `fitToWidth`/`fitToHeight` only take effect when `<pageSetUpPr fitToPage="1">`.
52
+ */
34
53
  export interface XlsxPageSetup {
35
54
  readonly paperSize?: number;
36
55
  readonly orientation?: 'portrait' | 'landscape' | 'default';
56
+ /** Print scaling percentage (10..400); default 100. */
37
57
  readonly scale?: number;
58
+ /** Number of pages wide to fit to (0 ⇒ use `scale`); default 1. */
38
59
  readonly fitToWidth?: number;
60
+ /** Number of pages tall to fit to; default 1. */
39
61
  readonly fitToHeight?: number;
40
62
  }
63
+ /**
64
+ * ECMA-376 Part 1 §18.3.1.70 — `<printOptions>`. Controls what is rendered when
65
+ * the sheet is printed. `gridLines` defaults to false (Excel/Calc do NOT print
66
+ * cell gridlines unless explicitly enabled), so a faithful print model draws
67
+ * only the borders that come from cell styles.
68
+ */
41
69
  export interface XlsxPrintOptions {
42
70
  readonly gridLines?: boolean;
43
71
  readonly horizontalCentered?: boolean;
44
72
  readonly verticalCentered?: boolean;
45
73
  }
74
+ /**
75
+ * §18.3.1.99 `<worksheet>` — one parsed worksheet: the cell grid plus its
76
+ * per-sheet geometry and overlays. The pure-XML parser fills the raw fields; the
77
+ * reader fills the resolved ones (`tables`, `pivotTables`, …).
78
+ */
46
79
  export interface ParsedWorksheet {
47
80
  readonly cells: ReadonlyArray<WorksheetCell>;
48
81
  readonly maxRow: number;
@@ -52,27 +85,85 @@ export interface ParsedWorksheet {
52
85
  readonly rowHeights: ReadonlyArray<RowHeight>;
53
86
  readonly pageMargins?: XlsxPageMargins;
54
87
  readonly pageSetup?: XlsxPageSetup;
88
+ /**
89
+ * ECMA-376 §18.3.1.65 — `<sheetPr><pageSetUpPr fitToPage="1"/>`. When set, the
90
+ * pageSetup `fitToWidth`/`fitToHeight` (not `scale`) drive print scaling.
91
+ */
55
92
  readonly fitToPage?: boolean;
56
93
  readonly printOptions?: XlsxPrintOptions;
94
+ /**
95
+ * ECMA-376 §18.3.1.74/§18.3.1.14 — manual `<rowBreaks>`/`<colBreaks>`. Each
96
+ * stored value is the `<brk id="...">` following the break (kept verbatim).
97
+ */
57
98
  readonly rowBreaks?: ReadonlyArray<number>;
58
99
  readonly colBreaks?: ReadonlyArray<number>;
100
+ /** §18.3.1.36 `<drawing r:id>` — the sheet's drawing part (charts/shapes). */
59
101
  readonly drawingRelId?: string;
102
+ /** §18.3.1.18 `<conditionalFormatting>` — value-driven cell formats (E-SHEET SC1). */
60
103
  readonly conditionalFormats?: ReadonlyArray<ConditionalFormat>;
104
+ /**
105
+ * §18.3.1.32 `<dataValidations>` — per-range input constraints (E-SHEET SV1). A
106
+ * `list` validation paints an in-cell dropdown affordance; all types round-trip.
107
+ */
61
108
  readonly dataValidations?: ReadonlyArray<DataValidation>;
109
+ /**
110
+ * §18.3.1.47 `<hyperlinks>` — raw cell hyperlinks (E-SHEET W3). The reader
111
+ * resolves each `relId` to an external URL; render-only (not written back).
112
+ */
62
113
  readonly hyperlinks?: ReadonlyArray<HyperlinkRef>;
114
+ /**
115
+ * §18.3.1.46 `<headerFooter>` — sheet header/footer format strings (E-SHEET W4).
116
+ * The projection expands the `&`-codes into header/footer bands; render-only.
117
+ */
63
118
  readonly headerFooter?: HeaderFooter;
119
+ /**
120
+ * Form controls declared on the sheet (E-SHEET W8) — raw `{name, relId}`; the
121
+ * reader resolves each `relId` to its ctrlProp (type + state). Render-only.
122
+ */
64
123
  readonly formControls?: ReadonlyArray<FormControlRef>;
124
+ /**
125
+ * §18.3.* `<oleObjects>` — embedded OLE / ActiveX controls (E-SHEET W10); the
126
+ * reader resolves each `relId` to its activeX part (type + visible state from
127
+ * the property bag). Render-only.
128
+ */
65
129
  readonly oleObjects?: ReadonlyArray<OleObjectRef>;
130
+ /** x14 extension `<sparklineGroups>` in `extLst` — per-cell mini charts (E-SHEET SC2). */
66
131
  readonly sparklines?: ReadonlyArray<ParsedSparkline>;
132
+ /**
133
+ * §18.3.1.95 `<tableParts>` — relationship ids of the sheet's table parts. The
134
+ * pure-XML parser only lists the ids; the reader resolves them (E-SHEET SC3).
135
+ */
67
136
  readonly tablePartRelIds?: ReadonlyArray<string>;
137
+ /** Resolved table parts (banded styles, header rows) — filled by the reader. */
68
138
  readonly tables?: ReadonlyArray<ExcelTable>;
139
+ /**
140
+ * Resolved pivot tables (E-PIVOT) — discovered via the sheet's `pivotTable`
141
+ * relationships (no element in the sheet XML), resolved by the reader.
142
+ */
69
143
  readonly pivotTables?: ReadonlyArray<PivotTable>;
144
+ /**
145
+ * ECMA-376 §18.3.1.66 `<sheetView><pane state="frozen">` — frozen rows/columns.
146
+ * A VIEW setting with NO effect on print/PDF (printed repeats are
147
+ * Print_Titles); carried for round-trip fidelity and HTML sticky panes
148
+ * (E-SHEET SE2/SE3).
149
+ */
70
150
  readonly pane?: SheetPane;
71
151
  }
152
+ /**
153
+ * A frozen pane: the count of leading rows / columns frozen in the worksheet
154
+ * view. Derived from `<pane ySplit="rows" xSplit="cols" state="frozen">` — a
155
+ * plain "split" pane (a resizable divider, no freeze) is not captured.
156
+ */
72
157
  export interface SheetPane {
73
158
  readonly frozenRows: number;
74
159
  readonly frozenCols: number;
75
160
  }
161
+ /**
162
+ * ECMA-376 §18.5.1.2 `<table>` — a structured table over a cell range with a
163
+ * banded style. The raw parse carries the range, header rows and style flags;
164
+ * the reader resolves the named style to header / band fill colours against the
165
+ * workbook theme (E-SHEET SC3).
166
+ */
76
167
  export interface ExcelTable {
77
168
  readonly ref: MergedRange;
78
169
  readonly name?: string;
@@ -83,10 +174,21 @@ export interface ExcelTable {
83
174
  readonly showFirstColumn: boolean;
84
175
  readonly showLastColumn: boolean;
85
176
  readonly autoFilter: boolean;
177
+ /**
178
+ * Resolved fills + header text colour (6-hex) — the reader derives these from
179
+ * the named style + workbook theme (E-SHEET SC3).
180
+ */
86
181
  readonly headerHex?: string;
87
182
  readonly bandHex?: string;
88
183
  readonly headerTextHex?: string;
89
184
  }
185
+ /**
186
+ * ECMA-376 §18.10.1.73 `<pivotTableDefinition>` — a pivot table. Its OUTPUT
187
+ * cells are already cached in the worksheet, so they render as a normal grid;
188
+ * this carries the pivot's location and named style so the reader can band the
189
+ * region in the pivot's own palette (E-PIVOT). The structural model (row/column
190
+ * fields, subtotals, collapse state) is later work — only location + style here.
191
+ */
90
192
  export interface PivotTable {
91
193
  readonly ref: MergedRange;
92
194
  readonly name?: string;
@@ -96,19 +198,36 @@ export interface PivotTable {
96
198
  readonly firstDataCol: number;
97
199
  readonly showRowStripes: boolean;
98
200
  readonly showColStripes: boolean;
201
+ /**
202
+ * §18.10.1.74 `<rowItems>`/`<colItems>` item type per data row / column (in
203
+ * order): `'grand'` (grand total), a subtotal-function name (subtotal), or
204
+ * undefined (a plain data line). The i-th entry maps to data row/column
205
+ * `firstDataRow/Col + i` (E-PIVOT PV3/PV4).
206
+ */
99
207
  readonly rowItemTypes?: ReadonlyArray<string | undefined>;
100
208
  readonly colItemTypes?: ReadonlyArray<string | undefined>;
209
+ /**
210
+ * Resolved fills + header text colour (6-hex) — derived from the named pivot
211
+ * style + workbook theme by the reader (E-PIVOT PV2).
212
+ */
101
213
  readonly headerHex?: string;
102
214
  readonly bandHex?: string;
103
215
  readonly headerTextHex?: string;
104
216
  }
217
+ /** The sparkline group type (ECMA-376 Part 4, x14): line / column / win-loss. */
105
218
  export type SparklineKind = 'line' | 'column' | 'winLoss';
219
+ /**
220
+ * ECMA-376 Part 4 (x14 extension) — a sparkline: a mini chart drawn inside a
221
+ * single host cell (`sqref`) from a data range (`dataRange`, an A1 area possibly
222
+ * sheet-qualified). The group's `kind` maps to line / column / win-loss.
223
+ */
106
224
  export interface ParsedSparkline {
107
225
  readonly kind: SparklineKind;
108
226
  readonly dataRange: string;
109
227
  readonly sqref: string;
110
228
  readonly colorHex?: string;
111
229
  }
230
+ /** §18.8.22 `<font>` — one font record in the workbook style table. */
112
231
  export interface XlsxFont {
113
232
  readonly sizePt?: number;
114
233
  readonly bold?: boolean;
@@ -117,35 +236,57 @@ export interface XlsxFont {
117
236
  readonly colorHex?: string;
118
237
  readonly name?: string;
119
238
  }
239
+ /** §18.8.20 `<fill>` — one fill record: pattern type plus foreground/background colours. */
120
240
  export interface XlsxFill {
121
241
  readonly patternType?: string;
122
242
  readonly fgColorHex?: string;
123
243
  readonly bgColorHex?: string;
124
244
  }
245
+ /** §18.18.3 ST_BorderStyle — a cell border-edge line style. */
125
246
  export type XlsxBorderStyleName = 'none' | 'thin' | 'medium' | 'thick' | 'hair' | 'dashed' | 'dotted' | 'double' | 'mediumDashed' | 'dashDot' | 'mediumDashDot' | 'dashDotDot' | 'mediumDashDotDot' | 'slantDashDot';
247
+ /** One border edge: its {@link XlsxBorderStyleName} and colour. */
126
248
  export interface XlsxBorderEdge {
127
249
  readonly style?: XlsxBorderStyleName;
128
250
  readonly colorHex?: string;
129
251
  }
252
+ /** §18.8.4 `<border>` — a cell's four edges plus the diagonal stroke. */
130
253
  export interface XlsxBorder {
131
254
  readonly top?: XlsxBorderEdge;
132
255
  readonly right?: XlsxBorderEdge;
133
256
  readonly bottom?: XlsxBorderEdge;
134
257
  readonly left?: XlsxBorderEdge;
258
+ /**
259
+ * §18.8.4 `<diagonal>` — the diagonal stroke; `@diagonalUp` (bottom-left →
260
+ * top-right) and/or `@diagonalDown` (top-left → bottom-right) select which
261
+ * corners it spans (W6).
262
+ */
135
263
  readonly diagonal?: XlsxBorderEdge;
136
264
  readonly diagonalUp?: boolean;
137
265
  readonly diagonalDown?: boolean;
138
266
  }
267
+ /** §18.18.40 ST_HorizontalAlignment — `<alignment horizontal>`. */
139
268
  export type XlsxHorizontalAlign = 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
269
+ /** §18.18.88 ST_VerticalAlignment — `<alignment vertical>`. */
140
270
  export type XlsxVerticalAlign = 'top' | 'center' | 'bottom' | 'justify' | 'distributed';
271
+ /** §18.8.1 `<alignment>` — a cell's text alignment, wrapping, indent and rotation. */
141
272
  export interface XlsxCellAlignment {
142
273
  readonly horizontal?: XlsxHorizontalAlign;
143
274
  readonly vertical?: XlsxVerticalAlign;
144
275
  readonly wrapText?: boolean;
276
+ /** §18.8.1 — left indent in "indent levels" (each ≈ 3 character widths) (W6). */
145
277
  readonly indent?: number;
278
+ /**
279
+ * §18.8.1 `textRotation` — degrees counter-clockwise (0–90), 91–180 clockwise
280
+ * as (value − 90), and 255 = stacked vertical text (W6).
281
+ */
146
282
  readonly textRotation?: number;
283
+ /** §18.8.1 `shrinkToFit` — scale the text down so it fits the cell on one line (W6). */
147
284
  readonly shrinkToFit?: boolean;
148
285
  }
286
+ /**
287
+ * §18.8.45 `<xf>` — one cell format record: indices into the font/fill/border/
288
+ * numFmt tables, the `apply*` flags, and direct alignment.
289
+ */
149
290
  export interface XlsxCellXf {
150
291
  readonly numFmtId: number;
151
292
  readonly fontId: number;
@@ -158,24 +299,44 @@ export interface XlsxCellXf {
158
299
  readonly applyAlignment?: boolean;
159
300
  readonly alignment?: XlsxCellAlignment;
160
301
  }
302
+ /**
303
+ * ECMA-376 Part 1 §18.8 — the workbook style table (`xl/styles.xml`): the
304
+ * number-format, font, fill, border and cell-format tables a cell's
305
+ * `styleIndex` resolves against, plus the differential formats.
306
+ */
161
307
  export interface XlsxStyles {
162
308
  readonly numFmts: ReadonlyMap<number, string>;
163
309
  readonly fonts: ReadonlyArray<XlsxFont>;
164
310
  readonly fills: ReadonlyArray<XlsxFill>;
165
311
  readonly borders: ReadonlyArray<XlsxBorder>;
166
312
  readonly cellXfs: ReadonlyArray<XlsxCellXf>;
313
+ /**
314
+ * §18.8.10 `<dxfs>` — differential formats referenced by conditional-format
315
+ * rules (E-SHEET SC1); only the properties a dxf sets override the base.
316
+ */
167
317
  readonly dxfs?: ReadonlyArray<Dxf>;
168
318
  }
319
+ /** §18.8.14 `<dxf>` — a differential (override) format a `cfRule` applies on match. */
169
320
  export interface Dxf {
170
321
  readonly font?: XlsxFont;
171
322
  readonly fill?: XlsxFill;
172
323
  }
324
+ /**
325
+ * ECMA-376 Part 1 §18.2.5 — `<definedName>`. A workbook-scoped (or sheet-scoped,
326
+ * via `localSheetId`) named range. Print areas and print titles ride these under
327
+ * the reserved names `_xlnm.Print_Area` / `_xlnm.Print_Titles`.
328
+ */
173
329
  export interface DefinedName {
174
330
  readonly name: string;
175
331
  readonly localSheetId?: number;
176
332
  readonly value: string;
177
333
  }
334
+ /** §18.18.15 ST_CfvoType — comparison operator for a `cellIs` rule. */
178
335
  export type CfOperator = 'lessThan' | 'lessThanOrEqual' | 'equal' | 'notEqual' | 'greaterThanOrEqual' | 'greaterThan' | 'between' | 'notBetween';
336
+ /**
337
+ * §18.3.1.10 `<cfRule type="cellIs">` — compares each cell to one constant (or
338
+ * two, for between/notBetween); a match applies the differential format `dxfId`.
339
+ */
179
340
  export interface CfRuleCellIs {
180
341
  readonly type: 'cellIs';
181
342
  readonly priority: number;
@@ -183,17 +344,40 @@ export interface CfRuleCellIs {
183
344
  readonly formulas: ReadonlyArray<string>;
184
345
  readonly dxfId: number;
185
346
  }
347
+ /**
348
+ * §18.3.1.11 ST_CfvoType — how a `<cfvo>` stop's threshold is derived.
349
+ * `min`/`max` (and the dataBar `autoMin`/`autoMax`) take the range's extent;
350
+ * `num`/`formula` a literal; `percent`/`percentile` position within the value
351
+ * distribution.
352
+ */
186
353
  export type CfvoType = 'num' | 'percent' | 'max' | 'min' | 'percentile' | 'formula' | 'autoMin' | 'autoMax';
354
+ /**
355
+ * §18.3.1.11 `<cfvo>` — one stop of a colorScale (or dataBar/iconSet). `val`
356
+ * carries the number/percent/formula text; absent for `min`/`max`.
357
+ */
187
358
  export interface Cfvo {
188
359
  readonly type: CfvoType;
189
360
  readonly val?: string;
190
361
  }
362
+ /**
363
+ * §18.3.1.16 `<cfRule type="colorScale">` — a 2- or 3-stop gradient. Each cfvo
364
+ * pairs with a colour; a cell's value, positioned between the bracketing stops,
365
+ * interpolates (in RGB) to a solid fill. Unlike `cellIs` it needs the range's
366
+ * value extent, so it resolves against every covered cell, not one constant.
367
+ */
191
368
  export interface CfRuleColorScale {
192
369
  readonly type: 'colorScale';
193
370
  readonly priority: number;
194
371
  readonly cfvos: ReadonlyArray<Cfvo>;
195
372
  readonly colorsHex: ReadonlyArray<string>;
196
373
  }
374
+ /**
375
+ * §18.3.1.28 `<cfRule type="dataBar">` — an in-cell bar whose length encodes the
376
+ * cell value within the range's extent. Two cfvo stops (lower/upper) bound the
377
+ * scale; `colorHex` fills the bar. `minLength`/`maxLength` clamp the bar as a
378
+ * percent (0..100) of the cell width (ECMA defaults 10/90; we default 0/100 —
379
+ * modern solid bars span the full cell).
380
+ */
197
381
  export interface CfRuleDataBar {
198
382
  readonly type: 'dataBar';
199
383
  readonly priority: number;
@@ -202,6 +386,11 @@ export interface CfRuleDataBar {
202
386
  readonly minLength?: number;
203
387
  readonly maxLength?: number;
204
388
  }
389
+ /**
390
+ * §18.3.1.49 `<cfRule type="iconSet">` — picks one glyph per cell from a named
391
+ * icon family (3/4/5 icons) by the value's bucket among the cfvo thresholds.
392
+ * `reverse` flips the icon order (highest value → first icon).
393
+ */
205
394
  export interface CfRuleIconSet {
206
395
  readonly type: 'iconSet';
207
396
  readonly priority: number;
@@ -209,6 +398,12 @@ export interface CfRuleIconSet {
209
398
  readonly cfvos: ReadonlyArray<Cfvo>;
210
399
  readonly reverse?: boolean;
211
400
  }
401
+ /**
402
+ * §18.3.1.10 `<cfRule type="top10">` — the top (or `bottom`) N values of the
403
+ * range take the differential format. `rank` is N; with `percent` it is a
404
+ * percentage of the range's cell count. Resolves against the range's value
405
+ * extent, like a scale.
406
+ */
212
407
  export interface CfRuleTop10 {
213
408
  readonly type: 'top10';
214
409
  readonly priority: number;
@@ -217,6 +412,11 @@ export interface CfRuleTop10 {
217
412
  readonly bottom: boolean;
218
413
  readonly dxfId: number;
219
414
  }
415
+ /**
416
+ * §18.3.1.10 `<cfRule type="aboveAverage">` — cells above (default) or below the
417
+ * range mean take the format. `equalAverage` makes the comparison inclusive;
418
+ * `stdDev`, when set, shifts the threshold by N population standard deviations.
419
+ */
220
420
  export interface CfRuleAboveAverage {
221
421
  readonly type: 'aboveAverage';
222
422
  readonly priority: number;
@@ -225,11 +425,23 @@ export interface CfRuleAboveAverage {
225
425
  readonly stdDev?: number;
226
426
  readonly dxfId: number;
227
427
  }
428
+ /**
429
+ * §18.3.1.10 `<cfRule type="duplicateValues" | "uniqueValues">` — cells whose
430
+ * value repeats within the range (duplicate) or occurs exactly once (unique)
431
+ * take the format. Compares numbers by value and strings case-insensitively,
432
+ * like Excel.
433
+ */
228
434
  export interface CfRuleDupUnique {
229
435
  readonly type: 'duplicateValues' | 'uniqueValues';
230
436
  readonly priority: number;
231
437
  readonly dxfId: number;
232
438
  }
439
+ /**
440
+ * §18.3.1.10 `<cfRule type="containsText" | "notContainsText" | "beginsWith" |
441
+ * "endsWith">` — a case-insensitive substring test against the cell's text.
442
+ * `text` is the needle; `formula` carries Excel's generated SEARCH/LEFT/RIGHT
443
+ * expression verbatim for faithful write-back (it is matched directly, not run).
444
+ */
233
445
  export interface CfRuleText {
234
446
  readonly type: 'containsText' | 'notContainsText' | 'beginsWith' | 'endsWith';
235
447
  readonly priority: number;
@@ -237,13 +449,30 @@ export interface CfRuleText {
237
449
  readonly dxfId: number;
238
450
  readonly formula?: string;
239
451
  }
452
+ /**
453
+ * §18.3.1.10 `<cfRule type="expression">` — an arbitrary formula evaluated per
454
+ * cell in the range; a TRUE (or non-zero) result applies the dxf. Ream evaluates
455
+ * it against the grid's cached values with a small deterministic formula engine
456
+ * (E-SHEET W9); the `formula` is kept verbatim for faithful write-back. A
457
+ * formula the engine cannot model simply does not apply (graceful loss, never
458
+ * misrender).
459
+ */
240
460
  export interface CfRuleExpression {
241
461
  readonly type: 'expression';
242
462
  readonly priority: number;
243
463
  readonly formula: string;
244
464
  readonly dxfId: number;
245
465
  }
466
+ /** §18.18.82 ST_TimePeriod — the clock-relative window a `timePeriod` rule tests. */
246
467
  export type TimePeriodKind = 'today' | 'yesterday' | 'tomorrow' | 'last7Days' | 'thisWeek' | 'lastWeek' | 'nextWeek' | 'thisMonth' | 'lastMonth' | 'nextMonth';
468
+ /**
469
+ * §18.3.1.10 `<cfRule type="timePeriod">` — cells whose date falls in a window
470
+ * relative to "today" take the dxf. The window is computed from an injected
471
+ * reference date (`options.now`) — Ream never reads the wall clock — so the rule
472
+ * is a no-op (deterministic) when no date is supplied. Excel also emits a helper
473
+ * `<formula>`; it is preserved verbatim for write-back but the window drives the
474
+ * match.
475
+ */
247
476
  export interface CfRuleTimePeriod {
248
477
  readonly type: 'timePeriod';
249
478
  readonly priority: number;
@@ -251,11 +480,19 @@ export interface CfRuleTimePeriod {
251
480
  readonly dxfId: number;
252
481
  readonly formula?: string;
253
482
  }
483
+ /** One conditional-format rule (`<cfRule>`): the union over the supported `type`s. */
254
484
  export type CfRule = CfRuleCellIs | CfRuleColorScale | CfRuleDataBar | CfRuleIconSet | CfRuleTop10 | CfRuleAboveAverage | CfRuleDupUnique | CfRuleText | CfRuleExpression | CfRuleTimePeriod;
485
+ /** §18.3.1.18 `<conditionalFormatting sqref="A1:A10 C1:C5">` — rules over ranges. */
255
486
  export interface ConditionalFormat {
256
487
  readonly ranges: ReadonlyArray<MergedRange>;
257
488
  readonly rules: ReadonlyArray<CfRule>;
258
489
  }
490
+ /**
491
+ * §18.3.1.47 `<hyperlink ref r:id location display tooltip>` — a cell (or range)
492
+ * hyperlink (E-SHEET W3). `relId` resolves to an external URL through the
493
+ * worksheet relationships; `location` is an in-workbook target (`Sheet!cell`).
494
+ * The raw form rides on the grid; the reader resolves it to a `SheetHyperlink`.
495
+ */
259
496
  export interface HyperlinkRef {
260
497
  readonly ref: string;
261
498
  readonly relId?: string;
@@ -263,18 +500,47 @@ export interface HyperlinkRef {
263
500
  readonly display?: string;
264
501
  readonly tooltip?: string;
265
502
  }
503
+ /**
504
+ * §18.3.1.46 `<headerFooter>` — the sheet's print header/footer format strings
505
+ * (E-SHEET W4). Each carries Excel's `&`-code mini-language (`&L`/`&C`/`&R`
506
+ * regions, `&P`/`&N`/`&D`/`&F`/`&A` field codes, `&B`/`&I` formatting). v1 reads
507
+ * the odd (= default) header and footer; even/first variants are a later
508
+ * refinement.
509
+ */
266
510
  export interface HeaderFooter {
267
511
  readonly oddHeader?: string;
268
512
  readonly oddFooter?: string;
269
513
  }
514
+ /**
515
+ * §18.3.1.* form control (E-SHEET W8) — a checkbox / option button / spinner /
516
+ * button etc. declared in the worksheet (legacy `<controls>` or the x14
517
+ * `extLst`). `relId` resolves to the control's ctrlProp part (type + state);
518
+ * `name` is its display name. Raw form (the reader resolves `relId`);
519
+ * render-only.
520
+ */
270
521
  export interface FormControlRef {
271
522
  readonly name?: string;
272
523
  readonly relId: string;
273
524
  }
525
+ /**
526
+ * §18.3.* `<oleObjects><oleObject progId r:id>` — an embedded OLE / ActiveX
527
+ * control (E-SHEET W10). `progId` (e.g. `Forms.CheckBox.1`) names the control
528
+ * class; `relId` resolves to its `xl/activeX/activeXN.xml` part (the persisted
529
+ * property bag). Raw form (the reader resolves `relId`); render-only.
530
+ */
274
531
  export interface OleObjectRef {
275
532
  readonly progId?: string;
276
533
  readonly relId: string;
277
534
  }
535
+ /**
536
+ * §18.4.4 `<r>` — one formatting run inside a rich-text shared string (E-SHEET
537
+ * W6). A `<si>` with multiple `<r><rPr>…</rPr><t>…</t></r>` runs carries per-run
538
+ * formatting from `<rPr>` (its own font properties, not a cellXf index). The
539
+ * projection emits these as separate document-model runs so a single cell can
540
+ * mix bold / colour / size. Render-only: the writer flattens back to plain text,
541
+ * so the round-trip stays byte-stable (rich formatting in a shared string is
542
+ * dropped on `convert('xlsx')`, a documented loss like slicers/pivots).
543
+ */
278
544
  export interface SheetRichRun {
279
545
  readonly text: string;
280
546
  readonly bold?: boolean;
@@ -282,9 +548,24 @@ export interface SheetRichRun {
282
548
  readonly underline?: boolean;
283
549
  readonly colorHex?: string;
284
550
  readonly sizePt?: number;
551
+ /** §18.4.2 `<vertAlign>` — superscript / subscript within the cell text. */
285
552
  readonly vertAlign?: 'superscript' | 'subscript';
286
553
  }
554
+ /**
555
+ * §18.18.18 ST_DataValidationType — the constraint a `<dataValidation>`
556
+ * enforces. Only `list` has a visual signature (the in-cell dropdown); the rest
557
+ * carry through for round-trip fidelity and for surfacing the input/error
558
+ * prompts.
559
+ */
287
560
  export type DataValidationType = 'none' | 'whole' | 'decimal' | 'list' | 'date' | 'time' | 'textLength' | 'custom';
561
+ /**
562
+ * §18.3.1.33 `<dataValidation>` — an input constraint over one or more ranges
563
+ * (`sqref`) (E-SHEET SV1). The visually-meaningful part is `type` (a `list` cell
564
+ * shows a dropdown); the formulas + prompts ride through so the validation
565
+ * survives a read→write round-trip. `showDropDown` keeps ECMA's INVERTED sense:
566
+ * the attribute is "1" to HIDE the in-cell dropdown, so a list validation shows
567
+ * one when the flag is absent/false.
568
+ */
288
569
  export interface DataValidation {
289
570
  readonly type: DataValidationType;
290
571
  readonly ranges: ReadonlyArray<MergedRange>;