reamkit 1.15.1 → 1.15.3

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 +20 -0
  12. package/dist/esm/core/bytes.js +24 -1
  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 +49 -1
  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 +302 -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 +27 -7
  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 +77 -1
  148. package/dist/esm/excel/print-model.js +230 -26
  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 +29 -0
  156. package/dist/esm/excel/sheet-to-flow.js +24 -7
  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 +39 -6
  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 +30 -0
  178. package/dist/esm/excel/xlsx-reader.js +38 -4
  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 +136 -4
  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 +23 -2
  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 +18 -2
  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 +5 -2
@@ -1,5 +1,28 @@
1
1
  import { PathSegment } from './vector.js';
2
+ /**
3
+ * Point on an axis-aligned ellipse at angle θ (radians, CCW from +x): returns
4
+ * `[cx + rx·cosθ, cy + ry·sinθ]`.
5
+ */
2
6
  export declare function arcPoint(cx: number, cy: number, rx: number, ry: number, angleRad: number): readonly [number, number];
7
+ /**
8
+ * Decompose an arc into cubic segments, ≤90° each. Returns ONLY `cubic`
9
+ * segments — the pen is assumed to already sit at the arc's start point
10
+ * (`arcPoint(..., startAngleRad)`); the caller emits a leading move/line.
11
+ * Degenerate input (non-positive radius or zero sweep) yields no segments,
12
+ * so no NaN can reach the serializer.
13
+ *
14
+ * @param startAngleRad Start angle in radians (CCW from +x).
15
+ * @param sweepAngleRad Signed angular extent in radians (sign = winding direction).
16
+ */
3
17
  export declare function arcToBeziers(cx: number, cy: number, rx: number, ry: number, startAngleRad: number, sweepAngleRad: number): Array<PathSegment>;
18
+ /**
19
+ * Full ellipse inscribed in the `(0,0)`–`(w,h)` box, as a closed path. Starts at
20
+ * the rightmost point and sweeps a full turn CCW.
21
+ */
4
22
  export declare function ellipseSegments(w: number, h: number): ReadonlyArray<PathSegment>;
23
+ /**
24
+ * Rounded rectangle in the `(0,0)`–`(w,h)` box (y-up) with uniform corner radius
25
+ * `r` (clamped to half the shorter side). Traversed CCW: bottom edge → BR corner
26
+ * → right edge → TR corner → top edge → TL corner → left edge → BL corner.
27
+ */
5
28
  export declare function roundRectSegments(w: number, h: number, r: number): ReadonlyArray<PathSegment>;
@@ -1,8 +1,22 @@
1
1
  import { PathBuilder } from "./vector.js";
2
2
  //#region src/core/arc-to-bezier.ts
3
+ /**
4
+ * Point on an axis-aligned ellipse at angle θ (radians, CCW from +x): returns
5
+ * `[cx + rx·cosθ, cy + ry·sinθ]`.
6
+ */
3
7
  function arcPoint(cx, cy, rx, ry, angleRad) {
4
8
  return [cx + rx * Math.cos(angleRad), cy + ry * Math.sin(angleRad)];
5
9
  }
10
+ /**
11
+ * Decompose an arc into cubic segments, ≤90° each. Returns ONLY `cubic`
12
+ * segments — the pen is assumed to already sit at the arc's start point
13
+ * (`arcPoint(..., startAngleRad)`); the caller emits a leading move/line.
14
+ * Degenerate input (non-positive radius or zero sweep) yields no segments,
15
+ * so no NaN can reach the serializer.
16
+ *
17
+ * @param startAngleRad Start angle in radians (CCW from +x).
18
+ * @param sweepAngleRad Signed angular extent in radians (sign = winding direction).
19
+ */
6
20
  function arcToBeziers(cx, cy, rx, ry, startAngleRad, sweepAngleRad) {
7
21
  const segments = [];
8
22
  if (!(rx > 0) || !(ry > 0) || sweepAngleRad === 0 || !Number.isFinite(sweepAngleRad)) return segments;
@@ -29,6 +43,10 @@ function arcToBeziers(cx, cy, rx, ry, startAngleRad, sweepAngleRad) {
29
43
  }
30
44
  return segments;
31
45
  }
