@vtj/renderer 0.9.2 → 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 H, 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 M, createRequest as He, merge as Me, pathToRegexp as Oe, 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.2
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.2";
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",
@@ -54,29 +55,29 @@ const le = [
54
55
  Object,
55
56
  Function,
56
57
  Date
57
- }, 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(
58
59
  ","
59
60
  ), at = "component,slot".split(",");
60
- function T(n, e) {
61
+ function M(n, e) {
61
62
  return n.map((t) => Ie(t) || t.startsWith("/") ? t : `${e}${t}`);
62
63
  }
63
- function Z(n) {
64
+ function ee(n) {
64
65
  return /\.css$/.test(n);
65
66
  }
66
- function ee(n) {
67
+ function te(n) {
67
68
  return /\.js$/.test(n);
68
69
  }
69
70
  function ct(n) {
70
71
  return /\.json$/.test(n);
71
72
  }
72
- function Fs(n) {
73
+ function As(n) {
73
74
  return n.map(
74
- (e) => `<script src="${x.append(e, { v: k })}"><\/script>`
75
+ (e) => `<script src="${P.append(e, { v: C })}"><\/script>`
75
76
  ).join("");
76
77
  }
77
- function As(n = []) {
78
+ function Is(n = []) {
78
79
  return n.map(
79
- (e) => `<link rel="stylesheet" href="${x.append(e, { v: k })}" />`
80
+ (e) => `<link rel="stylesheet" href="${P.append(e, { v: C })}" />`
80
81
  ).join("");
81
82
  }
82
83
  function lt(n, e = !1) {
@@ -87,15 +88,15 @@ function ut(n, e, t = !1) {
87
88
  return s.forEach(
88
89
  ({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
89
90
  p?.forEach((g) => {
90
- ee(g) && r.push(lt(g, t)), Z(g) && o.push(g);
91
- }), 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);
92
93
  }
93
94
  ), {
94
- scripts: T(r, e),
95
- css: T(o, e),
96
- materials: T(a, e),
95
+ scripts: M(r, e),
96
+ css: M(o, e),
97
+ materials: M(a, e),
97
98
  libraryExports: i,
98
- materialExports: De(f),
99
+ materialExports: Me(f),
99
100
  materialMapLibrary: u,
100
101
  libraryMap: c,
101
102
  libraryLocaleMap: l
@@ -168,13 +169,13 @@ function A(n, e, t = !1, s = !1) {
168
169
  const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
169
170
  return new Function("$scope", a)(e);
170
171
  } catch (r) {
171
- if (M.error("parseExpression.error", r, n, e?.__self ?? e), s)
172
+ if (x.error("parseExpression.error", r, n, e?.__self ?? e), s)
172
173
  throw r;
173
174
  }
174
175
  }
175
- function ue(n, e, t = !1, s = !1) {
176
+ function G(n, e, t = !1, s = !1) {
176
177
  const r = A(n, e, t, s);
177
- if (typeof r != "function" && (M.error(
178
+ if (typeof r != "function" && (x.error(
178
179
  "parseFunction.error",
179
180
  "not a function",
180
181
  n,
@@ -186,17 +187,17 @@ function ue(n, e, t = !1, s = !1) {
186
187
  function _(n) {
187
188
  return n && n.type === "JSExpression";
188
189
  }
189
- function U(n) {
190
+ function I(n) {
190
191
  return typeof n == "object" && n && n.type === "JSFunction";
191
192
  }
192
193
  function yt(n) {
193
- return _(n) || U(n);
194
+ return _(n) || I(n);
194
195
  }
195
- function Ts(n) {
196
+ function Ms(n) {
196
197
  return yt(n) ? n.value : JSON.stringify(n);
197
198
  }
198
199
  let R = null;
199
- const _t = He({
200
+ const _t = De({
200
201
  settings: {
201
202
  type: "form",
202
203
  validSuccess: !0,
@@ -205,7 +206,7 @@ const _t = He({
205
206
  validate: (n) => n.data?.code === 0 || !!n.data?.success,
206
207
  failMessage: !0,
207
208
  showError: (n) => {
208
- N.error({
209
+ U.error({
209
210
  message: n || "未知错误"
210
211
  });
211
212
  },
@@ -221,7 +222,6 @@ const _t = He({
221
222
  }
222
223
  }
223
224
  });
224
- let P;
225
225
  function wt(n, e) {
226
226
  const { jsonp: t, request: s } = e;
227
227
  if (n.method === "jsonp")
@@ -238,7 +238,7 @@ function wt(n, e) {
238
238
  headers: r
239
239
  }
240
240
  };
241
- return (a, i) => (delete o.data, s.send(Me(o, i || {}, { data: a })));
241
+ return (a, i) => (delete o.data, s.send(He(o, i || {}, { data: a })));
242
242
  }
243
243
  }
244
244
  function St(n, e) {
@@ -262,25 +262,36 @@ function bt(n = [], e = [], t) {
262
262
  return s;
263
263
  }
264
264
  async function jt(n = []) {
265
- P = await import("mockjs").then((e) => e.default || e), P && (P.setup({
266
- timeout: "50-500"
267
- }), 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
+ };
268
279
  }
269
- function $t(n, e) {
280
+ function Et(n, e) {
270
281
  if (!e.mock) return;
271
282
  const { url: t, mockTemplate: s } = e;
272
283
  if (t && s) {
273
284
  const r = Oe(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
274
285
  n.mock(r, (i) => {
275
- 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;
276
287
  return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
277
288
  });
278
289
  }
279
290
  }
280
291
  function Se() {
281
- P && (P._mocked = {});
292
+ E && (E._mocked = {});
282
293
  }
283
- const Et = {
294
+ const kt = {
284
295
  session: !1,
285
296
  authKey: "Authorization",
286
297
  storageKey: "ACCESS_STORAGE",
@@ -293,12 +304,12 @@ const Et = {
293
304
  noPermissionMessage: "无权限访问该页面",
294
305
  appName: ""
295
306
  }, be = Symbol("access");
296
- class Is {
307
+ class Ds {
297
308
  options;
298
309
  data = null;
299
310
  mode = y.Raw;
300
311
  constructor(e) {
301
- this.options = Object.assign({}, Et, e), this.loadData();
312
+ this.options = Object.assign({}, kt, e), this.loadData();
302
313
  }
303
314
  connect(e) {
304
315
  const { mode: t, router: s, request: r } = e;
@@ -329,11 +340,11 @@ class Is {
329
340
  }
330
341
  can(e) {
331
342
  const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
332
- 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]);
333
344
  }
334
345
  some(e) {
335
346
  const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
336
- return oe(e).some((o) => s[o] || s[t + "." + o]);
347
+ return ie(e).some((o) => s[o] || s[t + "." + o]);
337
348
  }
338
349
  install(e) {
339
350
  e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(be, this);
@@ -357,13 +368,13 @@ class Is {
357
368
  setData(e) {
358
369
  const { privateKey: t } = this.options;
359
370
  if (Array.isArray(e) && t) {
360
- const s = e.map((r) => ie(r, t));
371
+ const s = e.map((r) => ae(r, t));
361
372
  this.data = JSON.parse(s.join(""));
362
373
  return;
363
374
  }
364
375
  if (typeof e == "string")
365
376
  try {
366
- const s = t ? ie(e, t) : e;
377
+ const s = t ? ae(e, t) : e;
367
378
  s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
368
379
  } catch (s) {
369
380
  console.warn(s);
@@ -383,7 +394,7 @@ class Is {
383
394
  return e && t ? !!J.get(t) : !!this.getToken();
384
395
  }
385
396
  hasRoutePermission(e) {
386
- if (e.name === C) {
397
+ if (e.name === F) {
387
398
  const t = e.params.id;
388
399
  return t && this.can(t);
389
400
  }
@@ -466,7 +477,7 @@ class Pt {
466
477
  const { mode: t, dsl: s, attrs: r } = e;
467
478
  this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
468
479
  }
469
- setup(e, t = B) {
480
+ setup(e, t = N) {
470
481
  const s = t.getCurrentInstance();
471
482
  if (!s) return;
472
483
  this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
@@ -480,12 +491,12 @@ class Pt {
480
491
  });
481
492
  }
482
493
  __proxy() {
483
- this.__instance && le.forEach((e) => {
494
+ this.__instance && ue.forEach((e) => {
484
495
  this[e] = this.__instance?.[e];
485
496
  });
486
497
  }
487
498
  __cleanup() {
488
- le.forEach((e) => {
499
+ ue.forEach((e) => {
489
500
  this[e] = null;
490
501
  });
491
502
  }
@@ -493,9 +504,9 @@ class Pt {
493
504
  if (e)
494
505
  if (this.__mode === y.Runtime) {
495
506
  const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
496
- return ue({ type: s, value: r }, this);
507
+ return G({ type: s, value: r }, this);
497
508
  } else
498
- return ue(e, this);
509
+ return G(e, this);
499
510
  }
500
511
  __parseExpression(e) {
501
512
  if (e)
@@ -535,9 +546,9 @@ class Pt {
535
546
  return s.context.__proto__ = this.context, s.__proto__ = this, s;
536
547
  }
537
548
  }
538
- function G(n) {
549
+ function Y(n) {
539
550
  const {
540
- Vue: e = B,
551
+ Vue: e = N,
541
552
  mode: t = y.Runtime,
542
553
  components: s = {},
543
554
  libs: r = {},
@@ -554,15 +565,15 @@ function G(n) {
554
565
  }), f = e.defineComponent({
555
566
  name: i.value.name,
556
567
  props: {
557
- ...kt(i.value.props ?? [], l)
568
+ ...Ct(i.value.props ?? [], l)
558
569
  },
559
570
  setup(u) {
560
571
  l.$props = u, l.props = u, i.value.id && we(
561
572
  n.window || window,
562
573
  i.value.id,
563
574
  i.value.css || ""
564
- ), l.state = Ct(e, i.value.state ?? {}, l);
565
- 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(
566
577
  i.value.dataSources || {},
567
578
  l
568
579
  ), w = {
@@ -580,7 +591,7 @@ function G(n) {
580
591
  render() {
581
592
  if (!i.value.nodes) return null;
582
593
  const u = i.value.nodes || [];
583
- return u.length === 1 ? O(u[0], l, e, a) : u.map((p) => O(p, l, e, a));
594
+ return u.length === 1 ? B(u[0], l, e, a) : u.map((p) => B(p, l, e, a));
584
595
  },
585
596
  ...Ht(i.value.lifeCycles ?? {}, l)
586
597
  });
@@ -592,7 +603,7 @@ function G(n) {
592
603
  function xt(n = []) {
593
604
  return n.map((e) => j(e) ? e : e.name);
594
605
  }
595
- function kt(n = [], e) {
606
+ function Ct(n = [], e) {
596
607
  const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => ot[o]) : void 0;
597
608
  return n.map((s) => j(s) ? {
598
609
  name: s
@@ -610,18 +621,18 @@ function kt(n = [], e) {
610
621
  {}
611
622
  );
612
623
  }
613
- function Ct(n, e, t) {
624
+ function Ft(n, e, t) {
614
625
  return n.reactive(
615
626
  Object.keys(e || {}).reduce(
616
627
  (s, r) => {
617
628
  let o = e[r];
618
- 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;
619
630
  },
620
631
  {}
621
632
  )
622
633
  );
623
634
  }
624
- function Ft(n, e, t) {
635
+ function Tt(n, e, t) {
625
636
  return Object.entries(e ?? {}).reduce(
626
637
  (s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
627
638
  {}
@@ -633,7 +644,7 @@ function At(n, e) {
633
644
  {}
634
645
  );
635
646
  }
636
- function Tt(n, e = [], t) {
647
+ function It(n, e = [], t) {
637
648
  return e.reduce(
638
649
  (s, r) => {
639
650
  const { name: o, from: a } = r || {};
@@ -644,14 +655,20 @@ function Tt(n, e = [], t) {
644
655
  {}
645
656
  );
646
657
  }
647
- function It(n, e) {
658
+ function Mt(n, e) {
648
659
  return Object.keys(n).reduce(
649
660
  (t, s) => {
650
- const r = n[s], o = e.$apis[r.ref], a = U(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
651
- return t[s] = async (...i) => {
652
- const c = await o.apply(e, i);
653
- return a ? a(c) : c;
654
- }, 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;
655
672
  },
656
673
  {}
657
674
  );
@@ -675,64 +692,64 @@ function Ht(n, e) {
675
692
  );
676
693
  }
677
694
  let z = [];
678
- const Mt = (n) => n;
695
+ const Ot = (n) => n;
679
696
  async function je(n, e = window) {
680
- 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));
681
698
  if (r.length === 0 || !s) return null;
682
- const o = t.filter((i) => Z(i));
699
+ const o = t.filter((i) => ee(i));
683
700
  return o.length && ft(o, e), await ht(r, s, e).catch(
684
701
  (i) => (console.warn("loadScriptUrl error", r, s, i), null)
685
702
  );
686
703
  }
687
- function Y(n) {
704
+ function Q(n) {
688
705
  const { getDsl: e, getDslByUrl: t, options: s } = n;
689
706
  return s.window && (z.forEach((r) => {
690
707
  delete s.window[r];
691
- }), 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 () => {
692
709
  const i = await e(o.id);
693
- return i && (i.name = r), i ? G({
710
+ return i && (i.name = r), i ? Y({
694
711
  ...s,
695
712
  Vue: a,
696
713
  dsl: i,
697
714
  mode: y.Runtime,
698
- loader: Y(n)
715
+ loader: Q(n)
699
716
  }).renderer : null;
700
717
  }) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
701
718
  const i = await t(o.url);
702
- return i && (i.name = r), i ? G({
719
+ return i && (i.name = r), i ? Y({
703
720
  ...s,
704
721
  Vue: a,
705
722
  dsl: i,
706
723
  mode: y.Runtime,
707
- loader: Y(n)
724
+ loader: Q(n)
708
725
  }).renderer : null;
709
726
  }) : o.type === "Plugin" ? (o.library && z.push(o.library), a.defineAsyncComponent(async () => {
710
727
  const i = await je(o, s.window);
711
728
  return i || (console.warn("getPlugin result is null", o), null);
712
729
  })) : r;
713
730
  }
714
- function O(n, e, t = B, s = Mt) {
731
+ function B(n, e, t = N, s = Ot) {
715
732
  if (!n || !n.name || n.invisible) return null;
716
- 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);
717
- 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))
718
735
  return null;
719
736
  const m = (d) => {
720
737
  const w = d.$components, g = (() => {
721
738
  if (n.name === "component")
722
- return Ut(d, n.props?.is);
739
+ return Lt(d, n.props?.is);
723
740
  if (n.name === "slot") return n.name;
724
741
  const b = s(n.name, n.from, t);
725
742
  return j(b) ? gt(b) || vt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
726
- })(), 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);
727
744
  if (n.name === "slot")
728
- return Jt(t, n, S, d, s);
745
+ return Vt(t, n, S, d, s);
729
746
  u && Object.assign(S, d.__parseExpression(u.value)), l && (S.style = Object.assign(
730
747
  S.style ?? {},
731
- zt(l, d)
732
- )), p && Object.assign(S, Kt(p, d)), f.forEach((b) => {
733
- 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));
734
751
  });
735
- const Fe = Gt(
752
+ const Fe = Yt(
736
753
  t,
737
754
  n.children ?? [],
738
755
  d,
@@ -740,12 +757,12 @@ function O(n, e, t = B, s = Mt) {
740
757
  n
741
758
  );
742
759
  let L = t.createVNode(g, { ...S, ...Ce }, Fe);
743
- const re = r ? Ot(r, h, d) : [];
744
- 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;
745
762
  };
746
- return c ? Xt(c, m, e) : m(e);
763
+ return c ? Zt(c, m, e) : m(e);
747
764
  }
748
- function Ot(n, e, t) {
765
+ function Bt(n, e, t) {
749
766
  const s = n.app;
750
767
  return e.map((r) => {
751
768
  const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
@@ -754,7 +771,7 @@ function Ot(n, e, t) {
754
771
  return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
755
772
  }).filter((r) => !!r);
756
773
  }
757
- function Bt(n = []) {
774
+ function Nt(n = []) {
758
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(
759
776
  (c) => $(c.name) === "vModel"
760
777
  ), i = n.filter(
@@ -770,23 +787,23 @@ function Bt(n = []) {
770
787
  vHtml: o
771
788
  };
772
789
  }
773
- function Nt(n, e) {
790
+ function Ut(n, e) {
774
791
  return !!e.__parseExpression(n.value);
775
792
  }
776
- function Ut(n, e) {
793
+ function Lt(n, e) {
777
794
  return e ? _(e) ? n.__parseExpression(e) : e : "div";
778
795
  }
779
- function Lt(n, e, t) {
796
+ function qt(n, e, t) {
780
797
  const s = Object.keys(e || {}).reduce(
781
798
  (r, o) => {
782
799
  let a = e[o];
783
- 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;
784
801
  },
785
802
  {}
786
803
  );
787
804
  return s.ref = t.__ref(n, s.ref), s;
788
805
  }
789
- function qt(n, e, t) {
806
+ function Jt(n, e, t) {
790
807
  const s = ["passive", "capture", "once"], r = {
791
808
  capture: "Capture",
792
809
  once: "Once",
@@ -804,32 +821,32 @@ function $e(n = {}, e = !1) {
804
821
  const t = Object.keys(n);
805
822
  return e ? t.map((s) => "." + s) : t;
806
823
  }
807
- function Jt(n, e, t, s, r) {
808
- 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];
809
826
  return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
810
827
  _e(s.__parseExpression(o))
811
828
  ) : Array.isArray(o) ? o.map(
812
- (c) => O(c, s, n, r)
829
+ (c) => B(c, s, n, r)
813
830
  ) : null : null;
814
831
  }
815
- function Vt(n, e) {
832
+ function zt(n, e) {
816
833
  const { props: t } = n, s = t?.name || "default";
817
834
  return {
818
835
  name: _(s) ? e.__parseExpression(s) : s,
819
836
  params: []
820
837
  };
821
838
  }
822
- function zt(n, e) {
839
+ function Kt(n, e) {
823
840
  return e.__parseExpression(n.value) ? {} : {
824
841
  display: "none"
825
842
  };
826
843
  }
827
- function Kt(n, e) {
844
+ function Wt(n, e) {
828
845
  return {
829
846
  innerHTML: e.__parseExpression(n.value) || ""
830
847
  };
831
848
  }
832
- function Wt(n, e, t) {
849
+ function Gt(n, e, t) {
833
850
  const s = {
834
851
  type: "JSFunction",
835
852
  value: e.value?.value ? `(v) => {
@@ -843,7 +860,7 @@ function Wt(n, e, t) {
843
860
  [`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
844
861
  };
845
862
  }
846
- function Gt(n, e, t, s, r) {
863
+ function Yt(n, e, t, s, r) {
847
864
  if (!e) return null;
848
865
  if (j(e))
849
866
  return { default: () => e };
@@ -852,19 +869,19 @@ function Gt(n, e, t, s, r) {
852
869
  default: () => _e(t.__parseExpression(e))
853
870
  };
854
871
  if (Array.isArray(e) && e.length > 0) {
855
- 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 ? {
856
873
  [`scope_${r.id}`]: i
857
874
  } : {};
858
875
  return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
859
876
  const p = f.length ? Le(u ?? {}, f) : a(u);
860
877
  return l.map(
861
- (h) => O(h, t.__clone(p), n, s)
878
+ (h) => B(h, t.__clone(p), n, s)
862
879
  );
863
880
  }, i), {});
864
881
  }
865
882
  return null;
866
883
  }
867
- function Yt(n) {
884
+ function Qt(n) {
868
885
  const e = {
869
886
  default: {
870
887
  params: [],
@@ -872,7 +889,7 @@ function Yt(n) {
872
889
  }
873
890
  };
874
891
  for (const t of n) {
875
- const s = Qt(t.slot), r = s.name;
892
+ const s = Xt(t.slot), r = s.name;
876
893
  e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
877
894
  nodes: [t],
878
895
  params: s.params
@@ -880,59 +897,59 @@ function Yt(n) {
880
897
  }
881
898
  return e;
882
899
  }
883
- function Qt(n = "default") {
900
+ function Xt(n = "default") {
884
901
  return j(n) ? { name: n, params: [] } : { params: [], ...n };
885
902
  }
886
- function Xt(n, e, t) {
903
+ function Zt(n, e, t) {
887
904
  const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
888
905
  let i = t.__parseExpression(s) || [];
889
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`), []);
890
907
  }
891
- function Zt(n) {
908
+ function es(n) {
892
909
  return Ye() ? (Qe(n), !0) : !1;
893
910
  }
894
- function te(n) {
911
+ function se(n) {
895
912
  return typeof n == "function" ? n() : Xe(n);
896
913
  }
897
914
  const Ee = typeof window < "u" && typeof document < "u";
898
915
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
899
- const es = (n) => n != null, ts = () => {
916
+ const ts = (n) => n != null, ss = () => {
900
917
  };
901
- function ss(n) {
918
+ function ns(n) {
902
919
  return me();
903
920
  }
904
- function ns(...n) {
921
+ function rs(...n) {
905
922
  if (n.length !== 1)
906
923
  return ze(...n);
907
924
  const e = n[0];
908
- 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);
909
926
  }
910
- function rs(n, e) {
911
- ss() && Ge(n, e);
927
+ function os(n, e) {
928
+ ns() && Ge(n, e);
912
929
  }
913
- const os = Ee ? window : void 0, is = Ee ? window.document : void 0;
914
- function as(n) {
930
+ const is = Ee ? window : void 0, as = Ee ? window.document : void 0;
931
+ function cs(n) {
915
932
  var e;
916
- const t = te(n);
933
+ const t = se(n);
917
934
  return (e = t?.$el) != null ? e : t;
918
935
  }
919
- function cs() {
920
- const n = F(!1), e = me();
936
+ function ls() {
937
+ const n = T(!1), e = me();
921
938
  return e && Ze(() => {
922
939
  n.value = !0;
923
940
  }, e), n;
924
941
  }
925
- function ls(n) {
926
- const e = cs();
942
+ function us(n) {
943
+ const e = ls();
927
944
  return ve(() => (e.value, !!n()));
928
945
  }
929
- function us(n, e, t = {}) {
930
- const { window: s = os, ...r } = t;
946
+ function ps(n, e, t = {}) {
947
+ const { window: s = is, ...r } = t;
931
948
  let o;
932
- const a = ls(() => s && "MutationObserver" in s), i = () => {
949
+ const a = us(() => s && "MutationObserver" in s), i = () => {
933
950
  o && (o.disconnect(), o = void 0);
934
951
  }, c = ve(() => {
935
- 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);
936
953
  return new Set(h);
937
954
  }), l = ge(
938
955
  () => c.value,
@@ -943,23 +960,23 @@ function us(n, e, t = {}) {
943
960
  ), f = () => o?.takeRecords(), u = () => {
944
961
  l(), i();
945
962
  };
946
- return Zt(u), {
963
+ return es(u), {
947
964
  isSupported: a,
948
965
  stop: u,
949
966
  takeRecords: f
950
967
  };
951
968
  }
952
- function ps(n = null, e = {}) {
969
+ function ds(n = null, e = {}) {
953
970
  var t, s, r;
954
971
  const {
955
- document: o = is,
972
+ document: o = as,
956
973
  restoreOnUnmount: a = (u) => u
957
- } = 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";
958
975
  function f(u) {
959
976
  if (!("titleTemplate" in e))
960
977
  return u;
961
978
  const p = e.titleTemplate || "%s";
962
- 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);
963
980
  }
964
981
  return ge(
965
982
  c,
@@ -967,24 +984,24 @@ function ps(n = null, e = {}) {
967
984
  u !== p && o && (o.title = f(typeof u == "string" ? u : ""));
968
985
  },
969
986
  { immediate: !0 }
970
- ), e.observe && !e.titleTemplate && o && !l && us(
987
+ ), e.observe && !e.titleTemplate && o && !l && ps(
971
988
  (r = o.head) == null ? void 0 : r.querySelector("title"),
972
989
  () => {
973
990
  o && o.title !== c.value && (c.value = f(o.title));
974
991
  },
975
992
  { childList: !0 }
976
- ), rs(() => {
993
+ ), os(() => {
977
994
  if (a) {
978
995
  const u = a(i, c.value || "");
979
996
  u != null && o && (o.title = u);
980
997
  }
981
998
  }), c;
982
999
  }
983
- const pe = X({
1000
+ const pe = Z({
984
1001
  name: "VtjPageContainer",
985
1002
  async setup() {
986
- 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());
987
- 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")), {
988
1005
  provider: n,
989
1006
  component: r,
990
1007
  file: s,
@@ -1001,22 +1018,22 @@ const pe = X({
1001
1018
  activated() {
1002
1019
  this.meta.cache === !1 && (this.sid = Symbol());
1003
1020
  }
1004
- }), ds = {
1021
+ }), fs = {
1005
1022
  "data-l-h6o7ki7": "",
1006
1023
  class: "vtj-startup__wrapper"
1007
- }, fs = {
1024
+ }, hs = {
1008
1025
  "data-l-h6o7ki7": "",
1009
1026
  class: "vtj-startup"
1010
- }, hs = {
1027
+ }, ms = {
1011
1028
  "data-l-h6o7ki7": "",
1012
1029
  class: "vtj-startup__name"
1013
- }, ms = { "data-l-h6o7ki7": "" }, gs = {
1030
+ }, gs = { "data-l-h6o7ki7": "" }, vs = {
1014
1031
  "data-l-h6o7ki7": "",
1015
1032
  class: "vtj-startup__tagline"
1016
- }, vs = {
1033
+ }, ys = {
1017
1034
  "data-l-h6o7ki7": "",
1018
1035
  class: "vtj-startup__actions"
1019
- }, ys = /* @__PURE__ */ X({
1036
+ }, _s = /* @__PURE__ */ Z({
1020
1037
  __name: "Startup",
1021
1038
  props: {
1022
1039
  name: { default: "VTJ.PRO" },
@@ -1104,14 +1121,14 @@ const pe = X({
1104
1121
  window.location.href = o;
1105
1122
  }
1106
1123
  };
1107
- return (r, o) => (et(), tt("div", ds, [
1108
- E("div", fs, [
1109
- E("h1", hs, [
1110
- 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)
1111
1128
  ]),
1112
- E("div", gs, V(t.tagline), 1),
1113
- E("div", vs, [
1114
- E("button", {
1129
+ k("div", vs, V(t.tagline), 1),
1130
+ k("div", ys, [
1131
+ k("button", {
1115
1132
  "data-l-h6o7ki7": "",
1116
1133
  onClick: s
1117
1134
  }, V(t.actionText), 1)
@@ -1119,14 +1136,14 @@ const pe = X({
1119
1136
  ])
1120
1137
  ]));
1121
1138
  }
1122
- }), _s = X({
1139
+ }), ws = Z({
1123
1140
  name: "VtjStartupContainer",
1124
1141
  render() {
1125
- return W(ys);
1142
+ return W(_s);
1126
1143
  }
1127
- }), Re = Symbol("Provider");
1128
- var ws = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ws || {});
1129
- 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 {
1130
1147
  constructor(e) {
1131
1148
  super(), this.options = e;
1132
1149
  const {
@@ -1145,13 +1162,16 @@ class Ss extends Ae {
1145
1162
  } = e;
1146
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);
1147
1164
  const { access: h, request: m } = this.adapter;
1148
- 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
+ });
1149
1168
  }
1150
1169
  mode;
1151
1170
  globals = {};
1152
1171
  modules = {};
1153
1172
  adapter = { request: _t, jsonp: qe };
1154
1173
  apis = {};
1174
+ // public createMock: typeof createMock = createMock;
1155
1175
  dependencies = {};
1156
1176
  materials = {};
1157
1177
  library = {};
@@ -1162,12 +1182,24 @@ class Ss extends Ae {
1162
1182
  router = null;
1163
1183
  materialPath = "./";
1164
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
+ }
1165
1197
  async load(e) {
1166
1198
  const t = this.modules[`.vtj/projects/${e.id}.json`];
1167
1199
  if (this.project = t ? await t() : await this.service.init(e), !this.project)
1168
1200
  throw new Error("project is null");
1169
1201
  const { apis: s = [], meta: r = [] } = this.project, o = window;
1170
- 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();
1171
1203
  }
1172
1204
  async loadDependencies(e) {
1173
1205
  const t = Object.entries(this.dependencies);
@@ -1196,16 +1228,16 @@ class Ss extends Ae {
1196
1228
  else {
1197
1229
  const w = l[h] || [];
1198
1230
  for (const g of w)
1199
- 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 }));
1200
1232
  r[h] = e[h];
1201
1233
  }
1202
1234
  }
1203
1235
  if (i === "development") {
1204
1236
  for (const m of f)
1205
- await ae(x.append(m, { v: k }));
1237
+ await ce(P.append(m, { v: C }));
1206
1238
  const h = this.materials || {};
1207
1239
  for (const m of u) {
1208
- const d = e[p[m]], w = Te[m];
1240
+ const d = e[p[m]], w = Ae[m];
1209
1241
  if (w)
1210
1242
  d && w.forEach((g) => {
1211
1243
  o[g] = d[g];
@@ -1224,21 +1256,21 @@ class Ss extends Ae {
1224
1256
  if (!e) return;
1225
1257
  const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, c = o ? "" : "/", l = {
1226
1258
  path: `${c}${a}/:id`,
1227
- name: C,
1259
+ name: F,
1228
1260
  component: pe
1229
1261
  }, f = {
1230
1262
  path: c,
1231
- name: D,
1232
- component: t?.homepage ? pe : r.startupComponent || _s,
1263
+ name: H,
1264
+ component: t?.homepage ? pe : r.startupComponent || ws,
1233
1265
  meta: i
1234
1266
  };
1235
- 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));
1236
1268
  }
1237
1269
  install(e) {
1238
1270
  const t = e.config.globalProperties.installed || {};
1239
1271
  for (const [s, r] of Object.entries(this.library))
1240
1272
  !t[s] && mt(r) && (e.use(r), t[s] = !0);
1241
- 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) => {
1242
1274
  const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
1243
1275
  console.error(
1244
1276
  "[VTJ Error]:",
@@ -1248,7 +1280,7 @@ class Ss extends Ae {
1248
1280
  info: o
1249
1281
  },
1250
1282
  s?.stack
1251
- ), N.error({
1283
+ ), U.error({
1252
1284
  title: "未处理的异常:请在控制台查看详情",
1253
1285
  message: c
1254
1286
  });
@@ -1300,12 +1332,12 @@ class Ss extends Ae {
1300
1332
  apis: a,
1301
1333
  window,
1302
1334
  ...t
1303
- }, c = Y({
1335
+ }, c = Q({
1304
1336
  getDsl: async (l) => await this.getDsl(l) || null,
1305
1337
  getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
1306
1338
  options: i
1307
1339
  });
1308
- return G({
1340
+ return Y({
1309
1341
  ...i,
1310
1342
  dsl: e,
1311
1343
  loader: c
@@ -1314,40 +1346,40 @@ class Ss extends Ae {
1314
1346
  async getRenderComponent(e, t) {
1315
1347
  const s = this.getFile(e);
1316
1348
  if (!s)
1317
- return M.warn(`Can not find file: ${e}`), null;
1349
+ return x.warn(`Can not find file: ${e}`), null;
1318
1350
  t && t(s);
1319
1351
  const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
1320
1352
  if (o)
1321
1353
  return (await o())?.default;
1322
1354
  const a = await this.getDsl(s.id);
1323
- return a ? this.createDslRenderer(a).renderer : (M.warn(`Can not find dsl: ${e}`), null);
1355
+ return a ? this.createDslRenderer(a).renderer : (x.warn(`Can not find dsl: ${e}`), null);
1324
1356
  }
1325
1357
  defineUrlSchemaComponent(e, t) {
1326
- return ce(async () => {
1358
+ return le(async () => {
1327
1359
  const s = await this.getDslByUrl(e);
1328
1360
  return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
1329
1361
  });
1330
1362
  }
1331
1363
  definePluginComponent(e) {
1332
- return ce(async () => await je(e, window));
1364
+ return le(async () => await je(e, window));
1333
1365
  }
1334
1366
  }
1335
- function Ds(n) {
1336
- const e = new Ss(n);
1367
+ function Hs(n) {
1368
+ const e = new bs(n);
1337
1369
  return {
1338
1370
  provider: e,
1339
1371
  onReady: (s) => e.ready(s)
1340
1372
  };
1341
1373
  }
1342
- function Pe(n = {}) {
1343
- const e = he(Re);
1374
+ function Re(n = {}) {
1375
+ const e = he(ke);
1344
1376
  if (!e)
1345
1377
  throw new Error("Can not find provider");
1346
1378
  if (e.nodeEnv === "development") {
1347
1379
  const { id: t, version: s } = n;
1348
1380
  t && s && (async () => {
1349
1381
  const r = await e.getDsl(t);
1350
- r?.__VERSION__ !== s && N.warning({
1382
+ r?.__VERSION__ !== s && U.warning({
1351
1383
  title: r?.name,
1352
1384
  message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
1353
1385
  });
@@ -1355,7 +1387,7 @@ function Pe(n = {}) {
1355
1387
  }
1356
1388
  return e;
1357
1389
  }
1358
- const se = new Je({
1390
+ const ne = new Je({
1359
1391
  settings: {
1360
1392
  type: "json",
1361
1393
  validSuccess: !0,
@@ -1363,12 +1395,12 @@ const se = new Je({
1363
1395
  failMessage: !0,
1364
1396
  validate: (n) => n.data?.code === 0,
1365
1397
  showError: (n) => {
1366
- N.error({
1398
+ U.error({
1367
1399
  message: n || "未知错误"
1368
1400
  });
1369
1401
  }
1370
1402
  }
1371
- }), bs = (n = "/__vtj__/api/:type.json") => (e, t) => se.send({
1403
+ }), js = (n = "/__vtj__/api/:type.json") => (e, t) => ne.send({
1372
1404
  url: n,
1373
1405
  method: "post",
1374
1406
  params: { type: e },
@@ -1376,7 +1408,7 @@ const se = new Je({
1376
1408
  type: e,
1377
1409
  data: t
1378
1410
  }
1379
- }), 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({
1380
1412
  url: n,
1381
1413
  method: "post",
1382
1414
  data: {
@@ -1387,12 +1419,12 @@ const se = new Je({
1387
1419
  type: "data"
1388
1420
  }
1389
1421
  }).then((s) => s && s[0] ? s[0] : null).catch(() => null);
1390
- class ne {
1422
+ class re {
1391
1423
  api;
1392
1424
  pluginCaches = {};
1393
1425
  uploader;
1394
1426
  constructor() {
1395
- this.api = bs(), this.uploader = js();
1427
+ this.api = js(), this.uploader = $s();
1396
1428
  }
1397
1429
  async getExtension() {
1398
1430
  console.log("BaseService.getExtension");
@@ -1468,7 +1500,7 @@ class ne {
1468
1500
  const { urls: t = [] } = e, s = t.filter((o) => ct(o))[0];
1469
1501
  if (!s) return null;
1470
1502
  const r = this.pluginCaches[s];
1471
- return r || (this.pluginCaches[s] = se.send({
1503
+ return r || (this.pluginCaches[s] = ne.send({
1472
1504
  url: s,
1473
1505
  method: "get",
1474
1506
  settings: {
@@ -1486,17 +1518,17 @@ const v = new Ve({
1486
1518
  expired: 0,
1487
1519
  prefix: "__VTJ_"
1488
1520
  });
1489
- class Hs extends ne {
1521
+ class Os extends re {
1490
1522
  init(e) {
1491
- const t = new H(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 || {});
1492
1524
  return v.save(`project_${t.id}`, r), Promise.resolve(r);
1493
1525
  }
1494
1526
  saveProject(e) {
1495
- const t = new H(e);
1527
+ const t = new O(e);
1496
1528
  return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
1497
1529
  }
1498
1530
  saveMaterials(e, t) {
1499
- return v.save(`materials_${e.id}`, Q(t)), Promise.resolve(!0);
1531
+ return v.save(`materials_${e.id}`, X(t)), Promise.resolve(!0);
1500
1532
  }
1501
1533
  saveFile(e) {
1502
1534
  return v.save(`file_${e.id}`, e), Promise.resolve(!0);
@@ -1536,22 +1568,22 @@ class Hs extends ne {
1536
1568
  }), Promise.resolve(!0);
1537
1569
  }
1538
1570
  }
1539
- class $s extends ne {
1571
+ class Es extends re {
1540
1572
  projects = {};
1541
1573
  materials = {};
1542
1574
  files = {};
1543
1575
  histories = {};
1544
1576
  historyItems = {};
1545
1577
  init(e) {
1546
- const t = new H(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);
1547
1579
  return this.projects[r.id] = r, Promise.resolve(r);
1548
1580
  }
1549
1581
  saveProject(e) {
1550
- const t = new H(e);
1582
+ const t = new O(e);
1551
1583
  return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
1552
1584
  }
1553
1585
  saveMaterials(e, t) {
1554
- 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);
1555
1587
  }
1556
1588
  saveFile(e) {
1557
1589
  return this.files[e.id] = e, Promise.resolve(!0);
@@ -1593,11 +1625,11 @@ class $s extends ne {
1593
1625
  }), Promise.resolve(!0);
1594
1626
  }
1595
1627
  }
1596
- let I = null;
1597
- function Ms() {
1598
- return I || (I = new $s(), I);
1628
+ let D = null;
1629
+ function Bs() {
1630
+ return D || (D = new Es(), D);
1599
1631
  }
1600
- class Os extends ne {
1632
+ class Ns extends re {
1601
1633
  getFileCaches = {};
1602
1634
  async getExtension() {
1603
1635
  return await this.api("getExtension", {}).catch(() => {
@@ -1612,7 +1644,7 @@ class Os extends ne {
1612
1644
  async saveMaterials(e, t) {
1613
1645
  return !!await this.api("saveMaterials", {
1614
1646
  project: e,
1615
- materials: Q(t)
1647
+ materials: X(t)
1616
1648
  }).catch(() => !1);
1617
1649
  }
1618
1650
  async saveFile(e) {
@@ -1652,7 +1684,7 @@ class Os extends ne {
1652
1684
  );
1653
1685
  }
1654
1686
  }
1655
- function xe(n, e, t = []) {
1687
+ function Pe(n, e, t = []) {
1656
1688
  return t.map((s) => {
1657
1689
  const { id: r, title: o, icon: a, children: i, hidden: c } = s;
1658
1690
  return {
@@ -1661,39 +1693,39 @@ function xe(n, e, t = []) {
1661
1693
  icon: a,
1662
1694
  hidden: c,
1663
1695
  url: `${n}/${e}/${r}`,
1664
- children: i && i.length ? xe(n, e, i) : void 0
1696
+ children: i && i.length ? Pe(n, e, i) : void 0
1665
1697
  };
1666
1698
  });
1667
1699
  }
1668
- function ke(n, e) {
1700
+ function xe(n, e) {
1669
1701
  if (!e) return n;
1670
1702
  let t = [];
1671
1703
  for (const s of n)
1672
1704
  if (s.children && s.children.length) {
1673
- const r = ke(s.children, e);
1705
+ const r = xe(s.children, e);
1674
1706
  r.length && (s.children = r, t.push(s));
1675
1707
  } else
1676
1708
  e.can(s.id.toString()) && t.push(s);
1677
1709
  return t;
1678
1710
  }
1679
- function Bs(n) {
1711
+ function Us(n) {
1680
1712
  const {
1681
1713
  menuPathPrefix: e = "",
1682
1714
  pageRouteName: t = "page",
1683
1715
  disableMenusFilter: s = !1
1684
- } = 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;
1685
1717
  st(() => {
1686
1718
  const { name: p, params: h, meta: m } = o;
1687
- if (p === C) {
1719
+ if (p === F) {
1688
1720
  const d = r.getPage(h.id);
1689
1721
  i.value = !d?.mask, c.value = !!d?.pure;
1690
- } else if (p === D) {
1722
+ } else if (p === H) {
1691
1723
  const d = r.getHomepage();
1692
1724
  i.value = !d?.mask, c.value = !!d?.pure;
1693
1725
  } else
1694
1726
  i.value = !m.mask, c.value = !!m.pure;
1695
1727
  });
1696
- const f = xe(
1728
+ const f = Pe(
1697
1729
  e,
1698
1730
  t,
1699
1731
  l?.pages
@@ -1703,71 +1735,72 @@ function Bs(n) {
1703
1735
  logo: u?.logo,
1704
1736
  themeSwitchable: u?.themeSwitchable,
1705
1737
  title: u?.title || l?.description || l?.name || "VTJ App",
1706
- menus: s ? f : ke(f, a),
1738
+ menus: s ? f : xe(f, a),
1707
1739
  pure: c
1708
1740
  };
1709
1741
  }
1710
1742
  export {
1711
1743
  be as ACCESS_KEY,
1712
- Is as Access,
1744
+ Ds as Access,
1713
1745
  at as BUILD_IN_TAGS,
1714
1746
  rt as BUILT_IN_DIRECTIVES,
1715
- ne as BaseService,
1716
- le as CONTEXT_HOST,
1747
+ re as BaseService,
1748
+ ue as CONTEXT_HOST,
1717
1749
  Pt as Context,
1718
1750
  y as ContextMode,
1719
1751
  ot as DATA_TYPES,
1720
- D as HOMEPAGE_ROUTE_NAME,
1752
+ H as HOMEPAGE_ROUTE_NAME,
1721
1753
  it as HTML_TAGS,
1722
- Ts as JSCodeToString,
1723
- Cs as LIFE_CYCLES_LIST,
1724
- Os as LocalService,
1725
- $s as MemoryService,
1726
- ws as NodeEnv,
1727
- C as PAGE_ROUTE_NAME,
1728
- Ss as Provider,
1729
- ys as Startup,
1730
- Hs as StorageService,
1731
- 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,
1732
1764
  we as adoptedStyleSheets,
1733
- Fs as createAssetScripts,
1734
- As as createAssetsCss,
1735
- It as createDataSources,
1736
- Y as createLoader,
1737
- Ms as createMemoryService,
1765
+ As as createAssetScripts,
1766
+ Is as createAssetsCss,
1767
+ Mt as createDataSources,
1768
+ Q as createLoader,
1769
+ Bs as createMemoryService,
1738
1770
  St as createMetaApi,
1739
- Ds as createProvider,
1740
- G as createRenderer,
1771
+ $t as createMock,
1772
+ Hs as createProvider,
1773
+ Y as createRenderer,
1741
1774
  wt as createSchemaApi,
1742
1775
  bt as createSchemaApis,
1743
- Mt as defaultLoader,
1744
- T as fillBasePath,
1776
+ Ot as defaultLoader,
1777
+ M as fillBasePath,
1745
1778
  $e as getModifiers,
1746
1779
  je as getPlugin,
1747
1780
  pt as getRawComponent,
1748
1781
  gt as isBuiltInTag,
1749
- Z as isCSSUrl,
1782
+ ee as isCSSUrl,
1750
1783
  yt as isJSCode,
1751
1784
  _ as isJSExpression,
1752
- U as isJSFunction,
1785
+ I as isJSFunction,
1753
1786
  ct as isJSON,
1754
- ee as isJSUrl,
1787
+ te as isJSUrl,
1755
1788
  vt as isNativeTag,
1756
1789
  mt as isVuePlugin,
1757
1790
  dt as loadCss,
1758
1791
  ft as loadCssUrl,
1759
1792
  ht as loadScriptUrl,
1760
- $t as mockApi,
1793
+ Et as mockApi,
1761
1794
  jt as mockApis,
1762
1795
  Se as mockCleanup,
1763
- O as nodeRender,
1796
+ B as nodeRender,
1764
1797
  ut as parseDeps,
1765
1798
  A as parseExpression,
1766
- ue as parseFunction,
1767
- Re as providerKey,
1799
+ G as parseFunction,
1800
+ ke as providerKey,
1768
1801
  lt as removeProdFlag,
1769
1802
  _e as toString,
1770
1803
  Rt as useAccess,
1771
- Bs as useMask,
1772
- Pe as useProvider
1804
+ Us as useMask,
1805
+ Re as useProvider
1773
1806
  };