filens-preview 0.2.0 → 0.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 (47) hide show
  1. package/README.md +69 -16
  2. package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +1902 -63
  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 +5063 -108925
  6. package/dist/all-in-one/index.html +12 -3
  7. package/dist/index.d.ts +7 -0
  8. package/dist/split/THIRD-PARTY-NOTICES.txt +1902 -63
  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-DMapcEqq.js +1 -0
  13. package/dist/split/chunks/browser-video-session-CGI8FpX_.js +1 -0
  14. package/dist/split/chunks/cad-BvXJNqHR.js +7 -0
  15. package/dist/split/chunks/core-BLayEJn5.js +17 -0
  16. package/dist/split/chunks/diagram-DlpgioZ9.js +1 -0
  17. package/dist/split/chunks/docx-Sii3GNtE.js +1 -0
  18. package/dist/split/chunks/ebook-CLCQfska.js +5 -0
  19. package/dist/split/chunks/index-BPK_cNTp.js +1 -0
  20. package/dist/split/chunks/index-DI_GyFX1.js +1 -0
  21. package/dist/split/chunks/iwork-Datv3D5d.js +4 -0
  22. package/dist/split/chunks/media-runtime-tb-Q4Sah.js +1 -0
  23. package/dist/split/chunks/mindmap-B_GYpiFO.js +1 -0
  24. package/dist/split/chunks/model3d-BsIQNF2D.js +55 -0
  25. package/dist/split/chunks/mp4box.all-Bw_Tlr0T-D0URDfA1.js +1 -0
  26. package/dist/split/chunks/panorama-CIdiLIwD.js +973 -0
  27. package/dist/split/chunks/pdf-Dzzffz3p.js +12 -0
  28. package/dist/split/chunks/vendor-CBCxJuSg.js +4115 -0
  29. package/dist/split/chunks/xlsx-D2NFYc3n.js +3 -0
  30. package/dist/split/converter-image.wasm +0 -0
  31. package/dist/split/filens.js +2 -4781
  32. package/dist/split/index.html +12 -3
  33. package/package.json +2 -2
  34. package/dist/split/chunks/archive-_cUUL2-3.js +0 -731
  35. package/dist/split/chunks/cad-Cyh8aipO.js +0 -2405
  36. package/dist/split/chunks/core-gp02JQ3r.js +0 -14182
  37. package/dist/split/chunks/diagram-rxvArV-1.js +0 -654
  38. package/dist/split/chunks/docx-ecvZsSWm.js +0 -299
  39. package/dist/split/chunks/ebook-5FyKWZ8s.js +0 -623
  40. package/dist/split/chunks/iwork-DlaehzuR.js +0 -772
  41. package/dist/split/chunks/media-runtime-DwW7eq4g.js +0 -48
  42. package/dist/split/chunks/mindmap-D9lNNDoa.js +0 -560
  43. package/dist/split/chunks/model3d-BtFT01ZH.js +0 -5093
  44. package/dist/split/chunks/panorama-Ci6DK6sa.js +0 -5960
  45. package/dist/split/chunks/pdf-CecYOWld.js +0 -17898
  46. package/dist/split/chunks/vendor-DvWhw-zP.js +0 -54471
  47. package/dist/split/chunks/xlsx-VJTu9XNS.js +0 -818
package/README.md CHANGED
@@ -1,14 +1,27 @@
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.
10
19
  Applications can supply an optional `mediaConverter` for unsupported MOV codecs.
11
20
  Both builds preserve the same image and video support boundaries.
21
+ For optional local MP4/MOV recovery, pass `browserMedia: true` to `createPreview`.
22
+ It tries native playback first, then bounded remuxing or necessary WebCodecs AVC
23
+ processing, and never calls `mediaConverter` for video in this mode.
24
+ [Browser-only media scope and validation](../../docs/browser-media-engine.md).
12
25
 
13
26
  ```sh
14
27
  npm install filens-preview
@@ -30,14 +43,30 @@ npm run build:wasm
30
43
  npm run build:preview
31
44
  ```
