basic-file-preview 1.0.1 → 1.0.2

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.
@@ -1 +1,42 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("axios"),u=require("vue-json-viewer"),c=require("./_plugin-vue_export-helper.js"),l=e.defineComponent({name:"JsonPreview",__name:"JsonPreview",props:{url:{}},setup(r){const o=r,t=e.ref({}),a=async()=>{if(!o.url)return;const n=await s.get(o.url,{headers:{"Content-Type":"application/json"},params:{_t:Date.now()}});t.value=n.data};return e.onMounted(()=>{a()}),(n,i)=>(e.openBlock(),e.createBlock(e.unref(u),{value:e.unref(t),"expand-depth":1,expanded:!1,copyable:{copyText:"复制",copiedText:"已复制"},sort:!1,boxed:!1,"preview-mode":"","show-array-index":!1,showDoubleQuotes:!1},null,8,["value"]))}}),p=c._export_sfc(l,[["__scopeId","data-v-71d7c898"]]);exports.default=p;
1
+ import { defineComponent as s, ref as p, onMounted as c, openBlock as l, createBlock as i, unref as t } from "vue";
2
+ import u from "axios";
3
+ import d from "vue-json-viewer";
4
+ import { _ as f } from "./_plugin-vue_export-helper.js";
5
+ const m = /* @__PURE__ */ s({
6
+ name: "JsonPreview",
7
+ __name: "JsonPreview",
8
+ props: {
9
+ url: {}
10
+ },
11
+ setup(r) {
12
+ const e = r, o = p({}), n = async () => {
13
+ if (!e.url) return;
14
+ const a = await u.get(e.url, {
15
+ headers: {
16
+ "Content-Type": "application/json"
17
+ },
18
+ params: { _t: Date.now() }
19
+ });
20
+ o.value = a.data;
21
+ };
22
+ return c(() => {
23
+ n();
24
+ }), (a, _) => (l(), i(t(d), {
25
+ value: t(o),
26
+ "expand-depth": 1,
27
+ expanded: !1,
28
+ copyable: {
29
+ copyText: "复制",
30
+ copiedText: "已复制"
31
+ },
32
+ sort: !1,
33
+ boxed: !1,
34
+ "preview-mode": "",
35
+ "show-array-index": !1,
36
+ showDoubleQuotes: !1
37
+ }, null, 8, ["value"]));
38
+ }
39
+ }), y = /* @__PURE__ */ f(m, [["__scopeId", "data-v-71d7c898"]]);
40
+ export {
41
+ y as default
42
+ };
@@ -1 +1,50 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("axios"),i=require("@bytemd/vue-next"),c=require("@bytemd/plugin-breaks"),l=require("@bytemd/plugin-frontmatter"),d=require("@bytemd/plugin-gemoji"),m=require("@bytemd/plugin-gfm"),p=require("@bytemd/plugin-highlight"),g=require("@bytemd/plugin-math"),q=require("@bytemd/plugin-medium-zoom"),v=require("@bytemd/plugin-mermaid"),f=e.defineComponent({name:"MarkdownPreview",__name:"MarkdownPreview",props:{url:{}},setup(o){console.log("MarkdownPreview");const t=o,a=[c(),l(),d(),m(),p(),g(),q(),v()],n=e.ref(),s=async()=>{if(!t.url)return;const r=await u.get(t.url,{headers:{"Content-Type":"application/json"},params:{_t:Date.now()}});console.log("md",r.data),n.value=r.data};return e.onMounted(()=>{s()}),(r,w)=>(e.openBlock(),e.createBlock(e.unref(i.Viewer),{style:{padding:"10px 15px"},value:n.value,plugins:a},null,8,["value"]))}});exports.default=f;
1
+ import { defineComponent as a, ref as i, onMounted as p, openBlock as s, createBlock as l, unref as f } from "vue";
2
+ import c from "axios";
3
+ import { Viewer as u } from "@bytemd/vue-next";
4
+ import d from "@bytemd/plugin-breaks";
5
+ import g from "@bytemd/plugin-frontmatter";
6
+ import w from "@bytemd/plugin-gemoji";
7
+ import v from "@bytemd/plugin-gfm";
8
+ import _ from "@bytemd/plugin-highlight";
9
+ import h from "@bytemd/plugin-math";
10
+ import k from "@bytemd/plugin-medium-zoom";
11
+ import x from "@bytemd/plugin-mermaid";
12
+ const z = /* @__PURE__ */ a({
13
+ name: "MarkdownPreview",
14
+ __name: "MarkdownPreview",
15
+ props: {
16
+ url: {}
17
+ },
18
+ setup(t) {
19
+ console.log("MarkdownPreview");
20
+ const r = t, m = [
21
+ d(),
22
+ g(),
23
+ w(),
24
+ v(),
25
+ _(),
26
+ h(),
27
+ k(),
28
+ x()
29
+ ], e = i(), n = async () => {
30
+ if (!r.url) return;
31
+ const o = await c.get(r.url, {
32
+ headers: {
33
+ "Content-Type": "application/json"
34
+ },
35
+ params: { _t: Date.now() }
36
+ });
37
+ console.log("md", o.data), e.value = o.data;
38
+ };
39
+ return p(() => {
40
+ n();
41
+ }), (o, M) => (s(), l(f(u), {
42
+ style: { padding: "10px 15px" },
43
+ value: e.value,
44
+ plugins: m
45
+ }, null, 8, ["value"]));
46
+ }
47
+ });
48
+ export {
49
+ z as default
50
+ };
@@ -1 +1,42 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("vue3-pdf-app"),a=require("./_plugin-vue_export-helper.js"),f={class:"h-full"},i=e.defineComponent({name:"PdfPreview",__name:"PdfPreview",props:{url:{}},setup(t){const o={toolbar:{toolbarViewerRight:{presentationMode:!1,openFile:!1,print:!1,download:!1,viewBookmark:!1}}};function n(){localStorage.removeItem("pdfjs.history")}return(p,r)=>(e.openBlock(),e.createElementBlock("div",f,[r[0]||(r[0]=e.createElementVNode("link",{rel:"resource",type:"application/l10n",href:"/pdf/viewer.properties"},null,-1)),e.createVNode(e.unref(l),{ref:"pdfRef",pdf:t.url,config:o,onAfterCreated:n},null,8,["pdf"])]))}}),s=a._export_sfc(i,[["__scopeId","data-v-23ac8401"]]);exports.default=s;
1
+ import { defineComponent as f, openBlock as n, createElementBlock as a, createElementVNode as l, createVNode as p, unref as i } from "vue";
2
+ import s from "vue3-pdf-app";
3
+ import { _ as d } from "./_plugin-vue_export-helper.js";
4
+ const c = { class: "h-full" }, m = /* @__PURE__ */ f({
5
+ name: "PdfPreview",
6
+ __name: "PdfPreview",
7
+ props: {
8
+ url: {}
9
+ },
10
+ setup(o) {
11
+ const r = {
12
+ toolbar: {
13
+ toolbarViewerRight: {
14
+ presentationMode: !1,
15
+ openFile: !1,
16
+ print: !1,
17
+ download: !1,
18
+ viewBookmark: !1
19
+ }
20
+ }
21
+ };
22
+ function t() {
23
+ localStorage.removeItem("pdfjs.history");
24
+ }
25
+ return (u, e) => (n(), a("div", c, [
26
+ e[0] || (e[0] = l("link", {
27
+ rel: "resource",
28
+ type: "application/l10n",
29
+ href: "/pdf/viewer.properties"
30
+ }, null, -1)),
31
+ p(i(s), {
32
+ ref: "pdfRef",
33
+ pdf: o.url,
34
+ config: r,
35
+ onAfterCreated: t
36
+ }, null, 8, ["pdf"])
37
+ ]));
38
+ }
39
+ }), P = /* @__PURE__ */ d(m, [["__scopeId", "data-v-23ac8401"]]);
40
+ export {
41
+ P as default
42
+ };
@@ -1 +1,203 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index.js"),s=require("vue"),P=require("@vue-office/pptx"),B=require("./_plugin-vue_export-helper.js");function I(e,n){let t;const r=s.ref(!1),o=s.reactive({...e,originalPosition:"",originalOverflow:"",visible:!1});function l(a){o.text=a}function d(){const a=o.parent,p=g.ns;if(!a.vLoadingAddClassList){let u=a.getAttribute("loading-number");u=Number.parseInt(u)-1,u?a.setAttribute("loading-number",u.toString()):(i.removeClass(a,p.bm("parent","relative")),a.removeAttribute("loading-number")),i.removeClass(a,p.bm("parent","hidden"))}f(),y.unmount()}function f(){g.$el?.parentNode?.removeChild(g.$el)}function b(){e.beforeClose&&!e.beforeClose()||(r.value=!0,clearTimeout(t),t=setTimeout(c,400),o.visible=!1,e.closed?.())}function c(){if(!r.value)return;const a=o.parent;r.value=!1,a.vLoadingAddClassList=void 0,d()}const y=s.createApp(s.defineComponent({name:"ElLoading",setup(a,{expose:p}){const{ns:u,zIndex:A}=i.useGlobalComponentSettings("loading");return p({ns:u,zIndex:A}),()=>{const k=o.spinner||o.svg,L=s.h("svg",{class:"circular",viewBox:o.svgViewBox?o.svgViewBox:"0 0 50 50",...k?{innerHTML:k}:{}},[s.h("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})]),S=o.text?s.h("p",{class:u.b("text")},[o.text]):void 0;return s.h(s.Transition,{name:u.b("fade"),onAfterLeave:c},{default:s.withCtx(()=>[s.withDirectives(s.createVNode("div",{style:{backgroundColor:o.background||""},class:[u.b("mask"),o.customClass,u.is("fullscreen",o.fullscreen)]},[s.h("div",{class:u.b("spinner")},[L,S])]),[[s.vShow,o.visible]])])})}}}));Object.assign(y._context,n??{});const g=y.mount(document.createElement("div"));return{...s.toRefs(o),setText:l,removeElLoadingChild:f,close:b,handleAfterLeave:c,vm:g,get $el(){return g.$el}}}let x;const C=function(e={},n){if(!i.isClient)return;const t=T(e);if(t.fullscreen&&x)return x;const r=I({...t,closed:()=>{t.closed?.(),t.fullscreen&&(x=void 0)}},n??C._context);V(t,t.parent,r),_(t,t.parent,r),t.parent.vLoadingAddClassList=()=>_(t,t.parent,r);let o=t.parent.getAttribute("loading-number");return o?o=`${Number.parseInt(o)+1}`:o="1",t.parent.setAttribute("loading-number",o),t.parent.appendChild(r.$el),s.nextTick(()=>r.visible.value=t.visible),t.fullscreen&&(x=r),r},T=e=>{let n;return i.isString(e.target)?n=document.querySelector(e.target)??document.body:n=e.target||document.body,{parent:n===document.body||e.body?document.body:n,background:e.background||"",svg:e.svg||"",svgViewBox:e.svgViewBox||"",spinner:e.spinner||!1,text:e.text||"",fullscreen:n===document.body&&(e.fullscreen??!0),lock:e.lock??!1,customClass:e.customClass||"",visible:e.visible??!0,beforeClose:e.beforeClose,closed:e.closed,target:n}},V=async(e,n,t)=>{const{nextZIndex:r}=t.vm.zIndex||t.vm._.exposed.zIndex,o={};if(e.fullscreen)t.originalPosition.value=i.getStyle(document.body,"position"),t.originalOverflow.value=i.getStyle(document.body,"overflow"),o.zIndex=r();else if(e.parent===document.body){t.originalPosition.value=i.getStyle(document.body,"position"),await s.nextTick();for(const l of["top","left"]){const d=l==="top"?"scrollTop":"scrollLeft";o[l]=`${e.target.getBoundingClientRect()[l]+document.body[d]+document.documentElement[d]-Number.parseInt(i.getStyle(document.body,`margin-${l}`),10)}px`}for(const l of["height","width"])o[l]=`${e.target.getBoundingClientRect()[l]}px`}else t.originalPosition.value=i.getStyle(n,"position");for(const[l,d]of Object.entries(o))t.$el.style[l]=d},_=(e,n,t)=>{const r=t.vm.ns||t.vm._.exposed.ns;["absolute","fixed","sticky"].includes(t.originalPosition.value)?i.removeClass(n,r.bm("parent","relative")):i.addClass(n,r.bm("parent","relative")),e.fullscreen&&e.lock?i.addClass(n,r.bm("parent","hidden")):i.removeClass(n,r.bm("parent","hidden"))};C._context=null;const m=Symbol("ElLoading"),v=e=>`element-loading-${i.hyphenate(e)}`,w=(e,n)=>{const t=n.instance,r=c=>i.isObject(n.value)?n.value[c]:void 0,o=c=>s.ref(i.isString(c)&&t?.[c]||c),l=c=>o(r(c)||e.getAttribute(v(c))),d=r("fullscreen")??n.modifiers.fullscreen,f={text:l("text"),svg:l("svg"),svgViewBox:l("svgViewBox"),spinner:l("spinner"),background:l("background"),customClass:l("customClass"),fullscreen:d,target:r("target")??(d?void 0:e),body:r("body")??n.modifiers.body,lock:r("lock")??n.modifiers.lock},b=C(f);b._context=h._context,e[m]={options:f,instance:b}},N=(e,n)=>{for(const t of Object.keys(e))s.isRef(e[t])&&(e[t].value=n[t])},h={mounted(e,n){n.value&&w(e,n)},updated(e,n){const t=e[m];if(!n.value){t?.instance.close(),e[m]=null;return}t?N(t.options,i.isObject(n.value)?n.value:{text:e.getAttribute(v("text")),svg:e.getAttribute(v("svg")),svgViewBox:e.getAttribute(v("svgViewBox")),spinner:e.getAttribute(v("spinner")),background:e.getAttribute(v("background")),customClass:e.getAttribute(v("customClass"))}):w(e,n)},unmounted(e){e[m]?.instance.close(),e[m]=null}};h._context=null;const $=s.defineComponent({name:"PptPreview",__name:"PptPreview",props:{url:{}},setup(e){const n=s.ref(!0),t=()=>{n.value=!1};return(r,o)=>{const l=h;return e.url?s.withDirectives((s.openBlock(),s.createBlock(s.unref(P),{key:0,src:e.url,class:"vue-office-pptx",onRendered:t},null,8,["src"])),[[l,s.unref(n)]]):s.createCommentVNode("",!0)}}}),O=B._export_sfc($,[["__scopeId","data-v-ad74f2de"]]);exports.default=O;
1
+ import { u as R, r as y, i as j, a as I, g as v, b as A, c as N, h as z } from "./index.js";
2
+ import { ref as k, reactive as q, createApp as D, defineComponent as S, h as m, Transition as F, withCtx as G, withDirectives as V, createVNode as H, vShow as K, toRefs as M, nextTick as $, isRef as Y, openBlock as Z, createBlock as J, unref as L, createCommentVNode as Q } from "vue";
3
+ import U from "@vue-office/pptx";
4
+ import { _ as W } from "./_plugin-vue_export-helper.js";
5
+ function X(e, n) {
6
+ let t;
7
+ const s = k(!1), o = q({
8
+ ...e,
9
+ originalPosition: "",
10
+ originalOverflow: "",
11
+ visible: !1
12
+ });
13
+ function r(a) {
14
+ o.text = a;
15
+ }
16
+ function i() {
17
+ const a = o.parent, p = f.ns;
18
+ if (!a.vLoadingAddClassList) {
19
+ let c = a.getAttribute("loading-number");
20
+ c = Number.parseInt(c) - 1, c ? a.setAttribute("loading-number", c.toString()) : (y(a, p.bm("parent", "relative")), a.removeAttribute("loading-number")), y(a, p.bm("parent", "hidden"));
21
+ }
22
+ d(), C.unmount();
23
+ }
24
+ function d() {
25
+ f.$el?.parentNode?.removeChild(f.$el);
26
+ }
27
+ function b() {
28
+ e.beforeClose && !e.beforeClose() || (s.value = !0, clearTimeout(t), t = setTimeout(l, 400), o.visible = !1, e.closed?.());
29
+ }
30
+ function l() {
31
+ if (!s.value) return;
32
+ const a = o.parent;
33
+ s.value = !1, a.vLoadingAddClassList = void 0, i();
34
+ }
35
+ const C = D(S({
36
+ name: "ElLoading",
37
+ setup(a, { expose: p }) {
38
+ const { ns: c, zIndex: T } = R("loading");
39
+ return p({
40
+ ns: c,
41
+ zIndex: T
42
+ }), () => {
43
+ const w = o.spinner || o.svg, E = m("svg", {
44
+ class: "circular",
45
+ viewBox: o.svgViewBox ? o.svgViewBox : "0 0 50 50",
46
+ ...w ? { innerHTML: w } : {}
47
+ }, [m("circle", {
48
+ class: "path",
49
+ cx: "25",
50
+ cy: "25",
51
+ r: "20",
52
+ fill: "none"
53
+ })]), O = o.text ? m("p", { class: c.b("text") }, [o.text]) : void 0;
54
+ return m(F, {
55
+ name: c.b("fade"),
56
+ onAfterLeave: l
57
+ }, { default: G(() => [V(H("div", {
58
+ style: { backgroundColor: o.background || "" },
59
+ class: [
60
+ c.b("mask"),
61
+ o.customClass,
62
+ c.is("fullscreen", o.fullscreen)
63
+ ]
64
+ }, [m("div", { class: c.b("spinner") }, [E, O])]), [[K, o.visible]])]) });
65
+ };
66
+ }
67
+ }));
68
+ Object.assign(C._context, n ?? {});
69
+ const f = C.mount(document.createElement("div"));
70
+ return {
71
+ ...M(o),
72
+ setText: r,
73
+ removeElLoadingChild: d,
74
+ close: b,
75
+ handleAfterLeave: l,
76
+ vm: f,
77
+ get $el() {
78
+ return f.$el;
79
+ }
80
+ };
81
+ }
82
+ let x;
83
+ const _ = function(e = {}, n) {
84
+ if (!j) return;
85
+ const t = ee(e);
86
+ if (t.fullscreen && x) return x;
87
+ const s = X({
88
+ ...t,
89
+ closed: () => {
90
+ t.closed?.(), t.fullscreen && (x = void 0);
91
+ }
92
+ }, n ?? _._context);
93
+ te(t, t.parent, s), B(t, t.parent, s), t.parent.vLoadingAddClassList = () => B(t, t.parent, s);
94
+ let o = t.parent.getAttribute("loading-number");
95
+ return o ? o = `${Number.parseInt(o) + 1}` : o = "1", t.parent.setAttribute("loading-number", o), t.parent.appendChild(s.$el), $(() => s.visible.value = t.visible), t.fullscreen && (x = s), s;
96
+ }, ee = (e) => {
97
+ let n;
98
+ return I(e.target) ? n = document.querySelector(e.target) ?? document.body : n = e.target || document.body, {
99
+ parent: n === document.body || e.body ? document.body : n,
100
+ background: e.background || "",
101
+ svg: e.svg || "",
102
+ svgViewBox: e.svgViewBox || "",
103
+ spinner: e.spinner || !1,
104
+ text: e.text || "",
105
+ fullscreen: n === document.body && (e.fullscreen ?? !0),
106
+ lock: e.lock ?? !1,
107
+ customClass: e.customClass || "",
108
+ visible: e.visible ?? !0,
109
+ beforeClose: e.beforeClose,
110
+ closed: e.closed,
111
+ target: n
112
+ };
113
+ }, te = async (e, n, t) => {
114
+ const { nextZIndex: s } = t.vm.zIndex || t.vm._.exposed.zIndex, o = {};
115
+ if (e.fullscreen)
116
+ t.originalPosition.value = v(document.body, "position"), t.originalOverflow.value = v(document.body, "overflow"), o.zIndex = s();
117
+ else if (e.parent === document.body) {
118
+ t.originalPosition.value = v(document.body, "position"), await $();
119
+ for (const r of ["top", "left"]) {
120
+ const i = r === "top" ? "scrollTop" : "scrollLeft";
121
+ o[r] = `${e.target.getBoundingClientRect()[r] + document.body[i] + document.documentElement[i] - Number.parseInt(v(document.body, `margin-${r}`), 10)}px`;
122
+ }
123
+ for (const r of ["height", "width"]) o[r] = `${e.target.getBoundingClientRect()[r]}px`;
124
+ } else t.originalPosition.value = v(n, "position");
125
+ for (const [r, i] of Object.entries(o)) t.$el.style[r] = i;
126
+ }, B = (e, n, t) => {
127
+ const s = t.vm.ns || t.vm._.exposed.ns;
128
+ [
129
+ "absolute",
130
+ "fixed",
131
+ "sticky"
132
+ ].includes(t.originalPosition.value) ? y(n, s.bm("parent", "relative")) : A(n, s.bm("parent", "relative")), e.fullscreen && e.lock ? A(n, s.bm("parent", "hidden")) : y(n, s.bm("parent", "hidden"));
133
+ };
134
+ _._context = null;
135
+ const g = /* @__PURE__ */ Symbol("ElLoading"), u = (e) => `element-loading-${z(e)}`, P = (e, n) => {
136
+ const t = n.instance, s = (l) => N(n.value) ? n.value[l] : void 0, o = (l) => k(I(l) && t?.[l] || l), r = (l) => o(s(l) || e.getAttribute(u(l))), i = s("fullscreen") ?? n.modifiers.fullscreen, d = {
137
+ text: r("text"),
138
+ svg: r("svg"),
139
+ svgViewBox: r("svgViewBox"),
140
+ spinner: r("spinner"),
141
+ background: r("background"),
142
+ customClass: r("customClass"),
143
+ fullscreen: i,
144
+ target: s("target") ?? (i ? void 0 : e),
145
+ body: s("body") ?? n.modifiers.body,
146
+ lock: s("lock") ?? n.modifiers.lock
147
+ }, b = _(d);
148
+ b._context = h._context, e[g] = {
149
+ options: d,
150
+ instance: b
151
+ };
152
+ }, ne = (e, n) => {
153
+ for (const t of Object.keys(e)) Y(e[t]) && (e[t].value = n[t]);
154
+ }, h = {
155
+ mounted(e, n) {
156
+ n.value && P(e, n);
157
+ },
158
+ updated(e, n) {
159
+ const t = e[g];
160
+ if (!n.value) {
161
+ t?.instance.close(), e[g] = null;
162
+ return;
163
+ }
164
+ t ? ne(t.options, N(n.value) ? n.value : {
165
+ text: e.getAttribute(u("text")),
166
+ svg: e.getAttribute(u("svg")),
167
+ svgViewBox: e.getAttribute(u("svgViewBox")),
168
+ spinner: e.getAttribute(u("spinner")),
169
+ background: e.getAttribute(u("background")),
170
+ customClass: e.getAttribute(u("customClass"))
171
+ }) : P(e, n);
172
+ },
173
+ unmounted(e) {
174
+ e[g]?.instance.close(), e[g] = null;
175
+ }
176
+ };
177
+ h._context = null;
178
+ const oe = /* @__PURE__ */ S({
179
+ name: "PptPreview",
180
+ __name: "PptPreview",
181
+ props: {
182
+ url: {}
183
+ },
184
+ setup(e) {
185
+ const n = k(!0), t = () => {
186
+ n.value = !1;
187
+ };
188
+ return (s, o) => {
189
+ const r = h;
190
+ return e.url ? V((Z(), J(L(U), {
191
+ key: 0,
192
+ src: e.url,
193
+ class: "vue-office-pptx",
194
+ onRendered: t
195
+ }, null, 8, ["src"])), [
196
+ [r, L(n)]
197
+ ]) : Q("", !0);
198
+ };
199
+ }
200
+ }), ce = /* @__PURE__ */ W(oe, [["__scopeId", "data-v-ad74f2de"]]);
201
+ export {
202
+ ce as default
203
+ };
@@ -1,2 +1,39 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),f=require("axios"),i={class:"flex justify-center min-h-full h-full bg-gray! lh-loose box-border overflow-auto p-20px"},p=e.defineComponent({__name:"TxtPreview",props:{url:{}},setup(s){const o=s,a=e.ref(null),n=e.ref("");return e.onMounted(()=>{o.url&&f.get(o.url,{responseType:"arraybuffer"}).then(async r=>{const c=["UTF-8","GBK","GB18030"];let t="";for(const u of c)try{if(t=new TextDecoder(u).decode(r.data),![/�/,/[\uD800-\uDBFF][\uDC00-\uDFFF]/,/[\uFFFD\uFFFE\uFFFF]/].some(d=>d.test(t)))break}catch{continue}n.value=t})}),(r,c)=>(e.openBlock(),e.createElementBlock("div",i,[e.createElementVNode("pre",{ref_key:"contentRef",ref:a,class:"w-[70%] h-fit mt-30px mb-0 bg-white! p-10px whitespace-pre-wrap break-words"}," "+e.toDisplayString(e.unref(n))+`
2
- `,513)]))}});exports.default=p;
1
+ import { defineComponent as p, ref as c, onMounted as d, openBlock as i, createElementBlock as F, createElementVNode as g, toDisplayString as m, unref as b } from "vue";
2
+ import h from "axios";
3
+ const x = { class: "flex justify-center min-h-full h-full bg-gray! lh-loose box-border overflow-auto p-20px" }, D = /* @__PURE__ */ p({
4
+ __name: "TxtPreview",
5
+ props: {
6
+ url: {}
7
+ },
8
+ setup(s) {
9
+ const t = s, a = c(null), o = c("");
10
+ return d(() => {
11
+ t.url && h.get(t.url, { responseType: "arraybuffer" }).then(async (n) => {
12
+ const r = ["UTF-8", "GBK", "GB18030"];
13
+ let e = "";
14
+ for (const l of r)
15
+ try {
16
+ if (e = new TextDecoder(l).decode(n.data), ![
17
+ /�/,
18
+ /[\uD800-\uDBFF][\uDC00-\uDFFF]/,
19
+ /[\uFFFD\uFFFE\uFFFF]/
20
+ ].some((f) => f.test(e)))
21
+ break;
22
+ } catch {
23
+ continue;
24
+ }
25
+ o.value = e;
26
+ });
27
+ }), (n, r) => (i(), F("div", x, [
28
+ g("pre", {
29
+ ref_key: "contentRef",
30
+ ref: a,
31
+ class: "w-[70%] h-fit mt-30px mb-0 bg-white! p-10px whitespace-pre-wrap break-words"
32
+ }, " " + m(b(o)) + `
33
+ `, 513)
34
+ ]));
35
+ }
36
+ });
37
+ export {
38
+ D as default
39
+ };
@@ -1 +1,9 @@
1
- "use strict";const e=(t,o)=>{const c=t.__vccOpts||t;for(const[r,s]of o)c[r]=s;return c};exports._export_sfc=e;
1
+ const s = (t, r) => {
2
+ const o = t.__vccOpts || t;
3
+ for (const [c, e] of r)
4
+ o[c] = e;
5
+ return o;
6
+ };
7
+ export {
8
+ s as _
9
+ };