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
@@ -7,33 +7,140 @@ import { DocumentReader } from '../ir/adapters.js';
7
7
  import { FlowDoc } from '../ir/flow.js';
8
8
  import { SheetDoc } from '../ir/sheet.js';
9
9
  import { SignatureOptions, StyledRenderOptions } from '../../pdf/index.js';
10
+ /** The output formats {@link Ream.convert} can produce. */
10
11
  export type ReamTarget = 'pdf' | 'svg' | 'html' | 'docx' | 'xlsx';
12
+ /** Options for {@link Ream.parse}. */
11
13
  export interface ReamParseOptions {
14
+ /** Reader registry override; defaults to the built-in docx + xlsx readers. */
12
15
  readonly readers?: ReadonlyArray<DocumentReader<SourceDoc>>;
16
+ /**
17
+ * The user password for an encrypted PDF source (ISO 32000 §7.6). Defaults to
18
+ * the empty string, which opens the common permissions-only encryption (EP14).
19
+ */
13
20
  readonly password?: string;
14
21
  }
22
+ /**
23
+ * Options for {@link Ream.convert} and {@link Ream.convertWithReport}. Extends
24
+ * the low-level {@link StyledRenderOptions} (minus the font `registry` and
25
+ * `styles`, which Ream builds itself) with font resolution and source-touching
26
+ * conveniences.
27
+ */
15
28
  export interface ReamConvertOptions extends Omit<StyledRenderOptions, 'registry' | 'styles'> {
29
+ /** Explicit font bytes per variant (regular/bold/italic/bold-italic). */
16
30
  readonly fonts?: FontBytesByVariant;
31
+ /** Shorthand for supplying a single regular-variant font as raw bytes. */
17
32
  readonly fontBytes?: Uint8Array;
33
+ /** Substitute family hint for the auto-download path. */
18
34
  readonly fontFamily?: string;
35
+ /** Injectable `fetch` for the auto-download path (defaults to the global `fetch`). */
19
36
  readonly fontFetch?: FetchLike;
37
+ /**
38
+ * Font resolution chain (caller/embedded/local/remote), used when neither
39
+ * `fonts` nor `fontBytes` is given. A remote or local winner records a
40
+ * substitution {@link Loss}.
41
+ */
20
42
  readonly fontProviders?: ReadonlyArray<FontProvider>;
43
+ /** Throw {@link ConversionLossError} on the first loss instead of reporting it. */
21
44
  readonly strict?: boolean;
45
+ /** PDF/A-3 only: embed the parsed source file (`/AFRelationship /Source`). */
22
46
  readonly embedSource?: boolean;
47
+ /** Digitally sign the output (ISO 32000 §12.8, WebCrypto). */
23
48
  readonly signature?: SignatureOptions;
49
+ /**
50
+ * Reference date for spreadsheet conditional-format `timePeriod` rules and for
51
+ * `TODAY()`/`NOW()` in `expression` rules (E-SHEET W9). Supplying it re-projects
52
+ * a spreadsheet source so those clock-relative rules resolve against this date —
53
+ * an explicit input, never the wall clock. Omitted, they no-op and the output is
54
+ * unchanged.
55
+ */
24
56
  readonly now?: Date;
25
57
  }
