@eternalheart/vue-file-preview 1.6.12 → 1.6.13
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 +2 -0
- package/README.zh-CN.md +2 -0
- package/lib/FilePreviewContent.vue.d.ts +9 -1
- package/lib/FilePreviewEmbed.vue.d.ts +4 -1
- package/lib/FilePreviewModal.vue.d.ts +4 -1
- package/lib/chunks/EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs +20 -0
- package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs +32 -0
- package/lib/chunks/{avifLoader-CAUzjn-d-CTy7cevh.mjs → avifLoader-CAUzjn-d-C0KRpetN.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-DdDu94xL.mjs → heicLoader-D_9PukkA-Czof_5FJ.mjs} +1 -1
- package/lib/chunks/{index-CLM9sOKN.mjs → index--612Smof.mjs} +112 -112
- package/lib/chunks/{index-De-oaCgN.mjs → index-8Vpbg2kS.mjs} +2 -2
- package/lib/chunks/{index-2VQLB2Mi.mjs → index-B21EAyWz.mjs} +53 -49
- package/lib/chunks/{index-DmEMePjL.mjs → index-BASg1cr4.mjs} +2 -2
- package/lib/chunks/index-BB0i4QqI.mjs +117 -0
- package/lib/chunks/{index-Bmqn45d_.mjs → index-BVdrGK3Q.mjs} +72 -72
- package/lib/chunks/index-BlrFFeqc.mjs +330 -0
- package/lib/chunks/index-Bp9CuvMZ.mjs +157 -0
- package/lib/chunks/{index-i-KacQvS.mjs → index-BuqPb5mP.mjs} +3 -3
- package/lib/chunks/{index-DVG1fZAv.mjs → index-BvBqDq3O.mjs} +2 -2
- package/lib/chunks/{index-D6te_qaB.mjs → index-Bxpf9v5j.mjs} +26 -26
- package/lib/chunks/{index-D9z6lQat.mjs → index-C9mAajbD.mjs} +225 -220
- package/lib/chunks/{index-CM11hSQu.mjs → index-CDg6vIbT.mjs} +11 -11
- package/lib/chunks/{index-BxmX005K.mjs → index-CWE-hKSs.mjs} +11 -11
- package/lib/chunks/{index-BPmyF7Wr.mjs → index-CY3xzGgt.mjs} +18 -18
- package/lib/chunks/{index-t9kSzzMg.mjs → index-CxKZKUJj.mjs} +521 -523
- package/lib/chunks/{index-CuiEjR23.mjs → index-D30L8tm9.mjs} +15 -15
- package/lib/chunks/{index-DOAOk6m5.mjs → index-DN4Ui0Gh.mjs} +11 -11
- package/lib/chunks/{index-CEk6FKm3.mjs → index-DZZN3kYi.mjs} +551 -531
- package/lib/chunks/{index-D6Pjjxi0.mjs → index-Dkro_8Fy.mjs} +20 -20
- package/lib/chunks/{index-CiGUKdlt.mjs → index-VdzIFJJW.mjs} +23 -23
- package/lib/chunks/{index-WcAnJA2t.mjs → index-aoXgVLBb.mjs} +14 -14
- package/lib/chunks/{jp2Loader-Dig19xyo-BBR3tcPW.mjs → jp2Loader-Dig19xyo-CKUaGhPl.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-DGOmJwkQ.mjs → psdLoader-C0tKUXXl-CYWoQis5.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-CrCtXMup.mjs → rawLoader-C-tPeFAB-C35zC8nZ.mjs} +1 -1
- package/lib/chunks/{tiffLoader-BlhByX8w-jsxHlbyu.mjs → tiffLoader-BlhByX8w-BOxg_Du5.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BdhPCj48.mjs → useShikiHighlight-BPmcxA-h.mjs} +1 -1
- package/lib/index.cjs +59 -59
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +4 -4
- package/lib/renderers/EmptyState.vue.d.ts +2 -0
- package/lib/renderers/Json/index.vue.d.ts +5 -0
- package/lib/renderers/Pptx/index.vue.d.ts +3 -0
- package/lib/renderers/Text/index.vue.d.ts +3 -0
- package/lib/renderers/Xlsx/index.vue.d.ts +3 -0
- package/lib/renderers/registry.d.ts +3 -1
- package/package.json +1 -1
- package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs +0 -30
- package/lib/chunks/index-Bfg5zM8l.mjs +0 -141
- package/lib/chunks/index-Cud9j9Xy.mjs +0 -322
- package/lib/chunks/index-D4jhvs5m.mjs +0 -113
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { defineComponent as ue, ref as d, watch as Q, onMounted as ce, onBeforeUnmount as fe, openBlock as h, createElementBlock as m, createBlock as pe, createCommentVNode as S, createElementVNode as p, toDisplayString as L, unref as N, normalizeStyle as z, createVNode as ve, Fragment as O, renderList as Y } from "vue";
|
|
2
|
+
import de from "@likecoin/epub-ts";
|
|
3
|
+
import { List as he, ChevronLeft as me, ChevronRight as ge, Minimize2 as be, Maximize2 as xe, X as we } from "lucide-vue-next";
|
|
4
|
+
import { u as ye, c as ke } from "./index-DZZN3kYi.mjs";
|
|
5
|
+
import { _ as _e } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
6
|
+
import { T as Te } from "./base.types-DaftHyg7.mjs";
|
|
7
|
+
const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, Ce = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-z-10"
|
|
10
|
+
}, Se = { class: "vfp-renderer-loading-content" }, We = { class: "vfp-renderer-loading-text" }, Me = {
|
|
11
|
+
class: "vfp-flex vfp-items-center vfp-justify-between vfp-flex-shrink-0",
|
|
12
|
+
style: { padding: "12px 16px", "border-bottom": "1px solid rgba(255,255,255,0.1)" }
|
|
13
|
+
}, Ee = { style: { color: "white", "font-weight": "500", "font-size": "14px" } }, $e = {
|
|
14
|
+
class: "vfp-flex-1 vfp-overflow-y-auto",
|
|
15
|
+
style: { padding: "8px 4px" }
|
|
16
|
+
}, He = ["title", "onClick", "onMouseenter", "onMouseleave"], Re = ["title", "onClick", "onMouseenter", "onMouseleave"], Le = 794, qe = /* @__PURE__ */ ue({
|
|
17
|
+
__name: "index",
|
|
18
|
+
props: {
|
|
19
|
+
url: {}
|
|
20
|
+
},
|
|
21
|
+
setup(Z, { expose: ee }) {
|
|
22
|
+
const W = Z, q = new Te(), { t: v } = ye(), te = ke(), g = d(1), w = d(1), r = d(null), M = d(!0), y = d(null), b = d(!1), x = d([]), s = d(!1), A = d("");
|
|
23
|
+
Q([g, w, b, s, () => x.value.length], () => {
|
|
24
|
+
q.notify();
|
|
25
|
+
});
|
|
26
|
+
let c = null, e = null, k = 0, _ = null;
|
|
27
|
+
const G = () => {
|
|
28
|
+
var t;
|
|
29
|
+
try {
|
|
30
|
+
(t = e == null ? void 0 : e.destroy) == null || t.call(e);
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
c == null || c.destroy();
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
e = null, c = null, k = 0, _ = null;
|
|
38
|
+
}, oe = () => {
|
|
39
|
+
e == null || e.prev();
|
|
40
|
+
}, ae = () => {
|
|
41
|
+
e == null || e.next();
|
|
42
|
+
}, re = () => {
|
|
43
|
+
b.value = !b.value, setTimeout(() => {
|
|
44
|
+
r.value && e && (e.resize(r.value.offsetWidth, r.value.offsetHeight), _ && e.display(_), P());
|
|
45
|
+
}, 350);
|
|
46
|
+
}, le = () => {
|
|
47
|
+
s.value = !s.value;
|
|
48
|
+
}, I = (t) => {
|
|
49
|
+
A.value = t, e == null || e.display(t), s.value = !1;
|
|
50
|
+
}, f = (t) => t === A.value;
|
|
51
|
+
ee({
|
|
52
|
+
getToolbarGroups: () => [
|
|
53
|
+
{
|
|
54
|
+
items: [
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
icon: he,
|
|
58
|
+
tooltip: v.value("toolbar.toc"),
|
|
59
|
+
action: le,
|
|
60
|
+
disabled: x.value.length === 0,
|
|
61
|
+
active: s.value
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
items: [
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
icon: me,
|
|
70
|
+
tooltip: v.value("toolbar.prev_page"),
|
|
71
|
+
action: oe,
|
|
72
|
+
disabled: g.value <= 1
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "text",
|
|
76
|
+
content: `${g.value} / ${w.value}`,
|
|
77
|
+
minWidth: "4rem"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
icon: ge,
|
|
82
|
+
tooltip: v.value("toolbar.next_page"),
|
|
83
|
+
action: ae,
|
|
84
|
+
disabled: g.value >= w.value
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
items: [
|
|
90
|
+
{
|
|
91
|
+
type: "button",
|
|
92
|
+
icon: b.value ? be : xe,
|
|
93
|
+
tooltip: b.value ? v.value("toolbar.normal_width") : v.value("toolbar.full_width"),
|
|
94
|
+
action: re,
|
|
95
|
+
active: b.value
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
onToolbarChange: (t) => q.subscribe(t)
|
|
101
|
+
});
|
|
102
|
+
const V = async () => {
|
|
103
|
+
if (r.value) {
|
|
104
|
+
M.value = !0, y.value = null, x.value = [], s.value = !1, r.value.innerHTML = "", G();
|
|
105
|
+
try {
|
|
106
|
+
let t = W.url;
|
|
107
|
+
W.url.startsWith("blob:") && (t = await (await te.value(W.url)).arrayBuffer());
|
|
108
|
+
const l = de(t);
|
|
109
|
+
c = l;
|
|
110
|
+
const o = new Promise((a, n) => {
|
|
111
|
+
l.on("openFailed", (i) => {
|
|
112
|
+
n(i instanceof Error ? i : new Error("EPUB open failed"));
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
e = l.renderTo(r.value, {
|
|
116
|
+
manager: "continuous",
|
|
117
|
+
flow: "scrolled",
|
|
118
|
+
width: "100%",
|
|
119
|
+
height: "100%"
|
|
120
|
+
}), e.themes.register("default", {
|
|
121
|
+
body: {
|
|
122
|
+
background: "#ffffff !important",
|
|
123
|
+
color: "#1a1a1a !important",
|
|
124
|
+
"font-family": '"Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif !important',
|
|
125
|
+
"font-size": "16px !important",
|
|
126
|
+
"line-height": "2 !important",
|
|
127
|
+
padding: "40px 60px !important",
|
|
128
|
+
"max-width": "100% !important",
|
|
129
|
+
"box-sizing": "border-box !important",
|
|
130
|
+
"word-break": "break-word !important",
|
|
131
|
+
"overflow-wrap": "break-word !important"
|
|
132
|
+
},
|
|
133
|
+
p: { "text-indent": "2em !important", margin: "0.8em 0 !important" },
|
|
134
|
+
h1: { "text-align": "center !important", margin: "1.5em 0 1em !important" },
|
|
135
|
+
h2: { margin: "1.2em 0 0.8em !important" },
|
|
136
|
+
h3: { margin: "1em 0 0.6em !important" },
|
|
137
|
+
img: { "max-width": "100% !important", height: "auto !important" },
|
|
138
|
+
a: { color: "#2563eb !important", "text-decoration": "none !important" }
|
|
139
|
+
}), e.themes.select("default"), await Promise.race([c.ready, o]), c.locations.generate(1024).then(() => {
|
|
140
|
+
var i;
|
|
141
|
+
if (!c) return;
|
|
142
|
+
k = c.locations.length();
|
|
143
|
+
const a = e == null ? void 0 : e.currentLocation(), n = ((i = a == null ? void 0 : a.start) == null ? void 0 : i.location) ?? 0;
|
|
144
|
+
g.value = n + 1, w.value = k;
|
|
145
|
+
}).catch(() => {
|
|
146
|
+
});
|
|
147
|
+
const T = await Promise.race([c.loaded.navigation, o]);
|
|
148
|
+
Array.isArray(T == null ? void 0 : T.toc) && (x.value = T.toc), await Promise.race([e.display(), o]), M.value = !1, g.value = 1, w.value = k || 1, e.on("relocated", (a) => {
|
|
149
|
+
var j, U, J;
|
|
150
|
+
const n = a;
|
|
151
|
+
if ((j = n == null ? void 0 : n.start) != null && j.cfi && (_ = n.start.cfi), (U = n == null ? void 0 : n.start) != null && U.href) {
|
|
152
|
+
const B = n.start.href, D = [], K = (se) => {
|
|
153
|
+
for (const H of se) {
|
|
154
|
+
const R = H.href.split("#")[0];
|
|
155
|
+
R && (B === R || B.endsWith("/" + R) || B.endsWith(R)) && D.push(H.href), H.subitems && K(H.subitems);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
K(x.value), D.length === 1 && (A.value = D[0]);
|
|
159
|
+
}
|
|
160
|
+
const i = (J = n == null ? void 0 : n.start) == null ? void 0 : J.location;
|
|
161
|
+
typeof i == "number" && k > 0 && (g.value = i + 1, w.value = k);
|
|
162
|
+
});
|
|
163
|
+
} catch (t) {
|
|
164
|
+
console.error(v.value("epub.load_failed") + ":", t), y.value = v.value("epub.load_failed"), M.value = !1;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
let E = null, C = null, $ = { width: 0, height: 0 }, X = !0;
|
|
169
|
+
const ne = () => {
|
|
170
|
+
if (!(!r.value || !e)) {
|
|
171
|
+
if (e.resize(r.value.offsetWidth, r.value.offsetHeight), _)
|
|
172
|
+
try {
|
|
173
|
+
e.display(_);
|
|
174
|
+
} catch {
|
|
175
|
+
}
|
|
176
|
+
P();
|
|
177
|
+
}
|
|
178
|
+
}, ie = () => {
|
|
179
|
+
r.value && (E = new ResizeObserver(() => {
|
|
180
|
+
if (!r.value) return;
|
|
181
|
+
if (X) {
|
|
182
|
+
X = !1, $ = { width: r.value.offsetWidth, height: r.value.offsetHeight };
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const t = { width: r.value.offsetWidth, height: r.value.offsetHeight }, l = Math.abs($.width - t.width), o = Math.abs($.height - t.height);
|
|
186
|
+
l < 10 && o < 10 || ($ = t, C !== null && clearTimeout(C), C = window.setTimeout(ne, 350));
|
|
187
|
+
}), E.observe(r.value));
|
|
188
|
+
};
|
|
189
|
+
let u = null;
|
|
190
|
+
const F = () => {
|
|
191
|
+
var l;
|
|
192
|
+
if (!u) return;
|
|
193
|
+
const t = u;
|
|
194
|
+
if (t.scrollTop + t.clientHeight >= t.scrollHeight - 200)
|
|
195
|
+
try {
|
|
196
|
+
const o = e == null ? void 0 : e.manager;
|
|
197
|
+
(l = o == null ? void 0 : o.check) == null || l.call(o, 500, 500);
|
|
198
|
+
} catch {
|
|
199
|
+
}
|
|
200
|
+
}, P = () => {
|
|
201
|
+
u && (u.removeEventListener("scroll", F), u = null);
|
|
202
|
+
const t = () => {
|
|
203
|
+
var l;
|
|
204
|
+
u = ((l = r.value) == null ? void 0 : l.querySelector(".epub-container")) ?? null, u ? u.addEventListener("scroll", F, { passive: !0 }) : requestAnimationFrame(t);
|
|
205
|
+
};
|
|
206
|
+
requestAnimationFrame(t);
|
|
207
|
+
};
|
|
208
|
+
return ce(() => {
|
|
209
|
+
V(), ie(), P();
|
|
210
|
+
}), Q(() => W.url, (t) => {
|
|
211
|
+
t && V();
|
|
212
|
+
}), fe(() => {
|
|
213
|
+
E && E.disconnect(), C !== null && clearTimeout(C), u == null || u.removeEventListener("scroll", F), G();
|
|
214
|
+
}), (t, l) => (h(), m("div", ze, [
|
|
215
|
+
y.value ? (h(), pe(_e, {
|
|
216
|
+
key: 0,
|
|
217
|
+
message: y.value,
|
|
218
|
+
class: "vfp-absolute vfp-inset-0"
|
|
219
|
+
}, null, 8, ["message"])) : S("", !0),
|
|
220
|
+
M.value && !y.value ? (h(), m("div", Ce, [
|
|
221
|
+
p("div", Se, [
|
|
222
|
+
l[2] || (l[2] = p("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
223
|
+
p("span", We, L(N(v)("common.loading")), 1)
|
|
224
|
+
])
|
|
225
|
+
])) : S("", !0),
|
|
226
|
+
x.value.length > 0 ? (h(), m("div", {
|
|
227
|
+
key: 2,
|
|
228
|
+
class: "vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex",
|
|
229
|
+
style: z({ opacity: s.value ? 1 : 0, pointerEvents: s.value ? "auto" : "none", transition: "opacity 0.3s" })
|
|
230
|
+
}, [
|
|
231
|
+
p("div", {
|
|
232
|
+
class: "vfp-w-72 vfp-h-full vfp-flex vfp-flex-col",
|
|
233
|
+
style: z({
|
|
234
|
+
maxWidth: "80%",
|
|
235
|
+
background: "rgba(0,0,0,0.9)",
|
|
236
|
+
backdropFilter: "blur(12px)",
|
|
237
|
+
borderRight: "1px solid rgba(255,255,255,0.1)",
|
|
238
|
+
boxShadow: "0 25px 50px -12px rgba(0,0,0,0.25)",
|
|
239
|
+
transform: s.value ? "translateX(0)" : "translateX(-100%)",
|
|
240
|
+
transition: "transform 0.3s ease"
|
|
241
|
+
})
|
|
242
|
+
}, [
|
|
243
|
+
p("div", Me, [
|
|
244
|
+
p("span", Ee, L(N(v)("toolbar.toc")), 1),
|
|
245
|
+
p("button", {
|
|
246
|
+
style: { color: "rgba(255,255,255,0.6)", background: "none", border: "none", cursor: "pointer", padding: "4px" },
|
|
247
|
+
onClick: l[0] || (l[0] = (o) => s.value = !1)
|
|
248
|
+
}, [
|
|
249
|
+
ve(N(we), { style: { width: "16px", height: "16px" } })
|
|
250
|
+
])
|
|
251
|
+
]),
|
|
252
|
+
p("div", $e, [
|
|
253
|
+
(h(!0), m(O, null, Y(x.value, (o, T) => (h(), m(O, {
|
|
254
|
+
key: `${o.href}-${T}`
|
|
255
|
+
}, [
|
|
256
|
+
p("button", {
|
|
257
|
+
style: z({
|
|
258
|
+
width: "100%",
|
|
259
|
+
textAlign: "left",
|
|
260
|
+
padding: "8px 12px",
|
|
261
|
+
fontSize: "14px",
|
|
262
|
+
color: f(o.href) ? "white" : "rgba(255,255,255,0.7)",
|
|
263
|
+
fontWeight: f(o.href) ? "500" : "400",
|
|
264
|
+
background: f(o.href) ? "rgba(255,255,255,0.15)" : "none",
|
|
265
|
+
border: "none",
|
|
266
|
+
cursor: "pointer",
|
|
267
|
+
borderRadius: "4px",
|
|
268
|
+
overflow: "hidden",
|
|
269
|
+
textOverflow: "ellipsis",
|
|
270
|
+
whiteSpace: "nowrap",
|
|
271
|
+
display: "block",
|
|
272
|
+
transition: "all 0.15s"
|
|
273
|
+
}),
|
|
274
|
+
title: o.label,
|
|
275
|
+
onClick: (a) => I(o.href),
|
|
276
|
+
onMouseenter: (a) => !f(o.href) && (a.target.style.background = "rgba(255,255,255,0.1)"),
|
|
277
|
+
onMouseleave: (a) => !f(o.href) && (a.target.style.background = "none")
|
|
278
|
+
}, L(o.label.trim()), 45, He),
|
|
279
|
+
o.subitems && o.subitems.length > 0 ? (h(!0), m(O, { key: 0 }, Y(o.subitems, (a, n) => (h(), m("button", {
|
|
280
|
+
key: `${a.href}-${n}`,
|
|
281
|
+
style: z({
|
|
282
|
+
width: "100%",
|
|
283
|
+
textAlign: "left",
|
|
284
|
+
padding: "8px 12px 8px 28px",
|
|
285
|
+
fontSize: "13px",
|
|
286
|
+
color: f(a.href) ? "white" : "rgba(255,255,255,0.6)",
|
|
287
|
+
fontWeight: f(a.href) ? "500" : "400",
|
|
288
|
+
background: f(a.href) ? "rgba(255,255,255,0.15)" : "none",
|
|
289
|
+
border: "none",
|
|
290
|
+
cursor: "pointer",
|
|
291
|
+
borderRadius: "4px",
|
|
292
|
+
overflow: "hidden",
|
|
293
|
+
textOverflow: "ellipsis",
|
|
294
|
+
whiteSpace: "nowrap",
|
|
295
|
+
display: "block",
|
|
296
|
+
transition: "all 0.15s"
|
|
297
|
+
}),
|
|
298
|
+
title: a.label,
|
|
299
|
+
onClick: (i) => I(a.href),
|
|
300
|
+
onMouseenter: (i) => !f(a.href) && (i.target.style.background = "rgba(255,255,255,0.1)"),
|
|
301
|
+
onMouseleave: (i) => !f(a.href) && (i.target.style.background = "none")
|
|
302
|
+
}, L(a.label.trim()), 45, Re))), 128)) : S("", !0)
|
|
303
|
+
], 64))), 128))
|
|
304
|
+
])
|
|
305
|
+
], 4),
|
|
306
|
+
p("div", {
|
|
307
|
+
class: "vfp-flex-1",
|
|
308
|
+
style: z({ background: s.value ? "rgba(0,0,0,0.3)" : "transparent", transition: "background 0.3s" }),
|
|
309
|
+
onClick: l[1] || (l[1] = (o) => s.value = !1)
|
|
310
|
+
}, null, 4)
|
|
311
|
+
], 4)) : S("", !0),
|
|
312
|
+
y.value ? S("", !0) : (h(), m("div", {
|
|
313
|
+
key: 3,
|
|
314
|
+
ref_key: "viewerRef",
|
|
315
|
+
ref: r,
|
|
316
|
+
class: "vfp-h-full vfp-bg-surface-toolbar",
|
|
317
|
+
style: z({
|
|
318
|
+
width: b.value ? "100%" : `${Le}px`,
|
|
319
|
+
maxWidth: "100%",
|
|
320
|
+
transition: "width 0.3s ease",
|
|
321
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.12)",
|
|
322
|
+
overflow: "hidden"
|
|
323
|
+
})
|
|
324
|
+
}, null, 4))
|
|
325
|
+
]));
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
export {
|
|
329
|
+
qe as default
|
|
330
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { defineComponent as P, ref as v, onMounted as V, watch as q, onBeforeUnmount as A, computed as I, openBlock as p, createElementBlock as h, createElementVNode as k, toDisplayString as O, unref as C, createCommentVNode as T, createVNode as W, normalizeStyle as S } from "vue";
|
|
2
|
+
import { u as $, c as G, l as U, k as E, t as j, W as J } from "./index-DZZN3kYi.mjs";
|
|
3
|
+
import { init as D } from "pptx-preview";
|
|
4
|
+
import { _ as K } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
|
+
import { _ as Q } from "./EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs";
|
|
6
|
+
const X = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, Y = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "vfp-renderer-overlay vfp-renderer-loading"
|
|
9
|
+
}, Z = { class: "vfp-renderer-loading-content" }, ee = { class: "vfp-renderer-loading-text" }, te = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "vfp-renderer-overlay"
|
|
12
|
+
}, ie = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "vfp-renderer-overlay"
|
|
15
|
+
}, se = /* @__PURE__ */ P({
|
|
16
|
+
__name: "index",
|
|
17
|
+
props: {
|
|
18
|
+
url: {},
|
|
19
|
+
tiled: { type: Boolean, default: !0 },
|
|
20
|
+
emptyHint: {}
|
|
21
|
+
},
|
|
22
|
+
setup(R, { expose: z }) {
|
|
23
|
+
const s = R, { t: o } = $(), H = G(), n = v(!0), u = v(null), m = v(!1), w = v(0), l = v(null);
|
|
24
|
+
let r = null, y = null, c = null, f = null, _ = { width: 0, height: 0 }, M = 9 / 16;
|
|
25
|
+
const g = () => {
|
|
26
|
+
var d;
|
|
27
|
+
if (!l.value) return { width: 960, height: 540 };
|
|
28
|
+
const t = l.value.clientWidth, e = ((d = l.value.parentElement) == null ? void 0 : d.clientWidth) || 0, i = t > 100 ? t : e > 100 ? e : 300, a = Math.floor(i * M);
|
|
29
|
+
return { width: i, height: a };
|
|
30
|
+
}, F = async () => {
|
|
31
|
+
if (!(!l.value || !c || w.value === 0))
|
|
32
|
+
try {
|
|
33
|
+
if (r)
|
|
34
|
+
try {
|
|
35
|
+
r.destroy();
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
l.value.innerHTML = "";
|
|
39
|
+
const t = g();
|
|
40
|
+
r = D(l.value, {
|
|
41
|
+
width: t.width,
|
|
42
|
+
height: s.tiled ? t.height * w.value : t.height,
|
|
43
|
+
mode: s.tiled ? "list" : "slide"
|
|
44
|
+
}), await r.preview(c);
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
}, B = async () => {
|
|
48
|
+
if (!l.value) return;
|
|
49
|
+
n.value = !0, u.value = null, m.value = !1;
|
|
50
|
+
let t = window.setTimeout(() => {
|
|
51
|
+
u.value = o.value("pptx.timeout"), n.value = !1;
|
|
52
|
+
}, 3e4);
|
|
53
|
+
try {
|
|
54
|
+
const e = await H.value(s.url, {
|
|
55
|
+
mode: "cors",
|
|
56
|
+
credentials: "omit",
|
|
57
|
+
redirect: "follow"
|
|
58
|
+
});
|
|
59
|
+
if (!e.ok)
|
|
60
|
+
throw e.status === 404 ? new Error(o.value("pptx.not_found")) : e.status === 403 ? new E("file.forbidden") : e.status >= 500 ? new E("file.server_error") : new E("file.load_failed_status", { status: e.status });
|
|
61
|
+
const i = await e.arrayBuffer();
|
|
62
|
+
if (i.byteLength === 0) {
|
|
63
|
+
t !== null && clearTimeout(t), m.value = !0, n.value = !1;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
c = i, M = (await j(i)).ratio;
|
|
67
|
+
const a = document.createElement("div");
|
|
68
|
+
a.style.cssText = "position:absolute;left:-9999px;top:-9999px;visibility:hidden", document.body.appendChild(a);
|
|
69
|
+
try {
|
|
70
|
+
const d = D(a, {
|
|
71
|
+
width: 100,
|
|
72
|
+
height: 100,
|
|
73
|
+
mode: "slide"
|
|
74
|
+
});
|
|
75
|
+
try {
|
|
76
|
+
await d.preview(i);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new Error(o.value("pptx.invalid_format"));
|
|
79
|
+
}
|
|
80
|
+
const x = d.slideCount;
|
|
81
|
+
if (!x || x === 0) throw new Error(o.value("pptx.no_pages"));
|
|
82
|
+
d.destroy(), w.value = x, l.value && (l.value.innerHTML = "");
|
|
83
|
+
const b = g();
|
|
84
|
+
r = D(l.value, {
|
|
85
|
+
width: b.width,
|
|
86
|
+
height: s.tiled ? b.height * x : b.height,
|
|
87
|
+
mode: s.tiled ? "list" : "slide"
|
|
88
|
+
}), await r.preview(i), t !== null && (clearTimeout(t), t = null), n.value = !1;
|
|
89
|
+
} finally {
|
|
90
|
+
document.body.contains(a) && document.body.removeChild(a);
|
|
91
|
+
}
|
|
92
|
+
} catch (e) {
|
|
93
|
+
t !== null && clearTimeout(t);
|
|
94
|
+
let i = o.value("pptx.parse_failed");
|
|
95
|
+
e instanceof Error ? i = J(o.value, e) : typeof e == "string" && (i = e), u.value = i, n.value = !1;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
V(() => {
|
|
99
|
+
if (!l.value) return;
|
|
100
|
+
let t = !0;
|
|
101
|
+
y = new ResizeObserver(() => {
|
|
102
|
+
if (t) {
|
|
103
|
+
t = !1, _ = g();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const e = g(), i = Math.abs(_.width - e.width), a = Math.abs(_.height - e.height);
|
|
107
|
+
i < 10 && a < 10 || (_ = e, f !== null && clearTimeout(f), f = window.setTimeout(() => {
|
|
108
|
+
r && c && F();
|
|
109
|
+
}, 800));
|
|
110
|
+
}), y.observe(l.value), setTimeout(() => {
|
|
111
|
+
requestAnimationFrame(() => requestAnimationFrame(() => B()));
|
|
112
|
+
}, 150);
|
|
113
|
+
}), q(
|
|
114
|
+
() => s.url,
|
|
115
|
+
(t) => {
|
|
116
|
+
t && B();
|
|
117
|
+
}
|
|
118
|
+
), A(() => {
|
|
119
|
+
if (y && y.disconnect(), f !== null && clearTimeout(f), c = null, w.value = 0, r)
|
|
120
|
+
try {
|
|
121
|
+
r.destroy();
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
r = null;
|
|
125
|
+
});
|
|
126
|
+
const L = () => [], N = I(() => U(s.emptyHint, "structured"));
|
|
127
|
+
return z({
|
|
128
|
+
getToolbarGroups: L
|
|
129
|
+
}), (t, e) => (p(), h("div", X, [
|
|
130
|
+
n.value ? (p(), h("div", Y, [
|
|
131
|
+
k("div", Z, [
|
|
132
|
+
e[0] || (e[0] = k("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
133
|
+
k("p", ee, O(C(o)("pptx.loading")), 1)
|
|
134
|
+
])
|
|
135
|
+
])) : T("", !0),
|
|
136
|
+
m.value && !n.value && N.value ? (p(), h("div", te, [
|
|
137
|
+
W(Q)
|
|
138
|
+
])) : T("", !0),
|
|
139
|
+
u.value && !n.value ? (p(), h("div", ie, [
|
|
140
|
+
W(K, {
|
|
141
|
+
message: C(o)("pptx.load_failed"),
|
|
142
|
+
detail: u.value
|
|
143
|
+
}, null, 8, ["message", "detail"])
|
|
144
|
+
])) : T("", !0),
|
|
145
|
+
u.value ? T("", !0) : (p(), h("div", {
|
|
146
|
+
key: 3,
|
|
147
|
+
ref_key: "containerRef",
|
|
148
|
+
ref: l,
|
|
149
|
+
class: "pptx-wrapper vfp-w-full vfp-max-w-full md:vfp-max-w-6xl",
|
|
150
|
+
style: S({ opacity: n.value || m.value ? 0 : 1 })
|
|
151
|
+
}, null, 4))
|
|
152
|
+
]));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export {
|
|
156
|
+
se as default
|
|
157
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as ne, ref as z, onMounted as re, onUnmounted as ae, watch as se, openBlock as k, createElementBlock as H, createVNode as le, createCommentVNode as q, createElementVNode as U, toDisplayString as fe, unref as ue } from "vue";
|
|
2
|
-
import { u as de,
|
|
2
|
+
import { u as de, c as ce, k as pe } from "./index-DZZN3kYi.mjs";
|
|
3
3
|
import * as o from "three";
|
|
4
4
|
import { OrbitControls as me } from "three/examples/jsm/controls/OrbitControls";
|
|
5
5
|
import { DXFLoader as ve } from "three-dxf-loader";
|
|
6
6
|
import { STLLoader as ge } from "three/examples/jsm/loaders/STLLoader";
|
|
7
7
|
import { OBJLoader as he } from "three/examples/jsm/loaders/OBJLoader";
|
|
8
8
|
import { GLTFLoader as we } from "three/examples/jsm/loaders/GLTFLoader";
|
|
9
|
-
import { _ as be } from "./RendererError.vue_vue_type_script_setup_true_lang-
|
|
9
|
+
import { _ as be } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
10
10
|
import { T as Me } from "./base.types-DaftHyg7.mjs";
|
|
11
11
|
import { RotateCcw as ye, Box as xe, Grid3x3 as Ce, Axis3d as Le } from "lucide-vue-next";
|
|
12
12
|
function _e(m) {
|
|
@@ -68,7 +68,7 @@ const Ae = {
|
|
|
68
68
|
}, Ee = {
|
|
69
69
|
key: 1,
|
|
70
70
|
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-3 vfp-z-10"
|
|
71
|
-
}, Pe = { class: "vfp-renderer-loading-content" }, Re = { class: "vfp-renderer-loading-text
|
|
71
|
+
}, Pe = { class: "vfp-renderer-loading-content" }, Re = { class: "vfp-renderer-loading-text" }, He = /* @__PURE__ */ ne({
|
|
72
72
|
__name: "index",
|
|
73
73
|
props: {
|
|
74
74
|
url: {},
|
|
@@ -14,8 +14,8 @@ var jt = (u, e, t, s) => ({
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
import { defineComponent as _b, ref as si, watch as aa, nextTick as wu, onMounted as Gb, onBeforeUnmount as zb, openBlock as zh, createElementBlock as Eu, normalizeStyle as Ep, createElementVNode as ii, toDisplayString as Pm, unref as Sp, createVNode as Vb, createCommentVNode as Su, createBlock as Wb } from "vue";
|
|
17
|
-
import {
|
|
18
|
-
import { _ as Jb } from "./RendererError.vue_vue_type_script_setup_true_lang-
|
|
17
|
+
import { b as Xb, u as Yb, E as Mm, Q as Kb } from "./index-DZZN3kYi.mjs";
|
|
18
|
+
import { _ as Jb } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
19
19
|
import { X as Qb, Menu as Zb, ChevronLeft as qb, ChevronRight as tA, ZoomOut as eA, ZoomIn as sA, RefreshCw as iA } from "lucide-vue-next";
|
|
20
20
|
import { T as nA } from "./base.types-DaftHyg7.mjs";
|
|
21
21
|
var rA = {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as k, ref as p, onMounted as D, watch as
|
|
1
|
+
import { defineComponent as k, ref as p, onMounted as D, watch as z, onBeforeUnmount as M, openBlock as v, createElementBlock as m, createElementVNode as w, toDisplayString as N, unref as S, createCommentVNode as g, createBlock as B, normalizeStyle as C } from "vue";
|
|
2
2
|
import { S as H } from "./index-CyBXARuf.mjs";
|
|
3
|
-
import { u as R,
|
|
4
|
-
import { _ as O } from "./RendererError.vue_vue_type_script_setup_true_lang-
|
|
5
|
-
const V = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" },
|
|
3
|
+
import { u as R, c as W, X as G, m as E, T as F, p as L } from "./index-DZZN3kYi.mjs";
|
|
4
|
+
import { _ as O } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
|
+
const V = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, X = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
|
|
8
|
-
},
|
|
8
|
+
}, j = { class: "vfp-renderer-loading-content" }, q = { class: "vfp-renderer-loading-text" }, K = /* @__PURE__ */ k({
|
|
9
9
|
__name: "index",
|
|
10
10
|
props: {
|
|
11
11
|
url: {},
|
|
12
12
|
fileName: {}
|
|
13
13
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const i =
|
|
16
|
-
let r = null, u = null, o = null,
|
|
14
|
+
setup(T, { expose: x }) {
|
|
15
|
+
const i = T, { t: d } = R(), y = W(), a = p(!0), n = p(null), l = p(null);
|
|
16
|
+
let r = null, u = null, o = null, c = { width: 0, height: 0 };
|
|
17
17
|
const h = () => {
|
|
18
18
|
if (!l.value) return { width: 800, height: 600 };
|
|
19
|
-
const t = l.value.clientWidth, e = l.value.clientHeight, s = t > 100 ? t : 800,
|
|
20
|
-
return { width: s, height:
|
|
19
|
+
const t = l.value.clientWidth, e = l.value.clientHeight, s = t > 100 ? t : 800, f = e > 100 ? e : 600;
|
|
20
|
+
return { width: s, height: f };
|
|
21
21
|
}, b = () => {
|
|
22
22
|
if (!l.value || !r) return;
|
|
23
23
|
l.value.innerHTML = "";
|
|
@@ -44,12 +44,12 @@ const V = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
|
|
|
44
44
|
}).loadData(r);
|
|
45
45
|
}, _ = async () => {
|
|
46
46
|
if (l.value) {
|
|
47
|
-
|
|
47
|
+
a.value = !0, n.value = null;
|
|
48
48
|
try {
|
|
49
49
|
const t = await G(i.url, { fetcher: y.value }), e = E(t, { delimiter: F(i.fileName) });
|
|
50
|
-
r = L(e.header, e.rows, i.fileName), b(),
|
|
50
|
+
r = L(e.header, e.rows, i.fileName), b(), a.value = !1;
|
|
51
51
|
} catch (t) {
|
|
52
|
-
console.error(d.value("csv.parse_failed") + ":", t),
|
|
52
|
+
console.error(d.value("csv.parse_failed") + ":", t), n.value = d.value("csv.load_failed"), a.value = !1;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
};
|
|
@@ -58,43 +58,43 @@ const V = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
|
|
|
58
58
|
let t = !0;
|
|
59
59
|
u = new ResizeObserver(() => {
|
|
60
60
|
if (t) {
|
|
61
|
-
t = !1,
|
|
61
|
+
t = !1, c = h();
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
const e = h(), s = Math.abs(
|
|
65
|
-
s < 10 &&
|
|
64
|
+
const e = h(), s = Math.abs(c.width - e.width), f = Math.abs(c.height - e.height);
|
|
65
|
+
s < 10 && f < 10 || (c = e, o !== null && clearTimeout(o), o = window.setTimeout(() => {
|
|
66
66
|
r && b();
|
|
67
67
|
}, 500));
|
|
68
68
|
}), u.observe(l.value), setTimeout(() => {
|
|
69
69
|
requestAnimationFrame(() => _());
|
|
70
70
|
}, 100);
|
|
71
|
-
}),
|
|
71
|
+
}), z(
|
|
72
72
|
() => i.url,
|
|
73
73
|
() => {
|
|
74
74
|
_();
|
|
75
75
|
}
|
|
76
|
-
),
|
|
76
|
+
), M(() => {
|
|
77
77
|
u && u.disconnect(), o !== null && clearTimeout(o), r = null, l.value && (l.value.innerHTML = "");
|
|
78
|
-
}),
|
|
78
|
+
}), x({
|
|
79
79
|
getToolbarGroups: () => []
|
|
80
80
|
}), (t, e) => (v(), m("div", V, [
|
|
81
|
-
|
|
82
|
-
w("div",
|
|
81
|
+
a.value ? (v(), m("div", X, [
|
|
82
|
+
w("div", j, [
|
|
83
83
|
e[0] || (e[0] = w("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
84
|
-
w("p",
|
|
84
|
+
w("p", q, N(S(d)("csv.loading")), 1)
|
|
85
85
|
])
|
|
86
86
|
])) : g("", !0),
|
|
87
|
-
|
|
87
|
+
n.value && !a.value ? (v(), B(O, {
|
|
88
88
|
key: 1,
|
|
89
|
-
message:
|
|
89
|
+
message: n.value,
|
|
90
90
|
class: "vfp-absolute vfp-inset-0 vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
|
|
91
91
|
}, null, 8, ["message"])) : g("", !0),
|
|
92
|
-
|
|
92
|
+
n.value ? g("", !0) : (v(), m("div", {
|
|
93
93
|
key: 2,
|
|
94
94
|
ref_key: "containerRef",
|
|
95
95
|
ref: l,
|
|
96
96
|
class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
|
|
97
|
-
style: C({ opacity:
|
|
97
|
+
style: C({ opacity: a.value ? 0 : 1 })
|
|
98
98
|
}, null, 4))
|
|
99
99
|
]));
|
|
100
100
|
}
|