codemirror-editor-vue3
Advanced tools
Comparing version 0.1.4-beta to 0.2.0
@@ -1,1 +0,1 @@ | ||
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,l=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,i=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&l(e,n,t[n]);if(r)for(var n of r(t))a.call(t,n)&&l(e,n,t[n]);return e};import*as c from"codemirror";import s from"codemirror";import{defineComponent as u,ref as d,onMounted as p,markRaw as m,watch as g,openBlock as f,createElementBlock as h,computed as v,getCurrentInstance as y,onBeforeUnmount as b,normalizeClass as w,createBlock as x,resolveDynamicComponent as O,mergeProps as S}from"vue";import"codemirror/addon/merge/merge.css";import"codemirror/addon/merge/merge.js";import k from"diff-match-patch";import"codemirror/addon/mode/simple.js";import*as j from"codemirror/lib/codemirror.js";const $=window.CodeMirror||s,M=u({name:"codemirror",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=d(),r=d(null),o=()=>{r.value=m($.fromTextArea(n.value,e.options)),t("update:cminstance",m(r.value));let o=null;o=g((()=>e.cminstance),((n,a)=>{n&&e.cminstance.setValue(e.code||e.value||e.content),t("ready",r),o()}),{deep:!0})};return p((()=>{o()})),{initialize:o,textarea:n}}}),C=["name","placeholder"];M.render=function(e,t,n,r,o,a){return f(),h("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,C)};const E=window.CodeMirror||s;window.diff_match_patch=k,window.DIFF_DELETE=-1,window.DIFF_INSERT=1,window.DIFF_EQUAL=0;const I=u({name:"mergemode",props:{options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},height:{type:[String,Number],default:null}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=d(null),r=d(null),o=String(e.height).replace("px","")+"px",a=()=>{n.value=m(E.MergeView(r.value,e.options)),t("update:cminstance",m(n.value.edit)),document.querySelector(".CodeMirror-merge").style.height=o,document.querySelector(".CodeMirror-merge-right .CodeMirror").style.height=o,t("ready",n)};return p((()=>{a()})),{mergeView:r,initialize:a}}}),N={ref:"mergeView"};var A,F;function L(){const e=new Date;return`${e.getHours()<10?"0"+e.getHours():e.getHours()}:${e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}:${e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds()}`}function T(e){return`#link#${JSON.stringify(e)}#link#`}function V(e){const t=/#link#(.+)#link#/g;let n,r=[];for(n=t.exec(e);n;){const o=document.createElement("a"),a=JSON.parse(n[1]),l=Object.entries(a);for(let[e,t]of l)o.setAttribute(e,t);o.className="editor_custom_link",o.innerHTML="logDownload",r.push({start:n.index,end:n.index+n[0].length,node:o}),n=t.exec(e)}return r}function D(e="",t="info"){return`#log<${t}>log#${e}#log<${t}>log#`}function _(e){let t=[];return function(){const n=new RegExp("#log<(\\w*)>log#((.|\r\n|\n)*?)#log<(\\w*)>log#","g");let r;for(r=n.exec(e),console.log(r);r;){let o=r[0].replace(/\r\n/g,"\n").split("\n"),a=r[2].replace(/\r\n/g,"\n").split("\n");const l=document.createElement("span");let i=r[1];console.log(i),l.className=`c-editor--log__${i}`;let c=0;for(let e=0;e<o.length;e++){let n=o[e],i=a[e],s=l.cloneNode(!1);s.innerText=i,t.push({start:r.index+c,end:r.index+c+n.length,node:s}),c=c+n.length+1}r=n.exec(e)}}(),t}function P(e,t=""){return`[${L()}] <${t}> ${e}`}function R(e="",t=20,n="="){const r=Math.floor(1.5*e.length/2);const o=new Array(Math.max(t-r,5)).join(n);return`${o}${e}${o}`}I.render=function(e,t,n,r,o,a){return f(),h("div",N,null,512)},(F=A||(A={})).info="info",F.warning="warning",F.error="error";const B=[{regex:/(\[.*?\])([ \t]*)(<error>)/,token:["tag",null,"error.strong"],sol:!0,next:"error"},{regex:/(\[.*?\])([ \t]*)(<info>)/,token:["tag",null,"bracket"],sol:!0,next:"info"},{regex:/(\[.*?\])([ \t]*)(<warning>)/,token:["tag",null,"comment"],sol:!0,next:"warning"}];c.defineSimpleMode("fclog",{start:[...B,{regex:/.*/,token:"hr"}],error:[...B,{regex:/.*/,token:"error.strong"}],info:[...B,{regex:/.*/,token:"bracket"}],warning:[...B,{regex:/.*/,token:"comment"}]}),j.defineSimpleMode("log",{start:[{regex:/^[=]+[^=]*[=]+/,token:"strong"},{regex:/([^\w])([A-Z][\w]*)/,token:[null,"string"]},{regex:/(^[A-Z][\w]*)/,token:"string"}]});const z=window.CodeMirror||s,H=u({name:"codemirror-fclog",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""},KeepCursorInEnd:{type:Boolean,default:!0}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=d(),r=d(null),o=v((()=>e.KeepCursorInEnd)),a=(t=e.cminstance)=>{t.getAllMarks().forEach((e=>e.clear()));const n=t.getValue(),r=[].concat(V(n)).concat(_(n));for(let e=0;e<r.length;e++){const n=r[e];t.markText(t.posFromIndex(n.start),t.posFromIndex(n.end),{replacedWith:n.node})}},l=()=>{r.value=m(z.fromTextArea(n.value,e.options)),t("update:cminstance",m(r.value)),r.value.on("change",(t=>{a(),o&&Promise.resolve().then((()=>{let t=e.cminstance.getScrollInfo();e.cminstance.scrollTo(t.left,t.height)}))}))};return g((()=>e.cminstance),(n=>{n&&(a(e.cminstance),e.cminstance.setValue(e.code||e.value||e.content),t("ready",r))}),{deep:!0,immediate:!0}),p((()=>{l()})),{initialize:l,textarea:n}}}),K=["name","placeholder"];H.render=function(e,t,n,r,o,a){return f(),h("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,K)};"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const n=Object(e);for(let r=1;r<arguments.length;r++){const e=arguments[r];if(null!=e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}return n},writable:!0,configurable:!0});const U={mode:"text",theme:"default",lineNumbers:!0,smartIndent:!0,indentUnit:2,foldGutter:!0,matchBrackets:!0,autoCloseBrackets:!0,styleActiveLine:!0},W=["update:value","change","ready"],q=u({name:"CodemirrorEditor",props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:""},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:()=>({})},globalOptions:{type:Object,default:()=>({})},border:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},KeepCursorInEnd:{type:Boolean,default:!1}},emits:[...W,"changes","scroll","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"],components:{Default:M,Merge:I,FcLog:H},setup(e,t){var n,r;const o=d(null),a=d(""),l=d(),c=d(Object.assign(i({},U),e.globalOptions,e.options)),s=y(),u=d(null),p=(t=e.width,n=e.height)=>{o.value.setSize(t,n)},m=()=>{void 0!==e.unseenLines&&void 0!==marker&&e.unseenLines.forEach((e=>{const t=o.value.lineInfo(e);o.value.setGutterMarker(e,"breakpoints",t.gutterMarkers?null:marker())}))},{listenerEvents:f}=function({cminstance:e,ctx:t,internalInstance:n,content:r}){const o=()=>{let e=[];return Object.keys(n.vnode.props).forEach((t=>{if(t.startsWith("on")){let n=t.replace(t[2],t[2].toLowerCase()).slice(2);!W.includes(n)&&e.push(n)}})),e};return{listenerEvents:()=>{e.value.on("change",(e=>{const n=e.getValue();n!=r.value&&(r.value=n,t.emit("update:value",r.value),t.emit("change",r.value,e))}));const n={};return o().filter((e=>!n[e]&&(n[e]=!0))).forEach((n=>{e.value.on(n,((...e)=>{t.emit(n,...e)}))}))}}}({cminstance:o,ctx:t,internalInstance:s,content:a});g((()=>e.options),(t=>{for(const n in e.options)o.value.setOption(n,t[n])}),{deep:!0}),g((()=>e.value),(e=>{(e=>{if(e!==o.value.getValue()){const t=o.value.getScrollInfo();o.value.setValue(e),a.value=e,o.value.scrollTo(t.left,t.top)}m()})(e)}));return g((()=>e.merge),(t=>{"fclog"!=e.options.mode&&"log"!=e.options.mode?e.merge?l.value="Merge":l.value="default":l.value="FcLog"}),{immediate:!0}),b((()=>{(()=>{const e=o.value.doc.cm.getWrapperElement();null==e||e.remove()})()})),{presetModeName:l,cmOptions:c,cminstance:o,content:a,ready:e=>{f(),m(),p(),t.emit("ready",o.value)},resize:p,instanceName:e.name||(null==(r=null==(n=null==s?void 0:s.parent)?void 0:n.type)?void 0:r.name)+"-cm",presetRef:u}}});q.render=function(e,r,o,a,l,c){return f(),h("div",{class:w(["codemirror-container",{merge:e.$props.merge,bordered:!e.$props.merge&&e.$props.border,"width-auto":!e.$props.width||"100%"==e.$props.width,"height-auto":!e.$props.height||"100%"==e.$props.height}])},[(f(),x(O(e.presetModeName),S({ref:"presetRef",cminstance:e.cminstance,"onUpdate:cminstance":r[0]||(r[0]=t=>e.cminstance=t)},(s=i(i({},e.$props),e.$attrs),u={options:e.cmOptions,name:e.instanceName,content:e.content},t(s,n(u))),{onReady:e.ready}),null,16,["cminstance","onReady"]))],2);var s,u},q.install=(e,t)=>(t&&(t.options&&(q.props.globalOptions.default=()=>t.options),t.events&&(q.props.globalEvents.default=()=>t.events)),e.component("Codemirror",q),e);export{q as Codemirror,T as createLinkMark,P as createLog,D as createLogMark,R as createTitle,q as default,V as getLinkMark,L as getLocalTime,_ as getLogMark}; | ||
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,l=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,i=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&l(e,n,t[n]);if(r)for(var n of r(t))a.call(t,n)&&l(e,n,t[n]);return e};import c from"codemirror";import"codemirror/lib/codemirror.css";import{defineComponent as s,ref as u,onMounted as p,markRaw as d,watch as m,openBlock as g,createElementBlock as f,computed as h,getCurrentInstance as v,onBeforeUnmount as y,normalizeClass as b,normalizeStyle as w,createBlock as x,resolveDynamicComponent as O,mergeProps as k}from"vue";import"codemirror/addon/merge/merge.css";import"codemirror/addon/merge/merge.js";import S from"diff-match-patch";import"codemirror/addon/mode/simple.js";import*as j from"codemirror/lib/codemirror.js";const $=window.CodeMirror||c,E=s({name:"codemirror",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=u(),r=u(null),o=()=>{r.value=d($.fromTextArea(n.value,e.options)),t("update:cminstance",d(r.value));let o=null;o=m((()=>e.cminstance),((n,a)=>{n&&e.cminstance.setValue(e.code||e.value||e.content),t("ready",r),o()}),{deep:!0})};return p((()=>{o()})),{initialize:o,textarea:n}}}),M=["name","placeholder"];E.render=function(e,t,n,r,o,a){return g(),f("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,M)};const C=window.CodeMirror||c;window.diff_match_patch=S,window.DIFF_DELETE=-1,window.DIFF_INSERT=1,window.DIFF_EQUAL=0;const I=s({name:"mergemode",props:{options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},height:{type:[String,Number],default:null}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=u(null),r=u(null);String(e.height).replace("px","");const o=()=>{n.value=d(C.MergeView(r.value,e.options)),t("update:cminstance",d(n.value.edit)),t("ready",n)};return p((()=>{o()})),{mergeView:r,initialize:o}}}),N={ref:"mergeView"};var A,F;function L(){const e=new Date;return`${e.getHours()<10?"0"+e.getHours():e.getHours()}:${e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}:${e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds()}`}function T(e){return`#link#${JSON.stringify(e)}#link#`}function V(e){const t=/#link#(.+)#link#/g;let n,r=[];for(n=t.exec(e);n;){const o=document.createElement("a"),a=JSON.parse(n[1]),l=Object.entries(a);for(let[e,t]of l)o.setAttribute(e,t);o.className="editor_custom_link",o.innerHTML="logDownload",r.push({start:n.index,end:n.index+n[0].length,node:o}),n=t.exec(e)}return r}function D(e="",t="info"){return`#log<${t}>log#${e}#log<${t}>log#`}function _(e){let t=[];return function(){const n=new RegExp("#log<(\\w*)>log#((.|\r\n|\n)*?)#log<(\\w*)>log#","g");let r;for(r=n.exec(e);r;){let o=r[0].replace(/\r\n/g,"\n").split("\n"),a=r[2].replace(/\r\n/g,"\n").split("\n");const l=document.createElement("span");let i=r[1];l.className=`c-editor--log__${i}`;let c=0;for(let e=0;e<o.length;e++){let n=o[e],i=a[e],s=l.cloneNode(!1);s.innerText=i,t.push({start:r.index+c,end:r.index+c+n.length,node:s}),c=c+n.length+1}r=n.exec(e)}}(),t}function P(e,t=""){return`[${L()}] <${t}> ${e}`}function H(e="",t=20,n="="){const r=Math.floor(1.5*e.length/2);const o=new Array(Math.max(t-r,5)).join(n);return`${o}${e}${o}`}I.render=function(e,t,n,r,o,a){return g(),f("div",N,null,512)},(F=A||(A={})).info="info",F.warning="warning",F.error="error";const R=[{regex:/(\[.*?\])([ \t]*)(<error>[ \t])(.+)/,token:["tag",null,"error.strong","error.strong"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<info>)(.+)(.?)/,token:["tag",null,"bracket","bracket","hr"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<warning>)(.+)(.?)/,token:["tag",null,"comment","comment","hr"],sol:!0}];c.defineSimpleMode("fclog",{start:[...R,{regex:/.*/,token:"hr"}],error:[...R,{regex:/.*/,token:"error.strong"}],info:[...R,{regex:/.*/,token:"bracket"}],warning:[...R,{regex:/.*\[/,token:"comment"}]}),j.defineSimpleMode("log",{start:[{regex:/^[=]+[^=]*[=]+/,token:"strong"},{regex:/([^\w])([A-Z][\w]*)/,token:[null,"string"]},{regex:/(^[A-Z][\w]*)/,token:"string"}]});const B=window.CodeMirror||c,z=s({name:"codemirror-fclog",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""},KeepCursorInEnd:{type:Boolean,default:!0}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=u(),r=u(null),o=h((()=>e.KeepCursorInEnd)),a=(t=e.cminstance)=>{t.getAllMarks().forEach((e=>e.clear()));const n=t.getValue(),r=[].concat(V(n)).concat(_(n));for(let e=0;e<r.length;e++){const n=r[e];t.markText(t.posFromIndex(n.start),t.posFromIndex(n.end),{replacedWith:n.node})}},l=()=>{r.value=d(B.fromTextArea(n.value,e.options)),t("update:cminstance",d(r.value)),r.value.on("change",(t=>{a(),o&&Promise.resolve().then((()=>{let t=e.cminstance.getScrollInfo();e.cminstance.scrollTo(t.left,t.height)}))}))};return m((()=>e.cminstance),(n=>{n&&(a(e.cminstance),e.cminstance.setValue(e.code||e.value||e.content),t("ready",r))}),{deep:!0,immediate:!0}),p((()=>{l()})),{initialize:l,textarea:n}}}),W=["name","placeholder"];z.render=function(e,t,n,r,o,a){return g(),f("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,W)},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const n=Object(e);for(let r=1;r<arguments.length;r++){const e=arguments[r];if(null!=e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}return n},writable:!0,configurable:!0});const K={mode:"text",theme:"default",lineNumbers:!0,smartIndent:!0,indentUnit:2,foldGutter:!0,matchBrackets:!0,autoCloseBrackets:!0,styleActiveLine:!0},U=["update:value","change","input","ready"],G=s({name:"CodemirrorEditor",props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:""},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:()=>({})},globalOptions:{type:Object,default:()=>({})},border:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},KeepCursorInEnd:{type:Boolean,default:!1}},emits:[...U,"changes","scroll","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"],components:{Default:E,Merge:I,FcLog:z},setup(e,t){var n,r;const o=u(null),a=u(""),l=u(),c=u(Object.assign(i({},K),e.globalOptions,e.options)),s=v(),p=u(null),d=u(null),g=u(null),f=(t=e.width,n=e.height)=>{d.value=String(t).replace("px",""),g.value=String(n).replace("px","");let r=g.value;e.merge&&(r-=2),o.value.setSize(d.value,r)},h=()=>{void 0!==e.unseenLines&&void 0!==marker&&e.unseenLines.forEach((e=>{const t=o.value.lineInfo(e);o.value.setGutterMarker(e,"breakpoints",t.gutterMarkers?null:marker())}))},{listenerEvents:b}=function({cminstance:e,ctx:t,internalInstance:n,content:r}){const o=()=>{let e=[];return Object.keys(n.vnode.props).forEach((t=>{if(t.startsWith("on")){let n=t.replace(t[2],t[2].toLowerCase()).slice(2);!U.includes(n)&&e.push(n)}})),e};return{listenerEvents:()=>{e.value.on("change",(e=>{const n=e.getValue();n!=r.value&&(r.value=n,t.emit("update:value",r.value),t.emit("input",r.value),t.emit("change",r.value,e))}));const n={};return o().filter((e=>!n[e]&&(n[e]=!0))).forEach((n=>{e.value.on(n,((...e)=>{t.emit(n,...e)}))}))}}}({cminstance:o,ctx:t,internalInstance:s,content:a});m((()=>e.options),(t=>{for(const n in e.options)o.value.setOption(n,t[n])}),{deep:!0}),m((()=>e.value),(e=>{(e=>{if(e!==o.value.getValue()){const t=o.value.getScrollInfo();o.value.setValue(e),a.value=e,o.value.scrollTo(t.left,t.top)}h()})(e)}));return m((()=>e.merge),(t=>{"fclog"!=e.options.mode&&"log"!=e.options.mode?e.merge?l.value="Merge":l.value="default":l.value="FcLog"}),{immediate:!0}),y((()=>{(()=>{const e=o.value.doc.cm.getWrapperElement();null==e||e.remove()})()})),{presetModeName:l,cmOptions:c,cminstance:o,content:a,ready:n=>{b(),h(),f(),t.emit("ready",o.value),m([()=>e.height,()=>e.width],(([e,t])=>{f(e,t)}),{deep:!0})},resize:f,containerWidth:d,containerHeight:g,instanceName:e.name||(null==(r=null==(n=null==s?void 0:s.parent)?void 0:n.type)?void 0:r.name)+"-cm",presetRef:p}}});G.render=function(e,r,o,a,l,c){return g(),f("div",{class:b(["codemirror-container",{merge:e.$props.merge,bordered:!e.$props.merge&&e.$props.border,"width-auto":!e.$props.width||"100%"==e.$props.width,"height-auto":!e.$props.height||"100%"==e.$props.height}]),style:w({height:e.containerHeight+"px"})},[(g(),x(O(e.presetModeName),k({style:{height:"100%"},ref:"presetRef",cminstance:e.cminstance,"onUpdate:cminstance":r[0]||(r[0]=t=>e.cminstance=t)},(s=i(i({},e.$props),e.$attrs),u={options:e.cmOptions,name:e.instanceName,content:e.content},t(s,n(u))),{onReady:e.ready}),null,16,["cminstance","onReady"]))],6);var s,u};G.install=(e,t)=>(t&&(t.options&&(G.props.globalOptions.default=()=>t.options),t.events&&(G.props.globalEvents.default=()=>t.events)),e.component("Codemirror",G),e);export{G as Codemirror,T as createLinkMark,P as createLog,D as createLogMark,H as createTitle,G as default,V as getLinkMark,L as getLocalTime,_ as getLogMark}; |
@@ -1,1 +0,1 @@ | ||
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("codemirror"),require("vue"),require("codemirror/addon/merge/merge.css"),require("codemirror/addon/merge/merge.js"),require("diff-match-patch"),require("codemirror/addon/mode/simple.js"),require("codemirror/lib/codemirror.js")):"function"==typeof define&&define.amd?define(["exports","codemirror","vue","codemirror/addon/merge/merge.css","codemirror/addon/merge/merge.js","diff-match-patch","codemirror/addon/mode/simple.js","codemirror/lib/codemirror.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["codemirror-editor-vue3"]={},e["codemirror/lib/codemirror"].js,e.Vue,null,null,e.DiffMatchPatch,null,e.codemirror)}(this,(function(e,t,r,n,o,a,l,i){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t={__proto__:null,[Symbol.toStringTag]:"Module"};return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=c(t),d=s(t),p=c(a),m=s(i);const g=window.CodeMirror||u.default,f=r.defineComponent({name:"codemirror",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=r.ref(),o=r.ref(null),a=()=>{o.value=r.markRaw(g.fromTextArea(n.value,e.options)),t("update:cminstance",r.markRaw(o.value));let a=null;a=r.watch((()=>e.cminstance),((r,n)=>{r&&e.cminstance.setValue(e.code||e.value||e.content),t("ready",o),a()}),{deep:!0})};return r.onMounted((()=>{a()})),{initialize:a,textarea:n}}}),h=["name","placeholder"];f.render=function(e,t,n,o,a,l){return r.openBlock(),r.createElementBlock("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,h)};const v=window.CodeMirror||u.default;window.diff_match_patch=p.default,window.DIFF_DELETE=-1,window.DIFF_INSERT=1,window.DIFF_EQUAL=0;const y=r.defineComponent({name:"mergemode",props:{options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},height:{type:[String,Number],default:null}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=r.ref(null),o=r.ref(null),a=String(e.height).replace("px","")+"px",l=()=>{n.value=r.markRaw(v.MergeView(o.value,e.options)),t("update:cminstance",r.markRaw(n.value.edit)),document.querySelector(".CodeMirror-merge").style.height=a,document.querySelector(".CodeMirror-merge-right .CodeMirror").style.height=a,t("ready",n)};return r.onMounted((()=>{l()})),{mergeView:o,initialize:l}}}),w={ref:"mergeView"};var b,_;function k(){const e=new Date;return`${e.getHours()<10?"0"+e.getHours():e.getHours()}:${e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}:${e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds()}`}function O(e){const t=/#link#(.+)#link#/g;let r,n=[];for(r=t.exec(e);r;){const o=document.createElement("a"),a=JSON.parse(r[1]),l=Object.entries(a);for(let[e,t]of l)o.setAttribute(e,t);o.className="editor_custom_link",o.innerHTML="logDownload",n.push({start:r.index,end:r.index+r[0].length,node:o}),r=t.exec(e)}return n}function x(e){let t=[];return function(){const r=new RegExp("#log<(\\w*)>log#((.|\r\n|\n)*?)#log<(\\w*)>log#","g");let n;for(n=r.exec(e),console.log(n);n;){let o=n[0].replace(/\r\n/g,"\n").split("\n"),a=n[2].replace(/\r\n/g,"\n").split("\n");const l=document.createElement("span");let i=n[1];console.log(i),l.className=`c-editor--log__${i}`;let c=0;for(let e=0;e<o.length;e++){let r=o[e],i=a[e],s=l.cloneNode(!1);s.innerText=i,t.push({start:n.index+c,end:n.index+c+r.length,node:s}),c=c+r.length+1}n=r.exec(e)}}(),t}y.render=function(e,t,n,o,a,l){return r.openBlock(),r.createElementBlock("div",w,null,512)},(_=b||(b={})).info="info",_.warning="warning",_.error="error";const j=[{regex:/(\[.*?\])([ \t]*)(<error>)/,token:["tag",null,"error.strong"],sol:!0,next:"error"},{regex:/(\[.*?\])([ \t]*)(<info>)/,token:["tag",null,"bracket"],sol:!0,next:"info"},{regex:/(\[.*?\])([ \t]*)(<warning>)/,token:["tag",null,"comment"],sol:!0,next:"warning"}];d.defineSimpleMode("fclog",{start:[...j,{regex:/.*/,token:"hr"}],error:[...j,{regex:/.*/,token:"error.strong"}],info:[...j,{regex:/.*/,token:"bracket"}],warning:[...j,{regex:/.*/,token:"comment"}]}),m.defineSimpleMode("log",{start:[{regex:/^[=]+[^=]*[=]+/,token:"strong"},{regex:/([^\w])([A-Z][\w]*)/,token:[null,"string"]},{regex:/(^[A-Z][\w]*)/,token:"string"}]});const S=window.CodeMirror||u.default,M=r.defineComponent({name:"codemirror-fclog",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""},KeepCursorInEnd:{type:Boolean,default:!0}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const n=r.ref(),o=r.ref(null),a=r.computed((()=>e.KeepCursorInEnd)),l=(t=e.cminstance)=>{t.getAllMarks().forEach((e=>e.clear()));const r=t.getValue(),n=[].concat(O(r)).concat(x(r));for(let e=0;e<n.length;e++){const r=n[e];t.markText(t.posFromIndex(r.start),t.posFromIndex(r.end),{replacedWith:r.node})}},i=()=>{o.value=r.markRaw(S.fromTextArea(n.value,e.options)),t("update:cminstance",r.markRaw(o.value)),o.value.on("change",(t=>{l(),a&&Promise.resolve().then((()=>{let t=e.cminstance.getScrollInfo();e.cminstance.scrollTo(t.left,t.height)}))}))};return r.watch((()=>e.cminstance),(r=>{r&&(l(e.cminstance),e.cminstance.setValue(e.code||e.value||e.content),t("ready",o))}),{deep:!0,immediate:!0}),r.onMounted((()=>{i()})),{initialize:i,textarea:n}}}),C=["name","placeholder"];M.render=function(e,t,n,o,a,l){return r.openBlock(),r.createElementBlock("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,C)};"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const r=Object(e);for(let n=1;n<arguments.length;n++){const e=arguments[n];if(null!=e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}return r},writable:!0,configurable:!0});const E={mode:"text",theme:"default",lineNumbers:!0,smartIndent:!0,indentUnit:2,foldGutter:!0,matchBrackets:!0,autoCloseBrackets:!0,styleActiveLine:!0},P=["update:value","change","ready"],$=r.defineComponent({name:"CodemirrorEditor",props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:""},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:()=>({})},globalOptions:{type:Object,default:()=>({})},border:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},KeepCursorInEnd:{type:Boolean,default:!1}},emits:[...P,"changes","scroll","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"],components:{Default:f,Merge:y,FcLog:M},setup(e,t){var n,o;const a=r.ref(null),l=r.ref(""),i=r.ref(),c=r.ref(Object.assign(__spreadValues({},E),e.globalOptions,e.options)),s=r.getCurrentInstance(),u=r.ref(null),d=(t=e.width,r=e.height)=>{a.value.setSize(t,r)},p=()=>{void 0!==e.unseenLines&&void 0!==marker&&e.unseenLines.forEach((e=>{const t=a.value.lineInfo(e);a.value.setGutterMarker(e,"breakpoints",t.gutterMarkers?null:marker())}))},{listenerEvents:m}=function({cminstance:e,ctx:t,internalInstance:r,content:n}){const o=()=>{let e=[];return Object.keys(r.vnode.props).forEach((t=>{if(t.startsWith("on")){let r=t.replace(t[2],t[2].toLowerCase()).slice(2);!P.includes(r)&&e.push(r)}})),e};return{listenerEvents:()=>{e.value.on("change",(e=>{const r=e.getValue();r!=n.value&&(n.value=r,t.emit("update:value",n.value),t.emit("change",n.value,e))}));const r={};return o().filter((e=>!r[e]&&(r[e]=!0))).forEach((r=>{e.value.on(r,((...e)=>{t.emit(r,...e)}))}))}}}({cminstance:a,ctx:t,internalInstance:s,content:l});r.watch((()=>e.options),(t=>{for(const r in e.options)a.value.setOption(r,t[r])}),{deep:!0}),r.watch((()=>e.value),(e=>{(e=>{if(e!==a.value.getValue()){const t=a.value.getScrollInfo();a.value.setValue(e),l.value=e,a.value.scrollTo(t.left,t.top)}p()})(e)}));return r.watch((()=>e.merge),(t=>{"fclog"!=e.options.mode&&"log"!=e.options.mode?e.merge?i.value="Merge":i.value="default":i.value="FcLog"}),{immediate:!0}),r.onBeforeUnmount((()=>{(()=>{const e=a.value.doc.cm.getWrapperElement();null==e||e.remove()})()})),{presetModeName:i,cmOptions:c,cminstance:a,content:l,ready:e=>{m(),p(),d(),t.emit("ready",a.value)},resize:d,instanceName:e.name||(null==(o=null==(n=null==s?void 0:s.parent)?void 0:n.type)?void 0:o.name)+"-cm",presetRef:u}}});$.render=function(e,t,n,o,a,l){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["codemirror-container",{merge:e.$props.merge,bordered:!e.$props.merge&&e.$props.border,"width-auto":!e.$props.width||"100%"==e.$props.width,"height-auto":!e.$props.height||"100%"==e.$props.height}])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.presetModeName),r.mergeProps({ref:"presetRef",cminstance:e.cminstance,"onUpdate:cminstance":t[0]||(t[0]=t=>e.cminstance=t)},__spreadProps(__spreadValues(__spreadValues({},e.$props),e.$attrs),{options:e.cmOptions,name:e.instanceName,content:e.content}),{onReady:e.ready}),null,16,["cminstance","onReady"]))],2)},$.install=(e,t)=>(t&&(t.options&&($.props.globalOptions.default=()=>t.options),t.events&&($.props.globalEvents.default=()=>t.events)),e.component("Codemirror",$),e),e.Codemirror=$,e.createLinkMark=function(e){return`#link#${JSON.stringify(e)}#link#`},e.createLog=function(e,t=""){return`[${k()}] <${t}> ${e}`},e.createLogMark=function(e="",t="info"){return`#log<${t}>log#${e}#log<${t}>log#`},e.createTitle=function(e="",t=20,r="="){const n=Math.floor(1.5*e.length/2),o=new Array(Math.max(t-n,5)).join(r);return`${o}${e}${o}`},e.default=$,e.getLinkMark=O,e.getLocalTime=k,e.getLogMark=x,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"})); | ||
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("codemirror"),require("codemirror/lib/codemirror.css"),require("vue"),require("codemirror/addon/merge/merge.css"),require("codemirror/addon/merge/merge.js"),require("diff-match-patch"),require("codemirror/addon/mode/simple.js"),require("codemirror/lib/codemirror.js")):"function"==typeof define&&define.amd?define(["exports","codemirror","codemirror/lib/codemirror.css","vue","codemirror/addon/merge/merge.css","codemirror/addon/merge/merge.js","diff-match-patch","codemirror/addon/mode/simple.js","codemirror/lib/codemirror.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["codemirror-editor-vue3"]={},e.codemirror,null,e.Vue,null,null,e.DiffMatchPatch,null,e.codemirror)}(this,(function(e,t,r,n,o,a,l,i,c){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t={__proto__:null,[Symbol.toStringTag]:"Module"};return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var d=s(t),p=s(l),m=u(c);const g=window.CodeMirror||d.default,f=n.defineComponent({name:"codemirror",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const r=n.ref(),o=n.ref(null),a=()=>{o.value=n.markRaw(g.fromTextArea(r.value,e.options)),t("update:cminstance",n.markRaw(o.value));let a=null;a=n.watch((()=>e.cminstance),((r,n)=>{r&&e.cminstance.setValue(e.code||e.value||e.content),t("ready",o),a()}),{deep:!0})};return n.onMounted((()=>{a()})),{initialize:a,textarea:r}}}),h=["name","placeholder"];f.render=function(e,t,r,o,a,l){return n.openBlock(),n.createElementBlock("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,h)};const v=window.CodeMirror||d.default;window.diff_match_patch=p.default,window.DIFF_DELETE=-1,window.DIFF_INSERT=1,window.DIFF_EQUAL=0;const y=n.defineComponent({name:"mergemode",props:{options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},height:{type:[String,Number],default:null}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const r=n.ref(null),o=n.ref(null);String(e.height).replace("px","");const a=()=>{r.value=n.markRaw(v.MergeView(o.value,e.options)),t("update:cminstance",n.markRaw(r.value.edit)),t("ready",r)};return n.onMounted((()=>{a()})),{mergeView:o,initialize:a}}}),b={ref:"mergeView"};var w,_;function k(){const e=new Date;return`${e.getHours()<10?"0"+e.getHours():e.getHours()}:${e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}:${e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds()}`}function O(e){const t=/#link#(.+)#link#/g;let r,n=[];for(r=t.exec(e);r;){const o=document.createElement("a"),a=JSON.parse(r[1]),l=Object.entries(a);for(let[e,t]of l)o.setAttribute(e,t);o.className="editor_custom_link",o.innerHTML="logDownload",n.push({start:r.index,end:r.index+r[0].length,node:o}),r=t.exec(e)}return n}function x(e){let t=[];return function(){const r=new RegExp("#log<(\\w*)>log#((.|\r\n|\n)*?)#log<(\\w*)>log#","g");let n;for(n=r.exec(e);n;){let o=n[0].replace(/\r\n/g,"\n").split("\n"),a=n[2].replace(/\r\n/g,"\n").split("\n");const l=document.createElement("span");let i=n[1];l.className=`c-editor--log__${i}`;let c=0;for(let e=0;e<o.length;e++){let r=o[e],i=a[e],s=l.cloneNode(!1);s.innerText=i,t.push({start:n.index+c,end:n.index+c+r.length,node:s}),c=c+r.length+1}n=r.exec(e)}}(),t}y.render=function(e,t,r,o,a,l){return n.openBlock(),n.createElementBlock("div",b,null,512)},(_=w||(w={})).info="info",_.warning="warning",_.error="error";const S=[{regex:/(\[.*?\])([ \t]*)(<error>[ \t])(.+)/,token:["tag",null,"error.strong","error.strong"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<info>)(.+)(.?)/,token:["tag",null,"bracket","bracket","hr"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<warning>)(.+)(.?)/,token:["tag",null,"comment","comment","hr"],sol:!0}];d.default.defineSimpleMode("fclog",{start:[...S,{regex:/.*/,token:"hr"}],error:[...S,{regex:/.*/,token:"error.strong"}],info:[...S,{regex:/.*/,token:"bracket"}],warning:[...S,{regex:/.*\[/,token:"comment"}]}),m.defineSimpleMode("log",{start:[{regex:/^[=]+[^=]*[=]+/,token:"strong"},{regex:/([^\w])([A-Z][\w]*)/,token:[null,"string"]},{regex:/(^[A-Z][\w]*)/,token:"string"}]});const j=window.CodeMirror||d.default,M=n.defineComponent({name:"codemirror-fclog",props:{code:String,value:String,content:String,options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""},KeepCursorInEnd:{type:Boolean,default:!0}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const r=n.ref(),o=n.ref(null),a=n.computed((()=>e.KeepCursorInEnd)),l=(t=e.cminstance)=>{t.getAllMarks().forEach((e=>e.clear()));const r=t.getValue(),n=[].concat(O(r)).concat(x(r));for(let e=0;e<n.length;e++){const r=n[e];t.markText(t.posFromIndex(r.start),t.posFromIndex(r.end),{replacedWith:r.node})}},i=()=>{o.value=n.markRaw(j.fromTextArea(r.value,e.options)),t("update:cminstance",n.markRaw(o.value)),o.value.on("change",(t=>{l(),a&&Promise.resolve().then((()=>{let t=e.cminstance.getScrollInfo();e.cminstance.scrollTo(t.left,t.height)}))}))};return n.watch((()=>e.cminstance),(r=>{r&&(l(e.cminstance),e.cminstance.setValue(e.code||e.value||e.content),t("ready",o))}),{deep:!0,immediate:!0}),n.onMounted((()=>{i()})),{initialize:i,textarea:r}}}),E=["name","placeholder"];M.render=function(e,t,r,o,a,l){return n.openBlock(),n.createElementBlock("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,E)},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const r=Object(e);for(let n=1;n<arguments.length;n++){const e=arguments[n];if(null!=e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}return r},writable:!0,configurable:!0});const P={mode:"text",theme:"default",lineNumbers:!0,smartIndent:!0,indentUnit:2,foldGutter:!0,matchBrackets:!0,autoCloseBrackets:!0,styleActiveLine:!0},$=["update:value","change","input","ready"],C=n.defineComponent({name:"CodemirrorEditor",props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:""},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:()=>({})},globalOptions:{type:Object,default:()=>({})},border:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},KeepCursorInEnd:{type:Boolean,default:!1}},emits:[...$,"changes","scroll","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"],components:{Default:f,Merge:y,FcLog:M},setup(e,t){var r,o;const a=n.ref(null),l=n.ref(""),i=n.ref(),c=n.ref(Object.assign(__spreadValues({},P),e.globalOptions,e.options)),s=n.getCurrentInstance(),u=n.ref(null),d=n.ref(null),p=n.ref(null),m=(t=e.width,r=e.height)=>{d.value=String(t).replace("px",""),p.value=String(r).replace("px","");let n=p.value;e.merge&&(n-=2),a.value.setSize(d.value,n)},g=()=>{void 0!==e.unseenLines&&void 0!==marker&&e.unseenLines.forEach((e=>{const t=a.value.lineInfo(e);a.value.setGutterMarker(e,"breakpoints",t.gutterMarkers?null:marker())}))},{listenerEvents:f}=function({cminstance:e,ctx:t,internalInstance:r,content:n}){const o=()=>{let e=[];return Object.keys(r.vnode.props).forEach((t=>{if(t.startsWith("on")){let r=t.replace(t[2],t[2].toLowerCase()).slice(2);!$.includes(r)&&e.push(r)}})),e};return{listenerEvents:()=>{e.value.on("change",(e=>{const r=e.getValue();r!=n.value&&(n.value=r,t.emit("update:value",n.value),t.emit("input",n.value),t.emit("change",n.value,e))}));const r={};return o().filter((e=>!r[e]&&(r[e]=!0))).forEach((r=>{e.value.on(r,((...e)=>{t.emit(r,...e)}))}))}}}({cminstance:a,ctx:t,internalInstance:s,content:l});n.watch((()=>e.options),(t=>{for(const r in e.options)a.value.setOption(r,t[r])}),{deep:!0}),n.watch((()=>e.value),(e=>{(e=>{if(e!==a.value.getValue()){const t=a.value.getScrollInfo();a.value.setValue(e),l.value=e,a.value.scrollTo(t.left,t.top)}g()})(e)}));return n.watch((()=>e.merge),(t=>{"fclog"!=e.options.mode&&"log"!=e.options.mode?e.merge?i.value="Merge":i.value="default":i.value="FcLog"}),{immediate:!0}),n.onBeforeUnmount((()=>{(()=>{const e=a.value.doc.cm.getWrapperElement();null==e||e.remove()})()})),{presetModeName:i,cmOptions:c,cminstance:a,content:l,ready:r=>{f(),g(),m(),t.emit("ready",a.value),n.watch([()=>e.height,()=>e.width],(([e,t])=>{m(e,t)}),{deep:!0})},resize:m,containerWidth:d,containerHeight:p,instanceName:e.name||(null==(o=null==(r=null==s?void 0:s.parent)?void 0:r.type)?void 0:o.name)+"-cm",presetRef:u}}});C.render=function(e,t,r,o,a,l){return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["codemirror-container",{merge:e.$props.merge,bordered:!e.$props.merge&&e.$props.border,"width-auto":!e.$props.width||"100%"==e.$props.width,"height-auto":!e.$props.height||"100%"==e.$props.height}]),style:n.normalizeStyle({height:e.containerHeight+"px"})},[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.presetModeName),n.mergeProps({style:{height:"100%"},ref:"presetRef",cminstance:e.cminstance,"onUpdate:cminstance":t[0]||(t[0]=t=>e.cminstance=t)},__spreadProps(__spreadValues(__spreadValues({},e.$props),e.$attrs),{options:e.cmOptions,name:e.instanceName,content:e.content}),{onReady:e.ready}),null,16,["cminstance","onReady"]))],6)};C.install=(e,t)=>(t&&(t.options&&(C.props.globalOptions.default=()=>t.options),t.events&&(C.props.globalEvents.default=()=>t.events)),e.component("Codemirror",C),e),e.Codemirror=C,e.createLinkMark=function(e){return`#link#${JSON.stringify(e)}#link#`},e.createLog=function(e,t=""){return`[${k()}] <${t}> ${e}`},e.createLogMark=function(e="",t="info"){return`#log<${t}>log#${e}#log<${t}>log#`},e.createTitle=function(e="",t=20,r="="){const n=Math.floor(1.5*e.length/2),o=new Array(Math.max(t-n,5)).join(r);return`${o}${e}${o}`},e.default=C,e.getLinkMark=O,e.getLocalTime=k,e.getLogMark=x,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"})); |
{ | ||
"name": "codemirror-editor-vue3", | ||
"description": "CodeMirror component for Vue3", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
"files": [ | ||
"dist/" | ||
"dist", | ||
"./dist/style.css" | ||
], | ||
"main": "./dist/main.umd.js", | ||
"module": "./dist/main.es.js", | ||
"main": "./dist/codemirror-editor-vue3.umd.js", | ||
"module": "./dist/codemirror-editor-vue3.es.js", | ||
"style": "./dist/style.css", | ||
"exports": { | ||
".": { | ||
"import": "./dist/main.es.js", | ||
"require": "./dist/main.umd.js" | ||
"import": "./dist/codemirror-editor-vue3.es.js", | ||
"require": "./dist/codemirror-editor-vue3.umd.js" | ||
}, | ||
"./dist/style.css": { | ||
"import": "./dist/style.css", | ||
"require": "./dist/style.css" | ||
} | ||
}, | ||
"description": "CodeMirror component for Vue3", | ||
"version": "0.1.4-beta", | ||
"license": "MIT", | ||
"private": false, | ||
@@ -23,6 +29,6 @@ "author": { | ||
"homepage": "https://github.com/RennCheung/codemirror-editor-vue3", | ||
"unpkg": "dist/main.js", | ||
"jsnext:main": "dist/main.js", | ||
"unpkg": "dist/codemirror-editor-vue3.js", | ||
"jsnext:main": "dist/codemirror-editor-vue3.js", | ||
"jspm": { | ||
"main": "dist/main.js", | ||
"main": "dist/codemirror-editor-vue3.js", | ||
"registry": "npm", | ||
@@ -47,15 +53,19 @@ "format": "esm" | ||
"publish": "git push && git push --tags && npm publish", | ||
"docs:dev": "vitepress dev docs", | ||
"docs:build": "vitepress build docs", | ||
"docs:serve": "vitepress serve docs" | ||
"docs-dev": "vitepress dev docs --open", | ||
"docs-build": "vitepress build docs", | ||
"docs-serve": "vitepress serve docs", | ||
"deploy-docs": "bash scripts/deploy.sh" | ||
}, | ||
"dependencies": { | ||
"dedent": "^0.7.0" | ||
"codemirror": "^5.62.3", | ||
"diff-match-patch": "^1.0.5" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^1.6.0", | ||
"@vue/compiler-sfc": "^3.2.2", | ||
"@vue/runtime-dom": "^3.2.2", | ||
"vitepress": "^0.16.1", | ||
"vue-tsc": "^0.2.2", | ||
"@vitejs/plugin-vue": "^1.4.0", | ||
"ant-design-vue": "^2.2.6", | ||
"babel-plugin-import": "^1.13.3", | ||
"dedent": "^0.7.0", | ||
"diff-match-patch": "^1.0.5", | ||
"eslint": "^7.23.0", | ||
@@ -69,10 +79,11 @@ "eslint-config-airbnb-base": "^14.2.1", | ||
"rollup-plugin-esbuild": "^4.5.0", | ||
"rollup-plugin-postcss": "^4.0.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-vue": "^6.0.0", | ||
"vite": "^2.5.0-beta.2", | ||
"diff-match-patch": "^1.0.5", | ||
"vite": "^2.5.1", | ||
"vite-plugin-vuedoc": "^3.1.3", | ||
"vitepress": "^0.16.1", | ||
"vue": "^3.2.2", | ||
"@vue/compiler-sfc": "^3.2.2", | ||
"codemirror": "^5.62.2" | ||
"vue-tsc": "^0.2.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
85
24124
2
23
6
+ Addedcodemirror@^5.62.3
+ Addeddiff-match-patch@^1.0.5
+ Addedcodemirror@5.65.18(transitive)
+ Addeddiff-match-patch@1.0.5(transitive)
- Removeddedent@^0.7.0
- Removeddedent@0.7.0(transitive)