@file-viewer/react 3.3.0 → 3.3.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 (3) hide show
  1. package/README.en.md +19 -2
  2. package/README.md +19 -2
  3. package/package.json +4 -4
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
  }}
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
  }}
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.1",
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.1"
63
63
  },
64
64
  "license": "Apache-2.0",
65
65
  "fileViewer": {