32
45
 
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 |
46
+ Deploy the entire `packages/preview/dist/split/` directory, or
47
+ `dist/all-in-one/filens.js` with the archive sidecars when needed. The following
48
+ table is generated by `npm run report:preview-sizes` from exact byte measurements.
49
+
50
+ <!-- preview-runtime-sizes:start -->
51
+ | Runtime | Raw MB | gzip MB | Brotli MB |
52
+ | --- | ---: | ---: | ---: |
53
+ | Split main runtime | 10.55 | 3.34 | 2.67 |
54
+ | All-in-one main JS | 8.05 | 3.34 | 3.02 |
55
+ | Optional archive WASM + worker (either build) | 0.88 | 0.35 | 0.28 |
56
+ | Split with archive assets | 11.44 | 3.69 | 2.94 |
57
+ | All-in-one with archive assets | 8.93 | 3.69 | 3.30 |
58
+ <!-- preview-runtime-sizes:end -->
37
59
 
38
60
  These are current source build measurements (MB = 1,000,000 bytes), including
39
61
  application icons, optional Office decryption and 28 locale dictionaries. The
40
- npm package contains both directories, including notices, types and
62
+ archive engine always stays external, including all-in-one builds, and is loaded
63
+ only for RAR, 7z or multi-volume ZIP. Ordinary ZIP and ZIP-based document formats
64
+ share the existing JSZip/fflate dependencies. The extraction-only engine uses
65
+ -O3 and LTO, retains encryption and all supported decoders, and shares its compiled
66
+ WASM module between fresh per-operation workers. iWork uses the ordinary ZIP
67
+ reader without duplicating the ZIP encryption library. The totals in the table
68
+ include the optional archive assets and exclude notices.
69
+ The npm package contains both directories, including notices, types and
41
70
  documentation. Packed and installed bytes are recorded for each release.
