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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +26 -10
  2. package/dist/{UnsupportedRenderer-B016ePP5.js → UnsupportedRenderer-CbQ7S46f.js} +1 -1
  3. package/dist/index-DB5StklO.js +363 -0
  4. package/dist/light-file-preview.js +1 -1
  5. package/dist/light-file-preview.umd.cjs +158 -196
  6. package/dist/standalone/light-file-preview.iife.js +178 -217
  7. package/dist/standalone/style.css +1 -1
  8. package/dist/style.css +1 -1
  9. package/dist/types/components/FilePreview.vue.d.ts +3 -3
  10. package/dist/types/constants/file.d.ts +0 -1
  11. package/dist/types/types.d.ts +1 -1
  12. package/dist/vue2/light-file-preview-vue2.js +55300 -3
  13. package/dist/vue2/light-file-preview-vue2.umd.cjs +178 -217
  14. package/package.json +1 -3
  15. package/dist/PptxRenderer-B4sDptn0.js +0 -14773
  16. package/dist/index-DX4yvG8n.js +0 -353
  17. package/dist/types/components/renderers/PptxRenderer.vue.d.ts +0 -13
  18. package/dist/vue2/DocxRenderer-BYzWAtSx.js +0 -110
  19. package/dist/vue2/PdfRenderer-2f-SRj0_.js +0 -123
  20. package/dist/vue2/PptxRenderer-B1TlLH2y.js +0 -14773
  21. package/dist/vue2/SheetRenderer-DF9A6Tqq.js +0 -940
  22. package/dist/vue2/TextRenderer-Be7RzYjF.js +0 -59
  23. package/dist/vue2/UnsupportedRenderer-CIeHYr5T.js +0 -31
  24. package/dist/vue2/_commonjs-dynamic-modules-C74YT1gS.js +0 -32
  25. package/dist/vue2/docx-preview-BV-bQyiM.js +0 -5533
  26. package/dist/vue2/marked.esm-CRmQbSOC.js +0 -1577
  27. package/dist/vue2/pdf-BiKi76Et.js +0 -15320
  28. package/dist/vue2/purify.es-CCmmh-Lt.js +0 -553
  29. package/dist/vue2/style.css +0 -1
  30. package/dist/vue2/text-Bqxn_tMI.js +0 -24
  31. package/dist/vue2/vue2-DryhXOWQ.js +0 -6296
  32. package/dist/vue2/xlsx-j9Zzywas.js +0 -24774
  33. package/public/screenshots/effect-pptx.png +0 -0
