@vtj/renderer 0.9.0-alpha.4 → 0.9.0-alpha.41

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,19 @@
1
- import { Base as xe, BUILT_IN_COMPONENTS as Re, ProjectModel as A, HistoryModel as ce } from "@vtj/core";
2
- import { isUrl as ke, url as x, dedupArray as Ce, isString as j, isFunction as ee, logger as I, createRequest as Fe, merge as Ae, pathToRegexp as Ie, pathToRegexpMatch as Oe, formDataToJson as De, storage as B, cookie as U, toArray as te, unRSA as se, delay as le, camelCase as $, upperFirst as Me, pick as Te, jsonp as He, loadScript as ne, Request as Be, Storage as Ue, mapToObject as z } from "@vtj/utils";
3
- import * as M from "vue";
4
- import { inject as ue, toRef as Ne, readonly as Le, customRef as qe, ref as O, onBeforeUnmount as Je, getCurrentScope as Ve, onScopeDispose as ze, unref as Ke, getCurrentInstance as de, watch as pe, computed as fe, onMounted as We, defineComponent as K, h as q, openBlock as Ge, createElementBlock as Ye, createElementVNode as b, toDisplayString as N, defineAsyncComponent as re, watchEffect as Qe } from "vue";
5
- import { ElNotification as T, ElLoading as Xe } from "element-plus";
6
- import { useRoute as he } from "vue-router";
1
+ import { Base as Re, BUILT_IN_COMPONENTS as xe, ProjectModel as M, HistoryModel as le } from "@vtj/core";
2
+ import { isUrl as ke, url as R, dedupArray as Ce, isString as j, isFunction as V, logger as T, createRequest as Fe, merge as Ae, pathToRegexp as Ie, pathToRegexpMatch as Oe, formDataToJson as Me, storage as U, cookie as L, toArray as se, unRSA as ne, delay as ue, camelCase as $, upperFirst as Te, pick as De, jsonp as He, loadScript as re, Request as Be, Storage as Ne, mapToObject as G } from "@vtj/utils";
3
+ import * as H from "vue";
4
+ import { inject as de, toRef as Ue, readonly as Le, customRef as qe, ref as C, onBeforeUnmount as Je, getCurrentScope as Ve, onScopeDispose as ze, unref as Ke, getCurrentInstance as pe, watch as fe, computed as he, onMounted as We, defineComponent as Y, h as z, openBlock as Ge, createElementBlock as Ye, createElementVNode as b, toDisplayString as q, defineAsyncComponent as oe, watchEffect as Qe } from "vue";
5
+ import { ElNotification as B, ElLoading as Xe } from "element-plus";
6
+ import { useRoute as me } from "vue-router";
7
7
  /**!
8
8
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
9
9
  * @name @vtj/renderer
10
10
  * @author CHC chenhuachun1549@dingtalk.com
11
- * @version 0.9.0-alpha.4
11
+ * @version 0.9.0-alpha.41
12
12
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
13
13
  */
14
- const R = "0.9.0-alpha.4";
14
+ const x = "0.9.0-alpha.41";
15
15
  var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
