@work-zhanguo/light-file-preview 0.0.18 → 0.0.19

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 (33) hide show
  1. package/README.md +26 -10
  2. package/dist/{UnsupportedRenderer-B016ePP5.js → UnsupportedRenderer-CbQ7S46f.js} +1 -1
  3. package/dist/index-DB5StklO.js +363 -0
  4. package/dist/light-file-preview.js +1 -1
  5. package/dist/light-file-preview.umd.cjs +158 -196
  6. package/dist/standalone/light-file-preview.iife.js +178 -217
  7. package/dist/standalone/style.css +1 -1
  8. package/dist/style.css +1 -1
  9. package/dist/types/components/FilePreview.vue.d.ts +3 -3
  10. package/dist/types/constants/file.d.ts +0 -1
  11. package/dist/types/types.d.ts +1 -1
  12. package/dist/vue2/light-file-preview-vue2.js +55300 -3
  13. package/dist/vue2/light-file-preview-vue2.umd.cjs +178 -217
  14. package/package.json +1 -3
  15. package/dist/PptxRenderer-B4sDptn0.js +0 -14773
  16. package/dist/index-DX4yvG8n.js +0 -353
  17. package/dist/types/components/renderers/PptxRenderer.vue.d.ts +0 -13
  18. package/dist/vue2/DocxRenderer-BYzWAtSx.js +0 -110
  19. package/dist/vue2/PdfRenderer-2f-SRj0_.js +0 -123
  20. package/dist/vue2/PptxRenderer-B1TlLH2y.js +0 -14773
  21. package/dist/vue2/SheetRenderer-DF9A6Tqq.js +0 -940
  22. package/dist/vue2/TextRenderer-Be7RzYjF.js +0 -59
  23. package/dist/vue2/UnsupportedRenderer-CIeHYr5T.js +0 -31
  24. package/dist/vue2/_commonjs-dynamic-modules-C74YT1gS.js +0 -32
  25. package/dist/vue2/docx-preview-BV-bQyiM.js +0 -5533
  26. package/dist/vue2/marked.esm-CRmQbSOC.js +0 -1577
  27. package/dist/vue2/pdf-BiKi76Et.js +0 -15320
  28. package/dist/vue2/purify.es-CCmmh-Lt.js +0 -553
  29. package/dist/vue2/style.css +0 -1
  30. package/dist/vue2/text-Bqxn_tMI.js +0 -24
  31. package/dist/vue2/vue2-DryhXOWQ.js +0 -6296
  32. package/dist/vue2/xlsx-j9Zzywas.js +0 -24774
  33. package/public/screenshots/effect-pptx.png +0 -0
package/README.md CHANGED
@@ -28,6 +28,7 @@
28
28
  - 当前版本:`0.0.18`
29
29
  - 适用场景:业务系统附件预览、在线查看、弹窗预览、新页面预览
30
30
  - 支持 Vue 3、Vue 2 适配入口,以及非 Vue 项目的 standalone 产物
