@eternalheart/vue-file-preview 1.6.13 → 1.7.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.
- package/README.md +4 -0
- package/README.zh-CN.md +4 -0
- package/lib/FilePreviewContent.vue.d.ts +25 -6
- package/lib/FilePreviewEmbed.vue.d.ts +19 -6
- package/lib/FilePreviewModal.vue.d.ts +19 -6
- package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs → EmptyState.vue_vue_type_script_setup_true_lang-DSQp7H-K.mjs} +1 -1
- package/lib/chunks/{avifLoader-CAUzjn-d-C0KRpetN.mjs → avifLoader-CAUzjn-d-Cf00sjt2.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-Czof_5FJ.mjs → heicLoader-D_9PukkA-cn1P7b2x.mjs} +1 -1
- package/lib/chunks/{index-BASg1cr4.mjs → index-0VXtKKev.mjs} +1018 -1018
- package/lib/chunks/index-0fXL30y0.mjs +333 -0
- package/lib/chunks/{index-C9mAajbD.mjs → index-B1AwVHWI.mjs} +191 -191
- package/lib/chunks/{index-BvBqDq3O.mjs → index-B77rFiau.mjs} +2023 -2023
- package/lib/chunks/index-BB10as16.mjs +108 -0
- package/lib/chunks/index-BBIn-k4u.mjs +359 -0
- package/lib/chunks/index-BSzaI9ea.mjs +122 -0
- package/lib/chunks/index-BZvy39tn.mjs +117 -0
- package/lib/chunks/index-BlJEM2Lb.mjs +383 -0
- package/lib/chunks/{index-CxKZKUJj.mjs → index-CZlnxQFA.mjs} +1385 -1385
- package/lib/chunks/index-ClhTPqDI.mjs +137 -0
- package/lib/chunks/{index-8Vpbg2kS.mjs → index-D690gnNu.mjs} +118 -117
- package/lib/chunks/index-D7WykPYL.mjs +51 -0
- package/lib/chunks/{index-DZZN3kYi.mjs → index-DBzyeU0G.mjs} +1609 -1375
- package/lib/chunks/{index-Dkro_8Fy.mjs → index-DKFX5ToE.mjs} +33 -33
- package/lib/chunks/index-DRmKaFXK.mjs +157 -0
- package/lib/chunks/index-DXf3wXT5.mjs +155 -0
- package/lib/chunks/{index-BuqPb5mP.mjs → index-Dp7QQjNH.mjs} +114 -114
- package/lib/chunks/index-FzI__DHC.mjs +104 -0
- package/lib/chunks/index-PWjCziZG.mjs +90 -0
- package/lib/chunks/index-bT6XWKO_.mjs +52 -0
- package/lib/chunks/{index-DN4Ui0Gh.mjs → index-tX9VR6Vo.mjs} +122 -122
- package/lib/chunks/{jp2Loader-Dig19xyo-CKUaGhPl.mjs → jp2Loader-Dig19xyo-D-OEDL3n.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-CYWoQis5.mjs → psdLoader-C0tKUXXl-CVN06LUc.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-C35zC8nZ.mjs → rawLoader-C-tPeFAB-DBqcJPFK.mjs} +5 -5
- package/lib/chunks/{tiffLoader-BlhByX8w-BOxg_Du5.mjs → tiffLoader-BlhByX8w-8-0icdyL.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BPmcxA-h.mjs → useShikiHighlight-a_GUszuU.mjs} +1 -1
- package/lib/composables/useAudioPlayer.d.ts +1 -1
- package/lib/composables/usePreviewEvents.d.ts +27 -0
- package/lib/composables/useRequest.d.ts +16 -4
- package/lib/composables/useThemeMode.d.ts +1 -1
- package/lib/composables/useTranslator.d.ts +2 -2
- package/lib/core/events.d.ts +69 -0
- package/lib/core/i18n/index.d.ts +29 -0
- package/lib/core/i18n/messages/en-US.d.ts +5 -0
- package/lib/core/i18n/messages/index.d.ts +9 -0
- package/lib/core/i18n/messages/zh-CN.d.ts +5 -0
- package/lib/core/i18n/types.d.ts +23 -0
- package/lib/core/index.d.ts +34 -0
- package/lib/core/loaders/avifLoader.d.ts +22 -0
- package/lib/core/loaders/heicLoader.d.ts +21 -0
- package/lib/core/loaders/jp2Loader.d.ts +16 -0
- package/lib/core/loaders/jp2Worker.d.ts +1 -0
- package/lib/core/loaders/psdLoader.d.ts +14 -0
- package/lib/core/loaders/rawLoader.d.ts +14 -0
- package/lib/core/loaders/registry.d.ts +32 -0
- package/lib/core/loaders/tiffLoader.d.ts +28 -0
- package/lib/core/loaders/types.d.ts +56 -0
- package/lib/core/types.d.ts +89 -0
- package/lib/core/utils/csvParser.d.ts +31 -0
- package/lib/core/utils/emptyState.d.ts +28 -0
- package/lib/core/utils/excelDataConverter.d.ts +61 -0
- package/lib/core/utils/fileNormalizer.d.ts +21 -0
- package/lib/core/utils/fileType.d.ts +21 -0
- package/lib/core/utils/legacy-office/doc.d.ts +25 -0
- package/lib/core/utils/legacy-office/index.d.ts +8 -0
- package/lib/core/utils/legacy-office/ole.d.ts +8 -0
- package/lib/core/utils/legacy-office/ppt.d.ts +79 -0
- package/lib/core/utils/legacy-office/xls.d.ts +28 -0
- package/lib/core/utils/mimeTypes.d.ts +29 -0
- package/lib/core/utils/ooxml/docx.d.ts +17 -0
- package/lib/core/utils/ooxml/index.d.ts +4 -0
- package/lib/core/utils/ooxml/pptx.d.ts +7 -0
- package/lib/core/utils/ooxml/xml.d.ts +15 -0
- package/lib/core/utils/ooxml/zip.d.ts +3 -0
- package/lib/core/utils/pdfWorker.d.ts +61 -0
- package/lib/core/utils/previewMode.d.ts +7 -0
- package/lib/core/utils/request.d.ts +49 -0
- package/lib/core/utils/subtitleParser.d.ts +44 -0
- package/lib/core/utils/textDecoder.d.ts +30 -0
- package/lib/core/utils/uint8ArrayPolyfill.d.ts +18 -0
- package/lib/core/utils/zipReader.d.ts +51 -0
- package/lib/core/workers/imageDecoder.worker.d.ts +31 -0
- package/lib/core/workers/workerClient.d.ts +14 -0
- package/lib/i18n/localeKey.d.ts +1 -1
- package/lib/index.cjs +60 -60
- package/lib/index.css +1 -1
- package/lib/index.d.ts +11 -9
- package/lib/index.mjs +15 -12
- package/lib/renderers/Audio/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/toolbar.d.ts +2 -2
- package/lib/renderers/Csv/index.vue.d.ts +1 -1
- package/lib/renderers/Doc/index.vue.d.ts +1 -1
- package/lib/renderers/Docx/index.vue.d.ts +1 -1
- package/lib/renderers/Epub/index.vue.d.ts +1 -1
- package/lib/renderers/Font/index.vue.d.ts +1 -1
- package/lib/renderers/Image/index.vue.d.ts +2 -2
- package/lib/renderers/Json/index.vue.d.ts +2 -2
- package/lib/renderers/Markdown/index.vue.d.ts +1 -1
- package/lib/renderers/Mobi/index.vue.d.ts +1 -1
- package/lib/renderers/Msg/index.vue.d.ts +1 -1
- package/lib/renderers/Pdf/index.vue.d.ts +1 -1
- package/lib/renderers/Ppt/index.vue.d.ts +1 -1
- package/lib/renderers/Pptx/index.vue.d.ts +2 -2
- package/lib/renderers/Subtitle/index.vue.d.ts +1 -1
- package/lib/renderers/Text/index.vue.d.ts +2 -2
- package/lib/renderers/Unsupported/index.vue.d.ts +1 -1
- package/lib/renderers/Video/index.vue.d.ts +1 -1
- package/lib/renderers/Xlsx/index.vue.d.ts +2 -2
- package/lib/renderers/Xml/index.vue.d.ts +1 -1
- package/lib/renderers/Zip/TreeItem.vue.d.ts +1 -1
- package/lib/renderers/Zip/index.vue.d.ts +1 -1
- package/lib/renderers/base.types.d.ts +1 -1
- package/lib/renderers/registry.d.ts +1 -1
- package/lib/types.d.ts +3 -3
- package/package.json +2 -2
- package/lib/chunks/index--612Smof.mjs +0 -383
- package/lib/chunks/index-B21EAyWz.mjs +0 -137
- package/lib/chunks/index-BB0i4QqI.mjs +0 -117
- package/lib/chunks/index-BVdrGK3Q.mjs +0 -356
- package/lib/chunks/index-BlrFFeqc.mjs +0 -330
- package/lib/chunks/index-Bp9CuvMZ.mjs +0 -157
- package/lib/chunks/index-Bxpf9v5j.mjs +0 -104
- package/lib/chunks/index-CDg6vIbT.mjs +0 -51
- package/lib/chunks/index-CWE-hKSs.mjs +0 -90
- package/lib/chunks/index-CY3xzGgt.mjs +0 -108
- package/lib/chunks/index-D30L8tm9.mjs +0 -155
- package/lib/chunks/index-VdzIFJJW.mjs +0 -118
- package/lib/chunks/index-aoXgVLBb.mjs +0 -52
|
@@ -1,157 +0,0 @@
|
|
|
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,104 +0,0 @@
|
|
|
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
|
-
import { S as H } from "./index-CyBXARuf.mjs";
|
|
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
|
-
key: 0,
|
|
7
|
-
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
|
|
8
|
-
}, j = { class: "vfp-renderer-loading-content" }, q = { class: "vfp-renderer-loading-text" }, K = /* @__PURE__ */ k({
|
|
9
|
-
__name: "index",
|
|
10
|
-
props: {
|
|
11
|
-
url: {},
|
|
12
|
-
fileName: {}
|
|
13
|
-
},
|
|
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
|
-
const h = () => {
|
|
18
|
-
if (!l.value) return { width: 800, height: 600 };
|
|
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
|
-
}, b = () => {
|
|
22
|
-
if (!l.value || !r) return;
|
|
23
|
-
l.value.innerHTML = "";
|
|
24
|
-
const { width: t, height: e } = h(), s = t < 640;
|
|
25
|
-
new H(l.value, {
|
|
26
|
-
mode: "read",
|
|
27
|
-
showToolbar: !1,
|
|
28
|
-
showContextmenu: !1,
|
|
29
|
-
showGrid: !0,
|
|
30
|
-
row: {
|
|
31
|
-
len: 100,
|
|
32
|
-
height: 25
|
|
33
|
-
},
|
|
34
|
-
col: {
|
|
35
|
-
len: 26,
|
|
36
|
-
width: s ? 80 : 100,
|
|
37
|
-
indexWidth: s ? 40 : 60,
|
|
38
|
-
minWidth: s ? 40 : 60
|
|
39
|
-
},
|
|
40
|
-
view: {
|
|
41
|
-
height: () => e,
|
|
42
|
-
width: () => t
|
|
43
|
-
}
|
|
44
|
-
}).loadData(r);
|
|
45
|
-
}, _ = async () => {
|
|
46
|
-
if (l.value) {
|
|
47
|
-
a.value = !0, n.value = null;
|
|
48
|
-
try {
|
|
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(), a.value = !1;
|
|
51
|
-
} catch (t) {
|
|
52
|
-
console.error(d.value("csv.parse_failed") + ":", t), n.value = d.value("csv.load_failed"), a.value = !1;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
return D(() => {
|
|
57
|
-
if (!l.value) return;
|
|
58
|
-
let t = !0;
|
|
59
|
-
u = new ResizeObserver(() => {
|
|
60
|
-
if (t) {
|
|
61
|
-
t = !1, c = h();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
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
|
-
r && b();
|
|
67
|
-
}, 500));
|
|
68
|
-
}), u.observe(l.value), setTimeout(() => {
|
|
69
|
-
requestAnimationFrame(() => _());
|
|
70
|
-
}, 100);
|
|
71
|
-
}), z(
|
|
72
|
-
() => i.url,
|
|
73
|
-
() => {
|
|
74
|
-
_();
|
|
75
|
-
}
|
|
76
|
-
), M(() => {
|
|
77
|
-
u && u.disconnect(), o !== null && clearTimeout(o), r = null, l.value && (l.value.innerHTML = "");
|
|
78
|
-
}), x({
|
|
79
|
-
getToolbarGroups: () => []
|
|
80
|
-
}), (t, e) => (v(), m("div", V, [
|
|
81
|
-
a.value ? (v(), m("div", X, [
|
|
82
|
-
w("div", j, [
|
|
83
|
-
e[0] || (e[0] = w("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
84
|
-
w("p", q, N(S(d)("csv.loading")), 1)
|
|
85
|
-
])
|
|
86
|
-
])) : g("", !0),
|
|
87
|
-
n.value && !a.value ? (v(), B(O, {
|
|
88
|
-
key: 1,
|
|
89
|
-
message: n.value,
|
|
90
|
-
class: "vfp-absolute vfp-inset-0 vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
|
|
91
|
-
}, null, 8, ["message"])) : g("", !0),
|
|
92
|
-
n.value ? g("", !0) : (v(), m("div", {
|
|
93
|
-
key: 2,
|
|
94
|
-
ref_key: "containerRef",
|
|
95
|
-
ref: l,
|
|
96
|
-
class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
|
|
97
|
-
style: C({ opacity: a.value ? 0 : 1 })
|
|
98
|
-
}, null, 4))
|
|
99
|
-
]));
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
export {
|
|
103
|
-
K as default
|
|
104
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { defineComponent as m, ref as n, watch as _, openBlock as c, createElementBlock as p, createElementVNode as r, toDisplayString as g, unref as h, createBlock as y } from "vue";
|
|
2
|
-
import { u as w, c as k, k as x, B } from "./index-DZZN3kYi.mjs";
|
|
3
|
-
import { _ as T } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
4
|
-
const b = {
|
|
5
|
-
key: 0,
|
|
6
|
-
class: "vfp-renderer-loading"
|
|
7
|
-
}, E = { class: "vfp-renderer-loading-content" }, G = { class: "vfp-renderer-loading-text" }, H = {
|
|
8
|
-
key: 2,
|
|
9
|
-
class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
|
|
10
|
-
}, L = ["innerHTML"], N = /* @__PURE__ */ m({
|
|
11
|
-
__name: "index",
|
|
12
|
-
props: {
|
|
13
|
-
url: {}
|
|
14
|
-
},
|
|
15
|
-
setup(u, { expose: f }) {
|
|
16
|
-
const i = u, { t: l } = w(), d = k(), t = n(""), s = n(!0), a = n(null), v = async () => {
|
|
17
|
-
s.value = !0, a.value = null, t.value = "";
|
|
18
|
-
try {
|
|
19
|
-
const e = await d.value(i.url);
|
|
20
|
-
if (!e.ok) throw new x("file.load_failed");
|
|
21
|
-
const o = await e.arrayBuffer();
|
|
22
|
-
t.value = await B(o);
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.error(l.value("ppt.parse_failed") + ":", e), a.value = l.value("ppt.parse_failed");
|
|
25
|
-
} finally {
|
|
26
|
-
s.value = !1;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
return _(() => i.url, (e) => {
|
|
30
|
-
e && v();
|
|
31
|
-
}, { immediate: !0 }), f({
|
|
32
|
-
getToolbarGroups: () => []
|
|
33
|
-
}), (e, o) => s.value ? (c(), p("div", b, [
|
|
34
|
-
r("div", E, [
|
|
35
|
-
o[0] || (o[0] = r("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
36
|
-
r("span", G, g(h(l)("common.loading")), 1)
|
|
37
|
-
])
|
|
38
|
-
])) : a.value ? (c(), y(T, {
|
|
39
|
-
key: 1,
|
|
40
|
-
message: a.value
|
|
41
|
-
}, null, 8, ["message"])) : (c(), p("div", H, [
|
|
42
|
-
r("div", {
|
|
43
|
-
class: "vfp-legacy-ppt-wrap",
|
|
44
|
-
innerHTML: t.value
|
|
45
|
-
}, null, 8, L)
|
|
46
|
-
]));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
export {
|
|
50
|
-
N as default
|
|
51
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { defineComponent as L, ref as u, watch as M, computed as X, openBlock as l, createElementBlock as a, createElementVNode as r, toDisplayString as d, unref as v, createBlock as D, normalizeStyle as H, Fragment as w, renderList as B } from "vue";
|
|
2
|
-
import { u as F, c as G, X as N } from "./index-DZZN3kYi.mjs";
|
|
3
|
-
import { u as P } from "./useShikiHighlight-BPmcxA-h.mjs";
|
|
4
|
-
import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
|
-
const j = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "vfp-renderer-loading"
|
|
8
|
-
}, q = { class: "vfp-renderer-loading-content" }, A = { class: "vfp-renderer-loading-text" }, C = {
|
|
9
|
-
key: 2,
|
|
10
|
-
class: "vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
11
|
-
style: { background: "var(--fp-code-bg)" }
|
|
12
|
-
}, I = { class: "vfp-py-6 vfp-px-4 vfp-text-fg-primary vfp-font-mono vfp-text-sm vfp-whitespace-pre-wrap vfp-break-words" }, O = {
|
|
13
|
-
key: 3,
|
|
14
|
-
class: "vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
15
|
-
style: { background: "var(--fp-code-bg)" }
|
|
16
|
-
}, R = { class: "vfp-code-gutter" }, V = ["innerHTML"], Z = /* @__PURE__ */ L({
|
|
17
|
-
__name: "index",
|
|
18
|
-
props: {
|
|
19
|
-
url: {},
|
|
20
|
-
fileName: {}
|
|
21
|
-
},
|
|
22
|
-
setup(k, { expose: x }) {
|
|
23
|
-
const m = k, { t: g } = F(), b = G(), i = u(""), f = u(!0), c = u(null), S = u("xml"), { lineHtmls: _ } = P(i, S), T = (e) => {
|
|
24
|
-
const t = " ", o = /(>)(<)(\/*)/g, s = e.replace(o, `$1
|
|
25
|
-
$2$3`);
|
|
26
|
-
let n = 0;
|
|
27
|
-
return s.split(`
|
|
28
|
-
`).map((p) => {
|
|
29
|
-
let y = 0;
|
|
30
|
-
/^<\/\w/.test(p) ? n = Math.max(n - 1, 0) : /^<\w[^>]*[^/]>.*$/.test(p) && !/<.+<\/.+>$/.test(p) && (y = 1);
|
|
31
|
-
const z = t.repeat(n) + p;
|
|
32
|
-
return n += y, z;
|
|
33
|
-
}).join(`
|
|
34
|
-
`);
|
|
35
|
-
}, $ = (e) => {
|
|
36
|
-
try {
|
|
37
|
-
const o = new DOMParser().parseFromString(e, "application/xml");
|
|
38
|
-
if (o.querySelector("parsererror")) return e;
|
|
39
|
-
const n = new XMLSerializer().serializeToString(o);
|
|
40
|
-
return T(n);
|
|
41
|
-
} catch {
|
|
42
|
-
return e;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
M(() => m.url, async () => {
|
|
46
|
-
f.value = !0, c.value = null;
|
|
47
|
-
try {
|
|
48
|
-
const e = await N(m.url, { fetcher: b.value });
|
|
49
|
-
i.value = $(e);
|
|
50
|
-
} catch (e) {
|
|
51
|
-
console.error(e), c.value = g.value("xml.load_failed");
|
|
52
|
-
} finally {
|
|
53
|
-
f.value = !1;
|
|
54
|
-
}
|
|
55
|
-
}, { immediate: !0 });
|
|
56
|
-
const h = X(() => i.value.split(`
|
|
57
|
-
`));
|
|
58
|
-
return x({
|
|
59
|
-
getToolbarGroups: () => []
|
|
60
|
-
}), (e, t) => f.value ? (l(), a("div", j, [
|
|
61
|
-
r("div", q, [
|
|
62
|
-
t[0] || (t[0] = r("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
63
|
-
r("span", A, d(v(g)("common.loading")), 1)
|
|
64
|
-
])
|
|
65
|
-
])) : c.value ? (l(), D(E, {
|
|
66
|
-
key: 1,
|
|
67
|
-
message: c.value
|
|
68
|
-
}, null, 8, ["message"])) : v(_).length === 0 ? (l(), a("div", C, [
|
|
69
|
-
r("pre", I, d(i.value), 1)
|
|
70
|
-
])) : (l(), a("div", O, [
|
|
71
|
-
r("div", {
|
|
72
|
-
class: "vfp-code-block with-line-numbers vfp-w-full",
|
|
73
|
-
style: H({ gridTemplateRows: `repeat(${h.value.length}, auto) minmax(1.5rem, 1fr)` })
|
|
74
|
-
}, [
|
|
75
|
-
(l(!0), a(w, null, B(h.value, (o, s) => (l(), a(w, { key: s }, [
|
|
76
|
-
r("span", R, d(s + 1), 1),
|
|
77
|
-
r("span", {
|
|
78
|
-
class: "vfp-code-line",
|
|
79
|
-
innerHTML: v(_)[s] ?? ""
|
|
80
|
-
}, null, 8, V)
|
|
81
|
-
], 64))), 128)),
|
|
82
|
-
t[1] || (t[1] = r("span", { class: "vfp-code-gutter-filler" }, null, -1)),
|
|
83
|
-
t[2] || (t[2] = r("span", { class: "vfp-code-line-filler" }, null, -1))
|
|
84
|
-
], 4)
|
|
85
|
-
]));
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
export {
|
|
89
|
-
Z as default
|
|
90
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { defineComponent as M, ref as l, watch as y, nextTick as $, computed as k, openBlock as i, createElementBlock as p, createElementVNode as r, toDisplayString as B, unref as F, createBlock as N, normalizeStyle as d, Fragment as I, renderList as C } from "vue";
|
|
2
|
-
import { u as R, c as j, L as q, k as z, d as O, F as U } from "./index-DZZN3kYi.mjs";
|
|
3
|
-
import V from "mammoth";
|
|
4
|
-
import { _ as W } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
|
-
const X = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "vfp-renderer-loading"
|
|
8
|
-
}, Y = { class: "vfp-renderer-loading-content" }, J = { class: "vfp-renderer-loading-text" }, K = {
|
|
9
|
-
key: 2,
|
|
10
|
-
class: "vfp-docx-container vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
11
|
-
style: { background: "rgba(0, 0, 0, 0.15)" }
|
|
12
|
-
}, Q = ["innerHTML"], Z = ["innerHTML"], T = 1123, w = 60, b = 50, ee = 24, re = /* @__PURE__ */ M({
|
|
13
|
-
__name: "index",
|
|
14
|
-
props: {
|
|
15
|
-
url: {}
|
|
16
|
-
},
|
|
17
|
-
setup(G, { expose: H }) {
|
|
18
|
-
const E = T - w * 2, h = G, { t: f } = R(), A = j(), a = l(""), v = l(!0), c = l(null), s = l([]), m = l({}), _ = l(null), P = async () => {
|
|
19
|
-
v.value = !0, c.value = null, a.value = "", s.value = [], m.value = {};
|
|
20
|
-
try {
|
|
21
|
-
const e = await A.value(h.url);
|
|
22
|
-
if (!e.ok) throw new z("file.load_failed");
|
|
23
|
-
const n = await e.arrayBuffer(), [t, o] = await Promise.all([
|
|
24
|
-
V.convertToHtml({ arrayBuffer: n }, { styleMap: O }),
|
|
25
|
-
U(n).catch(() => ({}))
|
|
26
|
-
]);
|
|
27
|
-
m.value = o, a.value = t.value;
|
|
28
|
-
} catch (e) {
|
|
29
|
-
console.error(f.value("docx.parse_failed") + ":", e), c.value = f.value("docx.parse_failed");
|
|
30
|
-
} finally {
|
|
31
|
-
v.value = !1;
|
|
32
|
-
}
|
|
33
|
-
}, L = () => {
|
|
34
|
-
const e = _.value;
|
|
35
|
-
if (!e || !a.value) return;
|
|
36
|
-
const n = Array.from(e.children);
|
|
37
|
-
if (n.length === 0) {
|
|
38
|
-
s.value = [a.value];
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const t = [[]];
|
|
42
|
-
let o = 0;
|
|
43
|
-
for (const u of n) {
|
|
44
|
-
const x = u.offsetHeight;
|
|
45
|
-
o > 0 && o + x > E && (t.push([]), o = 0), t[t.length - 1].push(u.outerHTML), o += x;
|
|
46
|
-
}
|
|
47
|
-
t.length === 0 && t.push([]), s.value = t.map((u) => u.join(""));
|
|
48
|
-
};
|
|
49
|
-
y(() => h.url, (e) => {
|
|
50
|
-
e && P();
|
|
51
|
-
}, { immediate: !0 }), y(a, async () => {
|
|
52
|
-
a.value && (await $(), requestAnimationFrame(() => L()));
|
|
53
|
-
});
|
|
54
|
-
const g = k(() => q(m.value)), S = k(() => ({
|
|
55
|
-
...g.value,
|
|
56
|
-
position: "absolute",
|
|
57
|
-
visibility: "hidden",
|
|
58
|
-
width: `${794 - b * 2}px`,
|
|
59
|
-
pointerEvents: "none"
|
|
60
|
-
})), D = {
|
|
61
|
-
width: "100%",
|
|
62
|
-
maxWidth: "794px",
|
|
63
|
-
minHeight: `${T}px`,
|
|
64
|
-
background: "white",
|
|
65
|
-
boxShadow: "0 2px 12px rgba(0, 0, 0, 0.15)",
|
|
66
|
-
flexShrink: 0,
|
|
67
|
-
padding: `${w}px ${b}px`
|
|
68
|
-
};
|
|
69
|
-
return H({
|
|
70
|
-
getToolbarGroups: () => []
|
|
71
|
-
}), (e, n) => v.value ? (i(), p("div", X, [
|
|
72
|
-
r("div", Y, [
|
|
73
|
-
n[0] || (n[0] = r("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
74
|
-
r("span", J, B(F(f)("common.loading")), 1)
|
|
75
|
-
])
|
|
76
|
-
])) : c.value ? (i(), N(W, {
|
|
77
|
-
key: 1,
|
|
78
|
-
message: c.value
|
|
79
|
-
}, null, 8, ["message"])) : (i(), p("div", K, [
|
|
80
|
-
r("div", {
|
|
81
|
-
ref_key: "measureRef",
|
|
82
|
-
ref: _,
|
|
83
|
-
style: d(S.value),
|
|
84
|
-
innerHTML: a.value
|
|
85
|
-
}, null, 12, Q),
|
|
86
|
-
r("div", {
|
|
87
|
-
class: "vfp-flex vfp-flex-col vfp-items-center",
|
|
88
|
-
style: d({ gap: `${ee}px` })
|
|
89
|
-
}, [
|
|
90
|
-
(i(!0), p(I, null, C(s.value.length > 0 ? s.value : [""], (t, o) => (i(), p("div", {
|
|
91
|
-
key: o,
|
|
92
|
-
style: d({
|
|
93
|
-
...D,
|
|
94
|
-
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.07), 0 10px 20px rgba(0, 0, 0, 0.10)"
|
|
95
|
-
})
|
|
96
|
-
}, [
|
|
97
|
-
r("div", {
|
|
98
|
-
style: d(g.value),
|
|
99
|
-
innerHTML: t
|
|
100
|
-
}, null, 12, Z)
|
|
101
|
-
], 4))), 128))
|
|
102
|
-
], 4)
|
|
103
|
-
]));
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
export {
|
|
107
|
-
re as default
|
|
108
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { defineComponent as D, computed as K, ref as i, watch as k, nextTick as O, openBlock as d, createElementBlock as p, createElementVNode as y, toDisplayString as E, unref as R, createBlock as N } from "vue";
|
|
2
|
-
import X from "markdown-it";
|
|
3
|
-
import Y from "@traptitech/markdown-it-katex";
|
|
4
|
-
import { codeToHtml as B } from "shiki";
|
|
5
|
-
import { Code as F, Eye as W } from "lucide-vue-next";
|
|
6
|
-
import { u as z, c as J, g as Q, X as U, _ as Z } from "./index-DZZN3kYi.mjs";
|
|
7
|
-
import { _ as ee } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
8
|
-
import { T as te } from "./base.types-DaftHyg7.mjs";
|
|
9
|
-
const oe = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "vfp-renderer-loading"
|
|
12
|
-
}, re = { class: "vfp-renderer-loading-content" }, ne = { class: "vfp-renderer-loading-text" }, ae = {
|
|
13
|
-
key: 2,
|
|
14
|
-
class: "vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
15
|
-
style: { background: "var(--fp-code-bg)" }
|
|
16
|
-
}, le = {
|
|
17
|
-
key: 0,
|
|
18
|
-
class: "vfp-p-6 vfp-text-fg-primary vfp-font-mono vfp-text-sm vfp-whitespace-pre-wrap vfp-break-words"
|
|
19
|
-
}, se = ["innerHTML"], ce = {
|
|
20
|
-
key: 3,
|
|
21
|
-
class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
|
|
22
|
-
}, ie = ["innerHTML"], L = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', q = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', de = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', ue = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', pe = /* @__PURE__ */ D({
|
|
23
|
-
__name: "index",
|
|
24
|
-
props: {
|
|
25
|
-
url: {}
|
|
26
|
-
},
|
|
27
|
-
setup(V, { expose: G }) {
|
|
28
|
-
const x = V, C = new te(), { t: s } = z(), $ = J(), j = Q(), _ = K(() => j.value === "light" ? "github-light" : "github-dark"), c = i("preview"), b = i(""), v = i(""), h = i(""), u = i(!0), f = i(null), m = i(null);
|
|
29
|
-
k([c, u], () => {
|
|
30
|
-
C.notify();
|
|
31
|
-
}), G({
|
|
32
|
-
getToolbarGroups: () => {
|
|
33
|
-
const e = [];
|
|
34
|
-
return e.push({
|
|
35
|
-
items: [
|
|
36
|
-
{
|
|
37
|
-
type: "button",
|
|
38
|
-
icon: c.value === "preview" ? F : W,
|
|
39
|
-
tooltip: c.value === "preview" ? s.value("toolbar.source") : s.value("toolbar.preview"),
|
|
40
|
-
action: () => {
|
|
41
|
-
c.value = c.value === "preview" ? "source" : "preview";
|
|
42
|
-
},
|
|
43
|
-
active: c.value === "source"
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}), e;
|
|
47
|
-
},
|
|
48
|
-
onToolbarChange: (e) => C.subscribe(e)
|
|
49
|
-
});
|
|
50
|
-
const a = new X({
|
|
51
|
-
html: !0,
|
|
52
|
-
linkify: !0,
|
|
53
|
-
typographer: !1,
|
|
54
|
-
breaks: !1
|
|
55
|
-
});
|
|
56
|
-
a.use(Y), a.renderer.rules.fence = (e, r) => {
|
|
57
|
-
const t = e[r], n = t.info ? t.info.trim() : "", o = t.content;
|
|
58
|
-
return n ? `<div class="code-block-wrapper">
|
|
59
|
-
<div class="code-block-header">
|
|
60
|
-
<span>${n}</span>
|
|
61
|
-
</div>
|
|
62
|
-
<pre data-shiki-pending="1" data-lang="${n}"><code>${a.utils.escapeHtml(o)}</code></pre>
|
|
63
|
-
</div>` : `<div class="code-block-wrapper">
|
|
64
|
-
<pre class="no-lang-pre"><code>${a.utils.escapeHtml(o)}</code></pre>
|
|
65
|
-
</div>`;
|
|
66
|
-
}, a.renderer.rules.code_block = (e, r) => {
|
|
67
|
-
const t = e[r].content;
|
|
68
|
-
return `<div class="code-block-wrapper">
|
|
69
|
-
<pre class="no-lang-pre"><code>${a.utils.escapeHtml(t)}</code></pre>
|
|
70
|
-
</div>`;
|
|
71
|
-
};
|
|
72
|
-
const A = a.renderer.rules.table_open || ((e, r, t, n, o) => o.renderToken(e, r, t));
|
|
73
|
-
a.renderer.rules.table_open = (e, r, t, n, o) => '<div class="table-wrapper">' + A(e, r, t, n, o);
|
|
74
|
-
const I = a.renderer.rules.table_close || ((e, r, t, n, o) => o.renderToken(e, r, t));
|
|
75
|
-
a.renderer.rules.table_close = (e, r, t, n, o) => I(e, r, t, n, o) + "</div>";
|
|
76
|
-
const T = async () => {
|
|
77
|
-
u.value = !0, f.value = null;
|
|
78
|
-
try {
|
|
79
|
-
const e = await U(x.url, { fetcher: $.value });
|
|
80
|
-
b.value = e, v.value = a.render(e), u.value = !1;
|
|
81
|
-
try {
|
|
82
|
-
h.value = await B(e, { lang: "markdown", theme: _.value });
|
|
83
|
-
} catch {
|
|
84
|
-
h.value = "";
|
|
85
|
-
}
|
|
86
|
-
} catch (e) {
|
|
87
|
-
console.error(e), f.value = s.value("markdown.load_failed"), u.value = !1;
|
|
88
|
-
}
|
|
89
|
-
}, M = (e, r) => {
|
|
90
|
-
const t = document.createElement("button");
|
|
91
|
-
return t.type = "button", t.className = r ? "code-copy-btn" : "code-copy-btn code-copy-float", t.title = s.value("markdown.copy_code"), t.innerHTML = r ? L : q, t.addEventListener("click", async (n) => {
|
|
92
|
-
n.stopPropagation();
|
|
93
|
-
try {
|
|
94
|
-
await navigator.clipboard.writeText(e);
|
|
95
|
-
} catch {
|
|
96
|
-
const o = document.createElement("textarea");
|
|
97
|
-
o.value = e, document.body.appendChild(o), o.select(), document.execCommand("copy"), document.body.removeChild(o);
|
|
98
|
-
}
|
|
99
|
-
t.innerHTML = r ? de : ue, t.title = s.value("markdown.copied"), setTimeout(() => {
|
|
100
|
-
t.innerHTML = r ? L : q, t.title = s.value("markdown.copy_code");
|
|
101
|
-
}, 2e3);
|
|
102
|
-
}), t;
|
|
103
|
-
}, P = async () => {
|
|
104
|
-
var t, n;
|
|
105
|
-
if (!m.value) return;
|
|
106
|
-
const e = m.value.querySelectorAll('pre[data-shiki-pending="1"]');
|
|
107
|
-
for (const o of e) {
|
|
108
|
-
const w = o.getAttribute("data-lang") || "text", l = ((t = o.querySelector("code")) == null ? void 0 : t.textContent) || "";
|
|
109
|
-
try {
|
|
110
|
-
const g = await B(l, { lang: w, theme: _.value }), S = document.createElement("div");
|
|
111
|
-
S.innerHTML = g;
|
|
112
|
-
const H = S.firstElementChild;
|
|
113
|
-
H && o.replaceWith(H);
|
|
114
|
-
} catch {
|
|
115
|
-
o.style.backgroundColor = "var(--fp-code-bg)", o.removeAttribute("data-shiki-pending");
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const r = m.value.querySelectorAll(".code-block-wrapper");
|
|
119
|
-
for (const o of r) {
|
|
120
|
-
if (o.querySelector(".code-copy-btn")) continue;
|
|
121
|
-
const w = o.querySelector(".code-block-header"), l = o.querySelector("pre"), g = ((n = l == null ? void 0 : l.querySelector("code")) == null ? void 0 : n.textContent) ?? (l == null ? void 0 : l.textContent) ?? "";
|
|
122
|
-
w ? w.appendChild(M(g, !0)) : o.appendChild(M(g, !1));
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
return k(() => x.url, T, { immediate: !0 }), k(v, async () => {
|
|
126
|
-
v.value && (await O(), P());
|
|
127
|
-
}), k(_, () => {
|
|
128
|
-
b.value && T();
|
|
129
|
-
}), (e, r) => u.value ? (d(), p("div", oe, [
|
|
130
|
-
y("div", re, [
|
|
131
|
-
r[0] || (r[0] = y("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
132
|
-
y("span", ne, E(R(s)("common.loading")), 1)
|
|
133
|
-
])
|
|
134
|
-
])) : f.value ? (d(), N(ee, {
|
|
135
|
-
key: 1,
|
|
136
|
-
message: f.value
|
|
137
|
-
}, null, 8, ["message"])) : c.value === "source" ? (d(), p("div", ae, [
|
|
138
|
-
h.value ? (d(), p("div", {
|
|
139
|
-
key: 1,
|
|
140
|
-
class: "shiki-wrapper",
|
|
141
|
-
innerHTML: h.value
|
|
142
|
-
}, null, 8, se)) : (d(), p("pre", le, E(b.value), 1))
|
|
143
|
-
])) : (d(), p("div", ce, [
|
|
144
|
-
y("div", {
|
|
145
|
-
ref_key: "containerRef",
|
|
146
|
-
ref: m,
|
|
147
|
-
class: "markdown-body",
|
|
148
|
-
innerHTML: v.value
|
|
149
|
-
}, null, 8, ie)
|
|
150
|
-
]));
|
|
151
|
-
}
|
|
152
|
-
}), be = /* @__PURE__ */ Z(pe, [["__scopeId", "data-v-9a471ad8"]]);
|
|
153
|
-
export {
|
|
154
|
-
be as default
|
|
155
|
-
};
|