@file-viewer/react 2.3.0 → 3.0.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.
- package/README.en.md +17 -15
- package/README.md +16 -14
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -37,7 +37,7 @@ Every standard component package shares `@file-viewer/core` as the only common f
|
|
|
37
37
|
|
|
38
38
|
| Framework | Standard npm package | Entrypoints | GitHub | Gitee | Historical aliases |
|
|
39
39
|
| --- | --- | --- | --- | --- | --- |
|
|
40
|
-
| Vanilla JS / Pure Web | `@file-viewer/web` | ESM, type declarations, script tag IIFE
|
|
40
|
+
| Vanilla JS / Pure Web | `@file-viewer/web` | ESM, type declarations, script tag IIFE | [file-viewer-web](https://github.com/flyfish-dev/file-viewer-web) | [file-viewer-web](https://gitee.com/flyfish-dev/file-viewer-web) | `@flyfish-group/file-viewer-web` |
|
|
41
41
|
| Vanilla JS / Pure Web Full | `@file-viewer/web-full` | ESM, type declarations, script tag IIFE | [file-viewer-web-full](https://github.com/flyfish-dev/file-viewer-web-full) | [file-viewer-web-full](https://gitee.com/flyfish-dev/file-viewer-web-full) | none |
|
|
42
42
|
| Vue 3 | `@file-viewer/vue3` | ESM, type declarations | [file-viewer-vue3](https://github.com/flyfish-dev/file-viewer-vue3) | [file-viewer-vue3](https://gitee.com/flyfish-dev/file-viewer-vue3) | `@flyfish-group/file-viewer3`, `file-viewer3` |
|
|
43
43
|
| Vue 3 Full | `@file-viewer/vue3-full` | ESM, type declarations | [file-viewer-vue3-full](https://github.com/flyfish-dev/file-viewer-vue3-full) | [file-viewer-vue3-full](https://gitee.com/flyfish-dev/file-viewer-vue3-full) | none |
|
|
@@ -56,7 +56,7 @@ Every standard component package shares `@file-viewer/core` as the only common f
|
|
|
56
56
|
|
|
57
57
|
## Format Support Matrix
|
|
58
58
|
|
|
59
|
-
The shared catalog registers
|
|
59
|
+
The shared catalog registers 244 file extensions (221 stable and 23 experimental) across 34 preview pipelines. Experimental formats do not count toward stable support; full capability is assembled through renderer packages or presets.
|
|
60
60
|
|
|
61
61
|
| Preview pipeline | Category | Extensions | Level / status | Capabilities | Loading |
|
|
62
62
|
| --- | --- | --- | --- | --- | --- |
|
|
@@ -87,6 +87,8 @@ The shared catalog registers 221 file extensions (221 stable and 0 experimental)
|
|
|
87
87
|
| FictionBook | ebook | `.fb2` | structured / stable | download, print, HTML export, search | lazy async |
|
|
88
88
|
| UMD | ebook | `.umd` | structured / stable | download, print, HTML export, zoom(provider), search | lazy async |
|
|
89
89
|
| Image | image | `.gif`, `.jpg`, `.jpeg`, `.bmp`, `.tiff`, `.tif`, `.png`, `.svg`, `.webp`, `.avif`, `.ico`, `.heic`, `.heif`, `.jxl` | high-fidelity / stable | download, print, HTML export, zoom(provider) | lazy async |
|
|
90
|
+
| DICOM | medical-image | `.dcm`, `.dicom` | basic / experimental | download, zoom(provider) | lazy async |
|
|
91
|
+
| Digital signatures and evidence containers | cryptographic-container | `.p7m`, `.p7s`, `.p7c`, `.p7b`, `.pkcs7`, `.cms`, `.cmsc`, `.tsd`, `.tst`, `.tsq`, `.tsr`, `.asics`, `.scs`, `.asice`, `.sce`, `.ers`, `.asc`, `.sig`, `.pgp`, `.gpg`, `.jws` | structured / experimental | download | lazy async |
|
|
90
92
|
| Markdown | markdown | `.md`, `.markdown` | structured / stable | download, print, HTML export, search | lazy async |
|
|
91
93
|
| Code and Text | code | `.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`, `.patch`, `.bundle`, `.bdl`, `.jsonc`, `.json5`, `.ipynb`, `.toml`, `.proto`, `.hcl`, `.tex`, `.gv`, `.http`, `.react`, `.rb`, `.swift`, `.kt` | structured / stable | download, print, HTML export, search | lazy async |
|
|
92
94
|
| Video | media | `.mp4`, `.webm`, `.m3u8` | high-fidelity / stable | download | lazy async |
|
|
@@ -195,7 +197,7 @@ const options = {
|
|
|
195
197
|
- `copyAssets:true` copies PDF/CAD/Typst/Archive/Data workers, WASM, and vendor assets for offline and enterprise intranet deployment; archive directories use `vendor/libarchive/worker-bundle.js` / `libarchive.wasm` first, while the compatibility path only covers ZIP/TAR/GZIP when the Worker cannot start.
|
|
196
198
|
- `builtinRenderers` remains available for advanced baseline control or historical compatibility. Normal quick starts only need `preset` / `renderers` plus `rendererMode`.
|
|
197
199
|
- If a file is in the supported matrix but its renderer is not assembled, the viewer shows the recommended preset / renderer package. Truly unknown extensions still show an unsupported-format state.
|
|
198
|
-
- `@file-viewer/preset-all` provides the
|
|
200
|
+
- `@file-viewer/preset-all` provides the published compatibility renderer matrix; Worker, WASM, font, and vendor assets still need to be deployed by the Vite plugin or `file-viewer-copy-assets`. `*-full` packages already include this preset and must not install it again. DICOM and signature containers are later explicit opt-ins.
|
|
199
201
|
|
|
200
202
|
## Shared Options And Events
|
|
201
203
|
|
|
@@ -239,11 +241,11 @@ The table below lists the real props, event channel, and customization entry for
|
|
|
239
241
|
| `archive` | Archive Worker/WASM URLs, timeout, cache, archive limits, nested entry preview limits, and legacy GBK/GB18030 ZIP filename decoding. |
|
|
240
242
|
| `pdf` | PDF.js worker, navigation pane, outline, thumbnails, rotation, streaming, range chunk size, and credentials. |
|
|
241
243
|
| `docx` / `spreadsheet` | DOCX is provided by @file-viewer/renderer-word and uses the self-maintained @file-viewer/docx engine with automatic worker/main-thread selection, continuous flow reading, and async rendering by default; visual pagination is opt-in. Spreadsheet is provided by @file-viewer/renderer-spreadsheet with fidelity-first parsing, automatic Worker use for large files, and opt-in header drag column resizing. |
|
|
242
|
-
| `iwork` | Pages / Numbers / Keynote module Worker, timeout, ZIP/Snappy/IWA safety limits, and
|
|
243
|
-
| `hangul` | HWP/HWPX module Worker, timeout, ZIP
|
|
244
|
-
| `wordPerfect` | WordPerfect Worker,
|
|
245
|
-
| `presentation` | The
|
|
246
|
-
| `typst` / `data` / `cad` | Typst, SQLite, CAD/DWG/DXF/DWF WASM, worker, encoding, and rendering
|
|
244
|
+
| `iwork` | After explicitly installing the iWork capability, configure its Pages / Numbers / Keynote module Worker, timeout, ZIP/Snappy/IWA safety limits, and Quick Look fallback policy. It is not in the standard/full default closure. |
|
|
245
|
+
| `hangul` | After explicitly installing the Hangul capability, configure its HWP/HWPX module Worker, timeout, ZIP limits, and HWP record limits. It is not in the standard/full default closure. |
|
|
246
|
+
| `wordPerfect` | After explicitly installing the WordPerfect capability, configure its Worker, libwpd/librevenge WASM URL, and timeout. It is not in the standard/full default closure. |
|
|
247
|
+
| `presentation` | The standard/full default includes only the PPTX/OpenXML `@file-viewer/pptx` Worker, with optional `workerUrl` / `workerType` overrides. Binary PowerPoint 97–2003 `.ppt` is a separate heavy capability; run `file-viewer add ppt --write` to install its Worker/WASM and assets explicitly. |
|
|
248
|
+
| `typst` / `data` / `cad` | After explicitly installing the matching capability, configure Typst, SQLite, or CAD/DWG/DXF/DWF WASM, worker, encoding, and rendering options. These capabilities are not in the standard/full default closure. |
|
|
247
249
|
| `hooks` / `beforeOperation` | Shared lifecycle hooks and operation preflight checks for audit, permission, telemetry, and safety controls. |
|
|
248
250
|
|
|
249
251
|
## Style Isolation And Theme Customization
|
|
@@ -351,13 +353,13 @@ View-state sync is designed for projection systems, remote-control displays, sid
|
|
|
351
353
|
|
|
352
354
|
| Asset | Description |
|
|
353
355
|
| --- | --- |
|
|
354
|
-
|
|
|
355
|
-
| CAD
|
|
356
|
-
| PDF / DOCX / Excel /
|
|
357
|
-
|
|
|
358
|
-
|
|
|
359
|
-
| Offline deployment | Runtime
|
|
360
|
-
| Deployment principle |
|
|
356
|
+
| Standard assets | `@file-viewer/assets-standard` copies only the workers, WASM, fonts, and vendor files required by the frozen standard profile: PDF, DOCX, PPTX, spreadsheet/OpenXML, and archives. Its transactional receipt records package version, profile hash, per-file SHA-256, and ownership. |
|
|
357
|
+
| Specialist asset owners | CAD, Typst, iWork, 3D, Data, Drawing, Hangul, WordPerfect, and legacy PPT each use an independent `@file-viewer/assets-*` package. `@file-viewer/cli add <format> --write` selects only that capability and its assets. |
|
|
358
|
+
| PDF / DOCX / Excel / PPTX | Standard self-hosts the PDF.js worker/fonts, DOCX worker, spreadsheet worker, and PPTX worker. PPTX charts and PDF Identity-font repair are explicit standard correctness capabilities, so charts and font repair are never silently omitted. |
|
|
359
|
+
| Archive / email / native media | The archive libarchive Worker/WASM is in standard assets. Email, common images, and browser-native media use lazy-loaded code. HLS, MIDI, RTF, Mermaid, patch, and git bundle remain explicit capabilities and are not auto-installed as npm peers. |
|
|
360
|
+
| Draw.io | The safe project-maintained Drawing fallback ships with its renderer. The official diagrams.net viewer is a separate heavy `drawio-official` capability and is not in the standard profile for new projects. The published capability boundary of historical `*-full` packages remains compatible. |
|
|
361
|
+
| Offline deployment | Runtime code does not use public CDNs. Vite `copyAssets:true` publishes installed asset owners; other tools use `file-viewer install --yes` or `file-viewer assets --write`. Owners merge transactionally into one deterministic runtime manifest independent of install order. |
|
|
362
|
+
| Deployment principle | New formats are opt-in by default and never expand an already published `*-full` package automatically. Specialist workers, WASM, and parsers load only when their format is used. New projects should prefer standard or selected capabilities; historical full integrations retain their existing matrix. |
|
|
361
363
|
|
|
362
364
|
|
|
363
365
|
## Quality Gates
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ export function Preview() {
|
|
|
37
37
|
|
|
38
38
|
| 框架 | 标准 npm 包 | 入口格式 | GitHub | Gitee | 兼容历史包 |
|
|
39
39
|
| --- | --- | --- | --- | --- | --- |
|
|
40
|
-
| Vanilla JS / Pure Web | `@file-viewer/web` | ESM, 类型声明, script 标签 IIFE
|
|
40
|
+
| Vanilla JS / Pure Web | `@file-viewer/web` | ESM, 类型声明, script 标签 IIFE | [file-viewer-web](https://github.com/flyfish-dev/file-viewer-web) | [file-viewer-web](https://gitee.com/flyfish-dev/file-viewer-web) | `@flyfish-group/file-viewer-web` |
|
|
41
41
|
| Vanilla JS / Pure Web Full | `@file-viewer/web-full` | ESM, 类型声明, script 标签 IIFE | [file-viewer-web-full](https://github.com/flyfish-dev/file-viewer-web-full) | [file-viewer-web-full](https://gitee.com/flyfish-dev/file-viewer-web-full) | 无 |
|
|
42
42
|
| Vue 3 | `@file-viewer/vue3` | ESM, 类型声明 | [file-viewer-vue3](https://github.com/flyfish-dev/file-viewer-vue3) | [file-viewer-vue3](https://gitee.com/flyfish-dev/file-viewer-vue3) | `@flyfish-group/file-viewer3`, `file-viewer3` |
|
|
43
43
|
| Vue 3 Full | `@file-viewer/vue3-full` | ESM, 类型声明 | [file-viewer-vue3-full](https://github.com/flyfish-dev/file-viewer-vue3-full) | [file-viewer-vue3-full](https://gitee.com/flyfish-dev/file-viewer-vue3-full) | 无 |
|
|
@@ -56,7 +56,7 @@ export function Preview() {
|
|
|
56
56
|
|
|
57
57
|
## 格式支持矩阵
|
|
58
58
|
|
|
59
|
-
共享格式目录当前注册
|
|
59
|
+
共享格式目录当前注册 244 个扩展名(221 个稳定、23 个实验),映射到 34 条预览链路。实验格式不计入稳定支持数量;完整能力通过 renderer / preset 按需装配。
|
|
60
60
|
|
|
61
61
|
| 预览链路 | 分类 | 扩展名 | 等级 / 状态 | 能力 | 加载 |
|
|
62
62
|
| --- | --- | --- | --- | --- | --- |
|
|
@@ -87,6 +87,8 @@ export function Preview() {
|
|
|
87
87
|
| FictionBook | ebook | `.fb2` | structured / stable | 下载, 打印, HTML, 搜索 | 按需异步 |
|
|
88
88
|
| UMD | ebook | `.umd` | structured / stable | 下载, 打印, HTML, 缩放(Provider), 搜索 | 按需异步 |
|
|
89
89
|
| Image | image | `.gif`, `.jpg`, `.jpeg`, `.bmp`, `.tiff`, `.tif`, `.png`, `.svg`, `.webp`, `.avif`, `.ico`, `.heic`, `.heif`, `.jxl` | high-fidelity / stable | 下载, 打印, HTML, 缩放(Provider) | 按需异步 |
|
|
90
|
+
| DICOM | medical-image | `.dcm`, `.dicom` | basic / experimental | 下载, 缩放(Provider) | 按需异步 |
|
|
91
|
+
| Digital signatures and evidence containers | cryptographic-container | `.p7m`, `.p7s`, `.p7c`, `.p7b`, `.pkcs7`, `.cms`, `.cmsc`, `.tsd`, `.tst`, `.tsq`, `.tsr`, `.asics`, `.scs`, `.asice`, `.sce`, `.ers`, `.asc`, `.sig`, `.pgp`, `.gpg`, `.jws` | structured / experimental | 下载 | 按需异步 |
|
|
90
92
|
| Markdown | markdown | `.md`, `.markdown` | structured / stable | 下载, 打印, HTML, 搜索 | 按需异步 |
|
|
91
93
|
| Code and Text | code | `.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`, `.patch`, `.bundle`, `.bdl`, `.jsonc`, `.json5`, `.ipynb`, `.toml`, `.proto`, `.hcl`, `.tex`, `.gv`, `.http`, `.react`, `.rb`, `.swift`, `.kt` | structured / stable | 下载, 打印, HTML, 搜索 | 按需异步 |
|
|
92
94
|
| Video | media | `.mp4`, `.webm`, `.m3u8` | high-fidelity / stable | 下载 | 按需异步 |
|
|
@@ -239,11 +241,11 @@ const options = {
|
|
|
239
241
|
| `archive` | 配置压缩包 Worker/WASM、超时、缓存、包体限制和压缩包内单文件预览大小;旧 ZIP 中文文件名会自动按 GBK/GB18030 兼容解码。 |
|
|
240
242
|
| `pdf` | 配置 PDF.js Worker、导航栏、目录、缩略图、旋转、流式读取、Range chunk 和凭据。 |
|
|
241
243
|
| `docx` / `spreadsheet` | DOCX 由 @file-viewer/renderer-word 承接并使用自研 @file-viewer/docx,默认自动选择 Worker 或主线程解析,连续流式阅读和异步分批渲染,可按需显式开启视觉分页;表格由 @file-viewer/renderer-spreadsheet 承接,默认保真解析,大文件自动启用 Worker,表头拖拽调列宽可按需显式开启。 |
|
|
242
|
-
| `iwork` |
|
|
243
|
-
| `hangul` |
|
|
244
|
-
| `wordPerfect` |
|
|
245
|
-
| `presentation` |
|
|
246
|
-
| `typst` / `data` / `cad` |
|
|
244
|
+
| `iwork` | 显式安装 iWork capability 后,配置 Pages / Numbers / Keynote 的模块 Worker、超时、ZIP/Snappy/IWA 安全上限与 Quick Look 降级策略;它不属于 standard/full 默认闭包。 |
|
|
245
|
+
| `hangul` | 显式安装 Hangul capability 后,配置 HWP/HWPX 模块 Worker、超时、ZIP 解压/压缩率/条目数与 HWP 记录数安全上限;它不属于 standard/full 默认闭包。 |
|
|
246
|
+
| `wordPerfect` | 显式安装 WordPerfect capability 后,配置 Worker、libwpd/librevenge WASM 地址与超时;它不属于 standard/full 默认闭包。 |
|
|
247
|
+
| `presentation` | standard/full 默认只装配 PPTX/OpenXML 的 `@file-viewer/pptx` Worker,可通过 `workerUrl` / `workerType` 覆盖。PowerPoint 97–2003 `.ppt` 是独立重型 capability,需用 `file-viewer add ppt --write` 显式安装其 Worker/WASM 和资产。 |
|
|
248
|
+
| `typst` / `data` / `cad` | 显式安装相应 capability 后,配置 Typst、SQLite、CAD/DWG/DXF/DWF 等 WASM、Worker、编码和渲染策略;这些能力不属于 standard/full 默认闭包。 |
|
|
247
249
|
| `hooks` / `beforeOperation` | 统一生命周期 hooks 和操作前置校验,可用于审计、权限、埋点和安全控制。 |
|
|
248
250
|
|
|
249
251
|
## 样式隔离与主题定制
|
|
@@ -351,13 +353,13 @@ const options = {
|
|
|
351
353
|
|
|
352
354
|
| 资源 | 说明 |
|
|
353
355
|
| --- | --- |
|
|
354
|
-
|
|
|
355
|
-
| CAD
|
|
356
|
-
| PDF / DOCX / Excel /
|
|
357
|
-
|
|
|
358
|
-
|
|
|
359
|
-
| 离线部署 | 运行时不依赖公共 CDN
|
|
360
|
-
| 部署原则 |
|
|
356
|
+
| Standard 资产 | `@file-viewer/assets-standard` 只复制 PDF、DOCX、PPTX、Excel/OpenXML 与 Archive 等冻结 standard 所需 Worker、WASM、字体和 vendor 文件;事务收据记录包版本、profile hash、逐文件 SHA-256 和 owner。 |
|
|
357
|
+
| 专用资产 owner | CAD、Typst、iWork、3D、Data、Drawing、Hangul、WordPerfect 和旧版 PPT 各自使用独立 `@file-viewer/assets-*` 包。`@file-viewer/cli add <format> --write` 只选择该能力及其资产,不下载旁系格式。 |
|
|
358
|
+
| PDF / DOCX / Excel / PPTX | standard 支持自托管 PDF.js Worker/字体、DOCX Worker、Spreadsheet Worker 与 PPTX Worker。PPTX 图表和 PDF Identity-font repair 属于正确性能力,已明确纳入 standard;不会静默省略图表或字体修复。 |
|
|
359
|
+
| Archive / Email / 原生媒体 | Archive 的 libarchive Worker/WASM 属于 standard 资产;Email、常见图片和浏览器原生音视频按需加载代码。HLS、MIDI、RTF、Mermaid、patch/git bundle 是显式 capability,不会因 npm peer 自动安装。 |
|
|
360
|
+
| Draw.io | 安全自研 Drawing fallback 随 renderer 提供;diagrams.net official viewer 是独立 `drawio-official` 重型 capability,不进入新项目的 standard 默认闭包。历史 `*-full` 包的已发布能力边界保持兼容。 |
|
|
361
|
+
| 离线部署 | 运行时不依赖公共 CDN。Vite `copyAssets:true` 按已安装 asset owner 发布;其它构建工具运行 `file-viewer install --yes` 或 `file-viewer assets --write`。所有 owner 事务性合并为稳定运行时 manifest,安装顺序不影响结果。 |
|
|
362
|
+
| 部署原则 | 新格式默认 opt-in,不会自动扩张已发布的 `*-full` 包。只有命中特定格式时才加载对应 Worker、WASM 或解析库;新项目优先使用 standard 或按需 capability,历史 full 集成继续保留原能力矩阵。 |
|
|
361
363
|
|
|
362
364
|
|
|
363
365
|
## 质量门禁
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standard React component package for File Viewer",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": ">=17 <20"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@file-viewer/core": "
|
|
58
|
+
"@file-viewer/core": "3.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.2.17",
|