16
- const oe = [
16
+ const ie = [
17
17
  "$el",
18
18
  "$emit",
19
19
  "$nextTick",
@@ -47,14 +47,14 @@ const oe = [
47
47
  Object,
48
48
  Function,
49
49
  Date
50
- }, W = "VtjPage", me = "VtjHomepage";
51
- function C(n, e) {
50
+ }, k = "VtjPage", O = "VtjHomepage";
51
+ function A(n, e) {
52
52
  return n.map((t) => ke(t) || t.startsWith("/") ? t : `${e}${t}`);
53
53
  }
54
- function G(n) {
54
+ function Q(n) {
55
55
  return /\.css$/.test(n);
56
56
  }
57
- function Y(n) {
57
+ function X(n) {
58
58
  return /\.js$/.test(n);
59
59
  }
60
60
  function tt(n) {
@@ -62,34 +62,34 @@ function tt(n) {
62
62
  }
63
63
  function ws(n) {
64
64
  return n.map(
65
- (e) => `<script src="${x.append(e, { v: R })}"><\/script>`
65
+ (e) => `<script src="${R.append(e, { v: x })}"><\/script>`
66
66
  ).join("");
67
67
  }
68
68
  function Ss(n = []) {
69
69
  return n.map(
70
- (e) => `<link rel="stylesheet" href="${x.append(e, { v: R })}" />`
70
+ (e) => `<link rel="stylesheet" href="${R.append(e, { v: x })}" />`
71
71
  ).join("");
72
72
  }
73
73
  function st(n, e = !1) {
74
74
  return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
75
75
  }
76
76
  function nt(n, e, t = !1) {
77
- const s = n.filter((u) => !!u.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], d = {};
77
+ const s = n.filter((d) => !!d.enabled), r = [], o = [], a = [], i = [], l = {}, c = {}, f = [], u = {};
78
78
  return s.forEach(
79
- ({ urls: u, assetsUrl: m, library: p, assetsLibrary: h, localeLibrary: w }) => {
80
- u?.forEach((g) => {
81
- Y(g) && r.push(st(g, t)), G(g) && o.push(g);
82
- }), p && (i.push(p), c[p] = C(u || [], e), w && (l[p] = w)), m && a.push(m), h && f.push(h), p && h && (d[h] = p);
79
+ ({ urls: d, assetsUrl: m, library: p, assetsLibrary: h, localeLibrary: w }) => {
80
+ d?.forEach((g) => {
81
+ X(g) && r.push(st(g, t)), Q(g) && o.push(g);
82
+ }), p && (i.push(p), l[p] = A(d || [], e), w && (c[p] = w)), m && a.push(m), h && f.push(h), p && h && (u[h] = p);
83
83
  }
84
84
  ), {
85
- scripts: C(r, e),
86
- css: C(o, e),
87
- materials: C(a, e),
85
+ scripts: A(r, e),
86
+ css: A(o, e),
87
+ materials: A(a, e),
88
88
  libraryExports: i,
89
89
  materialExports: Ce(f),
90
- materialMapLibrary: d,
91
- libraryMap: c,
92
- libraryLocaleMap: l
90
+ materialMapLibrary: u,
91
+ libraryMap: l,
92
+ libraryLocaleMap: c
93
93
  };
94
94
  }
95
95
  function rt(n, e) {
@@ -105,7 +105,7 @@ function ve(n, e, t) {
105
105
  const r = new s();
106
106
  r.id = e, r.replaceSync(t);
107
107
  const o = n.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
108
- (c) => c.id !== e
108
+ (l) => l.id !== e
109
109
  );
110
110
  o.adoptedStyleSheets = [...i, r];
111
111
  } else {
@@ -130,36 +130,36 @@ async function at(n, e, t = window) {
130
130
  const s = t.document, r = t.document.head;
131
131
  let o = t[e];
132
132
  return o ? o.default || o : new Promise((a, i) => {
133
- for (const c of n) {
134
- const l = s.createElement("script");
135
- l.src = c, l.onload = () => {
133
+ for (const l of n) {
134
+ const c = s.createElement("script");
135
+ c.src = l, c.onload = () => {
136
136
  o = t[e], o ? a(o.default || o) : i(null);
137
- }, l.onerror = (f) => {
137
+ }, c.onerror = (f) => {
138
138
  i(f);
139
- }, r.appendChild(l);
139
+ }, r.appendChild(c);
140
140
  }
141
141
  });
142
142
  }
143
143
  function ct(n) {
144
- return ee(n) || ee(n?.install);
144
+ return V(n) || V(n?.install);
145
145
  }
146
- function k(n, e, t = !1, s = !1) {
146
+ function F(n, e, t = !1, s = !1) {
147
147
  try {
148
148
  const r = ['"use strict";', "var __self = arguments[0];"];
149
149
  r.push("return ");
150
150
  let o = (n.value || "").trim();
151
- o = o.replace(/this(\W|$)/g, (i, c) => `__self${c}`), o = r.join(`
151
+ o = o.replace(/this(\W|$)/g, (i, l) => `__self${l}`), o = r.join(`
152
152
  `) + o;
153
153
  const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
154
154
  return new Function("$scope", a)(e);
155
155
  } catch (r) {
156
- if (I.error("parseExpression.error", r, n, e?.__self ?? e), s)
156
+ if (T.error("parseExpression.error", r, n, e?.__self ?? e), s)
157
157
  throw r;
158
158
  }
159
159
  }
160
- function ie(n, e, t = !1, s = !1) {
161
- const r = k(n, e, t, s);
162
- if (typeof r != "function" && (I.error(
160
+ function ae(n, e, t = !1, s = !1) {
161
+ const r = F(n, e, t, s);
162
+ if (typeof r != "function" && (T.error(
163
163
  "parseFunction.error",
164
164
  "not a function",
165
165
  n,
@@ -171,11 +171,11 @@ function ie(n, e, t = !1, s = !1) {
171
171
  function S(n) {
172
172
  return n && n.type === "JSExpression";
173
173
  }
174
- function H(n) {
174
+ function N(n) {
175
175
  return typeof n == "object" && n && n.type === "JSFunction";
176
176
  }
177
177
  function lt(n) {
178
- return S(n) || H(n);
178
+ return S(n) || N(n);
179
179
  }
180
180
  function js(n) {
181
181
  return lt(n) ? n.value : JSON.stringify(n);
@@ -190,7 +190,7 @@ const ut = Fe({
190
190
  validate: (n) => n.data?.code === 0 || !!n.data?.success,
191
191
  failMessage: !0,
192
192
  showError: (n) => {
193
- T.error({
193
+ B.error({
194
194
  message: n || "未知错误"
195
195
  });
196
196
  },
@@ -215,7 +215,7 @@ function dt(n, e) {
215
215
  query: r
216
216
  });
217
217
  {
218
- const r = n.headers ? k(n.headers, {}, !0) : void 0, o = {
218
+ const r = n.headers ? F(n.headers, {}, !0) : void 0, o = {
219
219
  url: n.url,
220
220
  method: n.method,
221
221
  settings: {
@@ -255,10 +255,10 @@ function mt(n, e) {
255
255
  if (!e.mock) return;
256
256
  const { url: t, mockTemplate: s } = e;
257
257
  if (t && s) {
258
- const r = Ie(`${t}(.*)`), o = Oe(t, { decode: decodeURIComponent }), a = k(s, {}, !0);
258
+ const r = Ie(`${t}(.*)`), o = Oe(t, { decode: decodeURIComponent }), a = F(s, {}, !0);
259
259
  n.mock(r, (i) => {
260
- const c = x.parse(i.url) || {}, l = i.body instanceof FormData ? De(i.body) : i.body, f = o(i.url)?.params;
261
- return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
260
+ const l = R.parse(i.url) || {}, c = i.body instanceof FormData ? Me(i.body) : i.body, f = o(i.url)?.params;
261
+ return Object.assign(i, { data: c, params: l, query: f }), n.mock(a(i));
262
262
  });
263
263
  }
264
264
  }
@@ -270,12 +270,13 @@ const gt = {
270
270
  authKey: "Authorization",
271
271
  storageKey: "ACCESS_STORAGE",
272
272
  storagePrefix: "__VTJ_",
273
- unauthorized: "/unauthorized",
273
+ unauthorized: void 0,
274
274
  auth: "/#/login",
275
275
  redirectParam: "r",
276
276
  unauthorizedCode: 401,
277
277
  unauthorizedMessage: "登录已经失效,请重新登录!",
278
- noPermissionMessage: "无权限访问该页面"
278
+ noPermissionMessage: "无权限访问该页面",
279
+ appName: ""
279
280
  }, _e = Symbol("access");
280
281
  class $s {
281
282
  options;
@@ -286,38 +287,38 @@ class $s {
286
287
  }
287
288
  connect(e) {
288
289
  const { mode: t, router: s, request: r } = e;
289
- this.mode = t, s && t === _.Raw && this.setGuard(s), r && this.setRequest(r);
290
+ this.mode = t, s && this.mode === _.Raw && this.setGuard(s), r && this.setRequest(r);
290
291
  }
291
292
  login(e) {
292
293
  const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
293
- this.setData(e), this.data && (B.save(t, e, {
294
+ this.setData(e), this.data && (U.save(t, e, {
294
295
  type: "local",
295
296
  prefix: s
296
- }), r && U.set(o, this.data.token));
297
+ }), r && L.set(o, this.data.token));
297
298
  }
298
299
  clear() {
299
300
  const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
300
- this.data = null, B.remove(e, {
301
+ this.data = null, U.remove(e, {
301
302
  type: "local",
302
303
  prefix: t
303
- }), s && U.remove(r);
304
+ }), s && L.remove(r);
304
305
  }
305
306
  logout() {
306
307
  this.clear(), this.toLogin();
307
308
  }
308
309
  getData() {
309
- return this.data;
310
+ return this.data ? this.data : (this.loadData(), this.data);
310
311
  }
311
312
  getToken() {
312
- return this.data?.token;
313
+ return this.data || this.loadData(), this.data?.token;
313
314
  }
314
315
  can(e) {
315
- const { permissions: t = {} } = this.data || {};
316
- return typeof e == "function" ? e(t) : te(e).every((r) => t[r]);
316
+ const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
317
+ return typeof e == "function" ? e(s) : se(e).every((o) => s[o] || s[t + "." + o]);
317
318
  }
318
319
  some(e) {
319
- const { permissions: t = {} } = this.data || {};
320
- return te(e).some((r) => t[r]);
320
+ const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
321
+ return se(e).some((o) => s[o] || s[t + "." + o]);
321
322
  }
322
323
  install(e) {
323
324
  e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(_e, this);
@@ -334,20 +335,20 @@ class $s {
334
335
  }
335
336
  toLogin() {
336
337
  const { auth: e, redirectParam: t } = this.options;
337
- if (!e || this.mode !== _.Raw) return;
338
+ if (!e) return;
338
339
  const s = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
339
340
  typeof e == "function" ? e(s) : location.href = t ? `${e}${s}` : e;
340
341
  }
341
342
  setData(e) {
342
343
  const { privateKey: t } = this.options;
343
344
  if (Array.isArray(e) && t) {
344
- const s = e.map((r) => se(r, t));
345
+ const s = e.map((r) => ne(r, t));
345
346
  this.data = JSON.parse(s.join(""));
346
347
  return;
347
348
  }
348
349
  if (typeof e == "string")
349
350
  try {
350
- const s = t ? se(e, t) : e;
351
+ const s = t ? ne(e, t) : e;
351
352
  s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
352
353
  } catch (s) {
353
354
  console.warn(s);
@@ -356,18 +357,18 @@ class $s {
356
357
  this.data = e;
357
358
  }
358
359
  loadData() {
359
- const { storageKey: e, storagePrefix: t } = this.options, s = B.get(e, {
360
+ const { storageKey: e, storagePrefix: t } = this.options, s = U.get(e, {
360
361
  type: "local",
361
362
  prefix: t
362
363
  });
363
- this.setData(s);
364
+ this.setData(s || null);
364
365
  }
365
366
  isLogined() {
366
367
  const { session: e, authKey: t } = this.options;
367
- return e && t ? !!U.get(t) : !!this.data;
368
+ return e && t ? !!L.get(t) : !!this.getToken();
368
369
  }
369
370
  hasRoutePermission(e) {
370
- if (e.name === W) {
371
+ if (e.name === k) {
371
372
  const t = e.params.id;
372
373
  return t && this.can(t);
373
374
  }
@@ -383,8 +384,8 @@ class $s {
383
384
  if (this.hasRoutePermission(e))
384
385
  return t();
385
386
  {
386
- const s = this.options.noPermissionMessage || "无权限访问";
387
- return this.showTip(s), t(!1);
387
+ const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
388
+ return this.showTip(s), V(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
388
389
  }
389
390
  }
390
391
  t(!1), this.toLogin();
@@ -403,10 +404,10 @@ class $s {
403
404
  }
404
405
  async showTip(e) {
405
406
  const { alert: t } = this.options;
406
- t && (await le(150), await t(e, {
407
+ return t ? (await ue(150), await t(e, {
407
408
  title: "提示",
408
409
  type: "warning"
409
- }).catch((s) => s));
410
+ }).catch(() => !1)) : !1;
410
411
  }
411
412
  setRequest(e) {
412
413
  e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
@@ -419,7 +420,7 @@ class $s {
419
420
  }
420
421
  }
421
422
  function vt() {
422
- return ue(_e, null);
423
+ return de(_e, null);
423
424
  }
424
425
  class yt {
425
426
  __id = null;
@@ -450,7 +451,7 @@ class yt {
450
451
  const { mode: t, dsl: s, attrs: r } = e;
451
452
  this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
452
453
  }
453
- setup(e, t = M) {
454
+ setup(e, t = H) {
454
455
  const s = t.getCurrentInstance();
455
456
  if (!s) return;
456
457
  this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
@@ -464,12 +465,12 @@ class yt {
464
465
  });
465
466
  }
466
467
  __proxy() {
467
- this.__instance && oe.forEach((e) => {
468
+ this.__instance && ie.forEach((e) => {
468
469
  this[e] = this.__instance?.[e];
469
470
  });
470
471
  }
471
472
  __cleanup() {
472
- oe.forEach((e) => {
473
+ ie.forEach((e) => {
473
474
  this[e] = null;
474
475
  });
475
476
  }
@@ -477,22 +478,22 @@ class yt {
477
478
  if (e)
478
479
  if (this.__mode === _.Runtime) {
479
480
  const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
480
- return ie({ type: s, value: r }, this);
481
+ return ae({ type: s, value: r }, this);
481
482
  } else
482
- return ie(e, this);
483
+ return ae(e, this);
483
484
  }
484
485
  __parseExpression(e) {
485
486
  if (e)
486
487
  if (this.__mode === _.Runtime) {
487
488
  const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
488
- return k({ type: s, value: r }, this);
489
+ return F({ type: s, value: r }, this);
489
490
  } else
490
- return k(e, this);
491
+ return F(e, this);
491
492
  }
492
493
  __ref(e = null, t) {
493
494
  if (this.__mode !== _.VNode)
494
495
  return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
495
- await le(0);
496
+ await ue(0);
496
497
  let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
497
498
  if (!r) {
498
499
  typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
@@ -519,58 +520,58 @@ class yt {
519
520
  return s.context.__proto__ = this.context, s.__proto__ = this, s;
520
521
  }
521
522
  }
522
- function J(n) {
523
+ function K(n) {
523
524
  const {
524
- Vue: e = M,
525
+ Vue: e = H,
525
526
  mode: t = _.Runtime,
526
527
  components: s = {},
527
528
  libs: r = {},
528
529
  apis: o = {},
529
530
  loader: a
530
- } = n, i = e.computed(() => n.dsl), c = {
531
+ } = n, i = e.computed(() => n.dsl), l = {
531
532
  $components: s,
532
533
  $libs: r,
533
534
  $apis: o
534
- }, l = new yt({
535
+ }, c = new yt({
535
536
  mode: t,
536
537
  dsl: i.value,
537
- attrs: c
538
+ attrs: l
538
539
  }), f = e.defineComponent({
539
540
  name: i.value.name,
540
541
  props: {
541
- ...wt(i.value.props ?? [], l)
542
+ ...wt(i.value.props ?? [], c)
542
543
  },
543
- setup(d) {
544
- l.$props = d, l.props = d, i.value.id && ve(
544
+ setup(u) {
545
+ c.$props = u, c.props = u, i.value.id && ve(
545
546
  n.window || window,
546
547
  i.value.id,
547
548
  i.value.css || ""
548
- ), l.state = St(e, i.value.state ?? {}, l);
549
- const u = jt(e, i.value.computed ?? {}, l), m = $t(i.value.methods ?? {}, l), p = bt(e, i.value.inject, l), h = Et(
549
+ ), c.state = St(e, i.value.state ?? {}, c);
550
+ const d = jt(e, i.value.computed ?? {}, c), m = $t(i.value.methods ?? {}, c), p = bt(e, i.value.inject, c), h = Et(
550
551
  i.value.dataSources || {},
551
- l
552
+ c
552
553
  ), w = {
553
554
  ...p,
554
- ...u,
555
+ ...d,
555
556
  ...m,
556
557
  ...h
557
558
  };
558
- return l.setup(w, e), Pt(e, i.value.watch ?? [], l), {
559
- vtj: l
559
+ return c.setup(w, e), Pt(e, i.value.watch ?? [], c), {
560
+ vtj: c
560
561
  };
561
562
  },
562
563
  emits: _t(i.value.emits),
563
564
  expose: ["vtj"],
564
565
  render() {
565
566
  if (!i.value.nodes) return null;
566
- const d = i.value.nodes || [];
567
- return d.length === 1 ? D(d[0], l, e, a) : d.map((u) => D(u, l, e, a));
567
+ const u = i.value.nodes || [];
568
+ return u.length === 1 ? D(u[0], c, e, a) : u.map((d) => D(d, c, e, a));
568
569
  },
569
- ...xt(i.value.lifeCycles ?? {}, l)
570
+ ...Rt(i.value.lifeCycles ?? {}, c)
570
571
  });
571
572
  return {
572
573
  renderer: e.markRaw(f),
573
- context: l
574
+ context: c
574
575
  };
575
576
  }
576
577
  function _t(n = []) {
@@ -599,7 +600,7 @@ function St(n, e, t) {
599
600
  Object.keys(e || {}).reduce(
600
601
  (s, r) => {
601
602
  let o = e[r];
602
- return S(o) ? o = t.__parseExpression(o) : H(o) && (o = t.__parseFunction(o)), s[r] = o, s;
603
+ return S(o) ? o = t.__parseExpression(o) : N(o) && (o = t.__parseFunction(o)), s[r] = o, s;
603
604
  },
604
605
  {}
605
606
  )
@@ -622,8 +623,8 @@ function bt(n, e = [], t) {
622
623
  (s, r) => {
623
624
  const { name: o, from: a } = r || {};
624
625
  r.default;
625
- const i = S(a) ? t.__parseExpression(a) || o : a ?? o, c = S(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
626
- return s[o] = n.inject(i, c), s;
626
+ const i = S(a) ? t.__parseExpression(a) || o : a ?? o, l = S(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
627
+ return s[o] = n.inject(i, l), s;
627
628
  },
628
629
  {}
629
630
  );
@@ -631,10 +632,10 @@ function bt(n, e = [], t) {
631
632
  function Et(n, e) {
632
633
  return Object.keys(n).reduce(
633
634
  (t, s) => {
634
- const r = n[s], o = e.$apis[r.ref], a = H(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
635
+ const r = n[s], o = e.$apis[r.ref], a = N(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
635
636
  return t[s] = async (...i) => {
636
- const c = await o.apply(e, i);
637
- return a ? a(c) : c;
637
+ const l = await o.apply(e, i);
638
+ return a ? a(l) : l;
638
639
  }, t;
639
640
  },
640
641
  {}
@@ -652,80 +653,80 @@ function Pt(n, e = [], t) {
652
653
  );
653
654
  });
654
655
  }
655
- function xt(n, e) {
656
+ function Rt(n, e) {
656
657
  return Object.entries(n ?? {}).reduce(
657
658
  (t, [s, r]) => (t[s] = e.__parseFunction(r), t),
658
659
  {}
659
660
  );
660
661
  }
661
- let L = [];
662
- const Rt = (n) => n;
662
+ let J = [];
663
+ const xt = (n) => n;
663
664
  async function we(n, e = window) {
664
- const { urls: t = [], library: s } = n, r = t.filter((i) => Y(i));
665
+ const { urls: t = [], library: s } = n, r = t.filter((i) => X(i));
665
666
  if (r.length === 0 || !s) return null;
666
- const o = t.filter((i) => G(i));
667
+ const o = t.filter((i) => Q(i));
667
668
  return o.length && it(o, e), await at(r, s, e).catch(
668
669
  (i) => (console.warn("loadScriptUrl error", r, s, i), null)
669
670
  );
670
671
  }
671
- function V(n) {
672
+ function W(n) {
672
673
  const { getDsl: e, getDslByUrl: t, options: s } = n;
673
- return s.window && (L.forEach((r) => {
674
+ return s.window && (J.forEach((r) => {
674
675
  delete s.window[r];
675
- }), L = []), (r, o, a = M) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
676
+ }), J = []), (r, o, a = H) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
676
677
  const i = await e(o.id);
677
- return i && (i.name = r), i ? J({
678
+ return i && (i.name = r), i ? K({
678
679
  ...s,
679
680
  Vue: a,
680
681
  dsl: i,
681
682
  mode: _.Runtime,
682
- loader: V(n)
683
+ loader: W(n)
683
684
  }).renderer : null;
684
685
  }) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
685
686
  const i = await t(o.url);
686
- return i && (i.name = r), i ? J({
687
+ return i && (i.name = r), i ? K({
687
688
  ...s,
688
689
  Vue: a,
689
690
  dsl: i,
690
691
  mode: _.Runtime,
691
- loader: V(n)
692
+ loader: W(n)
692
693
  }).renderer : null;
693
- }) : o.type === "Plugin" ? (o.library && L.push(o.library), a.defineAsyncComponent(async () => {
694
+ }) : o.type === "Plugin" ? (o.library && J.push(o.library), a.defineAsyncComponent(async () => {
694
695
  const i = await we(o, s.window);
695
696
  return i || (console.warn("getPlugin result is null", o), null);
696
697
  })) : r;
697
698
  }
698
- function D(n, e, t = M, s = Rt) {
699
+ function D(n, e, t = H, s = xt) {
699
700
  if (!n || !n.name || n.invisible) return null;
700
- const { id: r = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: c, vModels: l, vBind: f } = kt(o);
701
+ const { id: r = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: f } = kt(o);
701
702
  if (a && !Ct(a, e))
702
703
  return null;
703
- const d = (u) => {
704
- const m = u.$components, p = (() => {
704
+ const u = (d) => {
705
+ const m = d.$components, p = (() => {
705
706
  if (n.name === "component")
706
- return Ft(u, n.props?.is);
707
+ return Ft(d, n.props?.is);
707
708
  if (n.name === "slot") return n.name;
708
709
  const v = s(n.name, n.from, t);
709
710
  return j(v) ? m[v] ?? v : v;
710
- })(), h = At(r, n.props ?? {}, u), w = It(t, n.events ?? {}, u);
711
+ })(), h = At(r, n.props ?? {}, d), w = It(t, n.events ?? {}, d);
711
712
  if (n.name === "slot")
712
- return Ot(t, n, h, u, s);
713
- f && Object.assign(h, u.__parseExpression(f.value)), c && (h.style = Object.assign(
713
+ return Ot(t, n, h, d, s);
714
+ f && Object.assign(h, d.__parseExpression(f.value)), l && (h.style = Object.assign(
714
715
  h.style ?? {},
715
- Mt(c, u)
716
- )), l.forEach((v) => {
717
- Object.assign(h, Tt(t, v, u));
716
+ Tt(l, d)
717
+ )), c.forEach((v) => {
718
+ Object.assign(h, Dt(t, v, d));
718
719
  });
719
720
  const g = Ht(
720
721
  t,
721
722
  n.children ?? [],
722
- u,
723
+ d,
723
724
  s,
724
725
  n
725
726
  );
726
727
  return t.createVNode(p, { ...h, ...w }, g);
727
728
  };
728
- return i ? Nt(i, d, e) : d(e);
729
+ return i ? Ut(i, u, e) : u(e);
729
730
  }
730
731
  function kt(n = []) {
731
732
  const e = n.find((i) => $(i.name) === "vIf"), t = n.find((i) => $(i.name) === "vFor"), s = n.find((i) => $(i.name) === "vShow"), r = n.find((i) => $(i.name) === "vBind"), o = n.filter((i) => $(i.name) === "vModel"), a = n.filter(
@@ -750,7 +751,7 @@ function At(n, e, t) {
750
751
  const s = Object.keys(e || {}).reduce(
751
752
  (r, o) => {
752
753
  let a = e[o];
753
- return S(a) ? a = t.__parseExpression(a) : H(a) && (a = t.__parseFunction(a)), r[o] = a, r;
754
+ return S(a) ? a = t.__parseExpression(a) : N(a) && (a = t.__parseFunction(a)), r[o] = a, r;
754
755
  },
755
756
  {}
756
757
  );
@@ -764,8 +765,8 @@ function It(n, e, t) {
764
765
  };
765
766
  return Object.keys(e || {}).reduce(
766
767
  (o, a) => {
767
- const i = e[a], c = Se(i.modifiers), l = c.find((u) => s.includes(u)), f = "on" + Me(a) + (l && r[l] || ""), d = t.__parseFunction(i.handler);
768
- return d && (o[f] = n.withModifiers(d, c)), o;
768
+ const i = e[a], l = Se(i.modifiers), c = l.find((d) => s.includes(d)), f = "on" + Te(a) + (c && r[c] || ""), u = t.__parseFunction(i.handler);
769
+ return u && (o[f] = n.withModifiers(u, l)), o;
769
770
  },
770
771
  {}
771
772
  );
@@ -775,26 +776,26 @@ function Se(n = {}, e = !1) {
775
776
  return e ? t.map((s) => "." + s) : t;
776
777
  }
777
778
  function Ot(n, e, t, s, r) {
778
- const { children: o } = e, a = Dt(e, s), i = s.$slots?.[a.name];
779
+ const { children: o } = e, a = Mt(e, s), i = s.$slots?.[a.name];
779
780
  return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : S(o) ? n.createTextVNode(
780
781
  ge(s.__parseExpression(o))
781
782
  ) : Array.isArray(o) ? o.map(
782
- (c) => D(c, s, n, r)
783
+ (l) => D(l, s, n, r)
783
784
  ) : null : null;
784
785
  }
785
- function Dt(n, e) {
786
+ function Mt(n, e) {
786
787
  const { props: t } = n, s = t?.name || "default";
787
788
  return {
788
789
  name: S(s) ? e.__parseExpression(s) : s,
789
790
  params: []
790
791
  };
791
792
  }
792
- function Mt(n, e) {
793
+ function Tt(n, e) {
793
794
  return e.__parseExpression(n.value) ? {} : {
794
795
  display: "none"
795
796
  };
796
797
  }
797
- function Tt(n, e, t) {
798
+ function Dt(n, e, t) {
798
799
  const s = {
799
800
  type: "JSFunction",
800
801
  value: e.value?.value ? `(v) => {
@@ -818,10 +819,10 @@ function Ht(n, e, t, s, r) {
818
819
  const o = Bt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
819
820
  [`scope_${r.id}`]: i
820
821
  } : {};
821
- return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (d) => {
822
- const u = f.length ? Te(d ?? {}, f) : a(d);
823
- return l.map(
824
- (m) => D(m, t.__clone(u), n, s)
822
+ return Object.entries(o).reduce((i, [l, { nodes: c, params: f }]) => (i[l] = (u) => {
823
+ const d = f.length ? De(u ?? {}, f) : a(u);
824
+ return c.map(
825
+ (m) => D(m, t.__clone(d), n, s)
825
826
  );
826
827
  }, i), {});
827
828
  }
@@ -835,7 +836,7 @@ function Bt(n) {
835
836
  }
836
837
  };
837
838
  for (const t of n) {
838
- const s = Ut(t.slot), r = s.name;
839
+ const s = Nt(t.slot), r = s.name;
839
840
  e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
840
841
  nodes: [t],
841
842
  params: s.params
@@ -843,18 +844,18 @@ function Bt(n) {
843
844
  }
844
845
  return e;
845
846
  }
846
- function Ut(n = "default") {
847
+ function Nt(n = "default") {
847
848
  return j(n) ? { name: n, params: [] } : { params: [], ...n };
848
849
  }
849
- function Nt(n, e, t) {
850
+ function Ut(n, e, t) {
850
851
  const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
851
852
  let i = t.__parseExpression(s) || [];
852
- 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`), []);
853
+ return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
853
854
  }
854
855
  function Lt(n) {
855
856
  return Ve() ? (ze(n), !0) : !1;
856
857
  }
857
- function Q(n) {
858
+ function Z(n) {
858
859
  return typeof n == "function" ? n() : Ke(n);
859
860
  }
860
861
  const je = typeof window < "u" && typeof document < "u";
@@ -862,13 +863,13 @@ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
862
863
  const qt = (n) => n != null, Jt = () => {
863
864
  };
864
865
  function Vt(n) {
865
- return de();
866
+ return pe();
866
867
  }
867
868
  function zt(...n) {
868
869
  if (n.length !== 1)
869
- return Ne(...n);
870
+ return Ue(...n);
870
871
  const e = n[0];
871
- return typeof e == "function" ? Le(qe(() => ({ get: e, set: Jt }))) : O(e);
872
+ return typeof e == "function" ? Le(qe(() => ({ get: e, set: Jt }))) : C(e);
872
873
  }
873
874
  function Kt(n, e) {
874
875
  Vt() && Je(n, e);
@@ -876,39 +877,39 @@ function Kt(n, e) {
876
877
  const Wt = je ? window : void 0, Gt = je ? window.document : void 0;
877
878
  function Yt(n) {
878
879
  var e;
879
- const t = Q(n);
880
+ const t = Z(n);
880
881
  return (e = t?.$el) != null ? e : t;
881
882
  }
882
883
  function Qt() {
883
- const n = O(!1), e = de();
884
+ const n = C(!1), e = pe();
884
885
  return e && We(() => {
885
886
  n.value = !0;
886
887
  }, e), n;
887
888
  }
888
889
  function Xt(n) {
889
890
  const e = Qt();
890
- return fe(() => (e.value, !!n()));
891
+ return he(() => (e.value, !!n()));
891
892
  }
892
893
  function Zt(n, e, t = {}) {
893
894
  const { window: s = Wt, ...r } = t;
894
895
  let o;
895
896
  const a = Xt(() => s && "MutationObserver" in s), i = () => {
896
897
  o && (o.disconnect(), o = void 0);
897
- }, c = fe(() => {
898
- const u = Q(n), m = (Array.isArray(u) ? u : [u]).map(Yt).filter(qt);
898
+ }, l = he(() => {
899
+ const d = Z(n), m = (Array.isArray(d) ? d : [d]).map(Yt).filter(qt);
899
900
  return new Set(m);
900
- }), l = pe(
901
- () => c.value,
902
- (u) => {
903
- i(), a.value && u.size && (o = new MutationObserver(e), u.forEach((m) => o.observe(m, r)));
901
+ }), c = fe(
902
+ () => l.value,
903
+ (d) => {
904
+ i(), a.value && d.size && (o = new MutationObserver(e), d.forEach((m) => o.observe(m, r)));
904
905
  },
905
906
  { immediate: !0, flush: "post" }
906
- ), f = () => o?.takeRecords(), d = () => {
907
- l(), i();
907
+ ), f = () => o?.takeRecords(), u = () => {
908
+ c(), i();
908
909
  };
909
- return Lt(d), {
910
+ return Lt(u), {
910
911
  isSupported: a,
911
- stop: d,
912
+ stop: u,
912
913
  takeRecords: f
913
914
  };
914
915
  }
@@ -916,48 +917,53 @@ function es(n = null, e = {}) {
916
917
  var t, s, r;
917
918
  const {
918
919
  document: o = Gt,
919
- restoreOnUnmount: a = (d) => d
920
- } = e, i = (t = o?.title) != null ? t : "", c = zt((s = n ?? o?.title) != null ? s : null), l = n && typeof n == "function";
921
- function f(d) {
920
+ restoreOnUnmount: a = (u) => u
921
+ } = e, i = (t = o?.title) != null ? t : "", l = zt((s = n ?? o?.title) != null ? s : null), c = n && typeof n == "function";
922
+ function f(u) {
922
923
  if (!("titleTemplate" in e))
923
- return d;
924
- const u = e.titleTemplate || "%s";
925
- return typeof u == "function" ? u(d) : Q(u).replace(/%s/g, d);
926
- }
927
- return pe(
928
- c,
929
- (d, u) => {
930
- d !== u && o && (o.title = f(typeof d == "string" ? d : ""));
924
+ return u;
925
+ const d = e.titleTemplate || "%s";
926
+ return typeof d == "function" ? d(u) : Z(d).replace(/%s/g, u);
927
+ }
928
+ return fe(
929
+ l,
930
+ (u, d) => {
931
+ u !== d && o && (o.title = f(typeof u == "string" ? u : ""));
931
932
  },
932
933
  { immediate: !0 }
933
- ), e.observe && !e.titleTemplate && o && !l && Zt(
934
+ ), e.observe && !e.titleTemplate && o && !c && Zt(
934
935
  (r = o.head) == null ? void 0 : r.querySelector("title"),
935
936
  () => {
936
- o && o.title !== c.value && (c.value = f(o.title));
937
+ o && o.title !== l.value && (l.value = f(o.title));
937
938
  },
938
939
  { childList: !0 }
939
940
  ), Kt(() => {
940
941
  if (a) {
941
- const d = a(i, c.value || "");
942
- d != null && o && (o.title = d);
942
+ const u = a(i, l.value || "");
943
+ u != null && o && (o.title = u);
943
944
  }
944
- }), c;
945
+ }), l;
945
946
  }
946
- const ae = K({
947
+ const ce = Y({
947
948
  name: "VtjPageContainer",
948
949
  async setup() {
949
- const n = be(), e = he(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null;
950
- return s && (Object.assign(e.meta, s.meta || {}), es(s.title || "VTJ")), {
950
+ const n = be(), e = me(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = C(Symbol());
951
+ return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), es(s.title || "VTJ")), {
951
952
  provider: n,
952
953
  component: r,
953
954
  file: s,
954
955
  query: e.query,
955
- meta: s?.meta
956
+ meta: e.meta,
957
+ sid: o,
958
+ route: e
956
959
  };
957
960
  },
958
961
  render() {
959
- const { component: n, query: e } = this;
960
- return n ? q(n, e) : q("div", "页面不存在");
962
+ const { component: n, query: e, sid: t } = this;
963
+ return n ? z(n, { ...e, key: t }) : z("div", "页面不存在");
964
+ },
965
+ activated() {
966
+ this.meta.cache === !1 && (this.sid = Symbol());
961
967
  }
962
968
  }), ts = {
963
969
  "data-l-h6o7ki7": "",
@@ -974,12 +980,13 @@ const ae = K({
974
980
  }, is = {
975
981
  "data-l-h6o7ki7": "",
976
982
  class: "vtj-startup__actions"
977
- }, as = /* @__PURE__ */ K({
983
+ }, as = /* @__PURE__ */ Y({
978
984
  __name: "Startup",
979
985
  props: {
980
986
  name: { default: "VTJ.PRO" },
981
987
  tagline: { default: "基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台" },
982
- actionText: { default: "开始设计" }
988
+ actionText: { default: "开始设计" },
989
+ link: {}
983
990
  },
984
991
  setup(n) {
985
992
  ((r, o) => {
@@ -1053,6 +1060,10 @@ const ae = K({
1053
1060
  }`);
1054
1061
  const t = n, s = () => {
1055
1062
  if (typeof window < "u") {
1063
+ if (t.link) {
1064
+ typeof t.link == "function" ? t.link() : window.location.href = t.link;
1065
+ return;
1066
+ }
1056
1067
  let o = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "__vtj__/#/";
1057
1068
  window.location.href = o;
1058
1069
  }
@@ -1060,26 +1071,26 @@ const ae = K({
1060
1071
  return (r, o) => (Ge(), Ye("div", ts, [
1061
1072
  b("div", ss, [
1062
1073
  b("h1", ns, [
1063
- b("span", rs, N(t.name), 1)
1074
+ b("span", rs, q(t.name), 1)
1064
1075
  ]),
1065
- b("div", os, N(t.tagline), 1),
1076
+ b("div", os, q(t.tagline), 1),
1066
1077
  b("div", is, [
1067
1078
  b("button", {
1068
1079
  "data-l-h6o7ki7": "",
1069
1080
  onClick: s
1070
- }, N(t.actionText), 1)
1081
+ }, q(t.actionText), 1)
1071
1082
  ])
1072
1083
  ])
1073
1084
  ]));
1074
1085
  }
1075
- }), cs = K({
1086
+ }), cs = Y({
1076
1087
  name: "VtjStartupContainer",
1077
1088
  render() {
1078
- return q(as);
1089
+ return z(as);
1079
1090
  }
1080
1091
  }), $e = Symbol("Provider");
1081
1092
  var ls = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ls || {});
1082
- class us extends xe {
1093
+ class us extends Re {
1083
1094
  constructor(e) {
1084
1095
  super(), this.options = e;
1085
1096
  const {
@@ -1089,16 +1100,16 @@ class us extends xe {
1089
1100
  materials: o,
1090
1101
  project: a = {},
1091
1102
  adapter: i = {},
1092
- globals: c = {},
1093
- modules: l = {},
1103
+ globals: l = {},
1104
+ modules: c = {},
1094
1105
  router: f = null,
1095
- materialPath: d = "./",
1096
- nodeEnv: u = "development"
1106
+ materialPath: u = "./",
1107
+ nodeEnv: d = "development"
1097
1108
  /* Development */
1098
1109
  } = e;
1099
- this.mode = s, this.modules = l, this.service = t, this.router = f, this.materialPath = d, this.nodeEnv = u, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, c), Object.assign(this.adapter, i);
1110
+ this.mode = s, this.modules = c, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = d, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i);
1100
1111
  const { access: m, request: p } = this.adapter;
1101
- m && m.connect({ mode: s, router: f, request: p }), s !== _.Design && this.load(a);
1112
+ m && m.connect({ mode: s, router: f, request: p }), a && s !== _.Design ? this.load(a) : this.project = a;
1102
1113
  }
1103
1114
  mode;
1104
1115
  globals = {};
@@ -1129,35 +1140,35 @@ class us extends xe {
1129
1140
  }
1130
1141
  async loadAssets(e) {
1131
1142
  const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
1132
- libraryExports: c,
1133
- libraryMap: l,
1143
+ libraryExports: l,
1144
+ libraryMap: c,
1134
1145
  materials: f,
1135
- materialExports: d,
1136
- materialMapLibrary: u
1146
+ materialExports: u,
1147
+ materialMapLibrary: d
1137
1148
  } = nt(
1138
1149
  t,
1139
1150
  a,
1140
1151
  i === "development"
1141
1152
  /* Development */
1142
1153
  );
1143
- for (const p of c) {
1154
+ for (const p of l) {
1144
1155
  const h = s[p], w = e[p];
1145
1156
  if (w)
1146
1157
  r[p] = w;
1147
1158
  else if (h)
1148
1159
  e[p] = r[p] = await h();
1149
1160
  else {
1150
- const g = l[p] || [];
1161
+ const g = c[p] || [];
1151
1162
  for (const v of g)
1152
- G(v) && await ot(p, x.append(v, { v: R })), Y(v) && await ne(x.append(v, { v: R }));
1163
+ Q(v) && await ot(p, R.append(v, { v: x })), X(v) && await re(R.append(v, { v: x }));
1153
1164
  r[p] = e[p];
1154
1165
  }
1155
1166
  }
1156
1167
  for (const p of f)
1157
- await ne(x.append(p, { v: R }));
1168
+ await re(R.append(p, { v: x }));
1158
1169
  const m = this.materials || {};
1159
- for (const p of d) {
1160
- const h = e[u[p]], w = Re[p];
1170
+ for (const p of u) {
1171
+ const h = e[d[p]], w = xe[p];
1161
1172
  if (w)
1162
1173
  h && w.forEach((g) => {
1163
1174
  o[g] = h[g];
@@ -1171,26 +1182,26 @@ class us extends xe {
1171
1182
  }
1172
1183
  }
1173
1184
  initRouter() {
1174
- const { router: e, project: t, options: s } = this;
1185
+ const { router: e, project: t, options: s, adapter: r } = this;
1175
1186
  if (!e) return;
1176
- const { routeParentName: r, pageRouteName: o = "page", routeMeta: a } = s, i = {
1177
- path: `/${o}/:id`,
1178
- name: W,
1179
- component: ae
1180
- }, c = {
1181
- path: "/",
1182
- name: me,
1183
- component: t?.homepage ? ae : cs,
1184
- meta: a
1187
+ const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, l = o ? "" : "/", c = {
1188
+ path: `${l}${a}/:id`,
1189
+ name: k,
1190
+ component: ce
1191
+ }, f = {
1192
+ path: l,
1193
+ name: O,
1194
+ component: t?.homepage ? ce : r.startupComponent || cs,
1195
+ meta: i
1185
1196
  };
1186
- r ? (e.addRoute(r, i), e.addRoute(r, c)) : (e.addRoute(i), e.addRoute(c));
1197
+ e.hasRoute(k) && e.removeRoute(k), e.hasRoute(O) && e.removeRoute(O), o ? (e.addRoute(o, c), e.addRoute(o, f)) : (e.addRoute(c), e.addRoute(f));
1187
1198
  }
1188
1199
  install(e) {
1189
1200
  const t = e.config.globalProperties.installed || {};
1190
1201
  for (const [s, r] of Object.entries(this.library))
1191
1202
  !t[s] && ct(r) && (e.use(r), t[s] = !0);
1192
1203
  this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide($e, this), e.config.globalProperties.installed = t, this.mode === _.Design && (e.config.errorHandler = (s, r, o) => {
1193
- const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
1204
+ const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", l = `[ ${a} ] ${i} ${o}`;
1194
1205
  console.error(
1195
1206
  "[VTJ Error]:",
1196
1207
  {
@@ -1199,9 +1210,9 @@ class us extends xe {
1199
1210
  info: o
1200
1211
  },
1201
1212
  s?.stack
1202
- ), T.error({
1213
+ ), B.error({
1203
1214
  title: "未处理的异常:请在控制台查看详情",
1204
- message: c
1215
+ message: l
1205
1216
  });
1206
1217
  });
1207
1218
  }
@@ -1229,7 +1240,7 @@ class us extends xe {
1229
1240
  }
1230
1241
  async getDsl(e) {
1231
1242
  const t = this.modules[`.vtj/files/${e}.json`];
1232
- return t ? await t() : this.service.getFile(e).catch(() => null);
1243
+ return t ? await t() : this.service.getFile(e, this.project || void 0).catch(() => null);
1233
1244
  }
1234
1245
  async getDslByUrl(e) {
1235
1246
  const t = this.urlDslCaches[e];
@@ -1251,36 +1262,36 @@ class us extends xe {
1251
1262
  apis: a,
1252
1263
  window,
1253
1264
  ...t
1254
- }, c = V({
1255
- getDsl: async (l) => await this.getDsl(l) || null,
1256
- getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
1265
+ }, l = W({
1266
+ getDsl: async (c) => await this.getDsl(c) || null,
1267
+ getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
1257
1268
  options: i
1258
1269
  });
1259
- return J({
1270
+ return K({
1260
1271
  ...i,
1261
1272
  dsl: e,
1262
- loader: c
1273
+ loader: l
1263
1274
  });
1264
1275
  }
1265
1276
  async getRenderComponent(e, t) {
1266
1277
  const s = this.getFile(e);
1267
1278
  if (!s)
1268
- return I.warn(`Can not find file: ${e}`), null;
1279
+ return T.warn(`Can not find file: ${e}`), null;
1269
1280
  t && t(s);
1270
1281
  const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
1271
1282
  if (o)
1272
1283
  return (await o())?.default;
1273
1284
  const a = await this.getDsl(s.id);
1274
- return a ? this.createDslRenderer(a).renderer : (I.warn(`Can not find dsl: ${e}`), null);
1285
+ return a ? this.createDslRenderer(a).renderer : (T.warn(`Can not find dsl: ${e}`), null);
1275
1286
  }
1276
1287
  defineUrlSchemaComponent(e, t) {
1277
- return re(async () => {
1288
+ return oe(async () => {
1278
1289
  const s = await this.getDslByUrl(e);
1279
1290
  return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
1280
1291
  });
1281
1292
  }
1282
1293
  definePluginComponent(e) {
1283
- return re(async () => await we(e, window));
1294
+ return oe(async () => await we(e, window));
1284
1295
  }
1285
1296
  }
1286
1297
  function bs(n) {
@@ -1291,14 +1302,14 @@ function bs(n) {
1291
1302
  };
1292
1303
  }
1293
1304
  function be(n = {}) {
1294
- const e = ue($e);
1305
+ const e = de($e);
1295
1306
  if (!e)
1296
1307
  throw new Error("Can not find provider");
1297
1308
  if (e.nodeEnv === "development") {
1298
1309
  const { id: t, version: s } = n;
1299
1310
  t && s && (async () => {
1300
1311
  const r = await e.getDsl(t);
1301
- r?.__VERSION__ !== s && T.warning({
1312
+ r?.__VERSION__ !== s && B.warning({
1302
1313
  title: r?.name,
1303
1314
  message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
1304
1315
  });
@@ -1306,7 +1317,7 @@ function be(n = {}) {
1306
1317
  }
1307
1318
  return e;
1308
1319
  }
1309
- const X = new Be({
1320
+ const ee = new Be({
1310
1321
  settings: {
1311
1322
  type: "json",
1312
1323
  validSuccess: !0,
@@ -1314,12 +1325,12 @@ const X = new Be({
1314
1325
  failMessage: !0,
1315
1326
  validate: (n) => n.data?.code === 0,
1316
1327
  showError: (n) => {
1317
- T.error({
1328
+ B.error({
1318
1329
  message: n || "未知错误"
1319
1330
  });
1320
1331
  }
1321
1332
  }
1322
- }), ds = (n = "/__vtj__/api/:type.json") => (e, t) => X.send({
1333
+ }), ds = (n = "/__vtj__/api/:type.json") => (e, t) => ee.send({
1323
1334
  url: n,
1324
1335
  method: "post",
1325
1336
  params: { type: e },
@@ -1327,7 +1338,7 @@ const X = new Be({
1327
1338
  type: e,
1328
1339
  data: t
1329
1340
  }
1330
- }), ps = (n = "/__vtj__/api/uploader.json") => async (e, t) => await X.send({
1341
+ }), ps = (n = "/__vtj__/api/uploader.json") => async (e, t) => await ee.send({
1331
1342
  url: n,
1332
1343
  method: "post",
1333
1344
  data: {
@@ -1338,7 +1349,7 @@ const X = new Be({
1338
1349
  type: "data"
1339
1350
  }
1340
1351
  }).then((s) => s && s[0] ? s[0] : null).catch(() => null);
1341
- class Z {
1352
+ class te {
1342
1353
  api;
1343
1354
  pluginCaches = {};
1344
1355
  uploader;
@@ -1419,7 +1430,7 @@ class Z {
1419
1430
  const { urls: t = [] } = e, s = t.filter((o) => tt(o))[0];
1420
1431
  if (!s) return null;
1421
1432
  const r = this.pluginCaches[s];
1422
- return r || (this.pluginCaches[s] = X.send({
1433
+ return r || (this.pluginCaches[s] = ee.send({
1423
1434
  url: s,
1424
1435
  method: "get",
1425
1436
  settings: {
@@ -1428,23 +1439,26 @@ class Z {
1428
1439
  }
1429
1440
  }).then((o) => o.data).catch(() => null));
1430
1441
  }
1442
+ async genSource(e) {
1443
+ return console.log("BaseService.genSource", e), "";
1444
+ }
1431
1445
  }
1432
- const y = new Ue({
1446
+ const y = new Ne({
1433
1447
  type: "local",
1434
1448
  expired: 0,
1435
1449
  prefix: "__VTJ_"
1436
1450
  });
1437
- class Es extends Z {
1451
+ class Es extends te {
1438
1452
  init(e) {
1439
- const t = new A(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
1453
+ const t = new M(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
1440
1454
  return y.save(`project_${t.id}`, r), Promise.resolve(r);
1441
1455
  }
1442
1456
  saveProject(e) {
1443
- const t = new A(e);
1457
+ const t = new M(e);
1444
1458
  return y.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
1445
1459
  }
1446
1460
  saveMaterials(e, t) {
1447
- return y.save(`materials_${e.id}`, z(t)), Promise.resolve(!0);
1461
+ return y.save(`materials_${e.id}`, G(t)), Promise.resolve(!0);
1448
1462
  }
1449
1463
  saveFile(e) {
1450
1464
  return y.save(`file_${e.id}`, e), Promise.resolve(!0);
@@ -1468,7 +1482,7 @@ class Es extends Z {
1468
1482
  return Promise.resolve(!0);
1469
1483
  }
1470
1484
  getHistory(e) {
1471
- const t = y.get(`history_${e}`), s = new ce(t || { id: e });
1485
+ const t = y.get(`history_${e}`), s = new le(t || { id: e });
1472
1486
  return Promise.resolve(s.toDsl());
1473
1487
  }
1474
1488
  getHistoryItem(e, t) {
@@ -1484,22 +1498,22 @@ class Es extends Z {
1484
1498
  }), Promise.resolve(!0);
1485
1499
  }
1486
1500
  }
1487
- class fs extends Z {
1501
+ class fs extends te {
1488
1502
  projects = {};
1489
1503
  materials = {};
1490
1504
  files = {};
1491
1505
  histories = {};
1492
1506
  historyItems = {};
1493
1507
  init(e) {
1494
- const t = new A(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
1508
+ const t = new M(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
1495
1509
  return this.projects[r.id] = r, Promise.resolve(r);
1496
1510
  }
1497
1511
  saveProject(e) {
1498
- const t = new A(e);
1512
+ const t = new M(e);
1499
1513
  return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
1500
1514
  }
1501
1515
  saveMaterials(e, t) {
1502
- return e.id && (this.materials[e.id] = z(t)), Promise.resolve(!0);
1516
+ return e.id && (this.materials[e.id] = G(t)), Promise.resolve(!0);
1503
1517
  }
1504
1518
  saveFile(e) {
1505
1519
  return this.files[e.id] = e, Promise.resolve(!0);
@@ -1523,7 +1537,7 @@ class fs extends Z {
1523
1537
  return Promise.resolve(!0);
1524
1538
  }
1525
1539
  getHistory(e) {
1526
- const t = this.histories[e], s = new ce(t || { id: e });
1540
+ const t = this.histories[e], s = new le(t || { id: e });
1527
1541
  return Promise.resolve(s);
1528
1542
  }
1529
1543
  getHistoryItem(e, t) {
@@ -1541,11 +1555,11 @@ class fs extends Z {
1541
1555
  }), Promise.resolve(!0);
1542
1556
  }
1543
1557
  }
1544
- let F = null;
1558
+ let I = null;
1545
1559
  function Ps() {
1546
- return F || (F = new fs(), F);
1560
+ return I || (I = new fs(), I);
1547
1561
  }
1548
- class xs extends Z {
1562
+ class Rs extends te {
1549
1563
  getFileCaches = {};
1550
1564
  async getExtension() {
1551
1565
  return await this.api("getExtension", {}).catch(() => {
@@ -1560,7 +1574,7 @@ class xs extends Z {
1560
1574
  async saveMaterials(e, t) {
1561
1575
  return !!await this.api("saveMaterials", {
1562
1576
  project: e,
1563
- materials: z(t)
1577
+ materials: G(t)
1564
1578
  }).catch(() => !1);
1565
1579
  }
1566
1580
  async saveFile(e) {
@@ -1600,16 +1614,16 @@ class xs extends Z {
1600
1614
  );
1601
1615
  }
1602
1616
  }
1603
- function Ee(n = []) {
1604
- return n.map((e) => {
1605
- const { id: t, title: s, icon: r, children: o, hidden: a } = e;
1617
+ function Ee(n, e, t = []) {
1618
+ return t.map((s) => {
1619
+ const { id: r, title: o, icon: a, children: i, hidden: l } = s;
1606
1620
  return {
1607
- id: t,
1608
- title: s,
1609
- icon: r,
1610
- hidden: a,
1611
- url: `/page/${t}`,
1612
- children: o && o.length ? Ee(o) : void 0
1621
+ id: r,
1622
+ title: o,
1623
+ icon: a,
1624
+ hidden: l,
1625
+ url: `${n}/${e}/${r}`,
1626
+ children: i && i.length ? Ee(n, e, i) : void 0
1613
1627
  };
1614
1628
  });
1615
1629
  }
@@ -1621,74 +1635,82 @@ function Pe(n, e) {
1621
1635
  const r = Pe(s.children, e);
1622
1636
  r.length && (s.children = r, t.push(s));
1623
1637
  } else
1624
- e[s.id] && t.push(s);
1638
+ e.can(s.id.toString()) && t.push(s);
1625
1639
  return t;
1626
1640
  }
1627
- function Rs() {
1628
- const n = be(), e = he(), t = vt(), s = O(!1), r = O(!1), o = t?.getData(), a = n.project;
1641
+ function xs(n) {
1642
+ const {
1643
+ menuPathPrefix: e = "",
1644
+ pageRouteName: t = "page",
1645
+ disableMenusFilter: s = !1
1646
+ } = n || {}, r = be(), o = me(), a = vt(), i = C(!1), l = C(!1), c = r.project;
1629
1647
  Qe(() => {
1630
- const { name: l, params: f, meta: d } = e;
1631
- if (l === W) {
1632
- const u = n.getPage(f.id);
1633
- s.value = !u?.mask, r.value = !!u?.pure;
1634
- } else if (l === me) {
1635
- const u = n.getHomepage();
1636
- s.value = !u?.mask, r.value = !!u?.pure;
1648
+ const { name: d, params: m, meta: p } = o;
1649
+ if (d === k) {
1650
+ const h = r.getPage(m.id);
1651
+ i.value = !h?.mask, l.value = !!h?.pure;
1652
+ } else if (d === O) {
1653
+ const h = r.getHomepage();
1654
+ i.value = !h?.mask, l.value = !!h?.pure;
1637
1655
  } else
1638
- s.value = !d.mask, r.value = !!d.pure;
1656
+ i.value = !p.mask, l.value = !!p.pure;
1639
1657
  });
1640
- const i = Ee(a?.pages), c = a?.config;
1658
+ const f = Ee(
1659
+ e,
1660
+ t,
1661
+ c?.pages
1662
+ ), u = c?.config;
1641
1663
  return {
1642
- disabled: s,
1643
- logo: c?.logo,
1644
- themeSwitchable: c?.themeSwitchable,
1645
- title: c?.title || a?.description || a?.name || "VTJ App",
1646
- menus: Pe(i, o?.permissions),
1647
- pure: r
1664
+ disabled: i,
1665
+ logo: u?.logo,
1666
+ themeSwitchable: u?.themeSwitchable,
1667
+ title: u?.title || c?.description || c?.name || "VTJ App",
1668
+ menus: s ? f : Pe(f, a),
1669
+ pure: l
1648
1670
  };
1649
1671
  }
1650
1672
  export {
1651
1673
  _e as ACCESS_KEY,
1652
1674
  $s as Access,
1653
1675
  Ze as BUILT_IN_DIRECTIVES,
1654
- Z as BaseService,
1655
- oe as CONTEXT_HOST,
1676
+ te as BaseService,
1677
+ ie as CONTEXT_HOST,
1656
1678
  yt as Context,
1657
1679
  _ as ContextMode,
1658
1680
  et as DATA_TYPES,
1659
- me as HOMEPAGE_ROUTE_NAME,
1681
+ O as HOMEPAGE_ROUTE_NAME,
1660
1682
  js as JSCodeToString,
1661
1683
  _s as LIFE_CYCLES_LIST,
1662
- xs as LocalService,
1684
+ Rs as LocalService,
1663
1685
  fs as MemoryService,
1664
1686
  ls as NodeEnv,
1665
- W as PAGE_ROUTE_NAME,
1687
+ k as PAGE_ROUTE_NAME,
1666
1688
  us as Provider,
1667
1689
  as as Startup,
1668
1690
  Es as StorageService,
1669
- R as VTJ_RENDERER_VERSION,
1691
+ x as VTJ_RENDERER_VERSION,
1670
1692
  ve as adoptedStyleSheets,
1671
1693
  ws as createAssetScripts,
1672
1694
  Ss as createAssetsCss,
1673
1695
  Et as createDataSources,
1674
- V as createLoader,
1696
+ W as createLoader,
1675
1697
  Ps as createMemoryService,
1676
1698
  pt as createMetaApi,
1677
1699
  bs as createProvider,
1678
- J as createRenderer,
1700
+ K as createRenderer,
1679
1701
  dt as createSchemaApi,
1680
1702
  ft as createSchemaApis,
1681
- Rt as defaultLoader,
1682
- C as fillBasePath,
1703
+ xt as defaultLoader,
1704
+ A as fillBasePath,
1683
1705
  Se as getModifiers,
1684
1706
  we as getPlugin,
1685
1707
  rt as getRawComponent,
1686
- G as isCSSUrl,
1708
+ Q as isCSSUrl,
1687
1709
  lt as isJSCode,
1688
1710
  S as isJSExpression,
1689
- H as isJSFunction,
1711
+ N as isJSFunction,
1690
1712
  tt as isJSON,
1691
- Y as isJSUrl,
1713
+ X as isJSUrl,
1692
1714
  ct as isVuePlugin,
1693
1715
  ot as loadCss,
1694
1716
  it as loadCssUrl,
@@ -1698,12 +1720,12 @@ export {
1698
1720
  ye as mockCleanup,
1699
1721
  D as nodeRender,
1700
1722
  nt as parseDeps,
1701
- k as parseExpression,
1702
- ie as parseFunction,
1723
+ F as parseExpression,
1724
+ ae as parseFunction,
1703
1725
  $e as providerKey,
1704
1726
  st as removeProdFlag,
1705
1727
  ge as toString,
1706
1728
  vt as useAccess,
1707
- Rs as useMask,
1729
+ xs as useMask,
1708
1730
  be as useProvider
1709
1731
  };