@flyfish-group/file-viewer 1.0.25 → 2.0.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 (237) hide show
  1. package/README.en.md +5 -375
  2. package/README.md +6 -352
  3. package/dist/index.d.ts +2 -606
  4. package/dist/index.js +2 -0
  5. package/package.json +32 -107
  6. package/dist/components/3MFLoader.js +0 -1
  7. package/dist/components/AMFLoader.js +0 -1
  8. package/dist/components/ArchiveViewer.js +0 -377
  9. package/dist/components/AudioViewer.js +0 -1
  10. package/dist/components/CadViewer.js +0 -1
  11. package/dist/components/CodeViewer.js +0 -1
  12. package/dist/components/ColladaLoader.js +0 -1
  13. package/dist/components/DrawingViewer.js +0 -1
  14. package/dist/components/EdaViewer.js +0 -1
  15. package/dist/components/EmailViewer.js +0 -1
  16. package/dist/components/EpubViewer.js +0 -1
  17. package/dist/components/FBXLoader.js +0 -1
  18. package/dist/components/GLTFLoader.js +0 -1
  19. package/dist/components/ImageViewer.js +0 -1
  20. package/dist/components/KMZLoader.js +0 -1
  21. package/dist/components/MarkdownViewer.js +0 -1
  22. package/dist/components/ModelViewer.js +0 -26885
  23. package/dist/components/OBJLoader.js +0 -1
  24. package/dist/components/OfdViewer.js +0 -1
  25. package/dist/components/PCDLoader.js +0 -1
  26. package/dist/components/PLYLoader.js +0 -1
  27. package/dist/components/PdfView.js +0 -31013
  28. package/dist/components/PptxRender.js +0 -19347
  29. package/dist/components/STLLoader.js +0 -1
  30. package/dist/components/TDSLoader.js +0 -1
  31. package/dist/components/TypstViewer.js +0 -2029
  32. package/dist/components/USDLoader.js +0 -1
  33. package/dist/components/UmdViewer.js +0 -2
  34. package/dist/components/VRMLLoader.js +0 -1
  35. package/dist/components/VTKLoader.js +0 -1
  36. package/dist/components/XYZLoader.js +0 -1
  37. package/dist/components/XlsxTable.js +0 -1
  38. package/dist/components/___vite-browser-external_commonjs-proxy.js +0 -1
  39. package/dist/components/_commonjs-dynamic-modules.js +0 -1
  40. package/dist/components/_commonjsHelpers.js +0 -1
  41. package/dist/components/ar-SA-G6X2FPQ2.js +0 -1
  42. package/dist/components/arc.js +0 -1
  43. package/dist/components/architecture-7EHR7CIX.js +0 -1
  44. package/dist/components/architectureDiagram-3BPJPVTR.js +0 -1
  45. package/dist/components/az-AZ-76LH7QW2.js +0 -1
  46. package/dist/components/bash.js +0 -1
  47. package/dist/components/bg-BG-XCXSNQG7.js +0 -1
  48. package/dist/components/blockDiagram-GPEHLZMM.js +0 -1
  49. package/dist/components/bn-BD-2XOGV67Q.js +0 -1
  50. package/dist/components/c4Diagram-AAUBKEIU.js +0 -1
  51. package/dist/components/ca-ES-6MX7JW3Y.js +0 -1
  52. package/dist/components/cfb.js +0 -1
  53. package/dist/components/channel.js +0 -1
  54. package/dist/components/chunk-2J33WTMH.js +0 -1
  55. package/dist/components/chunk-4BX2VUAB.js +0 -1
  56. package/dist/components/chunk-55IACEB6.js +0 -1
  57. package/dist/components/chunk-727SXJPM.js +0 -1
  58. package/dist/components/chunk-AQP2D5EJ.js +0 -1
  59. package/dist/components/chunk-EIO257PC.js +0 -1722
  60. package/dist/components/chunk-FMBD7UC4.js +0 -1
  61. package/dist/components/chunk-ND2GUHAM.js +0 -1
  62. package/dist/components/chunk-QZHKN3VN.js +0 -1
  63. package/dist/components/classDiagram-4FO5ZUOK.js +0 -1
  64. package/dist/components/classDiagram-v2-Q7XG4LA2.js +0 -1
  65. package/dist/components/core.js +0 -1
  66. package/dist/components/cose-bilkent-S5V4N54A.js +0 -1
  67. package/dist/components/cpp.js +0 -1
  68. package/dist/components/cs-CZ-2BRQDIVT.js +0 -1
  69. package/dist/components/csharp.js +0 -1
  70. package/dist/components/css.js +0 -1
  71. package/dist/components/cytoscape.esm.js +0 -1
  72. package/dist/components/da-DK-5WZEPLOC.js +0 -1
  73. package/dist/components/dagre-BM42HDAG.js +0 -1
  74. package/dist/components/de-DE-XR44H4JA.js +0 -1
  75. package/dist/components/defaultLocale.js +0 -1
  76. package/dist/components/diagram-2AECGRRQ.js +0 -1
  77. package/dist/components/diagram-5GNKFQAL.js +0 -1
  78. package/dist/components/diagram-KO2AKTUF.js +0 -1
  79. package/dist/components/diagram-LMA3HP47.js +0 -1
  80. package/dist/components/diagram-OG6HWLK6.js +0 -1
  81. package/dist/components/diff.js +0 -1
  82. package/dist/components/directory-open-01563666.js +0 -1
  83. package/dist/components/directory-open-4ed118d0.js +0 -1
  84. package/dist/components/docx-preview.js +0 -7
  85. package/dist/components/el-GR-BZB4AONW.js +0 -1
  86. package/dist/components/en-B4ZKOASM.js +0 -1
  87. package/dist/components/erDiagram-TEJ5UH35.js +0 -1
  88. package/dist/components/es-ES-U4NZUMDT.js +0 -1
  89. package/dist/components/eu-ES-A7QVB2H4.js +0 -1
  90. package/dist/components/eventmodeling-FCH6USID.js +0 -1
  91. package/dist/components/fa-IR-HGAKTJCU.js +0 -1
  92. package/dist/components/fflate.module.js +0 -1
  93. package/dist/components/fi-FI-Z5N7JZ37.js +0 -1
  94. package/dist/components/file-open-002ab408.js +0 -1
  95. package/dist/components/file-open-7c801643.js +0 -1
  96. package/dist/components/file-save-3189631c.js +0 -1
  97. package/dist/components/file-save-745eba88.js +0 -1
  98. package/dist/components/flowDiagram-I6XJVG4X.js +0 -1
  99. package/dist/components/fr-FR-RHASNOE6.js +0 -1
  100. package/dist/components/ganttDiagram-6RSMTGT7.js +0 -1
  101. package/dist/components/gitGraph-WXDBUCRP.js +0 -1
  102. package/dist/components/gitGraphDiagram-PVQCEYII.js +0 -1
  103. package/dist/components/gl-ES-HMX3MZ6V.js +0 -1
  104. package/dist/components/global-compiler.js +0 -1
  105. package/dist/components/global-renderer.js +0 -1
  106. package/dist/components/go.js +0 -1
  107. package/dist/components/graph.js +0 -1
  108. package/dist/components/he-IL-6SHJWFNN.js +0 -1
  109. package/dist/components/hi-IN-IWLTKZ5I.js +0 -1
  110. package/dist/components/hu-HU-A5ZG7DT2.js +0 -1
  111. package/dist/components/id-ID-SAP4L64H.js +0 -1
  112. package/dist/components/image-GAAHSSAO.js +0 -1
  113. package/dist/components/image-blob-reduce.esm.js +0 -2
  114. package/dist/components/index.js +0 -23989
  115. package/dist/components/index10.js +0 -1
  116. package/dist/components/index11.js +0 -1
  117. package/dist/components/index12.js +0 -1
  118. package/dist/components/index13.js +0 -1
  119. package/dist/components/index14.js +0 -1
  120. package/dist/components/index15.js +0 -1
  121. package/dist/components/index16.js +0 -1
  122. package/dist/components/index17.js +0 -1
  123. package/dist/components/index18.js +0 -1
  124. package/dist/components/index19.js +0 -1
  125. package/dist/components/index2.js +0 -1
  126. package/dist/components/index20.js +0 -1
  127. package/dist/components/index21.js +0 -1
  128. package/dist/components/index22.js +0 -2
  129. package/dist/components/index23.js +0 -1
  130. package/dist/components/index24.js +0 -1
  131. package/dist/components/index3.js +0 -1
  132. package/dist/components/index4.js +0 -1
  133. package/dist/components/index5.js +0 -1
  134. package/dist/components/index6.js +0 -1
  135. package/dist/components/index7.js +0 -1
  136. package/dist/components/index8.js +0 -1
  137. package/dist/components/index9.js +0 -1
  138. package/dist/components/info-J43DQDTF.js +0 -1
  139. package/dist/components/infoDiagram-5YYISTIA.js +0 -1
  140. package/dist/components/ini.js +0 -1
  141. package/dist/components/init.js +0 -1
  142. package/dist/components/ishikawaDiagram-YF4QCWOH.js +0 -1
  143. package/dist/components/it-IT-JPQ66NNP.js +0 -1
  144. package/dist/components/ja-JP-DBVTYXUO.js +0 -1
  145. package/dist/components/java.js +0 -1
  146. package/dist/components/javascript.js +0 -1
  147. package/dist/components/journeyDiagram-JHISSGLW.js +0 -1
  148. package/dist/components/json.js +0 -1
  149. package/dist/components/jszip.min.js +0 -1
  150. package/dist/components/kaa-6HZHGXH3.js +0 -1
  151. package/dist/components/kab-KAB-ZGHBKWFO.js +0 -1
  152. package/dist/components/kanban-definition-UN3LZRKU.js +0 -1
  153. package/dist/components/katex.js +0 -1
  154. package/dist/components/kk-KZ-P5N5QNE5.js +0 -1
  155. package/dist/components/km-KH-HSX4SM5Z.js +0 -1
  156. package/dist/components/ko-KR-MTYHY66A.js +0 -1
  157. package/dist/components/ku-TR-6OUDTVRD.js +0 -1
  158. package/dist/components/layout.js +0 -1
  159. package/dist/components/libarchive.js +0 -6
  160. package/dist/components/linear.js +0 -1
  161. package/dist/components/lt-LT-XHIRWOB4.js +0 -1
  162. package/dist/components/lv-LV-5QDEKY6T.js +0 -1
  163. package/dist/components/markdown.js +0 -1
  164. package/dist/components/mermaid-parser.core.js +0 -14
  165. package/dist/components/mindmap-definition-RKZ34NQL.js +0 -1
  166. package/dist/components/mr-IN-CRQNXWMA.js +0 -1
  167. package/dist/components/my-MM-5M5IBNSE.js +0 -1
  168. package/dist/components/nb-NO-T6EIAALU.js +0 -1
  169. package/dist/components/nestedRender.js +0 -1
  170. package/dist/components/nl-NL-IS3SIHDZ.js +0 -1
  171. package/dist/components/nn-NO-6E72VCQL.js +0 -1
  172. package/dist/components/oc-FR-POXYY2M6.js +0 -1
  173. package/dist/components/ofd.js +0 -1
  174. package/dist/components/ordinal.js +0 -1
  175. package/dist/components/pa-IN-N4M65BXN.js +0 -1
  176. package/dist/components/packet-YPE3B663.js +0 -1
  177. package/dist/components/percentages-BXMCSKIN.js +0 -1
  178. package/dist/components/php.js +0 -1
  179. package/dist/components/pica.js +0 -1
  180. package/dist/components/pie-LRSECV5Y.js +0 -1
  181. package/dist/components/pie.js +0 -1
  182. package/dist/components/pieDiagram-4H26LBE5.js +0 -1
  183. package/dist/components/pl-PL-T2D74RX3.js +0 -1
  184. package/dist/components/postal-mime.js +0 -1
  185. package/dist/components/printLayout.js +0 -1
  186. package/dist/components/pt-BR-5N22H2LF.js +0 -1
  187. package/dist/components/pt-PT-UZXXM6DQ.js +0 -1
  188. package/dist/components/python.js +0 -1
  189. package/dist/components/quadrantDiagram-W4KKPZXB.js +0 -1
  190. package/dist/components/radar-GUYGQ44K.js +0 -1
  191. package/dist/components/requirementDiagram-4Y6WPE33.js +0 -1
  192. package/dist/components/ro-RO-JPDTUUEW.js +0 -1
  193. package/dist/components/rough.esm.js +0 -1
  194. package/dist/components/roundRect.js +0 -1
  195. package/dist/components/ru-RU-B4JR7IUQ.js +0 -1
  196. package/dist/components/rust.js +0 -1
  197. package/dist/components/sankeyDiagram-5OEKKPKP.js +0 -1
  198. package/dist/components/sequenceDiagram-3UESZ5HK.js +0 -1
  199. package/dist/components/si-LK-N5RQ5JYF.js +0 -1
  200. package/dist/components/sk-SK-C5VTKIMK.js +0 -1
  201. package/dist/components/sl-SI-NN7IZMDC.js +0 -1
  202. package/dist/components/sql.js +0 -1
  203. package/dist/components/stateDiagram-AJRCARHV.js +0 -1
  204. package/dist/components/stateDiagram-v2-BHNVJYJU.js +0 -1
  205. package/dist/components/subset-shared.chunk.js +0 -1
  206. package/dist/components/subset-worker.chunk.js +0 -1
  207. package/dist/components/sv-SE-XGPEYMSR.js +0 -1
  208. package/dist/components/ta-IN-2NMHFXQM.js +0 -1
  209. package/dist/components/th-TH-HPSO5L25.js +0 -1
  210. package/dist/components/time.js +0 -1
  211. package/dist/components/timeline-definition-PNZ67QCA.js +0 -1
  212. package/dist/components/tr-TR-DEFEU3FU.js +0 -1
  213. package/dist/components/transform.js +0 -1
  214. package/dist/components/treeView-BLDUP644.js +0 -1
  215. package/dist/components/treemap-LRROVOQU.js +0 -1
  216. package/dist/components/typescript.js +0 -1
  217. package/dist/components/uk-UA-QMV73CPH.js +0 -1
  218. package/dist/components/vennDiagram-CIIHVFJN.js +0 -1
  219. package/dist/components/vi-VN-M7AON7JQ.js +0 -1
  220. package/dist/components/wardley-L42UT6IY.js +0 -1
  221. package/dist/components/wardleyDiagram-YWT4CUSO.js +0 -1
  222. package/dist/components/wasm-pack-shim.js +0 -1
  223. package/dist/components/wasm-pack-shim2.js +0 -1
  224. package/dist/components/worker-ref.js +0 -1
  225. package/dist/components/xml.js +0 -1
  226. package/dist/components/xychartDiagram-2RQKCTM6.js +0 -1
  227. package/dist/components/yaml.js +0 -1
  228. package/dist/components/zh-CN-LNUGB5OW.js +0 -1
  229. package/dist/components/zh-HK-E62DVLB3.js +0 -1
  230. package/dist/components/zh-TW-RAJ6MFWO.js +0 -1
  231. package/dist/index.mjs +0 -1
  232. package/dist/package/index.d.ts +0 -36
  233. package/dist/style.css +0 -17
  234. package/dist/wasm/cad/dwfv-render.wasm +0 -0
  235. package/dist/wasm/cad/dwg-worker.js +0 -24
  236. package/dist/wasm/cad/libredwg-web.js +0 -15
  237. package/dist/wasm/cad/libredwg-web.wasm +0 -0