46
+ /**
47
+ * Full ellipse inscribed in the `(0,0)`–`(w,h)` box, as a closed path. Starts at
48
+ * the rightmost point and sweeps a full turn CCW.
49
+ */
32
50
  function ellipseSegments(w, h) {
33
51
  const rx = w / 2;
34
52
  const ry = h / 2;
@@ -37,6 +55,11 @@ function ellipseSegments(w, h) {
37
55
  const start = arcPoint(cx, cy, rx, ry, 0);
38
56
  return new PathBuilder().moveTo(start[0], start[1]).append(arcToBeziers(cx, cy, rx, ry, 0, 2 * Math.PI)).close().build().segments;
39
57
  }
58
+ /**
59
+ * Rounded rectangle in the `(0,0)`–`(w,h)` box (y-up) with uniform corner radius
60
+ * `r` (clamped to half the shorter side). Traversed CCW: bottom edge → BR corner
61
+ * → right edge → TR corner → top edge → TL corner → left edge → BL corner.
62
+ */
40
63
  function roundRectSegments(w, h, r) {
41
64
  const rr = Math.max(0, Math.min(r, Math.min(w, h) / 2));
42
65
  const b = new PathBuilder();
@@ -1,9 +1,35 @@
1
1
  import { BidiClass } from './char-types.js';
2
+ /** Base paragraph direction: explicit `'ltr'`/`'rtl'`, or `'auto'` to derive it from the first strong character (P2/P3). */
2
3
  export type Direction = 'ltr' | 'rtl' | 'auto';
4
+ /** The result of {@link computeBidi}: per-code-point embedding levels, the paragraph base level, and the final working types. */
3
5
  export interface BidiResult {
6
+ /** One entry per input code point. */
4
7
  readonly levels: ReadonlyArray<number>;
8
+ /** The resolved paragraph embedding level (0 = LTR, 1 = RTL). */
5
9
  readonly paragraphLevel: number;
10
+ /** Working types after all resolution (useful for tests / debugging). */
6
11
  readonly types: ReadonlyArray<BidiClass>;
7
12
  }
13
+ /**
14
+ * Run the full UAX #9 Bidirectional Algorithm over a sequence of code points and
15
+ * return the resolved embedding levels. Applies, in order: P2/P3 (paragraph
16
+ * level), X1–X8 (explicit levels & directions, including isolates), X9 (remove
17
+ * explicit format/BN chars from rule processing), X10/BD13 (isolating run
18
+ * sequences), W1–W7, N0–N2, I1–I2 and L1. L2 reordering is left to the caller
19
+ * via {@link reorderVisual}.
20
+ *
21
+ * @param codePoints The paragraph's code points, in logical order.
22
+ * @param dir The base direction; `'auto'` derives the paragraph level from
23
+ * the first strong character.
24
+ * @returns The {@link BidiResult} (levels, paragraph level, final working types).
25
+ */
8
26
  export declare function computeBidi(codePoints: ReadonlyArray<number>, dir: Direction): BidiResult;
27
+ /**
28
+ * Rule L2 — given the resolved levels for a (sub)range, return the visual order
29
+ * as a permutation `visual[k] = logical index`. Reverses contiguous runs from the
30
+ * highest level down to the lowest odd level.
31
+ *
32
+ * @param levels One resolved embedding level per position, in logical order.
33
+ * @returns The visual order as a permutation where `result[k]` is the logical index at visual position `k`.
34
+ */
9
35
  export declare function reorderVisual(levels: ReadonlyArray<number>): Array<number>;
@@ -25,6 +25,19 @@ function computeBaseLevel(types, start, end) {
25
25
  }
26
26
  return 0;
27
27
  }
28
+ /**
29
+ * Run the full UAX #9 Bidirectional Algorithm over a sequence of code points and
30
+ * return the resolved embedding levels. Applies, in order: P2/P3 (paragraph
31
+ * level), X1–X8 (explicit levels & directions, including isolates), X9 (remove
32
+ * explicit format/BN chars from rule processing), X10/BD13 (isolating run
33
+ * sequences), W1–W7, N0–N2, I1–I2 and L1. L2 reordering is left to the caller
34
+ * via {@link reorderVisual}.
35
+ *
36
+ * @param codePoints The paragraph's code points, in logical order.
37
+ * @param dir The base direction; `'auto'` derives the paragraph level from
38
+ * the first strong character.
39
+ * @returns The {@link BidiResult} (levels, paragraph level, final working types).
40
+ */
28
41
  function computeBidi(codePoints, dir) {
29
42
  const n = codePoints.length;
30
43
  const origTypes = new Array(n);
@@ -421,6 +434,14 @@ function applyL1(origTypes, types, levels, paragraphLevel) {
421
434
  j--;
422
435
  }
423
436
  }
437
+ /**
438
+ * Rule L2 — given the resolved levels for a (sub)range, return the visual order
439
+ * as a permutation `visual[k] = logical index`. Reverses contiguous runs from the
440
+ * highest level down to the lowest odd level.
441
+ *
442
+ * @param levels One resolved embedding level per position, in logical order.
443
+ * @returns The visual order as a permutation where `result[k]` is the logical index at visual position `k`.
444
+ */
424
445
  function reorderVisual(levels) {
425
446
  const n = levels.length;
426
447
  const order = Array.from({ length: n }, (_, i) => i);
@@ -1,2 +1,19 @@
1
+ /**
2
+ * Unicode UAX #9 Bidi_Class values, grouped as in the spec: strong (`L`, `R`,
3
+ * `AL`), weak (`EN`/`ES`/`ET`/`AN`/`CS`/`NSM`/`BN`), neutral (`B`/`S`/`WS`/`ON`)
4
+ * and explicit formatting (`LRE`…`PDI`). Only the classes used by the scripts we
5
+ * target (Latin, Hebrew, Arabic) plus the shared punctuation/format characters
6
+ * are produced; everything else defaults to `L`.
7
+ */
1
8
  export type BidiClass = 'L' | 'R' | 'AL' | 'EN' | 'ES' | 'ET' | 'AN' | 'CS' | 'NSM' | 'BN' | 'B' | 'S' | 'WS' | 'ON' | 'LRE' | 'LRO' | 'RLE' | 'RLO' | 'PDF' | 'LRI' | 'RLI' | 'FSI' | 'PDI';
9
+ /**
10
+ * Classify a code point into its UAX #9 {@link BidiClass}. Explicit single code
11
+ * points are checked first (highest precedence), then the ordered, non-overlapping
12
+ * ranges (first match wins). Code points outside every listed range default to
13
+ * `L`, the correct default for the CJK / symbol / private-use blocks we do not
14
+ * yet shape specially.
15
+ *
16
+ * @param cp The Unicode code point.
17
+ * @returns The character's bidirectional class.
18
+ */
2
19
  export declare function bidiClass(cp: number): BidiClass;
@@ -429,6 +429,16 @@ var RANGES = [
429
429
  cls: "ON"
430
430
  }
431
431
  ];
432
+ /**
433
+ * Classify a code point into its UAX #9 {@link BidiClass}. Explicit single code
434
+ * points are checked first (highest precedence), then the ordered, non-overlapping
435
+ * ranges (first match wins). Code points outside every listed range default to
436
+ * `L`, the correct default for the CJK / symbol / private-use blocks we do not
437
+ * yet shape specially.
438
+ *
439
+ * @param cp The Unicode code point.
440
+ * @returns The character's bidirectional class.
441
+ */
432
442
  function bidiClass(cp) {
433
443
  const single = SINGLE.get(cp);
434
444
  if (single !== void 0) return single;
@@ -3,14 +3,56 @@ export type { Direction, BidiResult } from './algorithm.js';
3
3
  export type { BidiClass } from './char-types.js';
4
4
  export { computeBidi, reorderVisual } from './algorithm.js';
5
5
  export { bidiClass } from './char-types.js';
6
+ /** The result of {@link analyzeString}: per-code-point embedding levels for a string plus its paragraph base level. */
6
7
  export interface StringBidi {
8
+ /**
9
+ * Embedding level per *code point* (not per UTF-16 unit). Index aligns with
10
+ * `[...string]` iteration order.
11
+ */
7
12
  readonly levels: ReadonlyArray<number>;
13
+ /** The string's code points, in logical order (parallel to `levels`). */
8
14
  readonly codePoints: ReadonlyArray<number>;
15
+ /** The resolved paragraph embedding level (0 = LTR, 1 = RTL). */
9
16
  readonly paragraphLevel: number;
10
17
  }
18
+ /**
19
+ * Run the UAX #9 algorithm over a string, returning per-code-point embedding
20
+ * levels and the paragraph base level. Iterates by code point so surrogate pairs
21
+ * stay intact and the result indices align with `[...text]`.
22
+ *
23
+ * @param text The paragraph text.
24
+ * @param dir The base direction; `'auto'` (the default) derives it from the
25
+ * first strong character (P2/P3).
26
+ * @returns The {@link StringBidi} levels for `text`.
27
+ */
11
28
  export declare function analyzeString(text: string, dir?: Direction): StringBidi;
29
+ /**
30
+ * Whether a string contains any character that could trigger RTL reordering
31
+ * (`R` or `AL` strong types, or Arabic/Hebrew presentation forms). Used as a fast
32
+ * gate so pure-LTR paragraphs skip the BiDi machinery entirely.
33
+ *
34
+ * @param text The string to scan.
35
+ * @returns `true` if any code point falls in the Hebrew/Arabic/Syriac/Thaana/NKo
36
+ * or Arabic presentation-form ranges.
37
+ */
12
38
  export declare function hasBidiCharacters(text: string): boolean;
39
+ /**
40
+ * Reverse a string by code point (so surrogate pairs stay intact). Used to emit
41
+ * an RTL run's glyphs in visual (right-to-left) order, since our glyph placement
42
+ * advances left-to-right.
43
+ *
44
+ * @param text The string to reverse.
45
+ * @returns `text` with its code points in reverse order.
46
+ */
13
47
  export declare function reverseByCodePoint(text: string): string;
48
+ /**
49
+ * Given the embedding levels for a contiguous array of *tokens* (each token
50
+ * carrying a single resolved level), return the visual order as a permutation of
51
+ * token indices. A thin token-granularity wrapper over {@link reorderVisual} (L2).
52
+ *
53
+ * @param tokenLevels One resolved embedding level per token, in logical order.
54
+ * @returns The visual order as a permutation where `result[k]` is the logical token index.
55
+ */
14
56
  export declare function reorderTokens(tokenLevels: ReadonlyArray<number>): Array<number>;
15
57
  export { segmentLevels } from './segments.js';
16
58
  export type { BidiSegment } from './segments.js';
@@ -2,6 +2,16 @@ import "./char-types.js";
2
2
  import { computeBidi } from "./algorithm.js";
3
3
  import "./segments.js";
4
4
  //#region src/core/bidi/index.ts
5
+ /**
6
+ * Run the UAX #9 algorithm over a string, returning per-code-point embedding
7
+ * levels and the paragraph base level. Iterates by code point so surrogate pairs
8
+ * stay intact and the result indices align with `[...text]`.
9
+ *
10
+ * @param text The paragraph text.
11
+ * @param dir The base direction; `'auto'` (the default) derives it from the
12
+ * first strong character (P2/P3).
13
+ * @returns The {@link StringBidi} levels for `text`.
14
+ */
5
15
  function analyzeString(text, dir = "auto") {
6
16
  const codePoints = [];
7
17
  for (const ch of text) codePoints.push(ch.codePointAt(0));
@@ -12,6 +22,15 @@ function analyzeString(text, dir = "auto") {
12
22
  paragraphLevel
13
23
  };
14
24
  }
25
+ /**
26
+ * Whether a string contains any character that could trigger RTL reordering
27
+ * (`R` or `AL` strong types, or Arabic/Hebrew presentation forms). Used as a fast
28
+ * gate so pure-LTR paragraphs skip the BiDi machinery entirely.
29
+ *
30
+ * @param text The string to scan.
31
+ * @returns `true` if any code point falls in the Hebrew/Arabic/Syriac/Thaana/NKo
32
+ * or Arabic presentation-form ranges.
33
+ */
15
34
  function hasBidiCharacters(text) {
16
35
  for (const ch of text) {
17
36
  const cp = ch.codePointAt(0);
@@ -19,6 +38,14 @@ function hasBidiCharacters(text) {
19
38
  }
20
39
  return false;
21
40
  }
41
+ /**
42
+ * Reverse a string by code point (so surrogate pairs stay intact). Used to emit
43
+ * an RTL run's glyphs in visual (right-to-left) order, since our glyph placement
44
+ * advances left-to-right.
45
+ *
46
+ * @param text The string to reverse.
47
+ * @returns `text` with its code points in reverse order.
48
+ */
22
49
  function reverseByCodePoint(text) {
23
50
  return [...text].reverse().join("");
24
51
  }
@@ -1,6 +1,28 @@
1
+ /**
2
+ * One piece of a paragraph handed to {@link segmentLevels}: a plain text run, or
3
+ * an atomic object (inline image / math box). A segment may carry a run-level
4
+ * direction override, applied via explicit RLE/LRE…PDF wrapping.
5
+ */
1
6
  export interface BidiSegment {
7
+ /** Text content; ignored when `object` is true. */
2
8
  readonly text: string;
9
+ /** Atomic neutral object (inline image / math box) — counts as ONE position. */
3
10
  readonly object?: boolean;
11
+ /** Run-level direction override (`w:rtl`). */
4
12
  readonly rtl?: boolean;
5
13
  }
14
+ /**
15
+ * Resolve UAX #9 embedding levels for a paragraph described as a flat list of
16
+ * {@link BidiSegment}s, returning one level per "real" position: one per text
17
+ * code point, one per object. Carries the explicit-formatting protocol: an `rtl`
18
+ * segment is wrapped in RLE…PDF (an LTR segment inside an RTL paragraph in
19
+ * LRE…PDF) so run-level direction overrides neutral resolution, and each object
20
+ * participates as U+FFFC (Object Replacement Character). The inserted control
21
+ * characters are not reflected in the output — their levels are projected back
22
+ * onto the real positions only.
23
+ *
24
+ * @param segments The paragraph's segments, in logical order.
25
+ * @param baseDir The paragraph base direction.
26
+ * @returns One embedding level per real position (text code point or object).
27
+ */
6
28
  export declare function segmentLevels(segments: ReadonlyArray<BidiSegment>, baseDir: 'ltr' | 'rtl'): Array<number>;
@@ -4,6 +4,20 @@ var OBJECT_REPLACEMENT = 65532;
4
4
  var RLE = 8235;
5
5
  var PDF_FMT = 8236;
6
6
  var LRE = 8234;
7
+ /**
8
+ * Resolve UAX #9 embedding levels for a paragraph described as a flat list of
9
+ * {@link BidiSegment}s, returning one level per "real" position: one per text
10
+ * code point, one per object. Carries the explicit-formatting protocol: an `rtl`
11
+ * segment is wrapped in RLE…PDF (an LTR segment inside an RTL paragraph in
12
+ * LRE…PDF) so run-level direction overrides neutral resolution, and each object
13
+ * participates as U+FFFC (Object Replacement Character). The inserted control
14
+ * characters are not reflected in the output — their levels are projected back
15
+ * onto the real positions only.
16
+ *
17
+ * @param segments The paragraph's segments, in logical order.
18
+ * @param baseDir The paragraph base direction.
19
+ * @returns One embedding level per real position (text code point or object).
20
+ */
7
21
  function segmentLevels(segments, baseDir) {
8
22
  const bidiCps = [];
9
23
  const realIndexOfBidi = [];
@@ -1,2 +1,22 @@
1
+ /**
2
+ * Base64-encode raw bytes for `data:` URIs (the svg + html writers). `btoa` is
3
+ * available in browsers, workers and Node 16+; chunking keeps the intermediate
4
+ * binary string small.
5
+ */
1
6
  export declare function toBase64(bytes: Uint8Array): string;
7
+ /**
8
+ * Naive scan for an ASCII `needle` inside raw `haystack` bytes — used by reader
9
+ * sniffs to spot OPC part names (e.g. `'word/document.xml'`) without unzipping.
10
+ */
11
+ /**
12
+ * Scan raw package bytes for an OPC part name (e.g. `'xl/workbook.xml'`)
13
+ * without unzipping — the reader sniffs' cheap format probe. Accepts both the
14
+ * spec's `/` separator and the `\` that Windows producers write.
15
+ */
16
+ export declare function bytesIncludePartName(haystack: Uint8Array, partName: string): boolean;
17
+ /**
18
+ * Naive scan for an ASCII `needle` inside raw `haystack` bytes. Prefer
19
+ * {@link bytesIncludePartName} for OPC part names — it also accepts the
20
+ * backslash spelling real archives use.
21
+ */
2
22
  export declare function bytesInclude(haystack: Uint8Array, needle: string): boolean;
@@ -1,9 +1,32 @@
1
1
  //#region src/core/bytes.ts
2
+ /**
3
+ * Base64-encode raw bytes for `data:` URIs (the svg + html writers). `btoa` is
4
+ * available in browsers, workers and Node 16+; chunking keeps the intermediate
5
+ * binary string small.
6
+ */
2
7
  function toBase64(bytes) {
3
8
  let bin = "";
4
9
  for (const b of bytes) bin += String.fromCharCode(b);
5
10
  return btoa(bin);
6
11
  }
12
+ /**
13
+ * Naive scan for an ASCII `needle` inside raw `haystack` bytes — used by reader
14
+ * sniffs to spot OPC part names (e.g. `'word/document.xml'`) without unzipping.
15
+ */
16
+ /**
17
+ * Scan raw package bytes for an OPC part name (e.g. `'xl/workbook.xml'`)
18
+ * without unzipping — the reader sniffs' cheap format probe. Accepts both the
19
+ * spec's `/` separator and the `\` that Windows producers write.
20
+ */
21
+ function bytesIncludePartName(haystack, partName) {
22
+ if (bytesInclude(haystack, partName)) return true;
23
+ return partName.includes("/") && bytesInclude(haystack, partName.replace(/\//g, "\\"));
24
+ }
25
+ /**
26
+ * Naive scan for an ASCII `needle` inside raw `haystack` bytes. Prefer
27
+ * {@link bytesIncludePartName} for OPC part names — it also accepts the
28
+ * backslash spelling real archives use.
29
+ */
7
30
  function bytesInclude(haystack, needle) {
8
31
  const n = new TextEncoder().encode(needle);
9
32
  outer: for (let i = 0; i + n.length <= haystack.length; i++) {
@@ -13,4 +36,4 @@ function bytesInclude(haystack, needle) {
13
36
  return false;
14
37
  }
15
38
  //#endregion
16
- export { bytesInclude, toBase64 };
39
+ export { bytesInclude, bytesIncludePartName, toBase64 };
@@ -6,6 +6,7 @@ import { FontProvider } from '../fonts/provider.js';
6
6
  import { Loss, LossReport } from '../ir/index.js';
7
7
  import { FontBytesByVariant } from '../font/index.js';
8
8
  import { ProjectSheetOptions } from '../../excel/sheet-to-flow.js';
9
+ /** Options for a {@link Converter.convert} call (extends the docx PDF options). */
9
10
  export interface ConvertOptions extends ConvertDocxOptions {
10
11
  /**
11
12
  * Target: 'pdf' (default), 'svg' (page-stack preview), 'html'/'docx' (flowed),
@@ -33,25 +34,61 @@ export interface ConvertOptions extends ConvertDocxOptions {
33
34
  */
34
35
  readonly fontProviders?: ReadonlyArray<FontProvider>;
35
36
  }
37
+ /** The output of a conversion: the encoded bytes and the accumulated losses. */
36
38
  export interface ConvertResult {
39
+ /** The encoded output bytes (PDF / SVG / HTML / DOCX / XLSX). */
37
40
  readonly bytes: Uint8Array;
41
+ /** Every {@link Loss} recorded while reading the source and writing the target. */
38
42
  readonly losses: LossReport;
39
43
  }
44
+ /**
45
+ * One of the source IR trees a reader yields. The render path is {@link FlowDoc},
46
+ * so a {@link SheetDoc} is projected to a FlowDoc at the boundary (E-SHEET SB1);
47
+ * the discriminant `kind` selects the projection and a FlowDoc passes through.
48
+ */
40
49
  export type SourceDoc = FlowDoc | SheetDoc;
50
+ /**
51
+ * Normalize a {@link SourceDoc} to a {@link FlowDoc}: a {@link SheetDoc} is run
52
+ * through the print-model projection; a FlowDoc passes through unchanged.
53
+ *
54
+ * @param doc The reader's native tree.
55
+ * @param options Projection options (e.g. the `now` reference date).
56
+ * @returns The flow tree the render path consumes.
57
+ */
41
58
  export declare function toFlowDoc(doc: SourceDoc, options?: ProjectSheetOptions): FlowDoc;
59
+ /** A registry-driven converter: readers → layout → writers (ir-design §7). */
42
60
  export interface Converter {
43
61
  /** The registered readers, in sniffing order. */
44
62
  readonly readers: ReadonlyArray<DocumentReader<SourceDoc>>;
45
63
  /** Detect the input format by reader sniffing; undefined when unknown. */
46
64
  detect: (bytes: Uint8Array) => DocumentReader<SourceDoc> | undefined;
65
+ /** Read the bytes and convert them to the requested target (default `'pdf'`). */
47
66
  convert: (bytes: Uint8Array, options?: ConvertOptions) => Promise<ConvertResult>;
48
67
  }
68
+ /** Options for {@link createConverter}. */
49
69
  export interface CreateConverterOptions {
50
- /** Override / extend the reader registry (defaults to docx + xlsx). */
70
+ /** Override / extend the reader registry (defaults to {@link DEFAULT_READERS}). */
51
71
  readonly readers?: ReadonlyArray<DocumentReader<SourceDoc>>;
52
72
  }
73
+ /** The built-in readers, in sniffing order: docx, doc, xlsx, xls, pptx, ppt, pdf. */
53
74
  export declare const DEFAULT_READERS: ReadonlyArray<DocumentReader<SourceDoc>>;
75
+ /**
76
+ * Build a {@link Converter} over a reader registry. The async boundary (font
77
+ * fetching) lives here; readers and writers stay synchronous.
78
+ *
79
+ * @param opts Optional reader-registry override.
80
+ * @returns A converter exposing `readers`, `detect` and `convert`.
81
+ */
54
82
  export declare function createConverter(opts?: CreateConverterOptions): Converter;
83
+ /**
84
+ * Resolve the regular/bold/italic/bold-italic variants of the document-default
85
+ * family through a {@link FontProvider} chain. A `remote` or `local` winner is
86
+ * reported as a substitution {@link Loss}.
87
+ *
88
+ * @param providers The provider chain, highest priority first.
89
+ * @returns The resolved font bytes (present when the regular variant resolves)
90
+ * and an optional substitution loss.
91
+ */
55
92
  export declare function resolveFontsViaChain(providers: ReadonlyArray<FontProvider>): Promise<{
56
93
  fonts?: FontBytesByVariant;
57
94
  loss?: Loss;
@@ -22,6 +22,14 @@ import { xlsReader } from "../../excel/xls/xls-reader.js";
22
22
  import { pptReader } from "../../pptx/ppt/ppt-reader.js";
23
23
  import { pdfReader } from "../../pdf-reader/reader.js";
24
24
  //#region src/core/converter/facade.ts
25
+ /**
26
+ * Normalize a {@link SourceDoc} to a {@link FlowDoc}: a {@link SheetDoc} is run
27
+ * through the print-model projection; a FlowDoc passes through unchanged.
28
+ *
29
+ * @param doc The reader's native tree.
30
+ * @param options Projection options (e.g. the `now` reference date).
31
+ * @returns The flow tree the render path consumes.
32
+ */
25
33
  function toFlowDoc(doc, options = {}) {
26
34
  return doc.kind === "sheet" ? projectSheetDoc(doc, options) : doc;
27
35
  }
@@ -32,6 +40,7 @@ function readToFlow(reader, bytes, options = {}) {
32
40
  losses
33
41
  };
34
42
  }
43
+ /** The built-in readers, in sniffing order: docx, doc, xlsx, xls, pptx, ppt, pdf. */
35
44
  var DEFAULT_READERS = [
36
45
  docxReader,
37
46
  docReader,
@@ -41,6 +50,13 @@ var DEFAULT_READERS = [
41
50
  pptReader,
42
51
  pdfReader
43
52
  ];
53
+ /**
54
+ * Build a {@link Converter} over a reader registry. The async boundary (font
55
+ * fetching) lives here; readers and writers stay synchronous.
56
+ *
57
+ * @param opts Optional reader-registry override.
58
+ * @returns A converter exposing `readers`, `detect` and `convert`.
59
+ */
44
60
  function createConverter(opts = {}) {
45
61
  const readers = opts.readers ?? DEFAULT_READERS;
46
62
  const detect = (bytes) => readers.find((r) => r.sniff(bytes));
@@ -137,6 +153,15 @@ async function renderSheetReaderToPdf(reader, bytes, conv, now) {
137
153
  ...conv.section ? { section: conv.section } : {}
138
154
  });
139
155
  }
156
+ /**
157
+ * Resolve the regular/bold/italic/bold-italic variants of the document-default
158
+ * family through a {@link FontProvider} chain. A `remote` or `local` winner is
159
+ * reported as a substitution {@link Loss}.
160
+ *
161
+ * @param providers The provider chain, highest priority first.
162
+ * @returns The resolved font bytes (present when the regular variant resolves)
163
+ * and an optional substitution loss.
164
+ */
140
165
  async function resolveFontsViaChain(providers) {
141
166
  const chain = chainProviders(providers);
142
167
  const ask = (bold, italic) => chain.resolve({
@@ -1,4 +1,16 @@
1
1
  import { FlowDoc } from '../ir/flow.js';
2
2
  import { StyledRenderOptions } from '../../pdf/index.js';
3
+ /** Styled-render options projected from a {@link FlowDoc} (everything but the font `registry`). */
3
4
  export type FlowRenderOptions = Omit<StyledRenderOptions, 'registry'>;
5
+ /**
6
+ * Project a {@link FlowDoc} to the {@link StyledRenderOptions} the layout/PDF path
7
+ * consumes (minus the font `registry`, which the caller supplies). This is the
8
+ * single owner of the field-by-field mapping the converters and the facade used
9
+ * to repeat by hand. Key presence is significant — the conditional spreads are
10
+ * semantics, not style.
11
+ *
12
+ * @param flow The parsed interlayer.
13
+ * @returns The render options, threading the document's own sections,
14
+ * header/footer bands, notes, resources, charts, fonts and language.
15
+ */
4
16
  export declare function flowRenderOptions(flow: FlowDoc): FlowRenderOptions;
@@ -1,6 +1,17 @@
1
1
  import { EMPTY_STYLE_SHEET } from "../style-cascade/resolver.js";
2
2
  import "../style-cascade/index.js";
3
3
  //#region src/core/converter/project.ts
4
+ /**
5
+ * Project a {@link FlowDoc} to the {@link StyledRenderOptions} the layout/PDF path
6
+ * consumes (minus the font `registry`, which the caller supplies). This is the
7
+ * single owner of the field-by-field mapping the converters and the facade used
8
+ * to repeat by hand. Key presence is significant — the conditional spreads are
9
+ * semantics, not style.
10
+ *
11
+ * @param flow The parsed interlayer.
12
+ * @returns The render options, threading the document's own sections,
13
+ * header/footer bands, notes, resources, charts, fonts and language.
14
+ */
4
15
  function flowRenderOptions(flow) {
5
16
  return {
6
17
  styles: EMPTY_STYLE_SHEET,