markstream-vue 0.0.3-beta.6 → 0.0.3-beta.7
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/dist/Tooltip.js +1 -0
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +132 -91
- package/dist/index.js +1 -87
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +0 -0
- package/dist/workers/katexRenderer.worker.js +1 -45
- package/dist/workers/mermaidParser.worker.js +1 -92
- package/package.json +3 -3
- package/dist/exports-CVYl7bes.js +0 -5352
- package/dist/exports-ISf5W5H7.cjs +0 -246
- package/dist/index-B90_xyRN.js +0 -122
- package/dist/index-BOwgCLNK.cjs +0 -22
- package/dist/index-Bg9riGZT.js +0 -113
- package/dist/index-Bjfg9_i9.cjs +0 -1
- package/dist/index-BqQOMeNc.cjs +0 -1
- package/dist/index-CpUcwcBM.js +0 -976
- package/dist/index.cjs +0 -1
package/dist/index-B90_xyRN.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
var w = (d, n, r) => new Promise((a, s) => {
|
|
2
|
-
var f = (e) => {
|
|
3
|
-
try {
|
|
4
|
-
o(r.next(e));
|
|
5
|
-
} catch (m) {
|
|
6
|
-
s(m);
|
|
7
|
-
}
|
|
8
|
-
}, c = (e) => {
|
|
9
|
-
try {
|
|
10
|
-
o(r.throw(e));
|
|
11
|
-
} catch (m) {
|
|
12
|
-
s(m);
|
|
13
|
-
}
|
|
14
|
-
}, o = (e) => e.done ? a(e.value) : Promise.resolve(e.value).then(f, c);
|
|
15
|
-
o((r = r.apply(d, n)).next());
|
|
16
|
-
});
|
|
17
|
-
import { defineComponent as x, ref as E, watch as O, onMounted as y, onBeforeUnmount as B, createElementBlock as M, openBlock as C, withDirectives as K, createBlock as b, createCommentVNode as L, createElementVNode as _, vShow as W, Transition as D, withCtx as N, renderSlot as S } from "vue";
|
|
18
|
-
import { a as V, e as A, f as U, i as X, W as F, _ as P } from "./exports-CVYl7bes.js";
|
|
19
|
-
const Y = {
|
|
20
|
-
class: "math-inline__loading",
|
|
21
|
-
role: "status",
|
|
22
|
-
"aria-live": "polite"
|
|
23
|
-
}, $ = /* @__PURE__ */ x({
|
|
24
|
-
__name: "MathInlineNode",
|
|
25
|
-
props: {
|
|
26
|
-
node: {}
|
|
27
|
-
},
|
|
28
|
-
setup(d) {
|
|
29
|
-
const n = d, r = E(null), a = E(null);
|
|
30
|
-
let s = !1, f = 0, c = !1, o = null;
|
|
31
|
-
const e = E(!0), m = V();
|
|
32
|
-
let l = null;
|
|
33
|
-
function R() {
|
|
34
|
-
return w(this, null, function* () {
|
|
35
|
-
if (!n.node.content || !a.value || c)
|
|
36
|
-
return;
|
|
37
|
-
o && (o.abort(), o = null);
|
|
38
|
-
const i = ++f, u = new AbortController();
|
|
39
|
-
if (o = u, !s)
|
|
40
|
-
try {
|
|
41
|
-
!l && r.value && (l = m(r.value)), yield l == null ? void 0 : l.whenVisible;
|
|
42
|
-
} catch (t) {
|
|
43
|
-
}
|
|
44
|
-
A(n.node.content, !1, {
|
|
45
|
-
// Inline math should not wait on worker slots; fallback to sync render immediately
|
|
46
|
-
timeout: 1500,
|
|
47
|
-
waitTimeout: 0,
|
|
48
|
-
maxRetries: 0,
|
|
49
|
-
signal: u.signal
|
|
50
|
-
}).then((t) => {
|
|
51
|
-
c || i !== f || a.value && (a.value.innerHTML = t, e.value = !1, s = !0);
|
|
52
|
-
}).catch((t) => w(null, null, function* () {
|
|
53
|
-
if (c || i !== f || !a.value)
|
|
54
|
-
return;
|
|
55
|
-
const p = (t == null ? void 0 : t.code) || (t == null ? void 0 : t.name), k = p === "WORKER_INIT_ERROR" || (t == null ? void 0 : t.fallbackToRenderer), I = p === F || p === "WORKER_TIMEOUT", h = p === "KATEX_DISABLED";
|
|
56
|
-
if (k || I) {
|
|
57
|
-
const T = yield U();
|
|
58
|
-
if (T) {
|
|
59
|
-
try {
|
|
60
|
-
const v = T.renderToString(n.node.content, { throwOnError: n.node.loading, displayMode: !1 });
|
|
61
|
-
e.value = !1, a.value.innerHTML = v, s = !0, X(n.node.content, !1, v);
|
|
62
|
-
} catch (v) {
|
|
63
|
-
}
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (h) {
|
|
68
|
-
e.value = !1, a.value.textContent = n.node.raw;
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
s || (e.value = !h), n.node.loading ? h && (a.value.textContent = n.node.raw) : (e.value = !1, a.value.textContent = n.node.raw);
|
|
72
|
-
}));
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return O(
|
|
76
|
-
() => n.node.content,
|
|
77
|
-
() => {
|
|
78
|
-
R();
|
|
79
|
-
}
|
|
80
|
-
), y(() => {
|
|
81
|
-
R();
|
|
82
|
-
}), B(() => {
|
|
83
|
-
var i;
|
|
84
|
-
c = !0, o && (o.abort(), o = null), (i = l == null ? void 0 : l.destroy) == null || i.call(l), l = null;
|
|
85
|
-
}), (i, u) => (C(), M("span", {
|
|
86
|
-
ref_key: "containerEl",
|
|
87
|
-
ref: r,
|
|
88
|
-
class: "math-inline-wrapper"
|
|
89
|
-
}, [
|
|
90
|
-
K(_("span", {
|
|
91
|
-
ref_key: "mathElement",
|
|
92
|
-
ref: a,
|
|
93
|
-
class: "math-inline"
|
|
94
|
-
}, null, 512), [
|
|
95
|
-
[W, !e.value]
|
|
96
|
-
]),
|
|
97
|
-
e.value ? (C(), b(D, {
|
|
98
|
-
key: 0,
|
|
99
|
-
name: "table-node-fade"
|
|
100
|
-
}, {
|
|
101
|
-
default: N(() => [
|
|
102
|
-
_("span", Y, [
|
|
103
|
-
S(i.$slots, "loading", { isLoading: e.value }, () => [
|
|
104
|
-
u[0] || (u[0] = _("span", {
|
|
105
|
-
class: "math-inline__spinner animate-spin",
|
|
106
|
-
"aria-hidden": "true"
|
|
107
|
-
}, null, -1)),
|
|
108
|
-
u[1] || (u[1] = _("span", { class: "sr-only" }, "Loading", -1))
|
|
109
|
-
], !0)
|
|
110
|
-
])
|
|
111
|
-
]),
|
|
112
|
-
_: 3
|
|
113
|
-
})) : L("", !0)
|
|
114
|
-
], 512));
|
|
115
|
-
}
|
|
116
|
-
}), g = /* @__PURE__ */ P($, [["__scopeId", "data-v-fbd3ae11"]]);
|
|
117
|
-
g.install = (d) => {
|
|
118
|
-
d.component(g.__name, g);
|
|
119
|
-
};
|
|
120
|
-
export {
|
|
121
|
-
g as default
|
|
122
|
-
};
|
package/dist/index-BOwgCLNK.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";var dt=Object.defineProperty,ft=Object.defineProperties;var mt=Object.getOwnPropertyDescriptors;var Te=Object.getOwnPropertySymbols;var vt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var Pe=(f,s,r)=>s in f?dt(f,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):f[s]=r,he=(f,s)=>{for(var r in s||(s={}))vt.call(s,r)&&Pe(f,r,s[r]);if(Te)for(var r of Te(s))ht.call(s,r)&&Pe(f,r,s[r]);return f},pe=(f,s)=>ft(f,mt(s));var $=(f,s,r)=>new Promise((R,z)=>{var F=x=>{try{T(r.next(x))}catch(u){z(u)}},w=x=>{try{T(r.throw(x))}catch(u){z(u)}},T=x=>x.done?R(x.value):Promise.resolve(x.value).then(F,w);T((r=r.apply(f,s)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),g=require("./exports-ISf5W5H7.cjs"),pt={class:"html-preview-frame__header"},gt={class:"html-preview-frame__title"},wt={class:"html-preview-frame__label"},yt=["srcdoc"],kt=t.defineComponent({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(f){const s=f,{t:r}=g.useSafeI18n(),R=t.computed(()=>{const F=s.code||"",w=F.trim().toLowerCase();if(w.startsWith("<!doctype")||w.startsWith("<html")||w.startsWith("<body"))return F;const T=s.isDark?"#020617":"#ffffff",x=s.isDark?"#e5e7eb":"#020617";return`<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<style>
|
|
7
|
-
html, body {
|
|
8
|
-
margin: 0;
|
|
9
|
-
padding: 0;
|
|
10
|
-
height: 100%;
|
|
11
|
-
background-color: ${T};
|
|
12
|
-
color: ${x};
|
|
13
|
-
}
|
|
14
|
-
body {
|
|
15
|
-
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
</head>
|
|
19
|
-
<body>
|
|
20
|
-
${F}
|
|
21
|
-
</body>
|
|
22
|
-
</html>`});function z(F){var w;(F.key==="Escape"||F.key==="Esc")&&((w=s.onClose)==null||w.call(s))}return t.onMounted(()=>{typeof window!="undefined"&&window.addEventListener("keydown",z)}),t.onUnmounted(()=>{typeof window!="undefined"&&window.removeEventListener("keydown",z)}),(F,w)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:t.normalizeClass(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":s.isDark}]),onClick:w[2]||(w[2]=T=>{var x;return(x=s.onClose)==null?void 0:x.call(s)})},[t.createElementVNode("div",{class:t.normalizeClass(["html-preview-frame",{"html-preview-frame--dark":s.isDark}]),onClick:w[1]||(w[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",pt,[t.createElementVNode("div",gt,[w[3]||(w[3]=t.createElementVNode("span",{class:"html-preview-frame__dot"},null,-1)),t.createElementVNode("span",wt,t.toDisplayString(s.title||t.unref(r)("common.preview")||"Preview"),1)]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["html-preview-frame__close",{"html-preview-frame__close--dark":s.isDark}]),onClick:w[0]||(w[0]=T=>{var x;return(x=s.onClose)==null?void 0:x.call(s)})}," × ",2)]),t.createElementVNode("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:R.value},null,8,yt)],2)],2)]))}}),xt=g._export_sfc(kt,[["__scopeId","data-v-3cf0ed56"]]),bt={key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},Et={class:"flex items-center space-x-2 flex-1 overflow-hidden"},Ct=["innerHTML"],Mt={class:"text-sm font-medium font-mono truncate"},Bt={class:"flex items-center space-x-2"},Nt=["aria-pressed"],St=["disabled"],Vt=["disabled"],Ft=["disabled"],Tt=["aria-label"],Pt={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Ht={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Lt=["aria-pressed"],Dt={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Ot={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},$t=["aria-label"],zt={class:"code-loading-placeholder"},It={class:"sr-only","aria-live":"polite",role:"status"},He="__markstreamMonacoPassiveTouch__",Le=10,De=36,Oe=1,$e=0,ze=1.5,te=1,_t=t.defineComponent({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},customId:{}},emits:["previewCode","copy"],setup(f,{emit:s}){var Me;const r=f,R=s;typeof window!="undefined"&&z();function z(){var o;try{const e=window;if(e[He])return;const n=(o=window.Element)==null?void 0:o.prototype,i=n==null?void 0:n.addEventListener;if(!n||!i)return;n.addEventListener=function(a,h,v){return a==="touchstart"&&F(this,v)?i.call(this,a,h,w(v)):i.call(this,a,h,v)},e[He]=!0}catch(e){}}function F(o,e){if(!o)return!1;const n=o;return!(typeof n.closest!="function"||!n.closest(".monaco-editor, .monaco-diff-editor")||e&&typeof e=="object"&&"passive"in e)}function w(o){return o==null?{passive:!0}:typeof o=="boolean"?{capture:o,passive:!0}:typeof o=="object"?"passive"in o?o:pe(he({},o),{passive:!0}):{passive:!0}}const T=t.getCurrentInstance(),x=t.computed(()=>{const o=T==null?void 0:T.vnode.props;return!!(o&&(o.onPreviewCode||o.onPreviewCode))}),{t:u}=g.useSafeI18n(),b=t.ref(null),ne=t.ref(null),A=t.ref(!1),P=t.ref(g.normalizeLanguageIdentifier(r.node.language)),Y=t.computed(()=>g.resolveMonacoLanguageId(P.value)),C=t.ref(!1),M=t.ref(!1),X=t.ref(!1),ge=t.ref(!1),I=t.ref(null);let ie=0;const Ie=g.useViewportPriority(),W=t.ref(null),D=t.ref(typeof window=="undefined");typeof window!="undefined"&&t.watch(()=>ne.value,o=>{var n;if((n=W.value)==null||n.destroy(),W.value=null,!o){D.value=!1;return}const e=Ie(o,{rootMargin:"400px"});W.value=e,D.value=e.isVisible.value,e.whenVisible.then(()=>{D.value=!0})},{immediate:!0}),t.onBeforeUnmount(()=>{var o;(o=W.value)==null||o.destroy(),W.value=null});let O=null,G=null,re=()=>{},le=()=>{},K=()=>null,L=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),H=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),J=()=>{},ae=()=>{},q=null,we=()=>{var o;return String((o=r.node.language)!=null?o:"plaintext")},se=()=>$(null,null,function*(){});const N=t.computed(()=>r.node.diff),ce=t.ref(!1),Q=t.ref(!1);typeof window!="undefined"&&$(null,null,function*(){try{const o=yield g.getUseMonaco();if(!o){ce.value=!0;return}const e=o.useMonaco,n=o.detectLanguage;if(typeof n=="function"&&(we=n),typeof e=="function"){const i=Ce();if(i&&r.themes&&Array.isArray(r.themes)&&!r.themes.includes(i))throw new Error("Preferred theme not in provided themes array");const l=e(pe(he({wordWrap:"on",wrappingIndent:"same",themes:r.themes,theme:i},r.monacoOptions||{}),{onThemeChange(){We()}}));O=l.createEditor||O,G=l.createDiffEditor||G,re=l.updateCode||re,le=l.updateDiff||le,K=l.getEditor||K,L=l.getEditorView||L,H=l.getDiffEditorView||H,J=l.cleanupEditor||J,ae=l.safeClean||l.cleanupEditor||ae,se=l.setTheme||se,ge.value=!0,b.value&&(yield me(b.value))}}catch(o){ce.value=!0}});const S=t.ref(typeof((Me=r.monacoOptions)==null?void 0:Me.fontSize)=="number"?r.monacoOptions.fontSize:Number.NaN),m=t.ref(S.value),_e=t.computed(()=>{const o=S.value,e=m.value;return typeof o=="number"&&Number.isFinite(o)&&o>0&&typeof e=="number"&&Number.isFinite(e)&&e>0});function Re(){try{const o=b.value;if(!o)return null;const e=o.querySelector(".view-lines .view-line");if(e){const n=Math.ceil(e.getBoundingClientRect().height);if(n>0)return n}}catch(o){}return null}function ye(){var o,e,n,i,l;try{const a=N.value?(n=(e=(o=H())==null?void 0:o.getModifiedEditor)==null?void 0:e.call(o))!=null?n:H():L(),h=K(),v=(i=h==null?void 0:h.EditorOption)==null?void 0:i.fontInfo;if(a&&v!=null){const y=(l=a.getOption)==null?void 0:l.call(a,v),d=y==null?void 0:y.fontSize;if(typeof d=="number"&&Number.isFinite(d)&&d>0)return d}}catch(a){}try{const a=b.value;if(a){const h=a.querySelector(".view-lines .view-line");if(h)try{if(typeof window!="undefined"&&typeof window.getComputedStyle=="function"){const v=window.getComputedStyle(h).fontSize,y=v&&v.match(/^(\d+(?:\.\d+)?)/);if(y)return Number.parseFloat(y[1])}}catch(v){}}}catch(a){}return null}function ue(o){var i,l;try{const a=K(),h=(i=a==null?void 0:a.EditorOption)==null?void 0:i.lineHeight;if(h!=null){const v=(l=o==null?void 0:o.getOption)==null?void 0:l.call(o,h);if(typeof v=="number"&&v>0)return v}}catch(a){}const e=Re();if(e&&e>0)return e;const n=Number.isFinite(m.value)&&m.value>0?m.value:12;return Math.max(12,Math.round(n*1.35))}function de(){var e;if(Number.isFinite(m.value)&&m.value>0&&Number.isFinite(S.value))return m.value;const o=ye();return typeof((e=r.monacoOptions)==null?void 0:e.fontSize)=="number"?(S.value=r.monacoOptions.fontSize,m.value=r.monacoOptions.fontSize,m.value):o&&o>0?(S.value=o,m.value=o,o):(S.value=12,m.value=12,12)}function Ae(){const o=de(),e=Math.min(De,o+Oe);m.value=e}function je(){const o=de(),e=Math.max(Le,o-Oe);m.value=e}function Ye(){de(),Number.isFinite(S.value)&&(m.value=S.value)}function ke(){var o,e,n,i,l,a,h,v,y,d,p,Be,Ne,Se;try{const c=N.value?H():L();if(!c)return null;if(N.value&&(c!=null&&c.getOriginalEditor)&&(c!=null&&c.getModifiedEditor)){const k=(o=c.getOriginalEditor)==null?void 0:o.call(c),E=(e=c.getModifiedEditor)==null?void 0:e.call(c);(n=k==null?void 0:k.layout)==null||n.call(k),(i=E==null?void 0:E.layout)==null||i.call(E);const rt=((l=k==null?void 0:k.getContentHeight)==null?void 0:l.call(k))||0,lt=((a=E==null?void 0:E.getContentHeight)==null?void 0:a.call(E))||0,Fe=Math.max(rt,lt);if(Fe>0)return Math.ceil(Fe+te);const at=((y=(v=(h=k==null?void 0:k.getModel)==null?void 0:h.call(k))==null?void 0:v.getLineCount)==null?void 0:y.call(v))||1,st=((Be=(p=(d=E==null?void 0:E.getModel)==null?void 0:d.call(E))==null?void 0:p.getLineCount)==null?void 0:Be.call(p))||1,ct=Math.max(at,st),ut=Math.max(ue(k),ue(E));return Math.ceil(ct*(ut+ze)+$e+te)}else if(c!=null&&c.getContentHeight){(Ne=c==null?void 0:c.layout)==null||Ne.call(c);const k=c.getContentHeight();if(k>0)return Math.ceil(k+te)}const ve=(Se=c==null?void 0:c.getModel)==null?void 0:Se.call(c);let Ve=1;ve&&typeof ve.getLineCount=="function"&&(Ve=ve.getLineCount());const it=ue(c);return Math.ceil(Ve*(it+ze)+$e+te)}catch(c){return null}}function We(){var v,y,d;const o=b.value,e=ne.value;if(!o||!e)return;const n=o.querySelector(".monaco-editor")||o;let i=null;try{typeof window!="undefined"&&typeof window.getComputedStyle=="function"&&(i=window.getComputedStyle(n))}catch(p){i=null}const l=String((v=i==null?void 0:i.getPropertyValue("--vscode-editor-foreground"))!=null?v:""),a=String((y=i==null?void 0:i.getPropertyValue("--vscode-editor-background"))!=null?y:""),h=String((d=i==null?void 0:i.getPropertyValue("--vscode-editor-hoverHighlightBackground"))!=null?d:"");if(l&&a)return e.style.setProperty("--vscode-editor-foreground",l.trim()),e.style.setProperty("--vscode-editor-background",a.trim()),e.style.setProperty("--vscode-editor-selectionBackground",h.trim()),!0}function _(){try{const o=b.value;if(!o)return;const e=o.getBoundingClientRect(),n=window.scrollY+e.top,i=ke();if(i!=null&&i>0){const l=e.height;o.style.height=`${Math.ceil(i)}px`,o.style.maxHeight="none";const a=Math.ceil(i)-l;a!==0&&n<window.scrollY&&window.scrollBy(0,a)}}catch(o){}}function j(){var o;try{const e=b.value;if(!e)return;const n=e.getBoundingClientRect(),i=window.scrollY+n.top,l=n.height,a=qe();if(ie>0&&(ie--,I.value!=null)){const d=Math.min(I.value,a);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const p=Math.ceil(d)-l;p!==0&&i<window.scrollY&&window.scrollBy(0,p);return}const h=ke();if(h!=null&&h>0){const d=Math.min(h,a);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const p=Math.ceil(d)-l;p!==0&&i<window.scrollY&&window.scrollBy(0,p);return}if(I.value!=null){const d=Math.min(I.value,a);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const p=Math.ceil(d)-l;p!==0&&i<window.scrollY&&window.scrollBy(0,p);return}const v=Math.ceil(((o=e.getBoundingClientRect)==null?void 0:o.call(e).height)||0);if(v>0){const d=Math.min(v,a);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const p=Math.ceil(d)-l;p!==0&&i<window.scrollY&&window.scrollBy(0,p);return}const y=Number.parseFloat(e.style.height);if(!Number.isNaN(y)&&y>0){const d=Math.ceil(Math.min(y,a));e.style.height=`${d}px`;const p=d-l;p!==0&&i<window.scrollY&&window.scrollBy(0,p)}else{const d=Math.ceil(a);e.style.height=`${d}px`;const p=d-l;p!==0&&i<window.scrollY&&window.scrollBy(0,p)}e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto"}catch(e){}}function qe(){var n,i;const o=(i=(n=r.monacoOptions)==null?void 0:n.MAX_HEIGHT)!=null?i:500;if(typeof o=="number")return o;const e=String(o).match(/^(\d+(?:\.\d+)?)/);return e?Number.parseFloat(e[1]):500}const fe=t.computed(()=>r.isShowPreview&&(P.value==="html"||P.value==="svg")),U=t.computed(()=>P.value==="mermaid");t.watch(()=>r.node.language,o=>{P.value=g.normalizeLanguageIdentifier(o)}),t.watch(()=>r.node.code,o=>$(null,null,function*(){var e,n;if(r.stream!==!1){if(P.value||(P.value=g.normalizeLanguageIdentifier(we(o))),O&&!X.value&&b.value)try{yield me(b.value)}catch(i){}N.value?le(String((e=r.node.originalCode)!=null?e:""),String((n=r.node.updatedCode)!=null?n:""),Y.value):re(o,Y.value),C.value&&g.safeRaf(()=>_())}}));const Ue=t.computed(()=>{const o=P.value;return o?g.languageMap[o]||o.charAt(0).toUpperCase()+o.slice(1):g.languageMap[""]||"Plain Text"}),Xe=t.computed(()=>g.getLanguageIcon(P.value||"")),Ge=t.computed(()=>{const o={},e=l=>{if(l!=null)return typeof l=="number"?`${l}px`:String(l)},n=e(r.minWidth),i=e(r.maxWidth);return n&&(o.minWidth=n),i&&(o.maxWidth=i),o});function Ke(){return $(this,null,function*(){try{typeof navigator!="undefined"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(r.node.code)),A.value=!0,R("copy",r.node.code),setTimeout(()=>{A.value=!1},1e3)}catch(o){console.error("复制失败:",o)}})}function xe(o){const e=o;return!e||e.disabled}function V(o,e,n="top"){if(xe(o.currentTarget))return;const i=o,l=(i==null?void 0:i.clientX)!=null&&(i==null?void 0:i.clientY)!=null?{x:i.clientX,y:i.clientY}:void 0;g.showTooltipForAnchor(o.currentTarget,e,n,!1,l,r.isDark)}function B(){g.hideTooltip()}function be(o){if(xe(o.currentTarget))return;const e=A.value?u("common.copied")||"Copied":u("common.copy")||"Copy",n=o,i=(n==null?void 0:n.clientX)!=null&&(n==null?void 0:n.clientY)!=null?{x:n.clientX,y:n.clientY}:void 0;g.showTooltipForAnchor(o.currentTarget,e,"top",!1,i,r.isDark)}function Je(){C.value=!C.value;const o=N.value?H():L(),e=b.value;!o||!e||(C.value?(Z(!0),e.style.maxHeight="none",e.style.overflow="visible",_()):(Z(!1),e.style.overflow="auto",j()))}function Qe(){var o,e,n;if(M.value=!M.value,M.value){if(b.value){const i=Math.ceil(((e=(o=b.value).getBoundingClientRect)==null?void 0:e.call(o).height)||0);i>0&&(I.value=i)}Z(!1)}else{C.value&&Z(!0),b.value&&I.value!=null&&(b.value.style.height=`${I.value}px`);const i=N.value?H():L();try{(n=i==null?void 0:i.layout)==null||n.call(i)}catch(l){}ie=2,g.safeRaf(()=>{C.value?_():j()})}}t.watch(()=>m.value,(o,e)=>{const n=N.value?H():L();n&&typeof o=="number"&&Number.isFinite(o)&&o>0&&(n.updateOptions({fontSize:o}),C.value&&!M.value&&_())},{flush:"post",immediate:!1});function Ze(){if(!fe.value)return;const o=P.value;if(x.value){const e=o==="html"?"text/html":"image/svg+xml",n=o==="html"?u("artifacts.htmlPreviewTitle")||"HTML Preview":u("artifacts.svgPreviewTitle")||"SVG Preview";R("previewCode",{node:r.node,artifactType:e,artifactTitle:n,id:`temp-${o}-${Date.now()}`});return}o==="html"&&(Q.value=!Q.value)}function Z(o){var e,n;try{if(N.value){const i=H();(e=i==null?void 0:i.updateOptions)==null||e.call(i,{automaticLayout:o})}else{const i=L();(n=i==null?void 0:i.updateOptions)==null||n.call(i,{automaticLayout:o})}}catch(i){}}function et(o){return $(this,null,function*(){var n,i,l;if(!O)return;N.value?(ae(),G?yield G(o,String((n=r.node.originalCode)!=null?n:""),String((i=r.node.updatedCode)!=null?i:""),Y.value):yield O(o,r.node.code,Y.value)):yield O(o,r.node.code,Y.value);const e=N.value?H():L();if(typeof((l=r.monacoOptions)==null?void 0:l.fontSize)=="number")e==null||e.updateOptions({fontSize:r.monacoOptions.fontSize,automaticLayout:!1}),S.value=r.monacoOptions.fontSize,m.value=r.monacoOptions.fontSize;else{const a=ye();a&&a>0?(S.value=a,m.value=a):(S.value=12,m.value=12)}!C.value&&!M.value&&j(),r.loading===!1&&(yield t.nextTick(),g.safeRaf(()=>{C.value&&!M.value?_():M.value||j()}))})}function me(o){return O?q||(X.value=!0,q=$(null,null,function*(){yield et(o)}).finally(()=>{q=null}),q):null}const Ee=t.watch(()=>[b.value,U.value,N.value,r.stream,r.loading,ge.value,D.value],v=>$(null,[v],function*([o,e,n,i,l,a,h]){if(!o||!O||!h||i===!1&&l!==!1)return;if(U.value){J(),Ee();return}const y=me(o);y&&(yield y,Ee())})),tt=t.watch(()=>[r.darkTheme,r.lightTheme,X.value,D.value],()=>{if(!(!X.value||!D.value)){if(U.value)return tt();ot()}});function Ce(){return r.isDark?r.darkTheme:r.lightTheme}function ot(){const o=Ce();o&&se(o)}const nt=t.watch(()=>[r.monacoOptions,D.value],()=>{var n,i;if(!O||!D.value)return;if(U.value)return nt();const o=N.value?H():L(),e=typeof((n=r.monacoOptions)==null?void 0:n.fontSize)=="number"?r.monacoOptions.fontSize:Number.isFinite(m.value)?m.value:void 0;typeof e=="number"&&Number.isFinite(e)&&e>0&&((i=o==null?void 0:o.updateOptions)==null||i.call(o,{fontSize:e})),C.value&&!M.value?_():M.value||j()},{deep:!0}),ee=t.watch(()=>[r.loading,D.value],n=>$(null,[n],function*([o,e]){if(e){if(U.value){t.nextTick(()=>{ee==null||ee()});return}o||(yield t.nextTick(),g.safeRaf(()=>{M.value||(C.value?_():j()),ee()}))}}),{immediate:!0,flush:"post"});return t.onUnmounted(()=>{J()}),(o,e)=>ce.value?(t.openBlock(),t.createBlock(t.unref(g._sfc_main),{key:0,node:f.node,loading:r.loading},null,8,["node","loading"])):(t.openBlock(),t.createElementBlock("div",{key:1,ref_key:"container",ref:ne,style:t.normalizeStyle(Ge.value),class:t.normalizeClass(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[r.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":r.loading,"is-dark":r.isDark}]])},[r.showHeader?(t.openBlock(),t.createElementBlock("div",bt,[t.renderSlot(o.$slots,"header-left",{},()=>[t.createElementVNode("div",Et,[t.createElementVNode("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:Xe.value},null,8,Ct),t.createElementVNode("span",Mt,t.toDisplayString(Ue.value),1)])],!0),t.renderSlot(o.$slots,"header-right",{},()=>[t.createElementVNode("div",Bt,[t.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":M.value,onClick:Qe,onMouseenter:e[0]||(e[0]=n=>V(n,M.value?t.unref(u)("common.expand")||"Expand":t.unref(u)("common.collapse")||"Collapse")),onFocus:e[1]||(e[1]=n=>V(n,M.value?t.unref(u)("common.expand")||"Expand":t.unref(u)("common.collapse")||"Collapse")),onMouseleave:B,onBlur:B},[(t.openBlock(),t.createElementBlock("svg",{style:t.normalizeStyle({rotate:M.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...e[17]||(e[17]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Nt),r.showFontSizeButtons&&r.enableFontSizeControl?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Number.isFinite(m.value)?m.value<=Le:!1,onClick:e[2]||(e[2]=n=>je()),onMouseenter:e[3]||(e[3]=n=>V(n,t.unref(u)("common.decrease")||"Decrease")),onFocus:e[4]||(e[4]=n=>V(n,t.unref(u)("common.decrease")||"Decrease")),onMouseleave:B,onBlur:B},[...e[18]||(e[18]=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,St),t.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!_e.value||m.value===S.value,onClick:e[5]||(e[5]=n=>Ye()),onMouseenter:e[6]||(e[6]=n=>V(n,t.unref(u)("common.reset")||"Reset")),onFocus:e[7]||(e[7]=n=>V(n,t.unref(u)("common.reset")||"Reset")),onMouseleave:B,onBlur:B},[...e[19]||(e[19]=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),t.createElementVNode("path",{d:"M3 3v5h5"})])],-1)])],40,Vt),t.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Number.isFinite(m.value)?m.value>=De:!1,onClick:e[8]||(e[8]=n=>Ae()),onMouseenter:e[9]||(e[9]=n=>V(n,t.unref(u)("common.increase")||"Increase")),onFocus:e[10]||(e[10]=n=>V(n,t.unref(u)("common.increase")||"Increase")),onMouseleave:B,onBlur:B},[...e[20]||(e[20]=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,Ft)],64)):t.createCommentVNode("",!0),r.showCopyButton?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":A.value?t.unref(u)("common.copied")||"Copied":t.unref(u)("common.copy")||"Copy",onClick:Ke,onMouseenter:e[11]||(e[11]=n=>be(n)),onFocus:e[12]||(e[12]=n=>be(n)),onMouseleave:B,onBlur:B},[A.value?(t.openBlock(),t.createElementBlock("svg",Ht,[...e[22]||(e[22]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",Pt,[...e[21]||(e[21]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),t.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Tt)):t.createCommentVNode("",!0),r.showExpandButton?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":C.value,onClick:Je,onMouseenter:e[13]||(e[13]=n=>V(n,C.value?t.unref(u)("common.collapse")||"Collapse":t.unref(u)("common.expand")||"Expand")),onFocus:e[14]||(e[14]=n=>V(n,C.value?t.unref(u)("common.collapse")||"Collapse":t.unref(u)("common.expand")||"Expand")),onMouseleave:B,onBlur:B},[C.value?(t.openBlock(),t.createElementBlock("svg",Dt,[...e[23]||(e[23]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",Ot,[...e[24]||(e[24]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])]))],40,Lt)):t.createCommentVNode("",!0),fe.value&&r.showPreviewButton?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":t.unref(u)("common.preview")||"Preview",onClick:Ze,onMouseenter:e[15]||(e[15]=n=>V(n,t.unref(u)("common.preview")||"Preview")),onFocus:e[16]||(e[16]=n=>V(n,t.unref(u)("common.preview")||"Preview")),onMouseleave:B,onBlur:B},[...e[25]||(e[25]=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[t.createElementVNode("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[t.createElementVNode("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),t.createElementVNode("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})])],-1)])],40,$t)):t.createCommentVNode("",!0)])],!0)])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",{ref_key:"codeEditor",ref:b,class:t.normalizeClass(["code-editor-container",[f.stream?"":"code-height-placeholder"]])},null,2),[[t.vShow,!M.value&&(f.stream?!0:!f.loading)]]),Q.value&&!x.value&&fe.value&&P.value==="html"?(t.openBlock(),t.createBlock(xt,{key:1,code:f.node.code,"is-dark":r.isDark,"on-close":()=>Q.value=!1},null,8,["code","is-dark","on-close"])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",zt,[t.renderSlot(o.$slots,"loading",{loading:f.loading,stream:f.stream},()=>[e[26]||(e[26]=t.createElementVNode("div",{class:"loading-skeleton"},[t.createElementVNode("div",{class:"skeleton-line"}),t.createElementVNode("div",{class:"skeleton-line"}),t.createElementVNode("div",{class:"skeleton-line short"})],-1))],!0)],512),[[t.vShow,!f.stream&&f.loading]]),t.createElementVNode("span",It,t.toDisplayString(A.value?t.unref(u)("common.copied")||"Copied":""),1)],6))}}),oe=g._export_sfc(_t,[["__scopeId","data-v-acbbd971"]]);oe.install=f=>{f.component(oe.__name,oe)};exports.default=oe;
|
package/dist/index-Bg9riGZT.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
var v = (d, n, r) => new Promise((a, s) => {
|
|
2
|
-
var f = (l) => {
|
|
3
|
-
try {
|
|
4
|
-
o(r.next(l));
|
|
5
|
-
} catch (e) {
|
|
6
|
-
s(e);
|
|
7
|
-
}
|
|
8
|
-
}, u = (l) => {
|
|
9
|
-
try {
|
|
10
|
-
o(r.throw(l));
|
|
11
|
-
} catch (e) {
|
|
12
|
-
s(e);
|
|
13
|
-
}
|
|
14
|
-
}, o = (l) => l.done ? a(l.value) : Promise.resolve(l.value).then(f, u);
|
|
15
|
-
o((r = r.apply(d, n)).next());
|
|
16
|
-
});
|
|
17
|
-
import { defineComponent as O, ref as p, watch as y, onMounted as I, onBeforeUnmount as M, createElementBlock as T, openBlock as g, createVNode as K, createElementVNode as w, Transition as b, withCtx as N, createCommentVNode as V, normalizeClass as W } from "vue";
|
|
18
|
-
import { a as A, e as D, f as L, i as U, W as S, _ as X } from "./exports-CVYl7bes.js";
|
|
19
|
-
const z = {
|
|
20
|
-
key: 0,
|
|
21
|
-
class: "math-loading-overlay"
|
|
22
|
-
}, F = /* @__PURE__ */ O({
|
|
23
|
-
__name: "MathBlockNode",
|
|
24
|
-
props: {
|
|
25
|
-
node: {}
|
|
26
|
-
},
|
|
27
|
-
setup(d) {
|
|
28
|
-
const n = d, r = p(null), a = p(null);
|
|
29
|
-
let s = !1, f = 0, u = !1, o = null;
|
|
30
|
-
const l = A();
|
|
31
|
-
let e = null;
|
|
32
|
-
const c = p(!0);
|
|
33
|
-
function k() {
|
|
34
|
-
return v(this, null, function* () {
|
|
35
|
-
if (!n.node.content || !a.value || u)
|
|
36
|
-
return;
|
|
37
|
-
if (!s)
|
|
38
|
-
try {
|
|
39
|
-
!e && r.value && (e = l(r.value)), yield e == null ? void 0 : e.whenVisible;
|
|
40
|
-
} catch (t) {
|
|
41
|
-
}
|
|
42
|
-
o && (o.abort(), o = null);
|
|
43
|
-
const i = ++f, m = new AbortController();
|
|
44
|
-
o = m, D(n.node.content, !0, {
|
|
45
|
-
timeout: 3e3,
|
|
46
|
-
waitTimeout: 2e3,
|
|
47
|
-
maxRetries: 1,
|
|
48
|
-
signal: m.signal
|
|
49
|
-
}).then((t) => {
|
|
50
|
-
u || i !== f || a.value && (a.value.innerHTML = t, s = !0, c.value = !1);
|
|
51
|
-
}).catch((t) => v(null, null, function* () {
|
|
52
|
-
if (u || i !== f || !a.value)
|
|
53
|
-
return;
|
|
54
|
-
const h = (t == null ? void 0 : t.code) || (t == null ? void 0 : t.name), x = h === "WORKER_INIT_ERROR" || (t == null ? void 0 : t.fallbackToRenderer), B = h === S || h === "WORKER_TIMEOUT", C = h === "KATEX_DISABLED";
|
|
55
|
-
if (x || B) {
|
|
56
|
-
const R = yield L();
|
|
57
|
-
if (R) {
|
|
58
|
-
try {
|
|
59
|
-
const _ = R.renderToString(n.node.content, {
|
|
60
|
-
throwOnError: n.node.loading,
|
|
61
|
-
displayMode: !0
|
|
62
|
-
});
|
|
63
|
-
a.value.innerHTML = _, s = !0, c.value = !1, U(n.node.content, !0, _);
|
|
64
|
-
} catch (_) {
|
|
65
|
-
}
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (C) {
|
|
70
|
-
c.value = !1, a.value.textContent = n.node.raw;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
s || (c.value = !0), n.node.loading || (c.value = !1, a.value.textContent = n.node.raw);
|
|
74
|
-
}));
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return y(
|
|
78
|
-
() => n.node.content,
|
|
79
|
-
() => {
|
|
80
|
-
k();
|
|
81
|
-
}
|
|
82
|
-
), I(() => {
|
|
83
|
-
k();
|
|
84
|
-
}), M(() => {
|
|
85
|
-
var i;
|
|
86
|
-
u = !0, o && (o.abort(), o = null), (i = e == null ? void 0 : e.destroy) == null || i.call(e), e = null;
|
|
87
|
-
}), (i, m) => (g(), T("div", {
|
|
88
|
-
ref_key: "containerEl",
|
|
89
|
-
ref: r,
|
|
90
|
-
class: "math-block text-center overflow-x-auto relative min-h-[40px]"
|
|
91
|
-
}, [
|
|
92
|
-
K(b, { name: "math-fade" }, {
|
|
93
|
-
default: N(() => [
|
|
94
|
-
c.value ? (g(), T("div", z, [...m[0] || (m[0] = [
|
|
95
|
-
w("div", { class: "math-loading-spinner" }, null, -1)
|
|
96
|
-
])])) : V("", !0)
|
|
97
|
-
]),
|
|
98
|
-
_: 1
|
|
99
|
-
}),
|
|
100
|
-
w("div", {
|
|
101
|
-
ref_key: "mathBlockElement",
|
|
102
|
-
ref: a,
|
|
103
|
-
class: W({ "math-rendering": c.value })
|
|
104
|
-
}, null, 2)
|
|
105
|
-
], 512));
|
|
106
|
-
}
|
|
107
|
-
}), E = /* @__PURE__ */ X(F, [["__scopeId", "data-v-dab27d4f"]]);
|
|
108
|
-
E.install = (d) => {
|
|
109
|
-
d.component(E.__name, E);
|
|
110
|
-
};
|
|
111
|
-
export {
|
|
112
|
-
E as default
|
|
113
|
-
};
|
package/dist/index-Bjfg9_i9.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var k=(m,o,c)=>new Promise((r,u)=>{var h=l=>{try{a(c.next(l))}catch(t){u(t)}},i=l=>{try{a(c.throw(l))}catch(t){u(t)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(h,i);a((c=c.apply(m,o)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),f=require("./exports-ISf5W5H7.cjs"),x={key:0,class:"math-loading-overlay"},C=e.defineComponent({__name:"MathBlockNode",props:{node:{}},setup(m){const o=m,c=e.ref(null),r=e.ref(null);let u=!1,h=0,i=!1,a=null;const l=f.useViewportPriority();let t=null;const s=e.ref(!0);function g(){return k(this,null,function*(){if(!o.node.content||!r.value||i)return;if(!u)try{!t&&c.value&&(t=l(c.value)),yield t==null?void 0:t.whenVisible}catch(n){}a&&(a.abort(),a=null);const d=++h,_=new AbortController;a=_,f.renderKaTeXWithBackpressure(o.node.content,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:_.signal}).then(n=>{i||d!==h||r.value&&(r.value.innerHTML=n,u=!0,s.value=!1)}).catch(n=>k(null,null,function*(){if(i||d!==h||!r.value)return;const v=(n==null?void 0:n.code)||(n==null?void 0:n.name),B=v==="WORKER_INIT_ERROR"||(n==null?void 0:n.fallbackToRenderer),R=v===f.WORKER_BUSY_CODE||v==="WORKER_TIMEOUT",w=v==="KATEX_DISABLED";if(B||R){const T=yield f.getKatex();if(T){try{const E=T.renderToString(o.node.content,{throwOnError:o.node.loading,displayMode:!0});r.value.innerHTML=E,u=!0,s.value=!1,f.setKaTeXCache(o.node.content,!0,E)}catch(E){}return}}if(w){s.value=!1,r.value.textContent=o.node.raw;return}u||(s.value=!0),o.node.loading||(s.value=!1,r.value.textContent=o.node.raw)}))})}return e.watch(()=>o.node.content,()=>{g()}),e.onMounted(()=>{g()}),e.onBeforeUnmount(()=>{var d;i=!0,a&&(a.abort(),a=null),(d=t==null?void 0:t.destroy)==null||d.call(t),t=null}),(d,_)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerEl",ref:c,class:"math-block text-center overflow-x-auto relative min-h-[40px]"},[e.createVNode(e.Transition,{name:"math-fade"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",x,[..._[0]||(_[0]=[e.createElementVNode("div",{class:"math-loading-spinner"},null,-1)])])):e.createCommentVNode("",!0)]),_:1}),e.createElementVNode("div",{ref_key:"mathBlockElement",ref:r,class:e.normalizeClass({"math-rendering":s.value})},null,2)],512))}}),p=f._export_sfc(C,[["__scopeId","data-v-dab27d4f"]]);p.install=m=>{m.component(p.__name,p)};exports.default=p;
|
package/dist/index-BqQOMeNc.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var w=(m,t,s)=>new Promise((a,i)=>{var p=n=>{try{l(s.next(n))}catch(_){i(_)}},d=n=>{try{l(s.throw(n))}catch(_){i(_)}},l=n=>n.done?a(n.value):Promise.resolve(n.value).then(p,d);l((s=s.apply(m,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),f=require("./exports-ISf5W5H7.cjs"),y={class:"math-inline__loading",role:"status","aria-live":"polite"},I=e.defineComponent({__name:"MathInlineNode",props:{node:{}},setup(m){const t=m,s=e.ref(null),a=e.ref(null);let i=!1,p=0,d=!1,l=null;const n=e.ref(!0),_=f.useViewportPriority();let r=null;function T(){return w(this,null,function*(){if(!t.node.content||!a.value||d)return;l&&(l.abort(),l=null);const u=++p,c=new AbortController;if(l=c,!i)try{!r&&s.value&&(r=_(s.value)),yield r==null?void 0:r.whenVisible}catch(o){}f.renderKaTeXWithBackpressure(t.node.content,!1,{timeout:1500,waitTimeout:0,maxRetries:0,signal:c.signal}).then(o=>{d||u!==p||a.value&&(a.value.innerHTML=o,n.value=!1,i=!0)}).catch(o=>w(null,null,function*(){if(d||u!==p||!a.value)return;const h=(o==null?void 0:o.code)||(o==null?void 0:o.name),k=h==="WORKER_INIT_ERROR"||(o==null?void 0:o.fallbackToRenderer),C=h===f.WORKER_BUSY_CODE||h==="WORKER_TIMEOUT",E=h==="KATEX_DISABLED";if(k||C){const R=yield f.getKatex();if(R){try{const g=R.renderToString(t.node.content,{throwOnError:t.node.loading,displayMode:!1});n.value=!1,a.value.innerHTML=g,i=!0,f.setKaTeXCache(t.node.content,!1,g)}catch(g){}return}}if(E){n.value=!1,a.value.textContent=t.node.raw;return}i||(n.value=!E),t.node.loading?E&&(a.value.textContent=t.node.raw):(n.value=!1,a.value.textContent=t.node.raw)}))})}return e.watch(()=>t.node.content,()=>{T()}),e.onMounted(()=>{T()}),e.onBeforeUnmount(()=>{var u;d=!0,l&&(l.abort(),l=null),(u=r==null?void 0:r.destroy)==null||u.call(r),r=null}),(u,c)=>(e.openBlock(),e.createElementBlock("span",{ref_key:"containerEl",ref:s,class:"math-inline-wrapper"},[e.withDirectives(e.createElementVNode("span",{ref_key:"mathElement",ref:a,class:"math-inline"},null,512),[[e.vShow,!n.value]]),n.value?(e.openBlock(),e.createBlock(e.Transition,{key:0,name:"table-node-fade"},{default:e.withCtx(()=>[e.createElementVNode("span",y,[e.renderSlot(u.$slots,"loading",{isLoading:n.value},()=>[c[0]||(c[0]=e.createElementVNode("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),c[1]||(c[1]=e.createElementVNode("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):e.createCommentVNode("",!0)],512))}}),v=f._export_sfc(I,[["__scopeId","data-v-fbd3ae11"]]);v.install=m=>{m.component(v.__name,v)};exports.default=v;
|