@rentnerkev/pdf 0.0.0-stage → 0.1.1

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 (355) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +135 -2
  3. package/THIRD_PARTY_NOTICES.md +152 -0
  4. package/dist/components/Types/host.d.ts +3 -0
  5. package/dist/components/Types/host.d.ts.map +1 -0
  6. package/dist/components/Types/host.js +2 -0
  7. package/dist/components/Types/host.js.map +1 -0
  8. package/dist/components/Types/props.d.ts +504 -0
  9. package/dist/components/Types/props.d.ts.map +1 -0
  10. package/dist/components/Types/props.js +2 -0
  11. package/dist/components/Types/props.js.map +1 -0
  12. package/dist/components/components.d.ts +87 -0
  13. package/dist/components/components.d.ts.map +1 -0
  14. package/dist/components/components.js +86 -0
  15. package/dist/components/components.js.map +1 -0
  16. package/dist/components/host.d.ts +7 -0
  17. package/dist/components/host.d.ts.map +1 -0
  18. package/dist/components/host.js +15 -0
  19. package/dist/components/host.js.map +1 -0
  20. package/dist/engine/Types/backend.d.ts +120 -0
  21. package/dist/engine/Types/backend.d.ts.map +1 -0
  22. package/dist/engine/Types/backend.js +2 -0
  23. package/dist/engine/Types/backend.js.map +1 -0
  24. package/dist/engine/Types/engine.d.ts +192 -0
  25. package/dist/engine/Types/engine.d.ts.map +1 -0
  26. package/dist/engine/Types/engine.js +2 -0
  27. package/dist/engine/Types/engine.js.map +1 -0
  28. package/dist/engine/Types/errors.d.ts +16 -0
  29. package/dist/engine/Types/errors.d.ts.map +1 -0
  30. package/dist/engine/Types/errors.js +2 -0
  31. package/dist/engine/Types/errors.js.map +1 -0
  32. package/dist/engine/Types/limits.d.ts +55 -0
  33. package/dist/engine/Types/limits.d.ts.map +1 -0
  34. package/dist/engine/Types/limits.js +2 -0
  35. package/dist/engine/Types/limits.js.map +1 -0
  36. package/dist/engine/Types/render-options.d.ts +71 -0
  37. package/dist/engine/Types/render-options.d.ts.map +1 -0
  38. package/dist/engine/Types/render-options.js +2 -0
  39. package/dist/engine/Types/render-options.js.map +1 -0
  40. package/dist/engine/Types/render-result.d.ts +80 -0
  41. package/dist/engine/Types/render-result.d.ts.map +1 -0
  42. package/dist/engine/Types/render-result.js +2 -0
  43. package/dist/engine/Types/render-result.js.map +1 -0
  44. package/dist/engine/abort.d.ts +23 -0
  45. package/dist/engine/abort.d.ts.map +1 -0
  46. package/dist/engine/abort.js +71 -0
  47. package/dist/engine/abort.js.map +1 -0
  48. package/dist/engine/assets.d.ts +22 -0
  49. package/dist/engine/assets.d.ts.map +1 -0
  50. package/dist/engine/assets.js +40 -0
  51. package/dist/engine/assets.js.map +1 -0
  52. package/dist/engine/backend.d.ts +16 -0
  53. package/dist/engine/backend.d.ts.map +1 -0
  54. package/dist/engine/backend.js +43 -0
  55. package/dist/engine/backend.js.map +1 -0
  56. package/dist/engine/backends/native.d.ts +11 -0
  57. package/dist/engine/backends/native.d.ts.map +1 -0
  58. package/dist/engine/backends/native.js +62 -0
  59. package/dist/engine/backends/native.js.map +1 -0
  60. package/dist/engine/backends/wasm.d.ts +16 -0
  61. package/dist/engine/backends/wasm.d.ts.map +1 -0
  62. package/dist/engine/backends/wasm.js +216 -0
  63. package/dist/engine/backends/wasm.js.map +1 -0
  64. package/dist/engine/channel.d.ts +41 -0
  65. package/dist/engine/channel.d.ts.map +1 -0
  66. package/dist/engine/channel.js +140 -0
  67. package/dist/engine/channel.js.map +1 -0
  68. package/dist/engine/create-engine.d.ts +8 -0
  69. package/dist/engine/create-engine.d.ts.map +1 -0
  70. package/dist/engine/create-engine.js +120 -0
  71. package/dist/engine/create-engine.js.map +1 -0
  72. package/dist/engine/default-fonts.d.ts +9 -0
  73. package/dist/engine/default-fonts.d.ts.map +1 -0
  74. package/dist/engine/default-fonts.js +42 -0
  75. package/dist/engine/default-fonts.js.map +1 -0
  76. package/dist/engine/encode.d.ts +9 -0
  77. package/dist/engine/encode.d.ts.map +1 -0
  78. package/dist/engine/encode.js +199 -0
  79. package/dist/engine/encode.js.map +1 -0
  80. package/dist/engine/errors.d.ts +37 -0
  81. package/dist/engine/errors.d.ts.map +1 -0
  82. package/dist/engine/errors.js +71 -0
  83. package/dist/engine/errors.js.map +1 -0
  84. package/dist/engine/fonts.d.ts +9 -0
  85. package/dist/engine/fonts.d.ts.map +1 -0
  86. package/dist/engine/fonts.js +14 -0
  87. package/dist/engine/fonts.js.map +1 -0
  88. package/dist/engine/lifecycle.d.ts +40 -0
  89. package/dist/engine/lifecycle.d.ts.map +1 -0
  90. package/dist/engine/lifecycle.js +104 -0
  91. package/dist/engine/lifecycle.js.map +1 -0
  92. package/dist/engine/markup.d.ts +13 -0
  93. package/dist/engine/markup.d.ts.map +1 -0
  94. package/dist/engine/markup.js +14 -0
  95. package/dist/engine/markup.js.map +1 -0
  96. package/dist/engine/options.d.ts +12 -0
  97. package/dist/engine/options.d.ts.map +1 -0
  98. package/dist/engine/options.js +71 -0
  99. package/dist/engine/options.js.map +1 -0
  100. package/dist/engine/pdf-bytes.d.ts +8 -0
  101. package/dist/engine/pdf-bytes.d.ts.map +1 -0
  102. package/dist/engine/pdf-bytes.js +9 -0
  103. package/dist/engine/pdf-bytes.js.map +1 -0
  104. package/dist/engine/prepare.d.ts +17 -0
  105. package/dist/engine/prepare.d.ts.map +1 -0
  106. package/dist/engine/prepare.js +44 -0
  107. package/dist/engine/prepare.js.map +1 -0
  108. package/dist/engine/render-many.d.ts +14 -0
  109. package/dist/engine/render-many.d.ts.map +1 -0
  110. package/dist/engine/render-many.js +156 -0
  111. package/dist/engine/render-many.js.map +1 -0
  112. package/dist/engine/render-result.d.ts +12 -0
  113. package/dist/engine/render-result.d.ts.map +1 -0
  114. package/dist/engine/render-result.js +62 -0
  115. package/dist/engine/render-result.js.map +1 -0
  116. package/dist/engine/render-stream.d.ts +7 -0
  117. package/dist/engine/render-stream.d.ts.map +1 -0
  118. package/dist/engine/render-stream.js +56 -0
  119. package/dist/engine/render-stream.js.map +1 -0
  120. package/dist/engine/render.d.ts +15 -0
  121. package/dist/engine/render.d.ts.map +1 -0
  122. package/dist/engine/render.js +23 -0
  123. package/dist/engine/render.js.map +1 -0
  124. package/dist/fonts/NotoSans-Bold.ttf +0 -0
  125. package/dist/fonts/NotoSans-BoldItalic.ttf +0 -0
  126. package/dist/fonts/NotoSans-Italic.ttf +0 -0
  127. package/dist/fonts/NotoSans-Regular.ttf +0 -0
  128. package/dist/fonts/OFL.txt +94 -0
  129. package/dist/fonts/sources.json +32 -0
  130. package/dist/index.d.ts +26 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +11 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/ir/Types/input.d.ts +111 -0
  135. package/dist/ir/Types/input.d.ts.map +1 -0
  136. package/dist/ir/Types/input.js +2 -0
  137. package/dist/ir/Types/input.js.map +1 -0
  138. package/dist/ir/factories.d.ts +108 -0
  139. package/dist/ir/factories.d.ts.map +1 -0
  140. package/dist/ir/factories.js +410 -0
  141. package/dist/ir/factories.js.map +1 -0
  142. package/dist/ir/ir.generated.d.ts +811 -0
  143. package/dist/ir/ir.generated.d.ts.map +1 -0
  144. package/dist/ir/ir.generated.js +4 -0
  145. package/dist/ir/ir.generated.js.map +1 -0
  146. package/dist/ir/version.d.ts +9 -0
  147. package/dist/ir/version.d.ts.map +1 -0
  148. package/dist/ir/version.js +13 -0
  149. package/dist/ir/version.js.map +1 -0
  150. package/dist/jsx/Types/context.d.ts +24 -0
  151. package/dist/jsx/Types/context.d.ts.map +1 -0
  152. package/dist/jsx/Types/context.js +2 -0
  153. package/dist/jsx/Types/context.js.map +1 -0
  154. package/dist/jsx/Types/element.d.ts +30 -0
  155. package/dist/jsx/Types/element.d.ts.map +1 -0
  156. package/dist/jsx/Types/element.js +2 -0
  157. package/dist/jsx/Types/element.js.map +1 -0
  158. package/dist/jsx/Types/evaluate.d.ts +61 -0
  159. package/dist/jsx/Types/evaluate.d.ts.map +1 -0
  160. package/dist/jsx/Types/evaluate.js +2 -0
  161. package/dist/jsx/Types/evaluate.js.map +1 -0
  162. package/dist/jsx/Types/jsx.d.ts +16 -0
  163. package/dist/jsx/Types/jsx.d.ts.map +1 -0
  164. package/dist/jsx/Types/jsx.js +2 -0
  165. package/dist/jsx/Types/jsx.js.map +1 -0
  166. package/dist/jsx/context.d.ts +21 -0
  167. package/dist/jsx/context.d.ts.map +1 -0
  168. package/dist/jsx/context.js +49 -0
  169. package/dist/jsx/context.js.map +1 -0
  170. package/dist/jsx/element.d.ts +10 -0
  171. package/dist/jsx/element.d.ts.map +1 -0
  172. package/dist/jsx/element.js +19 -0
  173. package/dist/jsx/element.js.map +1 -0
  174. package/dist/jsx/evaluate.d.ts +16 -0
  175. package/dist/jsx/evaluate.d.ts.map +1 -0
  176. package/dist/jsx/evaluate.js +616 -0
  177. package/dist/jsx/evaluate.js.map +1 -0
  178. package/dist/jsx/source.d.ts +13 -0
  179. package/dist/jsx/source.d.ts.map +1 -0
  180. package/dist/jsx/source.js +49 -0
  181. package/dist/jsx/source.js.map +1 -0
  182. package/dist/jsx-dev-runtime.d.ts +9 -0
  183. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  184. package/dist/jsx-dev-runtime.js +24 -0
  185. package/dist/jsx-dev-runtime.js.map +1 -0
  186. package/dist/jsx-runtime.d.ts +12 -0
  187. package/dist/jsx-runtime.d.ts.map +1 -0
  188. package/dist/jsx-runtime.js +15 -0
  189. package/dist/jsx-runtime.js.map +1 -0
  190. package/dist/native/binding.generated.d.ts +227 -0
  191. package/dist/native/loader.d.ts +22 -0
  192. package/dist/native/loader.d.ts.map +1 -0
  193. package/dist/native/loader.js +98 -0
  194. package/dist/native/loader.js.map +1 -0
  195. package/dist/native/rentnerpdf.linux-arm64-gnu.node +0 -0
  196. package/dist/native/rentnerpdf.linux-arm64-musl.node +0 -0
  197. package/dist/native/rentnerpdf.linux-x64-gnu.node +0 -0
  198. package/dist/native/rentnerpdf.linux-x64-musl.node +0 -0
  199. package/dist/native/rentnerpdf.win32-arm64-msvc.node +0 -0
  200. package/dist/native/rentnerpdf.win32-x64-msvc.node +0 -0
  201. package/dist/node.d.ts +3 -0
  202. package/dist/node.d.ts.map +1 -0
  203. package/dist/node.js +6 -0
  204. package/dist/node.js.map +1 -0
  205. package/dist/react/Types/preview.d.ts +74 -0
  206. package/dist/react/Types/preview.d.ts.map +1 -0
  207. package/dist/react/Types/preview.js +2 -0
  208. package/dist/react/Types/preview.js.map +1 -0
  209. package/dist/react/Types/render.d.ts +24 -0
  210. package/dist/react/Types/render.d.ts.map +1 -0
  211. package/dist/react/Types/render.js +2 -0
  212. package/dist/react/Types/render.js.map +1 -0
  213. package/dist/react/attributes.d.ts +8 -0
  214. package/dist/react/attributes.d.ts.map +1 -0
  215. package/dist/react/attributes.js +44 -0
  216. package/dist/react/attributes.js.map +1 -0
  217. package/dist/react/components.d.ts +60 -0
  218. package/dist/react/components.d.ts.map +1 -0
  219. package/dist/react/components.js +266 -0
  220. package/dist/react/components.js.map +1 -0
  221. package/dist/react/pdf-preview.d.ts +16 -0
  222. package/dist/react/pdf-preview.d.ts.map +1 -0
  223. package/dist/react/pdf-preview.js +26 -0
  224. package/dist/react/pdf-preview.js.map +1 -0
  225. package/dist/react/pdf-render.d.ts +15 -0
  226. package/dist/react/pdf-render.d.ts.map +1 -0
  227. package/dist/react/pdf-render.js +60 -0
  228. package/dist/react/pdf-render.js.map +1 -0
  229. package/dist/react/registry.d.ts +44 -0
  230. package/dist/react/registry.d.ts.map +1 -0
  231. package/dist/react/registry.js +105 -0
  232. package/dist/react/registry.js.map +1 -0
  233. package/dist/react/render.d.ts +36 -0
  234. package/dist/react/render.d.ts.map +1 -0
  235. package/dist/react/render.js +212 -0
  236. package/dist/react/render.js.map +1 -0
  237. package/dist/react/same-document.d.ts +8 -0
  238. package/dist/react/same-document.d.ts.map +1 -0
  239. package/dist/react/same-document.js +59 -0
  240. package/dist/react/same-document.js.map +1 -0
  241. package/dist/react/static.d.ts +13 -0
  242. package/dist/react/static.d.ts.map +1 -0
  243. package/dist/react/static.js +65 -0
  244. package/dist/react/static.js.map +1 -0
  245. package/dist/react/use-pdf.d.ts +25 -0
  246. package/dist/react/use-pdf.d.ts.map +1 -0
  247. package/dist/react/use-pdf.js +59 -0
  248. package/dist/react/use-pdf.js.map +1 -0
  249. package/dist/react.d.ts +9 -0
  250. package/dist/react.d.ts.map +1 -0
  251. package/dist/react.js +10 -0
  252. package/dist/react.js.map +1 -0
  253. package/dist/tailwind/Types/merge-config.d.ts +28 -0
  254. package/dist/tailwind/Types/merge-config.d.ts.map +1 -0
  255. package/dist/tailwind/Types/merge-config.js +2 -0
  256. package/dist/tailwind/Types/merge-config.js.map +1 -0
  257. package/dist/tailwind/merge-config.d.ts +45 -0
  258. package/dist/tailwind/merge-config.d.ts.map +1 -0
  259. package/dist/tailwind/merge-config.js +46 -0
  260. package/dist/tailwind/merge-config.js.map +1 -0
  261. package/dist/tailwind-merge.d.ts +3 -0
  262. package/dist/tailwind-merge.d.ts.map +1 -0
  263. package/dist/tailwind-merge.js +4 -0
  264. package/dist/tailwind-merge.js.map +1 -0
  265. package/dist/tailwind.css +61 -0
  266. package/dist/theme/Types/css-imports.d.ts +38 -0
  267. package/dist/theme/Types/css-imports.d.ts.map +1 -0
  268. package/dist/theme/Types/css-imports.js +2 -0
  269. package/dist/theme/Types/css-imports.js.map +1 -0
  270. package/dist/theme/Types/theme.d.ts +70 -0
  271. package/dist/theme/Types/theme.d.ts.map +1 -0
  272. package/dist/theme/Types/theme.js +2 -0
  273. package/dist/theme/Types/theme.js.map +1 -0
  274. package/dist/theme/Types/warnings.d.ts +9 -0
  275. package/dist/theme/Types/warnings.d.ts.map +1 -0
  276. package/dist/theme/Types/warnings.js +2 -0
  277. package/dist/theme/Types/warnings.js.map +1 -0
  278. package/dist/theme/css-imports.d.ts +11 -0
  279. package/dist/theme/css-imports.d.ts.map +1 -0
  280. package/dist/theme/css-imports.js +138 -0
  281. package/dist/theme/css-imports.js.map +1 -0
  282. package/dist/theme/normalize.d.ts +15 -0
  283. package/dist/theme/normalize.d.ts.map +1 -0
  284. package/dist/theme/normalize.js +51 -0
  285. package/dist/theme/normalize.js.map +1 -0
  286. package/dist/theme/package-imports.d.ts +16 -0
  287. package/dist/theme/package-imports.d.ts.map +1 -0
  288. package/dist/theme/package-imports.js +90 -0
  289. package/dist/theme/package-imports.js.map +1 -0
  290. package/dist/theme/theme-from-css-file.d.ts +35 -0
  291. package/dist/theme/theme-from-css-file.d.ts.map +1 -0
  292. package/dist/theme/theme-from-css-file.js +223 -0
  293. package/dist/theme/theme-from-css-file.js.map +1 -0
  294. package/dist/theme/theme-from-css.d.ts +28 -0
  295. package/dist/theme/theme-from-css.d.ts.map +1 -0
  296. package/dist/theme/theme-from-css.js +62 -0
  297. package/dist/theme/theme-from-css.js.map +1 -0
  298. package/dist/theme/warnings.d.ts +13 -0
  299. package/dist/theme/warnings.d.ts.map +1 -0
  300. package/dist/theme/warnings.js +34 -0
  301. package/dist/theme/warnings.js.map +1 -0
  302. package/dist/vite/Types/plugin.d.ts +47 -0
  303. package/dist/vite/Types/plugin.d.ts.map +1 -0
  304. package/dist/vite/Types/plugin.js +5 -0
  305. package/dist/vite/Types/plugin.js.map +1 -0
  306. package/dist/vite/plugin.d.ts +30 -0
  307. package/dist/vite/plugin.d.ts.map +1 -0
  308. package/dist/vite/plugin.js +80 -0
  309. package/dist/vite/plugin.js.map +1 -0
  310. package/dist/vite.d.ts +3 -0
  311. package/dist/vite.d.ts.map +1 -0
  312. package/dist/vite.js +6 -0
  313. package/dist/vite.js.map +1 -0
  314. package/dist/wasm/binding.generated.d.ts +259 -0
  315. package/dist/wasm/loader.d.ts +17 -0
  316. package/dist/wasm/loader.d.ts.map +1 -0
  317. package/dist/wasm/loader.js +74 -0
  318. package/dist/wasm/loader.js.map +1 -0
  319. package/dist/wasm/pkg/rentnerpdf_wasm.d.ts +259 -0
  320. package/dist/wasm/pkg/rentnerpdf_wasm.js +883 -0
  321. package/dist/wasm/pkg/rentnerpdf_wasm_bg.wasm +0 -0
  322. package/dist/wasm/pkg/rentnerpdf_wasm_bg.wasm.d.ts +40 -0
  323. package/dist/worker/Types/connection.d.ts +25 -0
  324. package/dist/worker/Types/connection.d.ts.map +1 -0
  325. package/dist/worker/Types/connection.js +2 -0
  326. package/dist/worker/Types/connection.js.map +1 -0
  327. package/dist/worker/Types/protocol.d.ts +62 -0
  328. package/dist/worker/Types/protocol.d.ts.map +1 -0
  329. package/dist/worker/Types/protocol.js +2 -0
  330. package/dist/worker/Types/protocol.js.map +1 -0
  331. package/dist/worker/Types/worker-engine.d.ts +91 -0
  332. package/dist/worker/Types/worker-engine.d.ts.map +1 -0
  333. package/dist/worker/Types/worker-engine.js +2 -0
  334. package/dist/worker/Types/worker-engine.js.map +1 -0
  335. package/dist/worker/client.d.ts +20 -0
  336. package/dist/worker/client.d.ts.map +1 -0
  337. package/dist/worker/client.js +131 -0
  338. package/dist/worker/client.js.map +1 -0
  339. package/dist/worker/connection.d.ts +5 -0
  340. package/dist/worker/connection.d.ts.map +1 -0
  341. package/dist/worker/connection.js +119 -0
  342. package/dist/worker/connection.js.map +1 -0
  343. package/dist/worker/protocol.d.ts +24 -0
  344. package/dist/worker/protocol.d.ts.map +1 -0
  345. package/dist/worker/protocol.js +71 -0
  346. package/dist/worker/protocol.js.map +1 -0
  347. package/dist/worker/serve.d.ts +26 -0
  348. package/dist/worker/serve.d.ts.map +1 -0
  349. package/dist/worker/serve.js +119 -0
  350. package/dist/worker/serve.js.map +1 -0
  351. package/dist/worker.d.ts +4 -0
  352. package/dist/worker.d.ts.map +1 -0
  353. package/dist/worker.js +8 -0
  354. package/dist/worker.js.map +1 -0
  355. package/package.json +80 -5
