filens-preview 0.2.0 → 0.3.0

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 (29) hide show
  1. package/README.md +60 -13
  2. package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +969 -0
  3. package/dist/all-in-one/archive/7zz.wasm +0 -0
  4. package/dist/all-in-one/assets/archive-worker-Cy3bEdVg.js +2 -0
  5. package/dist/all-in-one/filens.js +70557 -64591
  6. package/dist/all-in-one/index.html +12 -3
  7. package/dist/index.d.ts +5 -0
  8. package/dist/split/THIRD-PARTY-NOTICES.txt +969 -0
  9. package/dist/split/archive/7zz.wasm +0 -0
  10. package/dist/split/assets/archive-worker-Cy3bEdVg.js +2 -0
  11. package/dist/split/assets/{iwork-worker-DiTOJG8f.js → iwork-worker-B9KPoDW3.js} +17 -17
  12. package/dist/split/chunks/archive-B4jVwD9o.js +921 -0
  13. package/dist/split/chunks/{cad-Cyh8aipO.js → cad-DMg-lGJX.js} +1 -1
  14. package/dist/split/chunks/{core-gp02JQ3r.js → core--zVW212C.js} +4205 -3760
  15. package/dist/split/chunks/{diagram-rxvArV-1.js → diagram-CDwCA6LZ.js} +2 -2
  16. package/dist/split/chunks/{docx-ecvZsSWm.js → docx-CuQfFJqr.js} +2 -2
  17. package/dist/split/chunks/{ebook-5FyKWZ8s.js → ebook-CLlJ8KX3.js} +2 -2
  18. package/dist/split/chunks/{iwork-DlaehzuR.js → iwork-dNVC0X8j.js} +39 -39
  19. package/dist/split/chunks/media-runtime-gcsBQMuo.js +48 -0
  20. package/dist/split/chunks/{mindmap-D9lNNDoa.js → mindmap-g0-VoK-K.js} +2 -2
  21. package/dist/split/chunks/{model3d-BtFT01ZH.js → model3d-1G1CC52V.js} +3 -3
  22. package/dist/split/chunks/{panorama-Ci6DK6sa.js → panorama-D7GVivtM.js} +246 -234
  23. package/dist/split/chunks/{vendor-DvWhw-zP.js → vendor-DPFNKNkh.js} +28487 -23383
  24. package/dist/split/chunks/{xlsx-VJTu9XNS.js → xlsx-Co26yo-R.js} +2 -2
  25. package/dist/split/filens.js +2714 -2483
  26. package/dist/split/index.html +12 -3
  27. package/package.json +2 -2
  28. package/dist/split/chunks/archive-_cUUL2-3.js +0 -731
  29. package/dist/split/chunks/media-runtime-DwW7eq4g.js +0 -48
package/README.md CHANGED
@@ -1,9 +1,18 @@
1
1
  # Standalone browser previews / 独立前端预览
2
2
 
3
- Build the same preview engines as a single JavaScript file or split modules. Both
3
+ Build the same preview engines as one main JavaScript file or split modules,
4
+ with an optional external archive engine in either build. Both
4
5
  include Vue, styles, PDF/iWork workers and the document, image/RAW and STEP WASM
5
6
  engines. No conversion server or host Vue installation is needed.
6
7
 
8
+ For iOS and Android application embedding, the [source SDKs](../../sdk/README.zh-CN.md)
9
+ wrap this same runtime in native views, with local file loading and lifecycle callbacks.
10
+
11
+ Version **0.3.0** adds the mobile source SDK integration, encrypted / solid / multipart
12
+ RAR and 7z previews, Office attachment previews, smaller embedded WASM, shared ZIP
13
+ loading and the default `FiLens © IceWhale` watermark. The optional archive engine
14
+ and its worker stay external in both runtime builds.
15
+
7
16
  Version 0.2.0 adds 28 toolbar languages, application-icon previews and the
8
17
  runtime fixes used by CLI 0.5.0's offline HTML preview. It uses native HEIC/HEIF decoding first, with a small dedicated WASM
9
18
  decoder as fallback. MOV plays through browser codecs.
@@ -30,14 +39,30 @@ npm run build:wasm
30
39
  npm run build:preview
