reamkit 1.15.1 → 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 +16 -0
  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 +47 -0
  236. package/dist/esm/pdf-reader/flow-build.js +42 -0
  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 +15 -0
  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 +13 -0
  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 +21 -0
  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 +16 -0
  281. package/dist/esm/word/doc/doc-text.d.ts +77 -0
  282. package/dist/esm/word/doc/doc-text.js +13 -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,4 +1,18 @@
1
1
  import { DocumentWriter, WriteResult } from '../core/ir/adapters.js';
2
2
  import { SheetDoc } from '../core/ir/sheet.js';
3
+ /**
4
+ * Serialize a {@link SheetDoc} back to a `.xlsx` (E-SHEET SD1). The first writer
5
+ * that consumes the SpreadsheetML IR node directly (not the FlowDoc projection),
6
+ * so the cells keep their RAW value + style index and the SheetDoc is a stable
7
+ * round-trip fixpoint (SD2). Re-emits the full grid surface — values, shared
8
+ * strings, styles, merges, column/row geometry, the page model, conditional
9
+ * formatting, sparklines, table parts and embedded charts — through the core OPC
10
+ * writer.
11
+ *
12
+ * @param sheet The spreadsheet IR tree to write.
13
+ * @returns The encoded `.xlsx` bytes and any write-time losses (e.g. a chart
14
+ * frame whose data could not be resolved).
15
+ */
3
16
  export declare function writeXlsx(sheet: SheetDoc): WriteResult;
17
+ /** The `.xlsx` {@link DocumentWriter}: a thin wrapper over {@link writeXlsx}. */
4
18
  export declare const xlsxWriter: DocumentWriter<SheetDoc>;
@@ -24,6 +24,19 @@ var CT_STYLES = "application/vnd.openxmlformats-officedocument.spreadsheetml.sty
24
24
  var CT_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
25
25
  var MAIN_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
26
26
  var R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
