@vtj/renderer 0.9.1 → 0.9.3

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.mjs CHANGED
@@ -1,19 +1,20 @@
1
- import { Base as Ae, BUILT_IN_COMPONENTS as Te, ProjectModel as M, HistoryModel as de } from "@vtj/core";
2
- import { isUrl as Ie, url as x, dedupArray as De, isString as j, isFunction as K, logger as O, createRequest as Me, merge as Oe, pathToRegexp as He, pathToRegexpMatch as Be, formDataToJson as Ne, storage as q, cookie as J, toArray as oe, unRSA as ie, delay as fe, camelCase as $, upperFirst as Ue, pick as Le, jsonp as qe, loadScript as ae, Request as Je, Storage as Ve, mapToObject as Q } from "@vtj/utils";
3
- import * as B from "vue";
4
- import { inject as he, toRef as ze, readonly as Ke, customRef as We, ref as F, onBeforeUnmount as Ge, getCurrentScope as Ye, onScopeDispose as Qe, unref as Xe, getCurrentInstance as me, watch as ge, computed as ve, onMounted as Ze, defineComponent as X, h as W, openBlock as et, createElementBlock as tt, createElementVNode as E, toDisplayString as V, defineAsyncComponent as ce, watchEffect as st } from "vue";
5
- import { ElNotification as N, ElLoading as nt } from "element-plus";
1
+ import { Base as Te, BUILT_IN_COMPONENTS as Ae, ProjectModel as O, HistoryModel as de } from "@vtj/core";
2
+ import { isUrl as Ie, url as P, dedupArray as Me, isString as j, isFunction as K, logger as x, createRequest as De, merge as He, pathToRegexp as Oe, pathToRegexpMatch as Be, formDataToJson as Ne, storage as q, cookie as J, toArray as ie, unRSA as ae, delay as fe, camelCase as $, upperFirst as Ue, pick as Le, jsonp as qe, loadScript as ce, Request as Je, Storage as Ve, mapToObject as X } from "@vtj/utils";
3
+ import * as N from "vue";
4
+ import { inject as he, toRef as ze, readonly as Ke, customRef as We, ref as T, onBeforeUnmount as Ge, getCurrentScope as Ye, onScopeDispose as Qe, unref as Xe, getCurrentInstance as me, watch as ge, computed as ve, onMounted as Ze, defineComponent as Z, h as W, openBlock as et, createElementBlock as tt, createElementVNode as k, toDisplayString as V, defineAsyncComponent as le, watchEffect as st } from "vue";
5
+ import { ElNotification as U, ElLoading as nt } from "element-plus";
6
+ import E from "mockjs";
6
7
  import { useRoute as ye } from "vue-router";
7
8
  /**!
8
9
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
9
10
  * @name @vtj/renderer
10
11
  * @author CHC chenhuachun1549@dingtalk.com
11
- * @version 0.9.1
12
+ * @version 0.9.3
12
13
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
13
14
  */
14
- const k = "0.9.1";
15
+ const C = "0.9.3";
15
16
  var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