@@ -0,0 +1,62 @@
1
+ import { pdfBytes } from './pdf-bytes.js';
2
+ const warningCodes = new Set([
3
+ 'UNKNOWN_CLASS',
4
+ 'INVALID_VALUE',
5
+ 'UNSUPPORTED_CLASS',
6
+ 'IGNORED_VARIANT',
7
+ 'NO_EFFECT',
8
+ 'INVALID_THEME',
9
+ 'UNKNOWN_ROLE',
10
+ 'MISSING_ALT_TEXT',
11
+ 'MISSING_GLYPH',
12
+ 'UNSUPPORTED_SVG_FEATURE',
13
+ ]);
14
+ export const isWarningCode = (value) => warningCodes.has(value);
15
+ /** Converts a binding's warning; `locate` adds the JSX source of its node. */
16
+ export const toWarning = ({ code, message, path, className, suggestion }, locate) => {
17
+ if (!isWarningCode(code)) {
18
+ throw new TypeError(`unknown warning code from the engine: ${code}`);
19
+ }
20
+ const source = path === undefined ? undefined : locate?.(path);
21
+ return {
22
+ code,
23
+ message,
24
+ ...(path === undefined ? {} : { path }),
25
+ ...(className === undefined ? {} : { className }),
26
+ ...(suggestion === undefined ? {} : { suggestion }),
27
+ ...(source === undefined ? {} : { source }),
28
+ };
29
+ };
30
+ const wrapReasons = new Set([
31
+ 'KEEP_WITH_NEXT',
32
+ 'KEEP_TOGETHER',
33
+ 'KEEP_TOGETHER_TOO_TALL',
34
+ 'WIDOWS_ORPHANS',
35
+ 'DOES_NOT_FIT',
36
+ 'FORCED_OVERSIZE',
37
+ ]);
38
+ const isWrapReason = (value) => wrapReasons.has(value);
39
+ const toDiagnostic = ({ pageIndex, path, reason, message }, locate) => {
40
+ if (!isWrapReason(reason)) {
41
+ throw new TypeError(`unknown wrap reason from the engine: ${reason}`);
42
+ }
43
+ const source = locate?.(path);
44
+ return {
45
+ pageIndex,
46
+ path,
47
+ reason,
48
+ message,
49
+ ...(source === undefined ? {} : { source }),
50
+ };
51
+ };
52
+ /**
53
+ * Converts a binding's result; absent optional fields stay absent. `locate`
54
+ * adds the JSX source of each warning's and diagnostic's node.
55
+ */
56
+ export const toRenderResult = (result, locate) => ({
57
+ pdf: pdfBytes(result.pdf),
58
+ pageCount: result.pageCount,
59
+ warnings: result.warnings.map((warning) => toWarning(warning, locate)),
60
+ diagnostics: result.diagnostics.map((diagnostic) => toDiagnostic(diagnostic, locate)),
61
+ });
62
+ //# sourceMappingURL=render-result.js.map
@@ -0,0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AM,CAAC,CACnC;CACJ,CAAC,CAAA","sourcesContent":["import { pdfBytes } from './pdf-bytes.ts'\nimport type {\n BackendRenderResult,\n BackendWarning,\n BackendWrapDiagnostic,\n} from './Types/backend.ts'\nimport type { SourceLocator } from './Types/errors.ts'\nimport type {\n RenderResult,\n RenderWarning,\n RentnerPdfWarningCode,\n WrapDiagnostic,\n WrapReason,\n} from './Types/render-result.ts'\n\nconst warningCodes: ReadonlySet<string> = new Set<RentnerPdfWarningCode>([\n 'UNKNOWN_CLASS',\n 'INVALID_VALUE',\n 'UNSUPPORTED_CLASS',\n 'IGNORED_VARIANT',\n 'NO_EFFECT',\n 'INVALID_THEME',\n 'UNKNOWN_ROLE',\n 'MISSING_ALT_TEXT',\n 'MISSING_GLYPH',\n 'UNSUPPORTED_SVG_FEATURE',\n])\n\nexport const isWarningCode = (value: string): value is RentnerPdfWarningCode =>\n warningCodes.has(value)\n\n/** Converts a binding's warning; `locate` adds the JSX source of its node. */\nexport const toWarning = (\n { code, message, path, className, suggestion }: BackendWarning,\n locate: SourceLocator | undefined,\n): RenderWarning => {\n if (!isWarningCode(code)) {\n throw new TypeError(`unknown warning code from the engine: ${code}`)\n }\n const source = path === undefined ? undefined : locate?.(path)\n return {\n code,\n message,\n ...(path === undefined ? {} : { path }),\n ...(className === undefined ? {} : { className }),\n ...(suggestion === undefined ? {} : { suggestion }),\n ...(source === undefined ? {} : { source }),\n }\n}\n\nconst wrapReasons: ReadonlySet<string> = new Set<WrapReason>([\n 'KEEP_WITH_NEXT',\n 'KEEP_TOGETHER',\n 'KEEP_TOGETHER_TOO_TALL',\n 'WIDOWS_ORPHANS',\n 'DOES_NOT_FIT',\n 'FORCED_OVERSIZE',\n])\n\nconst isWrapReason = (value: string): value is WrapReason =>\n wrapReasons.has(value)\n\nconst toDiagnostic = (\n { pageIndex, path, reason, message }: BackendWrapDiagnostic,\n locate: SourceLocator | undefined,\n): WrapDiagnostic => {\n if (!isWrapReason(reason)) {\n throw new TypeError(`unknown wrap reason from the engine: ${reason}`)\n }\n const source = locate?.(path)\n return {\n pageIndex,\n path,\n reason,\n message,\n ...(source === undefined ? {} : { source }),\n }\n}\n\n/**\n * Converts a binding's result; absent optional fields stay absent. `locate`\n * adds the JSX source of each warning's and diagnostic's node.\n */\nexport const toRenderResult = (\n result: BackendRenderResult,\n locate?: SourceLocator,\n): RenderResult => ({\n pdf: pdfBytes(result.pdf),\n pageCount: result.pageCount,\n warnings: result.warnings.map((warning) => toWarning(warning, locate)),\n diagnostics: result.diagnostics.map((diagnostic) =>\n toDiagnostic(diagnostic, locate),\n ),\n})\n"]}
@@ -0,0 +1,7 @@
1
+ import type { PdfBytes } from './Types/render-result.ts';
2
+ /**
3
+ * Starts `render` at once and returns its PDF as a stream. `signal` and
4
+ * cancelling the stream both cancel the render.
5
+ */
6
+ export declare function pdfStream(render: (signal: AbortSignal) => Promise<PdfBytes>, signal: AbortSignal | undefined): ReadableStream<Uint8Array<ArrayBuffer>>;
7
+ //# sourceMappingURL=render-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-stream.d.ts","sourceRoot":"","sources":["../../web/src/engine/render-stream.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAKxD;;;GAGG;AACH,wBAAgB,SAAS,CACrB,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,EAClD,MAAM,EAAE,WAAW,GAAG,SAAS,GAChC,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAuCzC"}
@@ -0,0 +1,56 @@
1
+ // `Engine.renderToStream`: the PDF as a `ReadableStream` of chunks. krilla
2
+ // writes the whole document before it returns (D-11), so the render
3
+ // finishes before the first chunk; the stream hands out the finished bytes
4
+ // in chunks without copying them. Writing pages into the stream while they
5
+ // are rendered is planned after 1.0.
6
+ import { abortedError } from './abort.js';
7
+ /** Bytes per chunk: small enough for HTTP responses to start early. */
8
+ const CHUNK_BYTES = 64 * 1024;
9
+ /**
10
+ * Starts `render` at once and returns its PDF as a stream. `signal` and
11
+ * cancelling the stream both cancel the render.
12
+ */
13
+ export function pdfStream(render, signal) {
14
+ const controller = new AbortController();
15
+ const onAbort = () => controller.abort(signal?.reason);
16
+ if (signal?.aborted === true)
17
+ controller.abort(signal.reason);
18
+ else
19
+ signal?.addEventListener('abort', onAbort, { once: true });
20
+ const finish = () => signal?.removeEventListener('abort', onAbort);
21
+ const rendering = render(controller.signal);
22
+ // Read by `pull`; a stream nobody reads must not leave an unhandled
23
+ // rejection behind.
24
+ rendering.catch(() => undefined);
25
+ let offset = 0;
26
+ return new ReadableStream({
27
+ async pull(stream) {
28
+ let pdf;
29
+ try {
30
+ pdf = await rendering;
31
+ }
32
+ catch (error) {
33
+ finish();
34
+ stream.error(error);
35
+ return;
36
+ }
37
+ if (controller.signal.aborted) {
38
+ finish();
39
+ stream.error(abortedError(controller.signal.reason));
40
+ return;
41
+ }
42
+ const end = Math.min(offset + CHUNK_BYTES, pdf.length);
43
+ stream.enqueue(pdf.subarray(offset, end));
44
+ offset = end;
45
+ if (offset >= pdf.length) {
46
+ finish();
47
+ stream.close();
48
+ }
49
+ },
50
+ cancel(reason) {
51
+ finish();
52
+ controller.abort(reason);
53
+ },
54
+ });
55
+ }
56
+ //# sourceMappingURL=render-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-stream.js","sourceRoot":"","sources":["../../web/src/engine/render-stream.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,oEAAoE;AACpE,2EAA2E;AAC3E,2EAA2E;AAC3E,qCAAqC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAGzC,uEAAuE;AACvE,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,CAAA;AAE7B;;;GAGG;AACH,MAAM,UAAU,SAAS,CACrB,MAAkD,EAClD,MAA+B;IAE/B,MAAM,UAAU,GAAG,IAAI,eAAe,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AQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;YACzC,MAAM,GAAG,GAAG,CAAA;YACZ,IAAI,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;gBACvB,MAAM,EAAE,CAAA;gBACR,MAAM,CAAC,KAAK,EAAE,CAAA;YAClB,CAAC;QACL,CAAC;QACD,MAAM,CAAC,MAAM;YACT,MAAM,EAAE,CAAA;YACR,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC;KACJ,CAAC,CAAA;AACN,CAAC","sourcesContent":["// `Engine.renderToStream`: the PDF as a `ReadableStream` of chunks. krilla\n// writes the whole document before it returns (D-11), so the render\n// finishes before the first chunk; the stream hands out the finished bytes\n// in chunks without copying them. Writing pages into the stream while they\n// are rendered is planned after 1.0.\nimport { abortedError } from './abort.ts'\nimport type { PdfBytes } from './Types/render-result.ts'\n\n/** Bytes per chunk: small enough for HTTP responses to start early. */\nconst CHUNK_BYTES = 64 * 1024\n\n/**\n * Starts `render` at once and returns its PDF as a stream. `signal` and\n * cancelling the stream both cancel the render.\n */\nexport function pdfStream(\n render: (signal: AbortSignal) => Promise<PdfBytes>,\n signal: AbortSignal | undefined,\n): ReadableStream<Uint8Array<ArrayBuffer>> {\n const controller = new AbortController()\n const onAbort = (): void => controller.abort(signal?.reason)\n if (signal?.aborted === true) controller.abort(signal.reason)\n else signal?.addEventListener('abort', onAbort, { once: true })\n const finish = (): void => signal?.removeEventListener('abort', onAbort)\n const rendering = render(controller.signal)\n // Read by `pull`; a stream nobody reads must not leave an unhandled\n // rejection behind.\n rendering.catch(() => undefined)\n let offset = 0\n return new ReadableStream<Uint8Array<ArrayBuffer>>({\n async pull(stream) {\n let pdf: PdfBytes\n try {\n pdf = await rendering\n } catch (error) {\n finish()\n stream.error(error)\n return\n }\n if (controller.signal.aborted) {\n finish()\n stream.error(abortedError(controller.signal.reason))\n return\n }\n const end = Math.min(offset + CHUNK_BYTES, pdf.length)\n stream.enqueue(pdf.subarray(offset, end))\n offset = end\n if (offset >= pdf.length) {\n finish()\n stream.close()\n }\n },\n cancel(reason) {\n finish()\n controller.abort(reason)\n },\n })\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { Engine, RenderInput } from './Types/engine.ts';
2
+ import type { RenderOptions } from './Types/render-options.ts';
3
+ import type { PdfBytes } from './Types/render-result.ts';
4
+ /**
5
+ * The default engine, created on first use and reused: the bundled Noto Sans
6
+ * fonts and default options. A failed creation is retried on the next call.
7
+ */
8
+ export declare function getDefaultEngine(): Promise<Engine>;
9
+ /**
10
+ * Renders with a default engine that is created on first use and reused:
11
+ * the bundled Noto Sans fonts and default options. For your own fonts or
12
+ * `strict` mode, create an engine with `createEngine()`.
13
+ */
14
+ export declare function render(input: RenderInput, options?: RenderOptions): Promise<PdfBytes>;
15
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../web/src/engine/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAIxD;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAMlD;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CACxB,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,QAAQ,CAAC,CAGnB"}
@@ -0,0 +1,23 @@
1
+ import { createEngine } from './create-engine.js';
2
+ let defaultEngine;
3
+ /**
4
+ * The default engine, created on first use and reused: the bundled Noto Sans
5
+ * fonts and default options. A failed creation is retried on the next call.
6
+ */
7
+ export function getDefaultEngine() {
8
+ defaultEngine ??= createEngine().catch((error) => {
9
+ defaultEngine = undefined;
10
+ throw error;
11
+ });
12
+ return defaultEngine;
13
+ }
14
+ /**
15
+ * Renders with a default engine that is created on first use and reused:
16
+ * the bundled Noto Sans fonts and default options. For your own fonts or
17
+ * `strict` mode, create an engine with `createEngine()`.
18
+ */
19
+ export async function render(input, options) {
20
+ const engine = await getDefaultEngine();
21
+ return engine.render(input, options);
22
+ }
23
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../web/src/engine/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAKjD,IAAI,aAA0C,CAAA;AAE9C;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC5B,aAAa,KAAK,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACtD,aAAa,GAAG,SAAS,CAAA;QACzB,MAAM,KAAK,CAAA;IACf,CAAC,CAAC,CAAA;IACF,OAAO,aAAa,CAAA;AACxB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CACxB,KAAkB,EAClB,OAAuB;IAEvB,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAA;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACxC,CAAC","sourcesContent":["import { createEngine } from './create-engine.ts'\nimport type { Engine, RenderInput } from './Types/engine.ts'\nimport type { RenderOptions } from './Types/render-options.ts'\nimport type { PdfBytes } from './Types/render-result.ts'\n\nlet defaultEngine: Promise<Engine> | undefined\n\n/**\n * The default engine, created on first use and reused: the bundled Noto Sans\n * fonts and default options. A failed creation is retried on the next call.\n */\nexport function getDefaultEngine(): Promise<Engine> {\n defaultEngine ??= createEngine().catch((error: unknown) => {\n defaultEngine = undefined\n throw error\n })\n return defaultEngine\n}\n\n/**\n * Renders with a default engine that is created on first use and reused:\n * the bundled Noto Sans fonts and default options. For your own fonts or\n * `strict` mode, create an engine with `createEngine()`.\n */\nexport async function render(\n input: RenderInput,\n options?: RenderOptions,\n): Promise<PdfBytes> {\n const engine = await getDefaultEngine()\n return engine.render(input, options)\n}\n"]}
Binary file
Binary file
Binary file
@@ -0,0 +1,94 @@
1
+ Copyright 2022 The Noto Project Authors (https://github.com/notofonts/)
2
+
3
+ This Font Software is licensed under the SIL Open Font License,
4
+ Version 1.1.
5
+
6
+ This license is copied below, and is also available with a FAQ at:
7
+ http://scripts.sil.org/OFL
8
+
9
+ -----------------------------------------------------------
10
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
+ -----------------------------------------------------------
12
+
13
+ PREAMBLE
14
+ The goals of the Open Font License (OFL) are to stimulate worldwide
15
+ development of collaborative font projects, to support the font
16
+ creation efforts of academic and linguistic communities, and to
17
+ provide a free and open framework in which fonts may be shared and
18
+ improved in partnership with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves. The
22
+ fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply to
27
+ any document created using the fonts or their derivatives.
28
+
29
+ DEFINITIONS
30
+ "Font Software" refers to the set of files released by the Copyright
31
+ Holder(s) under this license and clearly marked as such. This may
32
+ include source files, build scripts and documentation.
33
+
34
+ "Reserved Font Name" refers to any names specified as such after the
35
+ copyright statement(s).
36
+
37
+ "Original Version" refers to the collection of Font Software
38
+ components as distributed by the Copyright Holder(s).
39
+
40
+ "Modified Version" refers to any derivative made by adding to,
41
+ deleting, or substituting -- in part or in whole -- any of the
42
+ components of the Original Version, by changing formats or by porting
43
+ the Font Software to a new environment.
44
+
45
+ "Author" refers to any designer, engineer, programmer, technical
46
+ writer or other person who contributed to the Font Software.
47
+
48
+ PERMISSION & CONDITIONS
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of the Font Software, to use, study, copy, merge, embed,
51
+ modify, redistribute, and sell modified and unmodified copies of the
52
+ Font Software, subject to the following conditions:
53
+
54
+ 1) Neither the Font Software nor any of its individual components, in
55
+ Original or Modified Versions, may be sold by itself.
56
+
57
+ 2) Original or Modified Versions of the Font Software may be bundled,
58
+ redistributed and/or sold with any software, provided that each copy
59
+ contains the above copyright notice and this license. These can be
60
+ included either as stand-alone text files, human-readable headers or
61
+ in the appropriate machine-readable metadata fields within text or
62
+ binary files as long as those fields can be easily viewed by the user.
63
+
64
+ 3) No Modified Version of the Font Software may use the Reserved Font
65
+ Name(s) unless explicit written permission is granted by the
66
+ corresponding Copyright Holder. This restriction only applies to the
67
+ primary font name as presented to the users.
68
+
69
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
+ Software shall not be used to promote, endorse or advertise any
71
+ Modified Version, except to acknowledge the contribution(s) of the
72
+ Copyright Holder(s) and the Author(s) or with their explicit written
73
+ permission.
74
+
75
+ 5) The Font Software, modified or unmodified, in part or in whole,
76
+ must be distributed entirely under this license, and must not be
77
+ distributed under any other license. The requirement for fonts to
78
+ remain under this license does not apply to any document created using
79
+ the Font Software.
80
+
81
+ TERMINATION
82
+ This license becomes null and void if any of the above conditions are
83
+ not met.
84
+
85
+ DISCLAIMER
86
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,32 @@
1
+ {
2
+ "description": "Noto Sans, the default font family bundled with @rentnerkev/pdf (D-21). Unhinted TTF files from the official Noto release repository at a pinned commit; SIL Open Font License 1.1 (OFL.txt).",
3
+ "repository": "https://github.com/notofonts/notofonts.github.io",
4
+ "commit": "7a35fe3411ec512a8a0ed9f9e7ace74a24ea3444",
5
+ "files": [
6
+ {
7
+ "name": "NotoSans-Regular.ttf",
8
+ "url": "https://raw.githubusercontent.com/notofonts/notofonts.github.io/7a35fe3411ec512a8a0ed9f9e7ace74a24ea3444/fonts/NotoSans/unhinted/ttf/NotoSans-Regular.ttf",
9
+ "sha256": "f3961a9cde016d41a4879aecda1474d3a36d6bf54fa0e4643de029cc2248b0e8"
10
+ },
11
+ {
12
+ "name": "NotoSans-Bold.ttf",
13
+ "url": "https://raw.githubusercontent.com/notofonts/notofonts.github.io/7a35fe3411ec512a8a0ed9f9e7ace74a24ea3444/fonts/NotoSans/unhinted/ttf/NotoSans-Bold.ttf",
14
+ "sha256": "87cb2d84472a7d66da659ee47b6cdb9552326e8c128245231f191b6ac72529d9"
15
+ },
16
+ {
17
+ "name": "NotoSans-Italic.ttf",
18
+ "url": "https://raw.githubusercontent.com/notofonts/notofonts.github.io/7a35fe3411ec512a8a0ed9f9e7ace74a24ea3444/fonts/NotoSans/unhinted/ttf/NotoSans-Italic.ttf",
19
+ "sha256": "678288f868807d4d64a6f3b51466871d117d915780381ce9d0ed4b3bcbd06d37"
20
+ },
21
+ {
22
+ "name": "NotoSans-BoldItalic.ttf",
23
+ "url": "https://raw.githubusercontent.com/notofonts/notofonts.github.io/7a35fe3411ec512a8a0ed9f9e7ace74a24ea3444/fonts/NotoSans/unhinted/ttf/NotoSans-BoldItalic.ttf",
24
+ "sha256": "3d367743f371f28671d2764e911a53d7c20ec9b6aa8791d059e7090389fc52a5"
25
+ },
26
+ {
27
+ "name": "OFL.txt",
28
+ "url": "https://raw.githubusercontent.com/notofonts/notofonts.github.io/7a35fe3411ec512a8a0ed9f9e7ace74a24ea3444/fonts/LICENSE",
29
+ "sha256": "f2095b08bed08b23a6fe26112fcd679a2bee3f002eef077eb05d215ed1051bd8"
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,26 @@
1
+ export { Anchor, Cell, Document, Image, Keep, Link, Marker, Page, PageBreak, PageNumber, Svg, Row, Table, Text, TotalPages, View, } from './components/components.ts';
2
+ export type { AnchorAttributes, AnchorProps, AttachmentAttributes, BookmarkInput, BoxAttributes, CellAttributes, CellProps, CellRole, DataTableAttributes, DataTableProps, DocumentAttributes, DocumentProps, HeadingRole, ImageAttributes, ImageProps, ImageRole, KeepAttributes, KeepProps, LinkAttributes, LinkProps, MarkerAssignment, MarkerProps, NavigationAttributes, PageAttributes, PageBreakProps, PageNumberProps, PageProps, PageRegionProps, PageVariantProps, SvgAttributes, SvgProps, RowAttributes, RowProps, NumberTableColumn, TableAttributes, TableBaseAttributes, TableCellValue, TableColumn, TableColumnBase, TableColumnKey, TableColumnLayout, TableProps, TableRole, TextAttributes, TextTableColumn, TextMarkerAssignment, TextProps, TextRole, TextValue, TotalPagesProps, ViewAttributes, ViewProps, ViewRole, } from './components/Types/props.ts';
3
+ export { createEngine } from './engine/create-engine.ts';
4
+ export { RentnerPdfError } from './engine/errors.ts';
5
+ export { render } from './engine/render.ts';
6
+ export type { BackendChoice, BackendName } from './engine/Types/backend.ts';
7
+ export type { CacheOptions, Engine, EngineOptions, FontSource, RenderInput, } from './engine/Types/engine.ts';
8
+ export type { Limits, LimitsInput } from './engine/Types/limits.ts';
9
+ export type { BatchFailed, BatchOptions, BatchRendered, BatchResult, EngineStats, RenderOptions, } from './engine/Types/render-options.ts';
10
+ export type { RentnerPdfErrorCode, RentnerPdfErrorOptions, } from './engine/Types/errors.ts';
11
+ export type { PdfBytes, RenderResult, RenderWarning, RentnerPdfWarningCode, WrapDiagnostic, WrapReason, } from './engine/Types/render-result.ts';
12
+ export { anchor, cell, document, image, keep, link, marker, page, pageBreak, pageNumber, svg, row, table, text, type TextInput, totalPages, view, } from './ir/factories.ts';
13
+ /** IR types generated from the Rust engine (`ir.Document`, `ir.Node`, …). */
14
+ export type * as ir from './ir/ir.generated.ts';
15
+ export type { Dir, FacturX, FacturXLevel, HeaderScope, MarkerSelect, NumberFormat, Orientation, PageNumberFormat, PageNumbering, PageScope, PageSize, Relationship, RunningTotals, Standard, Style, StyleLength, TableTotals, TextAlign, } from './ir/ir.generated.ts';
16
+ export type { AttachmentInput, AttachmentSource, CellNodeInput, DocumentInput, ImageNodeInput, ImageSource, LetterheadInput, NodeInput, PageInput, PageVariantInput, PdfSource, SvgNodeInput, SvgSource, RowNodeInput, TableColumnInput, TableNodeInput, ViewNodeInput, } from './ir/Types/input.ts';
17
+ export { IR_VERSION } from './ir/version.ts';
18
+ export { createContext, useContext } from './jsx/context.ts';
19
+ export { Fragment, isElement } from './jsx/element.ts';
20
+ export { renderToIr, renderToIrSync } from './jsx/evaluate.ts';
21
+ export type { Context, Provider, ProviderProps } from './jsx/Types/context.ts';
22
+ export { DEFAULT_THEME_SCOPES, themeFromCss } from './theme/theme-from-css.ts';
23
+ export type { Theme, ThemeFromCssOptions, ThemeInput, ThemeStylesheet, ThemeVariables, } from './theme/Types/theme.ts';
24
+ export type { Component, Key, PdfElement, PdfNode, SourceLocation, } from './jsx/Types/element.ts';
25
+ export type { WasmModuleSource } from './wasm/loader.ts';
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../web/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,SAAS,EACT,UAAU,EACV,GAAG,EACH,GAAG,EACH,KAAK,EACL,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9E,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC9E,YAAY,EACR,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,cAAc,GACjB,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EACR,SAAS,EACT,GAAG,EACH,UAAU,EACV,OAAO,EACP,cAAc,GACjB,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ export { Anchor, Cell, Document, Image, Keep, Link, Marker, Page, PageBreak, PageNumber, Svg, Row, Table, Text, TotalPages, View, } from './components/components.js';
2
+ export { createEngine } from './engine/create-engine.js';
3
+ export { RentnerPdfError } from './engine/errors.js';
4
+ export { render } from './engine/render.js';
5
+ export { anchor, cell, document, image, keep, link, marker, page, pageBreak, pageNumber, svg, row, table, text, totalPages, view, } from './ir/factories.js';
6
+ export { IR_VERSION } from './ir/version.js';
7
+ export { createContext, useContext } from './jsx/context.js';
8
+ export { Fragment, isElement } from './jsx/element.js';
9
+ export { renderToIr, renderToIrSync } from './jsx/evaluate.js';
10
+ export { DEFAULT_THEME_SCOPES, themeFromCss } from './theme/theme-from-css.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../web/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,SAAS,EACT,UAAU,EACV,GAAG,EACH,GAAG,EACH,KAAK,EACL,IAAI,EACJ,UAAU,EACV,IAAI,GACP,MAAM,4BAA4B,CAAA;AAwDnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AA8B3C,OAAO,EACH,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,SAAS,EACT,UAAU,EACV,GAAG,EACH,GAAG,EACH,KAAK,EACL,IAAI,EAEJ,UAAU,EACV,IAAI,GACP,MAAM,mBAAmB,CAAA;AA4C1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAE9D,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA","sourcesContent":["export {\n Anchor,\n Cell,\n Document,\n Image,\n Keep,\n Link,\n Marker,\n Page,\n PageBreak,\n PageNumber,\n Svg,\n Row,\n Table,\n Text,\n TotalPages,\n View,\n} from './components/components.ts'\nexport type {\n AnchorAttributes,\n AnchorProps,\n AttachmentAttributes,\n BookmarkInput,\n BoxAttributes,\n CellAttributes,\n CellProps,\n CellRole,\n DataTableAttributes,\n DataTableProps,\n DocumentAttributes,\n DocumentProps,\n HeadingRole,\n ImageAttributes,\n ImageProps,\n ImageRole,\n KeepAttributes,\n KeepProps,\n LinkAttributes,\n LinkProps,\n MarkerAssignment,\n MarkerProps,\n NavigationAttributes,\n PageAttributes,\n PageBreakProps,\n PageNumberProps,\n PageProps,\n PageRegionProps,\n PageVariantProps,\n SvgAttributes,\n SvgProps,\n RowAttributes,\n RowProps,\n NumberTableColumn,\n TableAttributes,\n TableBaseAttributes,\n TableCellValue,\n TableColumn,\n TableColumnBase,\n TableColumnKey,\n TableColumnLayout,\n TableProps,\n TableRole,\n TextAttributes,\n TextTableColumn,\n TextMarkerAssignment,\n TextProps,\n TextRole,\n TextValue,\n TotalPagesProps,\n ViewAttributes,\n ViewProps,\n ViewRole,\n} from './components/Types/props.ts'\nexport { createEngine } from './engine/create-engine.ts'\nexport { RentnerPdfError } from './engine/errors.ts'\nexport { render } from './engine/render.ts'\nexport type { BackendChoice, BackendName } from './engine/Types/backend.ts'\nexport type {\n CacheOptions,\n Engine,\n EngineOptions,\n FontSource,\n RenderInput,\n} from './engine/Types/engine.ts'\nexport type { Limits, LimitsInput } from './engine/Types/limits.ts'\nexport type {\n BatchFailed,\n BatchOptions,\n BatchRendered,\n BatchResult,\n EngineStats,\n RenderOptions,\n} from './engine/Types/render-options.ts'\nexport type {\n RentnerPdfErrorCode,\n RentnerPdfErrorOptions,\n} from './engine/Types/errors.ts'\nexport type {\n PdfBytes,\n RenderResult,\n RenderWarning,\n RentnerPdfWarningCode,\n WrapDiagnostic,\n WrapReason,\n} from './engine/Types/render-result.ts'\nexport {\n anchor,\n cell,\n document,\n image,\n keep,\n link,\n marker,\n page,\n pageBreak,\n pageNumber,\n svg,\n row,\n table,\n text,\n type TextInput,\n totalPages,\n view,\n} from './ir/factories.ts'\n/** IR types generated from the Rust engine (`ir.Document`, `ir.Node`, …). */\nexport type * as ir from './ir/ir.generated.ts'\n// The IR types that component props use, so props can be typed without\n// the `ir` namespace.\nexport type {\n Dir,\n FacturX,\n FacturXLevel,\n HeaderScope,\n MarkerSelect,\n NumberFormat,\n Orientation,\n PageNumberFormat,\n PageNumbering,\n PageScope,\n PageSize,\n Relationship,\n RunningTotals,\n Standard,\n Style,\n StyleLength,\n TableTotals,\n TextAlign,\n} from './ir/ir.generated.ts'\nexport type {\n AttachmentInput,\n AttachmentSource,\n CellNodeInput,\n DocumentInput,\n ImageNodeInput,\n ImageSource,\n LetterheadInput,\n NodeInput,\n PageInput,\n PageVariantInput,\n PdfSource,\n SvgNodeInput,\n SvgSource,\n RowNodeInput,\n TableColumnInput,\n TableNodeInput,\n ViewNodeInput,\n} from './ir/Types/input.ts'\nexport { IR_VERSION } from './ir/version.ts'\nexport { createContext, useContext } from './jsx/context.ts'\nexport { Fragment, isElement } from './jsx/element.ts'\nexport { renderToIr, renderToIrSync } from './jsx/evaluate.ts'\nexport type { Context, Provider, ProviderProps } from './jsx/Types/context.ts'\nexport { DEFAULT_THEME_SCOPES, themeFromCss } from './theme/theme-from-css.ts'\nexport type {\n Theme,\n ThemeFromCssOptions,\n ThemeInput,\n ThemeStylesheet,\n ThemeVariables,\n} from './theme/Types/theme.ts'\nexport type {\n Component,\n Key,\n PdfElement,\n PdfNode,\n SourceLocation,\n} from './jsx/Types/element.ts'\nexport type { WasmModuleSource } from './wasm/loader.ts'\n"]}
@@ -0,0 +1,111 @@
1
+ import type { Attachment, CellNode, Document, ImageNode, Letterhead, Page, SvgNode, RowNode, TableColumn, TableNode, TextNode, ViewNode } from '../ir.generated.ts';
2
+ /** Image bytes: PNG, JPEG, GIF (first frame) or WebP. */
3
+ export type ImageSource = Uint8Array | ArrayBuffer;
4
+ /** SVG markup as a string, or the bytes of an `.svg` file (UTF-8). */
5
+ export type SvgSource = string | Uint8Array | ArrayBuffer;
6
+ /** The bytes of a PDF file. */
7
+ export type PdfSource = Uint8Array | ArrayBuffer;
8
+ /**
9
+ * The content of an attachment: bytes, or a string such as invoice XML,
10
+ * embedded as UTF-8.
11
+ */
12
+ export type AttachmentSource = string | Uint8Array | ArrayBuffer;
13
+ /**
14
+ * A file embedded in the PDF with its content; the encoder replaces `src`
15
+ * with `asset`, a buffer of its own.
16
+ */
17
+ export type AttachmentInput = Omit<Attachment, 'asset'> & {
18
+ readonly src: AttachmentSource;
19
+ };
20
+ /**
21
+ * A page of an existing PDF drawn behind the content of every page of a
22
+ * `Page` template, at its own size from the top left corner; the encoder
23
+ * replaces `src` with `asset`.
24
+ */
25
+ export type LetterheadInput = Omit<Letterhead, 'asset'> & {
26
+ readonly src: PdfSource;
27
+ };
28
+ /** An image node with its bytes; the encoder replaces `src` with `asset`. */
29
+ export type ImageNodeInput = Omit<ImageNode, 'asset'> & {
30
+ readonly src: ImageSource;
31
+ };
32
+ /** An SVG node with its markup; the encoder replaces `src` with `asset`. */
33
+ export type SvgNodeInput = Omit<SvgNode, 'asset'> & {
34
+ readonly src: SvgSource;
35
+ };
36
+ /** A view node whose subtree may contain image nodes with bytes. */
37
+ export type ViewNodeInput = Omit<ViewNode, 'children'> & {
38
+ children?: readonly NodeInput[];
39
+ };
40
+ /** A table cell whose content may contain image nodes with bytes. */
41
+ export type CellNodeInput = Omit<CellNode, 'children'> & {
42
+ children?: readonly NodeInput[];
43
+ };
44
+ /** A table row of cells. */
45
+ export type RowNodeInput = Omit<RowNode, 'children'> & {
46
+ children?: readonly ({
47
+ t: 'cell';
48
+ } & CellNodeInput)[];
49
+ };
50
+ /**
51
+ * A table column as the TypeScript API writes it; for data tables the
52
+ * encoder adds where its cells are in the columnar channel.
53
+ */
54
+ export type TableColumnInput = Omit<TableColumn, 'text' | 'values'>;
55
+ /**
56
+ * A table: element rows whose cells may contain image nodes with bytes,
57
+ * or, for a data-driven table, the row objects in `data`.
58
+ */
59
+ export type TableNodeInput = Omit<TableNode, 'children' | 'columns' | 'rows'> & {
60
+ children?: readonly ({
61
+ t: 'row';
62
+ } & RowNodeInput)[];
63
+ columns?: readonly TableColumnInput[];
64
+ /**
65
+ * The rows of a data-driven table: objects whose `key` properties the
66
+ * columns show. The encoder writes their cells to the columnar channel.
67
+ */
68
+ data?: readonly object[];
69
+ };
70
+ /** A content node; `t` selects the kind. */
71
+ export type NodeInput = ({
72
+ t: 'view';
73
+ } & ViewNodeInput) | ({
74
+ t: 'text';
75
+ } & TextNode) | ({
76
+ t: 'image';
77
+ } & ImageNodeInput) | ({
78
+ t: 'svg';
79
+ } & SvgNodeInput) | ({
80
+ t: 'table';
81
+ } & TableNodeInput);
82
+ /**
83
+ * Header, footer and letterhead overrides for some pages of a template;
84
+ * `null` removes the template's one on those pages.
85
+ */
86
+ export interface PageVariantInput {
87
+ header?: NodeInput | null;
88
+ footer?: NodeInput | null;
89
+ letterhead?: LetterheadInput | null;
90
+ }
91
+ /** A page whose content, header, footer and letterheads may carry bytes. */
92
+ export type PageInput = Omit<Page, 'children' | 'letterhead' | 'header' | 'footer' | 'first' | 'odd' | 'even' | 'last'> & {
93
+ children?: readonly NodeInput[];
94
+ letterhead?: LetterheadInput;
95
+ header?: NodeInput;
96
+ footer?: NodeInput;
97
+ first?: PageVariantInput;
98
+ odd?: PageVariantInput;
99
+ even?: PageVariantInput;
100
+ last?: PageVariantInput;
101
+ };
102
+ /**
103
+ * A document to render, as the factories and JSX build it; `v` defaults to
104
+ * the IR version this package writes.
105
+ */
106
+ export type DocumentInput = Omit<Document, 'v' | 'pages' | 'channel' | 'attachments'> & {
107
+ v?: number;
108
+ pages: readonly PageInput[];
109
+ attachments?: readonly AttachmentInput[];
110
+ };
111
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../web/src/ir/Types/input.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,IAAI,EACJ,OAAO,EACP,OAAO,EACP,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACX,MAAM,oBAAoB,CAAA;AAE3B,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,WAAW,CAAA;AAElD,sEAAsE;AACtE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAA;AAEzD,+BAA+B;AAC/B,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,WAAW,CAAA;AAEhD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAA;AAEhE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG;IACtD,QAAQ,CAAC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;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAC5B,QAAQ,EACR,GAAG,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAC5C,GAAG;IACA,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;IAC3B,WAAW,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;CAC3C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../web/src/ir/Types/input.ts"],"names":[],"mappings":"","sourcesContent":["// The documents the TypeScript API builds and renders. They are the IR from\n// ir.generated.ts with two differences: image and SVG nodes carry their\n// content in `src`, and data-driven tables their rows in `data`. Neither\n// travels inside the JSON (D-06): the engine's encoder moves the content\n// into separate asset buffers (`asset`) and the table cells into the\n// columnar channel (`rows`, the columns' `text` and `values`). Lists are\n// readonly: the encoder never changes a document.\nimport type {\n Attachment,\n CellNode,\n Document,\n ImageNode,\n Letterhead,\n Page,\n SvgNode,\n RowNode,\n TableColumn,\n TableNode,\n TextNode,\n ViewNode,\n} from '../ir.generated.ts'\n\n/** Image bytes: PNG, JPEG, GIF (first frame) or WebP. */\nexport type ImageSource = Uint8Array | ArrayBuffer\n\n/** SVG markup as a string, or the bytes of an `.svg` file (UTF-8). */\nexport type SvgSource = string | Uint8Array | ArrayBuffer\n\n/** The bytes of a PDF file. */\nexport type PdfSource = Uint8Array | ArrayBuffer\n\n/**\n * The content of an attachment: bytes, or a string such as invoice XML,\n * embedded as UTF-8.\n */\nexport type AttachmentSource = string | Uint8Array | ArrayBuffer\n\n/**\n * A file embedded in the PDF with its content; the encoder replaces `src`\n * with `asset`, a buffer of its own.\n */\nexport type AttachmentInput = Omit<Attachment, 'asset'> & {\n readonly src: AttachmentSource\n}\n\n/**\n * A page of an existing PDF drawn behind the content of every page of a\n * `Page` template, at its own size from the top left corner; the encoder\n * replaces `src` with `asset`.\n */\nexport type LetterheadInput = Omit<Letterhead, 'asset'> & {\n readonly src: PdfSource\n}\n\n/** An image node with its bytes; the encoder replaces `src` with `asset`. */\nexport type ImageNodeInput = Omit<ImageNode, 'asset'> & {\n readonly src: ImageSource\n}\n\n/** An SVG node with its markup; the encoder replaces `src` with `asset`. */\nexport type SvgNodeInput = Omit<SvgNode, 'asset'> & {\n readonly src: SvgSource\n}\n\n/** A view node whose subtree may contain image nodes with bytes. */\nexport type ViewNodeInput = Omit<ViewNode, 'children'> & {\n children?: readonly NodeInput[]\n}\n\n/** A table cell whose content may contain image nodes with bytes. */\nexport type CellNodeInput = Omit<CellNode, 'children'> & {\n children?: readonly NodeInput[]\n}\n\n/** A table row of cells. */\nexport type RowNodeInput = Omit<RowNode, 'children'> & {\n children?: readonly ({ t: 'cell' } & CellNodeInput)[]\n}\n\n/**\n * A table column as the TypeScript API writes it; for data tables the\n * encoder adds where its cells are in the columnar channel.\n */\nexport type TableColumnInput = Omit<TableColumn, 'text' | 'values'>\n\n/**\n * A table: element rows whose cells may contain image nodes with bytes,\n * or, for a data-driven table, the row objects in `data`.\n */\nexport type TableNodeInput = Omit<\n TableNode,\n 'children' | 'columns' | 'rows'\n> & {\n children?: readonly ({ t: 'row' } & RowNodeInput)[]\n columns?: readonly TableColumnInput[]\n /**\n * The rows of a data-driven table: objects whose `key` properties the\n * columns show. The encoder writes their cells to the columnar channel.\n */\n data?: readonly object[]\n}\n\n/** A content node; `t` selects the kind. */\nexport type NodeInput =\n | ({ t: 'view' } & ViewNodeInput)\n | ({ t: 'text' } & TextNode)\n | ({ t: 'image' } & ImageNodeInput)\n | ({ t: 'svg' } & SvgNodeInput)\n | ({ t: 'table' } & TableNodeInput)\n\n/**\n * Header, footer and letterhead overrides for some pages of a template;\n * `null` removes the template's one on those pages.\n */\nexport interface PageVariantInput {\n header?: NodeInput | null\n footer?: NodeInput | null\n letterhead?: LetterheadInput | null\n}\n\n/** A page whose content, header, footer and letterheads may carry bytes. */\nexport type PageInput = Omit<\n Page,\n | 'children'\n | 'letterhead'\n | 'header'\n | 'footer'\n | 'first'\n | 'odd'\n | 'even'\n | 'last'\n> & {\n children?: readonly NodeInput[]\n letterhead?: LetterheadInput\n header?: NodeInput\n footer?: NodeInput\n first?: PageVariantInput\n odd?: PageVariantInput\n even?: PageVariantInput\n last?: PageVariantInput\n}\n\n/**\n * A document to render, as the factories and JSX build it; `v` defaults to\n * the IR version this package writes.\n */\nexport type DocumentInput = Omit<\n Document,\n 'v' | 'pages' | 'channel' | 'attachments'\n> & {\n v?: number\n pages: readonly PageInput[]\n attachments?: readonly AttachmentInput[]\n}\n"]}