27
+ /**
28
+ * Serialize a {@link SheetDoc} back to a `.xlsx` (E-SHEET SD1). The first writer
29
+ * that consumes the SpreadsheetML IR node directly (not the FlowDoc projection),
30
+ * so the cells keep their RAW value + style index and the SheetDoc is a stable
31
+ * round-trip fixpoint (SD2). Re-emits the full grid surface — values, shared
32
+ * strings, styles, merges, column/row geometry, the page model, conditional
33
+ * formatting, sparklines, table parts and embedded charts — through the core OPC
34
+ * writer.
35
+ *
36
+ * @param sheet The spreadsheet IR tree to write.
37
+ * @returns The encoded `.xlsx` bytes and any write-time losses (e.g. a chart
38
+ * frame whose data could not be resolved).
39
+ */
27
40
  function writeXlsx(sheet) {
28
41
  const losses = [];
29
42
  const worksheetParts = [];
@@ -1,4 +1,22 @@
1
1
  import { DocumentWriter, WriteResult } from '../core/ir/adapters.js';
2
2
  import { FlowDoc } from '../core/ir/flow.js';
3
+ /**
4
+ * Render a {@link FlowDoc} to a self-contained HTML document (ir-design §7).
5
+ *
6
+ * A flow medium: no pagination, no layout engine and no fonts to embed, so this
7
+ * is a pure, zero-I/O transform. `flow.body` already carries FINAL effective
8
+ * properties (the Stage-6 contract), so values map straight to CSS; every read
9
+ * still routes through the cascade resolver over the empty sheet, a memoized
10
+ * identity on reader output. Charts and shapes emit as inline SVG; deliberately
11
+ * out of scope (reported as losses): inline math and headers/footers (no fixed
12
+ * pages to band them onto). Page-break hints map to CSS `break-before`.
13
+ *
14
+ * @param flow The format-neutral interlayer document tree.
15
+ * @returns The encoded HTML bytes plus the recorded {@link Loss} list.
16
+ */
3
17
  export declare function writeHtml(flow: FlowDoc): WriteResult;
18
+ /**
19
+ * The flow-medium {@link DocumentWriter} adapter (id `'html'`), wrapping
20
+ * {@link writeHtml}, with the set of {@link FEATURES} it renders.
21
+ */
4
22
  export declare const htmlWriter: DocumentWriter<FlowDoc>;
@@ -10,6 +10,20 @@ import { buildShapePaths, buildShapeTransform, buildStroke, gradientSvgDef } fro
10
10
  import { sanitizeHref } from "../core/links.js";
11
11
  import { toBase64 } from "../core/bytes.js";
12
12
  //#region src/html/html-writer.ts
13
+ /**
14
+ * Render a {@link FlowDoc} to a self-contained HTML document (ir-design §7).
15
+ *
16
+ * A flow medium: no pagination, no layout engine and no fonts to embed, so this
17
+ * is a pure, zero-I/O transform. `flow.body` already carries FINAL effective
18
+ * properties (the Stage-6 contract), so values map straight to CSS; every read
19
+ * still routes through the cascade resolver over the empty sheet, a memoized
20
+ * identity on reader output. Charts and shapes emit as inline SVG; deliberately
21
+ * out of scope (reported as losses): inline math and headers/footers (no fixed
22
+ * pages to band them onto). Page-break hints map to CSS `break-before`.
23
+ *
24
+ * @param flow The format-neutral interlayer document tree.
25
+ * @returns The encoded HTML bytes plus the recorded {@link Loss} list.
26
+ */
13
27
  function writeHtml(flow) {
14
28
  const losses = [];
15
29
  const out = [];
@@ -50,6 +64,10 @@ function writeHtml(flow) {
50
64
  losses
51
65
  };
52
66
  }
67
+ /**
68
+ * The flow-medium {@link DocumentWriter} adapter (id `'html'`), wrapping
69
+ * {@link writeHtml}, with the set of {@link FEATURES} it renders.
70
+ */
53
71
  var htmlWriter = {
54
72
  id: "html",
55
73
  consumes: "flow",
@@ -1,3 +1,26 @@
1
+ /**
2
+ * The public API for Ream.
3
+ *
4
+ * The package reads Word, Excel, PowerPoint and PDF — including the legacy
5
+ * `.doc` / `.xls` / `.ppt` — and converts any of them to PDF, SVG, HTML, DOCX or
6
+ * XLSX, implemented from the ECMA-376 and ISO 32000 specifications without
7
+ * wrapping LibreOffice, headless Office, or any commercial SDK.
8
+ *
9
+ * Typical use:
10
+ *
11
+ * ```ts
12
+ * import { Ream } from 'reamkit';
13
+ * const doc = Ream.parse(bytes); // format sniffed
14
+ * const pdf = await doc.convert('pdf'); // one parse, any target
15
+ * ```
16
+ *
17
+ * Advanced consumers can build custom pipelines from the reader/writer
18
+ * interfaces, drive the layout engine directly via {@link renderStyledPdf},
19
+ * supply a hyphenator, or import the typed document model from the
20
+ * `reamkit/document-model` subpath.
21
+ *
22
+ * @packageDocumentation
23
+ */
1
24
  export { fetchFontSet, resolveFamilyKey } from './core/fonts/index.js';
2
25
  export type { FamilyKey, FetchFontSetOptions, FetchLike } from './core/fonts/index.js';
3
26
  export { renderStyledPdf } from './pdf/index.js';
@@ -1,14 +1,21 @@
1
1
  import { MathNode } from '../core/document-model/index.js';
2
2
  import { PathSegment } from '../core/vector.js';
3
+ /** Font variant a math glyph renders in (drives the auto-italic of letters). */
3
4
  export type MathVariant = 'regular' | 'italic' | 'bold' | 'boldItalic';
5
+ /**
6
+ * An ordinary symbol drawn from the font: a string positioned in the box's local
7
+ * frame (origin = box left, baseline at `y = 0`, y up).
8
+ */
4
9
  export interface MathGlyphItem {
5
10
  readonly kind: 'glyph';
6
11
  readonly x: number;
12
+ /** Baseline offset, up positive. */
7
13
  readonly y: number;
8
14
  readonly text: string;
9
15
  readonly variant: MathVariant;
10
16
  readonly sizePt: number;
11
17
  }
18
+ /** A filled rectangle (fraction bars, accent rules); `(x, y)` is its bottom-left edge. */
12
19
  export interface MathRuleItem {
13
20
  readonly kind: 'rule';
14
21
  readonly x: number;
@@ -16,29 +23,61 @@ export interface MathRuleItem {
16
23
  readonly w: number;
17
24
  readonly h: number;
18
25
  }
26
+ /**
27
+ * A vector path drawn instead of a math-font glyph (radicals, stretchy
28
+ * delimiters, big operators) — so no math font is needed.
29
+ */
19
30
  export interface MathPathItem {
20
31
  readonly kind: 'path';
21
32
  readonly segments: ReadonlyArray<PathSegment>;
33
+ /** Present ⇒ stroked at this width. */
22
34
  readonly strokeWidthPt?: number;
35
+ /** `true` ⇒ filled. */
23
36
  readonly fill?: boolean;
24
37
  }
38
+ /** A positioned draw item in a {@link MathBox}'s local frame. */
25
39
  export type MathDrawItem = MathGlyphItem | MathRuleItem | MathPathItem;
40
+ /**
41
+ * A laid-out math box: a width plus ascent (above the baseline) and descent
42
+ * (below), and a flat list of positioned {@link MathDrawItem}s in a LOCAL frame
43
+ * (origin = box left, baseline at `y = 0`, y up).
44
+ */
26
45
  export interface MathBox {
27
46
  readonly width: number;
28
47
  readonly ascent: number;
29
48
  readonly descent: number;
30
49
  readonly items: ReadonlyArray<MathDrawItem>;
31
50
  }
51
+ /** Injected text-measure: the advance width of `text` at `sizePt` in `variant`. */
32
52
  export type MeasureMath = (text: string, sizePt: number, variant: MathVariant) => number;
53
+ /** Layout context threaded through {@link layoutMath} — currently just the em size. */
33
54
  export interface MathCtx {
34
55
  readonly sizePt: number;
35
56
  }
57
+ /** Decompose a {@link MathVariant} into its independent bold / italic flags. */
36
58
  export declare function variantStyle(v: MathVariant): {
37
59
  bold: boolean;
38
60
  italic: boolean;
39
61
  };
62
+ /**
63
+ * Recursively lay out an ECMA-376 §22 OfficeMath node into a {@link MathBox}.
64
+ * Ordinary symbols become {@link MathGlyphItem}s (rendered from the font);
65
+ * structural elements (fraction rules, radicals, big operators, stretchy
66
+ * delimiters) become rule/path items drawn as vector graphics. Pure: text widths
67
+ * arrive through the injected `measure` fn.
68
+ *
69
+ * @param node The math tree node to lay out.
70
+ * @param ctx The layout context (em size).
71
+ * @param measure The injected advance-width measurer.
72
+ * @returns The positioned box; constructs added in later milestones render empty.
73
+ */
40
74
  export declare function layoutMath(node: MathNode, ctx: MathCtx, measure: MeasureMath): MathBox;
75
+ /** Translate every item in a box by `(dx, dy)`, returning shifted copies. */
41
76
  export declare function shiftItems(items: ReadonlyArray<MathDrawItem>, dx: number, dy: number): Array<MathDrawItem>;
77
+ /**
78
+ * Flatten a math tree into `(variant, text)` glyph segments — used to subset the
79
+ * right glyphs into the right font variant. Grows alongside {@link layoutMath}.
80
+ */
42
81
  export declare function mathGlyphSegments(node: MathNode): Array<{
43
82
  variant: MathVariant;
44
83
  text: string;
@@ -6,6 +6,7 @@ var BAR_THICK = .045;
6
6
  var FRAC_GAP = .15;
7
7
  var FRAC_PAD = .12;
8
8
  var SCRIPT_SIZE = .7;
9
+ /** Decompose a {@link MathVariant} into its independent bold / italic flags. */
9
10
  function variantStyle(v) {
10
11
  return {
11
12
  bold: v === "bold" || v === "boldItalic",
@@ -20,6 +21,18 @@ function runCharVariant(ch, run) {
20
21
  const bold = run.bold ?? false;
21
22
  return variantOf(run.nor ? false : run.italic ?? isAutoItalic(ch), bold);
22
23
  }
24
+ /**
25
+ * Recursively lay out an ECMA-376 §22 OfficeMath node into a {@link MathBox}.
26
+ * Ordinary symbols become {@link MathGlyphItem}s (rendered from the font);
27
+ * structural elements (fraction rules, radicals, big operators, stretchy
28
+ * delimiters) become rule/path items drawn as vector graphics. Pure: text widths
29
+ * arrive through the injected `measure` fn.
30
+ *
31
+ * @param node The math tree node to lay out.
32
+ * @param ctx The layout context (em size).
33
+ * @param measure The injected advance-width measurer.
34
+ * @returns The positioned box; constructs added in later milestones render empty.
35
+ */
23
36
  function layoutMath(node, ctx, measure) {
24
37
  switch (node.type) {
25
38
  case "run": return layoutRun(node, ctx, measure);
@@ -1016,6 +1029,7 @@ function layoutGroupChr(node, ctx, measure) {
1016
1029
  items
1017
1030
  };
1018
1031
  }
1032
+ /** Translate every item in a box by `(dx, dy)`, returning shifted copies. */
1019
1033
  function shiftItems(items, dx, dy) {
1020
1034
  return items.map((it) => {
1021
1035
  if (it.kind === "glyph") return {
@@ -1054,6 +1068,10 @@ function shiftSegment(s, dx, dy) {
1054
1068
  case "close": return s;
1055
1069
  }
1056
1070
  }
1071
+ /**
1072
+ * Flatten a math tree into `(variant, text)` glyph segments — used to subset the
1073
+ * right glyphs into the right font variant. Grows alongside {@link layoutMath}.
1074
+ */
1057
1075
  function mathGlyphSegments(node) {
1058
1076
  const out = [];
1059
1077
  const visit = (n) => {
@@ -3,35 +3,74 @@ import { FontMeasure, ParsedTtf } from '../core/font/index.js';
3
3
  import { ResolvedParagraphProperties, ResolvedRunProperties } from '../core/style-cascade/index.js';
4
4
  import { PathSegment, VectorShape } from '../core/vector.js';
5
5
  import { PreparedImage } from '../core/images.js';
6
+ /** A font bound into a {@link LaidOutDocument}: the parsed face plus what layout/emit need from it. */
6
7
  export interface FontResource {
7
8
  readonly resourceName: string;
8
9
  readonly parsed: ParsedTtf;
10
+ /**
11
+ * Pure measurement/encoding (no `PdfDocument`): layout measures with this and
12
+ * emit encodes with it; the PDF font objects are created in the emit phase.
13
+ */
9
14
  readonly measure: FontMeasure;
15
+ /** Glyphs collected by the usage walk — the emit phase subsets to these. */
10
16
  readonly gids: ReadonlySet<number>;
11
17
  }
18
+ /** A run of text on a {@link Line}: the string plus its resolved font, size, width and link/tagging state. */
12
19
  export interface TextToken {
13
20
  readonly kind: 'text';
14
21
  readonly text: string;
15
22
  readonly isSpace: boolean;
23
+ /**
24
+ * External hyperlink target inherited from the source run (rels-resolved).
25
+ * Writers MUST sanitize the scheme (`core/links`) before emitting anything
26
+ * clickable.
27
+ */
16
28
  readonly href?: string;
29
+ /**
30
+ * §17.11.14 — the token renders a footnote reference number; pagination
31
+ * reserves the note's block at the bottom of the page it lands on.
32
+ */
17
33
  readonly footnoteRef?: string;
34
+ /**
35
+ * §17.16.22 — internal link target: a bookmark name in this document (not a
36
+ * URL; resolves to a GoTo destination, never through the scheme list).
37
+ */
18
38
  readonly anchor?: string;
39
+ /**
40
+ * List-item marker glyphs (`"1."`, `"•"`) — tagged PDF brackets them in a Lbl
41
+ * element separate from the item body.
42
+ */
19
43
  readonly listMarker?: true;
44
+ /**
45
+ * The token falls inside a comment range (`commentRangeRefs`): the emitter
46
+ * fills a soft highlight behind it (E-COMMENTS CM2c).
47
+ */
20
48
  readonly highlight?: true;
21
49
  readonly resolvedRun: ResolvedRunProperties;
22
50
  readonly font: FontResource;
23
51
  readonly fontSizePt: number;
24
52
  readonly widthPt: number;
53
+ /**
54
+ * UAX #9 embedding level of this token's characters (0 for pure-LTR docs).
55
+ * Even = LTR, odd = RTL. Used for visual reordering at emit time.
56
+ */
25
57
  readonly bidiLevel: number;
26
58
  }
59
+ /** An inline image on a {@link Line}: its sized box plus the resource name binding to the page XObject. */
27
60
  export interface ImageToken {
28
61
  readonly kind: 'image';
29
62
  readonly imageResourceName: string;
30
63
  readonly widthPt: number;
31
64
  readonly heightPt: number;
65
+ /** Constants kept to satisfy {@link Token} consumers — they never read these for images. */
32
66
  readonly isSpace: false;
33
67
  readonly bidiLevel: number;
34
68
  }
69
+ /**
70
+ * A math draw item with its font already resolved (`math-layout` emits a
71
+ * variant; the tokenizer maps it to a {@link FontResource} so the emit phase
72
+ * needs no fonts).
73
+ */
35
74
  export type ResolvedMathItem = {
36
75
  readonly kind: 'glyph';
37
76
  readonly x: number;
@@ -51,6 +90,10 @@ export type ResolvedMathItem = {
51
90
  readonly strokeWidthPt?: number;
52
91
  readonly fill?: boolean;
53
92
  };
93
+ /**
94
+ * An inline OfficeMath object — an atomic box straddling the baseline (its own
95
+ * ascent/descent extend the line height).
96
+ */
54
97
  export interface MathToken {
55
98
  readonly kind: 'math';
56
99
  readonly items: ReadonlyArray<ResolvedMathItem>;
@@ -60,7 +103,9 @@ export interface MathToken {
60
103
  readonly isSpace: false;
61
104
  readonly bidiLevel: number;
62
105
  }
106
+ /** A positioned atom on a {@link Line}: a text run, an inline image, or an inline math box. */
63
107
  export type Token = TextToken | ImageToken | MathToken;
108
+ /** A laid-out line of a paragraph: its broken tokens plus the geometry pagination needs. */
64
109
  export interface Line {
65
110
  readonly tokens: ReadonlyArray<Token>;
66
111
  readonly contentWidthPt: number;
@@ -69,25 +114,61 @@ export interface Line {
69
114
  readonly firstLine: boolean;
70
115
  readonly resolved: ResolvedParagraphProperties;
71
116
  isLastInParagraph: boolean;
117
+ /**
118
+ * Max ascent/descent contributed by math tokens (0 when none) — they straddle
119
+ * the baseline, so the line height/descent must grow to fit them.
120
+ */
72
121
  readonly mathAscentPt?: number;
73
122
  readonly mathDescentPt?: number;
123
+ /**
124
+ * E-PARITY: metric-derived single-line height and descent (Pt), the max over
125
+ * the line's text-token fonts under a non-default `layoutProfile`. Absent under
126
+ * `'ream'`, where leading stays the flat 1.2×/0.2 model (byte-identical).
127
+ */
74
128
  readonly metricHeightPt?: number;
75
129
  readonly metricDescentPt?: number;
76
130
  }
131
+ /** An image bound into a {@link LaidOutDocument}: its resource name plus the decoded/validated bytes. */
77
132
  export interface ImageResource {
78
133
  readonly resourceName: string;
134
+ /**
135
+ * Decoded/validated at layout time (the probe); the emit phase replays it
136
+ * without touching the source bytes again.
137
+ */
79
138
  readonly prepared: PreparedImage;
80
139
  }
140
+ /**
141
+ * The fields every {@link PageItem} shares (ir-design §6, frozen at stage 6.4):
142
+ * the positioned, layout-output vocabulary a page is made of. Page-frame
143
+ * geometry is branded `Pt` (PostScript points) with a TOP-LEFT origin, y growing
144
+ * downward (like CSS/SVG); the PDF emitter converts into PDF's native y-up frame
145
+ * at emission. Offsets measured from a text baseline (math/inline-image boxes
146
+ * inside a {@link Line}) and styling magnitudes (font/stroke sizes) stay plain
147
+ * numbers — they are not page-frame coordinates.
148
+ */
81
149
  export interface PageItemBase {
150
+ /**
151
+ * Tagged PDF (§14.8): the logical structure node this item's content belongs
152
+ * to. Set only on body content in tagged mode; undefined text in the line pass
153
+ * is treated as an artifact. Ignored when not tagging.
154
+ */
82
155
  readonly structId?: number;
156
+ /**
157
+ * Tagged PDF: explicitly mark this item as a pagination artifact (running
158
+ * header/footer, §14.8.2.2.2). Distinguishes header/footer text from
159
+ * not-yet-tagged body content so it is typed `/Artifact /Pagination`, never a P.
160
+ */
83
161
  readonly artifact?: 'pagination';
84
162
  }
163
+ /** A laid-out line of text (tokens carry their fonts/sizes/positions). */
85
164
  export interface TextLineItem extends PageItemBase {
86
165
  readonly type: 'line';
87
166
  readonly line: Line;
88
167
  readonly originX: Pt;
168
+ /** Distance from the page TOP down to the text baseline. */
89
169
  readonly baselineY: Pt;
90
170
  }
171
+ /** One edge of a table-cell frame; `(x, y)` is the cell box's top-left corner. */
91
172
  export interface BorderItem extends PageItemBase {
92
173
  readonly type: 'border';
93
174
  readonly side: 'top' | 'right' | 'bottom' | 'left';
@@ -98,6 +179,7 @@ export interface BorderItem extends PageItemBase {
98
179
  readonly borderSizePt: number;
99
180
  readonly borderColorHex: string;
100
181
  }
182
+ /** A filled rectangle (cell shading); `(x, y)` is its top-left corner. */
101
183
  export interface FillItem extends PageItemBase {
102
184
  readonly type: 'fill';
103
185
  readonly x: Pt;
@@ -106,6 +188,10 @@ export interface FillItem extends PageItemBase {
106
188
  readonly height: Pt;
107
189
  readonly fillColorHex: string;
108
190
  }
191
+ /**
192
+ * A placed raster image (resource name binds to the page XObject dict); `(x, y)`
193
+ * is its top-left corner.
194
+ */
109
195
  export interface ImageItem extends PageItemBase {
110
196
  readonly type: 'image';
111
197
  readonly x: Pt;
@@ -114,10 +200,15 @@ export interface ImageItem extends PageItemBase {
114
200
  readonly height: Pt;
115
201
  readonly imageResourceName: string;
116
202
  }
203
+ /**
204
+ * DrawingML vector geometry. `shape.transform` maps the shape's local y-up frame
205
+ * into the top-left page frame (see `flipTransform`).
206
+ */
117
207
  export interface ShapeItem extends PageItemBase {
118
208
  readonly type: 'shape';
119
209
  readonly shape: VectorShape;
120
210
  }
211
+ /** A positioned item on a laid-out page: a text line, border, fill, image, or vector shape. */
121
212
  export type PageItem = TextLineItem | BorderItem | FillItem | ImageItem | ShapeItem;
122
213
  export interface PagePaintPlan {
123
214
  readonly fills: ReadonlyArray<FillItem>;