@@ -1,59 +0,0 @@
1
- import { d as g, c as f, o as h, a as k, b as n, e as a, t as p, g as B, f as w, r as c } from "./vue2-DryhXOWQ.js";
2
- import { a as M } from "./text-Bqxn_tMI.js";
3
- const C = { class: "lfp-document" }, T = {
4
- key: 0,
5
- class: "lfp-hint"
6
- }, b = ["innerHTML"], N = {
7
- key: 2,
8
- class: "lfp-code"
9
- }, H = /* @__PURE__ */ g({
10
- __name: "TextRenderer",
11
- props: {
12
- source: {},
13
- encoding: {},
14
- extension: {},
15
- maxBytes: {}
16
- },
17
- emits: ["loading", "error"],
18
- setup(i, { emit: v }) {
19
- const e = i, s = v, t = c(""), u = c(!1), d = new AbortController(), r = c(""), m = f(() => e.extension === "md"), y = f(() => e.extension === "json");
20
- async function x() {
21
- s("loading", !0);
22
- try {
23
- t.value = await M(e.source, e.encoding, e.maxBytes, d.signal);
24
- const o = typeof e.source == "string" ? t.value.length : e.source.size;
25
- if (u.value = o > e.maxBytes, y.value)
26
- try {
27
- t.value = JSON.stringify(JSON.parse(t.value), null, 2);
28
- } catch (l) {
29
- }
30
- if (m.value) {
31
- const [{ marked: l }, { default: _ }] = await Promise.all([import("./marked.esm-CRmQbSOC.js"), import("./purify.es-CCmmh-Lt.js")]);
32
- r.value = _.sanitize(l.parse(t.value));
33
- } else
34
- r.value = "";
35
- } catch (o) {
36
- s("error", o instanceof Error ? o : new Error("文本预览失败"));
37
- } finally {
38
- s("loading", !1);
39
- }
40
- }
41
- return h(() => {
42
- x();
43
- }), k(() => {
44
- d.abort();
45
- }), (o, l) => (n(), a("div", C, [
46
- u.value ? (n(), a("p", T, "文件较大,当前仅展示前 " + p(Math.round(i.maxBytes / 1024)) + " KB 内容。", 1)) : B("", !0),
47
- m.value ? (n(), a("article", {
48
- key: 1,
49
- class: "lfp-markdown",
50
- innerHTML: r.value
51
- }, null, 8, b)) : (n(), a("pre", N, [
52
- w("code", null, p(t.value), 1)
53
- ]))
54
- ]));
55
- }
56
- });
57
- export {
58
- H as default
59
- };
@@ -1,31 +0,0 @@
1
- import { d as n, b as l, e as o, f as t, t as s, u as i, v as r } from "./vue2-DryhXOWQ.js";
2
- const d = { class: "lfp-empty" }, p = { class: "lfp-hint" }, v = /* @__PURE__ */ n({
3
- __name: "UnsupportedRenderer",
4
- props: {
5
- fileName: {},
6
- src: {}
7
- },
8
- setup(a) {
9
- return (f, e) => (l(), o("div", d, [
10
- e[2] || (e[2] = t("p", null, "暂不支持当前格式的在线预览。", -1)),
11
- t("p", p, "文件名:" + s(a.fileName), 1),
12
- t("button", {
13
- class: "lfp-button lfp-icon-button",
14
- type: "button",
15
- "aria-label": "Download",
16
- title: "Download",
17
- onClick: e[0] || (e[0] = (u) => i(r)(a.src, a.fileName))
18
- }, [...e[1] || (e[1] = [
19
- t("svg", {
20
- viewBox: "0 0 24 24",
21
- "aria-hidden": "true"
22
- }, [
23
- t("path", { d: "M12 3.5a1 1 0 0 1 1 1V12l2.8-2.8a1 1 0 1 1 1.4 1.42l-4.5 4.48a1 1 0 0 1-1.4 0l-4.5-4.48a1 1 0 0 1 1.4-1.42L11 12V4.5a1 1 0 0 1 1-1Zm-7 13a1 1 0 0 1 1 1v.75c0 .41.34.75.75.75h10.5a.75.75 0 0 0 .75-.75v-.75a1 1 0 1 1 2 0v.75A2.75 2.75 0 0 1 17.25 21H6.75A2.75 2.75 0 0 1 4 18.25v-.75a1 1 0 0 1 1-1Z" })
24
- ], -1)
25
- ])])
26
- ]));
27
- }
28
- });
29
- export {
30
- v as default
31
- };
@@ -1,32 +0,0 @@
1
- var u = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
2
- function i(e) {
3
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
4
- }
5
- function a(e) {
6
- if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
7
- var r = e.default;
8
- if (typeof r == "function") {
9
- var t = function o() {
10
- return this instanceof o ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
11
- };
12
- t.prototype = r.prototype;
13
- } else t = {};
14
- return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
15
- var n = Object.getOwnPropertyDescriptor(e, o);
16
- Object.defineProperty(t, o, n.get ? n : {
17
- enumerable: !0,
18
- get: function() {
19
- return e[o];
20
- }
21
- });
22
- }), t;
23
- }
24
- function l(e) {
25
- throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
26
- }
27
- export {
28
- u as a,
29
- i as b,
30
- l as c,
31
- a as g
32
- };