58
+ /**
59
+ * The object face of the library: parse a document once into the format-neutral
60
+ * {@link FlowDoc} interlayer, then convert it to any number of targets without
61
+ * re-reading the source.
62
+ *
63
+ * ```ts
64
+ * const doc = Ream.parse(bytes); // sniff → reader → FlowDoc
65
+ * const pdf = await doc.convert('pdf', { fonts });
66
+ * const svg = await doc.convert('svg', { fonts });
67
+ * ```
68
+ *
69
+ * It is a thin GRASP Controller: readers parse, `flowRenderOptions` projects the
70
+ * FlowDoc, and layout/emit plus the writers do the work. As a deliberate
71
+ * composition root, importing it pulls in every format module — prefer the
72
+ * per-format functions when bundle size matters more than convenience. The
73
+ * source bytes are retained only for the two source-touching features: docx
74
+ * substitute-font auto-detection and PDF/A-3 `embedSource`.
75
+ */
26
76
  export declare class Ream {
27
77
  readonly flow: FlowDoc;
28
78
  readonly sheet: SheetDoc | undefined;
29
79
  readonly losses: ReadonlyArray<Loss>;
30
80
  private readonly source;
31
81
  private readonly readerId;
82
+ /**
83
+ * @param flow The interlayer — the parsed, format-neutral document tree.
84
+ * @param sheet The native SpreadsheetML tree when the source is a spreadsheet
85
+ * (xlsx); {@link Ream.flow} is its projection through the print model.
86
+ * @param losses Losses recorded while reading the source.
87
+ * @param source The original source bytes (kept only for docx auto-fonts and
88
+ * PDF/A-3 `embedSource`).
89
+ * @param readerId The id of the reader that parsed the source.
90
+ */
32
91
  private constructor();
92
+ /**
93
+ * Sniff the format and parse the bytes once into the {@link FlowDoc} interlayer.
94
+ *
95
+ * @param bytes The raw document bytes; the format is detected by sniffing.
96
+ * @param options Optional reader-registry override and/or password for an
97
+ * encrypted source.
98
+ * @returns A reusable {@link Ream} instance.
99
+ * @throws Error when no registered reader recognizes the bytes.
100
+ */
33
101
  static parse(bytes: Uint8Array, options?: ReamParseOptions): Ream;
102
+ /** The source format id (`'docx'`, `'xlsx'`, …). */
34
103
  get format(): string;
104
+ /**
105
+ * Convert the parsed document to `to` and return just the output bytes. A thin
106
+ * wrapper over {@link Ream.convertWithReport} that drops the loss report.
107
+ *
108
+ * @param to The target format.
109
+ * @param options Font resolution and target-specific options.
110
+ * @returns The encoded output bytes.
111
+ */
35
112
  convert(to: ReamTarget, options?: ReamConvertOptions): Promise<Uint8Array>;
113
+ /**
114
+ * Convert the parsed document to `to`, returning the output bytes together with
115
+ * the accumulated {@link Loss} report (read-time losses plus any added while
116
+ * writing). HTML, DOCX and XLSX are produced straight from the interlayer — no
117
+ * layout, no fonts, zero I/O; SVG and PDF run the layout engine and resolve
118
+ * fonts first.
119
+ *
120
+ * @param to The target format. `'xlsx'` requires a spreadsheet source.
121
+ * @param options Font resolution and target-specific options.
122
+ * @returns The encoded bytes and the loss report.
123
+ * @throws Error when `to` is `'xlsx'` but the source has no grid.
124
+ * @throws ConversionLossError when `options.strict` is set and any loss was recorded.
125
+ */
36
126
  convertWithReport(to: ReamTarget, options?: ReamConvertOptions): Promise<ConvertResult>;
127
+ /**
128
+ * Resolve the font set for a layout/PDF conversion. Explicit `fonts`/`fontBytes`
129
+ * win; otherwise the provider chain is tried, then an open substitute set is
130
+ * auto-downloaded (per detected family for docx). Any substitution is appended
131
+ * to `losses`.
132
+ *
133
+ * @param options The convert options carrying the font preferences.
134
+ * @param losses The mutable loss list a substitution is appended to.
135
+ * @returns The font bytes and, for docx, optional per-family registries.
136
+ */
37
137
  private resolveFonts;
138
+ /**
139
+ * In strict mode, throw {@link ConversionLossError} for the first recorded loss.
140
+ *
141
+ * @param options The convert options (checked for `strict`).
142
+ * @param losses The losses accumulated so far.
143
+ * @throws ConversionLossError when `options.strict` is set and `losses` is non-empty.
144
+ */
38
145
  private enforceStrict;
39
146
  }
@@ -14,6 +14,7 @@ import { writeSvg } from "../../svg/svg-writer.js";
14
14
  import { resolveDocxAutoFonts } from "../../word/docx-to-pdf.js";
