@eternalheart/vue-file-preview 1.6.13 → 1.7.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 +2 -0
- package/README.zh-CN.md +2 -0
- package/lib/FilePreviewContent.vue.d.ts +17 -6
- package/lib/FilePreviewEmbed.vue.d.ts +14 -6
- package/lib/FilePreviewModal.vue.d.ts +14 -6
- package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs → EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs} +1 -1
- package/lib/chunks/{avifLoader-CAUzjn-d-C0KRpetN.mjs → avifLoader-CAUzjn-d-CnJpGYJ2.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-Czof_5FJ.mjs → heicLoader-D_9PukkA-g_dLrWLP.mjs} +1 -1
- package/lib/chunks/index-6XZXYqbp.mjs +125 -0
- package/lib/chunks/{index-B21EAyWz.mjs → index-BPSzwMOC.mjs} +51 -51
- package/lib/chunks/index-BYQ9S7Mk.mjs +104 -0
- package/lib/chunks/{index-8Vpbg2kS.mjs → index-Bf94DwQu.mjs} +105 -104
- package/lib/chunks/index-BfOWoMpY.mjs +359 -0
- package/lib/chunks/index-Bg8poMIm.mjs +117 -0
- package/lib/chunks/index-BzwJ0VWu.mjs +108 -0
- package/lib/chunks/index-C41YET0_.mjs +51 -0
- package/lib/chunks/{index-BvBqDq3O.mjs → index-C4hIk6pa.mjs} +2023 -2023
- package/lib/chunks/{index-BASg1cr4.mjs → index-C8lyQPe3.mjs} +1018 -1018
- package/lib/chunks/{index-C9mAajbD.mjs → index-CWPdNhoe.mjs} +200 -200
- package/lib/chunks/{index-BuqPb5mP.mjs → index-CrVQPnFj.mjs} +112 -112
- package/lib/chunks/{index-D30L8tm9.mjs → index-D5IF9F-D.mjs} +57 -57
- package/lib/chunks/{index-DN4Ui0Gh.mjs → index-DFeKS8tR.mjs} +120 -120
- package/lib/chunks/index-DM8Dfl-m.mjs +52 -0
- package/lib/chunks/index-DZe0BxAB.mjs +90 -0
- package/lib/chunks/{index-BlrFFeqc.mjs → index-GFcSJEwj.mjs} +75 -75
- package/lib/chunks/{index-Dkro_8Fy.mjs → index-LPGxJDnT.mjs} +32 -32
- package/lib/chunks/index-aKiIuKKx.mjs +157 -0
- package/lib/chunks/{index-DZZN3kYi.mjs → index-c-pYJEmH.mjs} +1589 -1394
- package/lib/chunks/{index-CxKZKUJj.mjs → index-z9RqL2wI.mjs} +1651 -1651
- package/lib/chunks/index-zLQlyNR2.mjs +383 -0
- package/lib/chunks/{jp2Loader-Dig19xyo-CKUaGhPl.mjs → jp2Loader-Dig19xyo-fCO1knZ0.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-CYWoQis5.mjs → psdLoader-C0tKUXXl-DihMskai.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-C35zC8nZ.mjs → rawLoader-C-tPeFAB-BSfDPl-z.mjs} +5 -5
- package/lib/chunks/{tiffLoader-BlhByX8w-BOxg_Du5.mjs → tiffLoader-BlhByX8w-JY5DaTre.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BPmcxA-h.mjs → useShikiHighlight-C-ztcJBE.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 +52 -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-BB0i4QqI.mjs +0 -117
- package/lib/chunks/index-BVdrGK3Q.mjs +0 -356
- 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-VdzIFJJW.mjs +0 -118
- package/lib/chunks/index-aoXgVLBb.mjs +0 -52
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as
|
|
1
|
+
import { defineComponent as re, ref as z, onMounted as se, onUnmounted as ae, watch as le, openBlock as H, createElementBlock as U, createVNode as fe, createCommentVNode as q, createElementVNode as V, toDisplayString as ue, unref as de } from "vue";
|
|
2
|
+
import { u as ce, a as pe, b as me, J as ve } from "./index-c-pYJEmH.mjs";
|
|
3
3
|
import * as o from "three";
|
|
4
|
-
import { OrbitControls as
|
|
5
|
-
import { DXFLoader as
|
|
6
|
-
import { STLLoader as
|
|
7
|
-
import { OBJLoader as
|
|
8
|
-
import { GLTFLoader as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { T as
|
|
11
|
-
import { RotateCcw as
|
|
4
|
+
import { OrbitControls as ge } from "three/examples/jsm/controls/OrbitControls";
|
|
5
|
+
import { DXFLoader as he } from "three-dxf-loader";
|
|
6
|
+
import { STLLoader as we } from "three/examples/jsm/loaders/STLLoader";
|
|
7
|
+
import { OBJLoader as be } from "three/examples/jsm/loaders/OBJLoader";
|
|
8
|
+
import { GLTFLoader as Me } from "three/examples/jsm/loaders/GLTFLoader";
|
|
9
|
+
import { _ as ye } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
10
|
+
import { T as xe } from "./base.types-DaftHyg7.mjs";
|
|
11
|
+
import { RotateCcw as Ce, Box as Le, Grid3x3 as Ee, Axis3d as Pe } from "lucide-vue-next";
|
|
12
12
|
function _e(m) {
|
|
13
13
|
return [
|
|
14
14
|
{
|
|
15
15
|
items: [
|
|
16
16
|
{
|
|
17
17
|
type: "button",
|
|
18
|
-
icon:
|
|
18
|
+
icon: Ce,
|
|
19
19
|
tooltip: m.t("toolbar.reset"),
|
|
20
20
|
action: () => {
|
|
21
21
|
var b;
|
|
@@ -29,7 +29,7 @@ function _e(m) {
|
|
|
29
29
|
...m.isDxf ? [] : [
|
|
30
30
|
{
|
|
31
31
|
type: "button",
|
|
32
|
-
icon:
|
|
32
|
+
icon: Le,
|
|
33
33
|
tooltip: m.wireframe ? m.t("cad.solid") : m.t("cad.wireframe"),
|
|
34
34
|
active: m.wireframe,
|
|
35
35
|
action: () => {
|
|
@@ -40,7 +40,7 @@ function _e(m) {
|
|
|
40
40
|
],
|
|
41
41
|
{
|
|
42
42
|
type: "button",
|
|
43
|
-
icon:
|
|
43
|
+
icon: Ee,
|
|
44
44
|
tooltip: m.t("cad.grid"),
|
|
45
45
|
active: m.showGrid,
|
|
46
46
|
action: () => {
|
|
@@ -50,7 +50,7 @@ function _e(m) {
|
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
type: "button",
|
|
53
|
-
icon:
|
|
53
|
+
icon: Pe,
|
|
54
54
|
tooltip: m.t("cad.axes"),
|
|
55
55
|
active: m.showAxes,
|
|
56
56
|
action: () => {
|
|
@@ -65,10 +65,10 @@ function _e(m) {
|
|
|
65
65
|
const Ae = {
|
|
66
66
|
key: 0,
|
|
67
67
|
class: "vfp-absolute vfp-inset-0 vfp-bg-surface-3 vfp-z-10"
|
|
68
|
-
},
|
|
68
|
+
}, Re = {
|
|
69
69
|
key: 1,
|
|
70
70
|
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-3 vfp-z-10"
|
|
71
|
-
},
|
|
71
|
+
}, Se = { class: "vfp-renderer-loading-content" }, ze = { class: "vfp-renderer-loading-text" }, ke = /* @__PURE__ */ re({
|
|
72
72
|
__name: "index",
|
|
73
73
|
props: {
|
|
74
74
|
url: {},
|
|
@@ -77,32 +77,32 @@ const Ae = {
|
|
|
77
77
|
baseUrl: {}
|
|
78
78
|
},
|
|
79
79
|
setup(m, { expose: b }) {
|
|
80
|
-
const
|
|
80
|
+
const X = (e) => {
|
|
81
81
|
if (!e || e.startsWith("blob:") || e.startsWith("data:")) return "";
|
|
82
82
|
try {
|
|
83
83
|
return new URL(".", new URL(e, document.baseURI)).href;
|
|
84
84
|
} catch {
|
|
85
85
|
return "";
|
|
86
86
|
}
|
|
87
|
-
},
|
|
88
|
-
const c = Math.max(
|
|
87
|
+
}, k = (e, t, i, s) => {
|
|
88
|
+
const c = Math.max(s.x, s.y, s.z), g = Number.isFinite(c) && c > 0 ? c : 1;
|
|
89
89
|
if (e instanceof o.OrthographicCamera) {
|
|
90
|
-
const l = (e.right - e.left) / (e.top - e.bottom), h = (Math.max(
|
|
90
|
+
const l = (e.right - e.left) / (e.top - e.bottom), h = (Math.max(s.y, s.x / l) || g) * 0.55;
|
|
91
91
|
e.left = -h * l, e.right = h * l, e.top = h, e.bottom = -h, e.near = 0, e.far = g * 4, e.zoom = 1, e.up.set(0, 1, 0), e.position.set(i.x, i.y, i.z + g * 2), e.lookAt(i), t.target.copy(i), t.update(), e.updateProjectionMatrix();
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
e.near = Math.max(g * 1e-3, 1e-4), e.far = Math.max(
|
|
96
|
-
}, v = m, { t:
|
|
97
|
-
let
|
|
98
|
-
const O = new
|
|
99
|
-
var
|
|
100
|
-
return i != null && i.name ? ((
|
|
101
|
-
},
|
|
94
|
+
const n = e.fov * (Math.PI / 180), a = Math.abs(g / 2 / Math.tan(n / 2)) * 1.5;
|
|
95
|
+
e.near = Math.max(g * 1e-3, 1e-4), e.far = Math.max(a * 4, i.length() * 2 + g * 4, e.near * 100), e.position.set(i.x + a, i.y + a, i.z + a), e.lookAt(i), t.target.copy(i), t.update(), e.updateProjectionMatrix();
|
|
96
|
+
}, v = m, { t: A } = ce(), Y = pe(), W = me(), x = z(null), P = z(!0), _ = z(null), T = z(!1), F = z(!0), G = z(!0);
|
|
97
|
+
let r = null, f = null, d = null, u = null, C = null, p = null, w = null, R = null, D = null, S = null, M = !1, L = !0;
|
|
98
|
+
const O = new xe(), N = (e, t, i) => {
|
|
99
|
+
var s, c, g;
|
|
100
|
+
return i != null && i.name ? ((s = i.name.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "" : t ? ((c = t.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "" : ((g = e.split(".").pop()) == null ? void 0 : g.toLowerCase().split("?")[0]) || "";
|
|
101
|
+
}, Z = () => {
|
|
102
102
|
if (!u || !f || !C) return;
|
|
103
103
|
const e = new o.Box3().setFromObject(C), t = e.getCenter(new o.Vector3()), i = e.getSize(new o.Vector3());
|
|
104
|
-
|
|
105
|
-
},
|
|
104
|
+
k(f, u, t, i), L = !0;
|
|
105
|
+
}, $ = () => {
|
|
106
106
|
T.value = !T.value, C && C.traverse((e) => {
|
|
107
107
|
if (e instanceof o.Mesh) {
|
|
108
108
|
const t = e.material;
|
|
@@ -111,140 +111,140 @@ const Ae = {
|
|
|
111
111
|
}) : t.wireframe = T.value);
|
|
112
112
|
}
|
|
113
113
|
}), L = !0, O.notify();
|
|
114
|
-
}, $ = () => {
|
|
115
|
-
F.value = !F.value, p && (p.visible = F.value), L = !0, O.notify();
|
|
116
114
|
}, K = () => {
|
|
115
|
+
F.value = !F.value, p && (p.visible = F.value), L = !0, O.notify();
|
|
116
|
+
}, Q = () => {
|
|
117
117
|
G.value = !G.value, w && (w.visible = G.value), L = !0, O.notify();
|
|
118
|
-
},
|
|
119
|
-
if (!
|
|
120
|
-
const t = e.getSize(new o.Vector3()), i = Math.max(t.x, t.y, t.z),
|
|
118
|
+
}, ee = (e) => {
|
|
119
|
+
if (!r) return;
|
|
120
|
+
const t = e.getSize(new o.Vector3()), i = Math.max(t.x, t.y, t.z), s = Number.isFinite(i) && i > 0 ? i : 1, c = Math.max(
|
|
121
121
|
Math.abs(e.min.x),
|
|
122
122
|
Math.abs(e.max.x),
|
|
123
123
|
Math.abs(e.min.y),
|
|
124
124
|
Math.abs(e.max.y),
|
|
125
125
|
Math.abs(e.min.z),
|
|
126
126
|
Math.abs(e.max.z)
|
|
127
|
-
), g = Number.isFinite(c) ? c :
|
|
128
|
-
p && (p.geometry.dispose(), p.material.dispose(),
|
|
127
|
+
), g = Number.isFinite(c) ? c : s, n = Math.max(s, g * 1.25), a = f instanceof o.OrthographicCamera, l = a ? s * 2 : Math.max(s * 2, g * 2.5);
|
|
128
|
+
p && (p.geometry.dispose(), p.material.dispose(), r.remove(p)), w && (w.geometry.dispose(), w.material.dispose(), r.remove(w)), p = new o.GridHelper(l, 20, 4473924, 2236962), a && (p.rotation.x = Math.PI / 2, e.getCenter(p.position), p.position.z = e.min.z - s * 1e-3), p.visible = F.value, r.add(p), w = new o.AxesHelper(n), w.visible = G.value, r.add(w);
|
|
129
129
|
};
|
|
130
130
|
b({
|
|
131
131
|
getToolbarGroups: () => _e({
|
|
132
|
-
cadRef: { resetView:
|
|
132
|
+
cadRef: { resetView: Z, toggleWireframe: $, toggleGrid: K, toggleAxes: Q },
|
|
133
133
|
isDxf: N(v.url, v.fileName, v.file) === "dxf",
|
|
134
134
|
wireframe: T.value,
|
|
135
135
|
showGrid: F.value,
|
|
136
136
|
showAxes: G.value,
|
|
137
|
-
t:
|
|
137
|
+
t: A.value
|
|
138
138
|
}),
|
|
139
139
|
onToolbarChange: (e) => O.subscribe(e)
|
|
140
140
|
});
|
|
141
|
-
const
|
|
141
|
+
const te = (e) => {
|
|
142
142
|
e.traverse((t) => {
|
|
143
143
|
t.geometry && t.geometry.dispose(), t.material && (Array.isArray(t.material) ? t.material.forEach((i) => {
|
|
144
|
-
|
|
145
|
-
}) :
|
|
144
|
+
j(i);
|
|
145
|
+
}) : j(t.material));
|
|
146
146
|
});
|
|
147
|
-
},
|
|
147
|
+
}, j = (e) => {
|
|
148
148
|
e.map && e.map.dispose(), e.lightMap && e.lightMap.dispose(), e.bumpMap && e.bumpMap.dispose(), e.normalMap && e.normalMap.dispose(), e.specularMap && e.specularMap.dispose(), e.envMap && e.envMap.dispose(), e.dispose();
|
|
149
|
-
},
|
|
149
|
+
}, I = () => {
|
|
150
150
|
if (!x.value) return;
|
|
151
151
|
M = !1, S = new AbortController();
|
|
152
152
|
const e = x.value, t = e.clientWidth, i = e.clientHeight;
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
f =
|
|
153
|
+
r = new o.Scene(), r.background = new o.Color(1710618);
|
|
154
|
+
const s = N(v.url, v.fileName, v.file) === "dxf", c = Math.max(t, 1) / Math.max(i, 1);
|
|
155
|
+
f = s ? new o.OrthographicCamera(-c, c, 1, -1, 0, 1e6) : new o.PerspectiveCamera(45, c, 0.01, 1e6), f.position.set(100, 100, 100), d = new o.WebGLRenderer({ antialias: !0 }), d.setSize(t, i), d.setPixelRatio(Math.min(window.devicePixelRatio, 2)), L = !0, e.appendChild(d.domElement), u = new ge(f, d.domElement), u.enableDamping = !0, u.dampingFactor = 0.05, s && (u.enableRotate = !1, u.screenSpacePanning = !0, u.mouseButtons.LEFT = o.MOUSE.PAN, u.touches.ONE = o.TOUCH.PAN, u.touches.TWO = o.TOUCH.DOLLY_PAN);
|
|
156
156
|
const g = new o.AmbientLight(16777215, 0.6);
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
157
|
+
r.add(g);
|
|
158
|
+
const n = new o.DirectionalLight(16777215, 0.8);
|
|
159
|
+
n.position.set(1, 1, 1), r.add(n);
|
|
160
|
+
const a = new o.DirectionalLight(16777215, 0.4);
|
|
161
|
+
a.position.set(-1, -1, -1), r.add(a), oe();
|
|
162
162
|
const l = () => {
|
|
163
163
|
if (M) return;
|
|
164
|
-
D = requestAnimationFrame(l), ((u == null ? void 0 : u.update()) || L) &&
|
|
164
|
+
D = requestAnimationFrame(l), ((u == null ? void 0 : u.update()) || L) && r && f && d && (d.render(r, f), L = !1);
|
|
165
165
|
};
|
|
166
|
-
l(), R = new ResizeObserver(
|
|
167
|
-
},
|
|
168
|
-
if (!
|
|
166
|
+
l(), R = new ResizeObserver(ie), R.observe(e);
|
|
167
|
+
}, oe = () => {
|
|
168
|
+
if (W.begin(v.url), !r || !f || !u || M) return;
|
|
169
169
|
const e = N(v.url, v.fileName, v.file);
|
|
170
170
|
let t;
|
|
171
171
|
const i = new o.LoadingManager();
|
|
172
172
|
if (e === "dxf")
|
|
173
|
-
t = new
|
|
173
|
+
t = new he();
|
|
174
174
|
else if (e === "stl")
|
|
175
|
-
t = new
|
|
175
|
+
t = new we(i);
|
|
176
176
|
else if (e === "obj")
|
|
177
|
-
t = new
|
|
177
|
+
t = new be(i);
|
|
178
178
|
else if (e === "gltf" || e === "glb")
|
|
179
|
-
t = new
|
|
179
|
+
t = new Me(i);
|
|
180
180
|
else {
|
|
181
|
-
|
|
181
|
+
_.value = A.value("cad.parse_failed"), P.value = !1;
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const s = (n, a) => {
|
|
185
185
|
if (M) return;
|
|
186
|
-
if (!
|
|
187
|
-
|
|
186
|
+
if (!n) {
|
|
187
|
+
_.value = A.value("cad.parse_failed"), P.value = !1;
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
let l;
|
|
191
|
-
if (
|
|
192
|
-
const
|
|
191
|
+
if (a === "stl") {
|
|
192
|
+
const E = n, ne = new o.MeshPhongMaterial({
|
|
193
193
|
color: 8947848,
|
|
194
194
|
flatShading: !0,
|
|
195
195
|
side: o.DoubleSide
|
|
196
196
|
});
|
|
197
|
-
l = new o.Mesh(
|
|
198
|
-
} else if (
|
|
199
|
-
if (l =
|
|
200
|
-
|
|
197
|
+
l = new o.Mesh(E, ne);
|
|
198
|
+
} else if (a === "gltf" || a === "glb") {
|
|
199
|
+
if (l = n.scene, !l) {
|
|
200
|
+
_.value = A.value("cad.parse_failed"), P.value = !1;
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
} else
|
|
204
|
-
l =
|
|
205
|
-
|
|
204
|
+
l = n, l.traverse((E) => {
|
|
205
|
+
E instanceof o.Mesh && !E.material && (E.material = new o.MeshPhongMaterial({
|
|
206
206
|
color: 8947848,
|
|
207
207
|
side: o.DoubleSide
|
|
208
208
|
}));
|
|
209
209
|
});
|
|
210
210
|
const h = new o.Box3().setFromObject(l);
|
|
211
211
|
if (h.isEmpty()) {
|
|
212
|
-
|
|
212
|
+
_.value = A.value("cad.parse_failed"), P.value = !1;
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
r.add(l), C = l;
|
|
216
216
|
const y = h.getCenter(new o.Vector3()), B = h.getSize(new o.Vector3());
|
|
217
|
-
|
|
218
|
-
}, c = (
|
|
219
|
-
M ||
|
|
217
|
+
ee(h), k(f, u, y, B), L = !0, P.value = !1, O.notify();
|
|
218
|
+
}, c = (n) => {
|
|
219
|
+
M || n.name !== "AbortError" && (_.value = A.value("cad.load_failed"), P.value = !1, W.error(n));
|
|
220
220
|
};
|
|
221
|
-
(v.file ? v.file.arrayBuffer() :
|
|
221
|
+
(v.file ? v.file.arrayBuffer() : Y.value(v.url, { signal: S == null ? void 0 : S.signal }).then((n) => {
|
|
222
222
|
if (!M) {
|
|
223
|
-
if (!
|
|
224
|
-
return
|
|
223
|
+
if (!n.ok) throw new ve("file.load_failed");
|
|
224
|
+
return n.arrayBuffer();
|
|
225
225
|
}
|
|
226
|
-
})).then((
|
|
227
|
-
if (!(M || !
|
|
226
|
+
})).then((n) => {
|
|
227
|
+
if (!(M || !n)) {
|
|
228
228
|
if (e === "stl") {
|
|
229
|
-
const
|
|
230
|
-
a
|
|
229
|
+
const a = t.parse(n);
|
|
230
|
+
s(a, e);
|
|
231
231
|
} else if (e === "obj") {
|
|
232
|
-
const l = new TextDecoder("utf-8").decode(
|
|
233
|
-
|
|
232
|
+
const l = new TextDecoder("utf-8").decode(n), h = t.parse(l);
|
|
233
|
+
s(h, e);
|
|
234
234
|
} else if (e === "gltf" || e === "glb")
|
|
235
235
|
t.parse(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
(
|
|
239
|
-
M || a
|
|
236
|
+
n,
|
|
237
|
+
X(v.baseUrl || v.url),
|
|
238
|
+
(a) => {
|
|
239
|
+
M || s(a, e);
|
|
240
240
|
},
|
|
241
|
-
(
|
|
241
|
+
(a) => c(a)
|
|
242
242
|
);
|
|
243
243
|
else if (e === "dxf") {
|
|
244
|
-
const l = new TextDecoder("utf-8").decode(
|
|
244
|
+
const l = new TextDecoder("utf-8").decode(n), h = o.BufferGeometry.prototype.setFromPoints;
|
|
245
245
|
o.BufferGeometry.prototype.setFromPoints = function(y) {
|
|
246
246
|
const B = (y || []).filter(
|
|
247
|
-
(
|
|
247
|
+
(E) => E && E.x !== void 0 && E.y !== void 0
|
|
248
248
|
);
|
|
249
249
|
return h.call(this, B);
|
|
250
250
|
};
|
|
@@ -254,7 +254,7 @@ const Ae = {
|
|
|
254
254
|
(y) => {
|
|
255
255
|
if (!M) {
|
|
256
256
|
const B = (y == null ? void 0 : y.entity) || y;
|
|
257
|
-
|
|
257
|
+
s(B, e);
|
|
258
258
|
}
|
|
259
259
|
},
|
|
260
260
|
(y) => {
|
|
@@ -268,39 +268,39 @@ const Ae = {
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
}).catch((
|
|
272
|
-
M || c(
|
|
271
|
+
}).catch((n) => {
|
|
272
|
+
M || c(n);
|
|
273
273
|
});
|
|
274
|
-
},
|
|
274
|
+
}, ie = () => {
|
|
275
275
|
if (!x.value || !f || !d || M) return;
|
|
276
276
|
const e = x.value.clientWidth, t = x.value.clientHeight;
|
|
277
277
|
e <= 0 || t <= 0 || (f instanceof o.OrthographicCamera ? (f.right = f.top * e / t, f.left = -f.right) : f.aspect = e / t, f.updateProjectionMatrix(), d.setSize(e, t), L = !0);
|
|
278
|
-
},
|
|
279
|
-
M = !0, S && S.abort(), D !== null && (cancelAnimationFrame(D), D = null), R == null || R.disconnect(), R = null, C && (
|
|
278
|
+
}, J = () => {
|
|
279
|
+
M = !0, S && S.abort(), D !== null && (cancelAnimationFrame(D), D = null), R == null || R.disconnect(), R = null, C && (te(C), r == null || r.remove(C), C = null), p && (p.geometry.dispose(), p.material.dispose(), r == null || r.remove(p), p = null), w && (w.geometry.dispose(), w.material.dispose(), r == null || r.remove(w), w = null), u == null || u.dispose(), d == null || d.dispose(), x.value && (d != null && d.domElement) && x.value.contains(d.domElement) && x.value.removeChild(d.domElement), r = null, f = null, d = null, u = null;
|
|
280
280
|
};
|
|
281
|
-
return
|
|
282
|
-
j();
|
|
283
|
-
}), ae(() => {
|
|
281
|
+
return se(() => {
|
|
284
282
|
I();
|
|
285
|
-
}),
|
|
286
|
-
|
|
287
|
-
}), (
|
|
283
|
+
}), ae(() => {
|
|
284
|
+
J();
|
|
285
|
+
}), le(() => v.url, () => {
|
|
286
|
+
J(), P.value = !0, _.value = null, x.value && I();
|
|
287
|
+
}), (e, t) => (H(), U("div", {
|
|
288
288
|
ref_key: "containerRef",
|
|
289
289
|
ref: x,
|
|
290
290
|
class: "vfp-relative vfp-w-full vfp-h-full vfp-bg-media-bg"
|
|
291
291
|
}, [
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
_.value ? (H(), U("div", Ae, [
|
|
293
|
+
fe(ye, { message: _.value }, null, 8, ["message"])
|
|
294
294
|
])) : q("", !0),
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
t[0] || (t[0] =
|
|
298
|
-
|
|
295
|
+
P.value ? (H(), U("div", Re, [
|
|
296
|
+
V("div", Se, [
|
|
297
|
+
t[0] || (t[0] = V("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
298
|
+
V("p", ze, ue(de(A)("cad.loading")), 1)
|
|
299
299
|
])
|
|
300
300
|
])) : q("", !0)
|
|
301
301
|
], 512));
|
|
302
302
|
}
|
|
303
303
|
});
|
|
304
304
|
export {
|
|
305
|
-
|
|
305
|
+
ke as default
|
|
306
306
|
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { codeToHtml as
|
|
5
|
-
import { Code as
|
|
6
|
-
import { u as
|
|
7
|
-
import { _ as
|
|
8
|
-
import { T as
|
|
9
|
-
const
|
|
1
|
+
import { defineComponent as K, computed as O, ref as i, watch as k, nextTick as R, openBlock as d, createElementBlock as p, createElementVNode as y, toDisplayString as B, unref as N, createBlock as Y } from "vue";
|
|
2
|
+
import F from "markdown-it";
|
|
3
|
+
import W from "@traptitech/markdown-it-katex";
|
|
4
|
+
import { codeToHtml as L } from "shiki";
|
|
5
|
+
import { Code as z, Eye as J } from "lucide-vue-next";
|
|
6
|
+
import { u as Q, a as U, b as X, g as Z, h as ee, e as te } from "./index-c-pYJEmH.mjs";
|
|
7
|
+
import { _ as oe } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
8
|
+
import { T as re } from "./base.types-DaftHyg7.mjs";
|
|
9
|
+
const ne = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "vfp-renderer-loading"
|
|
12
|
-
},
|
|
12
|
+
}, se = { class: "vfp-renderer-loading-content" }, le = { class: "vfp-renderer-loading-text" }, ae = {
|
|
13
13
|
key: 2,
|
|
14
14
|
class: "vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
15
15
|
style: { background: "var(--fp-code-bg)" }
|
|
16
|
-
},
|
|
16
|
+
}, ce = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "vfp-p-6 vfp-text-fg-primary vfp-font-mono vfp-text-sm vfp-whitespace-pre-wrap vfp-break-words"
|
|
19
|
-
},
|
|
19
|
+
}, ie = ["innerHTML"], de = {
|
|
20
20
|
key: 3,
|
|
21
21
|
class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
|
|
22
|
-
},
|
|
22
|
+
}, ue = ["innerHTML"], q = '<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>', V = '<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>', pe = '<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>', ve = '<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>', he = /* @__PURE__ */ K({
|
|
23
23
|
__name: "index",
|
|
24
24
|
props: {
|
|
25
25
|
url: {}
|
|
26
26
|
},
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
27
|
+
setup(G, { expose: $ }) {
|
|
28
|
+
const _ = G, C = new re(), { t: a } = Q(), j = U(), T = X(), A = Z(), b = O(() => A.value === "light" ? "github-light" : "github-dark"), c = i("preview"), x = i(""), v = i(""), h = i(""), u = i(!0), f = i(null), m = i(null);
|
|
29
29
|
k([c, u], () => {
|
|
30
30
|
C.notify();
|
|
31
|
-
}),
|
|
31
|
+
}), $({
|
|
32
32
|
getToolbarGroups: () => {
|
|
33
33
|
const e = [];
|
|
34
34
|
return e.push({
|
|
35
35
|
items: [
|
|
36
36
|
{
|
|
37
37
|
type: "button",
|
|
38
|
-
icon: c.value === "preview" ?
|
|
39
|
-
tooltip: c.value === "preview" ?
|
|
38
|
+
icon: c.value === "preview" ? z : J,
|
|
39
|
+
tooltip: c.value === "preview" ? a.value("toolbar.source") : a.value("toolbar.preview"),
|
|
40
40
|
action: () => {
|
|
41
41
|
c.value = c.value === "preview" ? "source" : "preview";
|
|
42
42
|
},
|
|
@@ -47,48 +47,48 @@ const oe = {
|
|
|
47
47
|
},
|
|
48
48
|
onToolbarChange: (e) => C.subscribe(e)
|
|
49
49
|
});
|
|
50
|
-
const
|
|
50
|
+
const s = new F({
|
|
51
51
|
html: !0,
|
|
52
52
|
linkify: !0,
|
|
53
53
|
typographer: !1,
|
|
54
54
|
breaks: !1
|
|
55
55
|
});
|
|
56
|
-
|
|
56
|
+
s.use(W), s.renderer.rules.fence = (e, r) => {
|
|
57
57
|
const t = e[r], n = t.info ? t.info.trim() : "", o = t.content;
|
|
58
58
|
return n ? `<div class="code-block-wrapper">
|
|
59
59
|
<div class="code-block-header">
|
|
60
60
|
<span>${n}</span>
|
|
61
61
|
</div>
|
|
62
|
-
<pre data-shiki-pending="1" data-lang="${n}"><code>${
|
|
62
|
+
<pre data-shiki-pending="1" data-lang="${n}"><code>${s.utils.escapeHtml(o)}</code></pre>
|
|
63
63
|
</div>` : `<div class="code-block-wrapper">
|
|
64
|
-
<pre class="no-lang-pre"><code>${
|
|
64
|
+
<pre class="no-lang-pre"><code>${s.utils.escapeHtml(o)}</code></pre>
|
|
65
65
|
</div>`;
|
|
66
|
-
},
|
|
66
|
+
}, s.renderer.rules.code_block = (e, r) => {
|
|
67
67
|
const t = e[r].content;
|
|
68
68
|
return `<div class="code-block-wrapper">
|
|
69
|
-
<pre class="no-lang-pre"><code>${
|
|
69
|
+
<pre class="no-lang-pre"><code>${s.utils.escapeHtml(t)}</code></pre>
|
|
70
70
|
</div>`;
|
|
71
71
|
};
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const I =
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
u.value = !0, f.value = null;
|
|
72
|
+
const P = s.renderer.rules.table_open || ((e, r, t, n, o) => o.renderToken(e, r, t));
|
|
73
|
+
s.renderer.rules.table_open = (e, r, t, n, o) => '<div class="table-wrapper">' + P(e, r, t, n, o);
|
|
74
|
+
const I = s.renderer.rules.table_close || ((e, r, t, n, o) => o.renderToken(e, r, t));
|
|
75
|
+
s.renderer.rules.table_close = (e, r, t, n, o) => I(e, r, t, n, o) + "</div>";
|
|
76
|
+
const M = async () => {
|
|
77
|
+
T.begin(_.url), u.value = !0, f.value = null;
|
|
78
78
|
try {
|
|
79
|
-
const e = await
|
|
80
|
-
|
|
79
|
+
const e = await ee(_.url, { fetcher: j.value });
|
|
80
|
+
x.value = e, v.value = s.render(e), u.value = !1;
|
|
81
81
|
try {
|
|
82
|
-
h.value = await
|
|
82
|
+
h.value = await L(e, { lang: "markdown", theme: b.value });
|
|
83
83
|
} catch {
|
|
84
84
|
h.value = "";
|
|
85
85
|
}
|
|
86
86
|
} catch (e) {
|
|
87
|
-
console.error(e), f.value =
|
|
87
|
+
console.error(e), f.value = a.value("markdown.load_failed"), u.value = !1, T.error(e);
|
|
88
88
|
}
|
|
89
|
-
},
|
|
89
|
+
}, S = (e, r) => {
|
|
90
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 =
|
|
91
|
+
return t.type = "button", t.className = r ? "code-copy-btn" : "code-copy-btn code-copy-float", t.title = a.value("markdown.copy_code"), t.innerHTML = r ? q : V, t.addEventListener("click", async (n) => {
|
|
92
92
|
n.stopPropagation();
|
|
93
93
|
try {
|
|
94
94
|
await navigator.clipboard.writeText(e);
|
|
@@ -96,21 +96,21 @@ const oe = {
|
|
|
96
96
|
const o = document.createElement("textarea");
|
|
97
97
|
o.value = e, document.body.appendChild(o), o.select(), document.execCommand("copy"), document.body.removeChild(o);
|
|
98
98
|
}
|
|
99
|
-
t.innerHTML = r ?
|
|
100
|
-
t.innerHTML = r ?
|
|
99
|
+
t.innerHTML = r ? pe : ve, t.title = a.value("markdown.copied"), setTimeout(() => {
|
|
100
|
+
t.innerHTML = r ? q : V, t.title = a.value("markdown.copy_code");
|
|
101
101
|
}, 2e3);
|
|
102
102
|
}), t;
|
|
103
|
-
},
|
|
103
|
+
}, D = async () => {
|
|
104
104
|
var t, n;
|
|
105
105
|
if (!m.value) return;
|
|
106
106
|
const e = m.value.querySelectorAll('pre[data-shiki-pending="1"]');
|
|
107
107
|
for (const o of e) {
|
|
108
108
|
const w = o.getAttribute("data-lang") || "text", l = ((t = o.querySelector("code")) == null ? void 0 : t.textContent) || "";
|
|
109
109
|
try {
|
|
110
|
-
const g = await
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
110
|
+
const g = await L(l, { lang: w, theme: b.value }), H = document.createElement("div");
|
|
111
|
+
H.innerHTML = g;
|
|
112
|
+
const E = H.firstElementChild;
|
|
113
|
+
E && o.replaceWith(E);
|
|
114
114
|
} catch {
|
|
115
115
|
o.style.backgroundColor = "var(--fp-code-bg)", o.removeAttribute("data-shiki-pending");
|
|
116
116
|
}
|
|
@@ -119,19 +119,19 @@ const oe = {
|
|
|
119
119
|
for (const o of r) {
|
|
120
120
|
if (o.querySelector(".code-copy-btn")) continue;
|
|
121
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(
|
|
122
|
+
w ? w.appendChild(S(g, !0)) : o.appendChild(S(g, !1));
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
return k(() =>
|
|
126
|
-
v.value && (await
|
|
127
|
-
}), k(
|
|
128
|
-
|
|
129
|
-
}), (e, r) => u.value ? (d(), p("div",
|
|
130
|
-
y("div",
|
|
125
|
+
return k(() => _.url, M, { immediate: !0 }), k(v, async () => {
|
|
126
|
+
v.value && (await R(), D());
|
|
127
|
+
}), k(b, () => {
|
|
128
|
+
x.value && M();
|
|
129
|
+
}), (e, r) => u.value ? (d(), p("div", ne, [
|
|
130
|
+
y("div", se, [
|
|
131
131
|
r[0] || (r[0] = y("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
132
|
-
y("span",
|
|
132
|
+
y("span", le, B(N(a)("common.loading")), 1)
|
|
133
133
|
])
|
|
134
|
-
])) : f.value ? (d(),
|
|
134
|
+
])) : f.value ? (d(), Y(oe, {
|
|
135
135
|
key: 1,
|
|
136
136
|
message: f.value
|
|
137
137
|
}, null, 8, ["message"])) : c.value === "source" ? (d(), p("div", ae, [
|
|
@@ -139,17 +139,17 @@ const oe = {
|
|
|
139
139
|
key: 1,
|
|
140
140
|
class: "shiki-wrapper",
|
|
141
141
|
innerHTML: h.value
|
|
142
|
-
}, null, 8,
|
|
143
|
-
])) : (d(), p("div",
|
|
142
|
+
}, null, 8, ie)) : (d(), p("pre", ce, B(x.value), 1))
|
|
143
|
+
])) : (d(), p("div", de, [
|
|
144
144
|
y("div", {
|
|
145
145
|
ref_key: "containerRef",
|
|
146
146
|
ref: m,
|
|
147
147
|
class: "markdown-body",
|
|
148
148
|
innerHTML: v.value
|
|
149
|
-
}, null, 8,
|
|
149
|
+
}, null, 8, ue)
|
|
150
150
|
]));
|
|
151
151
|
}
|
|
152
|
-
}),
|
|
152
|
+
}), Ce = /* @__PURE__ */ te(he, [["__scopeId", "data-v-51689691"]]);
|
|
153
153
|
export {
|
|
154
|
-
|
|
154
|
+
Ce as default
|
|
155
155
|
};
|