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.
- package/README.md +60 -13
- package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +969 -0
- package/dist/all-in-one/archive/7zz.wasm +0 -0
- package/dist/all-in-one/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/all-in-one/filens.js +70557 -64591
- package/dist/all-in-one/index.html +12 -3
- package/dist/index.d.ts +5 -0
- package/dist/split/THIRD-PARTY-NOTICES.txt +969 -0
- package/dist/split/archive/7zz.wasm +0 -0
- package/dist/split/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/split/assets/{iwork-worker-DiTOJG8f.js → iwork-worker-B9KPoDW3.js} +17 -17
- package/dist/split/chunks/archive-B4jVwD9o.js +921 -0
- package/dist/split/chunks/{cad-Cyh8aipO.js → cad-DMg-lGJX.js} +1 -1
- package/dist/split/chunks/{core-gp02JQ3r.js → core--zVW212C.js} +4205 -3760
- package/dist/split/chunks/{diagram-rxvArV-1.js → diagram-CDwCA6LZ.js} +2 -2
- package/dist/split/chunks/{docx-ecvZsSWm.js → docx-CuQfFJqr.js} +2 -2
- package/dist/split/chunks/{ebook-5FyKWZ8s.js → ebook-CLlJ8KX3.js} +2 -2
- package/dist/split/chunks/{iwork-DlaehzuR.js → iwork-dNVC0X8j.js} +39 -39
- package/dist/split/chunks/media-runtime-gcsBQMuo.js +48 -0
- package/dist/split/chunks/{mindmap-D9lNNDoa.js → mindmap-g0-VoK-K.js} +2 -2
- package/dist/split/chunks/{model3d-BtFT01ZH.js → model3d-1G1CC52V.js} +3 -3
- package/dist/split/chunks/{panorama-Ci6DK6sa.js → panorama-D7GVivtM.js} +246 -234
- package/dist/split/chunks/{vendor-DvWhw-zP.js → vendor-DPFNKNkh.js} +28487 -23383
- package/dist/split/chunks/{xlsx-VJTu9XNS.js → xlsx-Co26yo-R.js} +2 -2
- package/dist/split/filens.js +2714 -2483
- package/dist/split/index.html +12 -3
- package/package.json +2 -2
- package/dist/split/chunks/archive-_cUUL2-3.js +0 -731
- package/dist/split/chunks/media-runtime-DwW7eq4g.js +0 -48
package/dist/split/index.html
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>filens preview</title>
|
|
2
2
|
<style>html,body,#preview{height:100%;margin:0}body{font-family:system-ui}#picker{position:fixed;z-index:100;top:12px;right:16px;background:white;padding:8px;border:1px solid #ddd;border-radius:6px}#picker input{max-width:220px}</style>
|
|
3
|
-
<label id="picker">Open file <input type="file" id="file"></label><div id="preview"></div>
|
|
3
|
+
<label id="picker">Open file(s) <input type="file" id="file" multiple><span id="source-error" role="alert" hidden></span></label><div id="preview"></div>
|
|
4
4
|
<script type="module">
|
|
5
|
-
import { createPreview } from './filens.js';
|
|
5
|
+
import { createPreview, isArchiveVolumeName, selectArchiveVolumes } from './filens.js';
|
|
6
6
|
let preview;
|
|
7
7
|
const open = options => { document.body.dataset.state='loading'; delete document.body.dataset.error; preview?.destroy(); preview = createPreview('#preview', {
|
|
8
8
|
...options, onRendered: () => { document.body.dataset.state='ready'; },
|
|
9
9
|
onError: error => { document.body.dataset.state='error'; document.body.dataset.error=error.message; }
|
|
10
10
|
}); };
|
|
11
|
-
document.querySelector('#file').onchange = event => {
|
|
11
|
+
document.querySelector('#file').onchange = event => {
|
|
12
|
+
const files=Array.from(event.target.files), file=files.find(part=>isArchiveVolumeName(part.name))??files[0];
|
|
13
|
+
const error=document.querySelector('#source-error'); error.hidden=true;
|
|
14
|
+
if(!file) return;
|
|
15
|
+
try {
|
|
16
|
+
const set=selectArchiveVolumes(file.name,files);
|
|
17
|
+
open(set ? {src:{source:set.primary,archiveVolumes:set.files.slice(1).map(part=>({name:part.name,source:part}))},name:set.primary.name}
|
|
18
|
+
: {src:file,name:file.name});
|
|
19
|
+
} catch (cause) { error.textContent=cause.message; error.hidden=false; }
|
|
20
|
+
};
|
|
12
21
|
// The CLI serves metadata and file bytes from its local, token-scoped HTTP server.
|
|
13
22
|
if (new URL(location.href).searchParams.has('cli')) {
|
|
14
23
|
const response = await fetch('./source.json');
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filens-preview",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Browser-local
|
|
6
|
+
"description": "Browser-local document and media previews, as split modules or one main JS with an optional external archive engine.",
|
|
7
7
|
"main": "./dist/split/filens.js",
|
|
8
8
|
"module": "./dist/split/filens.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|