markstream-vue 0.0.5-beta.0 → 0.0.5-beta.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.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +91 -1
- package/dist/index.js +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/index4.js +1 -1
- package/dist/index6.js +1 -0
- package/dist/tailwind.ts +0 -0
- package/package.json +8 -4
package/dist/index4.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.defineProperties,o=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,r=(e,t)=>{for(var o in t||(t={}))l.call(t,o)&&a(e,o,t[o]);if(n)for(var o of n(t))i.call(t,o)&&a(e,o,t[o]);return e},u=(e,n)=>t(e,o(n)),s=(e,t,o)=>new Promise((n,l)=>{var i=e=>{try{r(o.next(e))}catch(t){l(t)}},a=e=>{try{r(o.throw(e))}catch(t){l(t)}},r=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);r((o=o.apply(e,t)).next())});import{defineComponent as c,computed as d,onMounted as v,onUnmounted as m,createBlock as p,openBlock as h,Teleport as f,createElementVNode as w,normalizeClass as g,withModifiers as y,toDisplayString as b,unref as k,getCurrentInstance as x,ref as M,watch as C,onBeforeUnmount as B,nextTick as S,createElementBlock as O,normalizeStyle as _,createCommentVNode as F,withDirectives as P,renderSlot as E,Fragment as N,vShow as T}from"vue";import{u as z,_ as H,n as $,r as j,a as D,g as L,l as Y,b as W,c as V,s as I,h as R}from"./exports.js";import{s as q}from"./safeRaf.js";const X={class:"markstream-vue"},A={class:"html-preview-frame__header"},G={class:"html-preview-frame__title"},J={class:"html-preview-frame__label"},U=["srcdoc"],K=/* @__PURE__ */H(/* @__PURE__ */c({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(e){const t=e,{t:o}=z(),n=d(()=>{const e=t.code||"",o=e.trim().toLowerCase();return o.startsWith("<!doctype")||o.startsWith("<html")||o.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`});function l(e){var o;"Escape"!==e.key&&"Esc"!==e.key||null==(o=t.onClose)||o.call(t)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",l)}),m(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",l)}),(e,l)=>(h(),p(f,{to:"body"},[w("div",X,[w("div",{class:g(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":t.isDark}]),onClick:l[2]||(l[2]=e=>{var o;return null==(o=t.onClose)?void 0:o.call(t)})},[w("div",{class:g(["html-preview-frame",{"html-preview-frame--dark":t.isDark}]),onClick:l[1]||(l[1]=y(()=>{},["stop"]))},[w("div",A,[w("div",G,[l[3]||(l[3]=w("span",{class:"html-preview-frame__dot"},null,-1)),w("span",J,b(t.title||k(o)("common.preview")||"Preview"),1)]),w("button",{type:"button",class:g(["html-preview-frame__close",{"html-preview-frame__close--dark":t.isDark}]),onClick:l[0]||(l[0]=e=>{var o;return null==(o=t.onClose)?void 0:o.call(t)})}," × ",2)]),w("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:n.value},null,8,U)],2)],2)])]))}}),[["__scopeId","data-v-296dd89d"]]),Q={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)"}},Z={class:"flex items-center gap-x-2 flex-1 overflow-hidden"},ee=["innerHTML"],te={class:"text-sm font-medium font-mono truncate"},oe={class:"flex items-center gap-x-2"},ne=["aria-pressed"],le=["disabled"],ie=["disabled"],ae=["disabled"],re=["aria-label"],ue={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"},se={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"},ce=["aria-pressed"],de={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"},ve={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"},me=["aria-label"],pe={class:"code-editor-layer"},he={class:"code-loading-placeholder"},fe={class:"sr-only","aria-live":"polite",role:"status"},we="__markstreamMonacoPassiveTouch__",ge=/* @__PURE__ */H(/* @__PURE__ */c({__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(e,{emit:t}){var o;const n=e,l=t;"undefined"!=typeof window&&function(){var e;try{const t=window;if(t[we])return;const o=null==(e=window.Element)?void 0:e.prototype,n=null==o?void 0:o.addEventListener;if(!o||!n)return;o.addEventListener=function(e,t,o){return"touchstart"===e&&function(e,t){if(!e)return!1;const o=e;return!("function"!=typeof o.closest||!o.closest(".monaco-editor, .monaco-diff-editor")||t&&"object"==typeof t&&"passive"in t)}(this,o)?n.call(this,e,t,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(r({},e),{passive:!0}):{passive:!0}}(o)):n.call(this,e,t,o)},t[we]=!0}catch(t){}}();const i=x(),a=d(()=>{const e=null==i?void 0:i.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:c}=z(),v=M(null),f=M(null),y=M(!1),H=M($(n.node.language)),X=d(()=>j(H.value)),A=M(!1),G=M(!1),J=M(!1),U=M(!1),ge=M(!1),ye=M(null);let be=0;const ke=D(),xe=M(null),Me=M("undefined"==typeof window);"undefined"!=typeof window&&C(()=>f.value,e=>{var t;if(null==(t=xe.value)||t.destroy(),xe.value=null,!e)return void(Me.value=!1);const o=ke(e,{rootMargin:"400px"});xe.value=o,Me.value=o.isVisible.value,o.whenVisible.then(()=>{Me.value=!0})},{immediate:!0}),B(()=>{var e;null==(e=xe.value)||e.destroy(),xe.value=null});let Ce=null,Be=null,Se=()=>{},Oe=()=>{},_e=()=>null,Fe=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Pe=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ee=()=>{},Ne=()=>{},Te=null,ze=()=>{var e;return String(null!=(e=n.node.language)?e:"plaintext")},He=()=>s(null,null,function*(){}),$e=null,je=null,De=null,Le=null,Ye=null;const We=d(()=>n.node.diff),Ve=M(!1),Ie=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.wordWrap;return null==t||"off"!==String(t)}),Re=d(()=>"undefined"!=typeof window&&!Ve.value&&!U.value),qe=M(!1);"undefined"!=typeof window&&s(null,null,function*(){try{const e=yield L();if(!e)return void(Ve.value=!0);const t=e.useMonaco,o=e.detectLanguage;if("function"==typeof o&&(ze=o),"function"==typeof t){const e=kt();if(e&&n.themes&&Array.isArray(n.themes)&&!n.themes.includes(e))throw new Error("Preferred theme not in provided themes array");const o=t(u(r({wordWrap:"on",wrappingIndent:"same",themes:n.themes,theme:e},n.monacoOptions||{}),{onThemeChange(){nt()}}));Ce=o.createEditor||Ce,Be=o.createDiffEditor||Be,Se=o.updateCode||Se,Oe=o.updateDiff||Oe,_e=o.getEditor||_e,Fe=o.getEditorView||Fe,Pe=o.getDiffEditorView||Pe,Ee=o.cleanupEditor||Ee,Ne=o.safeClean||o.cleanupEditor||Ne,He=o.setTheme||He,ge.value=!0,v.value&&(yield yt(v.value))}}catch(e){Ve.value=!0}});const Xe=M("number"==typeof(null==(o=n.monacoOptions)?void 0:o.fontSize)?n.monacoOptions.fontSize:Number.NaN),Ae=M(Xe.value),Ge=d(()=>{const e=Xe.value,t=Ae.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof t&&Number.isFinite(t)&&t>0}),Je=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const o=Ae.value;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:12}),Ue=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.lineHeight;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:Math.round(1.5*Je.value)}),Ke=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.tabSize;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:4}),Qe=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.fontFamily;return r({fontSize:`${Je.value}px`,lineHeight:`${Ue.value}px`,tabSize:Ke.value},"string"==typeof t&&t.trim()?{"--markstream-code-font-family":t.trim()}:{})});function Ze(){var e,t,o,n,l;try{const i=We.value?null!=(o=null==(t=null==(e=Pe())?void 0:e.getModifiedEditor)?void 0:t.call(e))?o:Pe():Fe(),a=_e(),r=null==(n=null==a?void 0:a.EditorOption)?void 0:n.fontInfo;if(i&&null!=r){const e=null==(l=i.getOption)?void 0:l.call(i,r),t=null==e?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t}}catch(i){}try{const e=v.value;if(e){const t=e.querySelector(".view-lines .view-line");if(t)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(t).fontSize,o=e&&e.match(/^(\d+(?:\.\d+)?)/);if(o)return Number.parseFloat(o[1])}}catch(i){}}}catch(i){}return null}function et(e){var t,o;try{const n=_e(),l=null==(t=null==n?void 0:n.EditorOption)?void 0:t.lineHeight;if(null!=l){const t=null==(o=null==e?void 0:e.getOption)?void 0:o.call(e,l);if("number"==typeof t&&t>0)return t}}catch(i){}const n=function(){try{const e=v.value;if(!e)return null;const t=e.querySelector(".view-lines .view-line");if(t){const e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch(i){}return null}();if(n&&n>0)return n;const l=Number.isFinite(Ae.value)&&Ae.value>0?Ae.value:12;return Math.max(12,Math.round(1.35*l))}function tt(){var e;if(Number.isFinite(Ae.value)&&Ae.value>0&&Number.isFinite(Xe.value))return Ae.value;const t=Ze();return"number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?(Xe.value=n.monacoOptions.fontSize,Ae.value=n.monacoOptions.fontSize,Ae.value):t&&t>0?(Xe.value=t,Ae.value=t,t):(Xe.value=12,Ae.value=12,12)}function ot(){var e,t,o,n,l,i,a,r,u,s,c,d,v,m;try{const p=We.value?Pe():Fe();if(!p)return null;if(We.value&&(null==p?void 0:p.getOriginalEditor)&&(null==p?void 0:p.getModifiedEditor)){const v=null==(e=p.getOriginalEditor)?void 0:e.call(p),m=null==(t=p.getModifiedEditor)?void 0:t.call(p);null==(o=null==v?void 0:v.layout)||o.call(v),null==(n=null==m?void 0:m.layout)||n.call(m);const h=(null==(l=null==v?void 0:v.getContentHeight)?void 0:l.call(v))||0,f=(null==(i=null==m?void 0:m.getContentHeight)?void 0:i.call(m))||0,w=Math.max(h,f);if(w>0)return Math.ceil(w+1);const g=(null==(u=null==(r=null==(a=null==v?void 0:v.getModel)?void 0:a.call(v))?void 0:r.getLineCount)?void 0:u.call(r))||1,y=(null==(d=null==(c=null==(s=null==m?void 0:m.getModel)?void 0:s.call(m))?void 0:c.getLineCount)?void 0:d.call(c))||1,b=Math.max(g,y),k=Math.max(et(v),et(m));return Math.ceil(b*(k+1.5)+0+1)}if(null==p?void 0:p.getContentHeight){null==(v=null==p?void 0:p.layout)||v.call(p);const e=p.getContentHeight();if(e>0)return Math.ceil(e+1)}const h=null==(m=null==p?void 0:p.getModel)?void 0:m.call(p);let f=1;h&&"function"==typeof h.getLineCount&&(f=h.getLineCount());const w=et(p);return Math.ceil(f*(w+1.5)+0+1)}catch(p){return null}}function nt(){var e,t,o;const n=v.value,l=f.value;if(!n||!l)return;const i=n.querySelector(".monaco-editor")||n;let a=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(a=window.getComputedStyle(i))}catch(c){a=null}const r=String(null!=(e=null==a?void 0:a.getPropertyValue("--vscode-editor-foreground"))?e:""),u=String(null!=(t=null==a?void 0:a.getPropertyValue("--vscode-editor-background"))?t:""),s=String(null!=(o=null==a?void 0:a.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?o:"");return r&&u?(l.style.setProperty("--vscode-editor-foreground",r.trim()),l.style.setProperty("--vscode-editor-background",u.trim()),l.style.setProperty("--vscode-editor-selectionBackground",s.trim()),!0):void 0}function lt(){try{const e=v.value;if(!e)return;const t=e.getBoundingClientRect(),o=window.scrollY+t.top,n=ot();if(null!=n&&n>0){const l=t.height;e.style.height=`${Math.ceil(n)}px`,e.style.maxHeight="none";const i=Math.ceil(n)-l;0!==i&&o<window.scrollY&&window.scrollBy(0,i)}}catch(e){}}function it(){var e;try{const t=v.value;if(!t)return;const o=t.getBoundingClientRect(),l=window.scrollY+o.top,i=o.height,a=function(){var e,t;const o=null!=(t=null==(e=n.monacoOptions)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof o)return o;const l=String(o).match(/^(\d+(?:\.\d+)?)/);return l?Number.parseFloat(l[1]):500}();if(be>0&&(be--,null!=ye.value)){const e=Math.min(ye.value,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const r=ot();if(null!=r&&r>0){const e=Math.min(r,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}if(null!=ye.value){const e=Math.min(ye.value,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const u=Math.ceil((null==(e=t.getBoundingClientRect)?void 0:e.call(t).height)||0);if(u>0){const e=Math.min(u,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const s=Number.parseFloat(t.style.height);if(!Number.isNaN(s)&&s>0){const e=Math.ceil(Math.min(s,a));t.style.height=`${e}px`;const o=e-i;0!==o&&l<window.scrollY&&window.scrollBy(0,o)}else{const e=Math.ceil(a);t.style.height=`${e}px`;const o=e-i;0!==o&&l<window.scrollY&&window.scrollBy(0,o)}t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto"}catch(t){}}const at=d(()=>n.isShowPreview&&("html"===H.value||"svg"===H.value));C(()=>n.node.language,e=>{H.value=$(e)}),C(()=>n.node.code,e=>s(null,null,function*(){var t,o;if(!1!==n.stream){if(H.value||(H.value=$(ze(e))),Ce&&!J.value&&v.value)try{yield yt(v.value)}catch(l){}We.value?Oe(String(null!=(t=n.node.originalCode)?t:""),String(null!=(o=n.node.updatedCode)?o:""),X.value):Se(e,X.value),A.value&&q(()=>lt())}}));const rt=d(()=>{const e=H.value;return e?Y[e]||e.charAt(0).toUpperCase()+e.slice(1):Y[""]||"Plain Text"}),ut=d(()=>W(H.value||"")),st=d(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=t(n.minWidth),l=t(n.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e});function ct(){return s(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(n.node.code)),y.value=!0,l("copy",n.node.code),setTimeout(()=>{y.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function dt(e){return!e||e.disabled}function vt(e,t,o="top"){if(dt(e.currentTarget))return;const l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;I(e.currentTarget,t,o,!1,i,n.isDark)}function mt(){R()}function pt(e){if(dt(e.currentTarget))return;const t=y.value?c("common.copied")||"Copied":c("common.copy")||"Copy",o=e,l=null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0;I(e.currentTarget,t,"top",!1,l,n.isDark)}function ht(){A.value=!A.value;const e=We.value?Pe():Fe(),t=v.value;e&&t&&(A.value?(gt(!0),t.style.maxHeight="none",t.style.overflow="visible",lt()):(gt(!1),t.style.overflow="auto",it()))}function ft(){var e,t,o;if(G.value=!G.value,G.value){if(v.value){const o=Math.ceil((null==(t=(e=v.value).getBoundingClientRect)?void 0:t.call(e).height)||0);o>0&&(ye.value=o)}gt(!1)}else{A.value&>(!0),v.value&&null!=ye.value&&(v.value.style.height=`${ye.value}px`);const e=We.value?Pe():Fe();try{null==(o=null==e?void 0:e.layout)||o.call(e)}catch(n){}be=2,q(()=>{A.value?lt():it()})}}function wt(){if(!at.value)return;const e=H.value;if(a.value){const t="html"===e?"text/html":"image/svg+xml",o="html"===e?c("artifacts.htmlPreviewTitle")||"HTML Preview":c("artifacts.svgPreviewTitle")||"SVG Preview";return void l("previewCode",{node:n.node,artifactType:t,artifactTitle:o,id:`temp-${e}-${Date.now()}`})}"html"===e&&(qe.value=!qe.value)}function gt(e){var t,o;try{if(We.value){const o=Pe();null==(t=null==o?void 0:o.updateOptions)||t.call(o,{automaticLayout:e})}else{const t=Fe();null==(o=null==t?void 0:t.updateOptions)||o.call(t,{automaticLayout:e})}}catch(n){}}function yt(e){if(!Ce)return null;if(Te)return Te;J.value=!0;const t=s(null,null,function*(){yield function(e){return s(this,null,function*(){var t,o,l;if(!Ce)return;We.value?(Ne(),Be?yield Be(e,String(null!=(t=n.node.originalCode)?t:""),String(null!=(o=n.node.updatedCode)?o:""),X.value):yield Ce(e,n.node.code,X.value)):yield Ce(e,n.node.code,X.value);const i=We.value?Pe():Fe();if("number"==typeof(null==(l=n.monacoOptions)?void 0:l.fontSize))null==i||i.updateOptions({fontSize:n.monacoOptions.fontSize,automaticLayout:!1}),Xe.value=n.monacoOptions.fontSize,Ae.value=n.monacoOptions.fontSize;else{const e=Ze();e&&e>0?(Xe.value=e,Ae.value=e):(Xe.value=12,Ae.value=12)}A.value||G.value||it(),!1===n.loading&&(yield S(),q(()=>{A.value&&!G.value?lt():G.value||it()})),yield S(),U.value=!0,nt()})}(e)});return Te=t.finally(()=>{Te=null}),Te}C(()=>Ae.value,(e,t)=>{const o=We.value?Pe():Fe();o&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(o.updateOptions({fontSize:e}),A.value&&!G.value&<())},{flush:"post",immediate:!1});const bt=C(()=>[v.value,We.value,n.stream,n.loading,ge.value,Me.value],e=>s(null,[e],function*([e,t,o,n,l,i]){if(!e||!Ce)return;if(!i)return;if(!1===o&&!1!==n)return;const a=yt(e);if(a){try{yield a}catch(r){U.value=!1}bt()}}));function kt(){return n.isDark?n.darkTheme:n.lightTheme}C(()=>[n.darkTheme,n.lightTheme,J.value,Me.value],()=>{J.value&&Me.value&&function(){const e=kt();e&&function(e){const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&"name"in e)return String(e.name);try{return JSON.stringify(e)}catch(t){return String(e)}}(e);t&&($e||Ye!==t)?$e?Le===t||je===t||(De=e,Le=t):(De=e,Le=t,$e=s(null,null,function*(){for(;Le&&null!=De;){const t=De,o=Le;if(De=null,Le=null,Ye!==o)try{je=o,yield He(t),Ye=o}catch(e){}}}).finally(()=>{$e=null,je=null})):Promise.resolve()}(e)}()}),C(()=>[n.monacoOptions,Me.value],()=>{var e,t;if(!Ce||!Me.value)return;const o=We.value?Pe():Fe(),l="number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?n.monacoOptions.fontSize:Number.isFinite(Ae.value)?Ae.value:void 0;"number"==typeof l&&Number.isFinite(l)&&l>0&&(null==(t=null==o?void 0:o.updateOptions)||t.call(o,{fontSize:l})),A.value&&!G.value?lt():G.value||it()},{deep:!0});const xt=C(()=>[n.loading,Me.value],e=>s(null,[e],function*([e,t]){t&&(e||(yield S(),q(()=>{G.value||(A.value?lt():it()),xt()})))}),{immediate:!0,flush:"post"});return m(()=>{Ee()}),(t,o)=>Ve.value?(h(),p(k(V),{key:0,node:e.node,loading:n.loading},null,8,["node","loading"])):(h(),O("div",{key:1,ref_key:"container",ref:f,style:_(st.value),class:g(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[n.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":n.loading,"is-dark":n.isDark}]])},[n.showHeader?(h(),O("div",Q,[E(t.$slots,"header-left",{},()=>[w("div",Z,[w("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:ut.value},null,8,ee),w("span",te,b(rt.value),1)])],!0),E(t.$slots,"header-right",{},()=>[w("div",oe,[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":G.value,onClick:ft,onMouseenter:o[0]||(o[0]=e=>vt(e,G.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onFocus:o[1]||(o[1]=e=>vt(e,G.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onMouseleave:mt,onBlur:mt},[(h(),O("svg",{style:_({rotate:G.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"},[...o[17]||(o[17]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ne),n.showFontSizeButtons&&n.enableFontSizeControl?(h(),O(N,{key:0},[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(Ae.value)&&Ae.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=tt(),t=Math.max(10,e-1);Ae.value=t}()),onMouseenter:o[3]||(o[3]=e=>vt(e,k(c)("common.decrease")||"Decrease")),onFocus:o[4]||(o[4]=e=>vt(e,k(c)("common.decrease")||"Decrease")),onMouseleave:mt,onBlur:mt},[...o[18]||(o[18]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,le),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!Ge.value||Ae.value===Xe.value,onClick:o[5]||(o[5]=e=>(tt(),void(Number.isFinite(Xe.value)&&(Ae.value=Xe.value)))),onMouseenter:o[6]||(o[6]=e=>vt(e,k(c)("common.reset")||"Reset")),onFocus:o[7]||(o[7]=e=>vt(e,k(c)("common.reset")||"Reset")),onMouseleave:mt,onBlur:mt},[...o[19]||(o[19]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),w("path",{d:"M3 3v5h5"})])],-1)])],40,ie),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(Ae.value)&&Ae.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=tt(),t=Math.min(36,e+1);Ae.value=t}()),onMouseenter:o[9]||(o[9]=e=>vt(e,k(c)("common.increase")||"Increase")),onFocus:o[10]||(o[10]=e=>vt(e,k(c)("common.increase")||"Increase")),onMouseleave:mt,onBlur:mt},[...o[20]||(o[20]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,ae)],64)):F("",!0),n.showCopyButton?(h(),O("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":y.value?k(c)("common.copied")||"Copied":k(c)("common.copy")||"Copy",onClick:ct,onMouseenter:o[11]||(o[11]=e=>pt(e)),onFocus:o[12]||(o[12]=e=>pt(e)),onMouseleave:mt,onBlur:mt},[y.value?(h(),O("svg",se,[...o[22]||(o[22]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(h(),O("svg",ue,[...o[21]||(o[21]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("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,re)):F("",!0),n.showExpandButton?(h(),O("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":A.value,onClick:ht,onMouseenter:o[13]||(o[13]=e=>vt(e,A.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onFocus:o[14]||(o[14]=e=>vt(e,A.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onMouseleave:mt,onBlur:mt},[A.value?(h(),O("svg",de,[...o[23]||(o[23]=[w("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)])])):(h(),O("svg",ve,[...o[24]||(o[24]=[w("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,ce)):F("",!0),at.value&&n.showPreviewButton?(h(),O("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":k(c)("common.preview")||"Preview",onClick:wt,onMouseenter:o[15]||(o[15]=e=>vt(e,k(c)("common.preview")||"Preview")),onFocus:o[16]||(o[16]=e=>vt(e,k(c)("common.preview")||"Preview")),onMouseleave:mt,onBlur:mt},[...o[25]||(o[25]=[w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[w("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[w("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"}),w("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,me)):F("",!0)])],!0)])):F("",!0),P(w("div",pe,[w("div",{ref_key:"codeEditor",ref:v,class:g(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Re.value}]])},null,2),Re.value?(h(),p(k(V),{key:0,class:g(["code-pre-fallback",{"is-wrap":Ie.value}]),style:_(Qe.value),node:e.node},null,8,["class","style","node"])):F("",!0)],512),[[T,!(G.value||!e.stream&&e.loading)]]),qe.value&&!a.value&&at.value&&"html"===H.value?(h(),p(K,{key:1,code:e.node.code,"is-dark":n.isDark,"on-close":()=>qe.value=!1},null,8,["code","is-dark","on-close"])):F("",!0),P(w("div",he,[E(t.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[26]||(o[26]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))],!0)],512),[[T,!e.stream&&e.loading]]),w("span",fe,b(y.value?k(c)("common.copied")||"Copied":""),1)],6))}}),[["__scopeId","data-v-82add932"]]);ge.install=e=>{e.component(ge.__name,ge)};export{ge as default};
|
|
1
|
+
var e=Object.defineProperty,t=Object.defineProperties,o=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,r=(e,t)=>{for(var o in t||(t={}))l.call(t,o)&&a(e,o,t[o]);if(n)for(var o of n(t))i.call(t,o)&&a(e,o,t[o]);return e},u=(e,n)=>t(e,o(n)),s=(e,t,o)=>new Promise((n,l)=>{var i=e=>{try{r(o.next(e))}catch(t){l(t)}},a=e=>{try{r(o.throw(e))}catch(t){l(t)}},r=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);r((o=o.apply(e,t)).next())});import{defineComponent as c,computed as d,onMounted as v,onUnmounted as m,createBlock as p,openBlock as h,Teleport as f,createElementVNode as w,normalizeClass as g,withModifiers as y,toDisplayString as b,unref as k,getCurrentInstance as x,ref as M,watch as C,onBeforeUnmount as B,nextTick as S,createElementBlock as O,normalizeStyle as _,createCommentVNode as F,withDirectives as P,renderSlot as E,Fragment as N,vShow as T}from"vue";import{u as z,_ as H,n as $,r as j,a as D,g as L,l as Y,b as W,c as V,s as q,h as I}from"./exports.js";import{s as R}from"./safeRaf.js";const X={class:"markstream-vue"},A={class:"html-preview-frame__header"},G={class:"html-preview-frame__title"},J={class:"html-preview-frame__label"},U=["srcdoc"],K=/* @__PURE__ */H(/* @__PURE__ */c({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(e){const t=e,{t:o}=z(),n=d(()=>{const e=t.code||"",o=e.trim().toLowerCase();return o.startsWith("<!doctype")||o.startsWith("<html")||o.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`});function l(e){var o;"Escape"!==e.key&&"Esc"!==e.key||null==(o=t.onClose)||o.call(t)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",l)}),m(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",l)}),(e,l)=>(h(),p(f,{to:"body"},[w("div",X,[w("div",{class:g(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":t.isDark}]),onClick:l[2]||(l[2]=e=>{var o;return null==(o=t.onClose)?void 0:o.call(t)})},[w("div",{class:g(["html-preview-frame",{"html-preview-frame--dark":t.isDark}]),onClick:l[1]||(l[1]=y(()=>{},["stop"]))},[w("div",A,[w("div",G,[l[3]||(l[3]=w("span",{class:"html-preview-frame__dot"},null,-1)),w("span",J,b(t.title||k(o)("common.preview")||"Preview"),1)]),w("button",{type:"button",class:g(["html-preview-frame__close",{"html-preview-frame__close--dark":t.isDark}]),onClick:l[0]||(l[0]=e=>{var o;return null==(o=t.onClose)?void 0:o.call(t)})}," × ",2)]),w("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:n.value},null,8,U)],2)],2)])]))}}),[["__scopeId","data-v-296dd89d"]]);let Q=null,Z=null,ee=null,te=null,oe=null,ne=null;const le=/* @__PURE__ */new WeakMap;let ie=0;const ae={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, var(--markstream-code-fallback-fg))","background-color":"var(--vscode-editor-background, var(--markstream-code-fallback-bg))"}},re={class:"flex items-center gap-x-2 flex-1 overflow-hidden"},ue=["innerHTML"],se={class:"text-sm font-medium font-mono truncate"},ce={class:"flex items-center gap-x-2"},de=["aria-pressed"],ve=["disabled"],me=["disabled"],pe=["disabled"],he=["aria-label"],fe={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"},we={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"},ge=["aria-pressed"],ye={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"},be={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"},ke=["aria-label"],xe={class:"code-editor-layer"},Me={class:"code-loading-placeholder"},Ce={class:"sr-only","aria-live":"polite",role:"status"},Be="__markstreamMonacoPassiveTouch__",Se=/* @__PURE__ */H(/* @__PURE__ */c({__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(e,{emit:t}){var o;const n=e,l=t;"undefined"!=typeof window&&function(){var e;try{const t=window;if(t[Be])return;const o=null==(e=window.Element)?void 0:e.prototype,n=null==o?void 0:o.addEventListener;if(!o||!n)return;o.addEventListener=function(e,t,o){return"touchstart"===e&&function(e,t){if(!e)return!1;const o=e;return!("function"!=typeof o.closest||!o.closest(".monaco-editor, .monaco-diff-editor")||t&&"object"==typeof t&&"passive"in t)}(this,o)?n.call(this,e,t,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(r({},e),{passive:!0}):{passive:!0}}(o)):n.call(this,e,t,o)},t[Be]=!0}catch(t){}}();const i=x(),a=d(()=>{const e=null==i?void 0:i.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:c}=z(),v=M(null),f=M(null),y=M(!1),H=M($(n.node.language)),X=d(()=>j(H.value)),A=M(!1),G=M(!1),J=M(!1),U=M(!1),Se=M(!1),Oe=M(null);let _e=0;const Fe=D(),Pe=M(null),Ee=M("undefined"==typeof window);"undefined"!=typeof window&&C(()=>f.value,e=>{var t;if(null==(t=Pe.value)||t.destroy(),Pe.value=null,!e)return void(Ee.value=!1);const o=Fe(e,{rootMargin:"400px"});Pe.value=o,Ee.value=o.isVisible.value,o.whenVisible.then(()=>{Ee.value=!0})},{immediate:!0}),B(()=>{var e;null==(e=Pe.value)||e.destroy(),Pe.value=null});let Ne=null,Te=null,ze=()=>{},He=()=>{},$e=()=>null,je=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),De=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Le=()=>{},Ye=()=>{},We=null,Ve=()=>{var e;return String(null!=(e=n.node.language)?e:"plaintext")},qe=()=>s(null,null,function*(){});const Ie=d(()=>n.node.diff),Re=M(!1),Xe=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.wordWrap;return null==t||"off"!==String(t)}),Ae=d(()=>"undefined"!=typeof window&&!Re.value&&!U.value),Ge=M(!1);"undefined"!=typeof window&&s(null,null,function*(){try{const e=yield L();if(!e)return void(Re.value=!0);const t=e.useMonaco,o=e.detectLanguage;if("function"==typeof o&&(Ve=o),"function"==typeof t){const e=Ct();if(e&&n.themes&&Array.isArray(n.themes)&&!n.themes.includes(e))throw new Error("Preferred theme not in provided themes array");const o=t(u(r({wordWrap:"on",wrappingIndent:"same",themes:n.themes,theme:e},n.monacoOptions||{}),{onThemeChange(){at()}}));Ne=o.createEditor||Ne,Te=o.createDiffEditor||Te,ze=o.updateCode||ze,He=o.updateDiff||He,$e=o.getEditor||$e,je=o.getEditorView||je,De=o.getDiffEditorView||De,Le=o.cleanupEditor||Le,Ye=o.safeClean||o.cleanupEditor||Ye,qe=o.setTheme||qe,Se.value=!0,v.value&&(yield xt(v.value))}}catch(e){Re.value=!0}});const Je=M("number"==typeof(null==(o=n.monacoOptions)?void 0:o.fontSize)?n.monacoOptions.fontSize:Number.NaN),Ue=M(Je.value),Ke=d(()=>{const e=Je.value,t=Ue.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof t&&Number.isFinite(t)&&t>0}),Qe=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const o=Ue.value;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:12}),Ze=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.lineHeight;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:Math.round(1.5*Qe.value)}),et=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.tabSize;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:4}),tt=d(()=>{var e;const t=null==(e=n.monacoOptions)?void 0:e.fontFamily;return r({fontSize:`${Qe.value}px`,lineHeight:`${Ze.value}px`,tabSize:et.value},"string"==typeof t&&t.trim()?{"--markstream-code-font-family":t.trim()}:{})});function ot(){var e,t,o,n,l;try{const i=Ie.value?null!=(o=null==(t=null==(e=De())?void 0:e.getModifiedEditor)?void 0:t.call(e))?o:De():je(),a=$e(),r=null==(n=null==a?void 0:a.EditorOption)?void 0:n.fontInfo;if(i&&null!=r){const e=null==(l=i.getOption)?void 0:l.call(i,r),t=null==e?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t}}catch(i){}try{const e=v.value;if(e){const t=e.querySelector(".view-lines .view-line");if(t)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(t).fontSize,o=e&&e.match(/^(\d+(?:\.\d+)?)/);if(o)return Number.parseFloat(o[1])}}catch(i){}}}catch(i){}return null}function nt(e){var t,o;try{const n=$e(),l=null==(t=null==n?void 0:n.EditorOption)?void 0:t.lineHeight;if(null!=l){const t=null==(o=null==e?void 0:e.getOption)?void 0:o.call(e,l);if("number"==typeof t&&t>0)return t}}catch(i){}const n=function(){try{const e=v.value;if(!e)return null;const t=e.querySelector(".view-lines .view-line");if(t){const e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch(i){}return null}();if(n&&n>0)return n;const l=Number.isFinite(Ue.value)&&Ue.value>0?Ue.value:12;return Math.max(12,Math.round(1.35*l))}function lt(){var e;if(Number.isFinite(Ue.value)&&Ue.value>0&&Number.isFinite(Je.value))return Ue.value;const t=ot();return"number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?(Je.value=n.monacoOptions.fontSize,Ue.value=n.monacoOptions.fontSize,Ue.value):t&&t>0?(Je.value=t,Ue.value=t,t):(Je.value=12,Ue.value=12,12)}function it(){var e,t,o,n,l,i,a,r,u,s,c,d,v,m;try{const p=Ie.value?De():je();if(!p)return null;if(Ie.value&&(null==p?void 0:p.getOriginalEditor)&&(null==p?void 0:p.getModifiedEditor)){const v=null==(e=p.getOriginalEditor)?void 0:e.call(p),m=null==(t=p.getModifiedEditor)?void 0:t.call(p);null==(o=null==v?void 0:v.layout)||o.call(v),null==(n=null==m?void 0:m.layout)||n.call(m);const h=(null==(l=null==v?void 0:v.getContentHeight)?void 0:l.call(v))||0,f=(null==(i=null==m?void 0:m.getContentHeight)?void 0:i.call(m))||0,w=Math.max(h,f);if(w>0)return Math.ceil(w+1);const g=(null==(u=null==(r=null==(a=null==v?void 0:v.getModel)?void 0:a.call(v))?void 0:r.getLineCount)?void 0:u.call(r))||1,y=(null==(d=null==(c=null==(s=null==m?void 0:m.getModel)?void 0:s.call(m))?void 0:c.getLineCount)?void 0:d.call(c))||1,b=Math.max(g,y),k=Math.max(nt(v),nt(m));return Math.ceil(b*(k+1.5)+0+1)}if(null==p?void 0:p.getContentHeight){null==(v=null==p?void 0:p.layout)||v.call(p);const e=p.getContentHeight();if(e>0)return Math.ceil(e+1)}const h=null==(m=null==p?void 0:p.getModel)?void 0:m.call(p);let f=1;h&&"function"==typeof h.getLineCount&&(f=h.getLineCount());const w=nt(p);return Math.ceil(f*(w+1.5)+0+1)}catch(p){return null}}function at(){var e,t,o,n,l,i,a,r;const u=v.value,s=f.value;if(!u||!s)return;const c=u.querySelector(".monaco-editor")||u,d=c.querySelector(".monaco-editor-background")||c,m=c.querySelector(".view-lines")||c;let p=null,h=null,w=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(p=window.getComputedStyle(c),h=d===c?p:window.getComputedStyle(d),w=m===c?p:window.getComputedStyle(m))}catch(M){p=null,h=null,w=null}const g=String(null!=(e=null==p?void 0:p.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),y=String(null!=(t=null==p?void 0:p.getPropertyValue("--vscode-editor-background"))?t:"").trim(),b=String(null!=(n=null!=(o=null==p?void 0:p.getPropertyValue("--vscode-editor-selectionBackground"))?o:null==p?void 0:p.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?n:"").trim(),k=g||String(null!=(i=null!=(l=null==w?void 0:w.color)?l:null==p?void 0:p.color)?i:"").trim(),x=y||String(null!=(r=null!=(a=null==h?void 0:h.backgroundColor)?a:null==p?void 0:p.backgroundColor)?r:"").trim();k&&s.style.setProperty("--vscode-editor-foreground",k),x&&s.style.setProperty("--vscode-editor-background",x),b&&s.style.setProperty("--vscode-editor-selectionBackground",b)}function rt(){try{const e=v.value;if(!e)return;const t=e.getBoundingClientRect(),o=window.scrollY+t.top,n=it();if(null!=n&&n>0){const l=t.height;e.style.height=`${Math.ceil(n)}px`,e.style.maxHeight="none";const i=Math.ceil(n)-l;0!==i&&o<window.scrollY&&window.scrollBy(0,i)}}catch(e){}}function ut(){var e;try{const t=v.value;if(!t)return;const o=t.getBoundingClientRect(),l=window.scrollY+o.top,i=o.height,a=function(){var e,t;const o=null!=(t=null==(e=n.monacoOptions)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof o)return o;const l=String(o).match(/^(\d+(?:\.\d+)?)/);return l?Number.parseFloat(l[1]):500}();if(_e>0&&(_e--,null!=Oe.value)){const e=Math.min(Oe.value,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const r=it();if(null!=r&&r>0){const e=Math.min(r,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}if(null!=Oe.value){const e=Math.min(Oe.value,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const u=Math.ceil((null==(e=t.getBoundingClientRect)?void 0:e.call(t).height)||0);if(u>0){const e=Math.min(u,a);t.style.height=`${Math.ceil(e)}px`,t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto";const o=Math.ceil(e)-i;return void(0!==o&&l<window.scrollY&&window.scrollBy(0,o))}const s=Number.parseFloat(t.style.height);if(!Number.isNaN(s)&&s>0){const e=Math.ceil(Math.min(s,a));t.style.height=`${e}px`;const o=e-i;0!==o&&l<window.scrollY&&window.scrollBy(0,o)}else{const e=Math.ceil(a);t.style.height=`${e}px`;const o=e-i;0!==o&&l<window.scrollY&&window.scrollBy(0,o)}t.style.maxHeight=`${Math.ceil(a)}px`,t.style.overflow="auto"}catch(t){}}const st=d(()=>n.isShowPreview&&("html"===H.value||"svg"===H.value));C(()=>n.node.language,e=>{H.value=$(e)}),C(()=>n.node.code,e=>s(null,null,function*(){var t,o;if(!1!==n.stream){if(H.value||(H.value=$(Ve(e))),Ne&&!J.value&&v.value)try{yield xt(v.value)}catch(l){}Ie.value?He(String(null!=(t=n.node.originalCode)?t:""),String(null!=(o=n.node.updatedCode)?o:""),X.value):ze(e,X.value),A.value&&R(()=>rt())}}));const ct=d(()=>{const e=H.value;return e?Y[e]||e.charAt(0).toUpperCase()+e.slice(1):Y[""]||"Plain Text"}),dt=d(()=>W(H.value||"")),vt=d(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=t(n.minWidth),l=t(n.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e});function mt(){return s(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(n.node.code)),y.value=!0,l("copy",n.node.code),setTimeout(()=>{y.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function pt(e){return!e||e.disabled}function ht(e,t,o="top"){if(pt(e.currentTarget))return;const l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;q(e.currentTarget,t,o,!1,i,n.isDark)}function ft(){I()}function wt(e){if(pt(e.currentTarget))return;const t=y.value?c("common.copied")||"Copied":c("common.copy")||"Copy",o=e,l=null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0;q(e.currentTarget,t,"top",!1,l,n.isDark)}function gt(){A.value=!A.value;const e=Ie.value?De():je(),t=v.value;e&&t&&(A.value?(kt(!0),t.style.maxHeight="none",t.style.overflow="visible",rt()):(kt(!1),t.style.overflow="auto",ut()))}function yt(){var e,t,o;if(G.value=!G.value,G.value){if(v.value){const o=Math.ceil((null==(t=(e=v.value).getBoundingClientRect)?void 0:t.call(e).height)||0);o>0&&(Oe.value=o)}kt(!1)}else{A.value&&kt(!0),v.value&&null!=Oe.value&&(v.value.style.height=`${Oe.value}px`);const e=Ie.value?De():je();try{null==(o=null==e?void 0:e.layout)||o.call(e)}catch(n){}_e=2,R(()=>{A.value?rt():ut()})}}function bt(){if(!st.value)return;const e=H.value;if(a.value){const t="html"===e?"text/html":"image/svg+xml",o="html"===e?c("artifacts.htmlPreviewTitle")||"HTML Preview":c("artifacts.svgPreviewTitle")||"SVG Preview";return void l("previewCode",{node:n.node,artifactType:t,artifactTitle:o,id:`temp-${e}-${Date.now()}`})}"html"===e&&(Ge.value=!Ge.value)}function kt(e){var t,o;try{if(Ie.value){const o=De();null==(t=null==o?void 0:o.updateOptions)||t.call(o,{automaticLayout:e})}else{const t=je();null==(o=null==t?void 0:t.updateOptions)||o.call(t,{automaticLayout:e})}}catch(n){}}function xt(e){if(!Ne)return null;if(We)return We;J.value=!0;const t=s(null,null,function*(){yield function(e){return s(this,null,function*(){var t,o,l;if(!Ne)return;Ie.value?(Ye(),Te?yield Te(e,String(null!=(t=n.node.originalCode)?t:""),String(null!=(o=n.node.updatedCode)?o:""),X.value):yield Ne(e,n.node.code,X.value)):yield Ne(e,n.node.code,X.value);const i=Ie.value?De():je();if("number"==typeof(null==(l=n.monacoOptions)?void 0:l.fontSize))null==i||i.updateOptions({fontSize:n.monacoOptions.fontSize,automaticLayout:!1}),Je.value=n.monacoOptions.fontSize,Ue.value=n.monacoOptions.fontSize;else{const e=ot();e&&e>0?(Je.value=e,Ue.value=e):(Je.value=12,Ue.value=12)}A.value||G.value||ut(),!1===n.loading&&(yield S(),R(()=>{A.value&&!G.value?rt():G.value||ut()})),yield S(),U.value=!0,at()})}(e)});return We=t.finally(()=>{We=null}),We}C(()=>Ue.value,(e,t)=>{const o=Ie.value?De():je();o&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(o.updateOptions({fontSize:e}),A.value&&!G.value&&rt())},{flush:"post",immediate:!1});const Mt=C(()=>[v.value,Ie.value,n.stream,n.loading,Se.value,Ee.value],e=>s(null,[e],function*([e,t,o,n,l,i]){if(!e||!Ne)return;if(!i)return;if(!1===o&&!1!==n)return;const a=xt(e);if(a){try{yield a}catch(r){U.value=!1}Mt()}}));function Ct(){return n.isDark?n.darkTheme:n.lightTheme}C(()=>[n.isDark,n.darkTheme,n.lightTheme,Se.value],()=>{Se.value&&function(){const e=Ct();e&&function(e,t){const o=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const o=le.get(e);if(o)return o;try{const t=JSON.stringify(e);if(t)return le.set(e,t),t}catch(t){}const n="__theme_"+ ++ie;return le.set(e,n),n}return String(e)}(t);return o?(ne=e,Q||oe!==o?Q?(te===o||Z===o||(ee=t,te=o),Q):(ee=t,te=o,Q=s(null,null,function*(){for(;te&&null!=ee;){const o=ee,n=te;if(ee=null,te=null,oe!==n)try{Z=n,yield(null!=ne?ne:e)(o),oe=n}catch(t){}}}).finally(()=>{Q=null,Z=null}),Q):Promise.resolve()):Promise.resolve()}(qe,e).then(()=>{U.value&&R(()=>at())})}()}),C(()=>[n.monacoOptions,Ee.value],()=>{var e,t;if(!Ne||!Ee.value)return;const o=Ie.value?De():je(),l="number"==typeof(null==(e=n.monacoOptions)?void 0:e.fontSize)?n.monacoOptions.fontSize:Number.isFinite(Ue.value)?Ue.value:void 0;"number"==typeof l&&Number.isFinite(l)&&l>0&&(null==(t=null==o?void 0:o.updateOptions)||t.call(o,{fontSize:l})),A.value&&!G.value?rt():G.value||ut()},{deep:!0});const Bt=C(()=>[n.loading,Ee.value],e=>s(null,[e],function*([e,t]){t&&(e||(yield S(),R(()=>{G.value||(A.value?rt():ut()),Bt()})))}),{immediate:!0,flush:"post"});return m(()=>{Le()}),(t,o)=>Re.value?(h(),p(k(V),{key:0,node:e.node,loading:n.loading},null,8,["node","loading"])):(h(),O("div",{key:1,ref_key:"container",ref:f,style:_(vt.value),class:g(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[n.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":n.loading,"is-dark":n.isDark}]])},[n.showHeader?(h(),O("div",ae,[E(t.$slots,"header-left",{},()=>[w("div",re,[w("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:dt.value},null,8,ue),w("span",se,b(ct.value),1)])],!0),E(t.$slots,"header-right",{},()=>[w("div",ce,[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":G.value,onClick:yt,onMouseenter:o[0]||(o[0]=e=>ht(e,G.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onFocus:o[1]||(o[1]=e=>ht(e,G.value?k(c)("common.expand")||"Expand":k(c)("common.collapse")||"Collapse")),onMouseleave:ft,onBlur:ft},[(h(),O("svg",{style:_({rotate:G.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"},[...o[17]||(o[17]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,de),n.showFontSizeButtons&&n.enableFontSizeControl?(h(),O(N,{key:0},[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(Ue.value)&&Ue.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=lt(),t=Math.max(10,e-1);Ue.value=t}()),onMouseenter:o[3]||(o[3]=e=>ht(e,k(c)("common.decrease")||"Decrease")),onFocus:o[4]||(o[4]=e=>ht(e,k(c)("common.decrease")||"Decrease")),onMouseleave:ft,onBlur:ft},[...o[18]||(o[18]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,ve),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!Ke.value||Ue.value===Je.value,onClick:o[5]||(o[5]=e=>(lt(),void(Number.isFinite(Je.value)&&(Ue.value=Je.value)))),onMouseenter:o[6]||(o[6]=e=>ht(e,k(c)("common.reset")||"Reset")),onFocus:o[7]||(o[7]=e=>ht(e,k(c)("common.reset")||"Reset")),onMouseleave:ft,onBlur:ft},[...o[19]||(o[19]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),w("path",{d:"M3 3v5h5"})])],-1)])],40,me),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(Ue.value)&&Ue.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=lt(),t=Math.min(36,e+1);Ue.value=t}()),onMouseenter:o[9]||(o[9]=e=>ht(e,k(c)("common.increase")||"Increase")),onFocus:o[10]||(o[10]=e=>ht(e,k(c)("common.increase")||"Increase")),onMouseleave:ft,onBlur:ft},[...o[20]||(o[20]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,pe)],64)):F("",!0),n.showCopyButton?(h(),O("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":y.value?k(c)("common.copied")||"Copied":k(c)("common.copy")||"Copy",onClick:mt,onMouseenter:o[11]||(o[11]=e=>wt(e)),onFocus:o[12]||(o[12]=e=>wt(e)),onMouseleave:ft,onBlur:ft},[y.value?(h(),O("svg",we,[...o[22]||(o[22]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(h(),O("svg",fe,[...o[21]||(o[21]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("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,he)):F("",!0),n.showExpandButton?(h(),O("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":A.value,onClick:gt,onMouseenter:o[13]||(o[13]=e=>ht(e,A.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onFocus:o[14]||(o[14]=e=>ht(e,A.value?k(c)("common.collapse")||"Collapse":k(c)("common.expand")||"Expand")),onMouseleave:ft,onBlur:ft},[A.value?(h(),O("svg",ye,[...o[23]||(o[23]=[w("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)])])):(h(),O("svg",be,[...o[24]||(o[24]=[w("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,ge)):F("",!0),st.value&&n.showPreviewButton?(h(),O("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":k(c)("common.preview")||"Preview",onClick:bt,onMouseenter:o[15]||(o[15]=e=>ht(e,k(c)("common.preview")||"Preview")),onFocus:o[16]||(o[16]=e=>ht(e,k(c)("common.preview")||"Preview")),onMouseleave:ft,onBlur:ft},[...o[25]||(o[25]=[w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[w("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[w("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"}),w("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,ke)):F("",!0)])],!0)])):F("",!0),P(w("div",xe,[w("div",{ref_key:"codeEditor",ref:v,class:g(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Ae.value}]])},null,2),Ae.value?(h(),p(k(V),{key:0,class:g(["code-pre-fallback",{"is-wrap":Xe.value}]),style:_(tt.value),node:e.node},null,8,["class","style","node"])):F("",!0)],512),[[T,!(G.value||!e.stream&&e.loading)]]),Ge.value&&!a.value&&st.value&&"html"===H.value?(h(),p(K,{key:1,code:e.node.code,"is-dark":n.isDark,"on-close":()=>Ge.value=!1},null,8,["code","is-dark","on-close"])):F("",!0),P(w("div",Me,[E(t.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[26]||(o[26]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))],!0)],512),[[T,!e.stream&&e.loading]]),w("span",Ce,b(y.value?k(c)("common.copied")||"Copied":""),1)],6))}}),[["__scopeId","data-v-9ca7806e"]]);Se.install=e=>{e.component(Se.__name,Se)};export{Se as default};
|
package/dist/index6.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(e,o,t)=>new Promise((n,r)=>{var l=e=>{try{i(t.next(e))}catch(o){r(o)}},a=e=>{try{i(t.throw(e))}catch(o){r(o)}},i=e=>e.done?n(e.value):Promise.resolve(e.value).then(l,a);i((t=t.apply(e,o)).next())});import{defineComponent as o,ref as t,computed as n,watch as r,nextTick as l,onMounted as a,onBeforeUnmount as i,createElementBlock as s,openBlock as u,normalizeClass as c,createCommentVNode as d,withDirectives as h,createBlock as v,renderSlot as g,createElementVNode as w,unref as m,toDisplayString as p,normalizeStyle as x,vShow as y,Teleport as C,createVNode as f,Transition as k,withCtx as b,withModifiers as M}from"vue";import{u as B,s as F,h as D,_ as j}from"./exports.js";const T=()=>import("@antv/infographic");let $=null,E=T;const z={key:0},L={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Z=["src"],H={key:2},I={class:"flex items-center gap-x-1"},P={class:"flex items-center gap-x-1"},_={key:4},X={key:5,class:"flex items-center gap-x-1"},O=["aria-pressed"],S={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"},V={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"},Y=["disabled"],R=["disabled"],U={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},G={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},N={key:1,class:"relative"},q={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},A={class:"flex items-center gap-2 backdrop-blur rounded-lg"},J={class:"markstream-vue"},K={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Q=/* @__PURE__ */j(/* @__PURE__ */o({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(o,{emit:j}){const Q=o,{t:W}=B(),ee=t(!1),oe=t(!1),te=t(),ne=t(!1),re=t("360px"),le=t(!1),ae=t(),ie=t(null),se=t(1),ue=t(0),ce=t(0),de=t(!1),he=t({x:0,y:0}),ve=n(()=>Q.node.code);function ge(e){return!e||e.disabled}function we(e,o,t="top"){if(ge(e.currentTarget))return;const n=e,r=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;F(e.currentTarget,o,t,!1,r,Q.isDark)}function me(){D()}function pe(e){if(ge(e.currentTarget))return;const o=ee.value?W("common.copied")||"Copied":W("common.copy")||"Copy",t=e,n=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;F(e.currentTarget,o,"top",!1,n,Q.isDark)}function xe(){return e(this,null,function*(){try{const e=ve.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),ee.value=!0,setTimeout(()=>{ee.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function ye(e){ne.value="source"===e}function Ce(){var o;const t=null==(o=te.value)?void 0:o.querySelector("svg");t?function(o){e(this,null,function*(){try{const t=(new XMLSerializer).serializeToString(o),n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(n);if("undefined"!=typeof document){const o=document.createElement("a");o.href=r,o.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(e){}URL.revokeObjectURL(r)}}catch(t){console.error("Failed to export SVG:",t)}})}(t):console.error("SVG element not found")}function fe(e){"Escape"===e.key&&le.value&&ke()}function ke(){if(le.value=!1,ae.value&&(ae.value.innerHTML=""),ie.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",fe)}catch(e){}}function be(){!function(){if(le.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",fe)}catch(e){}l(()=>{if(te.value&&ae.value){ae.value.innerHTML="";const e=document.createElement("div");e.style.transition="transform 0.1s ease",e.style.transformOrigin="center center",e.style.width="100%",e.style.height="100%",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center";const o=te.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),ae.value.appendChild(e),ie.value=e,e.style.transform=`translate(${ue.value}px, ${ce.value}px) scale(${se.value})`}})}()}function Me(){se.value<3&&(se.value+=.1)}function Be(){se.value>.5&&(se.value-=.1)}function Fe(){se.value=1,ue.value=0,ce.value=0}function De(e){de.value=!0,e instanceof MouseEvent?he.value={x:e.clientX-ue.value,y:e.clientY-ce.value}:he.value={x:e.touches[0].clientX-ue.value,y:e.touches[0].clientY-ce.value}}function je(e){if(!de.value)return;let o,t;e instanceof MouseEvent?(o=e.clientX,t=e.clientY):(o=e.touches[0].clientX,t=e.touches[0].clientY),ue.value=o-he.value.x,ce.value=t-he.value.y}function Te(){de.value=!1}let $e=null;function Ee(){return e(this,null,function*(){var o;if(te.value)try{const t=yield function(){return e(this,null,function*(){if($)return $;const e=E;if(!e)return null;let o;try{o=yield e()}catch(n){if(e===T)throw new Error('Optional dependency "@antv/infographic" is not installed. Please install it to enable infographic diagrams.');throw n}if(!o)return null;const t=o&&o.default?o.default:o;return $="function"==typeof t&&t.prototype&&t.prototype.render?t:o.Infographic?o.Infographic:t&&t.Infographic?t.Infographic:t,$})}();if(!t)return void console.warn("Infographic library failed to load.");$e&&(null==(o=$e.destroy)||o.call($e),$e=null),te.value.innerHTML="",$e=new t({container:te.value,width:"100%",height:"100%"}),$e.render(ve.value),l(()=>{if(te.value){const e=te.value.scrollHeight;e>0&&(re.value=`${Math.min(e,800)}px`)}})}catch(t){console.error("Failed to render infographic:",t),te.value&&(te.value.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${t instanceof Error?t.message:"Unknown error"}</div>`)}})}r(()=>ve.value,()=>{ne.value||oe.value||l(()=>{Ee()})}),r(()=>ne.value,e=>{e||oe.value||l(()=>{Ee()})}),r(()=>oe.value,e=>{e||ne.value||l(()=>{Ee()})}),a(()=>{ne.value||oe.value||l(()=>{Ee()})}),i(()=>{var e;if($e&&(null==(e=$e.destroy)||e.call($e),$e=null),"undefined"!=typeof window)try{window.removeEventListener("keydown",fe)}catch(o){}});const ze=n(()=>Q.isDark?"infographic-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"infographic-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700"),Le=n(()=>ne.value||oe.value),Ze=n(()=>({transform:`translate(${ue.value}px, ${ce.value}px) scale(${se.value})`}));return r(Ze,e=>{le.value&&ie.value&&(ie.value.style.transform=e.transform)}),(e,o)=>(u(),s("div",{class:c(["my-4 rounded-lg border overflow-hidden shadow-sm",[Q.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":Q.loading}]])},[Q.showHeader?(u(),s("div",{key:0,class:c(["infographic-block-header flex justify-between items-center px-4 py-2.5 border-b",Q.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"])},[e.$slots["header-left"]?(u(),s("div",z,[g(e.$slots,"header-left",{},void 0,!0)])):(u(),s("div",L,[w("img",{src:m("data:image/svg+xml,%3csvg%20width='15.52'%20height='16'%20viewBox='0%200%20291%20300'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3cpath%20d='M140.904%20239.376C128.83%20239.683%20119.675%20239.299%20115.448%20243.843C110.902%20248.07%20111.288%20257.227%20110.979%20269.302C111.118%20274.675%20111.118%20279.478%20111.472%20283.52C111.662%20285.638%20111.95%20287.547%20112.406%20289.224C112.411%20289.243%20112.416%20289.259%20112.422%20289.28C112.462%20289.419%20112.496%20289.558%20112.539%20289.691C113.168%20291.787%20114.088%20293.491%20115.446%20294.758C116.662%20296.064%20118.283%20296.963%20120.264%20297.59C120.36%20297.614%20120.464%20297.646%20120.555%20297.675C120.56%20297.68%20120.56%20297.68%20120.566%20297.68C120.848%20297.768%20121.142%20297.846%20121.443%20297.923C121.454%20297.923%20121.464%20297.928%20121.478%20297.934C122.875%20298.272%20124.424%20298.507%20126.11%20298.678C126.326%20298.696%20126.542%20298.718%20126.763%20298.739C130.79%20299.086%20135.558%20299.088%20140.904%20299.222C152.974%20298.912%20162.128%20299.302%20166.36%20294.758C170.904%20290.526%20170.515%20281.371%20170.824%20269.302C170.515%20257.227%20170.907%20248.07%20166.36%20243.843C162.131%20239.299%20152.974%20239.683%20140.904%20239.376Z'%20fill='%23FF6376'%3e%3c/path%3e%3cpath%20d='M21.2155%20128.398C12.6555%20128.616%206.16484%20128.339%203.16751%20131.56C-0.0538222%20134.56%200.218178%20141.054%20-0.000488281%20149.608C0.218178%20158.168%20-0.0538222%20164.659%203.16751%20167.656C6.16484%20170.878%2012.6555%20170.606%2021.2155%20170.824C25.0262%20170.726%2028.4288%20170.726%2031.2955%20170.475C32.7968%20170.342%2034.1488%20170.136%2035.3382%20169.814C35.3542%20169.811%2035.3648%20169.806%2035.3782%20169.803C35.4768%20169.774%2035.5755%20169.747%2035.6688%20169.718C37.1568%20169.272%2038.3648%20168.622%2039.2635%20167.656C40.1915%20166.795%2040.8262%20165.646%2041.2715%20164.243C41.2875%20164.174%2041.3115%20164.102%2041.3328%20164.035C41.3328%20164.035%2041.3355%20164.032%2041.3355%20164.027C41.3968%20163.827%2041.4529%20163.622%2041.5062%20163.406C41.5062%20163.398%2041.5115%20163.392%2041.5142%20163.382C41.7542%20162.392%2041.9222%20161.294%2042.0422%20160.096C42.0555%20159.944%2042.0715%20159.792%2042.0848%20159.635C42.3328%20156.779%2042.3328%20153.398%2042.4262%20149.608C42.2075%20141.054%2042.4848%20134.56%2039.2635%20131.56C36.2635%20128.339%2029.7728%20128.616%2021.2155%20128.398Z'%20fill='%23FFCCCC'%3e%3c/path%3e%3cpath%20d='M81.0595%20184.171C70.8568%20184.433%2063.1208%20184.102%2059.5475%20187.942C55.7075%20191.518%2056.0328%20199.254%2055.7742%20209.454C56.0328%20219.657%2055.7075%20227.393%2059.5475%20230.963C63.1208%20234.803%2070.8568%20234.478%2081.0595%20234.739C85.6008%20234.622%2089.6595%20234.622%2093.0728%20234.323C94.8648%20234.163%2096.4755%20233.921%2097.8942%20233.534C97.9102%20233.529%2097.9235%20233.526%2097.9422%20233.521C98.0568%20233.486%2098.1742%20233.457%2098.2888%20233.422C100.06%20232.889%20101.5%20232.113%20102.569%20230.963C103.676%20229.937%20104.433%20228.566%20104.964%20226.894C104.985%20226.811%20105.012%20226.726%20105.036%20226.646C105.041%20226.643%20105.041%20226.643%20105.041%20226.638C105.116%20226.401%20105.18%20226.153%20105.244%20225.897C105.244%20225.889%20105.249%20225.881%20105.254%20225.867C105.54%20224.689%20105.74%20223.379%20105.881%20221.953C105.9%20221.771%20105.916%20221.59%20105.934%20221.403C106.228%20218.001%20106.228%20213.969%20106.342%20209.454C106.081%20199.254%20106.412%20191.518%20102.572%20187.942C98.9955%20184.102%2091.2568%20184.433%2081.0595%20184.171Z'%20fill='%23FF939F'%3e%3c/path%3e%3cpath%20d='M260.591%20151.87C215.652%20151.87%20203.02%20164.523%20203.02%20209.462H198.476C198.476%20164.523%20185.836%20151.881%20140.895%20151.881V147.337C185.836%20147.337%20198.487%20134.705%20198.487%2089.7659H203.02C203.02%20134.705%20215.652%20147.337%20260.591%20147.337V151.87ZM286.052%20124.158C281.82%20119.614%20272.66%20120.001%20260.591%20119.689C248.521%20119.385%20239.361%20119.771%20235.129%20115.227C230.585%20110.995%20230.983%20101.846%20230.671%2089.7659C230.513%2083.7312%20230.535%2078.4272%20230.023%2074.1019C229.513%2069.7659%20228.481%2066.4219%20226.209%2064.3046C221.967%2059.7606%20212.817%2060.1472%20200.748%2059.8459C188.681%2060.1472%20179.519%2059.7606%20175.287%2064.3046C170.753%2068.5366%20171.129%2077.6966%20170.828%2089.7659C170.516%20101.835%20170.9%20110.995%20166.356%20115.227C162.124%20119.771%20152.985%20119.374%20140.905%20119.689C138.873%20119.739%20136.924%20119.771%20135.071%20119.811C119.313%20118.697%20106.337%20112.318%20106.337%2089.7659C106.212%2084.6699%20106.233%2080.1792%20105.807%2076.5206C105.367%2072.8726%20104.492%2070.0379%20102.575%2068.2566C99.0013%2064.4112%2091.2573%2064.7446%2081.0653%2064.4832C70.86%2064.7446%2063.1186%2064.4112%2059.5533%2068.2566C55.708%2071.8299%2056.0306%2079.5632%2055.7693%2089.7659C56.0306%2099.9686%2055.708%20107.702%2059.5533%20111.278C63.1186%20115.113%2070.86%20114.79%2081.0653%20115.049C103.617%20115.049%20109.996%20128.035%20111.1%20143.803C111.068%20145.659%20111.028%20147.587%20110.975%20149.619C111.121%20154.987%20111.121%20159.79%20111.476%20163.835C111.663%20165.95%20111.945%20167.857%20112.404%20169.534C112.412%20169.555%20112.412%20169.566%20112.423%20169.598C112.465%20169.734%20112.497%20169.867%20112.537%20170.003C113.164%20172.099%20114.092%20173.809%20115.447%20175.07C116.665%20176.371%20118.281%20177.278%20120.271%20177.905C120.364%20177.934%20120.46%20177.955%20120.564%20177.987C120.855%20178.081%20121.145%20178.153%20121.439%20178.238C121.46%20178.238%20121.471%20178.238%20121.479%20178.249C122.876%20178.582%20124.42%20178.822%20126.108%20178.987C126.327%20179.009%20126.545%20179.03%20126.764%20179.051C130.788%20179.395%20135.559%20179.395%20140.905%20179.529C152.975%20179.843%20162.124%20179.457%20166.356%20184.001C170.9%20188.233%20170.516%20197.371%20170.828%20209.451C171.129%20221.529%20170.743%20230.681%20175.287%20234.91C179.519%20239.454%20188.681%20239.07%20200.748%20239.371C206.127%20239.235%20210.921%20239.235%20214.975%20238.881C217.079%20238.694%20218.985%20238.403%20220.676%20237.955C220.695%20237.945%20220.705%20237.934%20220.727%20237.934C220.873%20237.891%20220.999%20237.859%20221.135%20237.819C223.228%20237.193%20224.937%20236.265%20226.209%20234.91C227.511%20233.691%20228.409%20232.065%20229.044%20230.097C229.065%20230.003%20229.095%20229.899%20229.127%20229.803V229.793C229.22%20229.513%20229.295%20229.222%20229.367%20228.918C229.367%20228.897%20229.377%20228.897%20229.377%20228.878C229.721%20227.481%20229.951%20225.937%20230.127%20224.249C230.137%20224.03%20230.169%20223.811%20230.191%20223.593C230.535%20219.571%20230.535%20214.798%20230.671%20209.451C230.972%20197.371%20230.585%20188.233%20235.129%20184.001C239.361%20179.457%20248.511%20179.843%20260.591%20179.529C272.66%20179.227%20281.82%20179.614%20286.052%20175.07C290.596%20170.838%20290.209%20161.689%20290.511%20149.619C290.209%20137.539%20290.596%20128.379%20286.052%20124.158Z'%20fill='%23FF356A'%3e%3c/path%3e%3cpath%20d='M112.405%2049.848C112.411%2049.8694%20112.416%2049.8827%20112.421%2049.904C112.461%2050.0427%20112.499%2050.1814%20112.539%2050.3147C113.171%2052.4134%20114.088%2054.1147%20115.448%2055.384C116.661%2056.6907%20118.283%2057.5894%20120.264%2058.2134C120.36%2058.24%20120.464%2058.2694%20120.555%2058.3014C120.56%2058.3067%20120.56%2058.3067%20120.565%2058.3067C120.848%2058.3947%20121.141%2058.4694%20121.443%2058.5467C121.453%2058.5467%20121.464%2058.552%20121.48%2058.5574C122.875%2058.896%20124.424%2059.1334%20126.112%2059.3014C126.325%2059.3227%20126.541%2059.3414%20126.763%2059.3627C130.789%2059.712%20135.56%2059.712%20140.904%2059.8454C152.973%2059.5387%20162.128%2059.928%20166.36%2055.384C170.907%2051.152%20170.515%2041.9947%20170.824%2029.9254C170.517%2017.8507%20170.907%208.69602%20166.363%204.46935C162.131%20-0.0746511%20152.973%200.309349%20140.904%201.52588e-05C128.829%200.309349%20119.675%20-0.0746511%20115.448%204.46935C110.904%208.69602%20111.288%2017.8507%20110.979%2029.9254C111.117%2035.3014%20111.117%2040.1014%20111.472%2044.144C111.661%2046.2614%20111.949%2048.1707%20112.405%2049.848Z'%20fill='%23FF6376'%3e%3c/path%3e%3c/g%3e%3c/svg%3e"),class:"w-4 h-4 my-0",alt:"Infographic"},null,8,Z),w("span",{class:c(["text-sm font-medium font-mono truncate",Q.isDark?"text-gray-400":"text-gray-600"])},"Infographic",2)])),e.$slots["header-center"]?(u(),s("div",H,[g(e.$slots,"header-center",{},void 0,!0)])):Q.showModeToggle?(u(),s("div",{key:3,class:c(["flex items-center gap-x-1 rounded-md p-0.5",Q.isDark?"bg-gray-700":"bg-gray-100"])},[w("button",{class:c(["px-2.5 py-1 text-xs rounded transition-colors",[ne.value?Q.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":Q.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"]]),onClick:o[0]||(o[0]=()=>ye("preview")),onMouseenter:o[1]||(o[1]=e=>we(e,m(W)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>we(e,m(W)("common.preview")||"Preview")),onMouseleave:me,onBlur:me},[w("div",I,[o[21]||(o[21]=w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),w("circle",{cx:"12",cy:"12",r:"3"})])],-1)),w("span",null,p(m(W)("common.preview")||"Preview"),1)])],34),w("button",{class:c(["px-2.5 py-1 text-xs rounded transition-colors",[ne.value?Q.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":Q.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"]]),onClick:o[3]||(o[3]=()=>ye("source")),onMouseenter:o[4]||(o[4]=e=>we(e,m(W)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>we(e,m(W)("common.source")||"Source")),onMouseleave:me,onBlur:me},[w("div",P,[o[22]||(o[22]=w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),w("span",null,p(m(W)("common.source")||"Source"),1)])],34)],2)):d("",!0),e.$slots["header-right"]?(u(),s("div",_,[g(e.$slots,"header-right",{},void 0,!0)])):(u(),s("div",X,[Q.showCollapseButton?(u(),s("button",{key:0,class:c(ze.value),"aria-pressed":oe.value,onClick:o[6]||(o[6]=e=>oe.value=!oe.value),onMouseenter:o[7]||(o[7]=e=>we(e,oe.value?m(W)("common.expand")||"Expand":m(W)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>we(e,oe.value?m(W)("common.expand")||"Expand":m(W)("common.collapse")||"Collapse")),onMouseleave:me,onBlur:me},[(u(),s("svg",{style:x({rotate:oe.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"},[...o[23]||(o[23]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],42,O)):d("",!0),Q.showCopyButton?(u(),s("button",{key:1,class:c(ze.value),onClick:xe,onMouseenter:o[9]||(o[9]=e=>pe(e)),onFocus:o[10]||(o[10]=e=>pe(e)),onMouseleave:me,onBlur:me},[ee.value?(u(),s("svg",V,[...o[25]||(o[25]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(u(),s("svg",S,[...o[24]||(o[24]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],34)):d("",!0),Q.showExportButton?(u(),s("button",{key:2,class:c(`${ze.value} ${Le.value?"opacity-50 cursor-not-allowed":""}`),disabled:Le.value,onClick:Ce,onMouseenter:o[11]||(o[11]=e=>we(e,m(W)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>we(e,m(W)("common.export")||"Export")),onMouseleave:me,onBlur:me},[...o[26]||(o[26]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,Y)):d("",!0),Q.showFullscreenButton?(u(),s("button",{key:3,class:c(`${ze.value} ${Le.value?"opacity-50 cursor-not-allowed":""}`),disabled:Le.value,onClick:be,onMouseenter:o[13]||(o[13]=e=>we(e,le.value?m(W)("common.minimize")||"Minimize":m(W)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>we(e,le.value?m(W)("common.minimize")||"Minimize":m(W)("common.open")||"Open")),onMouseleave:me,onBlur:me},[le.value?(u(),s("svg",G,[...o[28]||(o[28]=[w("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)])])):(u(),s("svg",U,[...o[27]||(o[27]=[w("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)])]))],42,R)):d("",!0)]))],2)):d("",!0),h(w("div",null,[ne.value?(u(),s("div",{key:0,class:c(["p-4",Q.isDark?"bg-gray-900":"bg-gray-50"])},[w("pre",{class:c(["text-sm font-mono whitespace-pre-wrap",Q.isDark?"text-gray-300":"text-gray-700"])},p(ve.value),3)],2)):(u(),s("div",N,[Q.showZoomControls?(u(),s("div",q,[w("div",A,[w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Me,onMouseenter:o[15]||(o[15]=e=>we(e,m(W)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>we(e,m(W)("common.zoomIn")||"Zoom in")),onMouseleave:me,onBlur:me},[...o[29]||(o[29]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],34),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Be,onMouseenter:o[17]||(o[17]=e=>we(e,m(W)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>we(e,m(W)("common.zoomOut")||"Zoom out")),onMouseleave:me,onBlur:me},[...o[30]||(o[30]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],34),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Fe,onMouseenter:o[19]||(o[19]=e=>we(e,m(W)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>we(e,m(W)("common.resetZoom")||"Reset zoom")),onMouseleave:me,onBlur:me},p(Math.round(100*se.value))+"% ",35)])])):d("",!0),w("div",{class:c(["min-h-[360px] relative transition-all duration-100 overflow-hidden block",Q.isDark?"bg-gray-900":"bg-gray-50"]),style:x({height:re.value}),onMousedown:De,onMousemove:je,onMouseup:Te,onMouseleave:Te,onTouchstartPassive:De,onTouchmovePassive:je,onTouchendPassive:Te},[w("div",{class:c(["absolute inset-0 cursor-grab",{"cursor-grabbing":de.value}]),style:x(Ze.value)},[w("div",{ref_key:"infographicContainer",ref:te,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],38)]))],512),[[y,!oe.value]]),(u(),v(C,{to:"body"},[w("div",J,[f(k,{name:"infographic-dialog",appear:""},{default:b(()=>[le.value?(u(),s("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:M(ke,["self"])},[w("div",{class:c(["dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",Q.isDark?"bg-gray-900":"bg-white"])},[w("div",K,[w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Me},[...o[31]||(o[31]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],2),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Be},[...o[32]||(o[32]=[w("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"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],2),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Fe},p(Math.round(100*se.value))+"% ",3),w("button",{class:c(["inline-flex items-center justify-center p-2 rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:ke},[...o[33]||(o[33]=[w("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"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])],2)]),w("div",{ref_key:"modalContent",ref:ae,class:c(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!de.value,"cursor-grabbing":de.value}]),onMousedown:De,onMousemove:je,onMouseup:Te,onMouseleave:Te,onTouchstartPassive:De,onTouchmovePassive:je,onTouchendPassive:Te},null,34)],2)])):d("",!0)]),_:1})])]))],2))}}),[["__scopeId","data-v-811a9bef"]]);Q.install=e=>{e.component(Q.__name,Q)};export{Q as default};
|
package/dist/tailwind.ts
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markstream-vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.5-beta.
|
|
4
|
+
"version": "0.0.5-beta.2",
|
|
5
5
|
"description": "Vue 3 Markdown renderer optimized for large docs: progressive Mermaid, streaming diff code blocks, and fast real-time preview.",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
@@ -66,15 +66,19 @@
|
|
|
66
66
|
"dist/workers"
|
|
67
67
|
],
|
|
68
68
|
"peerDependencies": {
|
|
69
|
+
"@antv/infographic": "^0.2.3",
|
|
69
70
|
"katex": ">=0.16.22",
|
|
70
71
|
"mermaid": ">=11",
|
|
71
72
|
"shiki": "^3.13.0",
|
|
72
|
-
"stream-markdown": ">=0.0.
|
|
73
|
-
"stream-monaco": ">=0.0.
|
|
73
|
+
"stream-markdown": ">=0.0.13",
|
|
74
|
+
"stream-monaco": ">=0.0.13",
|
|
74
75
|
"vue": ">=3.0.0",
|
|
75
76
|
"vue-i18n": ">=9"
|
|
76
77
|
},
|
|
77
78
|
"peerDependenciesMeta": {
|
|
79
|
+
"@antv/infographic": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
78
82
|
"katex": {
|
|
79
83
|
"optional": true
|
|
80
84
|
},
|
|
@@ -96,7 +100,7 @@
|
|
|
96
100
|
},
|
|
97
101
|
"dependencies": {
|
|
98
102
|
"@floating-ui/dom": "^1.7.4",
|
|
99
|
-
"stream-markdown-parser": "0.0.
|
|
103
|
+
"stream-markdown-parser": "0.0.56"
|
|
100
104
|
},
|
|
101
105
|
"devDependencies": {
|
|
102
106
|
"@antfu/eslint-config": "^5.4.1",
|