markstream-vue 0.0.2-beta.9 → 0.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.
- package/dist/{exports-CyoL-8XF.js → exports-CnH6kN6F.js} +1602 -1521
- package/dist/exports-DsdRlFsA.cjs +246 -0
- package/dist/exports.js +1 -1
- package/dist/{index-DdtMPiwH.js → index-BVEX3mF2.js} +12 -12
- package/dist/{index-CDRkq20z.js → index-Bie7KQwi.js} +323 -331
- package/dist/index-D4WvXLjB.cjs +22 -0
- package/dist/{index-Br7IvHNe.cjs → index-DObBCK_f.cjs} +1 -1
- package/dist/{index-DoRl8S3_.js → index-DRwD-ixu.js} +1 -1
- package/dist/{index-OTPe0l-Z.cjs → index-Dp_yMiDW.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +42 -40
- package/dist/index.tailwind.css +1 -1
- package/dist/index2.js +1 -1
- package/dist/index3.js +1 -1
- package/dist/index4.js +1 -1
- package/dist/tailwind.ts +0 -0
- package/package.json +4 -4
- package/dist/exports-DADWwNRQ.cjs +0 -246
- package/dist/index-CcqRGphH.cjs +0 -22
package/dist/index-CcqRGphH.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";var at=Object.defineProperty,st=Object.defineProperties;var ct=Object.getOwnPropertyDescriptors;var Me=Object.getOwnPropertySymbols;var ut=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable;var Ne=(m,c,i)=>c in m?at(m,c,{enumerable:!0,configurable:!0,writable:!0,value:i}):m[c]=i,Se=(m,c)=>{for(var i in c||(c={}))ut.call(c,i)&&Ne(m,i,c[i]);if(Me)for(var i of Me(c))dt.call(c,i)&&Ne(m,i,c[i]);return m},Ve=(m,c)=>st(m,ct(c));var $=(m,c,i)=>new Promise((I,L)=>{var N=w=>{try{v(i.next(w))}catch(D){L(D)}},a=w=>{try{v(i.throw(w))}catch(D){L(D)}},v=w=>w.done?I(w.value):Promise.resolve(w.value).then(N,a);v((i=i.apply(m,c)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),b=require("./exports-DADWwNRQ.cjs"),mt={class:"html-preview-frame__header"},ft={class:"html-preview-frame__title"},vt={class:"html-preview-frame__label"},ht=["srcdoc"],pt=t.defineComponent({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(m){const c=m,{t:i}=b.useSafeI18n(),I=t.computed(()=>{const N=c.code||"",a=N.trim().toLowerCase();if(a.startsWith("<!doctype")||a.startsWith("<html")||a.startsWith("<body"))return N;const v=c.isDark?"#020617":"#ffffff",w=c.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: ${v};
|
|
12
|
-
color: ${w};
|
|
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
|
-
${N}
|
|
21
|
-
</body>
|
|
22
|
-
</html>`});function L(N){var a;(N.key==="Escape"||N.key==="Esc")&&((a=c.onClose)==null||a.call(c))}return t.onMounted(()=>{typeof window!="undefined"&&window.addEventListener("keydown",L)}),t.onUnmounted(()=>{typeof window!="undefined"&&window.removeEventListener("keydown",L)}),(N,a)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:t.normalizeClass(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":c.isDark}]),onClick:a[2]||(a[2]=v=>{var w;return(w=c.onClose)==null?void 0:w.call(c)})},[t.createElementVNode("div",{class:t.normalizeClass(["html-preview-frame",{"html-preview-frame--dark":c.isDark}]),onClick:a[1]||(a[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",mt,[t.createElementVNode("div",ft,[a[3]||(a[3]=t.createElementVNode("span",{class:"html-preview-frame__dot"},null,-1)),t.createElementVNode("span",vt,t.toDisplayString(c.title||t.unref(i)("common.preview")||"Preview"),1)]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["html-preview-frame__close",{"html-preview-frame__close--dark":c.isDark}]),onClick:a[0]||(a[0]=v=>{var w;return(w=c.onClose)==null?void 0:w.call(c)})}," × ",2)]),t.createElementVNode("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:I.value},null,8,ht)],2)],2)]))}}),gt=b._export_sfc(pt,[["__scopeId","data-v-3cf0ed56"]]),wt={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)"}},yt={class:"flex items-center space-x-2 flex-1 overflow-hidden"},kt=["innerHTML"],xt={class:"text-sm font-medium font-mono truncate"},bt={class:"flex items-center space-x-2"},Ct=["aria-pressed"],Et=["disabled"],Bt=["disabled"],Mt=["disabled"],Nt=["aria-label"],St={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"},Vt={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"},Ft=["aria-pressed"],Tt={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"},Dt={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"},Ht=["aria-label"],Lt={class:"code-loading-placeholder"},Pt={class:"sr-only","aria-live":"polite",role:"status"},Fe=10,Te=36,De=1,He=0,Le=1.5,Q=1,Ot=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(m,{emit:c}){var ye,ke;const i=m,I=c,L=t.getCurrentInstance(),N=t.computed(()=>{const o=L==null?void 0:L.vnode.props;return!!(o&&(o.onPreviewCode||o.onPreviewCode))}),{t:a}=b.useSafeI18n(),v=t.ref(null),w=t.ref(null),D=t.ref(!1),B=t.ref(String((ye=i.node.language)!=null?ye:"")),C=t.ref(!1),E=t.ref(!1),W=t.ref(!1),de=t.ref(!1),z=t.ref(null);let ee=0;const Pe=b.useViewportPriority(),Y=t.ref(null),P=t.ref(typeof window=="undefined");typeof window!="undefined"&&t.watch(()=>w.value,o=>{var n;if((n=Y.value)==null||n.destroy(),Y.value=null,!o){P.value=!1;return}const e=Pe(o,{rootMargin:"400px"});Y.value=e,P.value=e.isVisible.value,e.whenVisible.then(()=>{P.value=!0})},{immediate:!0}),t.onBeforeUnmount(()=>{var o;(o=Y.value)==null||o.destroy(),Y.value=null});let O=null,q=null,te=()=>{},oe=()=>{},X=()=>null,H=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),T=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),U=()=>{},ne=()=>{},A=null,me=()=>{var o;return String((o=i.node.language)!=null?o:"plaintext")},le=()=>$(null,null,function*(){});const S=t.computed(()=>i.node.diff),ie=t.ref(!1),G=t.ref(!1);typeof window!="undefined"&&$(null,null,function*(){try{const o=yield b.getUseMonaco();if(!o){ie.value=!0;return}const e=o.useMonaco,n=o.detectLanguage;if(typeof n=="function"&&(me=n),typeof e=="function"){const l=we();if(l&&i.themes&&Array.isArray(i.themes)&&!i.themes.includes(l))throw new Error("Preferred theme not in provided themes array");const r=e(Ve(Se({wordWrap:"on",wrappingIndent:"same",themes:i.themes,theme:l},i.monacoOptions||{}),{onThemeChange(){_e()}}));O=r.createEditor||O,q=r.createDiffEditor||q,te=r.updateCode||te,oe=r.updateDiff||oe,X=r.getEditor||X,H=r.getEditorView||H,T=r.getDiffEditorView||T,U=r.cleanupEditor||U,ne=r.safeClean||r.cleanupEditor||ne,le=r.setTheme||le,de.value=!0,v.value&&(yield ce(v.value))}}catch(o){ie.value=!0}});const V=t.ref(typeof((ke=i.monacoOptions)==null?void 0:ke.fontSize)=="number"?i.monacoOptions.fontSize:Number.NaN),f=t.ref(V.value),Oe=t.computed(()=>{const o=V.value,e=f.value;return typeof o=="number"&&Number.isFinite(o)&&o>0&&typeof e=="number"&&Number.isFinite(e)&&e>0});function $e(){try{const o=v.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 fe(){var o,e,n,l,r;try{const s=S.value?(n=(e=(o=T())==null?void 0:o.getModifiedEditor)==null?void 0:e.call(o))!=null?n:T():H(),g=X(),p=(l=g==null?void 0:g.EditorOption)==null?void 0:l.fontInfo;if(s&&p!=null){const y=(r=s.getOption)==null?void 0:r.call(s,p),d=y==null?void 0:y.fontSize;if(typeof d=="number"&&Number.isFinite(d)&&d>0)return d}}catch(s){}try{const s=v.value;if(s){const g=s.querySelector(".view-lines .view-line");if(g)try{if(typeof window!="undefined"&&typeof window.getComputedStyle=="function"){const p=window.getComputedStyle(g).fontSize,y=p&&p.match(/^(\d+(?:\.\d+)?)/);if(y)return Number.parseFloat(y[1])}}catch(p){}}}catch(s){}return null}function re(o){var l,r;try{const s=X(),g=(l=s==null?void 0:s.EditorOption)==null?void 0:l.lineHeight;if(g!=null){const p=(r=o==null?void 0:o.getOption)==null?void 0:r.call(o,g);if(typeof p=="number"&&p>0)return p}}catch(s){}const e=$e();if(e&&e>0)return e;const n=Number.isFinite(f.value)&&f.value>0?f.value:12;return Math.max(12,Math.round(n*1.35))}function ae(){var e;if(Number.isFinite(f.value)&&f.value>0&&Number.isFinite(V.value))return f.value;const o=fe();return typeof((e=i.monacoOptions)==null?void 0:e.fontSize)=="number"?(V.value=i.monacoOptions.fontSize,f.value=i.monacoOptions.fontSize,f.value):o&&o>0?(V.value=o,f.value=o,o):(V.value=12,f.value=12,12)}function ze(){const o=ae(),e=Math.min(Te,o+De);f.value=e}function Re(){const o=ae(),e=Math.max(Fe,o-De);f.value=e}function Ie(){ae(),Number.isFinite(V.value)&&(f.value=V.value)}function ve(){var o,e,n,l,r,s,g,p,y,d,h,xe,be,Ce;try{const u=S.value?T():H();if(!u)return null;if(S.value&&(u!=null&&u.getOriginalEditor)&&(u!=null&&u.getModifiedEditor)){const k=(o=u.getOriginalEditor)==null?void 0:o.call(u),x=(e=u.getModifiedEditor)==null?void 0:e.call(u);(n=k==null?void 0:k.layout)==null||n.call(k),(l=x==null?void 0:x.layout)==null||l.call(x);const tt=((r=k==null?void 0:k.getContentHeight)==null?void 0:r.call(k))||0,ot=((s=x==null?void 0:x.getContentHeight)==null?void 0:s.call(x))||0,Be=Math.max(tt,ot);if(Be>0)return Math.ceil(Be+Q);const nt=((y=(p=(g=k==null?void 0:k.getModel)==null?void 0:g.call(k))==null?void 0:p.getLineCount)==null?void 0:y.call(p))||1,lt=((xe=(h=(d=x==null?void 0:x.getModel)==null?void 0:d.call(x))==null?void 0:h.getLineCount)==null?void 0:xe.call(h))||1,it=Math.max(nt,lt),rt=Math.max(re(k),re(x));return Math.ceil(it*(rt+Le)+He+Q)}else if(u!=null&&u.getContentHeight){(be=u==null?void 0:u.layout)==null||be.call(u);const k=u.getContentHeight();if(k>0)return Math.ceil(k+Q)}const ue=(Ce=u==null?void 0:u.getModel)==null?void 0:Ce.call(u);let Ee=1;ue&&typeof ue.getLineCount=="function"&&(Ee=ue.getLineCount());const et=re(u);return Math.ceil(Ee*(et+Le)+He+Q)}catch(u){return null}}function _e(){var p,y,d;const o=v.value,e=w.value;if(!o||!e)return;const n=o.querySelector(".monaco-editor")||o;let l=null;try{typeof window!="undefined"&&typeof window.getComputedStyle=="function"&&(l=window.getComputedStyle(n))}catch(h){l=null}const r=String((p=l==null?void 0:l.getPropertyValue("--vscode-editor-foreground"))!=null?p:""),s=String((y=l==null?void 0:l.getPropertyValue("--vscode-editor-background"))!=null?y:""),g=String((d=l==null?void 0:l.getPropertyValue("--vscode-editor-hoverHighlightBackground"))!=null?d:"");if(r&&s)return e.style.setProperty("--vscode-editor-foreground",r.trim()),e.style.setProperty("--vscode-editor-background",s.trim()),e.style.setProperty("--vscode-editor-selectionBackground",g.trim()),!0}function R(){try{const o=v.value;if(!o)return;const e=o.getBoundingClientRect(),n=window.scrollY+e.top,l=ve();if(l!=null&&l>0){const r=e.height;o.style.height=`${Math.ceil(l)}px`,o.style.maxHeight="none";const s=Math.ceil(l)-r;s!==0&&n<window.scrollY&&window.scrollBy(0,s)}}catch(o){}}function _(){var o;try{const e=v.value;if(!e)return;const n=e.getBoundingClientRect(),l=window.scrollY+n.top,r=n.height,s=Ye();if(ee>0&&(ee--,z.value!=null)){const d=Math.min(z.value,s);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(s)}px`,e.style.overflow="auto";const h=Math.ceil(d)-r;h!==0&&l<window.scrollY&&window.scrollBy(0,h);return}const g=ve();if(g!=null&&g>0){const d=Math.min(g,s);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(s)}px`,e.style.overflow="auto";const h=Math.ceil(d)-r;h!==0&&l<window.scrollY&&window.scrollBy(0,h);return}if(z.value!=null){const d=Math.min(z.value,s);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(s)}px`,e.style.overflow="auto";const h=Math.ceil(d)-r;h!==0&&l<window.scrollY&&window.scrollBy(0,h);return}const p=Math.ceil(((o=e.getBoundingClientRect)==null?void 0:o.call(e).height)||0);if(p>0){const d=Math.min(p,s);e.style.height=`${Math.ceil(d)}px`,e.style.maxHeight=`${Math.ceil(s)}px`,e.style.overflow="auto";const h=Math.ceil(d)-r;h!==0&&l<window.scrollY&&window.scrollBy(0,h);return}const y=Number.parseFloat(e.style.height);if(!Number.isNaN(y)&&y>0){const d=Math.ceil(Math.min(y,s));e.style.height=`${d}px`;const h=d-r;h!==0&&l<window.scrollY&&window.scrollBy(0,h)}else{const d=Math.ceil(s);e.style.height=`${d}px`;const h=d-r;h!==0&&l<window.scrollY&&window.scrollBy(0,h)}e.style.maxHeight=`${Math.ceil(s)}px`,e.style.overflow="auto"}catch(e){}}function Ye(){var n,l;const o=(l=(n=i.monacoOptions)==null?void 0:n.MAX_HEIGHT)!=null?l:500;if(typeof o=="number")return o;const e=String(o).match(/^(\d+(?:\.\d+)?)/);return e?Number.parseFloat(e[1]):500}const se=t.computed(()=>{const o=B.value.trim().toLowerCase();return i.isShowPreview&&(o==="html"||o==="svg")}),j=t.computed(()=>B.value.trim().toLowerCase()==="mermaid");t.watch(()=>i.node.language,o=>{B.value=o}),t.watch(()=>i.node.code,o=>$(null,null,function*(){var e,n;if(i.stream!==!1){if(B.value||(B.value=me(o)),O&&!W.value&&v.value)try{yield ce(v.value)}catch(l){}S.value?oe(String((e=i.node.originalCode)!=null?e:""),String((n=i.node.updatedCode)!=null?n:""),B.value):te(o,B.value),C.value&&b.safeRaf(()=>R())}}));const Ae=t.computed(()=>{const o=B.value.trim().toLowerCase();return b.languageMap[o]||o.charAt(0).toUpperCase()+o.slice(1)}),je=t.computed(()=>{const o=B.value.trim().toLowerCase();return b.getLanguageIcon(o.split(":")[0])}),We=t.computed(()=>{const o={},e=r=>{if(r!=null)return typeof r=="number"?`${r}px`:String(r)},n=e(i.minWidth),l=e(i.maxWidth);return n&&(o.minWidth=n),l&&(o.maxWidth=l),o});function qe(){return $(this,null,function*(){try{typeof navigator!="undefined"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(i.node.code)),D.value=!0,I("copy",i.node.code),setTimeout(()=>{D.value=!1},1e3)}catch(o){console.error("复制失败:",o)}})}function he(o){const e=o;return!e||e.disabled}function F(o,e,n="top"){if(he(o.currentTarget))return;const l=o,r=(l==null?void 0:l.clientX)!=null&&(l==null?void 0:l.clientY)!=null?{x:l.clientX,y:l.clientY}:void 0;b.showTooltipForAnchor(o.currentTarget,e,n,!1,r,i.isDark)}function M(){b.hideTooltip()}function pe(o){if(he(o.currentTarget))return;const e=D.value?a("common.copied")||"Copied":a("common.copy")||"Copy",n=o,l=(n==null?void 0:n.clientX)!=null&&(n==null?void 0:n.clientY)!=null?{x:n.clientX,y:n.clientY}:void 0;b.showTooltipForAnchor(o.currentTarget,e,"top",!1,l,i.isDark)}function Xe(){C.value=!C.value;const o=S.value?T():H(),e=v.value;!o||!e||(C.value?(K(!0),e.style.maxHeight="none",e.style.overflow="visible",R()):(K(!1),e.style.overflow="auto",_()))}function Ue(){var o,e,n;if(E.value=!E.value,E.value){if(v.value){const l=Math.ceil(((e=(o=v.value).getBoundingClientRect)==null?void 0:e.call(o).height)||0);l>0&&(z.value=l)}K(!1)}else{C.value&&K(!0),v.value&&z.value!=null&&(v.value.style.height=`${z.value}px`);const l=S.value?T():H();try{(n=l==null?void 0:l.layout)==null||n.call(l)}catch(r){}ee=2,b.safeRaf(()=>{C.value?R():_()})}}t.watch(()=>f.value,(o,e)=>{const n=S.value?T():H();n&&typeof o=="number"&&Number.isFinite(o)&&o>0&&(n.updateOptions({fontSize:o}),C.value&&!E.value&&R())},{flush:"post",immediate:!1});function Ge(){if(!se.value)return;const o=(B.value||i.node.language).toLowerCase();if(N.value){const e=o==="html"?"text/html":"image/svg+xml",n=o==="html"?a("artifacts.htmlPreviewTitle")||"HTML Preview":a("artifacts.svgPreviewTitle")||"SVG Preview";I("previewCode",{node:i.node,artifactType:e,artifactTitle:n,id:`temp-${o}-${Date.now()}`});return}o==="html"&&(G.value=!G.value)}function K(o){var e,n;try{if(S.value){const l=T();(e=l==null?void 0:l.updateOptions)==null||e.call(l,{automaticLayout:o})}else{const l=H();(n=l==null?void 0:l.updateOptions)==null||n.call(l,{automaticLayout:o})}}catch(l){}}function Ke(o){return $(this,null,function*(){var n,l,r;if(!O)return;S.value?(ne(),q?yield q(o,String((n=i.node.originalCode)!=null?n:""),String((l=i.node.updatedCode)!=null?l:""),B.value):yield O(o,i.node.code,B.value)):yield O(o,i.node.code,B.value);const e=S.value?T():H();if(typeof((r=i.monacoOptions)==null?void 0:r.fontSize)=="number")e==null||e.updateOptions({fontSize:i.monacoOptions.fontSize,automaticLayout:!1}),V.value=i.monacoOptions.fontSize,f.value=i.monacoOptions.fontSize;else{const s=fe();s&&s>0?(V.value=s,f.value=s):(V.value=12,f.value=12)}!C.value&&!E.value&&_(),i.loading===!1&&(yield t.nextTick(),b.safeRaf(()=>{C.value&&!E.value?R():E.value||_()}))})}function ce(o){return O?A||(W.value=!0,A=$(null,null,function*(){yield Ke(o)}).finally(()=>{A=null}),A):null}const ge=t.watch(()=>[v.value,j.value,S.value,i.stream,i.loading,de.value,P.value],p=>$(null,[p],function*([o,e,n,l,r,s,g]){if(!o||!O||!g||l===!1&&r!==!1)return;if(j.value){U(),ge();return}const y=ce(o);y&&(yield y,ge())})),Je=t.watch(()=>[i.darkTheme,i.lightTheme,W.value,P.value],()=>{if(!(!W.value||!P.value)){if(j.value)return Je();Qe()}});function we(){return i.isDark?i.darkTheme:i.lightTheme}function Qe(){const o=we();o&&le(o)}const Ze=t.watch(()=>[i.monacoOptions,P.value],()=>{var n,l;if(!O||!P.value)return;if(j.value)return Ze();const o=S.value?T():H(),e=typeof((n=i.monacoOptions)==null?void 0:n.fontSize)=="number"?i.monacoOptions.fontSize:Number.isFinite(f.value)?f.value:void 0;typeof e=="number"&&Number.isFinite(e)&&e>0&&((l=o==null?void 0:o.updateOptions)==null||l.call(o,{fontSize:e})),C.value&&!E.value?R():E.value||_()},{deep:!0}),J=t.watch(()=>[i.loading,P.value],n=>$(null,[n],function*([o,e]){if(e){if(j.value){t.nextTick(()=>{J==null||J()});return}o||(yield t.nextTick(),b.safeRaf(()=>{E.value||(C.value?R():_()),J()}))}}),{immediate:!0,flush:"post"});return t.onUnmounted(()=>{U()}),(o,e)=>ie.value?(t.openBlock(),t.createBlock(t.unref(b._sfc_main),{key:0,node:m.node,loading:i.loading},null,8,["node","loading"])):(t.openBlock(),t.createElementBlock("div",{key:1,ref_key:"container",ref:w,style:t.normalizeStyle(We.value),class:t.normalizeClass(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[i.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":i.loading,"is-dark":i.isDark}]])},[i.showHeader?(t.openBlock(),t.createElementBlock("div",wt,[t.renderSlot(o.$slots,"header-left",{},()=>[t.createElementVNode("div",yt,[t.createElementVNode("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:je.value},null,8,kt),t.createElementVNode("span",xt,t.toDisplayString(Ae.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":E.value,onClick:Ue,onMouseenter:e[0]||(e[0]=n=>F(n,E.value?t.unref(a)("common.expand")||"Expand":t.unref(a)("common.collapse")||"Collapse")),onFocus:e[1]||(e[1]=n=>F(n,E.value?t.unref(a)("common.expand")||"Expand":t.unref(a)("common.collapse")||"Collapse")),onMouseleave:M,onBlur:M},[(t.openBlock(),t.createElementBlock("svg",{style:t.normalizeStyle({rotate:E.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,Ct),i.showFontSizeButtons&&i.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(f.value)?f.value<=Fe:!1,onClick:e[2]||(e[2]=n=>Re()),onMouseenter:e[3]||(e[3]=n=>F(n,t.unref(a)("common.decrease")||"Decrease")),onFocus:e[4]||(e[4]=n=>F(n,t.unref(a)("common.decrease")||"Decrease")),onMouseleave:M,onBlur:M},[...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,Et),t.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!Oe.value||f.value===V.value,onClick:e[5]||(e[5]=n=>Ie()),onMouseenter:e[6]||(e[6]=n=>F(n,t.unref(a)("common.reset")||"Reset")),onFocus:e[7]||(e[7]=n=>F(n,t.unref(a)("common.reset")||"Reset")),onMouseleave:M,onBlur:M},[...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,Bt),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(f.value)?f.value>=Te:!1,onClick:e[8]||(e[8]=n=>ze()),onMouseenter:e[9]||(e[9]=n=>F(n,t.unref(a)("common.increase")||"Increase")),onFocus:e[10]||(e[10]=n=>F(n,t.unref(a)("common.increase")||"Increase")),onMouseleave:M,onBlur:M},[...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,Mt)],64)):t.createCommentVNode("",!0),i.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":D.value?t.unref(a)("common.copied")||"Copied":t.unref(a)("common.copy")||"Copy",onClick:qe,onMouseenter:e[11]||(e[11]=n=>pe(n)),onFocus:e[12]||(e[12]=n=>pe(n)),onMouseleave:M,onBlur:M},[D.value?(t.openBlock(),t.createElementBlock("svg",Vt,[...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",St,[...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,Nt)):t.createCommentVNode("",!0),i.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:Xe,onMouseenter:e[13]||(e[13]=n=>F(n,C.value?t.unref(a)("common.collapse")||"Collapse":t.unref(a)("common.expand")||"Expand")),onFocus:e[14]||(e[14]=n=>F(n,C.value?t.unref(a)("common.collapse")||"Collapse":t.unref(a)("common.expand")||"Expand")),onMouseleave:M,onBlur:M},[C.value?(t.openBlock(),t.createElementBlock("svg",Tt,[...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",Dt,[...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,Ft)):t.createCommentVNode("",!0),se.value&&i.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(a)("common.preview")||"Preview",onClick:Ge,onMouseenter:e[15]||(e[15]=n=>F(n,t.unref(a)("common.preview")||"Preview")),onFocus:e[16]||(e[16]=n=>F(n,t.unref(a)("common.preview")||"Preview")),onMouseleave:M,onBlur:M},[...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,Ht)):t.createCommentVNode("",!0)])],!0)])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",{ref_key:"codeEditor",ref:v,class:t.normalizeClass(["code-editor-container",[m.stream?"":"code-height-placeholder"]])},null,2),[[t.vShow,!E.value&&(m.stream?!0:!m.loading)]]),G.value&&!N.value&&se.value&&B.value.trim().toLowerCase()==="html"?(t.openBlock(),t.createBlock(gt,{key:1,code:m.node.code,"is-dark":i.isDark,"on-close":()=>G.value=!1},null,8,["code","is-dark","on-close"])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",Lt,[t.renderSlot(o.$slots,"loading",{loading:m.loading,stream:m.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,!m.stream&&m.loading]]),t.createElementVNode("span",Pt,t.toDisplayString(D.value?t.unref(a)("common.copied")||"Copied":""),1)],6))}}),Z=b._export_sfc(Ot,[["__scopeId","data-v-d44250c0"]]);Z.install=m=>{m.component(Z.__name,Z)};exports.default=Z;
|