@vtj/renderer 0.8.13 → 0.8.15

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/index.cjs CHANGED
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/renderer
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.8.13
5
+ * @version 0.8.15
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
- */const F="0.8.13";var S=(n=>(n.Runtime="Runtime",n.Design="Design",n.Raw="Raw",n.VNode="VNode",n))(S||{});const J=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],Ee=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],re=["vIf","vShow","vModel","vFor","vBind"],ne={String,Number,Boolean,Array,Object,Function,Date};function I(n,e){return n.map(t=>u.isUrl(t)?t:`${e}${t}`)}function B(n){return/\.css$/.test(n)}function N(n){return/\.js$/.test(n)}function se(n){return/\.json$/.test(n)}function Ce(n){return n.map(e=>`<script src="${u.url.append(e,{v:F})}"><\/script>`).join("")}function Pe(n=[]){return n.map(e=>`<link rel="stylesheet" href="${u.url.append(e,{v:F})}" />`).join("")}function oe(n,e){const t=n.filter(d=>!!d.enabled),r=[],s=[],o=[],a=[],i={},l={},c=[],m={};return t.forEach(({urls:d,assetsUrl:f,library:v,assetsLibrary:h,localeLibrary:g})=>{d?.forEach(p=>{N(p)&&r.push(p),B(p)&&s.push(p)}),v&&(a.push(v),i[v]=I(d||[],e),g&&(l[v]=g)),f&&o.push(f),h&&c.push(h),v&&h&&(m[h]=v)}),{scripts:I(r,e),css:I(s,e),materials:I(o,e),libraryExports:a,materialExports:u.dedupArray(c),materialMapLibrary:m,libraryMap:i,libraryLocaleMap:l}}function ie(n,e){const{name:t,parent:r,alias:s}=n;return r?e[r]?.[s||t]:e[s||t]}function V(n){return u.isString(n)?n:JSON.stringify(n)}function Y(n,e,t){const r=n.CSSStyleSheet;if(r.prototype.replaceSync){const s=new r;s.id=e,s.replaceSync(t);const o=n.document,a=o.adoptedStyleSheets,i=Array.from(a).filter(l=>l.id!==e);o.adoptedStyleSheets=[...i,s]}else{const s=n.document;let o=s.getElementById(e);o?o.innerHTML=t:(o=s.createElement("style"),o.id=e,o.innerHTML=t,s.head.appendChild(o))}}async function ae(n,e){const t=await window.fetch(e).then(r=>r.text()).catch(()=>"");t&&Y(window,n,t)}function K(n,e=window){const t=e.document,r=e.document.head;for(const s of n)if(!t.getElementById(s)){const a=t.createElement("link");a.rel="stylesheet",a.id=s,a.href=s,r.appendChild(a)}}async function ce(n,e,t=window){const r=t.document,s=t.document.head;let o=t[e];return o?o.default||o:new Promise((a,i)=>{for(const l of n){const c=r.createElement("script");c.src=l,c.onload=()=>{o=t[e],o&&a(o.default||o)},c.onerror=m=>{i(m)},s.appendChild(c)}})}function le(n){return u.isFunction(n)||u.isFunction(n?.install)}function R(n,e,t=!1,r=!1){try{const s=['"use strict";',"var __self = arguments[0];"];s.push("return ");let o=(n.value||"").trim();o=o.replace(/this(\W|$)/g,(i,l)=>`__self${l}`),o=s.join(`
8
- `)+o;const a=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",a)(e)}catch(s){if(u.logger.error("parseExpression.error",s,n,e?.__self??e),r)throw s}}function L(n,e,t=!1,r=!1){const s=R(n,e,t,r);if(typeof s!="function"&&(u.logger.error("parseFunction.error","not a function",n,e?.__self??e),r))throw new Error(`"${n.value}" not a function`);return s}function w(n){return n&&n.type==="JSExpression"}function O(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function ue(n){return w(n)||O(n)}function be(n){return ue(n)?n.value:JSON.stringify(n)}let b=null;const Fe=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:n=>n.data?.code===0||!!n.data?.success,failMessage:!0,showError:n=>{x.ElNotification.error({message:n||"未知错误"})},showLoading:()=>{b&&b.close(),b=x.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{b&&(b.close(),b=null)}}});function pe(n,e){const{jsonp:t,request:r}=e;if(n.method==="jsonp")return(s={})=>t(n.url,{...n.jsonpOptions,query:s});{const s=n.headers?R(n.headers,{},!0):void 0,o={url:n.url,method:n.method,settings:{...n.settings,headers:s}};return(a,i)=>r.send(u.merge(o,i||{},{data:a}))}}function de(n=[],e){return n.reduce((t,r)=>(t[r.id]=pe(r,e),t),{})}function fe(n=[]){T.setup({timeout:"50-500"}),X(),n.forEach(e=>me(e))}function me(n){if(!n.mock)return;const{url:e,mockTemplate:t}=n;if(e&&t){const r=u.pathToRegexp(`${e}(.*)`),s=u.pathToRegexpMatch(e,{decode:decodeURIComponent}),o=R(t,{},!0);T.mock(r,a=>{const i=u.url.parse(a.url)||{},l=a.body instanceof FormData?u.formDataToJson(a.body):a.body,c=s(a.url)?.params;return Object.assign(a,{data:l,params:i,query:c}),T.mock(o(a))})}}function X(){T._mocked={}}class he{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};__transform={};constructor(e){const{mode:t,dsl:r,attrs:s}=e;this.__mode=t,r&&(this.__id=r.id||null,this.__transform=r.transform||{}),s&&Object.assign(this,s)}setup(e,t=A){const r=t.getCurrentInstance();if(!r)return;this.__instance=r.proxy;const s=r.appContext.config.globalProperties;Object.assign(this,s),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()})}__proxy(){this.__instance&&J.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){J.forEach(e=>{this[e]=null})}__parseFunction(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return L({type:r,value:s},this)}else return L(e,this)}__parseExpression(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return R({type:r,value:s},this)}else return R(e,this)}__ref(e=null,t){if(this.__mode!==S.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),r=>{let s=r?.$vtjEl||r?.$el||r;if(!s){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}if(s.nodeType===3&&s.nextSibling&&(s=s.nextSibling),s.__vtj__=e,S.Design===this.__mode&&(s.__context__=this),e&&(this.__refs[e]=r),typeof t=="function")t(r);else if(t){const o=this.$refs[t];if(o){const a=new Set([].concat(o,r));this.$refs[t]=Array.from(a)}else this.$refs[t]=r}return r}}__clone(e={}){const t={...this.context,...e},r={...t,context:t};return r.context.__proto__=this.context,r.__proto__=this,r}}function D(n){const{Vue:e=A,mode:t=S.Runtime,components:r={},libs:s={},apis:o={},loader:a}=n,i=e.computed(()=>n.dsl),l={$components:r,$libs:s,$apis:o},c=new he({mode:t,dsl:i.value,attrs:l}),m=e.defineComponent({name:i.value.name,props:{...Re(i.value.props??[],c)},setup(d){c.$props=d,c.props=d,i.value.id&&Y(n.window||window,i.value.id,i.value.css||""),c.state=Ie(e,i.value.state??{},c);const f=He(e,i.value.computed??{},c),v=Oe(i.value.methods??{},c),h=Me(e,i.value.inject,c),g=ve(i.value.dataSources||{},c),p={...h,...f,...v,...g};return c.setup(p,e),xe(e,i.value.watch??[],c),{vtj:c}},emits:[...i.value.emits??[]],expose:["vtj"],render(){if(!i.value.nodes)return null;const d=i.value.nodes||[];return d.length===1?H(d[0],c,e,a):d.map(f=>H(f,c,e,a))},...Te(i.value.lifeCycles??{},c)});return{renderer:e.markRaw(m),context:c}}function Re(n=[],e){const t=r=>r?(Array.isArray(r)?r:[r]).map(o=>ne[o]):void 0;return n.map(r=>u.isString(r)?{name:r}:{name:r.name,type:r.type,required:r.required,default:w(r.default)?e.__parseExpression(r.default):r.default}).reduce((r,s)=>(r[s.name]={type:t(s.type),required:s.required,default:s.default},r),{})}function Ie(n,e,t){return n.reactive(Object.keys(e||{}).reduce((r,s)=>{let o=e[s];return w(o)?o=t.__parseExpression(o):O(o)&&(o=t.__parseFunction(o)),r[s]=o,r},{}))}function He(n,e,t){return Object.entries(e??{}).reduce((r,[s,o])=>(r[s]=n.computed(t.__parseFunction(o)),r),{})}function Oe(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}function Me(n,e=[],t){return e.reduce((r,s)=>{const{name:o,from:a}=s||{};s.default;const i=w(a)?t.__parseExpression(a)||o:a??o,l=w(s.default)?t.__parseExpression(s.default):s.default??null;return r[o]=n.inject(i,l),r},{})}function ve(n,e){return Object.keys(n).reduce((t,r)=>{const s=n[r],o=e.$apis[s.ref],a=O(s.transform)?s.transform.value?e.__parseFunction(s.transform):void 0:s.transform;return t[r]=async(...i)=>{const l=await o.apply(e,i);return a?a(l):l},t},{})}function xe(n,e=[],t){e.forEach(r=>{n.watch(t.__parseExpression(r.source),t.__parseFunction(r.handler),{deep:r.deep,immediate:r.immediate})})}function Te(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}let q=[];const ge=n=>n;async function W(n,e=window){const{urls:t=[],library:r}=n,s=t.filter(l=>N(l));if(s.length===0||!r)return null;const o=t.filter(l=>B(l));let a;const i=await ce(s,r,e).catch(()=>null);return i?.plugin&&(a=i.plugin),a?{component:a,css:o}:null}function k(n){const{getDsl:e,getDslByUrl:t,options:r}=n;return r.window&&(q.forEach(s=>{delete r.window[s]}),q=[]),(s,o,a=A)=>!o||typeof o=="string"?s:o.type==="Schema"&&o.id?a.defineAsyncComponent(async()=>{const i=await e(o.id);return i&&(i.name=s),i?D({...r,Vue:a,dsl:i,mode:S.Runtime,loader:k(n)}).renderer:null}):o.type==="UrlSchema"&&o.url?a.defineAsyncComponent(async()=>{const i=await t(o.url);return i&&(i.name=s),i?D({...r,Vue:a,dsl:i,mode:S.Runtime,loader:k(n)}).renderer:null}):o.type==="Plugin"?(o.library&&q.push(o.library),a.defineAsyncComponent(async()=>{const i=await W(o,r.window);return i?(K(i.css,r.window),i.component):null})):s}function H(n,e,t=A,r=ge){if(!n||!n.name||n.invisible)return null;const{id:s=null,directives:o=[]}=n,{vIf:a,vFor:i,vShow:l,vModels:c,vBind:m}=De(o);if(a&&!ke(a,e))return null;const d=f=>{const v=f.$components,h=(()=>{if(n.name==="component")return Ae(f,n.props?.is);if(n.name==="slot")return n.name;const _=r(n.name,n.from,t);return u.isString(_)?v[_]??_:_})(),g=Be(s,n.props??{},f),p=Ne(t,n.events??{},f);if(n.name==="slot")return Ue(t,n,g,f,r);m&&Object.assign(g,f.__parseExpression(m.value)),l&&(g.style=Object.assign(g.style??{},Je(l,f))),c.forEach(_=>{Object.assign(g,Le(t,_,f))});const $=Ve(t,n.children??[],f,r,n);return t.createVNode(h,{...g,...p},$)};return i?Xe(i,d,e):d(e)}function De(n=[]){const e=n.find(i=>u.camelCase(i.name)==="vIf"),t=n.find(i=>u.camelCase(i.name)==="vFor"),r=n.find(i=>u.camelCase(i.name)==="vShow"),s=n.find(i=>u.camelCase(i.name)==="vBind"),o=n.filter(i=>u.camelCase(i.name)==="vModel"),a=n.filter(i=>!re.includes(u.camelCase(i.name)));return{vIf:e,vFor:t,vShow:r,vModels:o,vBind:s,others:a}}function ke(n,e){return!!e.__parseExpression(n.value)}function Ae(n,e){return e?w(e)?n.__parseExpression(e):e:"div"}function Be(n,e,t){const r=Object.keys(e||{}).reduce((s,o)=>{let a=e[o];return w(a)?a=t.__parseExpression(a):O(a)&&(a=t.__parseFunction(a)),s[o]=a,s},{});return r.ref=t.__ref(n,r.ref),r}function Ne(n,e,t){const r=["passive","capture","once"],s={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((o,a)=>{const i=e[a],l=z(i.modifiers),c=l.find(f=>r.includes(f)),m="on"+u.upperFirst(a)+(c&&s[c]||""),d=t.__parseFunction(i.handler);return d&&(o[m]=n.withModifiers(d,l)),o},{})}function z(n={},e=!1){const t=Object.keys(n);return e?t.map(r=>"."+r):t}function Ue(n,e,t,r,s){const{children:o}=e,a=qe(e,r),i=r.$slots?.[a.name];return i?i(t):o?u.isString(o)?n.createTextVNode(o):w(o)?n.createTextVNode(V(r.__parseExpression(o))):Array.isArray(o)?o.map(l=>H(l,r,n,s)):null:null}function qe(n,e){const{props:t}=n,r=t?.name||"default";return{name:w(r)?e.__parseExpression(r):r,params:[]}}function Je(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function Le(n,e,t){const r={type:"JSFunction",value:e.value?.value?`(v) => {
7
+ */const F="0.8.15";var w=(n=>(n.Runtime="Runtime",n.Design="Design",n.Raw="Raw",n.VNode="VNode",n))(w||{});const J=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],Ee=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],re=["vIf","vShow","vModel","vFor","vBind"],ne={String,Number,Boolean,Array,Object,Function,Date};function I(n,e){return n.map(t=>u.isUrl(t)?t:`${e}${t}`)}function B(n){return/\.css$/.test(n)}function N(n){return/\.js$/.test(n)}function se(n){return/\.json$/.test(n)}function Ce(n){return n.map(e=>`<script src="${u.url.append(e,{v:F})}"><\/script>`).join("")}function Pe(n=[]){return n.map(e=>`<link rel="stylesheet" href="${u.url.append(e,{v:F})}" />`).join("")}function oe(n,e){const t=n.filter(d=>!!d.enabled),r=[],s=[],o=[],a=[],i={},l={},c=[],m={};return t.forEach(({urls:d,assetsUrl:f,library:v,assetsLibrary:h,localeLibrary:g})=>{d?.forEach(p=>{N(p)&&r.push(p),B(p)&&s.push(p)}),v&&(a.push(v),i[v]=I(d||[],e),g&&(l[v]=g)),f&&o.push(f),h&&c.push(h),v&&h&&(m[h]=v)}),{scripts:I(r,e),css:I(s,e),materials:I(o,e),libraryExports:a,materialExports:u.dedupArray(c),materialMapLibrary:m,libraryMap:i,libraryLocaleMap:l}}function ie(n,e){const{name:t,parent:r,alias:s}=n;return r?e[r]?.[s||t]:e[s||t]}function V(n){return u.isString(n)?n:JSON.stringify(n)}function Y(n,e,t){const r=n.CSSStyleSheet;if(r.prototype.replaceSync){const s=new r;s.id=e,s.replaceSync(t);const o=n.document,a=o.adoptedStyleSheets,i=Array.from(a).filter(l=>l.id!==e);o.adoptedStyleSheets=[...i,s]}else{const s=n.document;let o=s.getElementById(e);o?o.innerHTML=t:(o=s.createElement("style"),o.id=e,o.innerHTML=t,s.head.appendChild(o))}}async function ae(n,e){const t=await window.fetch(e).then(r=>r.text()).catch(()=>"");t&&Y(window,n,t)}function K(n,e=window){const t=e.document,r=e.document.head;for(const s of n)if(!t.getElementById(s)){const a=t.createElement("link");a.rel="stylesheet",a.id=s,a.href=s,r.appendChild(a)}}async function ce(n,e,t=window){const r=t.document,s=t.document.head;let o=t[e];return o?o.default||o:new Promise((a,i)=>{for(const l of n){const c=r.createElement("script");c.src=l,c.onload=()=>{o=t[e],o&&a(o.default||o)},c.onerror=m=>{i(m)},s.appendChild(c)}})}function le(n){return u.isFunction(n)||u.isFunction(n?.install)}function R(n,e,t=!1,r=!1){try{const s=['"use strict";',"var __self = arguments[0];"];s.push("return ");let o=(n.value||"").trim();o=o.replace(/this(\W|$)/g,(i,l)=>`__self${l}`),o=s.join(`
8
+ `)+o;const a=`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",a)(e)}catch(s){if(u.logger.error("parseExpression.error",s,n,e?.__self??e),r)throw s}}function L(n,e,t=!1,r=!1){const s=R(n,e,t,r);if(typeof s!="function"&&(u.logger.error("parseFunction.error","not a function",n,e?.__self??e),r))throw new Error(`"${n.value}" not a function`);return s}function S(n){return n&&n.type==="JSExpression"}function O(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function ue(n){return S(n)||O(n)}function be(n){return ue(n)?n.value:JSON.stringify(n)}let b=null;const Fe=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:n=>n.data?.code===0||!!n.data?.success,failMessage:!0,showError:n=>{x.ElNotification.error({message:n||"未知错误"})},showLoading:()=>{b&&b.close(),b=x.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{b&&(b.close(),b=null)}}});function pe(n,e){const{jsonp:t,request:r}=e;if(n.method==="jsonp")return(s={})=>t(n.url,{...n.jsonpOptions,query:s});{const s=n.headers?R(n.headers,{},!0):void 0,o={url:n.url,method:n.method,settings:{...n.settings,headers:s}};return(a,i)=>r.send(u.merge(o,i||{},{data:a}))}}function de(n=[],e){return n.reduce((t,r)=>(t[r.id]=pe(r,e),t),{})}function fe(n=[]){T.setup({timeout:"50-500"}),X(),n.forEach(e=>me(e))}function me(n){if(!n.mock)return;const{url:e,mockTemplate:t}=n;if(e&&t){const r=u.pathToRegexp(`${e}(.*)`),s=u.pathToRegexpMatch(e,{decode:decodeURIComponent}),o=R(t,{},!0);T.mock(r,a=>{const i=u.url.parse(a.url)||{},l=a.body instanceof FormData?u.formDataToJson(a.body):a.body,c=s(a.url)?.params;return Object.assign(a,{data:l,params:i,query:c}),T.mock(o(a))})}}function X(){T._mocked={}}class he{__id=null;__mode;__instance=null;__contextRefs={};__refs={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};__transform={};constructor(e){const{mode:t,dsl:r,attrs:s}=e;this.__mode=t,r&&(this.__id=r.id||null,this.__transform=r.transform||{}),s&&Object.assign(this,s)}setup(e,t=A){const r=t.getCurrentInstance();if(!r)return;this.__instance=r.proxy;const s=r.appContext.config.globalProperties;Object.assign(this,s),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()})}__proxy(){this.__instance&&J.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){J.forEach(e=>{this[e]=null})}__parseFunction(e){if(e)if(this.__mode===w.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return L({type:r,value:s},this)}else return L(e,this)}__parseExpression(e){if(e)if(this.__mode===w.Runtime){const{id:t,type:r}=e,s=t?this.__transform[t]??e.value:e.value;return R({type:r,value:s},this)}else return R(e,this)}__ref(e=null,t){if(this.__mode!==w.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),r=>{let s=r?.$vtjEl||r?.$el||r;if(!s){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}if(s.nodeType===3&&s.nextSibling&&(s=s.nextSibling),s.__vtj__=e,w.Design===this.__mode&&(s.__context__=this),e&&(this.__refs[e]=r),typeof t=="function")t(r);else if(t){const o=this.$refs[t];if(o){const a=new Set([].concat(o,r));this.$refs[t]=Array.from(a)}else this.$refs[t]=r}return r}}__clone(e={}){const t={...this.context,...e},r={...t,context:t};return r.context.__proto__=this.context,r.__proto__=this,r}}function D(n){const{Vue:e=A,mode:t=w.Runtime,components:r={},libs:s={},apis:o={},loader:a}=n,i=e.computed(()=>n.dsl),l={$components:r,$libs:s,$apis:o},c=new he({mode:t,dsl:i.value,attrs:l}),m=e.defineComponent({name:i.value.name,props:{...Re(i.value.props??[],c)},setup(d){c.$props=d,c.props=d,i.value.id&&Y(n.window||window,i.value.id,i.value.css||""),c.state=Ie(e,i.value.state??{},c);const f=He(e,i.value.computed??{},c),v=Oe(i.value.methods??{},c),h=Me(e,i.value.inject,c),g=ve(i.value.dataSources||{},c),p={...h,...f,...v,...g};return c.setup(p,e),xe(e,i.value.watch??[],c),{vtj:c}},emits:[...i.value.emits??[]],expose:["vtj"],render(){if(!i.value.nodes)return null;const d=i.value.nodes||[];return d.length===1?H(d[0],c,e,a):d.map(f=>H(f,c,e,a))},...Te(i.value.lifeCycles??{},c)});return{renderer:e.markRaw(m),context:c}}function Re(n=[],e){const t=r=>r?(Array.isArray(r)?r:[r]).map(o=>ne[o]):void 0;return n.map(r=>u.isString(r)?{name:r}:{name:r.name,type:r.type,required:r.required,default:S(r.default)?e.__parseExpression(r.default):r.default}).reduce((r,s)=>(r[s.name]={type:t(s.type),required:s.required,default:s.default},r),{})}function Ie(n,e,t){return n.reactive(Object.keys(e||{}).reduce((r,s)=>{let o=e[s];return S(o)?o=t.__parseExpression(o):O(o)&&(o=t.__parseFunction(o)),r[s]=o,r},{}))}function He(n,e,t){return Object.entries(e??{}).reduce((r,[s,o])=>(r[s]=n.computed(t.__parseFunction(o)),r),{})}function Oe(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}function Me(n,e=[],t){return e.reduce((r,s)=>{const{name:o,from:a}=s||{};s.default;const i=S(a)?t.__parseExpression(a)||o:a??o,l=S(s.default)?t.__parseExpression(s.default):s.default??null;return r[o]=n.inject(i,l),r},{})}function ve(n,e){return Object.keys(n).reduce((t,r)=>{const s=n[r],o=e.$apis[s.ref],a=O(s.transform)?s.transform.value?e.__parseFunction(s.transform):void 0:s.transform;return t[r]=async(...i)=>{const l=await o.apply(e,i);return a?a(l):l},t},{})}function xe(n,e=[],t){e.forEach(r=>{n.watch(t.__parseExpression(r.source),t.__parseFunction(r.handler),{deep:r.deep,immediate:r.immediate})})}function Te(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}let q=[];const ge=n=>n;async function W(n,e=window){const{urls:t=[],library:r}=n,s=t.filter(l=>N(l));if(s.length===0||!r)return null;const o=t.filter(l=>B(l));let a;const i=await ce(s,r,e).catch(()=>null);return i?.plugin&&(a=i.plugin),a?{component:a,css:o}:null}function k(n){const{getDsl:e,getDslByUrl:t,options:r}=n;return r.window&&(q.forEach(s=>{delete r.window[s]}),q=[]),(s,o,a=A)=>!o||typeof o=="string"?s:o.type==="Schema"&&o.id?a.defineAsyncComponent(async()=>{const i=await e(o.id);return i&&(i.name=s),i?D({...r,Vue:a,dsl:i,mode:w.Runtime,loader:k(n)}).renderer:null}):o.type==="UrlSchema"&&o.url?a.defineAsyncComponent(async()=>{const i=await t(o.url);return i&&(i.name=s),i?D({...r,Vue:a,dsl:i,mode:w.Runtime,loader:k(n)}).renderer:null}):o.type==="Plugin"?(o.library&&q.push(o.library),a.defineAsyncComponent(async()=>{const i=await W(o,r.window);return i?(K(i.css,r.window),i.component):null})):s}function H(n,e,t=A,r=ge){if(!n||!n.name||n.invisible)return null;const{id:s=null,directives:o=[]}=n,{vIf:a,vFor:i,vShow:l,vModels:c,vBind:m}=De(o);if(a&&!ke(a,e))return null;const d=f=>{const v=f.$components,h=(()=>{if(n.name==="component")return Ae(f,n.props?.is);if(n.name==="slot")return n.name;const _=r(n.name,n.from,t);return u.isString(_)?v[_]??_:_})(),g=Be(s,n.props??{},f),p=Ne(t,n.events??{},f);if(n.name==="slot")return Ue(t,n,g,f,r);m&&Object.assign(g,f.__parseExpression(m.value)),l&&(g.style=Object.assign(g.style??{},Je(l,f))),c.forEach(_=>{Object.assign(g,Le(t,_,f))});const $=Ve(t,n.children??[],f,r,n);return t.createVNode(h,{...g,...p},$)};return i?Xe(i,d,e):d(e)}function De(n=[]){const e=n.find(i=>u.camelCase(i.name)==="vIf"),t=n.find(i=>u.camelCase(i.name)==="vFor"),r=n.find(i=>u.camelCase(i.name)==="vShow"),s=n.find(i=>u.camelCase(i.name)==="vBind"),o=n.filter(i=>u.camelCase(i.name)==="vModel"),a=n.filter(i=>!re.includes(u.camelCase(i.name)));return{vIf:e,vFor:t,vShow:r,vModels:o,vBind:s,others:a}}function ke(n,e){return!!e.__parseExpression(n.value)}function Ae(n,e){return e?S(e)?n.__parseExpression(e):e:"div"}function Be(n,e,t){const r=Object.keys(e||{}).reduce((s,o)=>{let a=e[o];return S(a)?a=t.__parseExpression(a):O(a)&&(a=t.__parseFunction(a)),s[o]=a,s},{});return r.ref=t.__ref(n,r.ref),r}function Ne(n,e,t){const r=["passive","capture","once"],s={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(e||{}).reduce((o,a)=>{const i=e[a],l=z(i.modifiers),c=l.find(f=>r.includes(f)),m="on"+u.upperFirst(a)+(c&&s[c]||""),d=t.__parseFunction(i.handler);return d&&(o[m]=n.withModifiers(d,l)),o},{})}function z(n={},e=!1){const t=Object.keys(n);return e?t.map(r=>"."+r):t}function Ue(n,e,t,r,s){const{children:o}=e,a=qe(e,r),i=r.$slots?.[a.name];return i?i(t):o?u.isString(o)?n.createTextVNode(o):S(o)?n.createTextVNode(V(r.__parseExpression(o))):Array.isArray(o)?o.map(l=>H(l,r,n,s)):null:null}function qe(n,e){const{props:t}=n,r=t?.name||"default";return{name:S(r)?e.__parseExpression(r):r,params:[]}}function Je(n,e){return e.__parseExpression(n.value)?{}:{display:"none"}}function Le(n,e,t){const r={type:"JSFunction",value:e.value?.value?`(v) => {
9
9
  ${e.value.value} = v;
10
- }`:"(v) => {}"},s=t.__parseFunction(r),o=z(e.modifiers),a=w(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:o.length&&s?n.withModifiers(s,o):s}}function Ve(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(w(e))return{default:()=>V(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=Ye(e),a=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(o).reduce((i,[l,{nodes:c,params:m}])=>(i[l]=d=>{const f=m.length?u.pick(d??{},m):a(d);return c.map(v=>H(v,t.__clone(f),n,r))},i),{})}return null}function Ye(n){const e={default:{params:[],nodes:[]}};for(const t of n){const r=Ke(t.slot),s=r.name;e[s]?(e[s].nodes.push(t),e[s].params=e[s].params.concat(r.params)):e[s]={nodes:[t],params:r.params}}return e}function Ke(n="default"){return u.isString(n)?{name:n,params:[]}:{params:[],...n}}function Xe(n,e,t){const{value:r,iterator:s}=n,{item:o="item",index:a="index"}=s||{};let i=t.__parseExpression(r)||[];return Number.isInteger(i)&&(i=new Array(i).fill(!0).map((l,c)=>c+1)),Array.isArray(i)?i.map((l,c)=>e(t.__clone({[o]:l,[a]:c}))):(console.warn("[vForRender]:",`${r?.value} is not a Arrary`),[])}const ee=j.defineComponent({name:"VtjPageContainer",async setup(){const n=Q(),e=te.useRoute(),t=e.params.id,r=t?n.getPage(t):n.getHomepage(),s=r?await n.getRenderComponent(r.id):null;return r&&we.useTitle(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?j.h(this.component,this.query):j.h("div","页面不存在")}}),We=j.defineComponent({name:"VtjStartupContainer",render(){return j.h(je.XStartup)}}),G=Symbol("Provider");class ye extends E.Base{mode;globals={};modules={};adapter={request:Fe,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};constructor(e){super();const{service:t,mode:r=S.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:m=null,materialPath:d="./",nodeEnv:f="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=m,this.materialPath=d,this.nodeEnv=f,s&&(this.dependencies=s),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i),r!==S.Design&&this.load(a)}async load(e){const t=this.modules[`.vtj/projects/${e.id}.json`];if(this.project=t?await t():await this.service.init(e),!this.project)throw new Error("project is null");const{dependencies:r=[],apis:s}=this.project,{dependencies:o,library:a,components:i,materialPath:l}=this,{libraryExports:c,libraryMap:m,materials:d,materialExports:f,materialMapLibrary:v}=oe(r,l),h=window;h.CKEDITOR_VERSION=void 0;for(const p of c){const $=o[p],_=h[p];if(_)a[p]=_;else if($)h[p]=a[p]=await $();else{const C=m[p]||[];for(const P of C)B(P)&&await ae(p,u.url.append(P,{v:F})),N(P)&&await u.loadScript(u.url.append(P,{v:F}));a[p]=h[p]}}for(const p of d)await u.loadScript(u.url.append(p,{v:F}));const g=this.materials||{};for(const p of f){const $=h[v[p]],_=E.BUILT_IN_COMPONENTS[p];if(_)$&&_.forEach(C=>{i[C]=$[C]});else{const C=g[p]?(await g[p]()).default:h[p];C&&$&&(C.components||[]).forEach(P=>{i[P.name]=ie(P,$)})}}s&&(this.apis=de(s,this.adapter),X(),this.project.config?.mock&&fe(s)),this.initRouter(),this.triggerReady()}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:ee}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?ee:We}))}install(e){const t=e.config.globalProperties.installed||{};for(const[r,s]of Object.entries(this.library))!t[r]&&le(s)&&(e.use(s),t[r]=!0);e.provide(G,this),e.config.globalProperties.installed=t}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(r=>r.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},r=(s,o=[])=>{for(const a of o){if(a.id===s)return a;if(a.children&&a.children.length){const i=r(s,a.children);if(i)return i}}};return r(e,t)||null}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const t=this.modules[`.vtj/files/${e}.json`];return t?await t():this.service.getFile(e).catch(()=>null)}async getDslByUrl(e){const t=this.urlDslCaches[e];return t||(this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(r=>r.data).catch(()=>null))}createDslRenderer(e,t={}){const{library:r,components:s,mode:o,apis:a}=this,i={mode:o,Vue:r.Vue,components:s,libs:r,apis:a,window,...t},l=k({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return D({...i,dsl:e,loader:l})}async getRenderComponent(e){const t=this.getFile(e);if(!t)return u.logger.warn(`Can not find file: ${e}`),null;const r=`.vtj/vue/${e}.vue`,s=this.modules[r];if(s)return(await s())?.default;const o=await this.getDsl(t.id);return o?this.createDslRenderer(o).renderer:(u.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return j.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return j.defineAsyncComponent(async()=>{const t=await W(e,window);return t?(K(t.css),t.component):null})}}function ze(n){const e=new ye(n);return{provider:e,onReady:r=>e.ready(r)}}function Q(n={}){const e=j.inject(G);if(!e)throw new Error("Can not find provider");if(e.mode===S.Raw&&e.nodeEnv==="development"){const{id:t,version:r}=n;t&&r&&(async()=>{const s=await e.getDsl(t);s?.__VERSION__!==r&&x.ElNotification.warning({title:s?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Z=new u.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0,showError:n=>{x.ElNotification.error({message:n||"未知错误"})}}}),Ge=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Z.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),Qe=(n="/vtj/local/repository/uploader.json")=>async(e,t)=>await Z.send({url:n,method:"post",data:{files:e,projectId:t},settings:{type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);class U{api;pluginCaches={};uploader;constructor(){this.api=Ge(),this.uploader=Qe()}async getExtension(){console.log("BaseService.getExtension")}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return console.log("BaseService.saveMaterials",e,t),!1}async saveFile(e){return console.log("BaseService.saveFile",e),!1}async getFile(e){return console.log("BaseService.getFile",e),{}}async removeFile(e){return console.log("BaseService.removeFile",e),!1}async saveHistory(e){return console.log("BaseService.saveHistory",e),!1}async removeHistory(e){return console.log("BaseService.removeHistory",e),!1}async getHistory(e){return console.log("BaseService.getHistory",e),{}}async getHistoryItem(e,t){return console.log("BaseService.getHistoryItem",e,t),{}}async saveHistoryItem(e,t){return console.log("BaseService.saveHistoryItem",e,t),!1}async removeHistoryItem(e,t){return console.log("BaseService.removeHistoryItem",e,t),!1}async publish(e){return!!await this.api("publish",e).catch(()=>!1)}async publishFile(e,t){return!!await this.api("publishFile",{project:e,file:t}).catch(()=>!1)}async genVueContent(e,t){return await this.api("genVueContent",{project:e,dsl:t}).catch(()=>"")}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,t){return await this.uploader(e,t).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,t){return await this.api("removeStaticFile",{name:e,projectId:t}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:t=[]}=e,r=t.filter(o=>se(o))[0];if(!r)return null;const s=this.pluginCaches[r];return s||(this.pluginCaches[r]=Z.send({url:r,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}}const y=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Ze extends U{init(e){const t=new E.ProjectModel(e),r=y.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return y.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new E.ProjectModel(e);return y.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return y.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return y.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=y.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return y.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return y.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=y.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),y.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=y.get(`history_${e}`),r=new E.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=y.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return y.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{y.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class _e extends U{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new E.ProjectModel(e),r=this.projects[t.id]||{},s=Object.assign(t.toDsl(),r);return this.projects[s.id]=s,Promise.resolve(s)}saveProject(e){const t=new E.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const t=this.files[e];return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const t=this.histories[e];if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],r=new E.HistoryModel(t||{id:e});return Promise.resolve(r)}getHistoryItem(e,t){const r=`${e}_${t}`,s=this.historyItems[r]||{};return Promise.resolve(s)}saveHistoryItem(e,t){const r=`${e}_${t.id}`;return this.historyItems[r]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{const s=`${e}_${r}`;delete this.historyItems[s]}),Promise.resolve(!0)}}let M=null;function et(){return M||(M=new _e,M)}class tt extends U{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return!!await this.api("saveMaterials",{project:e,materials:u.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}function Se(n=[]){return n.map(e=>{const{id:t,title:r,icon:s,children:o,hidden:a}=e;return{id:t,title:r,icon:s,hidden:a,url:`/page/${t}`,children:o&&o.length?Se(o):void 0}})}function rt(){const n=Q(),e=te.useRoute(),t=j.ref(!1),r=n.project;j.watchEffect(()=>{const{name:a,params:i,meta:l}=e;if(a==="VtjPage"){const c=n.getPage(i.id);t.value=!c?.mask}else if(a==="VtjHomepage"){const c=n.getHomepage();t.value=!c?.mask}else t.value=!l.mask});const s=Se(r?.pages),o=r?.config;return{disabled:t,logo:o?.logo,themeSwitchable:o?.themeSwitchable,title:o?.title||r?.description||r?.name||"VTJ App",menus:s}}exports.BUILT_IN_DIRECTIVES=re;exports.BaseService=U;exports.CONTEXT_HOST=J;exports.Context=he;exports.ContextMode=S;exports.DATA_TYPES=ne;exports.JSCodeToString=be;exports.LIFE_CYCLES_LIST=Ee;exports.LocalService=tt;exports.MemoryService=_e;exports.Provider=ye;exports.StorageService=Ze;exports.VTJ_RENDERER_VERSION=F;exports.adoptedStyleSheets=Y;exports.createAssetScripts=Ce;exports.createAssetsCss=Pe;exports.createDataSources=ve;exports.createLoader=k;exports.createMemoryService=et;exports.createProvider=ze;exports.createRenderer=D;exports.createSchemaApi=pe;exports.createSchemaApis=de;exports.defaultLoader=ge;exports.fillBasePath=I;exports.getModifiers=z;exports.getPlugin=W;exports.getRawComponent=ie;exports.isCSSUrl=B;exports.isJSCode=ue;exports.isJSExpression=w;exports.isJSFunction=O;exports.isJSON=se;exports.isJSUrl=N;exports.isVuePlugin=le;exports.loadCss=ae;exports.loadCssUrl=K;exports.loadScriptUrl=ce;exports.mockApi=me;exports.mockApis=fe;exports.mockCleanup=X;exports.nodeRender=H;exports.parseDeps=oe;exports.parseExpression=R;exports.parseFunction=L;exports.providerKey=G;exports.toString=V;exports.useMask=rt;exports.useProvider=Q;
10
+ }`:"(v) => {}"},s=t.__parseFunction(r),o=z(e.modifiers),a=S(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:t.__parseExpression(e.value),[`onUpdate:${a}`]:o.length&&s?n.withModifiers(s,o):s}}function Ve(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(S(e))return{default:()=>V(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const o=Ye(e),a=i=>!i||!s?{}:s?.id&&Object.keys(i).length?{[`scope_${s.id}`]:i}:{};return Object.entries(o).reduce((i,[l,{nodes:c,params:m}])=>(i[l]=d=>{const f=m.length?u.pick(d??{},m):a(d);return c.map(v=>H(v,t.__clone(f),n,r))},i),{})}return null}function Ye(n){const e={default:{params:[],nodes:[]}};for(const t of n){const r=Ke(t.slot),s=r.name;e[s]?(e[s].nodes.push(t),e[s].params=e[s].params.concat(r.params)):e[s]={nodes:[t],params:r.params}}return e}function Ke(n="default"){return u.isString(n)?{name:n,params:[]}:{params:[],...n}}function Xe(n,e,t){const{value:r,iterator:s}=n,{item:o="item",index:a="index"}=s||{};let i=t.__parseExpression(r)||[];return Number.isInteger(i)&&(i=new Array(i).fill(!0).map((l,c)=>c+1)),Array.isArray(i)?i.map((l,c)=>e(t.__clone({[o]:l,[a]:c}))):(console.warn("[vForRender]:",`${r?.value} is not a Arrary`),[])}const ee=j.defineComponent({name:"VtjPageContainer",async setup(){const n=Q(),e=te.useRoute(),t=e.params.id,r=t?n.getPage(t):n.getHomepage(),s=r?await n.getRenderComponent(r.id):null;return r&&we.useTitle(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?j.h(this.component,this.query):j.h("div","页面不存在")}}),We=j.defineComponent({name:"VtjStartupContainer",render(){return j.h(je.XStartup)}}),G=Symbol("Provider");class ye extends E.Base{mode;globals={};modules={};adapter={request:Fe,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};constructor(e){super();const{service:t,mode:r=w.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:m=null,materialPath:d="./",nodeEnv:f="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=m,this.materialPath=d,this.nodeEnv=f,s&&(this.dependencies=s),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i),r!==w.Design&&this.load(a)}async load(e){const t=this.modules[`.vtj/projects/${e.id}.json`];if(this.project=t?await t():await this.service.init(e),!this.project)throw new Error("project is null");const{dependencies:r=[],apis:s}=this.project,{dependencies:o,library:a,components:i,materialPath:l}=this,{libraryExports:c,libraryMap:m,materials:d,materialExports:f,materialMapLibrary:v}=oe(r,l),h=window;h.CKEDITOR_VERSION=void 0;for(const p of c){const $=o[p],_=h[p];if(_)a[p]=_;else if($)h[p]=a[p]=await $();else{const C=m[p]||[];for(const P of C)B(P)&&await ae(p,u.url.append(P,{v:F})),N(P)&&await u.loadScript(u.url.append(P,{v:F}));a[p]=h[p]}}for(const p of d)await u.loadScript(u.url.append(p,{v:F}));const g=this.materials||{};for(const p of f){const $=h[v[p]],_=E.BUILT_IN_COMPONENTS[p];if(_)$&&_.forEach(C=>{i[C]=$[C]});else{const C=g[p]?(await g[p]()).default:h[p];C&&$&&(C.components||[]).forEach(P=>{i[P.name]=ie(P,$)})}}s&&(this.apis=de(s,this.adapter),X(),this.project.config?.mock&&fe(s)),this.initRouter(),this.triggerReady()}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:ee}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?ee:We}))}install(e){const t=e.config.globalProperties.installed||{};for(const[r,s]of Object.entries(this.library))!t[r]&&le(s)&&(e.use(s),t[r]=!0);e.provide(G,this),e.config.globalProperties.installed=t}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(r=>r.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},r=(s,o=[])=>{for(const a of o){if(a.id===s)return a;if(a.children&&a.children.length){const i=r(s,a.children);if(i)return i}}};return r(e,t)||null}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):null}async getDsl(e){const t=this.modules[`.vtj/files/${e}.json`];return t?await t():this.service.getFile(e).catch(()=>null)}async getDslByUrl(e){const t=this.urlDslCaches[e];return t||(this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(r=>r.data).catch(()=>null))}createDslRenderer(e,t={}){const{library:r,components:s,mode:o,apis:a}=this,i={mode:o,Vue:r.Vue,components:s,libs:r,apis:a,window,...t},l=k({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return D({...i,dsl:e,loader:l})}async getRenderComponent(e){const t=this.getFile(e);if(!t)return u.logger.warn(`Can not find file: ${e}`),null;const r=`.vtj/vue/${e}.vue`,s=this.modules[r];if(s)return(await s())?.default;const o=await this.getDsl(t.id);return o?this.createDslRenderer(o).renderer:(u.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return j.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return j.defineAsyncComponent(async()=>{const t=await W(e,window);return t?(K(t.css),t.component):null})}}function ze(n){const e=new ye(n);return{provider:e,onReady:r=>e.ready(r)}}function Q(n={}){const e=j.inject(G);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:r}=n;t&&r&&(async()=>{const s=await e.getDsl(t);s?.__VERSION__!==r&&x.ElNotification.warning({title:s?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Z=new u.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0,showError:n=>{x.ElNotification.error({message:n||"未知错误"})}}}),Ge=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Z.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),Qe=(n="/vtj/local/repository/uploader.json")=>async(e,t)=>await Z.send({url:n,method:"post",data:{files:e,projectId:t},settings:{type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);class U{api;pluginCaches={};uploader;constructor(){this.api=Ge(),this.uploader=Qe()}async getExtension(){console.log("BaseService.getExtension")}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return console.log("BaseService.saveMaterials",e,t),!1}async saveFile(e){return console.log("BaseService.saveFile",e),!1}async getFile(e){return console.log("BaseService.getFile",e),{}}async removeFile(e){return console.log("BaseService.removeFile",e),!1}async saveHistory(e){return console.log("BaseService.saveHistory",e),!1}async removeHistory(e){return console.log("BaseService.removeHistory",e),!1}async getHistory(e){return console.log("BaseService.getHistory",e),{}}async getHistoryItem(e,t){return console.log("BaseService.getHistoryItem",e,t),{}}async saveHistoryItem(e,t){return console.log("BaseService.saveHistoryItem",e,t),!1}async removeHistoryItem(e,t){return console.log("BaseService.removeHistoryItem",e,t),!1}async publish(e){return!!await this.api("publish",e).catch(()=>!1)}async publishFile(e,t){return!!await this.api("publishFile",{project:e,file:t}).catch(()=>!1)}async genVueContent(e,t){return await this.api("genVueContent",{project:e,dsl:t}).catch(()=>"")}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,t){return await this.uploader(e,t).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,t){return await this.api("removeStaticFile",{name:e,projectId:t}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:t=[]}=e,r=t.filter(o=>se(o))[0];if(!r)return null;const s=this.pluginCaches[r];return s||(this.pluginCaches[r]=Z.send({url:r,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}}const y=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class Ze extends U{init(e){const t=new E.ProjectModel(e),r=y.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return y.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new E.ProjectModel(e);return y.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return y.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return y.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=y.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return y.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return y.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=y.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),y.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=y.get(`history_${e}`),r=new E.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=y.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return y.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{y.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class _e extends U{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new E.ProjectModel(e),r=this.projects[t.id]||{},s=Object.assign(t.toDsl(),r);return this.projects[s.id]=s,Promise.resolve(s)}saveProject(e){const t=new E.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const t=this.files[e];return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const t=this.histories[e];if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],r=new E.HistoryModel(t||{id:e});return Promise.resolve(r)}getHistoryItem(e,t){const r=`${e}_${t}`,s=this.historyItems[r]||{};return Promise.resolve(s)}saveHistoryItem(e,t){const r=`${e}_${t.id}`;return this.historyItems[r]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{const s=`${e}_${r}`;delete this.historyItems[s]}),Promise.resolve(!0)}}let M=null;function et(){return M||(M=new _e,M)}class tt extends U{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e){return!!await this.api("saveProject",e).catch(()=>!1)}async saveMaterials(e,t){return!!await this.api("saveMaterials",{project:e,materials:u.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}function Se(n=[]){return n.map(e=>{const{id:t,title:r,icon:s,children:o,hidden:a}=e;return{id:t,title:r,icon:s,hidden:a,url:`/page/${t}`,children:o&&o.length?Se(o):void 0}})}function rt(){const n=Q(),e=te.useRoute(),t=j.ref(!1),r=n.project;j.watchEffect(()=>{const{name:a,params:i,meta:l}=e;if(a==="VtjPage"){const c=n.getPage(i.id);t.value=!c?.mask}else if(a==="VtjHomepage"){const c=n.getHomepage();t.value=!c?.mask}else t.value=!l.mask});const s=Se(r?.pages),o=r?.config;return{disabled:t,logo:o?.logo,themeSwitchable:o?.themeSwitchable,title:o?.title||r?.description||r?.name||"VTJ App",menus:s}}exports.BUILT_IN_DIRECTIVES=re;exports.BaseService=U;exports.CONTEXT_HOST=J;exports.Context=he;exports.ContextMode=w;exports.DATA_TYPES=ne;exports.JSCodeToString=be;exports.LIFE_CYCLES_LIST=Ee;exports.LocalService=tt;exports.MemoryService=_e;exports.Provider=ye;exports.StorageService=Ze;exports.VTJ_RENDERER_VERSION=F;exports.adoptedStyleSheets=Y;exports.createAssetScripts=Ce;exports.createAssetsCss=Pe;exports.createDataSources=ve;exports.createLoader=k;exports.createMemoryService=et;exports.createProvider=ze;exports.createRenderer=D;exports.createSchemaApi=pe;exports.createSchemaApis=de;exports.defaultLoader=ge;exports.fillBasePath=I;exports.getModifiers=z;exports.getPlugin=W;exports.getRawComponent=ie;exports.isCSSUrl=B;exports.isJSCode=ue;exports.isJSExpression=S;exports.isJSFunction=O;exports.isJSON=se;exports.isJSUrl=N;exports.isVuePlugin=le;exports.loadCss=ae;exports.loadCssUrl=K;exports.loadScriptUrl=ce;exports.mockApi=me;exports.mockApis=fe;exports.mockCleanup=X;exports.nodeRender=H;exports.parseDeps=oe;exports.parseExpression=R;exports.parseFunction=L;exports.providerKey=G;exports.toString=V;exports.useMask=rt;exports.useProvider=Q;
package/dist/index.mjs CHANGED
@@ -11,11 +11,11 @@ import { XStartup as He } from "@vtj/ui";
11
11
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
12
12
  * @name @vtj/renderer
13
13
  * @author CHC chenhuachun1549@dingtalk.com
14
- * @version 0.8.13
14
+ * @version 0.8.15
15
15
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
16
16
  */
17
- const C = "0.8.13";
18
- var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
17
+ const C = "0.8.15";
18
+ var w = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(w || {});
19
19
  const G = [
20
20
  "$el",
21
21
  "$emit",
@@ -168,14 +168,14 @@ function Q(n, e, t = !1, r = !1) {
168
168
  throw new Error(`"${n.value}" not a function`);
169
169
  return s;
170
170
  }
171
- function w(n) {
171
+ function _(n) {
172
172
  return n && n.type === "JSExpression";
173
173
  }
174
174
  function T(n) {
175
175
  return typeof n == "object" && n && n.type === "JSFunction";
176
176
  }
177
177
  function Ne(n) {
178
- return w(n) || T(n);
178
+ return _(n) || T(n);
179
179
  }
180
180
  function Ht(n) {
181
181
  return Ne(n) ? n.value : JSON.stringify(n);
@@ -304,7 +304,7 @@ class Ke {
304
304
  }
305
305
  __parseFunction(e) {
306
306
  if (e)
307
- if (this.__mode === _.Runtime) {
307
+ if (this.__mode === w.Runtime) {
308
308
  const { id: t, type: r } = e, s = t ? this.__transform[t] ?? e.value : e.value;
309
309
  return Q({ type: r, value: s }, this);
310
310
  } else
@@ -312,21 +312,21 @@ class Ke {
312
312
  }
313
313
  __parseExpression(e) {
314
314
  if (e)
315
- if (this.__mode === _.Runtime) {
315
+ if (this.__mode === w.Runtime) {
316
316
  const { id: t, type: r } = e, s = t ? this.__transform[t] ?? e.value : e.value;
317
317
  return R({ type: r, value: s }, this);
318
318
  } else
319
319
  return R(e, this);
320
320
  }
321
321
  __ref(e = null, t) {
322
- if (this.__mode !== _.VNode)
322
+ if (this.__mode !== w.VNode)
323
323
  return e && e !== this.__id && (this.__contextRefs[e] = this), (r) => {
324
324
  let s = r?.$vtjEl || r?.$el || r;
325
325
  if (!s) {
326
326
  typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
327
327
  return;
328
328
  }
329
- if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e, _.Design === this.__mode && (s.__context__ = this), e && (this.__refs[e] = r), typeof t == "function")
329
+ if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e, w.Design === this.__mode && (s.__context__ = this), e && (this.__refs[e] = r), typeof t == "function")
330
330
  t(r);
331
331
  else if (t) {
332
332
  const o = this.$refs[t];
@@ -350,7 +350,7 @@ class Ke {
350
350
  function N(n) {
351
351
  const {
352
352
  Vue: e = k,
353
- mode: t = _.Runtime,
353
+ mode: t = w.Runtime,
354
354
  components: r = {},
355
355
  libs: s = {},
356
356
  apis: o = {},
@@ -410,7 +410,7 @@ function We(n = [], e) {
410
410
  name: r.name,
411
411
  type: r.type,
412
412
  required: r.required,
413
- default: w(r.default) ? e.__parseExpression(r.default) : r.default
413
+ default: _(r.default) ? e.__parseExpression(r.default) : r.default
414
414
  }).reduce(
415
415
  (r, s) => (r[s.name] = {
416
416
  type: t(s.type),
@@ -425,7 +425,7 @@ function Xe(n, e, t) {
425
425
  Object.keys(e || {}).reduce(
426
426
  (r, s) => {
427
427
  let o = e[s];
428
- return w(o) ? o = t.__parseExpression(o) : T(o) && (o = t.__parseFunction(o)), r[s] = o, r;
428
+ return _(o) ? o = t.__parseExpression(o) : T(o) && (o = t.__parseFunction(o)), r[s] = o, r;
429
429
  },
430
430
  {}
431
431
  )
@@ -448,7 +448,7 @@ function Ge(n, e = [], t) {
448
448
  (r, s) => {
449
449
  const { name: o, from: a } = s || {};
450
450
  s.default;
451
- const i = w(a) ? t.__parseExpression(a) || o : a ?? o, l = w(s.default) ? t.__parseExpression(s.default) : s.default ?? null;
451
+ const i = _(a) ? t.__parseExpression(a) || o : a ?? o, l = _(s.default) ? t.__parseExpression(s.default) : s.default ?? null;
452
452
  return r[o] = n.inject(i, l), r;
453
453
  },
454
454
  {}
@@ -510,7 +510,7 @@ function U(n) {
510
510
  ...r,
511
511
  Vue: a,
512
512
  dsl: i,
513
- mode: _.Runtime,
513
+ mode: w.Runtime,
514
514
  loader: U(n)
515
515
  }).renderer : null;
516
516
  }) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
@@ -519,7 +519,7 @@ function U(n) {
519
519
  ...r,
520
520
  Vue: a,
521
521
  dsl: i,
522
- mode: _.Runtime,
522
+ mode: w.Runtime,
523
523
  loader: U(n)
524
524
  }).renderer : null;
525
525
  }) : o.type === "Plugin" ? (o.library && B.push(o.library), a.defineAsyncComponent(async () => {
@@ -578,13 +578,13 @@ function nt(n, e) {
578
578
  return !!e.__parseExpression(n.value);
579
579
  }
580
580
  function st(n, e) {
581
- return e ? w(e) ? n.__parseExpression(e) : e : "div";
581
+ return e ? _(e) ? n.__parseExpression(e) : e : "div";
582
582
  }
583
583
  function ot(n, e, t) {
584
584
  const r = Object.keys(e || {}).reduce(
585
585
  (s, o) => {
586
586
  let a = e[o];
587
- return w(a) ? a = t.__parseExpression(a) : T(a) && (a = t.__parseFunction(a)), s[o] = a, s;
587
+ return _(a) ? a = t.__parseExpression(a) : T(a) && (a = t.__parseFunction(a)), s[o] = a, s;
588
588
  },
589
589
  {}
590
590
  );
@@ -610,7 +610,7 @@ function ce(n = {}, e = !1) {
610
610
  }
611
611
  function at(n, e, t, r, s) {
612
612
  const { children: o } = e, a = ct(e, r), i = r.$slots?.[a.name];
613
- return i ? i(t) : o ? b(o) ? n.createTextVNode(o) : w(o) ? n.createTextVNode(
613
+ return i ? i(t) : o ? b(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
614
614
  ne(r.__parseExpression(o))
615
615
  ) : Array.isArray(o) ? o.map(
616
616
  (l) => M(l, r, n, s)
@@ -619,7 +619,7 @@ function at(n, e, t, r, s) {
619
619
  function ct(n, e) {
620
620
  const { props: t } = n, r = t?.name || "default";
621
621
  return {
622
- name: w(r) ? e.__parseExpression(r) : r,
622
+ name: _(r) ? e.__parseExpression(r) : r,
623
623
  params: []
624
624
  };
625
625
  }
@@ -634,7 +634,7 @@ function ut(n, e, t) {
634
634
  value: e.value?.value ? `(v) => {
635
635
  ${e.value.value} = v;
636
636
  }` : "(v) => {}"
637
- }, s = t.__parseFunction(r), o = ce(e.modifiers), a = w(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
637
+ }, s = t.__parseFunction(r), o = ce(e.modifiers), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
638
638
  return {
639
639
  [a]: t.__parseExpression(e.value),
640
640
  [`onUpdate:${a}`]: o.length && s ? n.withModifiers(s, o) : s
@@ -645,7 +645,7 @@ function pt(n, e, t, r, s) {
645
645
  return null;
646
646
  if (b(e))
647
647
  return { default: () => e };
648
- if (w(e))
648
+ if (_(e))
649
649
  return {
650
650
  default: () => ne(t.__parseExpression(e))
651
651
  };
@@ -726,7 +726,7 @@ class vt extends fe {
726
726
  super();
727
727
  const {
728
728
  service: t,
729
- mode: r = _.Raw,
729
+ mode: r = w.Raw,
730
730
  dependencies: s,
731
731
  materials: o,
732
732
  project: a = {},
@@ -737,7 +737,7 @@ class vt extends fe {
737
737
  materialPath: p = "./",
738
738
  nodeEnv: f = "development"
739
739
  } = e;
740
- this.mode = r, this.modules = c, this.service = t, this.router = d, this.materialPath = p, this.nodeEnv = f, s && (this.dependencies = s), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i), r !== _.Design && this.load(a);
740
+ this.mode = r, this.modules = c, this.service = t, this.router = d, this.materialPath = p, this.nodeEnv = f, s && (this.dependencies = s), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i), r !== w.Design && this.load(a);
741
741
  }
742
742
  async load(e) {
743
743
  const t = this.modules[`.vtj/projects/${e.id}.json`];
@@ -891,7 +891,7 @@ function ue(n = {}) {
891
891
  const e = Fe(le);
892
892
  if (!e)
893
893
  throw new Error("Can not find provider");
894
- if (e.mode === _.Raw && e.nodeEnv === "development") {
894
+ if (e.nodeEnv === "development") {
895
895
  const { id: t, version: r } = n;
896
896
  t && r && (async () => {
897
897
  const s = await e.getDsl(t);
@@ -1238,7 +1238,7 @@ export {
1238
1238
  W as BaseService,
1239
1239
  G as CONTEXT_HOST,
1240
1240
  Ke as Context,
1241
- _ as ContextMode,
1241
+ w as ContextMode,
1242
1242
  Oe as DATA_TYPES,
1243
1243
  Ht as JSCodeToString,
1244
1244
  Ct as LIFE_CYCLES_LIST,
@@ -1264,7 +1264,7 @@ export {
1264
1264
  ke as getRawComponent,
1265
1265
  V as isCSSUrl,
1266
1266
  Ne as isJSCode,
1267
- w as isJSExpression,
1267
+ _ as isJSExpression,
1268
1268
  T as isJSFunction,
1269
1269
  De as isJSON,
1270
1270
  L as isJSUrl,
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@vtj/renderer",
3
3
  "private": false,
4
- "version": "0.8.13",
4
+ "version": "0.8.15",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "mockjs": "~1.1.0",
8
- "@vtj/ui": "~0.8.13",
9
- "@vtj/core": "~0.8.13",
10
- "@vtj/icons": "~0.8.13",
11
- "@vtj/utils": "~0.8.13"
8
+ "@vtj/ui": "~0.8.15",
9
+ "@vtj/icons": "~0.8.15",
10
+ "@vtj/utils": "~0.8.15",
11
+ "@vtj/core": "~0.8.15"
12
12
  },
13
13
  "devDependencies": {
14
14
  "vue": "~3.4.15",
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/renderer
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.8.12
5
+ * @version 0.8.14
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export declare const version = "0.8.12";
8
+ export declare const version = "0.8.14";