31
+ - `PPTX` 预览已拆分为独立项目:[@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview) / [Gitee](https://gitee.com/hou_zhan_guo/pptx-review)
31
32
  - 在线演示:可通过顶部 `在线演示 Demo` 入口访问
32
33
 
33
34
  最近更新:
@@ -60,11 +61,12 @@
60
61
 
61
62
  ![PDF 预览效果](https://unpkg.com/@work-zhanguo/light-file-preview/public/screenshots/effect-pdf.png)
62
63
 
63
- ### PPTX
64
+ ### PPTX 说明
64
65
 
65
- `PPTX` 现已支持在线预览,适合业务系统里常见的汇报、方案、说明类演示文稿查看。旧版 `PPT` 仍保持下载入口降级。
66
+ 当前项目不再内置 `PPTX` 预览和相关集成能力。如需演示文稿预览,请直接使用独立项目:
66
67
 
67
- ![PPTX 预览效果](https://unpkg.com/@work-zhanguo/light-file-preview/public/screenshots/effect-pptx.png)
68
+ - npm:[@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
69
+ - Gitee:[hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
68
70
 
69
71
  ## 支持文件
70
72
 
@@ -88,7 +90,6 @@
88
90
  - `CSS`
89
91
  - `MD`
90
92
  - `DOCX`
91
- - `PPTX`
92
93
  - `XLS`
93
94
  - `XLSX`
94
95
  - `CSV`
@@ -101,6 +102,7 @@
101
102
 
102
103
  - `DOC`
103
104
  - `PPT`
105
+ - `PPTX`
104
106
  - 其他未识别格式
105
107
 
106
108
  补充说明:
@@ -113,11 +115,17 @@
113
115
 
114
116
  - [pdf.js](https://github.com/mozilla/pdf.js)
115
117
  - [docx-preview](https://github.com/VolodymyrBaydalka/docxjs)
116
- - [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
117
118
  - [SheetJS](https://github.com/SheetJS/sheetjs)
118
119
  - [marked](https://github.com/markedjs/marked)
119
120
  - [DOMPurify](https://github.com/cure53/DOMPurify)
120
121
 
122
+ ## PPTX 预览
123
+
124
+ `PPTX` 预览已经拆分到独立项目维护。本项目只保留通用文件预览能力,不再内置 `PPTX` 渲染器。
125
+
126
+ - npm:[@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
127
+ - Gitee:[hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
128
+
121
129
  ## 安装
122
130
 
123
131
  ```bash
@@ -301,6 +309,7 @@ npm run build:site
301
309
  - Current version: `0.0.18`
302
310
  - Use cases: attachment preview in business systems, inline viewing, dialog preview, and standalone preview pages
303
311
  - Supports Vue 3, a Vue 2 adapter entry, and standalone assets for non-Vue projects
312
+ - `PPTX` preview has been split into a standalone project: [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview) / [Gitee](https://gitee.com/hou_zhan_guo/pptx-review)
304
313
  - Demo: available through the `在线演示 Demo` link at the top of this document
305
314
 
306
315
  Recent updates:
@@ -333,11 +342,12 @@ The images below use the npm CDN URL. Local repository changes do not affect the
333
342
 
334
343
  ![PDF preview](https://unpkg.com/@work-zhanguo/light-file-preview/public/screenshots/effect-pdf.png)
335
344
 
336
- ### PPTX
345
+ ### PPTX Note
337
346
 
338
- `PPTX` files are now supported for online preview, which fits common slide decks used in business systems. Legacy `PPT` files still fall back to a download entry.
347
+ This project no longer ships built-in `PPTX` preview support. If you need slide preview, use the standalone project instead:
339
348
 
340
- ![PPTX preview](https://unpkg.com/@work-zhanguo/light-file-preview/public/screenshots/effect-pptx.png)
349
+ - npm: [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
350
+ - Gitee: [hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
341
351
 
342
352
  ## Supported Files
343
353
 
@@ -361,7 +371,6 @@ Supported for online preview:
361
371
  - `CSS`
362
372
  - `MD`
363
373
  - `DOCX`
364
- - `PPTX`
365
374
  - `XLS`
366
375
  - `XLSX`
367
376
  - `CSV`
@@ -374,6 +383,7 @@ Fallback to download entry:
374
383
 
375
384
  - `DOC`
376
385
  - `PPT`
386
+ - `PPTX`
377
387
  - any unrecognized format
378
388
 
379
389
  Notes:
@@ -386,11 +396,17 @@ Notes:
386
396
 
387
397
  - [pdf.js](https://github.com/mozilla/pdf.js)
388
398
  - [docx-preview](https://github.com/VolodymyrBaydalka/docxjs)
389
- - [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
390
399
  - [SheetJS](https://github.com/SheetJS/sheetjs)
391
400
  - [marked](https://github.com/markedjs/marked)
392
401
  - [DOMPurify](https://github.com/cure53/DOMPurify)
393
402
 
403
+ ## PPTX Preview
404
+
405
+ `PPTX` preview is now maintained as a standalone project. This package keeps the generic file preview scope and no longer bundles a `PPTX` renderer.
406
+
407
+ - npm: [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
408
+ - Gitee: [hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
409
+
394
410
  ## Installation
395
411
 
396
412
  ```bash
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as o, openBlock as l, createElementBlock as a, createElementVNode as t, toDisplayString as i, unref as r } from "vue";
2
- import { d as s } from "./index-DX4yvG8n.js";
2
+ import { d as s } from "./index-DB5StklO.js";
3
3
  const d = { class: "lfp-empty" }, p = { class: "lfp-hint" }, c = /* @__PURE__ */ o({
4
4
  __name: "UnsupportedRenderer",
5
5
  props: {
@@ -0,0 +1,363 @@
1
+ import { defineComponent as ee, defineAsyncComponent as L, ref as R, computed as x, watch as U, onBeforeUnmount as te, openBlock as s, createBlock as E, Teleport as oe, createVNode as N, Transition as O, withCtx as V, createElementBlock as v, normalizeClass as Z, createCommentVNode as S, createElementVNode as l, toDisplayString as D, Fragment as ne, unref as _, reactive as $, createApp as q, h as z } from "vue";
2
+ const y = {
3
+ image: ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"],
4
+ pdf: ["pdf"],
5
+ text: ["txt", "json", "js", "ts", "jsx", "tsx", "html", "css", "md", "csv"],
6
+ docx: ["docx"],
7
+ sheet: ["xls", "xlsx", "csv"],
8
+ video: ["mp4", "webm"],
9
+ audio: ["mp3", "wav"]
10
+ }, ae = ["doc", "ppt", "pptx"];
11
+ function I(e = "") {
12
+ const n = e.split("#")[0].split("?")[0].split(".");
13
+ return n.length > 1 ? n[n.length - 1].toLowerCase() : "";
14
+ }
15
+ function le(e) {
16
+ const t = I(e);
17
+ return y.image.includes(t) ? "image" : y.pdf.includes(t) ? "pdf" : y.docx.includes(t) ? "docx" : y.sheet.includes(t) ? "sheet" : y.video.includes(t) ? "video" : y.audio.includes(t) ? "audio" : y.text.includes(t) ? t === "csv" ? "sheet" : "text" : (ae.includes(t), "unsupported");
18
+ }
19
+ function se(e) {
20
+ if (/^(blob:|data:|https?:\/\/|file:\/\/)/i.test(e))
21
+ return e;
22
+ try {
23
+ const t = new URL(e, window.location.href);
24
+ return t.pathname = t.pathname.split("/").map((n) => encodeURIComponent(decodeURIComponent(n))).join("/"), t.toString();
25
+ } catch (t) {
26
+ return e.split("/").map((n) => encodeURIComponent(decodeURIComponent(n))).join("/");
27
+ }
28
+ }
29
+ function H(e, t) {
30
+ var r;
31
+ if (typeof e == "string") {
32
+ const f = se(e), d = e.split("/"), o = (r = t != null ? t : d[d.length - 1]) != null ? r : "unknown";
33
+ return {
34
+ source: e,
35
+ src: f,
36
+ name: decodeURIComponent(o.split("?")[0].split("#")[0]),
37
+ extension: I(o)
38
+ };
39
+ }
40
+ const n = URL.createObjectURL(e), c = t != null ? t : "name" in e && typeof e.name == "string" ? e.name : "blob";
41
+ return {
42
+ source: e,
43
+ src: n,
44
+ name: c,
45
+ extension: I(c),
46
+ cleanup: () => URL.revokeObjectURL(n)
47
+ };
48
+ }
49
+ function ie(e, t) {
50
+ const n = document.createElement("a");
51
+ n.href = e, n.download = t, n.target = "_blank", n.rel = "noopener", document.body.append(n), n.click(), n.remove();
52
+ }
53
+ const ue = ["aria-modal"], re = {
54
+ key: 0,
55
+ class: "lfp-toolbar"
56
+ }, ce = { class: "lfp-toolbar__meta" }, de = { class: "lfp-title" }, ve = { class: "lfp-badge" }, fe = { class: "lfp-toolbar__actions" }, pe = {
57
+ key: 0,
58
+ class: "lfp-loading"
59
+ }, me = {
60
+ key: 0,
61
+ class: "lfp-error"
62
+ }, ge = ["src", "alt"], xe = ["src"], be = ["src"], A = /* @__PURE__ */ ee({
63
+ __name: "FilePreview",
64
+ props: {
65
+ source: {},
66
+ fileName: {},
67
+ mode: { default: "inline" },
68
+ visible: { type: Boolean, default: !0 },
69
+ loadingText: { default: "文件加载中..." },
70
+ textEncoding: { default: "utf-8" },
71
+ maxTextBytes: { default: 1024 * 1024 * 2 },
72
+ maxSheetRows: { default: 200 },
73
+ maxSheetCols: { default: 50 },
74
+ pdfScale: { default: 1.35 },
75
+ showToolbar: { type: Boolean, default: !0 },
76
+ dialogTitle: { default: "文件预览" }
77
+ },
78
+ emits: ["update:visible", "error"],
79
+ setup(e, { emit: t }) {
80
+ const n = L(() => import("./PdfRenderer-DweDxjLS.js")), c = L(() => import("./TextRenderer-KUhpnf63.js")), r = L(() => import("./DocxRenderer-Cck1uOjU.js")), f = L(() => import("./SheetRenderer-CMDoDBXR.js")), d = L(() => import("./UnsupportedRenderer-CbQ7S46f.js")), o = e, F = t, b = R(null), p = R(!1), h = R(""), k = R(0), a = R(H(o.source, o.fileName)), w = R(!1), X = {
81
+ image: "图片",
82
+ pdf: "PDF",
83
+ text: "文本",
84
+ docx: "DOCX",
85
+ sheet: "表格",
86
+ video: "视频",
87
+ audio: "音频",
88
+ unsupported: "下载"
89
+ }, m = x(() => le(a.value.name)), W = x(() => X[m.value]), G = x(() => o.fileName || a.value.name || o.dialogTitle), g = x(() => o.mode === "dialog"), J = x(() => g.value ? o.visible : !0), B = x(() => `${a.value.src}::${k.value}`), C = x(
90
+ () => [
91
+ a.value.src,
92
+ a.value.extension,
93
+ o.textEncoding,
94
+ o.maxTextBytes,
95
+ o.maxSheetRows,
96
+ o.maxSheetCols,
97
+ o.pdfScale,
98
+ k.value
99
+ ].join("::")
100
+ ), j = x(() => m.value === "image" ? "img" : m.value === "video" ? "video" : m.value === "audio" ? "audio" : null);
101
+ U(
102
+ () => [o.source, o.fileName],
103
+ () => {
104
+ var i, u;
105
+ (i = b.value) == null || i.call(b), a.value = H(o.source, o.fileName), b.value = (u = a.value.cleanup) != null ? u : null, h.value = "", p.value = !1, k.value += 1;
106
+ },
107
+ { immediate: !0 }
108
+ ), U(
109
+ () => [o.textEncoding, o.maxTextBytes, o.maxSheetRows, o.maxSheetCols, o.pdfScale],
110
+ () => {
111
+ h.value = "", p.value = !1, k.value += 1;
112
+ }
113
+ ), U(
114
+ () => o.visible,
115
+ (i, u) => {
116
+ if (g.value) {
117
+ if (!i) {
118
+ w.value = !1, p.value = !1;
119
+ return;
120
+ }
121
+ u || (h.value = "", p.value = !1, k.value += 1, w.value = !1);
122
+ }
123
+ }
124
+ ), U(
125
+ () => o.mode,
126
+ (i, u) => {
127
+ i === "dialog" && u !== "dialog" && o.visible && (h.value = "", p.value = !1, k.value += 1, w.value = !1);
128
+ }
129
+ ), te(() => {
130
+ var i;
131
+ (i = b.value) == null || i.call(b);
132
+ });
133
+ function M() {
134
+ w.value = !1, F("update:visible", !1);
135
+ }
136
+ function Q() {
137
+ w.value = !0;
138
+ }
139
+ function Y() {
140
+ w.value && (w.value = !1, M());
141
+ }
142
+ function K() {
143
+ ie(a.value.src, a.value.name);
144
+ }
145
+ function P(i) {
146
+ h.value = i.message, F("error", i);
147
+ }
148
+ function T(i) {
149
+ p.value = i;
150
+ }
151
+ return (i, u) => (s(), E(oe, {
152
+ to: "body",
153
+ disabled: !g.value
154
+ }, [
155
+ N(O, {
156
+ name: g.value ? "lfp-dialog" : "lfp-static",
157
+ appear: ""
158
+ }, {
159
+ default: V(() => [
160
+ J.value ? (s(), v("div", {
161
+ key: 0,
162
+ class: Z(["lfp-wrapper", { "is-dialog": g.value }])
163
+ }, [
164
+ g.value ? (s(), v("div", {
165
+ key: 0,
166
+ class: "lfp-backdrop",
167
+ onPointerdown: Q,
168
+ onClick: Y
169
+ }, null, 32)) : S("", !0),
170
+ l("section", {
171
+ class: "lfp-panel",
172
+ role: "dialog",
173
+ "aria-modal": g.value ? "true" : "false"
174
+ }, [
175
+ e.showToolbar ? (s(), v("header", re, [
176
+ l("div", ce, [
177
+ l("strong", de, D(G.value), 1),
178
+ l("span", ve, D(W.value), 1)
179
+ ]),
180
+ l("div", fe, [
181
+ l("button", {
182
+ class: "lfp-button lfp-icon-button",
183
+ type: "button",
184
+ "aria-label": "Download",
185
+ title: "Download",
186
+ onClick: K
187
+ }, [...u[0] || (u[0] = [
188
+ l("svg", {
189
+ viewBox: "0 0 24 24",
190
+ "aria-hidden": "true"
191
+ }, [
192
+ l("path", { d: "M12 3.5a1 1 0 0 1 1 1V12l2.8-2.8a1 1 0 1 1 1.4 1.42l-4.5 4.48a1 1 0 0 1-1.4 0l-4.5-4.48a1 1 0 0 1 1.4-1.42L11 12V4.5a1 1 0 0 1 1-1Zm-7 13a1 1 0 0 1 1 1v.75c0 .41.34.75.75.75h10.5a.75.75 0 0 0 .75-.75v-.75a1 1 0 1 1 2 0v.75A2.75 2.75 0 0 1 17.25 21H6.75A2.75 2.75 0 0 1 4 18.25v-.75a1 1 0 0 1 1-1Z" })
193
+ ], -1)
194
+ ])]),
195
+ g.value ? (s(), v("button", {
196
+ key: 0,
197
+ class: "lfp-button lfp-button is-ghost lfp-icon-button",
198
+ type: "button",
199
+ "aria-label": "Close",
200
+ title: "Close",
201
+ onClick: M
202
+ }, [...u[1] || (u[1] = [
203
+ l("svg", {
204
+ viewBox: "0 0 24 24",
205
+ "aria-hidden": "true"
206
+ }, [
207
+ l("path", { d: "M6.7 5.3a1 1 0 0 1 1.4 0L12 9.17l3.9-3.88a1 1 0 1 1 1.4 1.42L13.4 10.6l3.9 3.89a1 1 0 0 1-1.4 1.42L12 12.03l-3.9 3.88a1 1 0 0 1-1.4-1.42l3.9-3.89-3.9-3.89a1 1 0 0 1 0-1.42Z" })
208
+ ], -1)
209
+ ])])) : S("", !0)
210
+ ])
211
+ ])) : S("", !0),
212
+ l("div", {
213
+ class: Z(["lfp-content", { "is-loading": p.value }])
214
+ }, [
215
+ N(O, { name: "lfp-fade" }, {
216
+ default: V(() => [
217
+ p.value ? (s(), v("div", pe, [
218
+ u[2] || (u[2] = l("span", { class: "lfp-spinner" }, null, -1)),
219
+ l("span", null, D(e.loadingText), 1)
220
+ ])) : S("", !0)
221
+ ]),
222
+ _: 1
223
+ }),
224
+ h.value ? (s(), v("div", me, [
225
+ l("p", null, D(h.value), 1),
226
+ l("button", {
227
+ class: "lfp-button lfp-icon-button",
228
+ type: "button",
229
+ "aria-label": "Download",
230
+ title: "Download",
231
+ onClick: K
232
+ }, [...u[3] || (u[3] = [
233
+ l("svg", {
234
+ viewBox: "0 0 24 24",
235
+ "aria-hidden": "true"
236
+ }, [
237
+ l("path", { d: "M12 3.5a1 1 0 0 1 1 1V12l2.8-2.8a1 1 0 1 1 1.4 1.42l-4.5 4.48a1 1 0 0 1-1.4 0l-4.5-4.48a1 1 0 0 1 1.4-1.42L11 12V4.5a1 1 0 0 1 1-1Zm-7 13a1 1 0 0 1 1 1v.75c0 .41.34.75.75.75h10.5a.75.75 0 0 0 .75-.75v-.75a1 1 0 1 1 2 0v.75A2.75 2.75 0 0 1 17.25 21H6.75A2.75 2.75 0 0 1 4 18.25v-.75a1 1 0 0 1 1-1Z" })
238
+ ], -1)
239
+ ])])
240
+ ])) : (s(), v(ne, { key: 1 }, [
241
+ j.value === "img" ? (s(), v("img", {
242
+ key: B.value,
243
+ class: "lfp-image",
244
+ src: a.value.src,
245
+ alt: a.value.name,
246
+ loading: "lazy"
247
+ }, null, 8, ge)) : j.value === "video" ? (s(), v("video", {
248
+ key: B.value,
249
+ class: "lfp-media",
250
+ src: a.value.src,
251
+ controls: "",
252
+ preload: "metadata"
253
+ }, null, 8, xe)) : j.value === "audio" ? (s(), v("audio", {
254
+ key: B.value,
255
+ class: "lfp-audio",
256
+ src: a.value.src,
257
+ controls: "",
258
+ preload: "metadata"
259
+ }, null, 8, be)) : m.value === "pdf" ? (s(), E(_(n), {
260
+ key: C.value,
261
+ source: typeof o.source == "string" ? a.value.src : o.source,
262
+ scale: e.pdfScale,
263
+ onLoading: T,
264
+ onError: P
265
+ }, null, 8, ["source", "scale"])) : m.value === "docx" ? (s(), E(_(r), {
266
+ key: C.value,
267
+ source: typeof o.source == "string" ? a.value.src : o.source,
268
+ onLoading: T,
269
+ onError: P
270
+ }, null, 8, ["source"])) : m.value === "sheet" ? (s(), E(_(f), {
271
+ key: C.value,
272
+ source: typeof o.source == "string" ? a.value.src : o.source,
273
+ "max-cols": e.maxSheetCols,
274
+ "max-rows": e.maxSheetRows,
275
+ onLoading: T,
276
+ onError: P
277
+ }, null, 8, ["source", "max-cols", "max-rows"])) : m.value === "text" ? (s(), E(_(c), {
278
+ key: C.value,
279
+ source: typeof o.source == "string" ? a.value.src : o.source,
280
+ encoding: e.textEncoding,
281
+ extension: a.value.extension,
282
+ "max-bytes": e.maxTextBytes,
283
+ onLoading: T,
284
+ onError: P
285
+ }, null, 8, ["source", "encoding", "extension", "max-bytes"])) : (s(), E(_(d), {
286
+ key: 7,
287
+ "file-name": a.value.name,
288
+ src: a.value.src
289
+ }, null, 8, ["file-name", "src"]))
290
+ ], 64))
291
+ ], 2)
292
+ ], 8, ue)
293
+ ], 2)) : S("", !0)
294
+ ]),
295
+ _: 1
296
+ }, 8, ["name"])
297
+ ], 8, ["disabled"]));
298
+ }
299
+ });
300
+ function he(e) {
301
+ if (typeof e == "string") {
302
+ const t = document.querySelector(e);
303
+ if (!t)
304
+ throw new Error(`未找到挂载节点:${e}`);
305
+ return t;
306
+ }
307
+ return e;
308
+ }
309
+ function we(e, t) {
310
+ const n = $({ ...t }), c = he(e), r = q({
311
+ render: () => z(A, n)
312
+ });
313
+ return r.mount(c), {
314
+ update(f) {
315
+ Object.assign(n, f);
316
+ },
317
+ unmount() {
318
+ r.unmount();
319
+ }
320
+ };
321
+ }
322
+ function ye(e) {
323
+ const t = document.createElement("div");
324
+ document.body.append(t);
325
+ let n;
326
+ const c = e["onUpdate:visible"], r = $({
327
+ visible: !0,
328
+ mode: "dialog",
329
+ ...e,
330
+ "onUpdate:visible"(d) {
331
+ c == null || c(d), r.visible = d, d || queueMicrotask(() => n.unmount());
332
+ }
333
+ }), f = q({
334
+ render: () => z(A, r)
335
+ });
336
+ return f.mount(t), n = {
337
+ update(d) {
338
+ Object.assign(r, d);
339
+ },
340
+ unmount() {
341
+ f.unmount(), t.remove();
342
+ }
343
+ }, n;
344
+ }
345
+ function Re() {
346
+ const e = {
347
+ mount: we,
348
+ openDialog: ye
349
+ };
350
+ return typeof window != "undefined" && (window.LightFilePreview = e), e;
351
+ }
352
+ const Ee = {
353
+ install(e) {
354
+ e.component("LightFilePreview", A);
355
+ }
356
+ };
357
+ export {
358
+ A as _,
359
+ ie as d,
360
+ Ee as i,
361
+ ye as o,
362
+ Re as r
363
+ };
@@ -1,4 +1,4 @@
1
- import { _ as i, i as r, o, r as l } from "./index-DX4yvG8n.js";
1
+ import { _ as i, i as r, o, r as l } from "./index-DB5StklO.js";
2
2
  export {
3
3
  i as FilePreview,
4
4
  r as default,