@7niao/doc-previewer 0.0.0-stage → 0.1.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/LICENSE +15 -0
- package/README.md +217 -2
- package/dist/assets/ArchiveRenderer-BZsm87A2.js +514 -0
- package/dist/assets/CadRenderer-DQiBmk71.js +1838 -0
- package/dist/assets/DocxRenderer-6BCR0R9L.js +3173 -0
- package/dist/assets/GisRenderer-BQ_T-z1A.js +9758 -0
- package/dist/assets/ImageRenderer-D1SFZkV3.js +24 -0
- package/dist/assets/MediaRenderer-DKj0V7cL.js +66 -0
- package/dist/assets/Model3dRenderer-DDk-HsYP.js +1966 -0
- package/dist/assets/OfdRenderer-1kDqHPDa.js +67 -0
- package/dist/assets/PdfRenderer-DuZpWPAu.js +16370 -0
- package/dist/assets/PptxRenderer-BSoVSGOz.js +48492 -0
- package/dist/assets/TextRenderer-pKpgA2wF.js +38 -0
- package/dist/assets/UnsupportedRenderer-CnjuGXg3.js +29 -0
- package/dist/assets/XlsxRenderer-Bohk5iIA.js +16257 -0
- package/dist/assets/_plugin-vue_export-helper-Djzt4Yr7.js +7 -0
- package/dist/assets/createLucideIcon-C_l8giLP.js +91 -0
- package/dist/assets/dom-Ba50_9e0.js +93 -0
- package/dist/assets/dwg2dxf-wasm-DO6Y5cnM.js +2148 -0
- package/dist/assets/file-question-mark-D7iJe3UN.js +21 -0
- package/dist/assets/jszip.min-OjSHaKmg.js +3039 -0
- package/dist/assets/ofd.es-CauEO04U.js +24255 -0
- package/dist/assets/rolldown-runtime-CwxnZyOB.js +22 -0
- package/dist/assets/three.module-B04XcvCz.js +12454 -0
- package/dist/assets/types-CVtHVd2P.js +168 -0
- package/dist/index.js +725 -0
- package/dist/libarchive/libarchive.wasm +0 -0
- package/dist/libarchive/worker-bundle.js +6 -0
- package/dist/style.css +2 -0
- package/dist/types/FileViewer.vue.d.ts +48 -0
- package/dist/types/components/PreviewToolbar.vue.d.ts +33 -0
- package/dist/types/composables/useFullscreen.d.ts +6 -0
- package/dist/types/composables/usePreviewSource.d.ts +14 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/renderers/ArchiveRenderer.vue.d.ts +18 -0
- package/dist/types/renderers/CadRenderer.vue.d.ts +29 -0
- package/dist/types/renderers/DocxRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/GisRenderer.vue.d.ts +26 -0
- package/dist/types/renderers/ImageRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/MediaRenderer.vue.d.ts +17 -0
- package/dist/types/renderers/Model3dRenderer.vue.d.ts +29 -0
- package/dist/types/renderers/OfdRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/PdfRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/PptxRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/TextRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/UnsupportedRenderer.vue.d.ts +14 -0
- package/dist/types/renderers/XlsxRenderer.vue.d.ts +16 -0
- package/dist/types/types.d.ts +51 -0
- package/dist/types/utils/detect.d.ts +10 -0
- package/dist/types/utils/dom.d.ts +13 -0
- package/dist/types/vendor/asn1js-stub.d.ts +10 -0
- package/package.json +77 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { h as e, inject as t } from "vue";
|
|
2
|
+
// node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/build/defaultAttributes.mjs
|
|
3
|
+
var n = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: 24,
|
|
6
|
+
height: 24,
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
"stroke-width": 2,
|
|
11
|
+
"stroke-linecap": "round",
|
|
12
|
+
"stroke-linejoin": "round"
|
|
13
|
+
}, r = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim();
|
|
14
|
+
// node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/build/buildLucideIconNode.mjs
|
|
15
|
+
function i(e) {
|
|
16
|
+
return e != null;
|
|
17
|
+
}
|
|
18
|
+
function a(e, t = {}) {
|
|
19
|
+
let a = t.attributeNames ?? {}, o = (e) => a[e] ?? e, s = e.size ?? e.width ?? n.width, c = e.size ?? e.height ?? n.height, l = e.aliases?.filter((e) => typeof e == "string" && e.trim() !== "").map((e) => `lucide-${e}`) ?? [], u = [...e.name ? [`lucide-${e.name}`] : [], ...l], d = t.className?.split(" ").filter(Boolean) ?? [], f = t.includeDefaultClasses === !1 ? r(...d) : r("lucide", ...u, ...d), p = t.absoluteStrokeWidth ? Number(t.strokeWidth ?? n["stroke-width"]) * Number(e.size ?? e.width ?? n.width) / Number(t.size ?? t.width ?? n.width) : t.strokeWidth ?? n["stroke-width"];
|
|
20
|
+
return [
|
|
21
|
+
"svg",
|
|
22
|
+
{
|
|
23
|
+
...Object.entries(n).reduce((e, [t, n]) => (e[o(t)] = n, e), {}),
|
|
24
|
+
..."color" in t && t.color && { [o("stroke")]: t.color },
|
|
25
|
+
..."size" in t && i(t.size) && {
|
|
26
|
+
[o("width")]: t.size,
|
|
27
|
+
[o("height")]: t.size
|
|
28
|
+
},
|
|
29
|
+
..."width" in t && i(t.width) && { [o("width")]: t.width },
|
|
30
|
+
..."height" in t && i(t.height) && { [o("height")]: t.height },
|
|
31
|
+
[o("stroke-width")]: p,
|
|
32
|
+
...f && { [o("class")]: f },
|
|
33
|
+
[o("viewBox")]: `0 0 ${s} ${c}`,
|
|
34
|
+
...t.hasA11yProp === !1 ? { [o("aria-hidden")]: "true" } : {},
|
|
35
|
+
..."attributes" in t && t.attributes
|
|
36
|
+
},
|
|
37
|
+
e.node.map((e) => {
|
|
38
|
+
let [n, r, i] = e, a = t.nonScalingStroke ? {
|
|
39
|
+
[o("vector-effect")]: "non-scaling-stroke",
|
|
40
|
+
...r
|
|
41
|
+
} : r;
|
|
42
|
+
return i ? [
|
|
43
|
+
n,
|
|
44
|
+
a,
|
|
45
|
+
i
|
|
46
|
+
] : [n, a];
|
|
47
|
+
})
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
// node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/hasA11yProp.mjs
|
|
51
|
+
var o = (e) => {
|
|
52
|
+
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
53
|
+
return !1;
|
|
54
|
+
}, s = (e) => e === "", c = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), l = /* @__PURE__ */ Symbol("lucide-icons");
|
|
55
|
+
function u() {
|
|
56
|
+
return t(l, {});
|
|
57
|
+
}
|
|
58
|
+
// node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
|
|
59
|
+
var d = ({ name: t, iconNode: n, "icon-node": r, icon: i = {
|
|
60
|
+
name: t && c(t),
|
|
61
|
+
node: n ?? r ?? [],
|
|
62
|
+
size: 24,
|
|
63
|
+
aliases: []
|
|
64
|
+
}, absoluteStrokeWidth: l, "absolute-stroke-width": d, nonScalingStroke: f, "non-scaling-stroke": p, strokeWidth: m, "stroke-width": h, size: g, width: _ = g, height: v = g, color: y, ...b }, { slots: x }) => {
|
|
65
|
+
let { size: S, color: C, strokeWidth: w = 2, absoluteStrokeWidth: T = !1, nonScalingStroke: E = !1, class: D = "" } = u(), O = s(l) || s(d) || l === !0 || d === !0 || T === !0, k = s(f) || s(p) || f === !0 || p === !0 || E === !0;
|
|
66
|
+
delete b.class;
|
|
67
|
+
let A = x.default?.(), [, j, M = []] = a(i, {
|
|
68
|
+
color: y ?? C,
|
|
69
|
+
width: _ ?? g ?? S,
|
|
70
|
+
height: v ?? g ?? S,
|
|
71
|
+
strokeWidth: m ?? h ?? w,
|
|
72
|
+
absoluteStrokeWidth: O,
|
|
73
|
+
nonScalingStroke: k,
|
|
74
|
+
className: D,
|
|
75
|
+
hasA11yProp: A != null && A.length > 0 || o(b),
|
|
76
|
+
attributes: b
|
|
77
|
+
});
|
|
78
|
+
return e("svg", j, [...M.map(([t, n]) => e(t, n)), ...A ?? []]);
|
|
79
|
+
};
|
|
80
|
+
// node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/createLucideIcon.mjs
|
|
81
|
+
function f(t, n = []) {
|
|
82
|
+
let r = typeof t == "string" ? {
|
|
83
|
+
name: t,
|
|
84
|
+
node: n
|
|
85
|
+
} : t;
|
|
86
|
+
return (t, { slots: n }) => e(d, {
|
|
87
|
+
...t,
|
|
88
|
+
icon: r
|
|
89
|
+
}, n.default ? { default: n.default } : void 0);
|
|
90
|
+
}
|
|
91
|
+
export { f as t };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// src/components/file-viewer/utils/dom.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!e || e < 0) return "";
|
|
4
|
+
if (e < 1024) return `${e} B`;
|
|
5
|
+
let t = [
|
|
6
|
+
"KB",
|
|
7
|
+
"MB",
|
|
8
|
+
"GB",
|
|
9
|
+
"TB"
|
|
10
|
+
], n = e / 1024, r = 0;
|
|
11
|
+
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
12
|
+
return `${n >= 10 ? n.toFixed(0) : n.toFixed(1)} ${t[r]}`;
|
|
13
|
+
}
|
|
14
|
+
function t(e, t) {
|
|
15
|
+
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
16
|
+
r.href = n, r.download = t || "download", r.rel = "noopener", r.style.display = "none", document.body.appendChild(r), r.click(), r.remove(), window.setTimeout(() => URL.revokeObjectURL(n), 5e3);
|
|
17
|
+
}
|
|
18
|
+
function n(e) {
|
|
19
|
+
return e.replace(/[&<>"]/g, (e) => ({
|
|
20
|
+
"&": "&",
|
|
21
|
+
"<": "<",
|
|
22
|
+
">": ">",
|
|
23
|
+
"\"": """
|
|
24
|
+
})[e] || e);
|
|
25
|
+
}
|
|
26
|
+
function r(e) {
|
|
27
|
+
let t = document.createElement("iframe");
|
|
28
|
+
t.setAttribute("aria-hidden", "true"), t.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(t);
|
|
29
|
+
let r = t.contentDocument;
|
|
30
|
+
if (!r) throw Error("无法创建打印页面");
|
|
31
|
+
return r.open(), r.write(`<!doctype html><html><head><title>${n(e)}</title></head><body></body></html>`), r.close(), t;
|
|
32
|
+
}
|
|
33
|
+
function i(e) {
|
|
34
|
+
for (let t of Array.from(document.styleSheets)) try {
|
|
35
|
+
let n = Array.from(t.cssRules || []).map((e) => e.cssText).join("\n");
|
|
36
|
+
if (!n) continue;
|
|
37
|
+
let r = e.createElement("style");
|
|
38
|
+
r.textContent = n, e.head.appendChild(r);
|
|
39
|
+
} catch {}
|
|
40
|
+
let t = e.createElement("style");
|
|
41
|
+
t.textContent = "\n @page { margin: 12mm; }\n html, body { margin: 0; padding: 0; background: #fff; }\n body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }\n img, svg, video, canvas { max-width: 100% !important; height: auto; }\n .fv-content { position: static !important; transform: none !important; width: auto !important; height: auto !important; }\n ", e.head.appendChild(t);
|
|
42
|
+
}
|
|
43
|
+
function a(e) {
|
|
44
|
+
let t = Array.from(e.images);
|
|
45
|
+
return t.length ? Promise.all(t.map((e) => new Promise((t) => {
|
|
46
|
+
if (e.complete) {
|
|
47
|
+
t();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let n = () => t();
|
|
51
|
+
e.addEventListener("load", n, { once: !0 }), e.addEventListener("error", n, { once: !0 }), window.setTimeout(n, 5e3);
|
|
52
|
+
}))).then(() => void 0) : Promise.resolve();
|
|
53
|
+
}
|
|
54
|
+
function o(e) {
|
|
55
|
+
window.setTimeout(() => {
|
|
56
|
+
let t = e.defaultView;
|
|
57
|
+
t && (t.focus(), t.print());
|
|
58
|
+
}, 200);
|
|
59
|
+
}
|
|
60
|
+
function s(e, t = {}) {
|
|
61
|
+
let { title: n = "", resetTransform: s = !0 } = t, c = r(n), l = c.contentDocument;
|
|
62
|
+
i(l);
|
|
63
|
+
let u = e.cloneNode(!0);
|
|
64
|
+
s && (u.style.transform = "none", u.style.position = "static", u.style.left = "auto", u.style.top = "auto");
|
|
65
|
+
let d = l.createElement("div");
|
|
66
|
+
d.className = "fv-print-page", d.appendChild(u), l.body.appendChild(d), a(l).then(() => {
|
|
67
|
+
o(l), window.setTimeout(() => c.remove(), 4e3);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function c(e) {
|
|
71
|
+
let t = document.createElement("iframe");
|
|
72
|
+
t.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", t.src = e, document.body.appendChild(t);
|
|
73
|
+
let n = !1, r = () => {
|
|
74
|
+
n || (n = !0, window.setTimeout(() => {
|
|
75
|
+
try {
|
|
76
|
+
t.contentWindow?.focus(), t.contentWindow?.print();
|
|
77
|
+
} catch {
|
|
78
|
+
window.open(e, "_blank", "noopener");
|
|
79
|
+
}
|
|
80
|
+
window.setTimeout(() => t.remove(), 6e3);
|
|
81
|
+
}, 500));
|
|
82
|
+
};
|
|
83
|
+
t.addEventListener("load", r, { once: !0 }), window.setTimeout(r, 2500);
|
|
84
|
+
}
|
|
85
|
+
function l(e, t = "") {
|
|
86
|
+
let n = r(t), i = n.contentDocument, a = i.createElement("style");
|
|
87
|
+
a.textContent = "@page { margin: 0; } html, body { margin: 0; background: #fff; } img { display: block; width: 100%; }", i.head.appendChild(a);
|
|
88
|
+
let s = i.createElement("img");
|
|
89
|
+
s.src = e, i.body.appendChild(s), s.addEventListener("load", () => {
|
|
90
|
+
o(i), window.setTimeout(() => n.remove(), 4e3);
|
|
91
|
+
}, { once: !0 });
|
|
92
|
+
}
|
|
93
|
+
export { c as a, l as i, e as n, s as r, t };
|