42
71
  [Package measurements](https://github.com/IceWhaleTech/filens/blob/main/docs/preview-package-sizes.json).
43
72
 
@@ -67,10 +96,15 @@ directory over HTTP(S). To integrate into another page:
67
96
  uses the bundled frontend WASM engines. Use [`@filens/vue`](https://github.com/IceWhaleTech/filens/tree/main/packages/vue) for
68
97
  direct Vue component integration.
69
98
 
99
+ Previews display a translucent `FiLens © IceWhale` watermark at the bottom right,
100
+ including when the toolbar is hidden and in preview fullscreen mode.
101
+
70
102
  Split chunks can range from a few KB to hundreds of KB after compression. Those
71
103
  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.
104
+ per-format download. The all-in-one file embeds CSS and document/image engines.
105
+ The RAR/7z engine and its worker are always separate files, never base64-embedded;
106
+ deploy both sidecars alongside the main JS to enable RAR, 7z and multi-volume ZIP.
107
+ They can be omitted when those formats are not required.
74
108
  A separate notices file accompanies
75
109
  both builds and should be distributed with them. [Exact measurements](https://github.com/IceWhaleTech/filens/blob/main/docs/preview-build-sizes.json).
76
110
 
@@ -79,6 +113,8 @@ Pages with a Content Security Policy must permit the generated inline styles,
79
113
  `blob:` workers and `data:` WASM. Use an HTTP(S) server for module imports, rather
80
114
  than opening the module-importing `index.html` as a `file:` URL. The CLI's
81
115
  self-contained HTML embeds the module instead and supports `file:` URLs.
116
+ RAR, 7z and multi-volume ZIP require the separate archive assets over HTTP(S);
117
+ CLI HTML shows a `--mode serve` fallback for them instead of embedding the engine.
82
118
  The supported formats and fidelity
83
119
  limits are shared with the [demo](https://github.com/IceWhaleTech/filens/blob/main/docs/support-matrix.md).
84
120
 
@@ -91,20 +127,36 @@ detection. Switch language with `viewer.update({ locale: 'de_DE' })`. Optional
91
127
  Both split and all-in-one builds contain these dictionaries for offline use.
92
128
  See the [locale list and API notes](../vue/README.md#languages-source-build).
93
129
 
94
- APK/IPA packages and Windows EXE/DLL/MUI/MUN resource files can be previewed as
95
- application icons using the included WASM converter. Icon extraction supports
96
- compiled Android icon resources, XML/binary iOS plist metadata, iOS CgBI PNGs,
130
+ APK/IPA packages open as ZIP-compatible archives with directory browsing and
131
+ entry previews. Windows EXE/DLL/MUI/MUN resource files can be previewed as
132
+ application icons using the included WASM converter. The converter also exposes
133
+ APK/IPA icon extraction for explicit requests. Icon extraction supports compiled
134
+ Android icon resources, XML/binary iOS plist metadata, iOS CgBI PNGs,
97
135
  and Windows PNG/DIB icon frames. These additions are included in 0.2.0.
98
136
  See the [supported icon representations
99
137
  and limits](../vue/README.md#application-icons-source-build).
100
138
 
139
+ The browser file picker accepts multi-volume RAR (`.part01.rar` or `.rar`/`.r00`),
140
+ 7z (`.7z.001`) and ZIP (`.zip.001` or `.z01`/`.zip`) archives. Select every part
141
+ together; picker order does not matter. Password prompts and nested previews
142
+ work across the parts. Missing first/intermediate volumes identify the filename;
143
+ the engine validates completeness. Limits are 256 parts and 512 MiB compressed
144
+ input per set, with 128 MiB per expanded entry. Both HTTP(S)-served builds support
145
+ this workflow with local archive sidecars; no remote service or CDN is used.
146
+ Programmatic callers supply the other
147
+ parts as `src.archiveVolumes: [{ name, source }]`; see the
148
+ [core API example](../core/README.md).
149
+
101
150
  The split build loads `converter-office.wasm` only when an encrypted Office
102
151
  document has a supplied password; a password prompt alone does not download it.
103
152
  The core is about 413 KB gzip, and the optional decryptor about 164 KB gzip.
104
153
  Splitting saves about 64 KB gzip on ordinary converted previews, while downloading
105
154
  both costs about 100 KB gzip more than the combined core due to shared code.
106
155
  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
156
+ that duplication; its download includes decryption. Embedded WASM is gzipped
157
+ before base64 encoding and decompressed on first use, with a JavaScript fallback
158
+ for browsers without DecompressionStream. HTTP split assets remain ordinary WASM
159
+ and use streaming compilation when the server supplies the correct MIME. See the
108
160
  [same-source measurements](../../docs/converter-size-impact.md) and the
109
161
  [format package audit](../../docs/format-package-sizes.md).
110
162
 
@@ -199,17 +251,18 @@ macOS; Windows/Linux browser launching still needs native validation.
199
251
  ## 中文说明
200
252
 
201
253
  两种产物使用相同 API:分包版部署整个 `split/` 目录,WASM 与重型引擎按需加载;
202
- 单文件版仅需部署 `all-in-one/filens.js`,其中包含 Vue、样式、Worker 和 WASM,
203
- 另附第三方许可文件。单文件部署更简单,初次下载也更大。
254
+ 单文件版的 `all-in-one/filens.js` 包含 Vue、样式和文档/图片引擎,另附第三方许可文件。
255
+ RAR/7z 和分卷 ZIP 始终使用独立的 `archive/7zz.wasm` 与 `assets/archive-worker-*.js`,
256
+ 按需加载,任何构建都不合并进主 JS。无需这些格式时可以省略这两个资源。
204
257
 
205
258
  `filens preview 文件路径` 会启动本地浏览器预览,由前端完成格式解析与渲染。
206
259
  CLI 0.5.0 首次预览时自动安装 filens-preview 0.2.0,也可先运行 `filens setup-preview`;
207
260
  源码版先运行 `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 的目标。
261
+ 当前 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
262
  独立 npm 包同时包含两种产物,[各版本包体积记录](../../docs/preview-package-sizes.json)。
210
263
  CLI 的安装体积另计:Lite 7.7–8.1 MiB,Full 31.1–36.8 MiB(含 OCR 运行时与模型);
211
264
  其中原生可执行文件为 1.8–2.2 MiB,不含 Node.js、缓存及预览包。
212
- 源码仅附带分包目录时约 11.6 MB(含许可文件与 HTML)。图片先尝试原生显示,分包版仅在失败时加载 HEIF 解码器;视频使用浏览器编解码器,不支持的编码可通过可选 mediaConverter 接入转换器。`--no-open --json` 返回本地地址,`--assets` 可切换单文件或分包版,
265
+ 图片先尝试原生显示,分包版仅在失败时加载 HEIF 解码器;视频使用浏览器编解码器,不支持的编码可通过可选 mediaConverter 接入转换器。`--no-open --json` 返回本地地址,`--assets` 可切换单文件或分包版,
213
266
  HTTP 模式下 Ctrl-C 退出。**CLI 0.5.0 默认生成携带原文件、预览引擎和许可说明的独立 HTML**,
214
267
  通过 `file://` 打开,生成后 CLI 退出,无需本地服务器,可完全离线使用。
215
268
  `--output preview.html` 保存到指定路径且不覆盖已有文件;默认临时 HTML 不会随 CLI