@file-viewer/web 3.2.2 → 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
@@ -1,5 +1,9 @@
1
1
  # @file-viewer/web
2
2
 
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
+
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
+
3
7
  <!-- FILE_VIEWER_PACKAGE_HEADER -->
4
8
  <p>
5
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>
@@ -9,7 +13,7 @@
9
13
  </p>
10
14
 
11
15
  <p>
12
- <a href="https://github.com/flyfish-dev/file-viewer">GitHub</a> · <a href="https://doc.file-viewer.app/">Docs</a> · <a href="https://demo.file-viewer.app/">Live demo</a> · <a href="https://doc.file-viewer.app/guide/formats">Format matrix</a> · <a href="https://github.com/flyfish-dev/file-viewer/issues">Issues</a> · <a href="https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/web/README.md">简体中文</a>
16
+ <a href="https://github.com/flyfish-dev/file-viewer">GitHub</a> · <a href="https://doc.file-viewer.app/">Docs</a> · <a href="https://demo.file-viewer.app/">Live demo</a> · <a href="https://doc.file-viewer.app/guide/formats">Format matrix</a> · <a href="https://github.com/flyfish-dev/file-viewer/issues">Issues</a> · <a href="https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/web/README.zh-CN.md">简体中文</a>
13
17
  </p>
14
18
 
15
19
  <p>
@@ -18,35 +22,41 @@
18
22
 
19
23
  > ⭐ If File Viewer helps you, please [star the repo on GitHub](https://github.com/flyfish-dev/file-viewer).
20
24
 
21
- 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:
28
+
29
+ ```bash
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.
22
38
 
23
39
  ```bash
24
- npm install @file-viewer/web
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
25
42
  ```
26
43
 
27
44
  ```html
28
- <flyfish-file-viewer
29
- id="viewer"
30
- src="/example/demo.pdf"
31
- theme="light"
32
- toolbar-position="bottom-right"
33
- style="display:block;height:720px"
34
- ></flyfish-file-viewer>
45
+ <div id="viewer" style="height:720px"></div>
35
46
  ```
36
47
 
37
48
  ```ts
38
- import { defineFileViewerElement } from '@file-viewer/web'
39
-
40
- defineFileViewerElement()
49
+ import { mountViewer } from '@file-viewer/web'
50
+ import standardRenderers from '@file-viewer/preset-standard'
41
51
 
42
- const viewer = document.getElementById('viewer')
43
- viewer.addEventListener('viewer-event', event => {
44
- 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)
45
56
  })
46
- viewer.zoomIn()
47
57
  ```
48
58
 
49
- 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).
50
60
 
51
61
  ## Style Isolation And Customization
52
62