@vtj/renderer 0.8.62 → 0.8.63
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 +4 -4
- package/dist/index.mjs +162 -161
- package/package.json +6 -6
- package/types/render/context.d.ts +1 -1
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.
|
|
5
|
+
* @version 0.8.63
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const P="0.8.
|
|
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 q(n,e,t=!1,r=!1){const s=b(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 I(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function le(n){return S(n)||I(n)}function be(n){return le(n)?n.value:JSON.stringify(n)}let C=null;const Re=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:n=>n.data?.code===0||!!n.data?.success,failMessage:!0,showError:n=>{O.ElNotification.error({message:n||"未知错误"})},showLoading:()=>{C&&C.close(),C=O.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{C&&(C.close(),C=null)}}});function ue(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?b(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
|
|
7
|
+
*/const P="0.8.63";var w=(n=>(n.Runtime="Runtime",n.Design="Design",n.Raw="Raw",n.VNode="VNode",n))(w||{});const U=["$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"],te=["vIf","vShow","vModel","vFor","vBind"],ne={String,Number,Boolean,Array,Object,Function,Date};function R(n,e){return n.map(t=>u.isUrl(t)?t:`${e}${t}`)}function A(n){return/\.css$/.test(n)}function k(n){return/\.js$/.test(n)}function re(n){return/\.json$/.test(n)}function Ce(n){return n.map(e=>`<script src="${u.url.append(e,{v:P})}"><\/script>`).join("")}function Pe(n=[]){return n.map(e=>`<link rel="stylesheet" href="${u.url.append(e,{v:P})}" />`).join("")}function se(n,e){const t=n.filter(d=>!!d.enabled),r=[],s=[],o=[],a=[],i={},l={},c=[],h={};return t.forEach(({urls:d,assetsUrl:f,library:p,assetsLibrary:g,localeLibrary:v})=>{d?.forEach(y=>{k(y)&&r.push(y),A(y)&&s.push(y)}),p&&(a.push(p),i[p]=R(d||[],e),v&&(l[p]=v)),f&&o.push(f),g&&c.push(g),p&&g&&(h[g]=p)}),{scripts:R(r,e),css:R(s,e),materials:R(o,e),libraryExports:a,materialExports:u.dedupArray(c),materialMapLibrary:h,libraryMap:i,libraryLocaleMap:l}}function oe(n,e){const{name:t,parent:r,alias:s}=n;return r?e[r]?.[s||t]:e[s||t]}function L(n){return u.isString(n)?n:JSON.stringify(n)}function J(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 ie(n,e){const t=await window.fetch(e).then(r=>r.text()).catch(()=>"");t&&J(window,n,t)}function V(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 ae(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):i(null)},c.onerror=h=>{i(h)},s.appendChild(c)}})}function ce(n){return u.isFunction(n)||u.isFunction(n?.install)}function b(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 q(n,e,t=!1,r=!1){const s=b(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 I(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function le(n){return S(n)||I(n)}function be(n){return le(n)?n.value:JSON.stringify(n)}let C=null;const Re=u.createRequest({settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:n=>n.data?.code===0||!!n.data?.success,failMessage:!0,showError:n=>{O.ElNotification.error({message:n||"未知错误"})},showLoading:()=>{C&&C.close(),C=O.ElLoading.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.05)"})},hideLoading:()=>{C&&(C.close(),C=null)}}});function ue(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?b(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){const{metaQuery:t}=e;if(!t)return;const{code:r,queryCode:s}=n;return(o,a)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(r,s,o,a)}}function fe(n=[],e=[],t){const r={};for(const s of n)r[s.id]=ue(s,t);for(const s of e)r[s.id]=de(s,t);return r}function pe(n=[]){x.setup({timeout:"50-500"}),W(),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=b(t,{},!0);x.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}),x.mock(o(a))})}}function W(){x._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=D){const r=t.getCurrentInstance();if(!r)return;this.__refs={},this.$refs={},this.context={},this.__contextRefs={},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()}),t.onBeforeUpdate(()=>{this.__refs={},this.$refs={},this.__contextRefs={},this.context={}})}__proxy(){this.__instance&&U.forEach(e=>{this[e]=this.__instance?.[e]})}__cleanup(){U.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 q({type:r,value:s},this)}else return q(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 b({type:r,value:s},this)}else return b(e,this)}__ref(e=null,t){if(this.__mode!==w.VNode)return e&&e!==this.__id&&(this.__contextRefs[e]=this),async r=>{await u.delay(0);let s=r?.$vtjEl||r?.$el||r?._?.vnode?.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 T(n){const{Vue:e=D,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}),h=e.defineComponent({name:i.value.name,props:{...Ie(i.value.props??[],c)},setup(d){c.$props=d,c.props=d,i.value.id&&J(n.window||window,i.value.id,i.value.css||""),c.state=Me(e,i.value.state??{},c);const f=Oe(e,i.value.computed??{},c),p=xe(i.value.methods??{},c),g=Te(e,i.value.inject,c),v=ve(i.value.dataSources||{},c),y={...g,...f,...p,...v};return c.setup(y,e),He(e,i.value.watch??[],c),{vtj:c}},emits:Fe(i.value.emits),expose:["vtj"],render(){if(!i.value.nodes)return null;const d=i.value.nodes||[];return d.length===1?F(d[0],c,e,a):d.map(f=>F(f,c,e,a))},...De(i.value.lifeCycles??{},c)});return{renderer:e.markRaw(h),context:c}}function Fe(n=[]){return n.map(e=>u.isString(e)?e:e.name)}function Ie(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 Me(n,e,t){return n.reactive(Object.keys(e||{}).reduce((r,s)=>{let o=e[s];return S(o)?o=t.__parseExpression(o):I(o)&&(o=t.__parseFunction(o)),r[s]=o,r},{}))}function Oe(n,e,t){return Object.entries(e??{}).reduce((r,[s,o])=>(r[s]=n.computed(t.__parseFunction(o)),r),{})}function xe(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}function Te(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=I(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 He(n,e=[],t){e.forEach(r=>{n.watch(t.__parseExpression(r.source),t.__parseFunction(r.handler),{deep:r.deep,immediate:r.immediate})})}function De(n,e){return Object.entries(n??{}).reduce((t,[r,s])=>(t[r]=e.__parseFunction(s),t),{})}let N=[];const ge=n=>n;async function Y(n,e=window){const{urls:t=[],library:r}=n,s=t.filter(i=>k(i));if(s.length===0||!r)return null;const o=t.filter(i=>A(i)),a=await ae(s,r,e).catch(i=>(console.warn("loadScriptUrl error",s,r,i),null));return a?{component:a,css:o}:null}function H(n){const{getDsl:e,getDslByUrl:t,options:r}=n;return r.window&&(N.forEach(s=>{delete r.window[s]}),N=[]),(s,o,a=D)=>!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?T({...r,Vue:a,dsl:i,mode:w.Runtime,loader:H(n)}).renderer:null}):o.type==="UrlSchema"&&o.url?a.defineAsyncComponent(async()=>{const i=await t(o.url);return i&&(i.name=s),i?T({...r,Vue:a,dsl:i,mode:w.Runtime,loader:H(n)}).renderer:null}):o.type==="Plugin"?(o.library&&N.push(o.library),a.defineAsyncComponent(async()=>{const i=await Y(o,r.window);return i?(V(i.css,r.window),i.component):(console.warn("getPlugin result is null",o),null)})):s}function F(n,e,t=D,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:h}=Ae(o);if(a&&!ke(a,e))return null;const d=f=>{const p=f.$components,g=(()=>{if(n.name==="component")return Be(f,n.props?.is);if(n.name==="slot")return n.name;const E=r(n.name,n.from,t);return u.isString(E)?p[E]??E:E})(),v=Ne(s,n.props??{},f),y=Ue(t,n.events??{},f);if(n.name==="slot")return qe(t,n,v,f,r);h&&Object.assign(v,f.__parseExpression(h.value)),l&&(v.style=Object.assign(v.style??{},Je(l,f))),c.forEach(E=>{Object.assign(v,Ve(t,E,f))});const j=We(t,n.children??[],f,r,n);return t.createVNode(g,{...v,...y},j)};return i?Xe(i,d,e):d(e)}function Ae(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=>!te.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 Be(n,e){return e?S(e)?n.__parseExpression(e):e:"div"}function Ne(n,e,t){const r=Object.keys(e||{}).reduce((s,o)=>{let a=e[o];return S(a)?a=t.__parseExpression(a):I(a)&&(a=t.__parseFunction(a)),s[o]=a,s},{});return r.ref=t.__ref(n,r.ref),r}function Ue(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=K(i.modifiers),c=l.find(f=>r.includes(f)),h="on"+u.upperFirst(a)+(c&&s[c]||""),d=t.__parseFunction(i.handler);return d&&(o[h]=n.withModifiers(d,l)),o},{})}function K(n={},e=!1){const t=Object.keys(n);return e?t.map(r=>"."+r):t}function qe(n,e,t,r,s){const{children:o}=e,a=Le(e,r),i=r.$slots?.[a.name];return i?i(t):o?u.isString(o)?n.createTextVNode(o):S(o)?n.createTextVNode(L(r.__parseExpression(o))):Array.isArray(o)?o.map(l=>F(l,r,n,s)):null:null}function Le(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 Ve(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=K(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 We(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(S(e))return{default:()=>L(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:h}])=>(i[l]=f=>{const p=h.length?u.pick(f??{},h):a(f);return c.map(d=>F(d,t.__clone(p),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`),[])}function ze(n){return m.getCurrentScope()?(m.onScopeDispose(n),!0):!1}function X(n){return typeof n=="function"?n():m.unref(n)}const ye=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ge=n=>n!=null,Qe=()=>{};function Ze(n){return m.getCurrentInstance()}function et(...n){if(n.length!==1)return m.toRef(...n);const e=n[0];return typeof e=="function"?m.readonly(m.customRef(()=>({get:e,set:Qe}))):m.ref(e)}function tt(n,e){Ze()&&m.onBeforeUnmount(n,e)}function nt(n){var e;const t=X(n);return(e=t?.$el)!=null?e:t}const rt=ye?window:void 0,st=ye?window.document:void 0;function ot(){const n=m.ref(!1),e=m.getCurrentInstance();return e&&m.onMounted(()=>{n.value=!0},e),n}function it(n){const e=ot();return m.computed(()=>(e.value,!!n()))}function at(n,e,t={}){const{window:r=rt,...s}=t;let o;const a=it(()=>r&&"MutationObserver"in r),i=()=>{o&&(o.disconnect(),o=void 0)},l=m.computed(()=>{const p=X(n),d=(Array.isArray(p)?p:[p]).map(nt).filter(Ge);return new Set(d)}),c=m.watch(()=>l.value,p=>{i(),a.value&&p.size&&(o=new MutationObserver(e),p.forEach(d=>o.observe(d,s)))},{immediate:!0,flush:"post"}),h=()=>o?.takeRecords(),f=()=>{i(),c()};return ze(f),{isSupported:a,stop:f,takeRecords:h}}function ct(n=null,e={}){var t,r,s;const{document:o=st,restoreOnUnmount:a=f=>f}=e,i=(t=o?.title)!=null?t:"",l=et((r=n??o?.title)!=null?r:null),c=n&&typeof n=="function";function h(f){if(!("titleTemplate"in e))return f;const p=e.titleTemplate||"%s";return typeof p=="function"?p(f):X(p).replace(/%s/g,f)}return m.watch(l,(f,p)=>{f!==p&&o&&(o.title=h(typeof f=="string"?f:""))},{immediate:!0}),e.observe&&!e.titleTemplate&&o&&!c&&at((s=o.head)==null?void 0:s.querySelector("title"),()=>{o&&o.title!==l.value&&(l.value=h(o.title))},{childList:!0}),tt(()=>{if(a){const f=a(i,l.value||"");f!=null&&o&&(o.title=f)}}),l}const Z=m.defineComponent({name:"VtjPageContainer",async setup(){const n=G(),e=ee.useRoute(),t=e.params.id,r=t?n.getPage(t):n.getHomepage(),s=r?await n.getRenderComponent(r.id):null;return r&&ct(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?m.h(this.component,this.query):m.h("div","页面不存在")}}),lt=m.defineComponent({name:"VtjStartupContainer",render(){return m.h(je.XStartup)}}),z=Symbol("Provider");class _e extends $.Base{constructor(e){super(),this.options=e;const{service:t,mode:r=w.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:h=null,materialPath:f="./",nodeEnv:p="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=h,this.materialPath=f,this.nodeEnv=p,s&&(this.dependencies=s),o&&(this.materials=o),Object.assign(this.globals,l),Object.assign(this.adapter,i),r!==w.Design&&this.load(a)}mode;globals={};modules={};adapter={request:Re,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};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{apis:r=[],meta:s=[]}=this.project,o=window;o.CKEDITOR_VERSION=void 0,this.nodeEnv!=="production"&&await this.loadAssets(o),this.apis=pe(r,s,this.adapter),W(),this.project.config?.mock&&de(r),this.initRouter(),this.triggerReady()}async loadAssets(e){const{dependencies:t=[]}=this.project,{dependencies:r,library:s,components:o,materialPath:a}=this,{libraryExports:i,libraryMap:l,materials:c,materialExports:h,materialMapLibrary:f}=se(t,a);for(const d of i){const g=r[d],v=e[d];if(v)s[d]=v;else if(g)e[d]=s[d]=await g();else{const y=l[d]||[];for(const j of y)A(j)&&await ie(d,u.url.append(j,{v:P})),k(j)&&await u.loadScript(u.url.append(j,{v:P}));s[d]=e[d]}}for(const d of c)await u.loadScript(u.url.append(d,{v:P}));const p=this.materials||{};for(const d of h){const g=e[f[d]],v=$.BUILT_IN_COMPONENTS[d];if(v)g&&v.forEach(y=>{o[y]=g[y]});else{const y=p[d]?(await p[d]()).default:e[d];y&&g&&(y.components||[]).forEach(j=>{o[j.name]=oe(j,g)})}}}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:Z}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?Z:lt}))}install(e){const t=e.config.globalProperties.installed||{};for(const[r,s]of Object.entries(this.library))!t[r]&&ce(s)&&(e.use(s),t[r]=!0);this.options.install&&e.use(this.options.install),e.provide(z,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=H({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return T({...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 m.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return m.defineAsyncComponent(async()=>{const t=await Y(e,window);return t?(V(t.css),t.component):null})}}function ut(n){const e=new _e(n);return{provider:e,onReady:r=>e.ready(r)}}function G(n={}){const e=m.inject(z);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&&O.ElNotification.warning({title:s?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Q=new u.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0,showError:n=>{O.ElNotification.error({message:n||"未知错误"})}}}),ft=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Q.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),pt=(n="/vtj/local/repository/uploader.json")=>async(e,t)=>await Q.send({url:n,method:"post",data:{files:e,projectId:t},settings:{type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);class B{api;pluginCaches={};uploader;constructor(){this.api=ft(),this.uploader=pt()}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=>re(o))[0];if(!r)return null;const s=this.pluginCaches[r];return s||(this.pluginCaches[r]=Q.send({url:r,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}}const _=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class dt extends B{init(e){const t=new $.ProjectModel(e),r=_.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return _.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new $.ProjectModel(e);return _.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return _.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return _.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=_.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return _.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return _.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=_.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),_.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=_.get(`history_${e}`),r=new $.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=_.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return _.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{_.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class Se extends B{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new $.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 $.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 $.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 mt(){return M||(M=new Se,M)}class ht extends B{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 we(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?we(o):void 0}})}function vt(){const n=G(),e=ee.useRoute(),t=m.ref(!1),r=n.project;m.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=we(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=te;exports.BaseService=B;exports.CONTEXT_HOST=U;exports.Context=he;exports.ContextMode=w;exports.DATA_TYPES=ne;exports.JSCodeToString=be;exports.LIFE_CYCLES_LIST=Ee;exports.LocalService=ht;exports.MemoryService=Se;exports.Provider=_e;exports.StorageService=dt;exports.VTJ_RENDERER_VERSION=P;exports.adoptedStyleSheets=J;exports.createAssetScripts=Ce;exports.createAssetsCss=Pe;exports.createDataSources=ve;exports.createLoader=H;exports.createMemoryService=mt;exports.createMetaApi=fe;exports.createProvider=ut;exports.createRenderer=T;exports.createSchemaApi=ue;exports.createSchemaApis=pe;exports.defaultLoader=ge;exports.fillBasePath=R;exports.getModifiers=K;exports.getPlugin=Y;exports.getRawComponent=oe;exports.isCSSUrl=A;exports.isJSCode=le;exports.isJSExpression=S;exports.isJSFunction=I;exports.isJSON=re;exports.isJSUrl=k;exports.isVuePlugin=ce;exports.loadCss=ie;exports.loadCssUrl=V;exports.loadScriptUrl=ae;exports.mockApi=me;exports.mockApis=de;exports.mockCleanup=W;exports.nodeRender=F;exports.parseDeps=se;exports.parseExpression=b;exports.parseFunction=q;exports.providerKey=z;exports.toString=L;exports.useMask=vt;exports.useProvider=G;
|
|
10
|
+
}`:"(v) => {}"},s=t.__parseFunction(r),o=K(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 We(n,e,t,r,s){if(!e)return null;if(u.isString(e))return{default:()=>e};if(S(e))return{default:()=>L(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:h}])=>(i[l]=d=>{const f=h.length?u.pick(d??{},h):a(d);return c.map(p=>F(p,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`),[])}function ze(n){return m.getCurrentScope()?(m.onScopeDispose(n),!0):!1}function X(n){return typeof n=="function"?n():m.unref(n)}const ye=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ge=n=>n!=null,Qe=()=>{};function Ze(n){return m.getCurrentInstance()}function et(...n){if(n.length!==1)return m.toRef(...n);const e=n[0];return typeof e=="function"?m.readonly(m.customRef(()=>({get:e,set:Qe}))):m.ref(e)}function tt(n,e){Ze()&&m.onBeforeUnmount(n,e)}function nt(n){var e;const t=X(n);return(e=t?.$el)!=null?e:t}const rt=ye?window:void 0,st=ye?window.document:void 0;function ot(){const n=m.ref(!1),e=m.getCurrentInstance();return e&&m.onMounted(()=>{n.value=!0},e),n}function it(n){const e=ot();return m.computed(()=>(e.value,!!n()))}function at(n,e,t={}){const{window:r=rt,...s}=t;let o;const a=it(()=>r&&"MutationObserver"in r),i=()=>{o&&(o.disconnect(),o=void 0)},l=m.computed(()=>{const f=X(n),p=(Array.isArray(f)?f:[f]).map(nt).filter(Ge);return new Set(p)}),c=m.watch(()=>l.value,f=>{i(),a.value&&f.size&&(o=new MutationObserver(e),f.forEach(p=>o.observe(p,s)))},{immediate:!0,flush:"post"}),h=()=>o?.takeRecords(),d=()=>{i(),c()};return ze(d),{isSupported:a,stop:d,takeRecords:h}}function ct(n=null,e={}){var t,r,s;const{document:o=st,restoreOnUnmount:a=d=>d}=e,i=(t=o?.title)!=null?t:"",l=et((r=n??o?.title)!=null?r:null),c=n&&typeof n=="function";function h(d){if(!("titleTemplate"in e))return d;const f=e.titleTemplate||"%s";return typeof f=="function"?f(d):X(f).replace(/%s/g,d)}return m.watch(l,(d,f)=>{d!==f&&o&&(o.title=h(typeof d=="string"?d:""))},{immediate:!0}),e.observe&&!e.titleTemplate&&o&&!c&&at((s=o.head)==null?void 0:s.querySelector("title"),()=>{o&&o.title!==l.value&&(l.value=h(o.title))},{childList:!0}),tt(()=>{if(a){const d=a(i,l.value||"");d!=null&&o&&(o.title=d)}}),l}const Z=m.defineComponent({name:"VtjPageContainer",async setup(){const n=G(),e=ee.useRoute(),t=e.params.id,r=t?n.getPage(t):n.getHomepage(),s=r?await n.getRenderComponent(r.id):null;return r&&ct(r.title||"VTJ"),{provider:n,component:s,file:r,query:e.query}},render(){return this.component?m.h(this.component,this.query):m.h("div","页面不存在")}}),lt=m.defineComponent({name:"VtjStartupContainer",render(){return m.h(je.XStartup)}}),z=Symbol("Provider");class _e extends $.Base{constructor(e){super(),this.options=e;const{service:t,mode:r=w.Raw,dependencies:s,materials:o,project:a={},adapter:i={},globals:l={},modules:c={},router:h=null,materialPath:d="./",nodeEnv:f="development"}=e;this.mode=r,this.modules=c,this.service=t,this.router=h,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)}mode;globals={};modules={};adapter={request:Re,jsonp:u.jsonp};apis={};dependencies={};materials={};library={};service;project=null;components={};nodeEnv="development";router=null;materialPath="./";urlDslCaches={};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{apis:r=[],meta:s=[]}=this.project,o=window;o.CKEDITOR_VERSION=void 0,this.nodeEnv!=="production"&&await this.loadAssets(o),this.apis=fe(r,s,this.adapter),W(),this.project.config?.mock&&pe(r),this.initRouter(),this.triggerReady()}async loadAssets(e){const{dependencies:t=[]}=this.project,{dependencies:r,library:s,components:o,materialPath:a}=this,{libraryExports:i,libraryMap:l,materials:c,materialExports:h,materialMapLibrary:d}=se(t,a);for(const p of i){const g=r[p],v=e[p];if(v)s[p]=v;else if(g)e[p]=s[p]=await g();else{const y=l[p]||[];for(const j of y)A(j)&&await ie(p,u.url.append(j,{v:P})),k(j)&&await u.loadScript(u.url.append(j,{v:P}));s[p]=e[p]}}for(const p of c)await u.loadScript(u.url.append(p,{v:P}));const f=this.materials||{};for(const p of h){const g=e[d[p]],v=$.BUILT_IN_COMPONENTS[p];if(v)g&&v.forEach(y=>{o[y]=g[y]});else{const y=f[p]?(await f[p]()).default:e[p];y&&g&&(y.components||[]).forEach(j=>{o[j.name]=oe(j,g)})}}}initRouter(){const{router:e,project:t}=this;e&&(e.addRoute({path:"/page/:id",name:"VtjPage",component:Z}),e.addRoute({path:"/",name:"VtjHomepage",component:t?.homepage?Z:lt}))}install(e){const t=e.config.globalProperties.installed||{};for(const[r,s]of Object.entries(this.library))!t[r]&&ce(s)&&(e.use(s),t[r]=!0);this.options.install&&e.use(this.options.install),e.provide(z,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=H({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:i});return T({...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 m.defineAsyncComponent(async()=>{const r=await this.getDslByUrl(e);return r?(r.name=t||r.name,this.createDslRenderer(r).renderer):null})}definePluginComponent(e){return m.defineAsyncComponent(async()=>{const t=await Y(e,window);return t?(V(t.css),t.component):null})}}function ut(n){const e=new _e(n);return{provider:e,onReady:r=>e.ready(r)}}function G(n={}){const e=m.inject(z);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&&O.ElNotification.warning({title:s?.name,message:"当前组件源码版本与运行时版本不一致,请重新发布组件"})})()}return e}const Q=new u.Request({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0,showError:n=>{O.ElNotification.error({message:n||"未知错误"})}}}),dt=(n="/vtj/local/repository/${type}.json")=>(e,t)=>Q.send({url:n,method:"post",query:{type:e},data:{type:e,data:t}}),ft=(n="/vtj/local/repository/uploader.json")=>async(e,t)=>await Q.send({url:n,method:"post",data:{files:e,projectId:t},settings:{type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);class B{api;pluginCaches={};uploader;constructor(){this.api=dt(),this.uploader=ft()}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=>re(o))[0];if(!r)return null;const s=this.pluginCaches[r];return s||(this.pluginCaches[r]=Q.send({url:r,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(o=>o.data).catch(()=>null))}}const _=new u.Storage({type:"local",expired:0,prefix:"__VTJ_"});class pt extends B{init(e){const t=new $.ProjectModel(e),r=_.get(`project_${t.id}`),s=Object.assign(t.toDsl(),r||{});return _.save(`project_${t.id}`,s),Promise.resolve(s)}saveProject(e){const t=new $.ProjectModel(e);return _.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return _.save(`materials_${e.id}`,u.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return _.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=_.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return _.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return _.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=_.get(`history_${e}`);if(t){const s=(t.items||[]).map(o=>o.id);this.removeHistoryItem(e,s),_.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=_.get(`history_${e}`),r=new $.HistoryModel(t||{id:e});return Promise.resolve(r.toDsl())}getHistoryItem(e,t){const r=_.get(`history_${e}_${t}`);return Promise.resolve(r)}saveHistoryItem(e,t){return _.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(r=>{_.remove(`history_${e}_${r}`)}),Promise.resolve(!0)}}class Se extends B{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new $.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 $.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 $.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 mt(){return M||(M=new Se,M)}class ht extends B{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 we(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?we(o):void 0}})}function vt(){const n=G(),e=ee.useRoute(),t=m.ref(!1),r=n.project;m.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=we(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=te;exports.BaseService=B;exports.CONTEXT_HOST=U;exports.Context=he;exports.ContextMode=w;exports.DATA_TYPES=ne;exports.JSCodeToString=be;exports.LIFE_CYCLES_LIST=Ee;exports.LocalService=ht;exports.MemoryService=Se;exports.Provider=_e;exports.StorageService=pt;exports.VTJ_RENDERER_VERSION=P;exports.adoptedStyleSheets=J;exports.createAssetScripts=Ce;exports.createAssetsCss=Pe;exports.createDataSources=ve;exports.createLoader=H;exports.createMemoryService=mt;exports.createMetaApi=de;exports.createProvider=ut;exports.createRenderer=T;exports.createSchemaApi=ue;exports.createSchemaApis=fe;exports.defaultLoader=ge;exports.fillBasePath=R;exports.getModifiers=K;exports.getPlugin=Y;exports.getRawComponent=oe;exports.isCSSUrl=A;exports.isJSCode=le;exports.isJSExpression=S;exports.isJSFunction=I;exports.isJSON=re;exports.isJSUrl=k;exports.isVuePlugin=ce;exports.loadCss=ie;exports.loadCssUrl=V;exports.loadScriptUrl=ae;exports.mockApi=me;exports.mockApis=pe;exports.mockCleanup=W;exports.nodeRender=F;exports.parseDeps=se;exports.parseExpression=b;exports.parseFunction=q;exports.providerKey=z;exports.toString=L;exports.useMask=vt;exports.useProvider=G;
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Base as ve, BUILT_IN_COMPONENTS as ye, ProjectModel as I, HistoryModel as ee } from "@vtj/core";
|
|
2
|
-
import { isUrl as ge, url as b, dedupArray as _e, isString as S, isFunction as K, logger as x, createRequest as we, merge as Se, pathToRegexp as $e, pathToRegexpMatch as je, formDataToJson as Ee, camelCase as j, upperFirst as
|
|
2
|
+
import { isUrl as ge, url as b, dedupArray as _e, isString as S, isFunction as K, logger as x, createRequest as we, merge as Se, pathToRegexp as $e, pathToRegexpMatch as je, formDataToJson as Ee, delay as be, camelCase as j, upperFirst as Pe, pick as Ce, jsonp as Re, loadScript as Q, Request as Fe, Storage as Ie, mapToObject as U } from "@vtj/utils";
|
|
3
3
|
import * as O from "vue";
|
|
4
|
-
import { toRef as
|
|
4
|
+
import { toRef as xe, readonly as He, customRef as Me, ref as N, onBeforeUnmount as Oe, getCurrentScope as De, onScopeDispose as ke, unref as Te, getCurrentInstance as te, watch as ne, computed as re, onMounted as Ae, defineComponent as se, h as T, inject as Be, defineAsyncComponent as X, watchEffect as Ue } from "vue";
|
|
5
5
|
import { useRoute as oe } from "vue-router";
|
|
6
|
-
import { ElNotification as q, ElLoading as
|
|
6
|
+
import { ElNotification as q, ElLoading as Ne } from "element-plus";
|
|
7
7
|
import H from "mockjs";
|
|
8
|
-
import { XStartup as
|
|
8
|
+
import { XStartup as qe } from "@vtj/ui";
|
|
9
9
|
/**!
|
|
10
10
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
11
11
|
* @name @vtj/renderer
|
|
12
12
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
13
|
-
* @version 0.8.
|
|
13
|
+
* @version 0.8.63
|
|
14
14
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
15
15
|
*/
|
|
16
|
-
const P = "0.8.
|
|
16
|
+
const P = "0.8.63";
|
|
17
17
|
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
|
18
18
|
const Y = [
|
|
19
19
|
"$el",
|
|
@@ -27,7 +27,7 @@ const Y = [
|
|
|
27
27
|
"$props",
|
|
28
28
|
"$options",
|
|
29
29
|
"$forceUpdate"
|
|
30
|
-
],
|
|
30
|
+
], Zt = [
|
|
31
31
|
"beforeCreate",
|
|
32
32
|
"created",
|
|
33
33
|
"beforeMount",
|
|
@@ -41,7 +41,7 @@ const Y = [
|
|
|
41
41
|
"renderTriggered",
|
|
42
42
|
"activated",
|
|
43
43
|
"deactivated"
|
|
44
|
-
],
|
|
44
|
+
], Je = ["vIf", "vShow", "vModel", "vFor", "vBind"], Le = {
|
|
45
45
|
String,
|
|
46
46
|
Number,
|
|
47
47
|
Boolean,
|
|
@@ -59,20 +59,20 @@ function J(n) {
|
|
|
59
59
|
function L(n) {
|
|
60
60
|
return /\.js$/.test(n);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Ve(n) {
|
|
63
63
|
return /\.json$/.test(n);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function en(n) {
|
|
66
66
|
return n.map(
|
|
67
67
|
(e) => `<script src="${b.append(e, { v: P })}"><\/script>`
|
|
68
68
|
).join("");
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function tn(n = []) {
|
|
71
71
|
return n.map(
|
|
72
72
|
(e) => `<link rel="stylesheet" href="${b.append(e, { v: P })}" />`
|
|
73
73
|
).join("");
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function We(n, e) {
|
|
76
76
|
const t = n.filter((u) => !!u.enabled), r = [], s = [], o = [], a = [], i = {}, l = {}, c = [], d = {};
|
|
77
77
|
return t.forEach(
|
|
78
78
|
({ urls: u, assetsUrl: f, library: p, assetsLibrary: h, localeLibrary: m }) => {
|
|
@@ -91,7 +91,7 @@ function Ve(n, e) {
|
|
|
91
91
|
libraryLocaleMap: l
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ge(n, e) {
|
|
95
95
|
const { name: t, parent: r, alias: s } = n;
|
|
96
96
|
return r ? e[r]?.[s || t] : e[s || t];
|
|
97
97
|
}
|
|
@@ -113,7 +113,7 @@ function ae(n, e, t) {
|
|
|
113
113
|
o ? o.innerHTML = t : (o = s.createElement("style"), o.id = e, o.innerHTML = t, s.head.appendChild(o));
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
116
|
+
async function Ke(n, e) {
|
|
117
117
|
const t = await window.fetch(e).then((r) => r.text()).catch(() => "");
|
|
118
118
|
t && ae(window, n, t);
|
|
119
119
|
}
|
|
@@ -125,7 +125,7 @@ function ce(n, e = window) {
|
|
|
125
125
|
a.rel = "stylesheet", a.id = s, a.href = s, r.appendChild(a);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
async function
|
|
128
|
+
async function Qe(n, e, t = window) {
|
|
129
129
|
const r = t.document, s = t.document.head;
|
|
130
130
|
let o = t[e];
|
|
131
131
|
return o ? o.default || o : new Promise((a, i) => {
|
|
@@ -139,7 +139,7 @@ async function Ke(n, e, t = window) {
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Xe(n) {
|
|
143
143
|
return K(n) || K(n?.install);
|
|
144
144
|
}
|
|
145
145
|
function C(n, e, t = !1, r = !1) {
|
|
@@ -173,14 +173,14 @@ function g(n) {
|
|
|
173
173
|
function D(n) {
|
|
174
174
|
return typeof n == "object" && n && n.type === "JSFunction";
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Ye(n) {
|
|
177
177
|
return g(n) || D(n);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
return
|
|
179
|
+
function nn(n) {
|
|
180
|
+
return Ye(n) ? n.value : JSON.stringify(n);
|
|
181
181
|
}
|
|
182
182
|
let E = null;
|
|
183
|
-
const
|
|
183
|
+
const ze = we({
|
|
184
184
|
settings: {
|
|
185
185
|
type: "form",
|
|
186
186
|
validSuccess: !0,
|
|
@@ -194,7 +194,7 @@ const Ye = we({
|
|
|
194
194
|
});
|
|
195
195
|
},
|
|
196
196
|
showLoading: () => {
|
|
197
|
-
E && E.close(), E =
|
|
197
|
+
E && E.close(), E = Ne.service({
|
|
198
198
|
lock: !0,
|
|
199
199
|
text: "Loading",
|
|
200
200
|
background: "rgba(0, 0, 0, 0.05)"
|
|
@@ -205,7 +205,7 @@ const Ye = we({
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
|
-
function
|
|
208
|
+
function Ze(n, e) {
|
|
209
209
|
const { jsonp: t, request: r } = e;
|
|
210
210
|
if (n.method === "jsonp")
|
|
211
211
|
return (s = {}) => t(n.url, {
|
|
@@ -224,7 +224,7 @@ function ze(n, e) {
|
|
|
224
224
|
return (a, i) => r.send(Se(o, i || {}, { data: a }));
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function et(n, e) {
|
|
228
228
|
const { metaQuery: t } = e;
|
|
229
229
|
if (!t) return;
|
|
230
230
|
const { code: r, queryCode: s } = n;
|
|
@@ -236,20 +236,20 @@ function Ze(n, e) {
|
|
|
236
236
|
return t(r, s, o, a);
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function tt(n = [], e = [], t) {
|
|
240
240
|
const r = {};
|
|
241
241
|
for (const s of n)
|
|
242
|
-
r[s.id] = ze(s, t);
|
|
243
|
-
for (const s of e)
|
|
244
242
|
r[s.id] = Ze(s, t);
|
|
243
|
+
for (const s of e)
|
|
244
|
+
r[s.id] = et(s, t);
|
|
245
245
|
return r;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function nt(n = []) {
|
|
248
248
|
H.setup({
|
|
249
249
|
timeout: "50-500"
|
|
250
|
-
}), le(), n.forEach((e) =>
|
|
250
|
+
}), le(), n.forEach((e) => rt(e));
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function rt(n) {
|
|
253
253
|
if (!n.mock) return;
|
|
254
254
|
const { url: e, mockTemplate: t } = n;
|
|
255
255
|
if (e && t) {
|
|
@@ -263,7 +263,7 @@ function nt(n) {
|
|
|
263
263
|
function le() {
|
|
264
264
|
H._mocked = {};
|
|
265
265
|
}
|
|
266
|
-
class
|
|
266
|
+
class st {
|
|
267
267
|
__id = null;
|
|
268
268
|
__mode;
|
|
269
269
|
__instance = null;
|
|
@@ -333,8 +333,9 @@ class rt {
|
|
|
333
333
|
}
|
|
334
334
|
__ref(e = null, t) {
|
|
335
335
|
if (this.__mode !== _.VNode)
|
|
336
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), (r) => {
|
|
337
|
-
|
|
336
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (r) => {
|
|
337
|
+
await be(0);
|
|
338
|
+
let s = r?.$vtjEl || r?.$el || r?._?.vnode?.el || r;
|
|
338
339
|
if (!s) {
|
|
339
340
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
340
341
|
return;
|
|
@@ -372,22 +373,22 @@ function A(n) {
|
|
|
372
373
|
$components: r,
|
|
373
374
|
$libs: s,
|
|
374
375
|
$apis: o
|
|
375
|
-
}, c = new
|
|
376
|
+
}, c = new st({
|
|
376
377
|
mode: t,
|
|
377
378
|
dsl: i.value,
|
|
378
379
|
attrs: l
|
|
379
380
|
}), d = e.defineComponent({
|
|
380
381
|
name: i.value.name,
|
|
381
382
|
props: {
|
|
382
|
-
...
|
|
383
|
+
...it(i.value.props ?? [], c)
|
|
383
384
|
},
|
|
384
385
|
setup(u) {
|
|
385
386
|
c.$props = u, c.props = u, i.value.id && ae(
|
|
386
387
|
n.window || window,
|
|
387
388
|
i.value.id,
|
|
388
389
|
i.value.css || ""
|
|
389
|
-
), c.state =
|
|
390
|
-
const f =
|
|
390
|
+
), c.state = at(e, i.value.state ?? {}, c);
|
|
391
|
+
const f = ct(e, i.value.computed ?? {}, c), p = lt(i.value.methods ?? {}, c), h = ut(e, i.value.inject, c), m = ft(
|
|
391
392
|
i.value.dataSources || {},
|
|
392
393
|
c
|
|
393
394
|
), v = {
|
|
@@ -396,29 +397,29 @@ function A(n) {
|
|
|
396
397
|
...p,
|
|
397
398
|
...m
|
|
398
399
|
};
|
|
399
|
-
return c.setup(v, e),
|
|
400
|
+
return c.setup(v, e), pt(e, i.value.watch ?? [], c), {
|
|
400
401
|
vtj: c
|
|
401
402
|
};
|
|
402
403
|
},
|
|
403
|
-
emits:
|
|
404
|
+
emits: ot(i.value.emits),
|
|
404
405
|
expose: ["vtj"],
|
|
405
406
|
render() {
|
|
406
407
|
if (!i.value.nodes) return null;
|
|
407
408
|
const u = i.value.nodes || [];
|
|
408
409
|
return u.length === 1 ? M(u[0], c, e, a) : u.map((f) => M(f, c, e, a));
|
|
409
410
|
},
|
|
410
|
-
...
|
|
411
|
+
...dt(i.value.lifeCycles ?? {}, c)
|
|
411
412
|
});
|
|
412
413
|
return {
|
|
413
414
|
renderer: e.markRaw(d),
|
|
414
415
|
context: c
|
|
415
416
|
};
|
|
416
417
|
}
|
|
417
|
-
function
|
|
418
|
+
function ot(n = []) {
|
|
418
419
|
return n.map((e) => S(e) ? e : e.name);
|
|
419
420
|
}
|
|
420
|
-
function
|
|
421
|
-
const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) =>
|
|
421
|
+
function it(n = [], e) {
|
|
422
|
+
const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) => Le[o]) : void 0;
|
|
422
423
|
return n.map((r) => S(r) ? {
|
|
423
424
|
name: r
|
|
424
425
|
} : {
|
|
@@ -435,7 +436,7 @@ function ot(n = [], e) {
|
|
|
435
436
|
{}
|
|
436
437
|
);
|
|
437
438
|
}
|
|
438
|
-
function
|
|
439
|
+
function at(n, e, t) {
|
|
439
440
|
return n.reactive(
|
|
440
441
|
Object.keys(e || {}).reduce(
|
|
441
442
|
(r, s) => {
|
|
@@ -446,19 +447,19 @@ function it(n, e, t) {
|
|
|
446
447
|
)
|
|
447
448
|
);
|
|
448
449
|
}
|
|
449
|
-
function
|
|
450
|
+
function ct(n, e, t) {
|
|
450
451
|
return Object.entries(e ?? {}).reduce(
|
|
451
452
|
(r, [s, o]) => (r[s] = n.computed(t.__parseFunction(o)), r),
|
|
452
453
|
{}
|
|
453
454
|
);
|
|
454
455
|
}
|
|
455
|
-
function
|
|
456
|
+
function lt(n, e) {
|
|
456
457
|
return Object.entries(n ?? {}).reduce(
|
|
457
458
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
458
459
|
{}
|
|
459
460
|
);
|
|
460
461
|
}
|
|
461
|
-
function
|
|
462
|
+
function ut(n, e = [], t) {
|
|
462
463
|
return e.reduce(
|
|
463
464
|
(r, s) => {
|
|
464
465
|
const { name: o, from: a } = s || {};
|
|
@@ -469,7 +470,7 @@ function lt(n, e = [], t) {
|
|
|
469
470
|
{}
|
|
470
471
|
);
|
|
471
472
|
}
|
|
472
|
-
function
|
|
473
|
+
function ft(n, e) {
|
|
473
474
|
return Object.keys(n).reduce(
|
|
474
475
|
(t, r) => {
|
|
475
476
|
const s = n[r], o = e.$apis[s.ref], a = D(s.transform) ? s.transform.value ? e.__parseFunction(s.transform) : void 0 : s.transform;
|
|
@@ -481,7 +482,7 @@ function ut(n, e) {
|
|
|
481
482
|
{}
|
|
482
483
|
);
|
|
483
484
|
}
|
|
484
|
-
function
|
|
485
|
+
function pt(n, e = [], t) {
|
|
485
486
|
e.forEach((r) => {
|
|
486
487
|
n.watch(
|
|
487
488
|
t.__parseExpression(r.source),
|
|
@@ -493,18 +494,18 @@ function ft(n, e = [], t) {
|
|
|
493
494
|
);
|
|
494
495
|
});
|
|
495
496
|
}
|
|
496
|
-
function
|
|
497
|
+
function dt(n, e) {
|
|
497
498
|
return Object.entries(n ?? {}).reduce(
|
|
498
499
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
499
500
|
{}
|
|
500
501
|
);
|
|
501
502
|
}
|
|
502
503
|
let k = [];
|
|
503
|
-
const
|
|
504
|
+
const mt = (n) => n;
|
|
504
505
|
async function ue(n, e = window) {
|
|
505
506
|
const { urls: t = [], library: r } = n, s = t.filter((i) => L(i));
|
|
506
507
|
if (s.length === 0 || !r) return null;
|
|
507
|
-
const o = t.filter((i) => J(i)), a = await
|
|
508
|
+
const o = t.filter((i) => J(i)), a = await Qe(s, r, e).catch(
|
|
508
509
|
(i) => (console.warn("loadScriptUrl error", s, r, i), null)
|
|
509
510
|
);
|
|
510
511
|
return a ? {
|
|
@@ -539,28 +540,28 @@ function B(n) {
|
|
|
539
540
|
return i ? (ce(i.css, r.window), i.component) : (console.warn("getPlugin result is null", o), null);
|
|
540
541
|
})) : s;
|
|
541
542
|
}
|
|
542
|
-
function M(n, e, t = O, r =
|
|
543
|
+
function M(n, e, t = O, r = mt) {
|
|
543
544
|
if (!n || !n.name || n.invisible) return null;
|
|
544
|
-
const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } =
|
|
545
|
-
if (a && !
|
|
545
|
+
const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } = ht(o);
|
|
546
|
+
if (a && !vt(a, e))
|
|
546
547
|
return null;
|
|
547
548
|
const u = (f) => {
|
|
548
549
|
const p = f.$components, h = (() => {
|
|
549
550
|
if (n.name === "component")
|
|
550
|
-
return
|
|
551
|
+
return yt(f, n.props?.is);
|
|
551
552
|
if (n.name === "slot") return n.name;
|
|
552
553
|
const $ = r(n.name, n.from, t);
|
|
553
554
|
return S($) ? p[$] ?? $ : $;
|
|
554
|
-
})(), m =
|
|
555
|
+
})(), m = gt(s, n.props ?? {}, f), v = _t(t, n.events ?? {}, f);
|
|
555
556
|
if (n.name === "slot")
|
|
556
|
-
return
|
|
557
|
+
return wt(t, n, m, f, r);
|
|
557
558
|
d && Object.assign(m, f.__parseExpression(d.value)), l && (m.style = Object.assign(
|
|
558
559
|
m.style ?? {},
|
|
559
|
-
|
|
560
|
+
$t(l, f)
|
|
560
561
|
)), c.forEach(($) => {
|
|
561
|
-
Object.assign(m,
|
|
562
|
+
Object.assign(m, jt(t, $, f));
|
|
562
563
|
});
|
|
563
|
-
const w =
|
|
564
|
+
const w = Et(
|
|
564
565
|
t,
|
|
565
566
|
n.children ?? [],
|
|
566
567
|
f,
|
|
@@ -569,11 +570,11 @@ function M(n, e, t = O, r = dt) {
|
|
|
569
570
|
);
|
|
570
571
|
return t.createVNode(h, { ...m, ...v }, w);
|
|
571
572
|
};
|
|
572
|
-
return i ?
|
|
573
|
+
return i ? Ct(i, u, e) : u(e);
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
+
function ht(n = []) {
|
|
575
576
|
const e = n.find((i) => j(i.name) === "vIf"), t = n.find((i) => j(i.name) === "vFor"), r = n.find((i) => j(i.name) === "vShow"), s = n.find((i) => j(i.name) === "vBind"), o = n.filter((i) => j(i.name) === "vModel"), a = n.filter(
|
|
576
|
-
(i) => !
|
|
577
|
+
(i) => !Je.includes(j(i.name))
|
|
577
578
|
);
|
|
578
579
|
return {
|
|
579
580
|
vIf: e,
|
|
@@ -584,13 +585,13 @@ function mt(n = []) {
|
|
|
584
585
|
others: a
|
|
585
586
|
};
|
|
586
587
|
}
|
|
587
|
-
function
|
|
588
|
+
function vt(n, e) {
|
|
588
589
|
return !!e.__parseExpression(n.value);
|
|
589
590
|
}
|
|
590
|
-
function
|
|
591
|
+
function yt(n, e) {
|
|
591
592
|
return e ? g(e) ? n.__parseExpression(e) : e : "div";
|
|
592
593
|
}
|
|
593
|
-
function
|
|
594
|
+
function gt(n, e, t) {
|
|
594
595
|
const r = Object.keys(e || {}).reduce(
|
|
595
596
|
(s, o) => {
|
|
596
597
|
let a = e[o];
|
|
@@ -600,7 +601,7 @@ function yt(n, e, t) {
|
|
|
600
601
|
);
|
|
601
602
|
return r.ref = t.__ref(n, r.ref), r;
|
|
602
603
|
}
|
|
603
|
-
function
|
|
604
|
+
function _t(n, e, t) {
|
|
604
605
|
const r = ["passive", "capture", "once"], s = {
|
|
605
606
|
capture: "Capture",
|
|
606
607
|
once: "Once",
|
|
@@ -608,7 +609,7 @@ function gt(n, e, t) {
|
|
|
608
609
|
};
|
|
609
610
|
return Object.keys(e || {}).reduce(
|
|
610
611
|
(o, a) => {
|
|
611
|
-
const i = e[a], l = fe(i.modifiers), c = l.find((f) => r.includes(f)), d = "on" +
|
|
612
|
+
const i = e[a], l = fe(i.modifiers), c = l.find((f) => r.includes(f)), d = "on" + Pe(a) + (c && s[c] || ""), u = t.__parseFunction(i.handler);
|
|
612
613
|
return u && (o[d] = n.withModifiers(u, l)), o;
|
|
613
614
|
},
|
|
614
615
|
{}
|
|
@@ -618,27 +619,27 @@ function fe(n = {}, e = !1) {
|
|
|
618
619
|
const t = Object.keys(n);
|
|
619
620
|
return e ? t.map((r) => "." + r) : t;
|
|
620
621
|
}
|
|
621
|
-
function
|
|
622
|
-
const { children: o } = e, a =
|
|
622
|
+
function wt(n, e, t, r, s) {
|
|
623
|
+
const { children: o } = e, a = St(e, r), i = r.$slots?.[a.name];
|
|
623
624
|
return i ? i(t) : o ? S(o) ? n.createTextVNode(o) : g(o) ? n.createTextVNode(
|
|
624
625
|
ie(r.__parseExpression(o))
|
|
625
626
|
) : Array.isArray(o) ? o.map(
|
|
626
627
|
(l) => M(l, r, n, s)
|
|
627
628
|
) : null : null;
|
|
628
629
|
}
|
|
629
|
-
function
|
|
630
|
+
function St(n, e) {
|
|
630
631
|
const { props: t } = n, r = t?.name || "default";
|
|
631
632
|
return {
|
|
632
633
|
name: g(r) ? e.__parseExpression(r) : r,
|
|
633
634
|
params: []
|
|
634
635
|
};
|
|
635
636
|
}
|
|
636
|
-
function
|
|
637
|
+
function $t(n, e) {
|
|
637
638
|
return e.__parseExpression(n.value) ? {} : {
|
|
638
639
|
display: "none"
|
|
639
640
|
};
|
|
640
641
|
}
|
|
641
|
-
function
|
|
642
|
+
function jt(n, e, t) {
|
|
642
643
|
const r = {
|
|
643
644
|
type: "JSFunction",
|
|
644
645
|
value: e.value?.value ? `(v) => {
|
|
@@ -650,7 +651,7 @@ function $t(n, e, t) {
|
|
|
650
651
|
[`onUpdate:${a}`]: o.length && s ? n.withModifiers(s, o) : s
|
|
651
652
|
};
|
|
652
653
|
}
|
|
653
|
-
function
|
|
654
|
+
function Et(n, e, t, r, s) {
|
|
654
655
|
if (!e) return null;
|
|
655
656
|
if (S(e))
|
|
656
657
|
return { default: () => e };
|
|
@@ -659,11 +660,11 @@ function jt(n, e, t, r, s) {
|
|
|
659
660
|
default: () => ie(t.__parseExpression(e))
|
|
660
661
|
};
|
|
661
662
|
if (Array.isArray(e) && e.length > 0) {
|
|
662
|
-
const o =
|
|
663
|
+
const o = bt(e), a = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
|
|
663
664
|
[`scope_${s.id}`]: i
|
|
664
665
|
} : {};
|
|
665
666
|
return Object.entries(o).reduce((i, [l, { nodes: c, params: d }]) => (i[l] = (u) => {
|
|
666
|
-
const f = d.length ?
|
|
667
|
+
const f = d.length ? Ce(u ?? {}, d) : a(u);
|
|
667
668
|
return c.map(
|
|
668
669
|
(p) => M(p, t.__clone(f), n, r)
|
|
669
670
|
);
|
|
@@ -671,7 +672,7 @@ function jt(n, e, t, r, s) {
|
|
|
671
672
|
}
|
|
672
673
|
return null;
|
|
673
674
|
}
|
|
674
|
-
function
|
|
675
|
+
function bt(n) {
|
|
675
676
|
const e = {
|
|
676
677
|
default: {
|
|
677
678
|
params: [],
|
|
@@ -679,7 +680,7 @@ function Et(n) {
|
|
|
679
680
|
}
|
|
680
681
|
};
|
|
681
682
|
for (const t of n) {
|
|
682
|
-
const r =
|
|
683
|
+
const r = Pt(t.slot), s = r.name;
|
|
683
684
|
e[s] ? (e[s].nodes.push(t), e[s].params = e[s].params.concat(r.params)) : e[s] = {
|
|
684
685
|
nodes: [t],
|
|
685
686
|
params: r.params
|
|
@@ -687,59 +688,59 @@ function Et(n) {
|
|
|
687
688
|
}
|
|
688
689
|
return e;
|
|
689
690
|
}
|
|
690
|
-
function
|
|
691
|
+
function Pt(n = "default") {
|
|
691
692
|
return S(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
692
693
|
}
|
|
693
|
-
function
|
|
694
|
+
function Ct(n, e, t) {
|
|
694
695
|
const { value: r, iterator: s } = n, { item: o = "item", index: a = "index" } = s || {};
|
|
695
696
|
let i = t.__parseExpression(r) || [];
|
|
696
697
|
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`), []);
|
|
697
698
|
}
|
|
698
|
-
function
|
|
699
|
-
return
|
|
699
|
+
function Rt(n) {
|
|
700
|
+
return De() ? (ke(n), !0) : !1;
|
|
700
701
|
}
|
|
701
702
|
function V(n) {
|
|
702
|
-
return typeof n == "function" ? n() :
|
|
703
|
+
return typeof n == "function" ? n() : Te(n);
|
|
703
704
|
}
|
|
704
705
|
const pe = typeof window < "u" && typeof document < "u";
|
|
705
706
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
706
|
-
const
|
|
707
|
+
const Ft = (n) => n != null, It = () => {
|
|
707
708
|
};
|
|
708
|
-
function
|
|
709
|
+
function xt(n) {
|
|
709
710
|
return te();
|
|
710
711
|
}
|
|
711
|
-
function
|
|
712
|
+
function Ht(...n) {
|
|
712
713
|
if (n.length !== 1)
|
|
713
|
-
return
|
|
714
|
+
return xe(...n);
|
|
714
715
|
const e = n[0];
|
|
715
|
-
return typeof e == "function" ?
|
|
716
|
+
return typeof e == "function" ? He(Me(() => ({ get: e, set: It }))) : N(e);
|
|
716
717
|
}
|
|
717
|
-
function
|
|
718
|
-
|
|
718
|
+
function Mt(n, e) {
|
|
719
|
+
xt() && Oe(n, e);
|
|
719
720
|
}
|
|
720
|
-
function
|
|
721
|
+
function Ot(n) {
|
|
721
722
|
var e;
|
|
722
723
|
const t = V(n);
|
|
723
724
|
return (e = t?.$el) != null ? e : t;
|
|
724
725
|
}
|
|
725
|
-
const
|
|
726
|
-
function
|
|
726
|
+
const Dt = pe ? window : void 0, kt = pe ? window.document : void 0;
|
|
727
|
+
function Tt() {
|
|
727
728
|
const n = N(!1), e = te();
|
|
728
|
-
return e &&
|
|
729
|
+
return e && Ae(() => {
|
|
729
730
|
n.value = !0;
|
|
730
731
|
}, e), n;
|
|
731
732
|
}
|
|
732
|
-
function
|
|
733
|
-
const e =
|
|
733
|
+
function At(n) {
|
|
734
|
+
const e = Tt();
|
|
734
735
|
return re(() => (e.value, !!n()));
|
|
735
736
|
}
|
|
736
|
-
function
|
|
737
|
-
const { window: r =
|
|
737
|
+
function Bt(n, e, t = {}) {
|
|
738
|
+
const { window: r = Dt, ...s } = t;
|
|
738
739
|
let o;
|
|
739
|
-
const a =
|
|
740
|
+
const a = At(() => r && "MutationObserver" in r), i = () => {
|
|
740
741
|
o && (o.disconnect(), o = void 0);
|
|
741
742
|
}, l = re(() => {
|
|
742
|
-
const f = V(n), p = (Array.isArray(f) ? f : [f]).map(
|
|
743
|
+
const f = V(n), p = (Array.isArray(f) ? f : [f]).map(Ot).filter(Ft);
|
|
743
744
|
return new Set(p);
|
|
744
745
|
}), c = ne(
|
|
745
746
|
() => l.value,
|
|
@@ -750,18 +751,18 @@ function At(n, e, t = {}) {
|
|
|
750
751
|
), d = () => o?.takeRecords(), u = () => {
|
|
751
752
|
i(), c();
|
|
752
753
|
};
|
|
753
|
-
return
|
|
754
|
+
return Rt(u), {
|
|
754
755
|
isSupported: a,
|
|
755
756
|
stop: u,
|
|
756
757
|
takeRecords: d
|
|
757
758
|
};
|
|
758
759
|
}
|
|
759
|
-
function
|
|
760
|
+
function Ut(n = null, e = {}) {
|
|
760
761
|
var t, r, s;
|
|
761
762
|
const {
|
|
762
|
-
document: o =
|
|
763
|
+
document: o = kt,
|
|
763
764
|
restoreOnUnmount: a = (u) => u
|
|
764
|
-
} = e, i = (t = o?.title) != null ? t : "", l =
|
|
765
|
+
} = e, i = (t = o?.title) != null ? t : "", l = Ht((r = n ?? o?.title) != null ? r : null), c = n && typeof n == "function";
|
|
765
766
|
function d(u) {
|
|
766
767
|
if (!("titleTemplate" in e))
|
|
767
768
|
return u;
|
|
@@ -774,13 +775,13 @@ function Bt(n = null, e = {}) {
|
|
|
774
775
|
u !== f && o && (o.title = d(typeof u == "string" ? u : ""));
|
|
775
776
|
},
|
|
776
777
|
{ immediate: !0 }
|
|
777
|
-
), e.observe && !e.titleTemplate && o && !c &&
|
|
778
|
+
), e.observe && !e.titleTemplate && o && !c && Bt(
|
|
778
779
|
(s = o.head) == null ? void 0 : s.querySelector("title"),
|
|
779
780
|
() => {
|
|
780
781
|
o && o.title !== l.value && (l.value = d(o.title));
|
|
781
782
|
},
|
|
782
783
|
{ childList: !0 }
|
|
783
|
-
),
|
|
784
|
+
), Mt(() => {
|
|
784
785
|
if (a) {
|
|
785
786
|
const u = a(i, l.value || "");
|
|
786
787
|
u != null && o && (o.title = u);
|
|
@@ -791,7 +792,7 @@ const Z = se({
|
|
|
791
792
|
name: "VtjPageContainer",
|
|
792
793
|
async setup() {
|
|
793
794
|
const n = me(), e = oe(), t = e.params.id, r = t ? n.getPage(t) : n.getHomepage(), s = r ? await n.getRenderComponent(r.id) : null;
|
|
794
|
-
return r &&
|
|
795
|
+
return r && Ut(r.title || "VTJ"), {
|
|
795
796
|
provider: n,
|
|
796
797
|
component: s,
|
|
797
798
|
file: r,
|
|
@@ -801,13 +802,13 @@ const Z = se({
|
|
|
801
802
|
render() {
|
|
802
803
|
return this.component ? T(this.component, this.query) : T("div", "页面不存在");
|
|
803
804
|
}
|
|
804
|
-
}),
|
|
805
|
+
}), Nt = se({
|
|
805
806
|
name: "VtjStartupContainer",
|
|
806
807
|
render() {
|
|
807
|
-
return T(
|
|
808
|
+
return T(qe);
|
|
808
809
|
}
|
|
809
810
|
}), de = Symbol("Provider");
|
|
810
|
-
class
|
|
811
|
+
class qt extends ve {
|
|
811
812
|
constructor(e) {
|
|
812
813
|
super(), this.options = e;
|
|
813
814
|
const {
|
|
@@ -828,7 +829,7 @@ class Nt extends ve {
|
|
|
828
829
|
mode;
|
|
829
830
|
globals = {};
|
|
830
831
|
modules = {};
|
|
831
|
-
adapter = { request:
|
|
832
|
+
adapter = { request: ze, jsonp: Re };
|
|
832
833
|
apis = {};
|
|
833
834
|
dependencies = {};
|
|
834
835
|
materials = {};
|
|
@@ -845,7 +846,7 @@ class Nt extends ve {
|
|
|
845
846
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
846
847
|
throw new Error("project is null");
|
|
847
848
|
const { apis: r = [], meta: s = [] } = this.project, o = window;
|
|
848
|
-
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" && await this.loadAssets(o), this.apis =
|
|
849
|
+
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" && await this.loadAssets(o), this.apis = tt(r, s, this.adapter), le(), this.project.config?.mock && nt(r), this.initRouter(), this.triggerReady();
|
|
849
850
|
}
|
|
850
851
|
async loadAssets(e) {
|
|
851
852
|
const { dependencies: t = [] } = this.project, { dependencies: r, library: s, components: o, materialPath: a } = this, {
|
|
@@ -854,7 +855,7 @@ class Nt extends ve {
|
|
|
854
855
|
materials: c,
|
|
855
856
|
materialExports: d,
|
|
856
857
|
materialMapLibrary: u
|
|
857
|
-
} =
|
|
858
|
+
} = We(t, a);
|
|
858
859
|
for (const p of i) {
|
|
859
860
|
const h = r[p], m = e[p];
|
|
860
861
|
if (m)
|
|
@@ -864,7 +865,7 @@ class Nt extends ve {
|
|
|
864
865
|
else {
|
|
865
866
|
const v = l[p] || [];
|
|
866
867
|
for (const w of v)
|
|
867
|
-
J(w) && await
|
|
868
|
+
J(w) && await Ke(p, b.append(w, { v: P })), L(w) && await Q(b.append(w, { v: P }));
|
|
868
869
|
s[p] = e[p];
|
|
869
870
|
}
|
|
870
871
|
}
|
|
@@ -880,7 +881,7 @@ class Nt extends ve {
|
|
|
880
881
|
else {
|
|
881
882
|
const v = f[p] ? (await f[p]()).default : e[p];
|
|
882
883
|
v && h && (v.components || []).forEach((w) => {
|
|
883
|
-
o[w.name] =
|
|
884
|
+
o[w.name] = Ge(w, h);
|
|
884
885
|
});
|
|
885
886
|
}
|
|
886
887
|
}
|
|
@@ -894,13 +895,13 @@ class Nt extends ve {
|
|
|
894
895
|
}), e.addRoute({
|
|
895
896
|
path: "/",
|
|
896
897
|
name: "VtjHomepage",
|
|
897
|
-
component: t?.homepage ? Z :
|
|
898
|
+
component: t?.homepage ? Z : Nt
|
|
898
899
|
}));
|
|
899
900
|
}
|
|
900
901
|
install(e) {
|
|
901
902
|
const t = e.config.globalProperties.installed || {};
|
|
902
903
|
for (const [r, s] of Object.entries(this.library))
|
|
903
|
-
!t[r] &&
|
|
904
|
+
!t[r] && Xe(s) && (e.use(s), t[r] = !0);
|
|
904
905
|
this.options.install && e.use(this.options.install), e.provide(de, this), e.config.globalProperties.installed = t;
|
|
905
906
|
}
|
|
906
907
|
getFile(e) {
|
|
@@ -983,15 +984,15 @@ class Nt extends ve {
|
|
|
983
984
|
});
|
|
984
985
|
}
|
|
985
986
|
}
|
|
986
|
-
function
|
|
987
|
-
const e = new
|
|
987
|
+
function rn(n) {
|
|
988
|
+
const e = new qt(n);
|
|
988
989
|
return {
|
|
989
990
|
provider: e,
|
|
990
991
|
onReady: (r) => e.ready(r)
|
|
991
992
|
};
|
|
992
993
|
}
|
|
993
994
|
function me(n = {}) {
|
|
994
|
-
const e =
|
|
995
|
+
const e = Be(de);
|
|
995
996
|
if (!e)
|
|
996
997
|
throw new Error("Can not find provider");
|
|
997
998
|
if (e.nodeEnv === "development") {
|
|
@@ -1006,7 +1007,7 @@ function me(n = {}) {
|
|
|
1006
1007
|
}
|
|
1007
1008
|
return e;
|
|
1008
1009
|
}
|
|
1009
|
-
const W = new
|
|
1010
|
+
const W = new Fe({
|
|
1010
1011
|
settings: {
|
|
1011
1012
|
type: "json",
|
|
1012
1013
|
validSuccess: !0,
|
|
@@ -1019,7 +1020,7 @@ const W = new Re({
|
|
|
1019
1020
|
});
|
|
1020
1021
|
}
|
|
1021
1022
|
}
|
|
1022
|
-
}),
|
|
1023
|
+
}), Jt = (n = "/vtj/local/repository/${type}.json") => (e, t) => W.send({
|
|
1023
1024
|
url: n,
|
|
1024
1025
|
method: "post",
|
|
1025
1026
|
query: { type: e },
|
|
@@ -1027,7 +1028,7 @@ const W = new Re({
|
|
|
1027
1028
|
type: e,
|
|
1028
1029
|
data: t
|
|
1029
1030
|
}
|
|
1030
|
-
}),
|
|
1031
|
+
}), Lt = (n = "/vtj/local/repository/uploader.json") => async (e, t) => await W.send({
|
|
1031
1032
|
url: n,
|
|
1032
1033
|
method: "post",
|
|
1033
1034
|
data: {
|
|
@@ -1043,7 +1044,7 @@ class G {
|
|
|
1043
1044
|
pluginCaches = {};
|
|
1044
1045
|
uploader;
|
|
1045
1046
|
constructor() {
|
|
1046
|
-
this.api =
|
|
1047
|
+
this.api = Jt(), this.uploader = Lt();
|
|
1047
1048
|
}
|
|
1048
1049
|
async getExtension() {
|
|
1049
1050
|
console.log("BaseService.getExtension");
|
|
@@ -1116,7 +1117,7 @@ class G {
|
|
|
1116
1117
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1117
1118
|
}
|
|
1118
1119
|
async getPluginMaterial(e) {
|
|
1119
|
-
const { urls: t = [] } = e, r = t.filter((o) =>
|
|
1120
|
+
const { urls: t = [] } = e, r = t.filter((o) => Ve(o))[0];
|
|
1120
1121
|
if (!r) return null;
|
|
1121
1122
|
const s = this.pluginCaches[r];
|
|
1122
1123
|
return s || (this.pluginCaches[r] = W.send({
|
|
@@ -1129,12 +1130,12 @@ class G {
|
|
|
1129
1130
|
}).then((o) => o.data).catch(() => null));
|
|
1130
1131
|
}
|
|
1131
1132
|
}
|
|
1132
|
-
const y = new
|
|
1133
|
+
const y = new Ie({
|
|
1133
1134
|
type: "local",
|
|
1134
1135
|
expired: 0,
|
|
1135
1136
|
prefix: "__VTJ_"
|
|
1136
1137
|
});
|
|
1137
|
-
class
|
|
1138
|
+
class sn extends G {
|
|
1138
1139
|
init(e) {
|
|
1139
1140
|
const t = new I(e), r = y.get(`project_${t.id}`), s = Object.assign(t.toDsl(), r || {});
|
|
1140
1141
|
return y.save(`project_${t.id}`, s), Promise.resolve(s);
|
|
@@ -1184,7 +1185,7 @@ class rn extends G {
|
|
|
1184
1185
|
}), Promise.resolve(!0);
|
|
1185
1186
|
}
|
|
1186
1187
|
}
|
|
1187
|
-
class
|
|
1188
|
+
class Vt extends G {
|
|
1188
1189
|
projects = {};
|
|
1189
1190
|
materials = {};
|
|
1190
1191
|
files = {};
|
|
@@ -1242,10 +1243,10 @@ class Lt extends G {
|
|
|
1242
1243
|
}
|
|
1243
1244
|
}
|
|
1244
1245
|
let F = null;
|
|
1245
|
-
function
|
|
1246
|
-
return F || (F = new
|
|
1246
|
+
function on() {
|
|
1247
|
+
return F || (F = new Vt(), F);
|
|
1247
1248
|
}
|
|
1248
|
-
class
|
|
1249
|
+
class an extends G {
|
|
1249
1250
|
getFileCaches = {};
|
|
1250
1251
|
async getExtension() {
|
|
1251
1252
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -1313,9 +1314,9 @@ function he(n = []) {
|
|
|
1313
1314
|
};
|
|
1314
1315
|
});
|
|
1315
1316
|
}
|
|
1316
|
-
function
|
|
1317
|
+
function cn() {
|
|
1317
1318
|
const n = me(), e = oe(), t = N(!1), r = n.project;
|
|
1318
|
-
|
|
1319
|
+
Ue(() => {
|
|
1319
1320
|
const { name: a, params: i, meta: l } = e;
|
|
1320
1321
|
if (a === "VtjPage") {
|
|
1321
1322
|
const c = n.getPage(i.id);
|
|
@@ -1336,54 +1337,54 @@ function an() {
|
|
|
1336
1337
|
};
|
|
1337
1338
|
}
|
|
1338
1339
|
export {
|
|
1339
|
-
|
|
1340
|
+
Je as BUILT_IN_DIRECTIVES,
|
|
1340
1341
|
G as BaseService,
|
|
1341
1342
|
Y as CONTEXT_HOST,
|
|
1342
|
-
|
|
1343
|
+
st as Context,
|
|
1343
1344
|
_ as ContextMode,
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1345
|
+
Le as DATA_TYPES,
|
|
1346
|
+
nn as JSCodeToString,
|
|
1347
|
+
Zt as LIFE_CYCLES_LIST,
|
|
1348
|
+
an as LocalService,
|
|
1349
|
+
Vt as MemoryService,
|
|
1350
|
+
qt as Provider,
|
|
1351
|
+
sn as StorageService,
|
|
1351
1352
|
P as VTJ_RENDERER_VERSION,
|
|
1352
1353
|
ae as adoptedStyleSheets,
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1354
|
+
en as createAssetScripts,
|
|
1355
|
+
tn as createAssetsCss,
|
|
1356
|
+
ft as createDataSources,
|
|
1356
1357
|
B as createLoader,
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1358
|
+
on as createMemoryService,
|
|
1359
|
+
et as createMetaApi,
|
|
1360
|
+
rn as createProvider,
|
|
1360
1361
|
A as createRenderer,
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1362
|
+
Ze as createSchemaApi,
|
|
1363
|
+
tt as createSchemaApis,
|
|
1364
|
+
mt as defaultLoader,
|
|
1364
1365
|
R as fillBasePath,
|
|
1365
1366
|
fe as getModifiers,
|
|
1366
1367
|
ue as getPlugin,
|
|
1367
|
-
|
|
1368
|
+
Ge as getRawComponent,
|
|
1368
1369
|
J as isCSSUrl,
|
|
1369
|
-
|
|
1370
|
+
Ye as isJSCode,
|
|
1370
1371
|
g as isJSExpression,
|
|
1371
1372
|
D as isJSFunction,
|
|
1372
|
-
|
|
1373
|
+
Ve as isJSON,
|
|
1373
1374
|
L as isJSUrl,
|
|
1374
|
-
|
|
1375
|
-
|
|
1375
|
+
Xe as isVuePlugin,
|
|
1376
|
+
Ke as loadCss,
|
|
1376
1377
|
ce as loadCssUrl,
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1378
|
+
Qe as loadScriptUrl,
|
|
1379
|
+
rt as mockApi,
|
|
1380
|
+
nt as mockApis,
|
|
1380
1381
|
le as mockCleanup,
|
|
1381
1382
|
M as nodeRender,
|
|
1382
|
-
|
|
1383
|
+
We as parseDeps,
|
|
1383
1384
|
C as parseExpression,
|
|
1384
1385
|
z as parseFunction,
|
|
1385
1386
|
de as providerKey,
|
|
1386
1387
|
ie as toString,
|
|
1387
|
-
|
|
1388
|
+
cn as useMask,
|
|
1388
1389
|
me as useProvider
|
|
1389
1390
|
};
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/renderer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.63",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"mockjs": "~1.1.0",
|
|
8
|
-
"@vtj/
|
|
9
|
-
"@vtj/
|
|
10
|
-
"@vtj/
|
|
11
|
-
"@vtj/
|
|
8
|
+
"@vtj/icons": "~0.8.63",
|
|
9
|
+
"@vtj/core": "~0.8.63",
|
|
10
|
+
"@vtj/utils": "~0.8.63",
|
|
11
|
+
"@vtj/ui": "~0.8.63"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"vue": "~3.4.15",
|
|
15
15
|
"vue-router": "~4.4.0",
|
|
16
|
-
"@vtj/cli": "~0.8.
|
|
16
|
+
"@vtj/cli": "~0.8.16"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
@@ -43,6 +43,6 @@ export declare class Context {
|
|
|
43
43
|
private __cleanup;
|
|
44
44
|
__parseFunction(code?: JSFunction): Function | undefined;
|
|
45
45
|
__parseExpression(code?: JSExpression | JSFunction): any;
|
|
46
|
-
__ref(id?: string | null, ref?: string | Function): ((el: any) => any) | undefined;
|
|
46
|
+
__ref(id?: string | null, ref?: string | Function): ((el: any) => Promise<any>) | undefined;
|
|
47
47
|
__clone(context?: Record<string, any>): Context;
|
|
48
48
|
}
|