web-doc 0.3.0

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 (308) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/README.md +148 -0
  4. package/THIRD_PARTY_NOTICES.md +20 -0
  5. package/bin/copy-assets.mjs +27 -0
  6. package/dist/abort.d.ts +1 -0
  7. package/dist/abort.js +18 -0
  8. package/dist/adapters/bitmap.d.ts +9 -0
  9. package/dist/adapters/bitmap.js +63 -0
  10. package/dist/adapters/csv-parser.d.ts +7 -0
  11. package/dist/adapters/csv-parser.js +124 -0
  12. package/dist/adapters/csv.d.ts +26 -0
  13. package/dist/adapters/csv.js +231 -0
  14. package/dist/adapters/image.d.ts +41 -0
  15. package/dist/adapters/image.js +198 -0
  16. package/dist/adapters/office.d.ts +211 -0
  17. package/dist/adapters/office.js +672 -0
  18. package/dist/adapters/pdf.d.ts +32 -0
  19. package/dist/adapters/pdf.js +429 -0
  20. package/dist/adapters/svg.d.ts +17 -0
  21. package/dist/adapters/svg.js +123 -0
  22. package/dist/assets/image/index.d.ts +75 -0
  23. package/dist/assets/image/index.js +289 -0
  24. package/dist/assets/image/index_bg.wasm +0 -0
  25. package/dist/assets/image/index_bg.wasm.d.ts +12 -0
  26. package/dist/assets/legacy/index.d.ts +54 -0
  27. package/dist/assets/legacy/index.js +306 -0
  28. package/dist/assets/legacy/index_bg.wasm +0 -0
  29. package/dist/assets/legacy/index_bg.wasm.d.ts +9 -0
  30. package/dist/assets/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  31. package/dist/assets/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  32. package/dist/assets/pdfjs/cmaps/78-H.bcmap +0 -0
  33. package/dist/assets/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  34. package/dist/assets/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  35. package/dist/assets/pdfjs/cmaps/78-V.bcmap +0 -0
  36. package/dist/assets/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  37. package/dist/assets/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  38. package/dist/assets/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  39. package/dist/assets/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  40. package/dist/assets/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  41. package/dist/assets/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  42. package/dist/assets/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  43. package/dist/assets/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  44. package/dist/assets/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  45. package/dist/assets/pdfjs/cmaps/Add-H.bcmap +0 -0
  46. package/dist/assets/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  47. package/dist/assets/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  48. package/dist/assets/pdfjs/cmaps/Add-V.bcmap +0 -0
  49. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  50. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  51. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  52. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  53. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  54. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  55. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  56. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  57. package/dist/assets/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  58. package/dist/assets/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  59. package/dist/assets/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  60. package/dist/assets/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  61. package/dist/assets/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  62. package/dist/assets/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  63. package/dist/assets/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  64. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  65. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  66. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  67. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  68. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  69. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  70. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  71. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  72. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  73. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  74. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  75. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  76. package/dist/assets/pdfjs/cmaps/B5-H.bcmap +0 -0
  77. package/dist/assets/pdfjs/cmaps/B5-V.bcmap +0 -0
  78. package/dist/assets/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  79. package/dist/assets/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  80. package/dist/assets/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  81. package/dist/assets/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  82. package/dist/assets/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  83. package/dist/assets/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  84. package/dist/assets/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  85. package/dist/assets/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  86. package/dist/assets/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  87. package/dist/assets/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  88. package/dist/assets/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  89. package/dist/assets/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  90. package/dist/assets/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  91. package/dist/assets/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  92. package/dist/assets/pdfjs/cmaps/EUC-H.bcmap +0 -0
  93. package/dist/assets/pdfjs/cmaps/EUC-V.bcmap +0 -0
  94. package/dist/assets/pdfjs/cmaps/Ext-H.bcmap +0 -0
  95. package/dist/assets/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  96. package/dist/assets/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  97. package/dist/assets/pdfjs/cmaps/Ext-V.bcmap +0 -0
  98. package/dist/assets/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  99. package/dist/assets/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  100. package/dist/assets/pdfjs/cmaps/GB-H.bcmap +4 -0
  101. package/dist/assets/pdfjs/cmaps/GB-V.bcmap +0 -0
  102. package/dist/assets/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  103. package/dist/assets/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  104. package/dist/assets/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  105. package/dist/assets/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  106. package/dist/assets/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  107. package/dist/assets/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  108. package/dist/assets/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  109. package/dist/assets/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  110. package/dist/assets/pdfjs/cmaps/GBT-H.bcmap +0 -0
  111. package/dist/assets/pdfjs/cmaps/GBT-V.bcmap +0 -0
  112. package/dist/assets/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  113. package/dist/assets/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  114. package/dist/assets/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  115. package/dist/assets/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  116. package/dist/assets/pdfjs/cmaps/H.bcmap +0 -0
  117. package/dist/assets/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  118. package/dist/assets/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  119. package/dist/assets/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  120. package/dist/assets/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  121. package/dist/assets/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  122. package/dist/assets/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  123. package/dist/assets/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  124. package/dist/assets/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  125. package/dist/assets/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  126. package/dist/assets/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  127. package/dist/assets/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  128. package/dist/assets/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  129. package/dist/assets/pdfjs/cmaps/Hankaku.bcmap +0 -0
  130. package/dist/assets/pdfjs/cmaps/Hiragana.bcmap +0 -0
  131. package/dist/assets/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  132. package/dist/assets/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  133. package/dist/assets/pdfjs/cmaps/KSC-H.bcmap +0 -0
  134. package/dist/assets/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  135. package/dist/assets/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  136. package/dist/assets/pdfjs/cmaps/KSC-V.bcmap +0 -0
  137. package/dist/assets/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  138. package/dist/assets/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  139. package/dist/assets/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  140. package/dist/assets/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  141. package/dist/assets/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  142. package/dist/assets/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  143. package/dist/assets/pdfjs/cmaps/Katakana.bcmap +0 -0
  144. package/dist/assets/pdfjs/cmaps/LICENSE +36 -0
  145. package/dist/assets/pdfjs/cmaps/NWP-H.bcmap +0 -0
  146. package/dist/assets/pdfjs/cmaps/NWP-V.bcmap +0 -0
  147. package/dist/assets/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  148. package/dist/assets/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  149. package/dist/assets/pdfjs/cmaps/Roman.bcmap +0 -0
  150. package/dist/assets/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  151. package/dist/assets/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  152. package/dist/assets/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  153. package/dist/assets/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  154. package/dist/assets/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  155. package/dist/assets/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  156. package/dist/assets/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  157. package/dist/assets/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  158. package/dist/assets/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  159. package/dist/assets/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  160. package/dist/assets/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  161. package/dist/assets/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  162. package/dist/assets/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  163. package/dist/assets/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  164. package/dist/assets/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  165. package/dist/assets/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  166. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  167. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  168. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  169. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  170. package/dist/assets/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  171. package/dist/assets/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  172. package/dist/assets/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  173. package/dist/assets/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  174. package/dist/assets/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  175. package/dist/assets/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  176. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  177. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  178. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  179. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  180. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  181. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  182. package/dist/assets/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  183. package/dist/assets/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  184. package/dist/assets/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  185. package/dist/assets/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  186. package/dist/assets/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  187. package/dist/assets/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  188. package/dist/assets/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  189. package/dist/assets/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  190. package/dist/assets/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  191. package/dist/assets/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  192. package/dist/assets/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  193. package/dist/assets/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  194. package/dist/assets/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  195. package/dist/assets/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  196. package/dist/assets/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  197. package/dist/assets/pdfjs/cmaps/V.bcmap +0 -0
  198. package/dist/assets/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  199. package/dist/assets/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
  200. package/dist/assets/pdfjs/iccs/LICENSE +116 -0
  201. package/dist/assets/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  202. package/dist/assets/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  203. package/dist/assets/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  204. package/dist/assets/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  205. package/dist/assets/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  206. package/dist/assets/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  207. package/dist/assets/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  208. package/dist/assets/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  209. package/dist/assets/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  210. package/dist/assets/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  211. package/dist/assets/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  212. package/dist/assets/pdfjs/standard_fonts/LICENSE_LIBERATION +102 -0
  213. package/dist/assets/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  214. package/dist/assets/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  215. package/dist/assets/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  216. package/dist/assets/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  217. package/dist/assets/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  218. package/dist/assets/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  219. package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  220. package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  221. package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_QCMS +22 -0
  222. package/dist/assets/pdfjs/wasm/LICENSE_QCMS +21 -0
  223. package/dist/assets/pdfjs/wasm/jbig2.wasm +0 -0
  224. package/dist/assets/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  225. package/dist/assets/pdfjs/wasm/openjpeg.wasm +0 -0
  226. package/dist/assets/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  227. package/dist/assets/pdfjs/wasm/qcms_bg.wasm +0 -0
  228. package/dist/assets/pdfjs/wasm/quickjs-eval.js +16 -0
  229. package/dist/assets/pdfjs/wasm/quickjs-eval.wasm +0 -0
  230. package/dist/client.d.ts +20 -0
  231. package/dist/client.js +82 -0
  232. package/dist/contracts.d.ts +379 -0
  233. package/dist/contracts.js +22 -0
  234. package/dist/csv-worker.d.ts +1 -0
  235. package/dist/csv-worker.js +17 -0
  236. package/dist/detect.d.ts +15 -0
  237. package/dist/detect.js +290 -0
  238. package/dist/errors.d.ts +14 -0
  239. package/dist/errors.js +40 -0
  240. package/dist/font-manifest.d.ts +11 -0
  241. package/dist/font-manifest.js +31 -0
  242. package/dist/fonts/OFL-1.1.txt +88 -0
  243. package/dist/fonts/THIRD_PARTY_NOTICES.md +10 -0
  244. package/dist/fonts/manifest.json +83 -0
  245. package/dist/fonts/noto-sans-arabic.woff2 +0 -0
  246. package/dist/fonts/noto-sans-bengali.woff2 +0 -0
  247. package/dist/fonts/noto-sans-cjk.woff2 +0 -0
  248. package/dist/fonts/noto-sans-devanagari.woff2 +0 -0
  249. package/dist/fonts/noto-sans-gujarati.woff2 +0 -0
  250. package/dist/fonts/noto-sans-gurmukhi.woff2 +0 -0
  251. package/dist/fonts/noto-sans-japanese.woff2 +0 -0
  252. package/dist/fonts/noto-sans-kannada.woff2 +0 -0
  253. package/dist/fonts/noto-sans-korean.woff2 +0 -0
  254. package/dist/fonts/noto-sans-latin-cyrillic.woff2 +0 -0
  255. package/dist/fonts/noto-sans-malayalam.woff2 +0 -0
  256. package/dist/fonts/noto-sans-odia.woff2 +0 -0
  257. package/dist/fonts/noto-sans-tamil.woff2 +0 -0
  258. package/dist/fonts/noto-sans-telugu.woff2 +0 -0
  259. package/dist/fonts.d.ts +20 -0
  260. package/dist/fonts.js +238 -0
  261. package/dist/format.d.ts +1 -0
  262. package/dist/format.js +1 -0
  263. package/dist/headless.d.ts +18 -0
  264. package/dist/headless.js +18 -0
  265. package/dist/i18n.d.ts +4 -0
  266. package/dist/i18n.js +55 -0
  267. package/dist/image-worker.d.ts +1 -0
  268. package/dist/image-worker.js +41 -0
  269. package/dist/index.d.ts +27 -0
  270. package/dist/index.js +29 -0
  271. package/dist/interaction.d.ts +24 -0
  272. package/dist/interaction.js +183 -0
  273. package/dist/legacy-converter-worker.d.ts +1 -0
  274. package/dist/legacy-converter-worker.js +19 -0
  275. package/dist/limits.d.ts +4 -0
  276. package/dist/limits.js +162 -0
  277. package/dist/registry.d.ts +8 -0
  278. package/dist/registry.js +35 -0
  279. package/dist/render-scheduler.d.ts +8 -0
  280. package/dist/render-scheduler.js +63 -0
  281. package/dist/source.d.ts +14 -0
  282. package/dist/source.js +116 -0
  283. package/dist/spreadsheet-viewport.d.ts +34 -0
  284. package/dist/spreadsheet-viewport.js +1035 -0
  285. package/dist/styles.css +137 -0
  286. package/dist/ui-styles.d.ts +1 -0
  287. package/dist/ui-styles.js +139 -0
  288. package/dist/ui.d.ts +8 -0
  289. package/dist/ui.js +390 -0
  290. package/dist/viewer.d.ts +52 -0
  291. package/dist/viewer.js +901 -0
  292. package/dist/viewport.d.ts +54 -0
  293. package/dist/viewport.js +907 -0
  294. package/dist/worker-adapter.d.ts +24 -0
  295. package/dist/worker-adapter.js +97 -0
  296. package/dist/worker-client.d.ts +23 -0
  297. package/dist/worker-client.js +105 -0
  298. package/dist/worker-endpoint.d.ts +13 -0
  299. package/dist/worker-endpoint.js +57 -0
  300. package/dist/worker-protocol.d.ts +48 -0
  301. package/dist/worker-protocol.js +14 -0
  302. package/dist/worker.d.ts +4 -0
  303. package/dist/worker.js +4 -0
  304. package/dist/workers/csv-worker.js +160 -0
  305. package/dist/workers/image-worker.js +41 -0
  306. package/dist/workers/legacy-converter-worker.js +19 -0
  307. package/dist/workers/pdf.worker.min.mjs +28 -0
  308. package/package.json +74 -0