package/README.en.md CHANGED
@@ -1,162 +1,6 @@
1
- # Flyfish Viewer
1
+ # @flyfish-group/file-viewer
2
2
 
3
- [Simplified Chinese](README.md) | [English](README.en.md)
4
-
5
- Bring Word, Excel, PowerPoint, PDF, Typst, archives, email, audio, ebooks, drawings, CAD, 3D models, Markdown, images, and source code preview into the browser with a clean, deployable viewer.
6
-
7
- `@flyfish-group/file-viewer3` is a pure frontend file preview component built with Vue 3, TypeScript, and Vite. Vue 2.7 projects should use the matching `@flyfish-group/file-viewer` package. The Vue 3 build is also the baseline runtime for the React, vanilla JavaScript, and iframe integration packages.
8
-
9
- The viewer does not require a backend conversion service. It is designed for OA systems, knowledge bases, attachment centers, workflow platforms, customer support portals, document approval flows, intranet systems, and offline-capable deployments where file preview should feel like a maintained product module rather than a temporary feature.
10
-
11
- - npm for Vue 3: [@flyfish-group/file-viewer3](https://www.npmjs.com/package/@flyfish-group/file-viewer3)
12
- - npm for Vue 2.7: [@flyfish-group/file-viewer](https://www.npmjs.com/package/@flyfish-group/file-viewer)
13
- - npm for React: [@flyfish-group/file-viewer-react](https://www.npmjs.com/package/@flyfish-group/file-viewer-react)
14
- - npm for vanilla JavaScript: [@flyfish-group/file-viewer-web](https://www.npmjs.com/package/@flyfish-group/file-viewer-web)
15
- - Official documentation: [doc.flyfish.dev](https://doc.flyfish.dev)
16
- - Online demo: [viewer.flyfish.dev](https://viewer.flyfish.dev)
17
- - Document comparison demo: [viewer.flyfish.dev/compare.html](https://viewer.flyfish.dev/compare.html)
18
- - Release downloads: [github.com/flyfish-dev/file-viewer/releases](https://github.com/flyfish-dev/file-viewer/releases)
19
- - GitHub artifact repository: [github.com/flyfish-dev/file-viewer](https://github.com/flyfish-dev/file-viewer)
20
- - Gitee artifact mirror: [gitee.com/flyfish-dev/file-viewer](https://gitee.com/flyfish-dev/file-viewer)
21
- - Source access and commercial customization: [https://dev.flyfish.group/shop](https://dev.flyfish.group/shop)
22
-
23
- ## Current Packages
24
-
25
- | Stack | Package | Version | Recommended branch | Notes |
26
- | --- | --- | --- | --- | --- |
27
- | Vue 3 | `@flyfish-group/file-viewer3` | `1.0.25` | `v3` | Recommended version and the runtime baseline for React / vanilla JS iframe integrations |
28
- | Vue 2.7 | `@flyfish-group/file-viewer` | `1.0.25` | `main` | Vue 2 compatible package with the same format coverage and API semantics |
29
- | React 17 / 18 / 19 | `@flyfish-group/file-viewer-react` | `1.0.25` | adapter package | iframe component that loads `/file-viewer/index.html` by default |
30
- | Vanilla JavaScript | `@flyfish-group/file-viewer-web` | `1.0.25` | adapter package | iframe helpers and static viewer asset copier |
31
-
32
- For intranet or offline environments, this artifact repository also ships npm tarballs under `artifacts/`:
33
-
34
- ```bash
35
- npm install ./artifacts/flyfish-group-file-viewer3-1.0.25.tgz
36
- npm install ./artifacts/flyfish-group-file-viewer-1.0.25.tgz
37
- npm install ./artifacts/flyfish-group-file-viewer-web-1.0.25.tgz
38
- npm install ./artifacts/flyfish-group-file-viewer-react-1.0.25.tgz
39
- ```
40
-
41
- When installing the React tarball offline, install the same-version web tarball first because the React package depends on `@flyfish-group/file-viewer-web`.
42
-
43
- If you use pnpm 10 and see `Ignored build scripts: @flyfish-group/file-viewer-web`, run:
44
-
45
- ```bash
46
- pnpm approve-builds
47
- ```
48
-
49
- Then allow `@flyfish-group/file-viewer-web`, or manually copy the bundled viewer assets:
50
-
51
- ```bash
52
- pnpm exec file-viewer-copy-assets ./public/file-viewer
53
- ```
54
-
55
- GitHub Releases provide all distribution downloads:
56
-
57
- | File | Purpose |
58
- | --- | --- |
59
- | `file-viewer-v3-*-demo.tar.gz` | Main demo / iframe private deployment static site; extract it and use `/index.html?url=...` |
60
- | `file-viewer-v3-*-adapter-demo.tar.gz` | React / vanilla JavaScript adapter demo site |
61
- | `file-viewer-v3-*-lib-dist.tar.gz` | Vue 3 library dist for offline inspection or self-hosted packaging |
62
- | `file-viewer-v3-*-docs.tar.gz` | Documentation site static output |
63
- | `flyfish-group-file-viewer3-*.tgz` | Vue 3 local npm package |
64
- | `flyfish-group-file-viewer-*.tgz` | Vue 2.7 local npm package |
65
- | `flyfish-group-file-viewer-web-*.tgz` | Vanilla JavaScript iframe helper with viewer asset copy tooling |
66
- | `flyfish-group-file-viewer-react-*.tgz` | React iframe component; install the same-version web package together with it |
67
-
68
- ![Flyfish Viewer demo](docs/_images/demo-main.png)
69
-
70
- ## Why Use It
71
-
72
- - **Pure frontend and serverless.** File parsing and rendering happen in the browser. You do not need Office Server, a LibreOffice daemon, or a document conversion backend.
73
- - **Broad format coverage.** The current release maps 152 extensions across 20 preview pipelines, including Office, PDF, OFD, Typst, archives, email, EDA files, CAD, 3D models, Excalidraw, draw.io, EPUB, UMD, Markdown, images, audio, video, and source code.
74
- - **Lazy loaded renderers.** Heavy PDF, Office, OFD, Typst, archive, email, CAD, 3D, ebook, Markdown, and code highlighting dependencies are loaded only when the file type needs them.
75
- - **Production-ready operations.** The viewer includes original file download, full rendered printing, rendered HTML export, watermark options, theme options, lifecycle hooks, iframe events, and before-operation guards for permission checks.
76
- - **Better document reading.** Word and PDF keep a grey workspace, white paper surface, centered reading, width fitting, navigation, zoom, rotation, and complete print / HTML export paths.
77
- - **Renderer-native zoom controls.** The common toolbar can zoom in, zoom out, and reset through per-format providers for PDF, Word, PPTX, virtual Excel tables, images, CAD, OFD, Typst, Markdown, code, and drawing files, avoiding fragile host-level CSS transforms.
78
- - **Controlled theming.** `options.theme` supports `light`, `dark`, and `system`. Light business UIs can lock the viewer to `light` even when the operating system is in dark mode.
79
- - **PDF toolbar ergonomics.** `toolbar.position` supports `auto`, `top`, and `bottom-right`. In `auto` mode, PDF uses a bottom-right floating operation bar to avoid duplicating the PDF navigation toolbar.
80
- - **Demo and comparison views.** The repository includes the main demo and a standalone `/compare.html` page for side-by-side document comparison.
81
- - **Component and standalone modes.** Use it as a Vue component, or deploy the static viewer and embed it through iframe in any system.
82
- - **Artifact-first delivery.** This public repository contains minified build artifacts, static demos, documentation output, sample files, Docker deployment assets, and npm tarballs. It does not contain the private source tree.
83
-
84
- ## Supported Formats
85
-
86
- The viewer is organized around preview pipelines rather than one-off file extensions.
87
-
88
- | Category | Extensions | Rendering pipeline | Typical use |
89
- | --- | --- | --- | --- |
90
- | Word | `docx`, `docm`, `dotx`, `dotm` | `docx-preview`, read-only page preview, print and HTML export | Modern Word documents and templates |
91
- | Legacy Word | `doc`, `dot` | `msdoc-viewer` with Word-like paper surface and CFB tolerance fixes | Old Word 97-2003 files |
92
- | Excel | `xlsx`, `xltx` | `styled-exceljs` plus virtual table rendering, merged cells, styles, auto text color, workbook images | Business spreadsheets and templates |
93
- | Excel-compatible | `xlsm`, `xlsb`, `xls`, `xlt`, `xltm`, `csv`, `ods`, `fods`, `numbers` | Progressive spreadsheet parsing and virtual rendering | Legacy spreadsheets and lightweight data preview |
94
- | PowerPoint | `pptx`, `pptm`, `potx`, `potm`, `ppsx`, `ppsm` | Slide preview with images, shapes, theme backgrounds, clipping, and EMF fallback | Presentations, training decks, proposals |
95
- | PDF | `pdf` | `pdfjs-dist`, streaming same-origin loading, Range support, zoom, rotation, page thumbnails, outline tree, width fitting, print, HTML export | Contracts, invoices, official layout documents |
96
- | OFD | `ofd` | Browser-side OFD preview based on `DLTech21/ofd.js` source | Chinese e-invoices, government documents, archives |
97
- | Typst | `typ`, `typst` | Direct Typst source rendering with browser WASM compiler and SVG pages | Technical reports, papers, engineering documents |
98
- | Archives | `zip`, `zipx`, `7z`, `rar`, `tar`, `gz`, `tgz`, `bz2`, `xz`, `zst`, `cab`, `iso`, `jar`, `apk`, `cbz`, `cbr`, and more | `libarchive.js` Worker, directory listing, lazy extraction, IndexedDB cache | Attachment packages and internal document bundles |
99
- | Email | `eml`, `msg` | `postal-mime` for EML, `@kenjiuno/msgreader` for MSG, headers, HTML/text body, attachment preview | Email archives and support tickets |
100
- | EDA | `olb`, `dra` | CFB-based OrCAD / Allegro structure inspection, trees, symbols, footprints, padstack candidates, properties, strings, diagnostics | Component libraries and EDA attachments |
101
- | CAD | `dwg`, `dxf`, `dwf`, `dwfx`, `xps` | `@flyfish-dev/cad-viewer` preview. DWG uses Worker + LibreDWG WASM, DXF uses a JS parser, and DWF/DWFx/XPS use the native `dwf-viewer` path for W2D/W3D/XPS graphics | Engineering drawings and AutoCAD archives |
102
- | 3D models | `glb`, `gltf`, `obj`, `stl`, `ply`, `fbx`, `dae`, `3ds`, `3mf`, `amf`, `usd`, `usda`, `usdc`, `usdz`, `kmz`, `pcd`, `wrl`, `vrml`, `xyz`, `vtk`, `vtp`, `step`, `stp`, `iges`, `igs`, `ifc`, `3dm` | Three.js interactive preview, with conversion guidance for heavy CAD/BIM kernels | 3D assets, point clouds, design models |
103
- | Excalidraw | `excalidraw` | Official `@excalidraw/excalidraw` restore and `exportToSvg` read-only rendering | Whiteboard sketches and product diagrams |
104
- | draw.io | `drawio`, `dio` | Official diagrams.net `GraphViewer` | Flowcharts and architecture diagrams |
105
- | EPUB | `epub` | `epubjs` table of contents and scrolling reader | Ebooks and long training materials |
106
- | UMD ebook | `umd` | UMD metadata, chapters, offsets, zlib text blocks | Legacy mobile ebooks |
107
- | Markdown | `md`, `markdown` | Markdown reading surface with theme-aware styles | README files and knowledge base articles |
108
- | Images | `gif`, `jpg`, `jpeg`, `bmp`, `tiff`, `tif`, `png`, `svg`, `webp` | Native image preview | Image attachments and design assets |
109
- | Source and text | `txt`, `json`, `js`, `mjs`, `cjs`, `css`, `java`, `py`, `html`, `htm`, `jsx`, `ts`, `tsx`, `xml`, `log`, `vue`, `yaml`, `yml`, `ini`, `sh`, `bash`, `sql`, `go`, `rs`, `php`, `c`, `cpp`, `cc`, `h`, `hpp`, `cs`, `diff` | Lightweight `highlight.js` language-specific highlighting, HTML shown as source | Logs, configs, code snippets, API responses |
110
- | Audio | `mp3`, `mpeg`, `wav`, `ogg`, `oga`, `opus`, `m4a`, `aac`, `flac`, `weba` | Native browser audio player | Recordings and audio attachments |
111
- | Video | `mp4` | Native browser video player | Screen recordings and demo videos |
112
-
113
- ## Vue 3 Integration
114
-
115
- ```bash
116
- npm install @flyfish-group/file-viewer3
117
- ```
118
-
119
- ```ts
120
- import { createApp } from 'vue'
121
- import App from './App.vue'
122
- import FileViewer from '@flyfish-group/file-viewer3'
123
-
124
- createApp(App).use(FileViewer).mount('#app')
125
- ```
126
-
127
- ```vue
128
- <script setup lang="ts">
129
- import { ref } from 'vue'
130
-
131
- const url = ref('/files/demo.pdf')
132
-
133
- const options = {
134
- theme: 'light',
135
- toolbar: { position: 'bottom-right', download: true, print: true, exportHtml: true },
136
- watermark: { text: 'Internal Preview', opacity: 0.14 },
137
- pdf: { streaming: 'same-origin', rangeChunkSize: 64 * 1024 }
138
- }
139
- </script>
140
-
141
- <template>
142
- <div style="height: 100vh">
143
- <file-viewer :url="url" :options="options" />
144
- </div>
145
- </template>
146
- ```
147
-
148
- For local files or authenticated downloads, pass a `File` object:
149
-
150
- ```ts
151
- const response = await fetch('/api/files/contract', { credentials: 'include' })
152
- const blob = await response.blob()
153
-
154
- file.value = new File([blob], 'contract.pdf', { type: blob.type })
155
- ```
156
-
157
- The filename matters. The viewer uses the extension to choose the correct rendering pipeline.
158
-
159
- ## Vue 2.7 Integration
3
+ `@flyfish-group/file-viewer` is the historical Vue 2.7 compatibility package. It only re-exports the standard `@file-viewer/vue2.7` package. New integrations should prefer the standard package name.
160
4
 
161
5
  ```bash
162
6
  npm install @flyfish-group/file-viewer
@@ -169,222 +13,8 @@ import FileViewer from '@flyfish-group/file-viewer'
169
13
  Vue.use(FileViewer)
170
14
  ```
171
15
 
172
- ```vue
173
- <template>
174
- <div style="height: 100vh">
175
- <file-viewer :url="url" :options="options" />
176
- </div>
177
- </template>
178
-
179
- <script>
180
- export default {
181
- data() {
182
- return {
183
- url: '/files/demo.pdf',
184
- options: {
185
- theme: 'light',
186
- toolbar: { position: 'bottom-right' }
187
- }
188
- }
189
- }
190
- }
191
- </script>
192
- ```
193
-
194
- The Vue 2 and Vue 3 package lines share the same user-facing capabilities and option semantics.
195
-
196
- ## React Integration
197
-
198
- The React package is an iframe adapter. It reuses the Vue 3 baseline viewer that is bundled by `@flyfish-group/file-viewer-web`.
199
-
200
- ```bash
201
- npm install @flyfish-group/file-viewer-react
202
- ```
203
-
204
- ```tsx
205
- import FileViewer from '@flyfish-group/file-viewer-react'
206
-
207
- export function Preview() {
208
- return (
209
- <div style={{ height: '100vh' }}>
210
- <FileViewer
211
- url="/files/demo.pdf"
212
- options={{
213
- theme: 'light',
214
- toolbar: { position: 'bottom-right' },
215
- watermark: { text: 'Internal Preview', opacity: 0.14 }
216
- }}
217
- onViewerEvent={(event) => {
218
- console.log(event.type, event.event, event.payload)
219
- }}
220
- />
221
- </div>
222
- )
223
- }
224
- ```
225
-
226
- By default, the iframe loads `/file-viewer/index.html`. If your static assets are deployed elsewhere, pass `viewerUrl`.
227
-
228
- ## Vanilla JavaScript Integration
229
-
230
- ```bash
231
- npm install @flyfish-group/file-viewer-web
232
- ```
233
-
234
- ```html
235
- <div id="viewer" style="height: 100vh"></div>
236
-
237
- <script type="module">
238
- import { mountViewerFrame } from '@flyfish-group/file-viewer-web'
239
-
240
- mountViewerFrame(document.getElementById('viewer'), {
241
- url: '/files/demo.pdf',
242
- options: {
243
- theme: 'light',
244
- toolbar: { position: 'bottom-right' },
245
- archive: { cache: true, workerTimeoutMs: 30000 }
246
- },
247
- onEvent(event) {
248
- console.log(event.type, event.event, event.payload)
249
- }
250
- })
251
- </script>
252
- ```
253
-
254
- The web package copies the static viewer into `public/file-viewer` during installation. If your package manager blocks install scripts, run:
255
-
256
- ```bash
257
- npx file-viewer-copy-assets ./public/file-viewer
258
- ```
259
-
260
- ## iframe Protocol
261
-
262
- If you cannot use npm helpers, deploy the static viewer and pass a file URL through query parameters:
263
-
264
- ```html
265
- <iframe
266
- src="/file-viewer/index.html?url=%2Ffiles%2Fdemo.pdf&options=%7B%22theme%22%3A%22light%22%2C%22toolbar%22%3A%7B%22position%22%3A%22bottom-right%22%7D%7D"
267
- style="width: 100%; height: 100vh; border: 0"
268
- ></iframe>
269
- ```
270
-
271
- For authenticated files, download the file in the host system and push a `Blob` to the iframe:
272
-
273
- ```ts
274
- const viewerUrl = '/file-viewer/index.html'
275
- const viewerOrigin = location.origin
276
- const filename = 'contract.pdf'
277
- const options = { theme: 'light', toolbar: { position: 'bottom-right' } }
278
- const frame = document.getElementById('viewer') as HTMLIFrameElement
279
-
280
- frame.src =
281
- `${viewerUrl}?name=${encodeURIComponent(filename)}` +
282
- `&from=${encodeURIComponent(location.origin)}` +
283
- `&options=${encodeURIComponent(JSON.stringify(options))}`
284
-
285
- frame.onload = async () => {
286
- const response = await fetch('/api/files/contract', { credentials: 'include' })
287
- const blob = await response.blob()
288
- frame.contentWindow?.postMessage(blob, viewerOrigin)
289
- }
290
- ```
291
-
292
- The viewer validates `event.origin === from` and only accepts `Blob` messages from the declared origin.
293
-
294
- ## Core Options
295
-
296
- | Option | Description |
297
- | --- | --- |
298
- | `theme` | `light`, `dark`, or `system`. Default is `system`. Use `light` when embedding in a fixed light UI. |
299
- | `toolbar` | `true`, `false`, or an object that controls download, print, HTML export, unified zoom controls, and toolbar position. |
300
- | `toolbar.zoom` | Shows or hides the built-in zoom group. The actual capability is provided by each renderer, so unsupported or interaction-sensitive formats are not force-scaled. |
301
- | `toolbar.position` | `auto`, `top`, or `bottom-right`. Default `auto` floats the operation bar at bottom right for PDF and keeps other formats at top. |
302
- | `watermark` | Text or image watermark configuration. Watermark participates in preview, print, and exported HTML. |
303
- | `archive.workerUrl` | Custom `libarchive.js` Worker URL for special private deployments. By default the viewer tries `vendor/libarchive/worker-bundle.js` under the current base and falls back to the bundled Worker automatically. |
304
- | `archive.wasmUrl` | Custom libarchive WASM URL used by the bundled Worker fallback. |
305
- | `archive.workerTimeoutMs` | Worker initialization, encryption check, and directory-read timeout. Defaults to 30000ms and then falls back to ZIP/TAR/GZIP compatibility mode when possible. |
306
- | `archive.cache` | Enables IndexedDB cache for extracted archive entries. |
307
- | `archive.maxArchiveSize` | Maximum archive size allowed for directory parsing. |
308
- | `archive.maxEntryPreviewSize` | Maximum extracted entry size allowed for online preview. |
309
- | `pdf.streaming` | PDF URL loading strategy. Same-origin streaming is enabled by default. |
310
- | `pdf.rangeChunkSize` | PDF.js Range request chunk size. |
311
- | `typst.compilerWasmUrl` | Custom Typst compiler WASM URL. |
312
- | `hooks` | Vue component lifecycle hooks for load and unload events. |
313
- | `beforeOperation` | Vue component guard before download, print, HTML export, or zoom actions. Return `false` to cancel. |
314
-
315
- React, vanilla JavaScript, and iframe integrations cannot serialize function hooks into query parameters. Use `onViewerEvent` or `onEvent` to receive lifecycle and operation events from the iframe.
316
-
317
- ## Printing, Exporting, and Watermarks
318
-
319
- - Download keeps the original file bytes. It does not write rendered output back into the source file.
320
- - Print opens a print-only document containing the rendered body and watermark, without the demo shell or host UI.
321
- - PDF print and HTML export use a dedicated adapter that renders complete pages rather than only the visible canvas.
322
- - Word print and HTML export preserve the white paper surface and page sizing while removing preview-only layout wrappers.
323
- - Spreadsheet, archive, email, EPUB, audio, video, and 3D pipelines hide unreliable print buttons when the full document cannot be printed consistently.
324
- - HTML export clones the current rendered output and converts canvas content where possible.
325
-
326
- ## Document Comparison
327
-
328
- The production demo includes a standalone comparison page:
329
-
330
- [https://viewer.flyfish.dev/compare.html](https://viewer.flyfish.dev/compare.html)
331
-
332
- It supports two-pane document preview, built-in samples, URL input, local upload, swapping panes, reset, and synchronized scrolling. The comparison page is intentionally separate from the main viewer entry so that the primary component API stays small and predictable.
333
-
334
- ## Private Deployment
335
-
336
- For npm-based iframe integrations, make sure your final static output contains:
337
-
338
- ```txt
339
- file-viewer/index.html
340
- file-viewer/assets/*
341
- file-viewer/vendor/libarchive/worker-bundle.js # optional unless you want a static Worker path
342
- file-viewer/vendor/libarchive/libarchive.wasm # keep next to worker-bundle.js when using archive.workerUrl
343
- ```
344
-
345
- The artifact repository also contains:
346
-
347
- | Path | Purpose |
348
- | --- | --- |
349
- | `dist/` | Minified library build artifacts |
350
- | `demo/` | Static production demo, including `index.html` and `compare.html` |
351
- | `adapter-demo/` | React and vanilla JavaScript integration demo |
352
- | `docs/` | Static documentation site output |
353
- | `example/` | Sample files used by the demo |
354
- | `artifacts/` | npm tarballs and packaged static build archives |
355
- | `README.md` | Default Chinese documentation |
356
- | `README.en.md` | English documentation |
357
- | `LICENSE` | Apache-2.0 license |
358
-
359
- ## Docker
360
-
361
- The project provides a static nginx runtime image and build scripts for `linux/amd64` and `linux/arm64`. A typical deployment can serve the demo and comparison page directly:
362
-
363
- ```bash
364
- docker run --rm -p 8080:80 flyfishdev/file-viewer:1.0.25
365
- ```
366
-
367
- Then open:
368
-
369
- ```txt
370
- http://localhost:8080/
371
- http://localhost:8080/compare.html
372
- ```
373
-
374
- If you build the image yourself, use the provided `Dockerfile` and keep the static viewer assets, examples, and vendor WASM files together.
375
-
376
- ## Public Artifacts vs Source Code
377
-
378
- This public repository is for artifact delivery. It contains minified build output, static demo sites, sample files, documentation output, and npm tarballs. It intentionally does not include the private source tree. The Gitee mirror is synchronized from a clean latest-artifact snapshot when needed, so domestic users can clone the full expanded artifact repository without inheriting oversized binary release history.
379
-
380
- If you need source code access, second development resources, or commercial customization, use the self-service source access portal:
381
-
382
- [https://dev.flyfish.group/shop](https://dev.flyfish.group/shop)
383
-
384
- The self-service source access price is 4.99. It is designed to make legitimate second development and commercial evaluation straightforward without mixing source delivery into the public artifact repository.
385
-
386
- ## License and Attribution
16
+ See the official documentation for the full format matrix, options, lifecycle hooks, beforeOperation, theme, watermark, search, zoom, print, and export APIs: https://doc.flyfish-viewer.app/
387
17
 
388
- Flyfish Viewer is distributed under the Apache-2.0 license. You may use the public artifacts according to that license.
18
+ Online demo: https://viewer.flyfish.dev/. License: Apache-2.0. For second development or commercial use, keep clear Flyfish Viewer attribution; shared compatibility fixes are welcome.
389
19
 
390
- For second development or commercial use, please keep clear attribution to Flyfish Viewer and contribute useful fixes or compatibility improvements back whenever possible. This keeps the preview ecosystem healthier for everyone using the component in real business systems.
20
+ 中文 README: [README.md](./README.md).