@file-viewer/react 3.3.0 → 3.3.3

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.zh-CN.md)
4
4
 
5
+ Browser-side file preview for React 18/19. Use one component API for loading, search, zoom, page navigation, print and export where supported by the selected format. This is the lightweight package: add renderer presets for PDF, Office and other document formats.
6
+
5
7
  <!-- FILE_VIEWER_PACKAGE_HEADER -->
6
8
  <p>
7
9
  <a href="https://www.npmjs.com/package/@file-viewer/react"><img src="https://img.shields.io/npm/v/@file-viewer%2Freact?logo=npm" alt="npm version"></a>
@@ -20,14 +22,28 @@
20
22
 
21
23
  > ⭐ If File Viewer helps you, please [star the repo on GitHub](https://github.com/flyfish-dev/file-viewer).
22
24
 
23
- The standard React native component package for Flyfish File Viewer. The component renders a React container and mounts the complete viewer through this package's local controller on top of `@file-viewer/core` and the core browser engine. It keeps ref APIs, controlled props, lifecycle events, and the full options surface.
25
+ ## Quick start
26
+
27
+ Create an application with renderers and local assets configured:
28
+
29
+ ```bash
30
+ npx file-viewer-cli@latest create my-viewer --framework react --profile standard
31
+ ```
32
+
33
+ For an existing project, use `npx file-viewer-cli@latest add .`, or follow the [manual integration guide](https://doc.file-viewer.app/guide/on-demand-renderers). The component alone does not install document engines or deploy their Worker/WASM files.
34
+
35
+ ## Manual integration
36
+
37
+ The examples below require the matching renderer preset and self-hosted assets. The CLI configures these for you; a bare component install is not a PDF or Office viewer.
24
38
 
25
39
  ```bash
26
- npm install @file-viewer/react
40
+ npm install @file-viewer/react @file-viewer/preset-standard file-viewer-copy-assets
41
+ npx --no-install file-viewer-copy-assets ./public/file-viewer
27
42
  ```
28
43
 
29
44
  ```tsx
30
45
  import FileViewer from '@file-viewer/react'
46
+ import standardRenderers from '@file-viewer/preset-standard'
31
47
 
32
48
  export function Preview() {
33
49
  return (
@@ -35,6 +51,7 @@ export function Preview() {
35
51
  <FileViewer
36
52
  url="/example/demo.docx"
37
53
  options={{
54
+ preset: standardRenderers,
38
55
  theme: 'light',
39
56
  toolbar: { position: 'bottom-right' }
40
57
  }}
@@ -277,7 +294,7 @@ The table below lists the real props, event channel, and customization entry for
277
294
  | `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. |
278
295
  | `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. |
279
296
  | `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. |
280
- | `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. |
297
+ | `presentation` | Standard includes PPTX/OpenXML; Office/All presets and Full packages also support binary `.ppt` / `.pot`. PPT uses an Apache-2.0 TypeScript engine and parsing Worker, without WASM or embedded fonts. Minimal installs can use `file-viewer add ppt --write`; custom routes can override `pptModuleUrl` / `pptWorkerUrl`. |
281
298
  | `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. |
282
299
  | `hooks` / `beforeOperation` | Shared lifecycle hooks and operation preflight checks for audit, permission, telemetry, and safety controls. |
283
300
 
@@ -403,7 +420,7 @@ View-state sync is designed for projection systems, remote-control displays, sid
403
420
 
404
421
  See the official documentation for options, lifecycle hooks, beforeOperation, theme, watermark, search, zoom, print, and export APIs: https://doc.file-viewer.app/
405
422
 
406
- Online demo: https://demo.file-viewer.app/. File Viewer-authored source and component packages generated by this repository use Apache-2.0. Any distribution that includes the `@file-viewer/ppt` runtime retains its independent LICENSE and NOTICE and does not relicense it under Apache-2.0. For derivative or commercial use, keep clear Flyfish Viewer attribution; shared compatibility fixes are welcome in the matching component repository.
423
+ Online demo: https://demo.file-viewer.app/. File Viewer-authored source, component packages and the new compiled TypeScript PPT runtime use Apache-2.0. The PPT engine source remains private; retain its LICENSE and NOTICE.md. Previous native PPT license and watermark requirements are unchanged, and other third-party runtimes retain their original licenses. Keep Flyfish Viewer attribution in derivative and commercial use.
407
424
  <!-- FILE_VIEWER_GENERATED:END -->
408
425
 
409
426
  ## Formats and related packages
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.zh-CN.md)
4
4
 
5
+ Browser-side file preview for React 18/19. Use one component API for loading, search, zoom, page navigation, print and export where supported by the selected format. This is the lightweight package: add renderer presets for PDF, Office and other document formats.
6
+
5
7
  <!-- FILE_VIEWER_PACKAGE_HEADER -->
6
8
  <p>
7
9
  <a href="https://www.npmjs.com/package/@file-viewer/react"><img src="https://img.shields.io/npm/v/@file-viewer%2Freact?logo=npm" alt="npm version"></a>
@@ -20,14 +22,28 @@
20
22
 
21
23
  > ⭐ If File Viewer helps you, please [star the repo on GitHub](https://github.com/flyfish-dev/file-viewer).
22
24
 
23
- The standard React native component package for Flyfish File Viewer. The component renders a React container and mounts the complete viewer through this package's local controller on top of `@file-viewer/core` and the core browser engine. It keeps ref APIs, controlled props, lifecycle events, and the full options surface.
25
+ ## Quick start
26
+
27
+ Create an application with renderers and local assets configured:
28
+
29
+ ```bash
30
+ npx file-viewer-cli@latest create my-viewer --framework react --profile standard
31
+ ```
32
+
33
+ For an existing project, use `npx file-viewer-cli@latest add .`, or follow the [manual integration guide](https://doc.file-viewer.app/guide/on-demand-renderers). The component alone does not install document engines or deploy their Worker/WASM files.
34
+
35
+ ## Manual integration
36
+
37
+ The examples below require the matching renderer preset and self-hosted assets. The CLI configures these for you; a bare component install is not a PDF or Office viewer.
24
38
 
25
39
  ```bash
26
- npm install @file-viewer/react
40
+ npm install @file-viewer/react @file-viewer/preset-standard file-viewer-copy-assets
41
+ npx --no-install file-viewer-copy-assets ./public/file-viewer
27
42
  ```
28
43
 
29
44
  ```tsx
30
45
  import FileViewer from '@file-viewer/react'
46
+ import standardRenderers from '@file-viewer/preset-standard'
31
47
 
32
48
  export function Preview() {
33
49
  return (
@@ -35,6 +51,7 @@ export function Preview() {
35
51
  <FileViewer
36
52
  url="/example/demo.docx"
37
53
  options={{
54
+ preset: standardRenderers,
38
55
  theme: 'light',
39
56
  toolbar: { position: 'bottom-right' }
40
57
  }}
@@ -277,7 +294,7 @@ The table below lists the real props, event channel, and customization entry for
277
294
  | `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. |
278
295
  | `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. |
279
296
  | `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. |
280
- | `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. |
297
+ | `presentation` | Standard includes PPTX/OpenXML; Office/All presets and Full packages also support binary `.ppt` / `.pot`. PPT uses an Apache-2.0 TypeScript engine and parsing Worker, without WASM or embedded fonts. Minimal installs can use `file-viewer add ppt --write`; custom routes can override `pptModuleUrl` / `pptWorkerUrl`. |
281
298
  | `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. |
282
299
  | `hooks` / `beforeOperation` | Shared lifecycle hooks and operation preflight checks for audit, permission, telemetry, and safety controls. |
283
300
 
@@ -403,7 +420,7 @@ View-state sync is designed for projection systems, remote-control displays, sid
403
420
 
404
421
  See the official documentation for options, lifecycle hooks, beforeOperation, theme, watermark, search, zoom, print, and export APIs: https://doc.file-viewer.app/
405
422
 
406
- Online demo: https://demo.file-viewer.app/. File Viewer-authored source and component packages generated by this repository use Apache-2.0. Any distribution that includes the `@file-viewer/ppt` runtime retains its independent LICENSE and NOTICE and does not relicense it under Apache-2.0. For derivative or commercial use, keep clear Flyfish Viewer attribution; shared compatibility fixes are welcome in the matching component repository.
423
+ Online demo: https://demo.file-viewer.app/. File Viewer-authored source, component packages and the new compiled TypeScript PPT runtime use Apache-2.0. The PPT engine source remains private; retain its LICENSE and NOTICE.md. Previous native PPT license and watermark requirements are unchanged, and other third-party runtimes retain their original licenses. Keep Flyfish Viewer attribution in derivative and commercial use.
407
424
  <!-- FILE_VIEWER_GENERATED:END -->
408
425
 
409
426
  ## Formats and related packages
package/README.zh-CN.md CHANGED
@@ -277,7 +277,7 @@ const options = {
277
277
  | `iwork` | 显式安装 iWork capability 后,配置 Pages / Numbers / Keynote 的模块 Worker、超时、ZIP/Snappy/IWA 安全上限与 Quick Look 降级策略;它不属于 standard/full 默认闭包。 |
278
278
  | `hangul` | 显式安装 Hangul capability 后,配置 HWP/HWPX 模块 Worker、超时、ZIP 解压/压缩率/条目数与 HWP 记录数安全上限;它不属于 standard/full 默认闭包。 |
279
279
  | `wordPerfect` | 显式安装 WordPerfect capability 后,配置 Worker、libwpd/librevenge WASM 地址与超时;它不属于 standard/full 默认闭包。 |
280
- | `presentation` | standard/full 默认只装配 PPTX/OpenXML 的 `@file-viewer/pptx` Worker,可通过 `workerUrl` / `workerType` 覆盖。PowerPoint 97–2003 `.ppt` 是独立重型 capability,需用 `file-viewer add ppt --write` 显式安装其 Worker/WASM 和资产。 |
280
+ | `presentation` | standard 默认包含 PPTX/OpenXML;Office/All preset 和 Full 包同时支持二进制 `.ppt` / `.pot`。PPT 使用 Apache-2.0 的 TypeScript 引擎与解析 Worker,无需 WASM 或内置字体。精简安装可用 `file-viewer add ppt --write`;自定义路径可覆盖 `pptModuleUrl` / `pptWorkerUrl`。 |
281
281
  | `typst` / `data` / `cad` | 显式安装相应 capability 后,配置 Typst、SQLite、CAD/DWG/DXF/DWF 等 WASM、Worker、编码和渲染策略;这些能力不属于 standard/full 默认闭包。 |
282
282
  | `hooks` / `beforeOperation` | 统一生命周期 hooks 和操作前置校验,可用于审计、权限、埋点和安全控制。 |
283
283
 
@@ -403,7 +403,7 @@ const options = {
403
403
 
404
404
  完整参数、生命周期 hooks、beforeOperation、主题、水印、搜索、缩放、打印和导出说明见官方文档: https://doc.file-viewer.app/
405
405
 
406
- 在线 Demo: https://demo.file-viewer.app/ 。File Viewer 自身源码与本仓生成的组件包使用 Apache-2.0;发行物若包含 `@file-viewer/ppt` 运行时,该运行时保留其独立 LICENSE 与 NOTICE,不被 Apache-2.0 重新许可。二开或商用请保留 Flyfish Viewer 来源说明;如果修复了通用兼容问题,也欢迎贡献回对应组件仓库。
406
+ 在线 Demo: https://demo.file-viewer.app/ 。File Viewer 自身源码、组件包和新 TypeScript PPT 公共编译包使用 Apache-2.0;PPT 引擎源码保持私有,发行时保留其 LICENSE 与 NOTICE.md。旧 native PPT 的许可和水印要求不变,其余第三方运行时保留原许可证。二开或商用请保留 Flyfish Viewer 来源说明。
407
407
  <!-- FILE_VIEWER_GENERATED:END -->
408
408
 
409
409
  ## 格式与相关包
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@file-viewer/react",
3
- "version": "3.3.0",
3
+ "version": "3.3.3",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "Standard React component package for File Viewer",
6
+ "description": "Lightweight React 18/19 file viewer. Add PDF, Office and other browser-side previews with renderer presets.",
7
7
  "keywords": [
8
8
  "file-viewer",
9
9
  "document-preview",
@@ -26,7 +26,7 @@
26
26
  "type": "git",
27
27
  "url": "git+https://github.com/flyfish-dev/file-viewer.git"
28
28
  },
29
- "homepage": "https://doc.file-viewer.app/",
29
+ "homepage": "https://github.com/flyfish-dev/file-viewer#readme",
30
30
  "bugs": {
31
31
  "url": "https://github.com/flyfish-dev/file-viewer/issues"
32
32
  },
@@ -59,7 +59,7 @@
59
59
  "react": ">=17 <20"
60
60
  },
61
61
  "dependencies": {
62
- "@file-viewer/core": "3.3.0"
62
+ "@file-viewer/core": "3.3.3"
63
63
  },
64
64
  "license": "Apache-2.0",
65
65
  "fileViewer": {