15
15
  import { DEFAULT_READERS, resolveFontsViaChain, toFlowDoc } from "./facade.js";
16
16
  //#region src/core/converter/ream.ts
17
+ /** OOXML / legacy MIME types by reader id, for the PDF/A-3 embedded source file. */
17
18
  var SOURCE_MIME = {
18
19
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
19
20
  doc: "application/msword",
@@ -23,7 +24,34 @@ var SOURCE_MIME = {
23
24
  ppt: "application/vnd.ms-powerpoint",
24
25
  pdf: "application/pdf"
25
26
  };
27
+ /**
28
+ * The object face of the library: parse a document once into the format-neutral
29
+ * {@link FlowDoc} interlayer, then convert it to any number of targets without
30
+ * re-reading the source.
31
+ *
32
+ * ```ts
33
+ * const doc = Ream.parse(bytes); // sniff → reader → FlowDoc
34
+ * const pdf = await doc.convert('pdf', { fonts });
35
+ * const svg = await doc.convert('svg', { fonts });
36
+ * ```
37
+ *
38
+ * It is a thin GRASP Controller: readers parse, `flowRenderOptions` projects the
39
+ * FlowDoc, and layout/emit plus the writers do the work. As a deliberate
40
+ * composition root, importing it pulls in every format module — prefer the
41
+ * per-format functions when bundle size matters more than convenience. The
42
+ * source bytes are retained only for the two source-touching features: docx
43
+ * substitute-font auto-detection and PDF/A-3 `embedSource`.
44
+ */
26
45
  var Ream = class Ream {
46
+ /**
47
+ * @param flow The interlayer — the parsed, format-neutral document tree.
48
+ * @param sheet The native SpreadsheetML tree when the source is a spreadsheet
49
+ * (xlsx); {@link Ream.flow} is its projection through the print model.
50
+ * @param losses Losses recorded while reading the source.
51
+ * @param source The original source bytes (kept only for docx auto-fonts and
52
+ * PDF/A-3 `embedSource`).
53
+ * @param readerId The id of the reader that parsed the source.
54
+ */
27
55
  constructor(flow, sheet, losses, source, readerId) {
28
56
  this.flow = flow;
29
57
  this.sheet = sheet;
@@ -31,6 +59,15 @@ var Ream = class Ream {
31
59
  this.source = source;
32
60
  this.readerId = readerId;
33
61
  }
62
+ /**
63
+ * Sniff the format and parse the bytes once into the {@link FlowDoc} interlayer.
64
+ *
65
+ * @param bytes The raw document bytes; the format is detected by sniffing.
66
+ * @param options Optional reader-registry override and/or password for an
67
+ * encrypted source.
68
+ * @returns A reusable {@link Ream} instance.
69
+ * @throws Error when no registered reader recognizes the bytes.
70
+ */
34
71
  static parse(bytes, options = {}) {
35
72
  const readers = options.readers ?? DEFAULT_READERS;
36
73
  const reader = readers.find((r) => r.sniff(bytes));
@@ -39,12 +76,34 @@ var Ream = class Ream {
39
76
  const sheet = doc.kind === "sheet" ? doc : void 0;
40
77
  return new Ream(toFlowDoc(doc), sheet, losses, bytes, reader.id);
41
78
  }
79
+ /** The source format id (`'docx'`, `'xlsx'`, …). */
42
80
  get format() {
43
81
  return this.readerId;
44
82
  }
83
+ /**
84
+ * Convert the parsed document to `to` and return just the output bytes. A thin
85
+ * wrapper over {@link Ream.convertWithReport} that drops the loss report.
86
+ *
87
+ * @param to The target format.
88
+ * @param options Font resolution and target-specific options.
89
+ * @returns The encoded output bytes.
90
+ */
45
91
  async convert(to, options = {}) {
46
92
  return (await this.convertWithReport(to, options)).bytes;
47
93
  }
94
+ /**
95
+ * Convert the parsed document to `to`, returning the output bytes together with
96
+ * the accumulated {@link Loss} report (read-time losses plus any added while
97
+ * writing). HTML, DOCX and XLSX are produced straight from the interlayer — no
98
+ * layout, no fonts, zero I/O; SVG and PDF run the layout engine and resolve
99
+ * fonts first.
100
+ *
101
+ * @param to The target format. `'xlsx'` requires a spreadsheet source.
102
+ * @param options Font resolution and target-specific options.
103
+ * @returns The encoded bytes and the loss report.
104
+ * @throws Error when `to` is `'xlsx'` but the source has no grid.
105
+ * @throws ConversionLossError when `options.strict` is set and any loss was recorded.
106
+ */
48
107
  async convertWithReport(to, options = {}) {
49
108
  const losses = [...this.losses];
50
109
  const flow = this.sheet && options.now ? projectSheetDoc(this.sheet, { now: options.now }) : this.flow;
@@ -120,6 +179,16 @@ var Ream = class Ream {
120
179
  losses
121
180
  };
122
181
  }
182
+ /**
183
+ * Resolve the font set for a layout/PDF conversion. Explicit `fonts`/`fontBytes`
184
+ * win; otherwise the provider chain is tried, then an open substitute set is
185
+ * auto-downloaded (per detected family for docx). Any substitution is appended
186
+ * to `losses`.
187
+ *
188
+ * @param options The convert options carrying the font preferences.
189
+ * @param losses The mutable loss list a substitution is appended to.
190
+ * @returns The font bytes and, for docx, optional per-family registries.
191
+ */
123
192
  async resolveFonts(options, losses) {
124
193
  const explicit = options.fonts ?? (options.fontBytes ? { regular: options.fontBytes } : void 0);
125
194
  if (explicit) return { fonts: explicit };
@@ -134,6 +203,13 @@ var Ream = class Ream {
134
203
  ...options.fontFetch ? { fetch: options.fontFetch } : {}
135
204
  }) };
136
205
  }
206
+ /**
207
+ * In strict mode, throw {@link ConversionLossError} for the first recorded loss.
208
+ *
209
+ * @param options The convert options (checked for `strict`).
210
+ * @param losses The losses accumulated so far.
211
+ * @throws ConversionLossError when `options.strict` is set and `losses` is non-empty.
212
+ */
137
213
  enforceStrict(options, losses) {
138
214
  if (options.strict && losses.length > 0) throw new ConversionLossError(losses[0]);
139
215
  }
@@ -1,22 +1,99 @@
1
+ /**
2
+ * Concatenate a list of byte arrays into a single {@link Uint8Array}.
3
+ *
4
+ * @param arrays The arrays to join, in order.
5
+ * @returns A new array holding every input back to back.
6
+ */
1
7
  export declare function concat(arrays: ReadonlyArray<Uint8Array>): Uint8Array;
8
+ /**
9
+ * Tag-length-value: wrap `content` in an identifier octet + definite-form length.
10
+ *
11
+ * @param tag The identifier octet (tag class + constructed bit + number).
12
+ * @param content The already-encoded value bytes.
13
+ * @returns The complete `tag || length || content` encoding.
14
+ */
2
15
  export declare function tlv(tag: number, content: Uint8Array): Uint8Array;
16
+ /** SEQUENCE (tag `0x30`) wrapping the concatenated `items`. */
3
17
  export declare const seq: (...items: Array<Uint8Array>) => Uint8Array;
18
+ /** SET (tag `0x31`) wrapping the concatenated `items`. */
4
19
  export declare const set: (...items: Array<Uint8Array>) => Uint8Array;
20
+ /** OCTET STRING (tag `0x04`) wrapping raw `bytes`. */
5
21
  export declare const octetString: (bytes: Uint8Array) => Uint8Array;
22
+ /** NULL (tag `0x05`, empty content). */
6
23
  export declare const nullValue: () => Uint8Array;
24
+ /** `[n]` context-tag, constructed (EXPLICIT or IMPLICIT-over-constructed). */
7
25
  export declare const explicit: (tagNum: number, content: Uint8Array) => Uint8Array;
26
+ /**
27
+ * Encode a dotted OBJECT IDENTIFIER (§8.19). The first two arcs fold into
28
+ * `40*a + b`; each subsequent arc is base-128 big-endian.
29
+ *
30
+ * @param dotted The OID in dotted form, e.g. `"1.2.840.113549.1.7.2"`.
31
+ * @returns The OID TLV (tag `0x06`).
32
+ */
8
33
  export declare function oid(dotted: string): Uint8Array;
34
+ /**
35
+ * Encode an INTEGER (§8.3) in minimal two's-complement form. Accepts a small
36
+ * non-negative number or raw magnitude bytes; prepends `0x00` when the top bit
37
+ * is set so the value stays positive.
38
+ *
39
+ * @param value A non-negative number, or big-endian magnitude bytes.
40
+ * @returns The INTEGER TLV (tag `0x02`).
41
+ */
9
42
  export declare function integer(value: number | Uint8Array): Uint8Array;
43
+ /**
44
+ * Encode a CMS Time (RFC 5652 §11.3): `UTCTime` (`YYMMDDHHMMSSZ`) for years
45
+ * 1950–2049, `GeneralizedTime` (`YYYYMMDDHHMMSSZ`) otherwise.
46
+ *
47
+ * @param d The instant to encode (formatted in UTC).
48
+ * @returns The time TLV (tag `0x17` or `0x18`).
49
+ */
10
50
  export declare function cmsTime(d: Date): Uint8Array;
51
+ /**
52
+ * The sorted, concatenated content of a `SET OF` (§11.6) — without the outer
53
+ * tag, so the same canonical body can be wrapped once as SET (`0x31`, for
54
+ * signing) and once as `[0]` IMPLICIT (`0xa0`, inside the `SignerInfo`).
55
+ *
56
+ * @param items The set members (each a full DER encoding).
57
+ * @returns The members sorted ascending by encoding and concatenated.
58
+ */
11
59
  export declare function setOfBody(items: ReadonlyArray<Uint8Array>): Uint8Array;
60
+ /** A parsed DER tag-length-value, as byte offsets into the source buffer. */
12
61
  export interface Tlv {
62
+ /** The identifier octet. */
13
63
  readonly tag: number;
64
+ /** Offset of the first content byte. */
14
65
  readonly contentStart: number;
66
+ /** Offset one past the last content byte. */
15
67
  readonly contentEnd: number;
68
+ /** Offset one past the whole TLV (same as `contentEnd` for definite lengths). */
16
69
  readonly end: number;
17
70
  }
71
+ /**
72
+ * Parse the immediate child TLVs of a constructed `parent`, in order.
73
+ *
74
+ * @param buf The buffer the offsets index into.
75
+ * @param parent The constructed TLV whose content is walked.
76
+ * @returns Each child {@link Tlv}, left to right.
77
+ */
18
78
  export declare function children(buf: Uint8Array, parent: Tlv): Array<Tlv>;
79
+ /**
80
+ * Read a single TLV header at `offset`, decoding short- and long-form lengths.
81
+ *
82
+ * @param buf The source buffer.
83
+ * @param offset The offset of the identifier octet.
84
+ * @returns The parsed {@link Tlv} (offsets relative to `buf`).
85
+ */
19
86
  export declare function readTlv(buf: Uint8Array, offset: number): Tlv;
87
+ /**
88
+ * Pull the issuer Name and serialNumber out of an X.509 certificate, as raw DER
89
+ * TLV slices (verbatim, for the CMS `IssuerAndSerialNumber`).
90
+ *
91
+ * `Certificate ::= SEQ { tbsCertificate SEQ { [0] version?, serialNumber INTEGER,
92
+ * signature AlgId, issuer Name, ... }, ... }`.
93
+ *
94
+ * @param cert The DER-encoded certificate.
95
+ * @returns The `issuer` Name and `serial` INTEGER, each a verbatim DER slice.
96
+ */
20
97
  export declare function certIssuerAndSerial(cert: Uint8Array): {
21
98
  readonly issuer: Uint8Array;
22
99
  readonly serial: Uint8Array;
@@ -1,5 +1,11 @@
1
1
  //#region src/core/crypto/asn1.ts
2
2
  var textEncoder = new TextEncoder();
3
+ /**
4
+ * Concatenate a list of byte arrays into a single {@link Uint8Array}.
5
+ *
6
+ * @param arrays The arrays to join, in order.
7
+ * @returns A new array holding every input back to back.
8
+ */
3
9
  function concat(arrays) {
4
10
  let total = 0;
5
11
  for (const a of arrays) total += a.length;
@@ -21,6 +27,13 @@ function encodeLength(len) {
21
27
  }
22
28
  return new Uint8Array([128 | bytes.length, ...bytes]);
23
29
  }
30
+ /**
31
+ * Tag-length-value: wrap `content` in an identifier octet + definite-form length.
32
+ *
33
+ * @param tag The identifier octet (tag class + constructed bit + number).
34
+ * @param content The already-encoded value bytes.
35
+ * @returns The complete `tag || length || content` encoding.
36
+ */
24
37
  function tlv(tag, content) {
25
38
  const len = encodeLength(content.length);
26
39
  const out = new Uint8Array(1 + len.length + content.length);
@@ -29,10 +42,15 @@ function tlv(tag, content) {
29
42
  out.set(content, 1 + len.length);
30
43
  return out;
31
44
  }
45
+ /** SEQUENCE (tag `0x30`) wrapping the concatenated `items`. */
32
46
  var seq = (...items) => tlv(48, concat(items));
47
+ /** SET (tag `0x31`) wrapping the concatenated `items`. */
33
48
  var set = (...items) => tlv(49, concat(items));
49
+ /** OCTET STRING (tag `0x04`) wrapping raw `bytes`. */
34
50
  var octetString = (bytes) => tlv(4, bytes);
51
+ /** NULL (tag `0x05`, empty content). */
35
52
  var nullValue = () => tlv(5, new Uint8Array(0));
53
+ /** `[n]` context-tag, constructed (EXPLICIT or IMPLICIT-over-constructed). */
36
54
  var explicit = (tagNum, content) => tlv(160 | tagNum, content);
37
55
  function base128(v) {
38
56
  const out = [v & 127];
@@ -43,12 +61,27 @@ function base128(v) {
43
61
  }
44
62
  return out;
45
63
  }
64
+ /**
65
+ * Encode a dotted OBJECT IDENTIFIER (§8.19). The first two arcs fold into
66
+ * `40*a + b`; each subsequent arc is base-128 big-endian.
67
+ *
68
+ * @param dotted The OID in dotted form, e.g. `"1.2.840.113549.1.7.2"`.
69
+ * @returns The OID TLV (tag `0x06`).
70
+ */
46
71
  function oid(dotted) {
47
72
  const parts = dotted.split(".").map((p) => Number(p));
48
73
  const body = [...base128(40 * parts[0] + parts[1])];
49
74
  for (let i = 2; i < parts.length; i++) body.push(...base128(parts[i]));
50
75
  return tlv(6, new Uint8Array(body));
51
76
  }
77
+ /**
78
+ * Encode an INTEGER (§8.3) in minimal two's-complement form. Accepts a small
79
+ * non-negative number or raw magnitude bytes; prepends `0x00` when the top bit
80
+ * is set so the value stays positive.
81
+ *
82
+ * @param value A non-negative number, or big-endian magnitude bytes.
83
+ * @returns The INTEGER TLV (tag `0x02`).
84
+ */
52
85
  function integer(value) {
53
86
  let bytes;
54
87
  if (typeof value === "number") {
@@ -68,6 +101,13 @@ function integer(value) {
68
101
  return tlv(2, new Uint8Array(bytes));
69
102
  }
70
103
  var pad2 = (n) => n.toString().padStart(2, "0");
104
+ /**
105
+ * Encode a CMS Time (RFC 5652 §11.3): `UTCTime` (`YYMMDDHHMMSSZ`) for years
106
+ * 1950–2049, `GeneralizedTime` (`YYYYMMDDHHMMSSZ`) otherwise.
107
+ *
108
+ * @param d The instant to encode (formatted in UTC).
109
+ * @returns The time TLV (tag `0x17` or `0x18`).
110
+ */
71
111
  function cmsTime(d) {
72
112
  const y = d.getUTCFullYear();
73
113
  const mmddhhmmss = pad2(d.getUTCMonth() + 1) + pad2(d.getUTCDate()) + pad2(d.getUTCHours()) + pad2(d.getUTCMinutes()) + pad2(d.getUTCSeconds());
@@ -79,9 +119,24 @@ function compareDer(a, b) {
79
119
  for (let i = 0; i < n; i++) if (a[i] !== b[i]) return a[i] - b[i];
80
120
  return a.length - b.length;
81
121
  }
122
+ /**
123
+ * The sorted, concatenated content of a `SET OF` (§11.6) — without the outer
124
+ * tag, so the same canonical body can be wrapped once as SET (`0x31`, for
125
+ * signing) and once as `[0]` IMPLICIT (`0xa0`, inside the `SignerInfo`).
126
+ *
127
+ * @param items The set members (each a full DER encoding).
128
+ * @returns The members sorted ascending by encoding and concatenated.
129
+ */
82
130
  function setOfBody(items) {
83
131
  return concat([...items].sort(compareDer));
84
132
  }
133
+ /**
134
+ * Read a single TLV header at `offset`, decoding short- and long-form lengths.
135
+ *
136
+ * @param buf The source buffer.
137
+ * @param offset The offset of the identifier octet.
138
+ * @returns The parsed {@link Tlv} (offsets relative to `buf`).
139
+ */
85
140
  function readTlv(buf, offset) {
86
141
  const tag = buf[offset];
87
142
  let i = offset + 1;
@@ -102,6 +157,16 @@ function readTlv(buf, offset) {
102
157
  end: i + len
103
158
  };
104
159
  }
160
+ /**
161
+ * Pull the issuer Name and serialNumber out of an X.509 certificate, as raw DER
162
+ * TLV slices (verbatim, for the CMS `IssuerAndSerialNumber`).
163
+ *
164
+ * `Certificate ::= SEQ { tbsCertificate SEQ { [0] version?, serialNumber INTEGER,
165
+ * signature AlgId, issuer Name, ... }, ... }`.
166
+ *
167
+ * @param cert The DER-encoded certificate.
168
+ * @returns The `issuer` Name and `serial` INTEGER, each a verbatim DER slice.
169
+ */
105
170
  function certIssuerAndSerial(cert) {
106
171
  let p = readTlv(cert, readTlv(cert, 0).contentStart).contentStart;
107
172
  let t = readTlv(cert, p);
@@ -1,9 +1,34 @@
1
+ /** Inputs to {@link buildPkcs7Detached} for a detached PDF signature. */
1
2
  export interface CmsParams {
3
+ /**
4
+ * Signer's X.509 certificate (DER). Included in the CMS so a verifier can
5
+ * build the trust path; its issuer + serial identify the signer.
6
+ */
2
7
  readonly certificate: Uint8Array;
8
+ /** Optional additional chain certificates (DER), e.g. intermediates. */
3
9
  readonly extraCertificates?: ReadonlyArray<Uint8Array>;
10
+ /** SHA-256 digest of the signed PDF byte range (the detached content). */
4
11
  readonly messageDigest: Uint8Array;
5
12
  readonly signingTime: Date;
13
+ /**
14
+ * Public-key algorithm of the signer's key (default `'rsa'`). Selects the
15
+ * `SignerInfo` signatureAlgorithm (`rsaEncryption` vs `ecdsa-with-SHA256`); the
16
+ * digest stays SHA-256 either way.
17
+ */
6
18
  readonly signatureAlgorithm?: 'rsa' | 'ecdsa';
19
+ /**
20
+ * Signs the DER of the `signedAttrs` over SHA-256. For `'rsa'` this is
21
+ * RSASSA-PKCS1-v1_5; for `'ecdsa'` it must return a DER `Ecdsa-Sig-Value`
22
+ * (`SEQUENCE { r INTEGER, s INTEGER }`), not the raw r‖s.
23
+ */
7
24
  readonly sign: (signedAttrsDer: Uint8Array) => Promise<Uint8Array>;
8
25
  }
26
+ /**
27
+ * Build a complete CMS `ContentInfo` (`id-signedData`) wrapping a single
28
+ * `SignerInfo` with authenticated attributes (`contentType`, `messageDigest`,
29
+ * `signingTime`). Detached: the signed PDF bytes are not carried in the CMS.
30
+ *
31
+ * @param params The certificate(s), message digest, signing time and sign callback.
32
+ * @returns The DER-encoded PKCS#7 blob for the signature dictionary's `/Contents`.
33
+ */
9
34
  export declare function buildPkcs7Detached(params: CmsParams): Promise<Uint8Array>;
@@ -14,6 +14,14 @@ var sha256AlgId = () => seq(oid(OID.sha256));
14
14
  var rsaAlgId = () => seq(oid(OID.rsaEncryption), nullValue());
15
15
  var ecdsaAlgId = () => seq(oid(OID.ecdsaWithSHA256));
16
16
  var attribute = (oidStr, value) => seq(oid(oidStr), set(value));
17
+ /**
18
+ * Build a complete CMS `ContentInfo` (`id-signedData`) wrapping a single
19
+ * `SignerInfo` with authenticated attributes (`contentType`, `messageDigest`,
20
+ * `signingTime`). Detached: the signed PDF bytes are not carried in the CMS.
21
+ *
22
+ * @param params The certificate(s), message digest, signing time and sign callback.
23
+ * @returns The DER-encoded PKCS#7 blob for the signature dictionary's `/Contents`.
24
+ */
17
25
  async function buildPkcs7Detached(params) {
18
26
  const { issuer, serial } = certIssuerAndSerial(params.certificate);
19
27
  const attrsBody = setOfBody([
@@ -1 +1,8 @@
1
+ /**
2
+ * The typed document model — the OOXML-faithful node types (paragraphs, runs,
3
+ * tables, sections, drawings, charts, math) that the readers populate and the
4
+ * writers consume. Imported via the `reamkit/document-model` subpath.
5
+ *
6
+ * @packageDocumentation
7
+ */
1
8
  export type { AbstractNumbering, Alignment, Border, BorderStyle, BodyElement, Comment, CellBorders, CellMerge, DocumentInfo, CellMargins, CellProperties, CellShading, CellDataBar, CellIcon, CellIconShape, CellSparkline, Chart, ChartBlock, ChartDataPoint, ChartSeries, ChartType, CustomGeometry, CustomPathCmd, DocumentModel, FontFamilyMap, HeaderFooterReference, HeaderFooterType, ImageBlock, InlineImage, MathAccent, MathBar, MathDelimiter, MathEqArray, MathFraction, MathFunc, MathGroupChr, MathLimit, MathMatrix, MathNary, MathNode, MathRadical, MathRow, MathRun, MathScript, Numbering, NumberingFormat, NumberingInstance, NumberingLevel, NumberingReference, PageMargins, PageSize, Paragraph, ParagraphProperties, Run, RunProperties, RowProperties, Section, FloatAnchor, SectionColumns, SectionProperties, ShapeBlock, ShapeDash, ShapeFill, ShapeFillKind, ShapeGeometry, ShapeLine, ShapeTextBody, ShapeTransform, Style, StyleSheet, StyleType, Table, TableCell, TableLook, TableProperties, TableStyleCondition, TableStyleConditionType, TableStyleLayer, TableRow, UnderlineStyle, VerticalAlign, } from './types.js';