31
40
  ```
32
41
 
33
- | Build | Deploy | Approximate runtime size |
34
- | --- | --- | --- |
35
- | Split | Entire `packages/preview/dist/split/` directory | 11.05 MB raw / 3.20 MB gzip / 2.52 MB Brotli, across all runtime files |
36
- | All in one | `packages/preview/dist/all-in-one/filens.js` | 12.68 MB raw / 3.77 MB gzip / 2.83 MB Brotli |
42
+ Deploy the entire `packages/preview/dist/split/` directory, or
43
+ `dist/all-in-one/filens.js` with the archive sidecars when needed. The following
44
+ table is generated by `npm run report:preview-sizes` from exact byte measurements.
45
+
46
+ <!-- preview-runtime-sizes:start -->
47
+ | Runtime | Raw MB | gzip MB | Brotli MB |
48
+ | --- | ---: | ---: | ---: |
49
+ | Split main runtime | 11.23 | 3.26 | 2.57 |
50
+ | All-in-one main JS | 8.85 | 3.26 | 2.90 |
51
+ | Optional archive WASM + worker (either build) | 0.88 | 0.35 | 0.28 |
52
+ | Split with archive assets | 12.11 | 3.61 | 2.85 |
53
+ | All-in-one with archive assets | 9.73 | 3.60 | 3.18 |
54
+ <!-- preview-runtime-sizes:end -->
37
55
 
38
56
  These are current source build measurements (MB = 1,000,000 bytes), including
39
57
  application icons, optional Office decryption and 28 locale dictionaries. The
40
- npm package contains both directories, including notices, types and
58
+ archive engine always stays external, including all-in-one builds, and is loaded
59
+ only for RAR, 7z or multi-volume ZIP. Ordinary ZIP and ZIP-based document formats
60
+ share the existing JSZip/fflate dependencies. The extraction-only engine uses
61
+ -O3 and LTO, retains encryption and all supported decoders, and shares its compiled
62
+ WASM module between fresh per-operation workers. iWork uses the ordinary ZIP
63
+ reader without duplicating the ZIP encryption library. The totals in the table
64
+ include the optional archive assets and exclude notices.
65
+ The npm package contains both directories, including notices, types and
41
66
  documentation. Packed and installed bytes are recorded for each release.
42
67
  [Package measurements](https://github.com/IceWhaleTech/filens/blob/main/docs/preview-package-sizes.json).
43
68
 
@@ -67,10 +92,15 @@ directory over HTTP(S). To integrate into another page:
67
92
  uses the bundled frontend WASM engines. Use [`@filens/vue`](https://github.com/IceWhaleTech/filens/tree/main/packages/vue) for
68
93
  direct Vue component integration.
69
94
 
95
+ Previews display a translucent `FiLens © IceWhale` watermark at the bottom right,
96
+ including when the toolbar is hidden and in preview fullscreen mode.
97
+
70
98
  Split chunks can range from a few KB to hundreds of KB after compression. Those
71
99
  figures exclude shared dependencies and engines; a chunk is not a complete
72
- per-format download. The all-in-one file embeds CSS, base64 WASM and workers; it
73
- needs no additional runtime files.
100
+ per-format download. The all-in-one file embeds CSS and document/image engines.
101
+ The RAR/7z engine and its worker are always separate files, never base64-embedded;
102
+ deploy both sidecars alongside the main JS to enable RAR, 7z and multi-volume ZIP.
103
+ They can be omitted when those formats are not required.
74
104
  A separate notices file accompanies
75
105
  both builds and should be distributed with them. [Exact measurements](https://github.com/IceWhaleTech/filens/blob/main/docs/preview-build-sizes.json).
76
106
 
@@ -79,6 +109,8 @@ Pages with a Content Security Policy must permit the generated inline styles,
79
109
  `blob:` workers and `data:` WASM. Use an HTTP(S) server for module imports, rather
80
110
  than opening the module-importing `index.html` as a `file:` URL. The CLI's
81
111
  self-contained HTML embeds the module instead and supports `file:` URLs.
112
+ RAR, 7z and multi-volume ZIP require the separate archive assets over HTTP(S);
113
+ CLI HTML shows a `--mode serve` fallback for them instead of embedding the engine.
82
114
  The supported formats and fidelity
83
115
  limits are shared with the [demo](https://github.com/IceWhaleTech/filens/blob/main/docs/support-matrix.md).
84
116
 
@@ -98,13 +130,27 @@ and Windows PNG/DIB icon frames. These additions are included in 0.2.0.
98
130
  See the [supported icon representations
99
131
  and limits](../vue/README.md#application-icons-source-build).
100
132
 
133
+ The browser file picker accepts multi-volume RAR (`.part01.rar` or `.rar`/`.r00`),
134
+ 7z (`.7z.001`) and ZIP (`.zip.001` or `.z01`/`.zip`) archives. Select every part
135
+ together; picker order does not matter. Password prompts and nested previews
136
+ work across the parts. Missing first/intermediate volumes identify the filename;
137
+ the engine validates completeness. Limits are 256 parts and 512 MiB compressed
138
+ input per set, with 128 MiB per expanded entry. Both HTTP(S)-served builds support
139
+ this workflow with local archive sidecars; no remote service or CDN is used.
140
+ Programmatic callers supply the other
141
+ parts as `src.archiveVolumes: [{ name, source }]`; see the
142
+ [core API example](../core/README.md).
143
+
101
144
  The split build loads `converter-office.wasm` only when an encrypted Office
102
145
  document has a supplied password; a password prompt alone does not download it.
103
146
  The core is about 413 KB gzip, and the optional decryptor about 164 KB gzip.
104
147
  Splitting saves about 64 KB gzip on ordinary converted previews, while downloading
105
148
  both costs about 100 KB gzip more than the combined core due to shared code.
106
149
  The all-in-one file uses the combined core (477 KB gzip / 387 KB Brotli) to avoid
107
- that duplication; its download includes decryption. See the
150
+ that duplication; its download includes decryption. Embedded WASM is gzipped
151
+ before base64 encoding and decompressed on first use, with a JavaScript fallback
152
+ for browsers without DecompressionStream. HTTP split assets remain ordinary WASM
153
+ and use streaming compilation when the server supplies the correct MIME. See the
108
154
  [same-source measurements](../../docs/converter-size-impact.md) and the
109
155
  [format package audit](../../docs/format-package-sizes.md).
110
156
 
@@ -199,17 +245,18 @@ macOS; Windows/Linux browser launching still needs native validation.
199
245
  ## 中文说明
200
246
 
201
247
  两种产物使用相同 API:分包版部署整个 `split/` 目录,WASM 与重型引擎按需加载;
202
- 单文件版仅需部署 `all-in-one/filens.js`,其中包含 Vue、样式、Worker 和 WASM,
203
- 另附第三方许可文件。单文件部署更简单,初次下载也更大。
248
+ 单文件版的 `all-in-one/filens.js` 包含 Vue、样式和文档/图片引擎,另附第三方许可文件。
249
+ RAR/7z 和分卷 ZIP 始终使用独立的 `archive/7zz.wasm` 与 `assets/archive-worker-*.js`,
250
+ 按需加载,任何构建都不合并进主 JS。无需这些格式时可以省略这两个资源。
204
251
 
205
252
  `filens preview 文件路径` 会启动本地浏览器预览,由前端完成格式解析与渲染。
206
253
  CLI 0.5.0 首次预览时自动安装 filens-preview 0.2.0,也可先运行 `filens setup-preview`;
207
254
  源码版先运行 `npm run build:agent:preview`。
208
- 当前源码构建中,分包运行时合计 2.52 MB Brotli,单文件为 2.83 MB Brotli / 3.77 MB gzip / 12.68 MB 原始体积,已包含安装包图标、可选 Office 解密模块和 28 个语言包。分包版仅在加密 Office 文档提交密码后加载解密模块;单文件版使用含解密功能的合并核心,避免重复代码。合并核心为 477 KB gzip / 387 KB Brotli,尚未达到约 300 KB 的目标。
255
+ 当前 0.3.0 构建的精确体积见上方自动生成表格,主运行时、可选压缩引擎和包含压缩引擎的总量分别计量。主运行时已包含安装包图标、可选 Office 解密模块和 28 个语言包。压缩引擎采用 O3 加 LTO,保留密码、固实压缩、分卷和所有原有解码器,移除写入功能及未使用的格式;复用编译模块,各操作仍使用独立 Worker 和内存。iWork 不再重复内嵌 ZIP 解密库。JSZip 使用源模块,让 ZIP 文档和 TIFF 共享同一份 pako,Three.js 与文档解析器共享 fflate。分包版仅在加密 Office 文档提交密码后加载解密模块;单文件版使用含解密功能的合并核心。自包含 HTML 不嵌入压缩引擎,RAR/7z 和分卷 ZIP 使用 `--mode serve`。
209
256
  独立 npm 包同时包含两种产物,[各版本包体积记录](../../docs/preview-package-sizes.json)。
210
257
  CLI 的安装体积另计:Lite 7.7–8.1 MiB,Full 31.1–36.8 MiB(含 OCR 运行时与模型);
211
258
  其中原生可执行文件为 1.8–2.2 MiB,不含 Node.js、缓存及预览包。
212
- 源码仅附带分包目录时约 11.6 MB(含许可文件与 HTML)。图片先尝试原生显示,分包版仅在失败时加载 HEIF 解码器;视频使用浏览器编解码器,不支持的编码可通过可选 mediaConverter 接入转换器。`--no-open --json` 返回本地地址,`--assets` 可切换单文件或分包版,
259
+ 图片先尝试原生显示,分包版仅在失败时加载 HEIF 解码器;视频使用浏览器编解码器,不支持的编码可通过可选 mediaConverter 接入转换器。`--no-open --json` 返回本地地址,`--assets` 可切换单文件或分包版,
213
260
  HTTP 模式下 Ctrl-C 退出。**CLI 0.5.0 默认生成携带原文件、预览引擎和许可说明的独立 HTML**,
214
261
  通过 `file://` 打开,生成后 CLI 退出,无需本地服务器,可完全离线使用。
215
262
  `--output preview.html` 保存到指定路径且不覆盖已有文件;默认临时 HTML 不会随 CLI