16
- const le = [
17
+ const ue = [
17
18
  "$el",
18
19
  "$emit",
19
20
  "$nextTick",
@@ -25,7 +26,7 @@ const le = [
25
26
  "$props",
26
27
  "$options",
27
28
  "$forceUpdate"
28
- ], Cs = [
29
+ ], Ts = [
29
30
  "beforeCreate",
30
31
  "created",
31
32
  "beforeMount",
@@ -39,7 +40,14 @@ const le = [
39
40
  "renderTriggered",
40
41
  "activated",
41
42
  "deactivated"
42
- ], rt = ["vIf", "vShow", "vModel", "vFor", "vBind"], ot = {
43
+ ], rt = [
44
+ "vIf",
45
+ "vShow",
46
+ "vModel",
47
+ "vFor",
48
+ "vBind",
49
+ "vHtml"
50
+ ], ot = {
43
51
  String,
44
52
  Number,
45
53
  Boolean,
@@ -47,29 +55,29 @@ const le = [
47
55
  Object,
48
56
  Function,
49
57
  Date
50
- }, C = "VtjPage", D = "VtjHomepage", it = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot".split(
58
+ }, F = "VtjPage", H = "VtjHomepage", it = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot".split(
51
59
  ","
52
60
  ), at = "component,slot".split(",");
53
- function T(n, e) {
61
+ function M(n, e) {
54
62
  return n.map((t) => Ie(t) || t.startsWith("/") ? t : `${e}${t}`);
55
63
  }
56
- function Z(n) {
64
+ function ee(n) {
57
65
  return /\.css$/.test(n);
58
66
  }
59
- function ee(n) {
67
+ function te(n) {
60
68
  return /\.js$/.test(n);
61
69
  }
62
70
  function ct(n) {
63
71
  return /\.json$/.test(n);
64
72
  }
65
- function Fs(n) {
73
+ function As(n) {
66
74
  return n.map(
67
- (e) => `<script src="${x.append(e, { v: k })}"><\/script>`
75
+ (e) => `<script src="${P.append(e, { v: C })}"><\/script>`
68
76
  ).join("");
69
77
  }
70
- function As(n = []) {
78
+ function Is(n = []) {
71
79
  return n.map(
72
- (e) => `<link rel="stylesheet" href="${x.append(e, { v: k })}" />`
80
+ (e) => `<link rel="stylesheet" href="${P.append(e, { v: C })}" />`
73
81
  ).join("");
74
82
  }
75
83
  function lt(n, e = !1) {
@@ -80,15 +88,15 @@ function ut(n, e, t = !1) {
80
88
  return s.forEach(
81
89
  ({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
82
90
  p?.forEach((g) => {
83
- ee(g) && r.push(lt(g, t)), Z(g) && o.push(g);
84
- }), m && (i.push(m), c[m] = T(p || [], e), w && (l[m] = w)), h && a.push(h), d && f.push(d), m && d && (u[d] = m);
91
+ te(g) && r.push(lt(g, t)), ee(g) && o.push(g);
92
+ }), m && (i.push(m), c[m] = M(p || [], e), w && (l[m] = w)), h && a.push(h), d && f.push(d), m && d && (u[d] = m);
85
93
  }
86
94
  ), {
87
- scripts: T(r, e),
88
- css: T(o, e),
89
- materials: T(a, e),
95
+ scripts: M(r, e),
96
+ css: M(o, e),
97
+ materials: M(a, e),
90
98
  libraryExports: i,
91
- materialExports: De(f),
99
+ materialExports: Me(f),
92
100
  materialMapLibrary: u,
93
101
  libraryMap: c,
94
102
  libraryLocaleMap: l
@@ -161,13 +169,13 @@ function A(n, e, t = !1, s = !1) {
161
169
  const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
162
170
  return new Function("$scope", a)(e);
163
171
  } catch (r) {
164
- if (O.error("parseExpression.error", r, n, e?.__self ?? e), s)
172
+ if (x.error("parseExpression.error", r, n, e?.__self ?? e), s)
165
173
  throw r;
166
174
  }
167
175
  }
168
- function ue(n, e, t = !1, s = !1) {
176
+ function G(n, e, t = !1, s = !1) {
169
177
  const r = A(n, e, t, s);
170
- if (typeof r != "function" && (O.error(
178
+ if (typeof r != "function" && (x.error(
171
179
  "parseFunction.error",
172
180
  "not a function",
173
181
  n,
@@ -179,17 +187,17 @@ function ue(n, e, t = !1, s = !1) {
179
187
  function _(n) {
180
188
  return n && n.type === "JSExpression";
181
189
  }
182
- function U(n) {
190
+ function I(n) {
183
191
  return typeof n == "object" && n && n.type === "JSFunction";
184
192
  }
185
193
  function yt(n) {
186
- return _(n) || U(n);
194
+ return _(n) || I(n);
187
195
  }
188
- function Ts(n) {
196
+ function Ms(n) {
189
197
  return yt(n) ? n.value : JSON.stringify(n);
190
198
  }
191
199
  let R = null;
192
- const _t = Me({
200
+ const _t = De({
193
201
  settings: {
194
202
  type: "form",
195
203
  validSuccess: !0,
@@ -198,7 +206,7 @@ const _t = Me({
198
206
  validate: (n) => n.data?.code === 0 || !!n.data?.success,
199
207
  failMessage: !0,
200
208
  showError: (n) => {
201
- N.error({
209
+ U.error({
202
210
  message: n || "未知错误"
203
211
  });
204
212
  },
@@ -214,7 +222,6 @@ const _t = Me({
214
222
  }
215
223
  }
216
224
  });
217
- let P;
218
225
  function wt(n, e) {
219
226
  const { jsonp: t, request: s } = e;
220
227
  if (n.method === "jsonp")
@@ -231,7 +238,7 @@ function wt(n, e) {
231
238
  headers: r
232
239
  }
233
240
  };
234
- return (a, i) => (delete o.data, s.send(Oe(o, i || {}, { data: a })));
241
+ return (a, i) => (delete o.data, s.send(He(o, i || {}, { data: a })));
235
242
  }
236
243
  }
237
244
  function St(n, e) {
@@ -255,25 +262,36 @@ function bt(n = [], e = [], t) {
255
262
  return s;
256
263
  }
257
264
  async function jt(n = []) {
258
- P = await import("mockjs").then((e) => e.default || e), P && (P.setup({
259
- timeout: "50-500"
260
- }), Se(), n.forEach((e) => $t(P, e)));
265
+ E && (Se(), n.forEach((e) => Et(E, e)));
266
+ }
267
+ function $t(n) {
268
+ const e = I(n.mockTemplate) && n.mockTemplate.value ? G(n.mockTemplate, {}, !0) : void 0;
269
+ return async (...t) => {
270
+ let s = {};
271
+ if (e)
272
+ try {
273
+ s = await e.apply(e, t);
274
+ } catch (r) {
275
+ x.warn("模拟数据模版异常", r);
276
+ }
277
+ return E.mock(s);
278
+ };
261
279
  }
262
- function $t(n, e) {
280
+ function Et(n, e) {
263
281
  if (!e.mock) return;
264
282
  const { url: t, mockTemplate: s } = e;
265
283
  if (t && s) {
266
- const r = He(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
284
+ const r = Oe(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
267
285
  n.mock(r, (i) => {
268
- const c = x.parse(i.url) || {}, l = i.body instanceof FormData ? Ne(i.body) : i.body, f = o(i.url)?.params;
286
+ const c = P.parse(i.url) || {}, l = i.body instanceof FormData ? Ne(i.body) : i.body, f = o(i.url)?.params;
269
287
  return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
270
288
  });
271
289
  }
272
290
  }
273
291
  function Se() {
274
- P && (P._mocked = {});
292
+ E && (E._mocked = {});
275
293
  }
276
- const Et = {
294
+ const kt = {
277
295
  session: !1,
278
296
  authKey: "Authorization",
279
297
  storageKey: "ACCESS_STORAGE",
@@ -286,12 +304,12 @@ const Et = {
286
304
  noPermissionMessage: "无权限访问该页面",
287
305
  appName: ""
288
306
  }, be = Symbol("access");
289
- class Is {
307
+ class Ds {
290
308
  options;
291
309
  data = null;
292
310
  mode = y.Raw;
293
311
  constructor(e) {
294
- this.options = Object.assign({}, Et, e), this.loadData();
312
+ this.options = Object.assign({}, kt, e), this.loadData();
295
313
  }
296
314
  connect(e) {
297
315
  const { mode: t, router: s, request: r } = e;
@@ -322,11 +340,11 @@ class Is {
322
340
  }
323
341
  can(e) {
324
342
  const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
325
- return typeof e == "function" ? e(s) : oe(e).every((o) => s[o] || s[t + "." + o]);
343
+ return typeof e == "function" ? e(s) : ie(e).every((o) => s[o] || s[t + "." + o]);
326
344
  }
327
345
  some(e) {
328
346
  const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
329
- return oe(e).some((o) => s[o] || s[t + "." + o]);
347
+ return ie(e).some((o) => s[o] || s[t + "." + o]);
330
348
  }
331
349
  install(e) {
332
350
  e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(be, this);
@@ -350,13 +368,13 @@ class Is {
350
368
  setData(e) {
351
369
  const { privateKey: t } = this.options;
352
370
  if (Array.isArray(e) && t) {
353
- const s = e.map((r) => ie(r, t));
371
+ const s = e.map((r) => ae(r, t));
354
372
  this.data = JSON.parse(s.join(""));
355
373
  return;
356
374
  }
357
375
  if (typeof e == "string")
358
376
  try {
359
- const s = t ? ie(e, t) : e;
377
+ const s = t ? ae(e, t) : e;
360
378
  s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
361
379
  } catch (s) {
362
380
  console.warn(s);
@@ -376,7 +394,7 @@ class Is {
376
394
  return e && t ? !!J.get(t) : !!this.getToken();
377
395
  }
378
396
  hasRoutePermission(e) {
379
- if (e.name === C) {
397
+ if (e.name === F) {
380
398
  const t = e.params.id;
381
399
  return t && this.can(t);
382
400
  }
@@ -459,7 +477,7 @@ class Pt {
459
477
  const { mode: t, dsl: s, attrs: r } = e;
460
478
  this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
461
479
  }
462
- setup(e, t = B) {
480
+ setup(e, t = N) {
463
481
  const s = t.getCurrentInstance();
464
482
  if (!s) return;
465
483
  this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
@@ -473,12 +491,12 @@ class Pt {
473
491
  });
474
492
  }
475
493
  __proxy() {
476
- this.__instance && le.forEach((e) => {
494
+ this.__instance && ue.forEach((e) => {
477
495
  this[e] = this.__instance?.[e];
478
496
  });
479
497
  }
480
498
  __cleanup() {
481
- le.forEach((e) => {
499
+ ue.forEach((e) => {
482
500
  this[e] = null;
483
501
  });
484
502
  }
@@ -486,9 +504,9 @@ class Pt {
486
504
  if (e)
487
505
  if (this.__mode === y.Runtime) {
488
506
  const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
489
- return ue({ type: s, value: r }, this);
507
+ return G({ type: s, value: r }, this);
490
508
  } else
491
- return ue(e, this);
509
+ return G(e, this);
492
510
  }
493
511
  __parseExpression(e) {
494
512
  if (e)
@@ -528,9 +546,9 @@ class Pt {
528
546
  return s.context.__proto__ = this.context, s.__proto__ = this, s;
529
547
  }
530
548
  }
531
- function G(n) {
549
+ function Y(n) {
532
550
  const {
533
- Vue: e = B,
551
+ Vue: e = N,
534
552
  mode: t = y.Runtime,
535
553
  components: s = {},
536
554
  libs: r = {},
@@ -547,15 +565,15 @@ function G(n) {
547
565
  }), f = e.defineComponent({
548
566
  name: i.value.name,
549
567
  props: {
550
- ...kt(i.value.props ?? [], l)
568
+ ...Ct(i.value.props ?? [], l)
551
569
  },
552
570
  setup(u) {
553
571
  l.$props = u, l.props = u, i.value.id && we(
554
572
  n.window || window,
555
573
  i.value.id,
556
574
  i.value.css || ""
557
- ), l.state = Ct(e, i.value.state ?? {}, l);
558
- const p = Ft(e, i.value.computed ?? {}, l), h = At(i.value.methods ?? {}, l), m = Tt(e, i.value.inject, l), d = It(
575
+ ), l.state = Ft(e, i.value.state ?? {}, l);
576
+ const p = Tt(e, i.value.computed ?? {}, l), h = At(i.value.methods ?? {}, l), m = It(e, i.value.inject, l), d = Mt(
559
577
  i.value.dataSources || {},
560
578
  l
561
579
  ), w = {
@@ -573,9 +591,9 @@ function G(n) {
573
591
  render() {
574
592
  if (!i.value.nodes) return null;
575
593
  const u = i.value.nodes || [];
576
- return u.length === 1 ? H(u[0], l, e, a) : u.map((p) => H(p, l, e, a));
594
+ return u.length === 1 ? B(u[0], l, e, a) : u.map((p) => B(p, l, e, a));
577
595
  },
578
- ...Mt(i.value.lifeCycles ?? {}, l)
596
+ ...Ht(i.value.lifeCycles ?? {}, l)
579
597
  });
580
598
  return {
581
599
  renderer: e.markRaw(f),
@@ -585,7 +603,7 @@ function G(n) {
585
603
  function xt(n = []) {
586
604
  return n.map((e) => j(e) ? e : e.name);
587
605
  }
588
- function kt(n = [], e) {
606
+ function Ct(n = [], e) {
589
607
  const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => ot[o]) : void 0;
590
608
  return n.map((s) => j(s) ? {
591
609
  name: s
@@ -603,18 +621,18 @@ function kt(n = [], e) {
603
621
  {}
604
622
  );
605
623
  }
606
- function Ct(n, e, t) {
624
+ function Ft(n, e, t) {
607
625
  return n.reactive(
608
626
  Object.keys(e || {}).reduce(
609
627
  (s, r) => {
610
628
  let o = e[r];
611
- return _(o) ? o = t.__parseExpression(o) : U(o) && (o = t.__parseFunction(o)), s[r] = o, s;
629
+ return _(o) ? o = t.__parseExpression(o) : I(o) && (o = t.__parseFunction(o)), s[r] = o, s;
612
630
  },
613
631
  {}
614
632
  )
615
633
  );
616
634
  }
617
- function Ft(n, e, t) {
635
+ function Tt(n, e, t) {
618
636
  return Object.entries(e ?? {}).reduce(
619
637
  (s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
620
638
  {}
@@ -626,7 +644,7 @@ function At(n, e) {
626
644
  {}
627
645
  );
628
646
  }
629
- function Tt(n, e = [], t) {
647
+ function It(n, e = [], t) {
630
648
  return e.reduce(
631
649
  (s, r) => {
632
650
  const { name: o, from: a } = r || {};
@@ -637,14 +655,20 @@ function Tt(n, e = [], t) {
637
655
  {}
638
656
  );
639
657
  }
640
- function It(n, e) {
658
+ function Mt(n, e) {
641
659
  return Object.keys(n).reduce(
642
660
  (t, s) => {
643
- const r = n[s], o = e.$apis[r.ref], a = U(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
644
- return t[s] = async (...i) => {
645
- const c = await o.apply(e, i);
646
- return a ? a(c) : c;
647
- }, t;
661
+ const r = n[s];
662
+ if (r.type === "mock")
663
+ t[s] = $t(r);
664
+ else if (r.ref) {
665
+ const o = e.$apis[r.ref], a = I(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
666
+ t[s] = async (...i) => {
667
+ const c = await o.apply(e, i);
668
+ return a ? a(c) : c;
669
+ };
670
+ }
671
+ return t;
648
672
  },
649
673
  {}
650
674
  );
@@ -661,7 +685,7 @@ function Dt(n, e = [], t) {
661
685
  );
662
686
  });
663
687
  }
664
- function Mt(n, e) {
688
+ function Ht(n, e) {
665
689
  return Object.entries(n ?? {}).reduce(
666
690
  (t, [s, r]) => (t[s] = e.__parseFunction(r), t),
667
691
  {}
@@ -670,62 +694,62 @@ function Mt(n, e) {
670
694
  let z = [];
671
695
  const Ot = (n) => n;
672
696
  async function je(n, e = window) {
673
- const { urls: t = [], library: s } = n, r = t.filter((i) => ee(i));
697
+ const { urls: t = [], library: s } = n, r = t.filter((i) => te(i));
674
698
  if (r.length === 0 || !s) return null;
675
- const o = t.filter((i) => Z(i));
699
+ const o = t.filter((i) => ee(i));
676
700
  return o.length && ft(o, e), await ht(r, s, e).catch(
677
701
  (i) => (console.warn("loadScriptUrl error", r, s, i), null)
678
702
  );
679
703
  }
680
- function Y(n) {
704
+ function Q(n) {
681
705
  const { getDsl: e, getDslByUrl: t, options: s } = n;
682
706
  return s.window && (z.forEach((r) => {
683
707
  delete s.window[r];
684
- }), z = []), (r, o, a = B) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
708
+ }), z = []), (r, o, a = N) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
685
709
  const i = await e(o.id);
686
- return i && (i.name = r), i ? G({
710
+ return i && (i.name = r), i ? Y({
687
711
  ...s,
688
712
  Vue: a,
689
713
  dsl: i,
690
714
  mode: y.Runtime,
691
- loader: Y(n)
715
+ loader: Q(n)
692
716
  }).renderer : null;
693
717
  }) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
694
718
  const i = await t(o.url);
695
- return i && (i.name = r), i ? G({
719
+ return i && (i.name = r), i ? Y({
696
720
  ...s,
697
721
  Vue: a,
698
722
  dsl: i,
699
723
  mode: y.Runtime,
700
- loader: Y(n)
724
+ loader: Q(n)
701
725
  }).renderer : null;
702
726
  }) : o.type === "Plugin" ? (o.library && z.push(o.library), a.defineAsyncComponent(async () => {
703
727
  const i = await je(o, s.window);
704
728
  return i || (console.warn("getPlugin result is null", o), null);
705
729
  })) : r;
706
730
  }
707
- function H(n, e, t = B, s = Ot) {
731
+ function B(n, e, t = N, s = Ot) {
708
732
  if (!n || !n.name || n.invisible) return null;
709
- const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = n, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: p, others: h } = Bt(a);
710
- if (i && !Nt(i, e))
733
+ const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = n, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: p, others: h } = Nt(a);
734
+ if (i && !Ut(i, e))
711
735
  return null;
712
736
  const m = (d) => {
713
737
  const w = d.$components, g = (() => {
714
738
  if (n.name === "component")
715
- return Ut(d, n.props?.is);
739
+ return Lt(d, n.props?.is);
716
740
  if (n.name === "slot") return n.name;
717
741
  const b = s(n.name, n.from, t);
718
742
  return j(b) ? gt(b) || vt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
719
- })(), S = Lt(o, n.props ?? {}, d), Ce = qt(t, n.events ?? {}, d);
743
+ })(), S = qt(o, n.props ?? {}, d), Ce = Jt(t, n.events ?? {}, d);
720
744
  if (n.name === "slot")
721
- return Jt(t, n, S, d, s);
745
+ return Vt(t, n, S, d, s);
722
746
  u && Object.assign(S, d.__parseExpression(u.value)), l && (S.style = Object.assign(
723
747
  S.style ?? {},
724
- zt(l, d)
725
- )), p && Object.assign(S, Kt(p, d)), f.forEach((b) => {
726
- Object.assign(S, Wt(t, b, d));
748
+ Kt(l, d)
749
+ )), p && Object.assign(S, Wt(p, d)), f.forEach((b) => {
750
+ Object.assign(S, Gt(t, b, d));
727
751
  });
728
- const Fe = Gt(
752
+ const Fe = Yt(
729
753
  t,
730
754
  n.children ?? [],
731
755
  d,
@@ -733,23 +757,21 @@ function H(n, e, t = B, s = Ot) {
733
757
  n
734
758
  );
735
759
  let L = t.createVNode(g, { ...S, ...Ce }, Fe);
736
- const re = r ? Ht(r, h, d) : [];
737
- return re.length && (L = t.withDirectives(L, re)), L;
760
+ const oe = r ? Bt(r, h, d) : [];
761
+ return oe.length && (L = t.withDirectives(L, oe)), L;
738
762
  };
739
- return c ? Xt(c, m, e) : m(e);
763
+ return c ? Zt(c, m, e) : m(e);
740
764
  }
741
- function Ht(n, e, t) {
765
+ function Bt(n, e, t) {
742
766
  const s = n.app;
743
767
  return e.map((r) => {
744
768
  const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
745
769
  if (!o) return null;
746
770
  const a = [o];
747
- return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(
748
- _(r.modifiers) ? t.__parseExpression(r.modifiers) : r.modifiers
749
- ), a;
771
+ return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
750
772
  }).filter((r) => !!r);
751
773
  }
752
- function Bt(n = []) {
774
+ function Nt(n = []) {
753
775
  const e = n.find((c) => $(c.name) === "vIf"), t = n.find((c) => $(c.name) === "vFor"), s = n.find((c) => $(c.name) === "vShow"), r = n.find((c) => $(c.name) === "vBind"), o = n.find((c) => $(c.name) === "vHtml"), a = n.filter(
754
776
  (c) => $(c.name) === "vModel"
755
777
  ), i = n.filter(
@@ -765,23 +787,23 @@ function Bt(n = []) {
765
787
  vHtml: o
766
788
  };
767
789
  }
768
- function Nt(n, e) {
790
+ function Ut(n, e) {
769
791
  return !!e.__parseExpression(n.value);
770
792
  }
771
- function Ut(n, e) {
793
+ function Lt(n, e) {
772
794
  return e ? _(e) ? n.__parseExpression(e) : e : "div";
773
795
  }
774
- function Lt(n, e, t) {
796
+ function qt(n, e, t) {
775
797
  const s = Object.keys(e || {}).reduce(
776
798
  (r, o) => {
777
799
  let a = e[o];
778
- return _(a) ? a = t.__parseExpression(a) : U(a) && (a = t.__parseFunction(a)), r[o] = a, r;
800
+ return _(a) ? a = t.__parseExpression(a) : I(a) && (a = t.__parseFunction(a)), r[o] = a, r;
779
801
  },
780
802
  {}
781
803
  );
782
804
  return s.ref = t.__ref(n, s.ref), s;
783
805
  }
784
- function qt(n, e, t) {
806
+ function Jt(n, e, t) {
785
807
  const s = ["passive", "capture", "once"], r = {
786
808
  capture: "Capture",
787
809
  once: "Once",
@@ -799,32 +821,32 @@ function $e(n = {}, e = !1) {
799
821
  const t = Object.keys(n);
800
822
  return e ? t.map((s) => "." + s) : t;
801
823
  }
802
- function Jt(n, e, t, s, r) {
803
- const { children: o } = e, a = Vt(e, s), i = s.$slots?.[a.name];
824
+ function Vt(n, e, t, s, r) {
825
+ const { children: o } = e, a = zt(e, s), i = s.$slots?.[a.name];
804
826
  return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
805
827
  _e(s.__parseExpression(o))
806
828
  ) : Array.isArray(o) ? o.map(
807
- (c) => H(c, s, n, r)
829
+ (c) => B(c, s, n, r)
808
830
  ) : null : null;
809
831
  }
810
- function Vt(n, e) {
832
+ function zt(n, e) {
811
833
  const { props: t } = n, s = t?.name || "default";
812
834
  return {
813
835
  name: _(s) ? e.__parseExpression(s) : s,
814
836
  params: []
815
837
  };
816
838
  }
817
- function zt(n, e) {
839
+ function Kt(n, e) {
818
840
  return e.__parseExpression(n.value) ? {} : {
819
841
  display: "none"
820
842
  };
821
843
  }
822
- function Kt(n, e) {
844
+ function Wt(n, e) {
823
845
  return {
824
846
  innerHTML: e.__parseExpression(n.value) || ""
825
847
  };
826
848
  }
827
- function Wt(n, e, t) {
849
+ function Gt(n, e, t) {
828
850
  const s = {
829
851
  type: "JSFunction",
830
852
  value: e.value?.value ? `(v) => {
@@ -838,7 +860,7 @@ function Wt(n, e, t) {
838
860
  [`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
839
861
  };
840
862
  }
841
- function Gt(n, e, t, s, r) {
863
+ function Yt(n, e, t, s, r) {
842
864
  if (!e) return null;
843
865
  if (j(e))
844
866
  return { default: () => e };
@@ -847,19 +869,19 @@ function Gt(n, e, t, s, r) {
847
869
  default: () => _e(t.__parseExpression(e))
848
870
  };
849
871
  if (Array.isArray(e) && e.length > 0) {
850
- const o = Yt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
872
+ const o = Qt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
851
873
  [`scope_${r.id}`]: i
852
874
  } : {};
853
875
  return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
854
876
  const p = f.length ? Le(u ?? {}, f) : a(u);
855
877
  return l.map(
856
- (h) => H(h, t.__clone(p), n, s)
878
+ (h) => B(h, t.__clone(p), n, s)
857
879
  );
858
880
  }, i), {});
859
881
  }
860
882
  return null;
861
883
  }
862
- function Yt(n) {
884
+ function Qt(n) {
863
885
  const e = {
864
886
  default: {
865
887
  params: [],
@@ -867,7 +889,7 @@ function Yt(n) {
867
889
  }
868
890
  };
869
891
  for (const t of n) {
870
- const s = Qt(t.slot), r = s.name;
892
+ const s = Xt(t.slot), r = s.name;
871
893
  e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
872
894
  nodes: [t],
873
895
  params: s.params
@@ -875,59 +897,59 @@ function Yt(n) {
875
897
  }
876
898
  return e;
877
899
  }
878
- function Qt(n = "default") {
900
+ function Xt(n = "default") {
879
901
  return j(n) ? { name: n, params: [] } : { params: [], ...n };
880
902
  }
881
- function Xt(n, e, t) {
903
+ function Zt(n, e, t) {
882
904
  const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
883
905
  let i = t.__parseExpression(s) || [];
884
906
  return Number.isInteger(i) && (i = new Array(i).fill(!0).map((c, l) => l + 1)), Array.isArray(i) ? i.map((c, l) => e(t.__clone({ [o]: c, [a]: l }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
885
907
  }
886
- function Zt(n) {
908
+ function es(n) {
887
909
  return Ye() ? (Qe(n), !0) : !1;
888
910
  }
889
- function te(n) {
911
+ function se(n) {
890
912
  return typeof n == "function" ? n() : Xe(n);
891
913
  }
892
914
  const Ee = typeof window < "u" && typeof document < "u";
893
915
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
894
- const es = (n) => n != null, ts = () => {
916
+ const ts = (n) => n != null, ss = () => {
895
917
  };
896
- function ss(n) {
918
+ function ns(n) {
897
919
  return me();
898
920
  }
899
- function ns(...n) {
921
+ function rs(...n) {
900
922
  if (n.length !== 1)
901
923
  return ze(...n);
902
924
  const e = n[0];
903
- return typeof e == "function" ? Ke(We(() => ({ get: e, set: ts }))) : F(e);
925
+ return typeof e == "function" ? Ke(We(() => ({ get: e, set: ss }))) : T(e);
904
926
  }
905
- function rs(n, e) {
906
- ss() && Ge(n, e);
927
+ function os(n, e) {
928
+ ns() && Ge(n, e);
907
929
  }
908
- const os = Ee ? window : void 0, is = Ee ? window.document : void 0;
909
- function as(n) {
930
+ const is = Ee ? window : void 0, as = Ee ? window.document : void 0;
931
+ function cs(n) {
910
932
  var e;
911
- const t = te(n);
933
+ const t = se(n);
912
934
  return (e = t?.$el) != null ? e : t;
913
935
  }
914
- function cs() {
915
- const n = F(!1), e = me();
936
+ function ls() {
937
+ const n = T(!1), e = me();
916
938
  return e && Ze(() => {
917
939
  n.value = !0;
918
940
  }, e), n;
919
941
  }
920
- function ls(n) {
921
- const e = cs();
942
+ function us(n) {
943
+ const e = ls();
922
944
  return ve(() => (e.value, !!n()));
923
945
  }
924
- function us(n, e, t = {}) {
925
- const { window: s = os, ...r } = t;
946
+ function ps(n, e, t = {}) {
947
+ const { window: s = is, ...r } = t;
926
948
  let o;
927
- const a = ls(() => s && "MutationObserver" in s), i = () => {
949
+ const a = us(() => s && "MutationObserver" in s), i = () => {
928
950
  o && (o.disconnect(), o = void 0);
929
951
  }, c = ve(() => {
930
- const p = te(n), h = (Array.isArray(p) ? p : [p]).map(as).filter(es);
952
+ const p = se(n), h = (Array.isArray(p) ? p : [p]).map(cs).filter(ts);
931
953
  return new Set(h);
932
954
  }), l = ge(
933
955
  () => c.value,
@@ -938,23 +960,23 @@ function us(n, e, t = {}) {
938
960
  ), f = () => o?.takeRecords(), u = () => {
939
961
  l(), i();
940
962
  };
941
- return Zt(u), {
963
+ return es(u), {
942
964
  isSupported: a,
943
965
  stop: u,
944
966
  takeRecords: f
945
967
  };
946
968
  }
947
- function ps(n = null, e = {}) {
969
+ function ds(n = null, e = {}) {
948
970
  var t, s, r;
949
971
  const {
950
- document: o = is,
972
+ document: o = as,
951
973
  restoreOnUnmount: a = (u) => u
952
- } = e, i = (t = o?.title) != null ? t : "", c = ns((s = n ?? o?.title) != null ? s : null), l = n && typeof n == "function";
974
+ } = e, i = (t = o?.title) != null ? t : "", c = rs((s = n ?? o?.title) != null ? s : null), l = n && typeof n == "function";
953
975
  function f(u) {
954
976
  if (!("titleTemplate" in e))
955
977
  return u;
956
978
  const p = e.titleTemplate || "%s";
957
- return typeof p == "function" ? p(u) : te(p).replace(/%s/g, u);
979
+ return typeof p == "function" ? p(u) : se(p).replace(/%s/g, u);
958
980
  }
959
981
  return ge(
960
982
  c,
@@ -962,24 +984,24 @@ function ps(n = null, e = {}) {
962
984
  u !== p && o && (o.title = f(typeof u == "string" ? u : ""));
963
985
  },
964
986
  { immediate: !0 }
965
- ), e.observe && !e.titleTemplate && o && !l && us(
987
+ ), e.observe && !e.titleTemplate && o && !l && ps(
966
988
  (r = o.head) == null ? void 0 : r.querySelector("title"),
967
989
  () => {
968
990
  o && o.title !== c.value && (c.value = f(o.title));
969
991
  },
970
992
  { childList: !0 }
971
- ), rs(() => {
993
+ ), os(() => {
972
994
  if (a) {
973
995
  const u = a(i, c.value || "");
974
996
  u != null && o && (o.title = u);
975
997
  }
976
998
  }), c;
977
999
  }
978
- const pe = X({
1000
+ const pe = Z({
979
1001
  name: "VtjPageContainer",
980
1002
  async setup() {
981
- const n = Pe(), e = ye(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = F(Symbol());
982
- return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), ps(s.title || "VTJ")), {
1003
+ const n = Re(), e = ye(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = T(Symbol());
1004
+ return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), ds(s.title || "VTJ")), {
983
1005
  provider: n,
984
1006
  component: r,
985
1007
  file: s,
@@ -996,22 +1018,22 @@ const pe = X({
996
1018
  activated() {
997
1019
  this.meta.cache === !1 && (this.sid = Symbol());
998
1020
  }
999
- }), ds = {
1021
+ }), fs = {
1000
1022
  "data-l-h6o7ki7": "",
1001
1023
  class: "vtj-startup__wrapper"
1002
- }, fs = {
1024
+ }, hs = {
1003
1025
  "data-l-h6o7ki7": "",
1004
1026
  class: "vtj-startup"
1005
- }, hs = {
1027
+ }, ms = {
1006
1028
  "data-l-h6o7ki7": "",
1007
1029
  class: "vtj-startup__name"
1008
- }, ms = { "data-l-h6o7ki7": "" }, gs = {
1030
+ }, gs = { "data-l-h6o7ki7": "" }, vs = {
1009
1031
  "data-l-h6o7ki7": "",
1010
1032
  class: "vtj-startup__tagline"
1011
- }, vs = {
1033
+ }, ys = {
1012
1034
  "data-l-h6o7ki7": "",
1013
1035
  class: "vtj-startup__actions"
1014
- }, ys = /* @__PURE__ */ X({
1036
+ }, _s = /* @__PURE__ */ Z({
1015
1037
  __name: "Startup",
1016
1038
  props: {
1017
1039
  name: { default: "VTJ.PRO" },
@@ -1099,14 +1121,14 @@ const pe = X({
1099
1121
  window.location.href = o;
1100
1122
  }
1101
1123
  };
1102
- return (r, o) => (et(), tt("div", ds, [
1103
- E("div", fs, [
1104
- E("h1", hs, [
1105
- E("span", ms, V(t.name), 1)
1124
+ return (r, o) => (et(), tt("div", fs, [
1125
+ k("div", hs, [
1126
+ k("h1", ms, [
1127
+ k("span", gs, V(t.name), 1)
1106
1128
  ]),
1107
- E("div", gs, V(t.tagline), 1),
1108
- E("div", vs, [
1109
- E("button", {
1129
+ k("div", vs, V(t.tagline), 1),
1130
+ k("div", ys, [
1131
+ k("button", {
1110
1132
  "data-l-h6o7ki7": "",
1111
1133
  onClick: s
1112
1134
  }, V(t.actionText), 1)
@@ -1114,14 +1136,14 @@ const pe = X({
1114
1136
  ])
1115
1137
  ]));
1116
1138
  }
1117
- }), _s = X({
1139
+ }), ws = Z({
1118
1140
  name: "VtjStartupContainer",
1119
1141
  render() {
1120
- return W(ys);
1142
+ return W(_s);
1121
1143
  }
1122
- }), Re = Symbol("Provider");
1123
- var ws = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ws || {});
1124
- class Ss extends Ae {
1144
+ }), ke = Symbol("Provider");
1145
+ var Ss = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Ss || {});
1146
+ class bs extends Te {
1125
1147
  constructor(e) {
1126
1148
  super(), this.options = e;
1127
1149
  const {
@@ -1140,13 +1162,16 @@ class Ss extends Ae {
1140
1162
  } = e;
1141
1163
  this.mode = s, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = p, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, c), Object.assign(this.adapter, i);
1142
1164
  const { access: h, request: m } = this.adapter;
1143
- h && h.connect({ mode: s, router: f, request: m }), a && s !== y.Design ? this.load(a) : this.project = a;
1165
+ h && h.connect({ mode: s, router: f, request: m }), a && s !== y.Design ? this.load(a) : this.project = a, E.setup({
1166
+ timeout: "50-500"
1167
+ });
1144
1168
  }
1145
1169
  mode;
1146
1170
  globals = {};
1147
1171
  modules = {};
1148
1172
  adapter = { request: _t, jsonp: qe };
1149
1173
  apis = {};
1174
+ // public createMock: typeof createMock = createMock;
1150
1175
  dependencies = {};
1151
1176
  materials = {};
1152
1177
  library = {};
@@ -1157,12 +1182,24 @@ class Ss extends Ae {
1157
1182
  router = null;
1158
1183
  materialPath = "./";
1159
1184
  urlDslCaches = {};
1185
+ createMock(e) {
1186
+ return async (...t) => {
1187
+ let s = {};
1188
+ if (e)
1189
+ try {
1190
+ s = await e.apply(e, t);
1191
+ } catch (r) {
1192
+ x.warn("模拟数据模版异常", r);
1193
+ }
1194
+ return E.mock(s);
1195
+ };
1196
+ }
1160
1197
  async load(e) {
1161
1198
  const t = this.modules[`.vtj/projects/${e.id}.json`];
1162
1199
  if (this.project = t ? await t() : await this.service.init(e), !this.project)
1163
1200
  throw new Error("project is null");
1164
1201
  const { apis: s = [], meta: r = [] } = this.project, o = window;
1165
- o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis = bt(s, r, this.adapter), Se(), this.project.config?.mock && jt(s), this.initRouter(), this.triggerReady();
1202
+ o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis = bt(s, r, this.adapter), Se(), jt(s), this.initRouter(), this.triggerReady();
1166
1203
  }
1167
1204
  async loadDependencies(e) {
1168
1205
  const t = Object.entries(this.dependencies);
@@ -1191,16 +1228,16 @@ class Ss extends Ae {
1191
1228
  else {
1192
1229
  const w = l[h] || [];
1193
1230
  for (const g of w)
1194
- Z(g) && await dt(h, x.append(g, { v: k })), ee(g) && await ae(x.append(g, { v: k }));
1231
+ ee(g) && await dt(h, P.append(g, { v: C })), te(g) && await ce(P.append(g, { v: C }));
1195
1232
  r[h] = e[h];
1196
1233
  }
1197
1234
  }
1198
1235
  if (i === "development") {
1199
1236
  for (const m of f)
1200
- await ae(x.append(m, { v: k }));
1237
+ await ce(P.append(m, { v: C }));
1201
1238
  const h = this.materials || {};
1202
1239
  for (const m of u) {
1203
- const d = e[p[m]], w = Te[m];
1240
+ const d = e[p[m]], w = Ae[m];
1204
1241
  if (w)
1205
1242
  d && w.forEach((g) => {
1206
1243
  o[g] = d[g];
@@ -1219,21 +1256,21 @@ class Ss extends Ae {
1219
1256
  if (!e) return;
1220
1257
  const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, c = o ? "" : "/", l = {
1221
1258
  path: `${c}${a}/:id`,
1222
- name: C,
1259
+ name: F,
1223
1260
  component: pe
1224
1261
  }, f = {
1225
1262
  path: c,
1226
- name: D,
1227
- component: t?.homepage ? pe : r.startupComponent || _s,
1263
+ name: H,
1264
+ component: t?.homepage ? pe : r.startupComponent || ws,
1228
1265
  meta: i
1229
1266
  };
1230
- e.hasRoute(C) && e.removeRoute(C), e.hasRoute(D) && e.removeRoute(D), o ? (e.addRoute(o, l), e.addRoute(o, f)) : (e.addRoute(l), e.addRoute(f));
1267
+ e.hasRoute(F) && e.removeRoute(F), e.hasRoute(H) && e.removeRoute(H), o ? (e.addRoute(o, l), e.addRoute(o, f)) : (e.addRoute(l), e.addRoute(f));
1231
1268
  }
1232
1269
  install(e) {
1233
1270
  const t = e.config.globalProperties.installed || {};
1234
1271
  for (const [s, r] of Object.entries(this.library))
1235
1272
  !t[s] && mt(r) && (e.use(r), t[s] = !0);
1236
- this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Re, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
1273
+ this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(ke, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
1237
1274
  const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
1238
1275
  console.error(
1239
1276
  "[VTJ Error]:",
@@ -1243,7 +1280,7 @@ class Ss extends Ae {
1243
1280
  info: o
1244
1281
  },
1245
1282
  s?.stack
1246
- ), N.error({
1283
+ ), U.error({
1247
1284
  title: "未处理的异常:请在控制台查看详情",
1248
1285
  message: c
1249
1286
  });
@@ -1295,12 +1332,12 @@ class Ss extends Ae {
1295
1332
  apis: a,
1296
1333
  window,
1297
1334
  ...t
1298
- }, c = Y({
1335
+ }, c = Q({
1299
1336
  getDsl: async (l) => await this.getDsl(l) || null,
1300
1337
  getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
1301
1338
  options: i
1302
1339
  });
1303
- return G({
1340
+ return Y({
1304
1341
  ...i,
1305
1342
  dsl: e,
1306
1343
  loader: c
@@ -1309,40 +1346,40 @@ class Ss extends Ae {
1309
1346
  async getRenderComponent(e, t) {
1310
1347
  const s = this.getFile(e);
1311
1348
  if (!s)
1312
- return O.warn(`Can not find file: ${e}`), null;
1349
+ return x.warn(`Can not find file: ${e}`), null;
1313
1350
  t && t(s);
1314
1351
  const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
1315
1352
  if (o)
1316
1353
  return (await o())?.default;
1317
1354
  const a = await this.getDsl(s.id);
1318
- return a ? this.createDslRenderer(a).renderer : (O.warn(`Can not find dsl: ${e}`), null);
1355
+ return a ? this.createDslRenderer(a).renderer : (x.warn(`Can not find dsl: ${e}`), null);
1319
1356
  }
1320
1357
  defineUrlSchemaComponent(e, t) {
1321
- return ce(async () => {
1358
+ return le(async () => {
1322
1359
  const s = await this.getDslByUrl(e);
1323
1360
  return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
1324
1361
  });
1325
1362
  }
1326
1363
  definePluginComponent(e) {
1327
- return ce(async () => await je(e, window));
1364
+ return le(async () => await je(e, window));
1328
1365
  }
1329
1366
  }
1330
- function Ds(n) {
1331
- const e = new Ss(n);
1367
+ function Hs(n) {
1368
+ const e = new bs(n);
1332
1369
  return {
1333
1370
  provider: e,
1334
1371
  onReady: (s) => e.ready(s)
1335
1372
  };
1336
1373
  }
1337
- function Pe(n = {}) {
1338
- const e = he(Re);
1374
+ function Re(n = {}) {
1375
+ const e = he(ke);
1339
1376
  if (!e)
1340
1377
  throw new Error("Can not find provider");
1341
1378
  if (e.nodeEnv === "development") {
1342
1379
  const { id: t, version: s } = n;
1343
1380
  t && s && (async () => {
1344
1381
  const r = await e.getDsl(t);
1345
- r?.__VERSION__ !== s && N.warning({
1382
+ r?.__VERSION__ !== s && U.warning({
1346
1383
  title: r?.name,
1347
1384
  message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
1348
1385
  });
@@ -1350,7 +1387,7 @@ function Pe(n = {}) {
1350
1387
  }
1351
1388
  return e;
1352
1389
  }
1353
- const se = new Je({
1390
+ const ne = new Je({
1354
1391
  settings: {
1355
1392
  type: "json",
1356
1393
  validSuccess: !0,
@@ -1358,12 +1395,12 @@ const se = new Je({
1358
1395
  failMessage: !0,
1359
1396
  validate: (n) => n.data?.code === 0,
1360
1397
  showError: (n) => {
1361
- N.error({
1398
+ U.error({
1362
1399
  message: n || "未知错误"
1363
1400
  });
1364
1401
  }
1365
1402
  }
1366
- }), bs = (n = "/__vtj__/api/:type.json") => (e, t) => se.send({
1403
+ }), js = (n = "/__vtj__/api/:type.json") => (e, t) => ne.send({
1367
1404
  url: n,
1368
1405
  method: "post",
1369
1406
  params: { type: e },
@@ -1371,7 +1408,7 @@ const se = new Je({
1371
1408
  type: e,
1372
1409
  data: t
1373
1410
  }
1374
- }), js = (n = "/__vtj__/api/uploader.json") => async (e, t) => await se.send({
1411
+ }), $s = (n = "/__vtj__/api/uploader.json") => async (e, t) => await ne.send({
1375
1412
  url: n,
1376
1413
  method: "post",
1377
1414
  data: {
@@ -1382,12 +1419,12 @@ const se = new Je({
1382
1419
  type: "data"
1383
1420
  }
1384
1421
  }).then((s) => s && s[0] ? s[0] : null).catch(() => null);
1385
- class ne {
1422
+ class re {
1386
1423
  api;
1387
1424
  pluginCaches = {};
1388
1425
  uploader;
1389
1426
  constructor() {
1390
- this.api = bs(), this.uploader = js();
1427
+ this.api = js(), this.uploader = $s();
1391
1428
  }
1392
1429
  async getExtension() {
1393
1430
  console.log("BaseService.getExtension");
@@ -1463,7 +1500,7 @@ class ne {
1463
1500
  const { urls: t = [] } = e, s = t.filter((o) => ct(o))[0];
1464
1501
  if (!s) return null;
1465
1502
  const r = this.pluginCaches[s];
1466
- return r || (this.pluginCaches[s] = se.send({
1503
+ return r || (this.pluginCaches[s] = ne.send({
1467
1504
  url: s,
1468
1505
  method: "get",
1469
1506
  settings: {
@@ -1481,17 +1518,17 @@ const v = new Ve({
1481
1518
  expired: 0,
1482
1519
  prefix: "__VTJ_"
1483
1520
  });
1484
- class Ms extends ne {
1521
+ class Os extends re {
1485
1522
  init(e) {
1486
- const t = new M(e), s = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
1523
+ const t = new O(e), s = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
1487
1524
  return v.save(`project_${t.id}`, r), Promise.resolve(r);
1488
1525
  }
1489
1526
  saveProject(e) {
1490
- const t = new M(e);
1527
+ const t = new O(e);
1491
1528
  return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
1492
1529
  }
1493
1530
  saveMaterials(e, t) {
1494
- return v.save(`materials_${e.id}`, Q(t)), Promise.resolve(!0);
1531
+ return v.save(`materials_${e.id}`, X(t)), Promise.resolve(!0);
1495
1532
  }
1496
1533
  saveFile(e) {
1497
1534
  return v.save(`file_${e.id}`, e), Promise.resolve(!0);
@@ -1531,22 +1568,22 @@ class Ms extends ne {
1531
1568
  }), Promise.resolve(!0);
1532
1569
  }
1533
1570
  }
1534
- class $s extends ne {
1571
+ class Es extends re {
1535
1572
  projects = {};
1536
1573
  materials = {};
1537
1574
  files = {};
1538
1575
  histories = {};
1539
1576
  historyItems = {};
1540
1577
  init(e) {
1541
- const t = new M(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
1578
+ const t = new O(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
1542
1579
  return this.projects[r.id] = r, Promise.resolve(r);
1543
1580
  }
1544
1581
  saveProject(e) {
1545
- const t = new M(e);
1582
+ const t = new O(e);
1546
1583
  return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
1547
1584
  }
1548
1585
  saveMaterials(e, t) {
1549
- return e.id && (this.materials[e.id] = Q(t)), Promise.resolve(!0);
1586
+ return e.id && (this.materials[e.id] = X(t)), Promise.resolve(!0);
1550
1587
  }
1551
1588
  saveFile(e) {
1552
1589
  return this.files[e.id] = e, Promise.resolve(!0);
@@ -1588,11 +1625,11 @@ class $s extends ne {
1588
1625
  }), Promise.resolve(!0);
1589
1626
  }
1590
1627
  }
1591
- let I = null;
1592
- function Os() {
1593
- return I || (I = new $s(), I);
1628
+ let D = null;
1629
+ function Bs() {
1630
+ return D || (D = new Es(), D);
1594
1631
  }
1595
- class Hs extends ne {
1632
+ class Ns extends re {
1596
1633
  getFileCaches = {};
1597
1634
  async getExtension() {
1598
1635
  return await this.api("getExtension", {}).catch(() => {
@@ -1607,7 +1644,7 @@ class Hs extends ne {
1607
1644
  async saveMaterials(e, t) {
1608
1645
  return !!await this.api("saveMaterials", {
1609
1646
  project: e,
1610
- materials: Q(t)
1647
+ materials: X(t)
1611
1648
  }).catch(() => !1);
1612
1649
  }
1613
1650
  async saveFile(e) {
@@ -1647,7 +1684,7 @@ class Hs extends ne {
1647
1684
  );
1648
1685
  }
1649
1686
  }
1650
- function xe(n, e, t = []) {
1687
+ function Pe(n, e, t = []) {
1651
1688
  return t.map((s) => {
1652
1689
  const { id: r, title: o, icon: a, children: i, hidden: c } = s;
1653
1690
  return {
@@ -1656,39 +1693,39 @@ function xe(n, e, t = []) {
1656
1693
  icon: a,
1657
1694
  hidden: c,
1658
1695
  url: `${n}/${e}/${r}`,
1659
- children: i && i.length ? xe(n, e, i) : void 0
1696
+ children: i && i.length ? Pe(n, e, i) : void 0
1660
1697
  };
1661
1698
  });
1662
1699
  }
1663
- function ke(n, e) {
1700
+ function xe(n, e) {
1664
1701
  if (!e) return n;
1665
1702
  let t = [];
1666
1703
  for (const s of n)
1667
1704
  if (s.children && s.children.length) {
1668
- const r = ke(s.children, e);
1705
+ const r = xe(s.children, e);
1669
1706
  r.length && (s.children = r, t.push(s));
1670
1707
  } else
1671
1708
  e.can(s.id.toString()) && t.push(s);
1672
1709
  return t;
1673
1710
  }
1674
- function Bs(n) {
1711
+ function Us(n) {
1675
1712
  const {
1676
1713
  menuPathPrefix: e = "",
1677
1714
  pageRouteName: t = "page",
1678
1715
  disableMenusFilter: s = !1
1679
- } = n || {}, r = Pe(), o = ye(), a = Rt(), i = F(!1), c = F(!1), l = r.project;
1716
+ } = n || {}, r = Re(), o = ye(), a = Rt(), i = T(!1), c = T(!1), l = r.project;
1680
1717
  st(() => {
1681
1718
  const { name: p, params: h, meta: m } = o;
1682
- if (p === C) {
1719
+ if (p === F) {
1683
1720
  const d = r.getPage(h.id);
1684
1721
  i.value = !d?.mask, c.value = !!d?.pure;
1685
- } else if (p === D) {
1722
+ } else if (p === H) {
1686
1723
  const d = r.getHomepage();
1687
1724
  i.value = !d?.mask, c.value = !!d?.pure;
1688
1725
  } else
1689
1726
  i.value = !m.mask, c.value = !!m.pure;
1690
1727
  });
1691
- const f = xe(
1728
+ const f = Pe(
1692
1729
  e,
1693
1730
  t,
1694
1731
  l?.pages
@@ -1698,71 +1735,72 @@ function Bs(n) {
1698
1735
  logo: u?.logo,
1699
1736
  themeSwitchable: u?.themeSwitchable,
1700
1737
  title: u?.title || l?.description || l?.name || "VTJ App",
1701
- menus: s ? f : ke(f, a),
1738
+ menus: s ? f : xe(f, a),
1702
1739
  pure: c
1703
1740
  };
1704
1741
  }
1705
1742
  export {
1706
1743
  be as ACCESS_KEY,
1707
- Is as Access,
1744
+ Ds as Access,
1708
1745
  at as BUILD_IN_TAGS,
1709
1746
  rt as BUILT_IN_DIRECTIVES,
1710
- ne as BaseService,
1711
- le as CONTEXT_HOST,
1747
+ re as BaseService,
1748
+ ue as CONTEXT_HOST,
1712
1749
  Pt as Context,
1713
1750
  y as ContextMode,
1714
1751
  ot as DATA_TYPES,
1715
- D as HOMEPAGE_ROUTE_NAME,
1752
+ H as HOMEPAGE_ROUTE_NAME,
1716
1753
  it as HTML_TAGS,
1717
- Ts as JSCodeToString,
1718
- Cs as LIFE_CYCLES_LIST,
1719
- Hs as LocalService,
1720
- $s as MemoryService,
1721
- ws as NodeEnv,
1722
- C as PAGE_ROUTE_NAME,
1723
- Ss as Provider,
1724
- ys as Startup,
1725
- Ms as StorageService,
1726
- k as VTJ_RENDERER_VERSION,
1754
+ Ms as JSCodeToString,
1755
+ Ts as LIFE_CYCLES_LIST,
1756
+ Ns as LocalService,
1757
+ Es as MemoryService,
1758
+ Ss as NodeEnv,
1759
+ F as PAGE_ROUTE_NAME,
1760
+ bs as Provider,
1761
+ _s as Startup,
1762
+ Os as StorageService,
1763
+ C as VTJ_RENDERER_VERSION,
1727
1764
  we as adoptedStyleSheets,
1728
- Fs as createAssetScripts,
1729
- As as createAssetsCss,
1730
- It as createDataSources,
1731
- Y as createLoader,
1732
- Os as createMemoryService,
1765
+ As as createAssetScripts,
1766
+ Is as createAssetsCss,
1767
+ Mt as createDataSources,
1768
+ Q as createLoader,
1769
+ Bs as createMemoryService,
1733
1770
  St as createMetaApi,
1734
- Ds as createProvider,
1735
- G as createRenderer,
1771
+ $t as createMock,
1772
+ Hs as createProvider,
1773
+ Y as createRenderer,
1736
1774
  wt as createSchemaApi,
1737
1775
  bt as createSchemaApis,
1738
1776
  Ot as defaultLoader,
1739
- T as fillBasePath,
1777
+ M as fillBasePath,
1740
1778
  $e as getModifiers,
1741
1779
  je as getPlugin,
1742
1780
  pt as getRawComponent,
1743
1781
  gt as isBuiltInTag,
1744
- Z as isCSSUrl,
1782
+ ee as isCSSUrl,
1745
1783
  yt as isJSCode,
1746
1784
  _ as isJSExpression,
1747
- U as isJSFunction,
1785
+ I as isJSFunction,
1748
1786
  ct as isJSON,
1749
- ee as isJSUrl,
1787
+ te as isJSUrl,
1750
1788
  vt as isNativeTag,
1751
1789
  mt as isVuePlugin,
1752
1790
  dt as loadCss,
1753
1791
  ft as loadCssUrl,
1754
1792
  ht as loadScriptUrl,
1755
- $t as mockApi,
1793
+ Et as mockApi,
1756
1794
  jt as mockApis,
1757
1795
  Se as mockCleanup,
1758
- H as nodeRender,
1796
+ B as nodeRender,
1759
1797
  ut as parseDeps,
1760
1798
  A as parseExpression,
1761
- ue as parseFunction,
1762
- Re as providerKey,
1799
+ G as parseFunction,
1800
+ ke as providerKey,
1763
1801
  lt as removeProdFlag,
1764
1802
  _e as toString,
1765
1803
  Rt as useAccess,
1766
- Bs as useMask,
1767
- Pe as useProvider
1804
+ Us as useMask,
1805
+ Re as useProvider
1768
1806
  };