UNPKG

vuepress-plugin-md-enhance

Version:
3 lines (2 loc) 1.7 kB
import{deepAssign as U,LoadingIcon as V}from"@vuepress/helper/client";import{defineComponent as h,ref as w,shallowRef as n,computed as y,h as r,onMounted as _,version as C}from"vue";import"@vue/repl/style.css";import"../styles/vue-playground.scss";import{u as I}from"../vuePlayground-BYL10dkl.js";const M=e=>JSON.parse(decodeURIComponent(e));var b=h({name:"VuePlayground",props:{files:{type:String,required:!0},title:String,settings:String},setup(e){const{vueVersion:t=C,vueRuntimeDevUrl:a=`https://unpkg.com/@vue/runtime-dom@${t}/dist/runtime-dom.esm-browser.js`,vueRuntimeProdUrl:l=`https://unpkg.com/@vue/runtime-dom@${t}/dist/runtime-dom.esm-browser.prod.js`,vueServerRendererUrl:p=`https://unpkg.com/@vue/server-renderer@${t}/dist/server-renderer.esm-browser.js`,...d}=I(),i=w(!0),o=n(),s=n(),u=n(),m=y(()=>U({},d,M(e.settings??"{}"))),v=async()=>{if(__VUEPRESS_SSR__)return;const[{useStore:c,useVueImportMap:g,Repl:f},{default:R}]=await Promise.all([import("@vue/repl"),VUE_PLAYGROUND_MONACO?import("@vue/repl/monaco-editor"):import("@vue/repl/codemirror-editor")]);o.value=f,u.value=R;const{importMap:S,vueVersion:P}=g({runtimeDev:a,runtimeProd:l,serverRenderer:p});s.value=c({builtinImportMap:S,vueVersion:P},decodeURIComponent(e.files))};return _(async()=>{await v(),i.value=!1}),()=>[r("div",{class:"vp-container vue-playground-wrapper"},[e.title?r("div",{class:"vp-container-header"},r("div",{class:"vp-container-title"},decodeURIComponent(e.title))):null,r("div",{class:"repl-container"},[i.value?r(V,{class:"vue-preview-loading",height:192}):null,o.value?r(o.value,{...m.value,editor:u.value,store:s.value}):null])])]}});export{b as default}; //# sourceMappingURL=VuePlayground.js.map