package/LICENSE-APACHE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Zrimo contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zrimo contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # web-doc
2
+
3
+ **Any document. One canvas.**
4
+
5
+ [Website](https://bnku.github.io/zrimo/) ·
6
+ [Live React demo](https://bnku.github.io/zrimo/demo/) ·
7
+ [Documentation](https://bnku.github.io/zrimo/getting-started) ·
8
+ [GitHub](https://github.com/leonidkuznetsov18/web-doc)
9
+
10
+ > web-doc is a fork of [Zrimo](https://github.com/bnku/zrimo) maintained at
11
+ > [leonidkuznetsov18/web-doc](https://github.com/leonidkuznetsov18/web-doc).
12
+ > It adds page-scoped search (`SearchOptions.pageRange`) and is released
13
+ > independently; the runtime API, CSS hooks (`.zrimo-ui`, `--zrimo-*`) and
14
+ > asset layout are the same as upstream's `@zrimo/viewer`.
15
+
16
+ ## Why web-doc?
17
+
18
+ - **One viewer for common business formats.** Open DOCX, XLSX, PPTX, legacy
19
+ Office, PDF, images, SVG, CSV and TSV through one TypeScript API.
20
+ - **Use our interface or bring your own.** Mount the built-in toolbar, hide it
21
+ behind React controls, or render headlessly to your own canvas.
22
+ - **Real document interactions.** Pan, zoom, fit, search, selectable text,
23
+ thumbnails, sheet navigation, multi-cell selection and TSV clipboard output.
24
+ - **International documents.** Latin, Cyrillic, CJK, Arabic and supported Indic
25
+ scripts use application fonts, system fonts or lazy self-hosted fallbacks.
26
+ - **Browser-private by design.** Parsers, renderers and legacy converters run
27
+ locally; format-specific Rust/WASM modules load only when needed.
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ npm install web-doc
33
+ npx web-doc-copy-assets public/zrimo
34
+ ```
35
+
36
+ The second command copies workers, WASM modules and optional font assets into
37
+ your application's public directory. Until a version is on npm, every
38
+ [GitHub release](https://github.com/leonidkuznetsov18/web-doc/releases) carries
39
+ the same tarball (`web-doc-x.y.z.tgz`, with `SHA256SUMS`), which can be
40
+ pinned by URL instead.
41
+
42
+ ## Quick start
43
+
44
+ ```ts
45
+ import { ViewerClient } from "web-doc";
46
+ import "web-doc/styles.css";
47
+
48
+ const client = ViewerClient.create({
49
+ assetBaseUrl: new URL("/zrimo/", location.href),
50
+ });
51
+
52
+ const viewer = client.createViewer({
53
+ container: document.querySelector("#viewer")!,
54
+ ui: true,
55
+ fit: "width",
56
+ });
57
+
58
+ await viewer.load(file, { fileName: file.name });
59
+
60
+ // When the host component unmounts:
61
+ await viewer.destroy();
62
+ await client.destroy();
63
+ ```
64
+
65
+ Give the host element an explicit size:
66
+
67
+ ```css
68
+ #viewer {
69
+ width: 100%;
70
+ height: 100%;
71
+ min-height: 320px;
72
+ }
73
+ ```
74
+
75
+ See the [installation guide](https://bnku.github.io/zrimo/getting-started) for
76
+ framework setup, asset paths and production MIME configuration.
77
+
78
+ ## Choose your integration
79
+
80
+ | Approach | Configuration | Best for |
81
+ | ----------- | ---------------------------------------- | ----------------------------------------------------- |
82
+ | Built-in UI | `createViewer({ container, ui: true })` | A complete viewer with minimal host code |
83
+ | Custom UI | `createViewer({ container, ui: false })` | React/Vue/Svelte controls around the managed viewport |
84
+ | Headless | `web-doc/headless` | Custom canvas rendering and application-owned layout |
85
+
86
+ The [live React demo](https://bnku.github.io/zrimo/demo/) shows the built-in UI,
87
+ a fully custom React toolbar and the headless API side by side.
88
+
89
+ ## Supported formats
90
+
91
+ | Family | Formats |
92
+ | -------------------- | ---------------------------------------------------- |
93
+ | Modern Office | DOCX, DOCM, XLSX, XLSM, PPTX, PPTM, PPSX |
94
+ | Legacy Office | Word 97–2003 DOC, BIFF8 XLS, PPT |
95
+ | Documents and images | PDF, PNG, JPEG, WebP, GIF, BMP, multi-page TIFF, SVG |
96
+ | Structured data | CSV, TSV |
97
+
98
+ Macros and document scripts never execute. Spreadsheet formulas display their
99
+ stored cached values. Images are rendered without OCR. Password-protected
100
+ documents are not currently supported, and complex legacy Office objects may
101
+ render with reduced fidelity. The maintained details live in the
102
+ [compatibility guide](https://bnku.github.io/zrimo/compatibility).
103
+
104
+ ## Public entry points
105
+
106
+ - `web-doc` — complete API and optional built-in UI;
107
+ - `web-doc/headless` — UI-free runtime and adapters;
108
+ - `web-doc/worker` — worker adapter and RPC contracts;
109
+ - `web-doc/styles.css` — built-in UI styles;
110
+ - `web-doc/assets/*`, `/workers/*`, `/fonts/*` — explicit runtime assets.
111
+
112
+ Start with the [API reference](https://bnku.github.io/zrimo/api/reference),
113
+ [UI guide](https://bnku.github.io/zrimo/ui) or
114
+ [framework integrations](https://bnku.github.io/zrimo/integrations).
115
+
116
+ ## Browser support
117
+
118
+ Zrimo targets Safari 16.4+ and the latest two stable Chrome, Edge, Firefox and
119
+ Safari releases. Automated browser coverage runs in Chromium, Firefox and
120
+ WebKit.
121
+
122
+ ## Built on open source
123
+
124
+ Zrimo exists thanks to the maintainers and contributors behind these projects:
125
+
126
+ | Project | License | Used for |
127
+ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | --------------------------------------------------------------------- |
128
+ | [Office Open XML Viewer (`@silurus/ooxml`)](https://github.com/yukiyokotani/office-open-xml-viewer) | MIT | Rust/WASM parsing and Canvas rendering for DOCX, XLSX and PPTX |
129
+ | [`office_oxide`](https://github.com/yfedoseev/office_oxide) | MIT OR Apache-2.0 | Compound files, shared Office utilities and legacy XLS/PPT conversion |
130
+ | [Mozilla PDF.js](https://github.com/mozilla/pdf.js) | Apache-2.0 | PDF parsing, fonts, Canvas rendering, links and selectable text |
131
+ | [`@napi-rs/canvas`](https://github.com/Brooooooklyn/canvas) | MIT | Optional PDF.js Node dependency; not bundled into the browser runtime |
132
+ | [`image`](https://github.com/image-rs/image) and [`tiff`](https://github.com/image-rs/image-tiff) | MIT OR Apache-2.0 / MIT | Multi-page TIFF decoding and image output |
133
+ | [`wasm-bindgen`](https://github.com/wasm-bindgen/wasm-bindgen) | MIT OR Apache-2.0 | JavaScript and TypeScript bindings for Rust/WASM modules |
134
+ | [`zip`](https://github.com/zip-rs/zip2) | MIT | Bounded in-memory ZIP and OOXML package handling |
135
+ | [Serde](https://github.com/serde-rs/serde), [`serde_json`](https://github.com/serde-rs/json) and [`thiserror`](https://github.com/dtolnay/thiserror) | MIT OR Apache-2.0 | Serialization and structured Rust errors |
136
+ | [`core-js`](https://github.com/zloirock/core-js) | MIT | Compatibility modules used by the PDF.js legacy browser build |
137
+ | [Noto Sans](https://github.com/notofonts/noto-fonts) and [Noto Sans CJK](https://github.com/notofonts/noto-cjk) | SIL Open Font License 1.1 | Lazy self-hosted multilingual fallback fonts |
138
+
139
+ Third-party components retain their own licenses. The npm package includes
140
+ `THIRD_PARTY_NOTICES.md` and its font notices. The complete pinned inventory is
141
+ available as the repository's
142
+ [generated SPDX SBOM](https://github.com/bnku/zrimo/blob/main/artifacts/sbom.spdx.json).
143
+
144
+ ## License
145
+
146
+ Zrimo's original source code and documentation are dual-licensed, at your
147
+ option, under the [MIT License](LICENSE-MIT) or the
148
+ [Apache License 2.0](LICENSE-APACHE). Copyright (c) 2026 Zrimo contributors.
@@ -0,0 +1,20 @@
1
+ # Third-party notices
2
+
3
+ The release artifact contains or depends on the following principal components. The generated SPDX SBOM in `artifacts/sbom.spdx.json` is the complete machine-readable inventory for the pinned lockfiles.
4
+
5
+ - [`@silurus/ooxml`](https://github.com/yukiyokotani/office-open-xml-viewer) — MIT; modern Office parsing/rendering.
6
+ - [`office_oxide`](https://github.com/yfedoseev/office_oxide) — MIT OR Apache-2.0; compound-file handling, Office IR/writer utilities and legacy XLS/PPT conversion.
7
+ - [`pdfjs-dist` / Mozilla PDF.js](https://github.com/mozilla/pdf.js) — Apache-2.0; browser PDF parsing,
8
+ font/CMap handling, canvas rendering, and text extraction. The packaged
9
+ standard-font, ICC, CMap, OpenJPEG, JBIG2, and QCMS assets retain the license
10
+ files distributed with PDF.js under `dist/assets/pdfjs/`.
11
+ - [`core-js`](https://github.com/zloirock/core-js) compatibility modules embedded in the PDF.js legacy browser build —
12
+ MIT; polyfills required by the supported browser matrix, including the PDF
13
+ worker realm.
14
+ - [`@napi-rs/canvas`](https://github.com/Brooooooklyn/canvas) — MIT; optional Node canvas backend pulled by PDF.js and excluded from Zrimo's browser bundle.
15
+ - [`image`](https://github.com/image-rs/image) and [`tiff`](https://github.com/image-rs/image-tiff) Rust crates — MIT OR Apache-2.0 / MIT; multi-page TIFF decoding and PNG output.
16
+ - [`wasm-bindgen`](https://github.com/wasm-bindgen/wasm-bindgen) — MIT OR Apache-2.0; browser bindings for project-owned Rust/WASM modules.
17
+ - [`zip`](https://github.com/zip-rs/zip2) — MIT; bounded in-memory ZIP/OOXML package manipulation.
18
+ - [Serde](https://github.com/serde-rs/serde), [`serde_json`](https://github.com/serde-rs/json) and [`thiserror`](https://github.com/dtolnay/thiserror) — MIT OR Apache-2.0; serialization and structured Rust errors.
19
+ - [Noto Sans](https://github.com/notofonts/noto-fonts) and [Noto Sans CJK](https://github.com/notofonts/noto-cjk) subset fonts — SIL Open Font License 1.1. The font manifest, complete OFL text, pinned source commits and SHA-256 hashes are included in `dist/fonts/`.
20
+ No Microsoft proprietary font or copyleft runtime component is bundled. Transitive notices and license expressions are verified by `npm run licenses`.
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cp, mkdir } from "node:fs/promises";
4
+ import { resolve } from "node:path";
5
+
6
+ const packageRoot = resolve(import.meta.dirname, "..");
7
+ const destination = process.argv[2];
8
+
9
+ if (!destination || destination === "--help" || destination === "-h") {
10
+ console.log("Usage: web-doc-copy-assets <public-directory>");
11
+ console.log("Copies Zrimo workers, WASM/PDF assets, and optional fonts.");
12
+ process.exit(destination ? 0 : 1);
13
+ }
14
+
15
+ const output = resolve(process.cwd(), destination);
16
+ await mkdir(output, { recursive: true });
17
+ for (const directory of ["assets", "fonts", "workers"]) {
18
+ await cp(
19
+ resolve(packageRoot, "dist", directory),
20
+ resolve(output, directory),
21
+ {
22
+ recursive: true,
23
+ force: true,
24
+ },
25
+ );
26
+ }
27
+ console.log(`Zrimo runtime assets copied to ${output}`);
@@ -0,0 +1 @@
1
+ export declare function linkedAbortController(...signals: readonly (AbortSignal | undefined)[]): AbortController;
package/dist/abort.js ADDED
@@ -0,0 +1,18 @@
1
+ import { abortError } from "./errors.js";
2
+ export function linkedAbortController(...signals) {
3
+ const controller = new AbortController();
4
+ const abort = () => controller.abort(abortError());
5
+ for (const signal of signals) {
6
+ if (!signal)
7
+ continue;
8
+ if (signal.aborted) {
9
+ abort();
10
+ break;
11
+ }
12
+ signal.addEventListener("abort", abort, {
13
+ once: true,
14
+ signal: controller.signal,
15
+ });
16
+ }
17
+ return controller;
18
+ }
@@ -0,0 +1,9 @@
1
+ export declare function drawEncodedImage(data: Uint8Array, mimeType: string, target: HTMLCanvasElement | OffscreenCanvas, options: {
2
+ readonly dpr: number;
3
+ readonly cssWidth?: number;
4
+ readonly cssHeight?: number;
5
+ readonly scale?: number;
6
+ }): Promise<{
7
+ width: number;
8
+ height: number;
9
+ }>;
@@ -0,0 +1,63 @@
1
+ import { ViewerError } from "../errors.js";
2
+ export async function drawEncodedImage(data, mimeType, target, options) {
3
+ const blob = new Blob([data.slice()], { type: mimeType });
4
+ const decoded = await decodeImage(blob);
5
+ try {
6
+ const naturalWidth = decoded.width;
7
+ const naturalHeight = decoded.height;
8
+ const dpr = Math.max(1, options.dpr);
9
+ const scale = options.scale ?? 1 / dpr;
10
+ const cssWidth = options.cssWidth ?? naturalWidth * scale;
11
+ const cssHeight = options.cssHeight ?? naturalHeight * scale;
12
+ target.width = Math.max(1, Math.ceil(cssWidth * dpr));
13
+ target.height = Math.max(1, Math.ceil(cssHeight * dpr));
14
+ if ("style" in target) {
15
+ target.style.width = `${cssWidth}px`;
16
+ target.style.height = `${cssHeight}px`;
17
+ }
18
+ const context = target.getContext("2d");
19
+ if (!context)
20
+ throw new ViewerError("render-failed", "Canvas 2D context is unavailable");
21
+ context.setTransform(dpr, 0, 0, dpr, 0, 0);
22
+ context.clearRect(0, 0, cssWidth, cssHeight);
23
+ context.drawImage(decoded.source, 0, 0, cssWidth, cssHeight);
24
+ return { width: naturalWidth, height: naturalHeight };
25
+ }
26
+ finally {
27
+ decoded.close();
28
+ }
29
+ }
30
+ async function decodeImage(blob) {
31
+ if (typeof createImageBitmap === "function") {
32
+ const bitmap = await createImageBitmap(blob, {
33
+ imageOrientation: "from-image",
34
+ });
35
+ return {
36
+ source: bitmap,
37
+ width: bitmap.width,
38
+ height: bitmap.height,
39
+ close: () => bitmap.close(),
40
+ };
41
+ }
42
+ if (typeof document === "undefined")
43
+ throw new ViewerError("render-failed", "No browser image decoder is available");
44
+ const url = URL.createObjectURL(blob);
45
+ try {
46
+ const image = new Image();
47
+ image.decoding = "async";
48
+ image.src = url;
49
+ await image.decode();
50
+ return {
51
+ source: image,
52
+ width: image.naturalWidth,
53
+ height: image.naturalHeight,
54
+ close: () => URL.revokeObjectURL(url),
55
+ };
56
+ }
57
+ catch (error) {
58
+ URL.revokeObjectURL(url);
59
+ throw new ViewerError("invalid-file", "Browser image decode failed", {
60
+ cause: error,
61
+ });
62
+ }
63
+ }
@@ -0,0 +1,7 @@
1
+ export interface ParsedDelimitedText {
2
+ readonly delimiter: string;
3
+ readonly encoding: string;
4
+ readonly rows: readonly (readonly string[])[];
5
+ }
6
+ export declare function parseDelimitedBytes(data: Uint8Array, format: "csv" | "tsv", maxCells?: number): ParsedDelimitedText;
7
+ export declare function parseDelimitedText(text: string, delimiter: string, maxCells?: number): readonly (readonly string[])[];
@@ -0,0 +1,124 @@
1
+ import { ViewerError } from "../errors.js";
2
+ export function parseDelimitedBytes(data, format, maxCells = 1_000_000) {
3
+ const decoded = decodeDelimitedBytes(data);
4
+ const delimiter = format === "tsv" ? "\t" : detectDelimiter(decoded.text, [",", "\t", ";"]);
5
+ return {
6
+ delimiter,
7
+ encoding: decoded.encoding,
8
+ rows: parseDelimitedText(decoded.text, delimiter, maxCells),
9
+ };
10
+ }
11
+ export function parseDelimitedText(text, delimiter, maxCells = 1_000_000) {
12
+ const rows = [];
13
+ let row = [];
14
+ let field = "";
15
+ let quoted = false;
16
+ let cells = 0;
17
+ const pushField = () => {
18
+ cells += 1;
19
+ if (cells > maxCells)
20
+ throw new ViewerError("resource-limit", "Delimited data exceeds cell limit", {
21
+ details: { maxCells },
22
+ });
23
+ row.push(field);
24
+ field = "";
25
+ };
26
+ const pushRow = () => {
27
+ pushField();
28
+ rows.push(row);
29
+ row = [];
30
+ };
31
+ for (let index = 0; index < text.length; index += 1) {
32
+ const character = text[index];
33
+ if (quoted) {
34
+ if (character === '"') {
35
+ if (text[index + 1] === '"') {
36
+ field += '"';
37
+ index += 1;
38
+ }
39
+ else
40
+ quoted = false;
41
+ }
42
+ else
43
+ field += character;
44
+ continue;
45
+ }
46
+ if (character === '"' && field.length === 0)
47
+ quoted = true;
48
+ else if (character === delimiter)
49
+ pushField();
50
+ else if (character === "\n")
51
+ pushRow();
52
+ else if (character !== "\r")
53
+ field += character;
54
+ }
55
+ if (quoted)
56
+ throw new ViewerError("invalid-file", "Unterminated quoted field in delimited data");
57
+ if (field.length > 0 || row.length > 0)
58
+ pushRow();
59
+ return rows;
60
+ }
61
+ function decodeDelimitedBytes(data) {
62
+ if (data[0] === 0xef && data[1] === 0xbb && data[2] === 0xbf)
63
+ return {
64
+ text: new TextDecoder("utf-8", { fatal: true }).decode(data.subarray(3)),
65
+ encoding: "utf-8",
66
+ };
67
+ if (data[0] === 0xff && data[1] === 0xfe)
68
+ return {
69
+ text: new TextDecoder("utf-16le", { fatal: true }).decode(data.subarray(2)),
70
+ encoding: "utf-16le",
71
+ };
72
+ if (data[0] === 0xfe && data[1] === 0xff) {
73
+ const swapped = data.subarray(2).slice();
74
+ for (let index = 0; index + 1 < swapped.length; index += 2)
75
+ [swapped[index], swapped[index + 1]] = [
76
+ swapped[index + 1],
77
+ swapped[index],
78
+ ];
79
+ return {
80
+ text: new TextDecoder("utf-16le", { fatal: true }).decode(swapped),
81
+ encoding: "utf-16be",
82
+ };
83
+ }
84
+ try {
85
+ return {
86
+ text: new TextDecoder("utf-8", { fatal: true }).decode(data),
87
+ encoding: "utf-8",
88
+ };
89
+ }
90
+ catch {
91
+ return {
92
+ text: new TextDecoder("windows-1252").decode(data),
93
+ encoding: "windows-1252",
94
+ };
95
+ }
96
+ }
97
+ function detectDelimiter(text, candidates) {
98
+ const sample = text.slice(0, 64 * 1024);
99
+ let best = ",";
100
+ let bestScore = -1;
101
+ for (const candidate of candidates) {
102
+ let quoted = false;
103
+ let count = 0;
104
+ let lines = 0;
105
+ for (let index = 0; index < sample.length && lines < 20; index += 1) {
106
+ const character = sample[index];
107
+ if (character === '"') {
108
+ if (quoted && sample[index + 1] === '"')
109
+ index += 1;
110
+ else
111
+ quoted = !quoted;
112
+ }
113
+ else if (!quoted && character === candidate)
114
+ count += 1;
115
+ else if (!quoted && character === "\n")
116
+ lines += 1;
117
+ }
118
+ if (count > bestScore) {
119
+ best = candidate;
120
+ bestScore = count;
121
+ }
122
+ }
123
+ return best;
124
+ }