@file-viewer/web 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.
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/web/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/web/README.zh-CN.md)
4
4
 
5
+ Browser-side file preview for Vanilla JS / Pure Web. 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/web"><img src="https://img.shields.io/npm/v/@file-viewer%2Fweb?logo=npm" alt="npm version"></a>
@@ -20,35 +22,41 @@
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 pure web native component package for Flyfish File Viewer. It ships the `<flyfish-file-viewer>` Web Component, imperative `mountViewer` controller, IIFE global bundle, and asset-copy CLI for legacy admin pages, script-tag usage, micro-frontends, and framework-free systems.
25
+ ## Quick start
26
+
27
+ Create an application with renderers and local assets configured:
24
28
 
25
29
  ```bash
26
- npm install @file-viewer/web
30
+ npx file-viewer-cli@latest create my-viewer --framework web --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.
38
+
39
+ ```bash
40
+ npm install @file-viewer/web @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
  ```html
30
- <flyfish-file-viewer
31
- id="viewer"
32
- src="/example/demo.pdf"
33
- theme="light"
34
- toolbar-position="bottom-right"
35
- style="display:block;height:720px"
36
- ></flyfish-file-viewer>
45
+ <div id="viewer" style="height:720px"></div>
37
46
  ```
38
47
 
39
48
  ```ts
40
- import { defineFileViewerElement } from '@file-viewer/web'
41
-
42
- defineFileViewerElement()
49
+ import { mountViewer } from '@file-viewer/web'
50
+ import standardRenderers from '@file-viewer/preset-standard'
43
51
 
44
- const viewer = document.getElementById('viewer')
45
- viewer.addEventListener('viewer-event', event => {
46
- console.log(event.detail.type)
52
+ const viewer = mountViewer(document.getElementById('viewer')!, {
53
+ url: '/example/demo.pdf',
54
+ options: { preset: standardRenderers, theme: 'light' },
55
+ onEvent: event => console.log(event.type)
47
56
  })
48
- viewer.zoomIn()
49
57
  ```
50
58
 
51
- Use `mountViewer(container, options)` when you need a fully imperative controller.
59
+ `mountViewer(container, options)` returns the controller API. For declarative markup, the same package also provides `<flyfish-file-viewer>`; see the [Web Component guide](https://doc.file-viewer.app/guide/quickstart-web).
52
60
 
53
61
  ## Style Isolation And Customization
54
62
 
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/web/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/web/README.zh-CN.md)
4
4
 
5
+ Browser-side file preview for Vanilla JS / Pure Web. 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/web"><img src="https://img.shields.io/npm/v/@file-viewer%2Fweb?logo=npm" alt="npm version"></a>
@@ -20,35 +22,41 @@
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 pure web native component package for Flyfish File Viewer. It ships the `<flyfish-file-viewer>` Web Component, imperative `mountViewer` controller, IIFE global bundle, and asset-copy CLI for legacy admin pages, script-tag usage, micro-frontends, and framework-free systems.
25
+ ## Quick start
26
+
27
+ Create an application with renderers and local assets configured:
24
28
 
25
29
  ```bash
26
- npm install @file-viewer/web
30
+ npx file-viewer-cli@latest create my-viewer --framework web --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.
38
+
39
+ ```bash
40
+ npm install @file-viewer/web @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
  ```html
30
- <flyfish-file-viewer
31
- id="viewer"
32
- src="/example/demo.pdf"
33
- theme="light"
34
- toolbar-position="bottom-right"
35
- style="display:block;height:720px"
36
- ></flyfish-file-viewer>
45
+ <div id="viewer" style="height:720px"></div>
37
46
  ```
38
47
 
39
48
  ```ts
40
- import { defineFileViewerElement } from '@file-viewer/web'
41
-
42
- defineFileViewerElement()
49
+ import { mountViewer } from '@file-viewer/web'
50
+ import standardRenderers from '@file-viewer/preset-standard'
43
51
 
44
- const viewer = document.getElementById('viewer')
45
- viewer.addEventListener('viewer-event', event => {
46
- console.log(event.detail.type)
52
+ const viewer = mountViewer(document.getElementById('viewer')!, {
53
+ url: '/example/demo.pdf',
54
+ options: { preset: standardRenderers, theme: 'light' },
55
+ onEvent: event => console.log(event.type)
47
56
  })
48
- viewer.zoomIn()
49
57
  ```
50
58
 
51
- Use `mountViewer(container, options)` when you need a fully imperative controller.
59
+ `mountViewer(container, options)` returns the controller API. For declarative markup, the same package also provides `<flyfish-file-viewer>`; see the [Web Component guide](https://doc.file-viewer.app/guide/quickstart-web).
52
60
 
53
61
  ## Style Isolation And Customization
54
62