@file-viewer/web 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 +27 -19
- package/README.md +27 -19
- package/README.zh-CN.md +2 -2
- package/dist/flyfish-file-viewer-web.amd.js +26 -23
- package/dist/flyfish-file-viewer-web.iife.js +26 -23
- 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/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
|
-
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
Create an application with renderers and local assets configured:
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -326,7 +334,7 @@ The table below lists the real props, event channel, and customization entry for
|
|
|
326
334
|
| `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. |
|
|
327
335
|
| `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. |
|
|
328
336
|
| `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. |
|
|
329
|
-
| `presentation` |
|
|
337
|
+
| `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`. |
|
|
330
338
|
| `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. |
|
|
331
339
|
| `hooks` / `beforeOperation` | Shared lifecycle hooks and operation preflight checks for audit, permission, telemetry, and safety controls. |
|
|
332
340
|
|
|
@@ -450,7 +458,7 @@ View-state sync is designed for projection systems, remote-control displays, sid
|
|
|
450
458
|
|
|
451
459
|
See the official documentation for options, lifecycle hooks, beforeOperation, theme, watermark, search, zoom, print, and export APIs: https://doc.file-viewer.app/
|
|
452
460
|
|
|
453
|
-
Online demo: https://demo.file-viewer.app/. File Viewer-authored source
|
|
461
|
+
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.
|
|
454
462
|
<!-- FILE_VIEWER_GENERATED:END -->
|
|
455
463
|
|
|
456
464
|
## 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/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
|
-
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
Create an application with renderers and local assets configured:
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -326,7 +334,7 @@ The table below lists the real props, event channel, and customization entry for
|
|
|
326
334
|
| `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. |
|
|
327
335
|
| `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. |
|
|
328
336
|
| `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. |
|
|
329
|
-
| `presentation` |
|
|
337
|
+
| `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`. |
|
|
330
338
|
| `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. |
|
|
331
339
|
| `hooks` / `beforeOperation` | Shared lifecycle hooks and operation preflight checks for audit, permission, telemetry, and safety controls. |
|
|
332
340
|
|
|
@@ -450,7 +458,7 @@ View-state sync is designed for projection systems, remote-control displays, sid
|
|
|
450
458
|
|
|
451
459
|
See the official documentation for options, lifecycle hooks, beforeOperation, theme, watermark, search, zoom, print, and export APIs: https://doc.file-viewer.app/
|
|
452
460
|
|
|
453
|
-
Online demo: https://demo.file-viewer.app/. File Viewer-authored source
|
|
461
|
+
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.
|
|
454
462
|
<!-- FILE_VIEWER_GENERATED:END -->
|
|
455
463
|
|
|
456
464
|
## Formats and related packages
|
package/README.zh-CN.md
CHANGED
|
@@ -325,7 +325,7 @@ const options = {
|
|
|
325
325
|
| `iwork` | 显式安装 iWork capability 后,配置 Pages / Numbers / Keynote 的模块 Worker、超时、ZIP/Snappy/IWA 安全上限与 Quick Look 降级策略;它不属于 standard/full 默认闭包。 |
|
|
326
326
|
| `hangul` | 显式安装 Hangul capability 后,配置 HWP/HWPX 模块 Worker、超时、ZIP 解压/压缩率/条目数与 HWP 记录数安全上限;它不属于 standard/full 默认闭包。 |
|
|
327
327
|
| `wordPerfect` | 显式安装 WordPerfect capability 后,配置 Worker、libwpd/librevenge WASM 地址与超时;它不属于 standard/full 默认闭包。 |
|
|
328
|
-
| `presentation` | standard
|
|
328
|
+
| `presentation` | standard 默认包含 PPTX/OpenXML;Office/All preset 和 Full 包同时支持二进制 `.ppt` / `.pot`。PPT 使用 Apache-2.0 的 TypeScript 引擎与解析 Worker,无需 WASM 或内置字体。精简安装可用 `file-viewer add ppt --write`;自定义路径可覆盖 `pptModuleUrl` / `pptWorkerUrl`。 |
|
|
329
329
|
| `typst` / `data` / `cad` | 显式安装相应 capability 后,配置 Typst、SQLite、CAD/DWG/DXF/DWF 等 WASM、Worker、编码和渲染策略;这些能力不属于 standard/full 默认闭包。 |
|
|
330
330
|
| `hooks` / `beforeOperation` | 统一生命周期 hooks 和操作前置校验,可用于审计、权限、埋点和安全控制。 |
|
|
331
331
|
|
|
@@ -449,7 +449,7 @@ const options = {
|
|
|
449
449
|
|
|
450
450
|
完整参数、生命周期 hooks、beforeOperation、主题、水印、搜索、缩放、打印和导出说明见官方文档: https://doc.file-viewer.app/
|
|
451
451
|
|
|
452
|
-
在线 Demo: https://demo.file-viewer.app/ 。File Viewer
|
|
452
|
+
在线 Demo: https://demo.file-viewer.app/ 。File Viewer 自身源码、组件包和新 TypeScript PPT 公共编译包使用 Apache-2.0;PPT 引擎源码保持私有,发行时保留其 LICENSE 与 NOTICE.md。旧 native PPT 的许可和水印要求不变,其余第三方运行时保留原许可证。二开或商用请保留 Flyfish Viewer 来源说明。
|
|
453
453
|
<!-- FILE_VIEWER_GENERATED:END -->
|
|
454
454
|
|
|
455
455
|
## 格式与相关包
|