@vtj/renderer 0.10.1-alpha.0 → 0.10.1-alpha.2

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,18 +1,17 @@
1
- import { Base as Me, BUILT_IN_COMPONENTS as De, ProjectModel as O, HistoryModel as de } from "@vtj/core";
2
- import { isUrl as He, url as P, dedupArray as Oe, isString as j, isFunction as V, logger as x, storage as L, cookie as q, toArray as ie, unRSA as ae, delay as fe, createRequest as he, jsonp as me, merge as Be, pathToRegexp as Ne, pathToRegexpMatch as Ue, formDataToJson as Le, camelCase as $, upperFirst as qe, pick as Je, request as K, loadScript as ce, Storage as ze, mapToObject as Z } from "@vtj/utils";
1
+ import { Base as Ie, BUILT_IN_COMPONENTS as De, ProjectModel as O, HistoryModel as pe } from "@vtj/core";
2
+ import { isUrl as He, url as R, dedupArray as Oe, isString as j, isFunction as V, logger as P, storage as L, cookie as q, toArray as ie, unRSA as ae, delay as fe, createRequest as he, jsonp as me, merge as Be, pathToRegexp as Ne, pathToRegexpMatch as Ue, formDataToJson as Le, camelCase as $, upperFirst as qe, pick as Je, request as K, loadScript as ce, Storage as ze, mapToObject as Z } from "@vtj/utils";
3
3
  import * as N from "vue";
4
- import { inject as ge, toRef as Ve, readonly as Ke, ref as F, customRef as We, onBeforeUnmount as Ge, getCurrentScope as Ye, onScopeDispose as Qe, getCurrentInstance as ve, watch as ye, toValue as ee, computed as _e, onMounted as Xe, defineComponent as te, h as W, createElementBlock as Ze, openBlock as et, createElementVNode as E, toDisplayString as J, defineAsyncComponent as le, watchEffect as tt } from "vue";
5
- import R from "mockjs";
4
+ import { inject as ge, toRef as Ve, readonly as Ke, ref as M, customRef as We, onBeforeUnmount as Ge, getCurrentScope as Ye, onScopeDispose as Qe, getCurrentInstance as ve, watch as ye, toValue as ee, computed as _e, onMounted as Xe, defineComponent as te, h as W, createElementBlock as Ze, openBlock as et, createElementVNode as k, toDisplayString as J, defineAsyncComponent as le, watchEffect as tt } from "vue";
6
5
  import { useRoute as we } from "vue-router";
7
6
  /**!
8
7
  * Copyright (c) 2025, VTJ.PRO All rights reserved.
9
8
  * @name @vtj/renderer
10
9
  * @author CHC chenhuachun1549@dingtalk.com
11
- * @version 0.10.1-alpha.0
10
+ * @version 0.10.1-alpha.2
12
11
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
13
12
  */
14
- const C = "0.10.1-alpha.0";
15
- var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
13
+ const x = "0.10.1-alpha.2";
14
+ var y = /* @__PURE__ */ ((s) => (s.Runtime = "Runtime", s.Design = "Design", s.Raw = "Raw", s.VNode = "VNode", s))(y || {});
16
15
  const ue = [
17
16
  "$el",
18
17
  "$emit",
@@ -25,7 +24,7 @@ const ue = [
25
24
  "$props",
26
25
  "$options",
27
26
  "$forceUpdate"
28
- ], xs = [
27
+ ], xn = [
29
28
  "beforeCreate",
30
29
  "created",
31
30
  "beforeMount",
@@ -39,14 +38,14 @@ const ue = [
39
38
  "renderTriggered",
40
39
  "activated",
41
40
  "deactivated"
42
- ], st = [
41
+ ], nt = [
43
42
  "vIf",
44
43
  "vShow",
45
44
  "vModel",
46
45
  "vFor",
47
46
  "vBind",
48
47
  "vHtml"
49
- ], nt = {
48
+ ], st = {
50
49
  String,
51
50
  Number,
52
51
  Boolean,
@@ -54,46 +53,46 @@ const ue = [
54
53
  Object,
55
54
  Function,
56
55
  Date
57
- }, A = "VtjPage", H = "VtjHomepage", rt = "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(
56
+ }, C = "VtjPage", H = "VtjHomepage", rt = "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
57
  ","
59
58
  ), ot = "component,slot".split(",");
60
- function M(n, e) {
61
- return n.map((t) => He(t) || t.startsWith("/") ? t : `${e}${t}`);
59
+ function I(s, e) {
60
+ return s.map((t) => He(t) || t.startsWith("/") ? t : `${e}${t}`);
62
61
  }
63
- function se(n) {
64
- return /\.css$/.test(n);
62
+ function ne(s) {
63
+ return /\.css$/.test(s);
65
64
  }
66
- function ne(n) {
67
- return /\.js$/.test(n);
65
+ function se(s) {
66
+ return /\.js$/.test(s);
68
67
  }
69
- function it(n) {
70
- return /\.json$/.test(n);
68
+ function it(s) {
69
+ return /\.json$/.test(s);
71
70
  }
72
- function Cs(n) {
73
- return n.map(
74
- (e) => `<script src="${P.append(e, { v: C })}"><\/script>`
71
+ function Cn(s) {
72
+ return s.map(
73
+ (e) => `<script src="${R.append(e, { v: x })}"><\/script>`
75
74
  ).join("");
76
75
  }
77
- function As(n = []) {
78
- return n.map(
79
- (e) => `<link rel="stylesheet" href="${P.append(e, { v: C })}" />`
76
+ function Mn(s = []) {
77
+ return s.map(
78
+ (e) => `<link rel="stylesheet" href="${R.append(e, { v: x })}" />`
80
79
  ).join("");
81
80
  }
82
- function at(n, e = !1) {
83
- return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
81
+ function at(s, e = !1) {
82
+ return e && s.endsWith(".prod.js") ? s.replace(".prod.js", ".js") : s;
84
83
  }
85
- function ct(n, e, t = !1) {
86
- const s = n.filter((p) => !!p.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
87
- return s.forEach(
88
- ({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
89
- p?.forEach((g) => {
90
- ne(g) && r.push(at(g, t)), se(g) && o.push(g);
91
- }), 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);
84
+ function ct(s, e, t = !1) {
85
+ const n = s.filter((d) => !!d.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
86
+ return n.forEach(
87
+ ({ urls: d, assetsUrl: h, library: m, assetsLibrary: p, localeLibrary: w }) => {
88
+ d?.forEach((g) => {
89
+ se(g) && r.push(at(g, t)), ne(g) && o.push(g);
90
+ }), m && (i.push(m), c[m] = I(d || [], e), w && (l[m] = w)), h && a.push(h), p && f.push(p), m && p && (u[p] = m);
92
91
  }
93
92
  ), {
94
- scripts: M(r, e),
95
- css: M(o, e),
96
- materials: M(a, e),
93
+ scripts: I(r, e),
94
+ css: I(o, e),
95
+ materials: I(a, e),
97
96
  libraryExports: i,
98
97
  materialExports: Oe(f),
99
98
  materialMapLibrary: u,
@@ -101,46 +100,46 @@ function ct(n, e, t = !1) {
101
100
  libraryLocaleMap: l
102
101
  };
103
102
  }
104
- function lt(n, e) {
105
- const { name: t, parent: s, alias: r } = n;
106
- return s ? e[s]?.[r || t] : e[r || t];
103
+ function lt(s, e) {
104
+ const { name: t, parent: n, alias: r } = s;
105
+ return n ? e[n]?.[r || t] : e[r || t];
107
106
  }
108
- function Se(n) {
109
- return j(n) ? n : JSON.stringify(n);
107
+ function Se(s) {
108
+ return j(s) ? s : JSON.stringify(s);
110
109
  }
111
- function be(n, e, t) {
112
- const s = n.CSSStyleSheet;
113
- if (s.prototype.replaceSync) {
114
- const r = new s();
110
+ function be(s, e, t) {
111
+ const n = s.CSSStyleSheet;
112
+ if (n.prototype.replaceSync) {
113
+ const r = new n();
115
114
  r.id = e, r.replaceSync(t);
116
- const o = n.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
115
+ const o = s.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
117
116
  (c) => c.id !== e
118
117
  );
119
118
  o.adoptedStyleSheets = [...i, r];
120
119
  } else {
121
- const r = n.document;
120
+ const r = s.document;
122
121
  let o = r.getElementById(e);
123
122
  o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
124
123
  }
125
124
  }
126
- async function ut(n, e) {
127
- const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
128
- t && be(window, n, t);
125
+ async function ut(s, e) {
126
+ const t = await window.fetch(e).then((n) => n.text()).catch(() => "");
127
+ t && be(window, s, t);
129
128
  }
130
- function pt(n, e = window) {
131
- const t = e.document, s = e.document.head;
132
- for (const r of n)
129
+ function dt(s, e = window) {
130
+ const t = e.document, n = e.document.head;
131
+ for (const r of s)
133
132
  if (!t.getElementById(r)) {
134
133
  const a = t.createElement("link");
135
- a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
134
+ a.rel = "stylesheet", a.id = r, a.href = r, n.appendChild(a);
136
135
  }
137
136
  }
138
- async function dt(n, e, t = window) {
139
- const s = t.document, r = t.document.head;
137
+ async function pt(s, e, t = window) {
138
+ const n = t.document, r = t.document.head;
140
139
  let o = t[e];
141
140
  return o ? o.default || o : new Promise((a, i) => {
142
- for (const c of n) {
143
- const l = s.createElement("script");
141
+ for (const c of s) {
142
+ const l = n.createElement("script");
144
143
  l.src = c, l.onload = () => {
145
144
  o = t[e], o ? a(o.default || o) : i(null);
146
145
  }, l.onerror = (f) => {
@@ -149,51 +148,58 @@ async function dt(n, e, t = window) {
149
148
  }
150
149
  });
151
150
  }
152
- function ft(n) {
153
- return V(n) || V(n?.install);
151
+ function ft(s) {
152
+ return V(s) || V(s?.install);
154
153
  }
155
- function ht(n) {
156
- return ot.includes(n);
154
+ function ht(s) {
155
+ return ot.includes(s);
157
156
  }
158
- function mt(n) {
159
- return rt.includes(n);
157
+ function mt(s) {
158
+ return rt.includes(s);
160
159
  }
161
- function T(n, e, t = !1, s = !1) {
160
+ function A(s = window) {
161
+ const e = window.Mock;
162
+ if (e) return e;
163
+ const t = s.Mock;
164
+ if (t)
165
+ return window.Mock = t, t;
166
+ }
167
+ function F(s, e, t = !1, n = !1) {
162
168
  try {
163
169
  const r = ['"use strict";', "var __self = arguments[0];"];
164
170
  r.push("return ");
165
- let o = (n.value || "").trim();
171
+ let o = (s.value || "").trim();
166
172
  o = o.replace(/this(\W|$)/g, (i, c) => `__self${c}`), o = r.join(`
167
173
  `) + o;
168
174
  const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
169
175
  return new Function("$scope", a)(e);
170
176
  } catch (r) {
171
- if (x.error("parseExpression.error", r, n, e?.__self ?? e), s)
177
+ if (P.error("parseExpression.error", r, s, e?.__self ?? e), n)
172
178
  throw r;
173
179
  }
174
180
  }
175
- function G(n, e, t = !1, s = !1) {
176
- const r = T(n, e, t, s);
177
- if (typeof r != "function" && (x.error(
181
+ function G(s, e, t = !1, n = !1) {
182
+ const r = F(s, e, t, n);
183
+ if (typeof r != "function" && (P.error(
178
184
  "parseFunction.error",
179
185
  "not a function",
180
- n,
186
+ s,
181
187
  e?.__self ?? e
182
- ), s))
183
- throw new Error(`"${n.value}" not a function`);
188
+ ), n))
189
+ throw new Error(`"${s.value}" not a function`);
184
190
  return r;
185
191
  }
186
- function _(n) {
187
- return n && n.type === "JSExpression";
192
+ function _(s) {
193
+ return s && s.type === "JSExpression";
188
194
  }
189
- function I(n) {
190
- return typeof n == "object" && n && n.type === "JSFunction";
195
+ function T(s) {
196
+ return typeof s == "object" && s && s.type === "JSFunction";
191
197
  }
192
- function gt(n) {
193
- return _(n) || I(n);
198
+ function gt(s) {
199
+ return _(s) || T(s);
194
200
  }
195
- function Fs(n) {
196
- return gt(n) ? n.value : JSON.stringify(n);
201
+ function An(s) {
202
+ return gt(s) ? s.value : JSON.stringify(s);
197
203
  }
198
204
  const vt = {
199
205
  session: !1,
@@ -208,7 +214,7 @@ const vt = {
208
214
  noPermissionMessage: "无权限访问该页面",
209
215
  appName: ""
210
216
  }, je = Symbol("access");
211
- class Ts {
217
+ class Fn {
212
218
  options;
213
219
  data = null;
214
220
  mode = y.Raw;
@@ -216,22 +222,22 @@ class Ts {
216
222
  this.options = Object.assign({}, vt, e), this.loadData();
217
223
  }
218
224
  connect(e) {
219
- const { mode: t, router: s, request: r } = e;
220
- this.mode = t, s && this.mode === y.Raw && this.setGuard(s), r && this.setRequest(r);
225
+ const { mode: t, router: n, request: r } = e;
226
+ this.mode = t, n && this.mode === y.Raw && this.setGuard(n), r && this.setRequest(r);
221
227
  }
222
228
  login(e) {
223
- const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
229
+ const { storageKey: t, storagePrefix: n, session: r, authKey: o } = this.options;
224
230
  this.setData(e), this.data && (L.save(t, e, {
225
231
  type: "local",
226
- prefix: s
232
+ prefix: n
227
233
  }), r && q.set(o, this.data.token));
228
234
  }
229
235
  clear() {
230
- const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
236
+ const { storageKey: e, storagePrefix: t, session: n, authKey: r } = this.options;
231
237
  this.data = null, L.remove(e, {
232
238
  type: "local",
233
239
  prefix: t
234
- }), s && q.remove(r);
240
+ }), n && q.remove(r);
235
241
  }
236
242
  logout() {
237
243
  this.clear(), this.toLogin();
@@ -243,20 +249,20 @@ class Ts {
243
249
  return this.data || this.loadData(), this.data?.token;
244
250
  }
245
251
  can(e) {
246
- const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
247
- return typeof e == "function" ? e(s) : ie(e).every((o) => s[o] || s[t + "." + o]);
252
+ const { appName: t } = this.options, { permissions: n = {} } = this.data || {};
253
+ return typeof e == "function" ? e(n) : ie(e).every((o) => n[o] || n[t + "." + o]);
248
254
  }
249
255
  some(e) {
250
- const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
251
- return ie(e).some((o) => s[o] || s[t + "." + o]);
256
+ const { appName: t } = this.options, { permissions: n = {} } = this.data || {};
257
+ return ie(e).some((o) => n[o] || n[t + "." + o]);
252
258
  }
253
259
  install(e) {
254
- e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(je, this);
260
+ e.config.globalProperties.$access || (e.config.globalProperties.$access = this, e.provide(je, this));
255
261
  }
256
262
  isAuthPath(e) {
257
- const { auth: t, isAuth: s } = this.options;
258
- if (s)
259
- return s(e);
263
+ const { auth: t, isAuth: n } = this.options;
264
+ if (n)
265
+ return n(e);
260
266
  if (e.path && typeof t == "string") {
261
267
  const r = t.split("#")[1] || t;
262
268
  return e.path === r;
@@ -266,46 +272,46 @@ class Ts {
266
272
  toLogin() {
267
273
  const { auth: e, redirectParam: t } = this.options;
268
274
  if (!e) return;
269
- const s = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
270
- typeof e == "function" ? e(s) : location.href = t ? `${e}${s}` : e;
275
+ const n = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
276
+ typeof e == "function" ? e(n) : location.href = t ? `${e}${n}` : e;
271
277
  }
272
278
  setData(e) {
273
279
  const { privateKey: t } = this.options;
274
280
  if (Array.isArray(e) && t) {
275
- const s = e.map((r) => ae(r, t));
276
- this.data = JSON.parse(s.join(""));
281
+ const n = e.map((r) => ae(r, t));
282
+ this.data = JSON.parse(n.join(""));
277
283
  return;
278
284
  }
279
285
  if (typeof e == "string")
280
286
  try {
281
- const s = t ? ae(e, t) : e;
282
- s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
283
- } catch (s) {
284
- console.warn(s);
287
+ const n = t ? ae(e, t) : e;
288
+ n ? this.data = JSON.parse(n) : console.warn("RSA解密失败或登录信息缺失");
289
+ } catch (n) {
290
+ console.warn(n);
285
291
  }
286
292
  else
287
293
  this.data = e;
288
294
  }
289
295
  loadData() {
290
- const { storageKey: e, storagePrefix: t } = this.options, s = L.get(e, {
296
+ const { storageKey: e, storagePrefix: t } = this.options, n = L.get(e, {
291
297
  type: "local",
292
298
  prefix: t
293
299
  });
294
- this.setData(s || null);
300
+ this.setData(n || null);
295
301
  }
296
302
  isLogined() {
297
303
  const { session: e, authKey: t } = this.options;
298
304
  return e && t ? !!q.get(t) : !!this.getToken();
299
305
  }
300
306
  hasRoutePermission(e) {
301
- if (e.name === A) {
307
+ if (e.name === C) {
302
308
  const t = e.params.id;
303
309
  return t && this.can(t);
304
310
  }
305
311
  return !0;
306
312
  }
307
313
  setGuard(e) {
308
- e.beforeEach((t, s, r) => this.guard(t, r));
314
+ e.beforeEach((t, n, r) => this.guard(t, r));
309
315
  }
310
316
  async guard(e, t) {
311
317
  if (this.isWhiteList(e) || this.isAuthPath(e))
@@ -314,15 +320,15 @@ class Ts {
314
320
  if (this.hasRoutePermission(e))
315
321
  return t();
316
322
  {
317
- const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
318
- return await this.showTip(s), V(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
323
+ const { noPermissionMessage: n = "无权限访问", unauthorized: r = !1 } = this.options;
324
+ return await this.showTip(n), V(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
319
325
  }
320
326
  }
321
327
  t(!1), this.toLogin();
322
328
  }
323
329
  isWhiteList(e) {
324
330
  const { whiteList: t } = this.options;
325
- return t ? Array.isArray(t) ? t.some((s) => e.fullPath.startsWith(s)) : t(e) : !1;
331
+ return t ? Array.isArray(t) ? t.some((n) => e.fullPath.startsWith(n)) : t(e) : !1;
326
332
  }
327
333
  isUnauthorized(e) {
328
334
  const { unauthorizedCode: t = 401 } = this.options;
@@ -343,8 +349,8 @@ class Ts {
343
349
  e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
344
350
  async (t) => (await this.showUnauthorizedAlert(t), t),
345
351
  async (t) => {
346
- const s = t.response || t || {};
347
- return await this.showUnauthorizedAlert(s), Promise.reject(t);
352
+ const n = t.response || t || {};
353
+ return await this.showUnauthorizedAlert(n), Promise.reject(t);
348
354
  }
349
355
  );
350
356
  }
@@ -352,8 +358,8 @@ class Ts {
352
358
  function yt() {
353
359
  return ge(je, null);
354
360
  }
355
- function Is(n = {}) {
356
- const { notify: e, loading: t, settings: s = {} } = n;
361
+ function Tn(s = {}) {
362
+ const { notify: e, loading: t, settings: n = {} } = s;
357
363
  let r = null;
358
364
  return {
359
365
  request: he({
@@ -373,7 +379,7 @@ function Is(n = {}) {
373
379
  hideLoading: () => {
374
380
  r && (r.close(), r = null);
375
381
  },
376
- ...s
382
+ ...n
377
383
  }
378
384
  }),
379
385
  jsonp: me,
@@ -381,76 +387,78 @@ function Is(n = {}) {
381
387
  loading: t
382
388
  };
383
389
  }
384
- function _t(n, e) {
385
- const { jsonp: t, request: s } = e;
386
- if (n.method === "jsonp")
387
- return (r = {}) => t(n.url, {
388
- ...n.jsonpOptions,
390
+ function _t(s, e) {
391
+ const { jsonp: t, request: n } = e;
392
+ if (s.method === "jsonp")
393
+ return (r = {}) => t(s.url, {
394
+ ...s.jsonpOptions,
389
395
  query: r
390
396
  });
391
397
  {
392
- const r = n.headers ? T(n.headers, {}, !0) : void 0, o = {
393
- url: n.url,
394
- method: n.method,
398
+ const r = s.headers ? F(s.headers, {}, !0) : void 0, o = {
399
+ url: s.url,
400
+ method: s.method,
395
401
  settings: {
396
- ...n.settings,
402
+ ...s.settings,
397
403
  headers: r
398
404
  }
399
405
  };
400
- return (a, i) => (delete o.data, s.send(Be(o, i || {}, { data: a })));
406
+ return (a, i) => (delete o.data, n.send(Be(o, i || {}, { data: a })));
401
407
  }
402
408
  }
403
- function wt(n, e) {
409
+ function wt(s, e) {
404
410
  const { metaQuery: t } = e;
405
411
  if (!t) return;
406
- const { code: s, queryCode: r } = n;
412
+ const { code: n, queryCode: r } = s;
407
413
  return (o, a) => {
408
414
  if (!t) {
409
415
  console.warn("adapter.metaQuery is not defined!");
410
416
  return;
411
417
  }
412
- return t(s, r, o, a);
418
+ return t(n, r, o, a);
413
419
  };
414
420
  }
415
- function St(n = [], e = [], t) {
416
- const s = {};
417
- for (const r of n)
418
- s[r.id] = _t(r, t);
421
+ function St(s = [], e = [], t) {
422
+ const n = {};
423
+ for (const r of s)
424
+ n[r.id] = _t(r, t);
419
425
  for (const r of e)
420
- s[r.id] = wt(r, t);
421
- return s;
426
+ n[r.id] = wt(r, t);
427
+ return n;
422
428
  }
423
- async function bt(n = []) {
424
- R && ($e(), n.forEach((e) => $t(R, e)));
429
+ async function bt(s = []) {
430
+ const e = A();
431
+ e && ($e(), s.forEach((t) => $t(e, t)));
425
432
  }
426
- function jt(n) {
427
- const e = I(n.mockTemplate) && n.mockTemplate.value ? G(n.mockTemplate, {}, !0) : void 0;
428
- return async (...t) => {
429
- let s = {};
433
+ function jt(s) {
434
+ const e = T(s.mockTemplate) && s.mockTemplate.value ? G(s.mockTemplate, {}, !0) : void 0, t = A();
435
+ return async (...n) => {
436
+ let r = {};
430
437
  if (e)
431
438
  try {
432
- s = await e.apply(e, t);
433
- } catch (r) {
434
- x.warn("模拟数据模版异常", r);
439
+ r = await e.apply(e, n);
440
+ } catch (o) {
441
+ P.warn("模拟数据模版异常", o);
435
442
  }
436
- return R.mock(s);
443
+ return t?.mock(r);
437
444
  };
438
445
  }
439
- function $t(n, e) {
446
+ function $t(s, e) {
440
447
  if (!e.mock) return;
441
- const { url: t, mockTemplate: s } = e;
442
- if (t && s) {
443
- const r = Ne(`${t}(.*)`), o = Ue(t, { decode: decodeURIComponent }), a = T(s, {}, !0);
444
- n.mock(r, (i) => {
445
- const c = P.parse(i.url) || {}, l = i.body instanceof FormData ? Le(i.body) : i.body, f = o(i.url)?.params;
446
- return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
448
+ const { url: t, mockTemplate: n } = e;
449
+ if (t && n) {
450
+ const r = Ne(`${t}(.*)`), o = Ue(t, { decode: decodeURIComponent }), a = F(n, {}, !0);
451
+ s.mock(r, (i) => {
452
+ const c = R.parse(i.url) || {}, l = i.body instanceof FormData ? Le(i.body) : i.body, f = o(i.url)?.params;
453
+ return Object.assign(i, { data: l, params: c, query: f }), s.mock(a(i));
447
454
  });
448
455
  }
449
456
  }
450
457
  function $e() {
451
- R && (R._mocked = {});
458
+ const s = A();
459
+ s && (s._mocked = {});
452
460
  }
453
- class Et {
461
+ class kt {
454
462
  __id = null;
455
463
  __mode;
456
464
  __instance = null;
@@ -476,14 +484,14 @@ class Et {
476
484
  $apis = {};
477
485
  __transform = {};
478
486
  constructor(e) {
479
- const { mode: t, dsl: s, attrs: r } = e;
480
- this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
487
+ const { mode: t, dsl: n, attrs: r } = e;
488
+ this.__mode = t, n && (this.__id = n.id || null, this.__transform = n.transform || {}), r && Object.assign(this, r);
481
489
  }
482
490
  setup(e, t = N) {
483
- const s = t.getCurrentInstance();
484
- if (!s) return;
485
- this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
486
- const r = s.appContext.config.globalProperties;
491
+ const n = t.getCurrentInstance();
492
+ if (!n) return;
493
+ this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = n.proxy;
494
+ const r = n.appContext.config.globalProperties;
487
495
  Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
488
496
  this.__proxy();
489
497
  }), t.onUnmounted(() => {
@@ -508,60 +516,60 @@ class Et {
508
516
  __parseFunction(e) {
509
517
  if (e)
510
518
  if (this.__mode === y.Runtime) {
511
- const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
512
- return G({ type: s, value: r }, this);
519
+ const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
520
+ return G({ type: n, value: r }, this);
513
521
  } else
514
522
  return G(e, this);
515
523
  }
516
524
  __parseExpression(e) {
517
525
  if (e)
518
526
  if (this.__mode === y.Runtime) {
519
- const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
520
- return T({ type: s, value: r }, this);
527
+ const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
528
+ return F({ type: n, value: r }, this);
521
529
  } else
522
- return T(e, this);
530
+ return F(e, this);
523
531
  }
524
532
  __ref(e = null, t) {
525
533
  if (this.__mode !== y.VNode)
526
- return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
534
+ return e && e !== this.__id && (this.__contextRefs[e] = this), async (n) => {
527
535
  await fe(0);
528
- let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
536
+ let r = n?.$vtjEl || n?.$el || n?._?.vnode?.el || n;
529
537
  if (!r) {
530
538
  typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
531
539
  return;
532
540
  }
533
- return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, y.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] = this.__getRefEl(this.__refs, e, s)), typeof t == "function" ? t(s) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, s)), s;
541
+ return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, y.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] = this.__getRefEl(this.__refs, e, n)), typeof t == "function" ? t(n) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, n)), n;
534
542
  };
535
543
  }
536
- __getRefEl(e, t, s) {
544
+ __getRefEl(e, t, n) {
537
545
  const r = e[t];
538
- if (r && s !== r) {
539
- const o = new Set([].concat(r, s));
546
+ if (r && n !== r) {
547
+ const o = new Set([].concat(r, n));
540
548
  return Array.from(o);
541
549
  } else
542
- return s;
550
+ return n;
543
551
  }
544
552
  __clone(e = {}) {
545
- const t = { ...this.context, ...e }, s = {
553
+ const t = { ...this.context, ...e }, n = {
546
554
  ...t,
547
555
  context: t
548
556
  };
549
- return s.context.__proto__ = this.context, s.__proto__ = this, s;
557
+ return n.context.__proto__ = this.context, n.__proto__ = this, n;
550
558
  }
551
559
  }
552
- function Y(n) {
560
+ function Y(s) {
553
561
  const {
554
562
  Vue: e = N,
555
563
  mode: t = y.Runtime,
556
- components: s = {},
564
+ components: n = {},
557
565
  libs: r = {},
558
566
  apis: o = {},
559
567
  loader: a
560
- } = n, i = e.computed(() => n.dsl), c = {
561
- $components: s,
568
+ } = s, i = e.computed(() => s.dsl), c = {
569
+ $components: n,
562
570
  $libs: r,
563
571
  $apis: o
564
- }, l = new Et({
572
+ }, l = new kt({
565
573
  mode: t,
566
574
  dsl: i.value,
567
575
  attrs: c
@@ -572,101 +580,101 @@ function Y(n) {
572
580
  },
573
581
  setup(u) {
574
582
  l.$props = u, l.props = u, i.value.id && be(
575
- n.window || window,
583
+ s.window || window,
576
584
  i.value.id,
577
585
  i.value.css || ""
578
586
  ), l.state = Pt(e, i.value.state ?? {}, l);
579
- const p = xt(e, i.value.computed ?? {}, l), h = Ct(i.value.methods ?? {}, l), m = At(e, i.value.inject, l), d = Ft(
587
+ const d = xt(e, i.value.computed ?? {}, l), h = Ct(i.value.methods ?? {}, l), m = Mt(e, i.value.inject, l), p = At(
580
588
  i.value.dataSources || {},
581
589
  l
582
590
  ), w = {
583
591
  ...m,
584
- ...p,
592
+ ...d,
585
593
  ...h,
586
- ...d
594
+ ...p
587
595
  };
588
- return l.setup(w, e), Tt(e, i.value.watch ?? [], l), {
596
+ return l.setup(w, e), Ft(e, i.value.watch ?? [], l), {
589
597
  vtj: l
590
598
  };
591
599
  },
592
- emits: kt(i.value.emits),
600
+ emits: Et(i.value.emits),
593
601
  expose: ["vtj"],
594
602
  render() {
595
603
  if (!i.value.nodes) return null;
596
604
  const u = i.value.nodes || [];
597
- return u.length === 1 ? B(u[0], l, e, a) : u.map((p) => B(p, l, e, a));
605
+ return u.length === 1 ? B(u[0], l, e, a) : u.map((d) => B(d, l, e, a));
598
606
  },
599
- ...It(i.value.lifeCycles ?? {}, l)
607
+ ...Tt(i.value.lifeCycles ?? {}, l)
600
608
  });
601
609
  return {
602
610
  renderer: e.markRaw(f),
603
611
  context: l
604
612
  };
605
613
  }
606
- function kt(n = []) {
607
- return n.map((e) => j(e) ? e : e.name);
614
+ function Et(s = []) {
615
+ return s.map((e) => j(e) ? e : e.name);
608
616
  }
609
- function Rt(n = [], e) {
610
- const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => nt[o]) : void 0;
611
- return n.map((s) => j(s) ? {
612
- name: s
617
+ function Rt(s = [], e) {
618
+ const t = (n) => n ? (Array.isArray(n) ? n : [n]).map((o) => st[o]) : void 0;
619
+ return s.map((n) => j(n) ? {
620
+ name: n
613
621
  } : {
614
- name: s.name,
615
- type: s.type,
616
- required: s.required,
617
- default: _(s.default) ? e.__parseExpression(s.default) : s.default
622
+ name: n.name,
623
+ type: n.type,
624
+ required: n.required,
625
+ default: _(n.default) ? e.__parseExpression(n.default) : n.default
618
626
  }).reduce(
619
- (s, r) => (s[r.name] = {
627
+ (n, r) => (n[r.name] = {
620
628
  type: t(r.type),
621
629
  required: r.required,
622
630
  default: r.default
623
- }, s),
631
+ }, n),
624
632
  {}
625
633
  );
626
634
  }
627
- function Pt(n, e, t) {
628
- return n.reactive(
635
+ function Pt(s, e, t) {
636
+ return s.reactive(
629
637
  Object.keys(e || {}).reduce(
630
- (s, r) => {
638
+ (n, r) => {
631
639
  let o = e[r];
632
- return _(o) ? o = t.__parseExpression(o) : I(o) && (o = t.__parseFunction(o)), s[r] = o, s;
640
+ return _(o) ? o = t.__parseExpression(o) : T(o) && (o = t.__parseFunction(o)), n[r] = o, n;
633
641
  },
634
642
  {}
635
643
  )
636
644
  );
637
645
  }
638
- function xt(n, e, t) {
646
+ function xt(s, e, t) {
639
647
  return Object.entries(e ?? {}).reduce(
640
- (s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
648
+ (n, [r, o]) => (n[r] = s.computed(t.__parseFunction(o)), n),
641
649
  {}
642
650
  );
643
651
  }
644
- function Ct(n, e) {
645
- return Object.entries(n ?? {}).reduce(
646
- (t, [s, r]) => (t[s] = e.__parseFunction(r), t),
652
+ function Ct(s, e) {
653
+ return Object.entries(s ?? {}).reduce(
654
+ (t, [n, r]) => (t[n] = e.__parseFunction(r), t),
647
655
  {}
648
656
  );
649
657
  }
650
- function At(n, e = [], t) {
658
+ function Mt(s, e = [], t) {
651
659
  return e.reduce(
652
- (s, r) => {
660
+ (n, r) => {
653
661
  const { name: o, from: a } = r || {};
654
662
  r.default;
655
663
  const i = _(a) ? t.__parseExpression(a) || o : a ?? o, c = _(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
656
- return s[o] = n.inject(i, c), s;
664
+ return n[o] = s.inject(i, c), n;
657
665
  },
658
666
  {}
659
667
  );
660
668
  }
661
- function Ft(n, e) {
662
- return Object.keys(n).reduce(
663
- (t, s) => {
664
- const r = n[s];
669
+ function At(s, e) {
670
+ return Object.keys(s).reduce(
671
+ (t, n) => {
672
+ const r = s[n];
665
673
  if (r.type === "mock")
666
- t[s] = jt(r);
674
+ t[n] = jt(r);
667
675
  else if (r.ref) {
668
- const o = e.$apis[r.ref], a = I(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
669
- t[s] = async (...i) => {
676
+ const o = e.$apis[r.ref], a = T(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
677
+ t[n] = async (...i) => {
670
678
  const c = await o.apply(e, i);
671
679
  return a ? a(c) : c;
672
680
  };
@@ -676,71 +684,71 @@ function Ft(n, e) {
676
684
  {}
677
685
  );
678
686
  }
679
- function Tt(n, e = [], t) {
680
- e.forEach((s) => {
681
- n.watch(
682
- t.__parseExpression(s.source),
683
- t.__parseFunction(s.handler),
687
+ function Ft(s, e = [], t) {
688
+ e.forEach((n) => {
689
+ s.watch(
690
+ t.__parseExpression(n.source),
691
+ t.__parseFunction(n.handler),
684
692
  {
685
- deep: s.deep,
686
- immediate: s.immediate
693
+ deep: n.deep,
694
+ immediate: n.immediate
687
695
  }
688
696
  );
689
697
  });
690
698
  }
691
- function It(n, e) {
692
- return Object.entries(n ?? {}).reduce(
693
- (t, [s, r]) => (t[s] = e.__parseFunction(r), t),
699
+ function Tt(s, e) {
700
+ return Object.entries(s ?? {}).reduce(
701
+ (t, [n, r]) => (t[n] = e.__parseFunction(r), t),
694
702
  {}
695
703
  );
696
704
  }
697
- let z = [], k = {};
698
- const Mt = (n) => n;
699
- async function Ee(n, e = window) {
700
- const { urls: t = [], library: s } = n, r = t.filter((i) => ne(i));
701
- if (r.length === 0 || !s) return null;
702
- const o = t.filter((i) => se(i));
703
- return o.length && pt(o, e), await dt(r, s, e).catch(
704
- (i) => (console.warn("loadScriptUrl error", r, s, i), null)
705
+ let z = [], E = {};
706
+ const It = (s) => s;
707
+ async function ke(s, e = window) {
708
+ const { urls: t = [], library: n } = s, r = t.filter((i) => se(i));
709
+ if (r.length === 0 || !n) return null;
710
+ const o = t.filter((i) => ne(i));
711
+ return o.length && dt(o, e), await pt(r, n, e).catch(
712
+ (i) => (console.warn("loadScriptUrl error", r, n, i), null)
705
713
  );
706
714
  }
707
- function Q(n) {
708
- const { getDsl: e, getDslByUrl: t, options: s } = n;
709
- return s.window && (z.forEach((r) => {
710
- delete s.window[r];
715
+ function Q(s) {
716
+ const { getDsl: e, getDslByUrl: t, options: n } = s;
717
+ return n.window && (z.forEach((r) => {
718
+ delete n.window[r];
711
719
  }), z = []), (r, o, a = N) => {
712
720
  if (!o || typeof o == "string") return r;
713
721
  if (o.type === "Schema" && o.id) {
714
- let i = k[o.id];
715
- return i || (i = k[o.id] = a.defineAsyncComponent(async () => {
722
+ let i = E[o.id];
723
+ return i || (i = E[o.id] = a.defineAsyncComponent(async () => {
716
724
  const c = await e(o.id);
717
725
  return c && (c.name = r), c ? Y({
718
- ...s,
726
+ ...n,
719
727
  Vue: a,
720
728
  dsl: c,
721
729
  mode: y.Runtime,
722
- loader: Q(n)
730
+ loader: Q(s)
723
731
  }).renderer : null;
724
732
  }), i);
725
733
  }
726
734
  if (o.type === "UrlSchema" && o.url) {
727
- let i = k[o.url];
728
- return i || (i = k[o.url] = a.defineAsyncComponent(async () => {
735
+ let i = E[o.url];
736
+ return i || (i = E[o.url] = a.defineAsyncComponent(async () => {
729
737
  const c = await t(o.url);
730
738
  return c && (c.name = r), c ? Y({
731
- ...s,
739
+ ...n,
732
740
  Vue: a,
733
741
  dsl: c,
734
742
  mode: y.Runtime,
735
- loader: Q(n)
743
+ loader: Q(s)
736
744
  }).renderer : null;
737
745
  }), i);
738
746
  }
739
747
  if (o.type === "Plugin") {
740
- let i = o.library ? k[o.library] : null;
741
- return i || (o.library && z.push(o.library), i = k[o.library || Symbol()] = a.defineAsyncComponent(
748
+ let i = o.library ? E[o.library] : null;
749
+ return i || (o.library && z.push(o.library), i = E[o.library || Symbol()] = a.defineAsyncComponent(
742
750
  async () => {
743
- const c = await Ee(o, s.window);
751
+ const c = await ke(o, n.window);
744
752
  return c || (console.warn("getPlugin result is null", o), null);
745
753
  }
746
754
  ), i);
@@ -748,145 +756,145 @@ function Q(n) {
748
756
  return r;
749
757
  };
750
758
  }
751
- function Ms() {
752
- k = {};
759
+ function In() {
760
+ E = {};
753
761
  }
754
- function B(n, e, t = N, s = Mt) {
755
- if (!n || !n.name || n.invisible) return null;
756
- 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 } = Ht(a);
762
+ function B(s, e, t = N, n = It) {
763
+ if (!s || !s.name || s.invisible) return null;
764
+ const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = s, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: d, others: h } = Ht(a);
757
765
  if (i && !Ot(i, e))
758
766
  return null;
759
- const m = (d) => {
760
- const w = d.$components, g = (() => {
761
- if (n.name === "component")
762
- return Bt(d, n.props?.is);
763
- if (n.name === "slot") return n.name;
764
- const b = s(n.name, n.from, t);
767
+ const m = (p) => {
768
+ const w = p.$components, g = (() => {
769
+ if (s.name === "component")
770
+ return Bt(p, s.props?.is);
771
+ if (s.name === "slot") return s.name;
772
+ const b = n(s.name, s.from, t);
765
773
  return j(b) ? ht(b) || mt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
766
- })(), S = Nt(o, n.props ?? {}, d), Te = Ut(t, n.events ?? {}, d);
767
- if (n.name === "slot")
768
- return Lt(t, n, S, d, s);
769
- u && Object.assign(S, d.__parseExpression(u.value)), l && (S.style = Object.assign(
774
+ })(), S = Nt(o, s.props ?? {}, p), Fe = Ut(t, s.events ?? {}, p);
775
+ if (s.name === "slot")
776
+ return Lt(t, s, S, p, n);
777
+ u && Object.assign(S, p.__parseExpression(u.value)), l && (S.style = Object.assign(
770
778
  S.style ?? {},
771
- Jt(l, d)
772
- )), p && Object.assign(S, zt(p, d)), f.forEach((b) => {
773
- Object.assign(S, Vt(t, b, d));
779
+ Jt(l, p)
780
+ )), d && Object.assign(S, zt(d, p)), f.forEach((b) => {
781
+ Object.assign(S, Vt(t, b, p));
774
782
  });
775
- const Ie = Kt(
783
+ const Te = Kt(
776
784
  t,
777
- n.children ?? [],
778
- d,
779
- s,
780
- n
785
+ s.children ?? [],
786
+ p,
787
+ n,
788
+ s
781
789
  );
782
- let U = t.createVNode(g, { ...S, ...Te }, Ie);
783
- const oe = r ? Dt(r, h, d) : [];
790
+ let U = t.createVNode(g, { ...S, ...Fe }, Te);
791
+ const oe = r ? Dt(r, h, p) : [];
784
792
  return oe.length && (U = t.withDirectives(U, oe)), U;
785
793
  };
786
794
  return c ? Yt(c, m, e) : m(e);
787
795
  }
788
- function Dt(n, e, t) {
789
- const s = n.app;
796
+ function Dt(s, e, t) {
797
+ const n = s.app;
790
798
  return e.map((r) => {
791
- const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
799
+ const o = typeof r.name == "string" ? n.directive(r.name) : t.__parseExpression(r.name);
792
800
  if (!o) return null;
793
801
  const a = [o];
794
802
  return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
795
803
  }).filter((r) => !!r);
796
804
  }
797
- function Ht(n = []) {
798
- 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(
805
+ function Ht(s = []) {
806
+ const e = s.find((c) => $(c.name) === "vIf"), t = s.find((c) => $(c.name) === "vFor"), n = s.find((c) => $(c.name) === "vShow"), r = s.find((c) => $(c.name) === "vBind"), o = s.find((c) => $(c.name) === "vHtml"), a = s.filter(
799
807
  (c) => $(c.name) === "vModel"
800
- ), i = n.filter(
801
- (c) => !st.includes($(c.name))
808
+ ), i = s.filter(
809
+ (c) => !nt.includes($(c.name))
802
810
  );
803
811
  return {
804
812
  vIf: e,
805
813
  vFor: t,
806
- vShow: s,
814
+ vShow: n,
807
815
  vModels: a,
808
816
  vBind: r,
809
817
  others: i,
810
818
  vHtml: o
811
819
  };
812
820
  }
813
- function Ot(n, e) {
814
- return !!e.__parseExpression(n.value);
821
+ function Ot(s, e) {
822
+ return !!e.__parseExpression(s.value);
815
823
  }
816
- function Bt(n, e) {
817
- return e ? _(e) ? n.__parseExpression(e) : e : "div";
824
+ function Bt(s, e) {
825
+ return e ? _(e) ? s.__parseExpression(e) : e : "div";
818
826
  }
819
- function Nt(n, e, t) {
820
- const s = X(e, t);
821
- return s.ref = t.__ref(n, s.ref), s;
827
+ function Nt(s, e, t) {
828
+ const n = X(e, t);
829
+ return n.ref = t.__ref(s, n.ref), n;
822
830
  }
823
- function X(n, e) {
824
- return _(n) ? e.__parseExpression(n) : I(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => X(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
825
- (t, s) => {
826
- let r = n[s];
827
- return t[s] = X(r, e), t;
831
+ function X(s, e) {
832
+ return _(s) ? e.__parseExpression(s) : T(s) ? e.__parseFunction(s) : Array.isArray(s) ? s.map((t) => X(t, e)) : typeof s == "object" ? Object.keys(s || {}).reduce(
833
+ (t, n) => {
834
+ let r = s[n];
835
+ return t[n] = X(r, e), t;
828
836
  },
829
837
  {}
830
- ) : n;
838
+ ) : s;
831
839
  }
832
- function Ut(n, e, t) {
833
- const s = ["passive", "capture", "once"], r = {
840
+ function Ut(s, e, t) {
841
+ const n = ["passive", "capture", "once"], r = {
834
842
  capture: "Capture",
835
843
  once: "Once",
836
844
  passive: "OnceCapture"
837
845
  };
838
846
  return Object.keys(e || {}).reduce(
839
847
  (o, a) => {
840
- const i = e[a], c = ke(i.modifiers), l = c.find((p) => s.includes(p)), f = "on" + qe(a) + (l && r[l] || ""), u = t.__parseFunction(i.handler);
841
- return u && (o[f] = n.withModifiers(u, c)), o;
848
+ const i = e[a], c = Ee(i.modifiers), l = c.find((d) => n.includes(d)), f = "on" + qe(a) + (l && r[l] || ""), u = t.__parseFunction(i.handler);
849
+ return u && (o[f] = s.withModifiers(u, c)), o;
842
850
  },
843
851
  {}
844
852
  );
845
853
  }
846
- function ke(n = {}, e = !1) {
847
- const t = Object.keys(n);
848
- return e ? t.map((s) => "." + s) : t;
854
+ function Ee(s = {}, e = !1) {
855
+ const t = Object.keys(s);
856
+ return e ? t.map((n) => "." + n) : t;
849
857
  }
850
- function Lt(n, e, t, s, r) {
851
- const { children: o } = e, a = qt(e, s), i = s.$slots?.[a.name];
852
- return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
853
- Se(s.__parseExpression(o))
858
+ function Lt(s, e, t, n, r) {
859
+ const { children: o } = e, a = qt(e, n), i = n.$slots?.[a.name];
860
+ return i ? i(t) : o ? j(o) ? s.createTextVNode(o) : _(o) ? s.createTextVNode(
861
+ Se(n.__parseExpression(o))
854
862
  ) : Array.isArray(o) ? o.map(
855
- (c) => B(c, s, n, r)
863
+ (c) => B(c, n, s, r)
856
864
  ) : null : null;
857
865
  }
858
- function qt(n, e) {
859
- const { props: t } = n, s = t?.name || "default";
866
+ function qt(s, e) {
867
+ const { props: t } = s, n = t?.name || "default";
860
868
  return {
861
- name: _(s) ? e.__parseExpression(s) : s,
869
+ name: _(n) ? e.__parseExpression(n) : n,
862
870
  params: []
863
871
  };
864
872
  }
865
- function Jt(n, e) {
866
- return e.__parseExpression(n.value) ? {} : {
873
+ function Jt(s, e) {
874
+ return e.__parseExpression(s.value) ? {} : {
867
875
  display: "none"
868
876
  };
869
877
  }
870
- function zt(n, e) {
878
+ function zt(s, e) {
871
879
  return {
872
- innerHTML: e.__parseExpression(n.value) || ""
880
+ innerHTML: e.__parseExpression(s.value) || ""
873
881
  };
874
882
  }
875
- function Vt(n, e, t) {
876
- const s = {
883
+ function Vt(s, e, t) {
884
+ const n = {
877
885
  type: "JSFunction",
878
886
  value: e.value?.value ? `(v) => {
879
887
  ${e.value.value} = v;
880
888
  }` : "(v) => {}"
881
- }, r = t.__parseFunction(s), o = ke(
889
+ }, r = t.__parseFunction(n), o = Ee(
882
890
  _(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
883
891
  ), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
884
892
  return {
885
893
  [a]: t.__parseExpression(e.value),
886
- [`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
894
+ [`onUpdate:${a}`]: o.length && r ? s.withModifiers(r, o) : r
887
895
  };
888
896
  }
889
- function Kt(n, e, t, s, r) {
897
+ function Kt(s, e, t, n, r) {
890
898
  if (!e) return null;
891
899
  if (j(e))
892
900
  return { default: () => e };
@@ -899,88 +907,88 @@ function Kt(n, e, t, s, r) {
899
907
  [`scope_${r.id}`]: i
900
908
  } : {};
901
909
  return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
902
- const p = f.length ? Je(u ?? {}, f) : a(u);
910
+ const d = f.length ? Je(u ?? {}, f) : a(u);
903
911
  return l.map(
904
- (h) => B(h, t.__clone(p), n, s)
912
+ (h) => B(h, t.__clone(d), s, n)
905
913
  );
906
914
  }, i), {});
907
915
  }
908
916
  return null;
909
917
  }
910
- function Wt(n) {
918
+ function Wt(s) {
911
919
  const e = {
912
920
  default: {
913
921
  params: [],
914
922
  nodes: []
915
923
  }
916
924
  };
917
- for (const t of n) {
918
- const s = Gt(t.slot), r = s.name;
919
- e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
925
+ for (const t of s) {
926
+ const n = Gt(t.slot), r = n.name;
927
+ e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(n.params)) : e[r] = {
920
928
  nodes: [t],
921
- params: s.params
929
+ params: n.params
922
930
  };
923
931
  }
924
932
  return e;
925
933
  }
926
- function Gt(n = "default") {
927
- return j(n) ? { name: n, params: [] } : { params: [], ...n };
934
+ function Gt(s = "default") {
935
+ return j(s) ? { name: s, params: [] } : { params: [], ...s };
928
936
  }
929
- function Yt(n, e, t) {
930
- const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
931
- let i = t.__parseExpression(s) || [];
932
- 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`), []);
937
+ function Yt(s, e, t) {
938
+ const { value: n, iterator: r } = s, { item: o = "item", index: a = "index" } = r || {};
939
+ let i = t.__parseExpression(n) || [];
940
+ 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]:", `${n?.value} is not a Arrary`), []);
933
941
  }
934
- function Qt(n) {
935
- return Ye() ? (Qe(n), !0) : !1;
942
+ function Qt(s) {
943
+ return Ye() ? (Qe(s), !0) : !1;
936
944
  }
937
945
  const Re = typeof window < "u" && typeof document < "u";
938
946
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
939
- const Xt = (n) => n != null, Zt = () => {
947
+ const Xt = (s) => s != null, Zt = () => {
940
948
  };
941
- function es(n) {
949
+ function en(s) {
942
950
  return ve();
943
951
  }
944
- function ts(n) {
945
- return Array.isArray(n) ? n : [n];
952
+ function tn(s) {
953
+ return Array.isArray(s) ? s : [s];
946
954
  }
947
- function ss(...n) {
948
- if (n.length !== 1)
949
- return Ve(...n);
950
- const e = n[0];
951
- return typeof e == "function" ? Ke(We(() => ({ get: e, set: Zt }))) : F(e);
955
+ function nn(...s) {
956
+ if (s.length !== 1)
957
+ return Ve(...s);
958
+ const e = s[0];
959
+ return typeof e == "function" ? Ke(We(() => ({ get: e, set: Zt }))) : M(e);
952
960
  }
953
- function ns(n, e) {
954
- es() && Ge(n, e);
961
+ function sn(s, e) {
962
+ en() && Ge(s, e);
955
963
  }
956
- const rs = Re ? window : void 0, os = Re ? window.document : void 0;
957
- function is(n) {
964
+ const rn = Re ? window : void 0, on = Re ? window.document : void 0;
965
+ function an(s) {
958
966
  var e;
959
- const t = ee(n);
967
+ const t = ee(s);
960
968
  return (e = t?.$el) != null ? e : t;
961
969
  }
962
- function as() {
963
- const n = F(!1), e = ve();
970
+ function cn() {
971
+ const s = M(!1), e = ve();
964
972
  return e && Xe(() => {
965
- n.value = !0;
966
- }, e), n;
973
+ s.value = !0;
974
+ }, e), s;
967
975
  }
968
- function cs(n) {
969
- const e = as();
970
- return _e(() => (e.value, !!n()));
976
+ function ln(s) {
977
+ const e = cn();
978
+ return _e(() => (e.value, !!s()));
971
979
  }
972
- function ls(n, e, t = {}) {
973
- const { window: s = rs, ...r } = t;
980
+ function un(s, e, t = {}) {
981
+ const { window: n = rn, ...r } = t;
974
982
  let o;
975
- const a = cs(() => s && "MutationObserver" in s), i = () => {
983
+ const a = ln(() => n && "MutationObserver" in n), i = () => {
976
984
  o && (o.disconnect(), o = void 0);
977
985
  }, c = _e(() => {
978
- const p = ee(n), h = ts(p).map(is).filter(Xt);
986
+ const d = ee(s), h = tn(d).map(an).filter(Xt);
979
987
  return new Set(h);
980
988
  }), l = ye(
981
989
  () => c.value,
982
- (p) => {
983
- i(), a.value && p.size && (o = new MutationObserver(e), p.forEach((h) => o.observe(h, r)));
990
+ (d) => {
991
+ i(), a.value && d.size && (o = new MutationObserver(e), d.forEach((h) => o.observe(h, r)));
984
992
  },
985
993
  { immediate: !0, flush: "post" }
986
994
  ), f = () => o?.takeRecords(), u = () => {
@@ -992,45 +1000,45 @@ function ls(n, e, t = {}) {
992
1000
  takeRecords: f
993
1001
  };
994
1002
  }
995
- function us(n = null, e = {}) {
996
- var t, s, r;
1003
+ function dn(s = null, e = {}) {
1004
+ var t, n, r;
997
1005
  const {
998
- document: o = os,
1006
+ document: o = on,
999
1007
  restoreOnUnmount: a = (u) => u
1000
- } = e, i = (t = o?.title) != null ? t : "", c = ss((s = n ?? o?.title) != null ? s : null), l = !!(n && typeof n == "function");
1008
+ } = e, i = (t = o?.title) != null ? t : "", c = nn((n = s ?? o?.title) != null ? n : null), l = !!(s && typeof s == "function");
1001
1009
  function f(u) {
1002
1010
  if (!("titleTemplate" in e))
1003
1011
  return u;
1004
- const p = e.titleTemplate || "%s";
1005
- return typeof p == "function" ? p(u) : ee(p).replace(/%s/g, u);
1012
+ const d = e.titleTemplate || "%s";
1013
+ return typeof d == "function" ? d(u) : ee(d).replace(/%s/g, u);
1006
1014
  }
1007
1015
  return ye(
1008
1016
  c,
1009
- (u, p) => {
1010
- u !== p && o && (o.title = f(u ?? ""));
1017
+ (u, d) => {
1018
+ u !== d && o && (o.title = f(u ?? ""));
1011
1019
  },
1012
1020
  { immediate: !0 }
1013
- ), e.observe && !e.titleTemplate && o && !l && ls(
1021
+ ), e.observe && !e.titleTemplate && o && !l && un(
1014
1022
  (r = o.head) == null ? void 0 : r.querySelector("title"),
1015
1023
  () => {
1016
1024
  o && o.title !== c.value && (c.value = f(o.title));
1017
1025
  },
1018
1026
  { childList: !0 }
1019
- ), ns(() => {
1027
+ ), sn(() => {
1020
1028
  if (a) {
1021
1029
  const u = a(i, c.value || "");
1022
1030
  u != null && o && (o.title = u);
1023
1031
  }
1024
1032
  }), c;
1025
1033
  }
1026
- const pe = te({
1034
+ const de = te({
1027
1035
  name: "VtjPageContainer",
1028
1036
  async setup() {
1029
- const n = xe(), e = we(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = F(Symbol());
1030
- return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), us(s.title || "VTJ")), {
1031
- provider: n,
1037
+ const s = xe(), e = we(), t = e.params.id, n = t ? s.getPage(t) : s.getHomepage(), r = n ? await s.getRenderComponent(n.id) : null, o = M(Symbol());
1038
+ return n && (Object.assign(e.meta, n.meta || {}, { cache: n.cache }), dn(n.title || "VTJ")), {
1039
+ provider: s,
1032
1040
  component: r,
1033
- file: s,
1041
+ file: n,
1034
1042
  query: e.query,
1035
1043
  meta: e.meta,
1036
1044
  sid: o,
@@ -1038,28 +1046,28 @@ const pe = te({
1038
1046
  };
1039
1047
  },
1040
1048
  render() {
1041
- const { component: n, query: e, sid: t } = this;
1042
- return n ? W(n, { ...e, key: t }) : W("div", "页面不存在");
1049
+ const { component: s, query: e, sid: t } = this;
1050
+ return s ? W(s, { ...e, key: t }) : W("div", "页面不存在");
1043
1051
  },
1044
1052
  activated() {
1045
1053
  this.meta.cache === !1 && (this.sid = Symbol());
1046
1054
  }
1047
- }), ps = {
1055
+ }), pn = {
1048
1056
  "data-l-h6o7ki7": "",
1049
1057
  class: "vtj-startup__wrapper"
1050
- }, ds = {
1058
+ }, fn = {
1051
1059
  "data-l-h6o7ki7": "",
1052
1060
  class: "vtj-startup"
1053
- }, fs = {
1061
+ }, hn = {
1054
1062
  "data-l-h6o7ki7": "",
1055
1063
  class: "vtj-startup__name"
1056
- }, hs = { "data-l-h6o7ki7": "" }, ms = {
1064
+ }, mn = { "data-l-h6o7ki7": "" }, gn = {
1057
1065
  "data-l-h6o7ki7": "",
1058
1066
  class: "vtj-startup__tagline"
1059
- }, gs = {
1067
+ }, vn = {
1060
1068
  "data-l-h6o7ki7": "",
1061
1069
  class: "vtj-startup__actions"
1062
- }, vs = /* @__PURE__ */ te({
1070
+ }, yn = /* @__PURE__ */ te({
1063
1071
  __name: "Startup",
1064
1072
  props: {
1065
1073
  name: { default: "VTJ.PRO" },
@@ -1067,7 +1075,7 @@ const pe = te({
1067
1075
  actionText: { default: "开始设计" },
1068
1076
  link: {}
1069
1077
  },
1070
- setup(n) {
1078
+ setup(s) {
1071
1079
  ((r, o) => {
1072
1080
  let a = document.getElementById("h6o7ki7");
1073
1081
  a || (a = document.createElement("style"), a.id = "h6o7ki7", document.head.appendChild(a), a.innerHTML = o);
@@ -1151,7 +1159,7 @@ const pe = te({
1151
1159
  .vtj-startup__actions .button[data-l-h6o7ki7]:hover{
1152
1160
  opacity: 0.7;
1153
1161
  }`);
1154
- const t = n, s = () => {
1162
+ const t = s, n = () => {
1155
1163
  if (typeof window < "u") {
1156
1164
  if (t.link) {
1157
1165
  typeof t.link == "function" ? t.link() : window.location.href = t.link;
@@ -1161,39 +1169,39 @@ const pe = te({
1161
1169
  window.location.href = o;
1162
1170
  }
1163
1171
  };
1164
- return (r, o) => (et(), Ze("div", ps, [
1165
- E("div", ds, [
1166
- E("h1", fs, [
1167
- E("span", hs, J(t.name), 1)
1172
+ return (r, o) => (et(), Ze("div", pn, [
1173
+ k("div", fn, [
1174
+ k("h1", hn, [
1175
+ k("span", mn, J(t.name), 1)
1168
1176
  ]),
1169
- E("div", ms, J(t.tagline), 1),
1170
- E("div", gs, [
1171
- o[0] || (o[0] = E("span", {
1177
+ k("div", gn, J(t.tagline), 1),
1178
+ k("div", vn, [
1179
+ o[0] || (o[0] = k("span", {
1172
1180
  "data-l-h6o7ki7": "",
1173
1181
  class: "span"
1174
1182
  }, "设置项目主页后,将替换此页面显示", -1)),
1175
- E("span", {
1183
+ k("span", {
1176
1184
  "data-l-h6o7ki7": "",
1177
1185
  class: "button",
1178
- onClick: s
1186
+ onClick: n
1179
1187
  }, J(t.actionText), 1)
1180
1188
  ])
1181
1189
  ])
1182
1190
  ]));
1183
1191
  }
1184
- }), ys = te({
1192
+ }), _n = te({
1185
1193
  name: "VtjStartupContainer",
1186
1194
  render() {
1187
- return W(vs);
1195
+ return W(yn);
1188
1196
  }
1189
1197
  }), Pe = Symbol("Provider");
1190
- var _s = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(_s || {});
1191
- class ws extends Me {
1198
+ var wn = /* @__PURE__ */ ((s) => (s.Production = "production", s.Development = "development", s))(wn || {});
1199
+ class Sn extends Ie {
1192
1200
  constructor(e) {
1193
1201
  super(), this.options = e;
1194
1202
  const {
1195
1203
  service: t,
1196
- mode: s = y.Raw,
1204
+ mode: n = y.Raw,
1197
1205
  dependencies: r,
1198
1206
  materials: o,
1199
1207
  project: a = {},
@@ -1202,14 +1210,12 @@ class ws extends Me {
1202
1210
  modules: l = {},
1203
1211
  router: f = null,
1204
1212
  materialPath: u = "./",
1205
- nodeEnv: p = "development"
1213
+ nodeEnv: d = "development"
1206
1214
  /* Development */
1207
1215
  } = e;
1208
- 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);
1216
+ this.mode = n, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = d, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, c), Object.assign(this.adapter, i);
1209
1217
  const { access: h, request: m } = this.adapter;
1210
- h && h.connect({ mode: s, router: f, request: m }), a && s !== y.Design ? this.load(a) : this.project = a, R.setup({
1211
- timeout: "50-500"
1212
- });
1218
+ h && h.connect({ mode: n, router: f, request: m }), a && n !== y.Design ? this.load(a) : this.project = a;
1213
1219
  }
1214
1220
  mode;
1215
1221
  globals = {};
@@ -1228,35 +1234,41 @@ class ws extends Me {
1228
1234
  urlDslCaches = {};
1229
1235
  createMock(e) {
1230
1236
  return async (...t) => {
1231
- let s = {};
1237
+ let n = {};
1232
1238
  if (e)
1233
1239
  try {
1234
- s = await e.apply(e, t);
1235
- } catch (r) {
1236
- x.warn("模拟数据模版异常", r);
1240
+ n = await e.apply(e, t);
1241
+ } catch (o) {
1242
+ P.warn("模拟数据模版异常", o);
1237
1243
  }
1238
- return R.mock(s);
1244
+ return A()?.mock(n);
1239
1245
  };
1240
1246
  }
1241
1247
  async load(e) {
1242
1248
  const t = this.modules[`.vtj/projects/${e.id}.json`];
1243
1249
  if (this.project = t ? await t() : await this.service.init(e), !this.project)
1244
1250
  throw new Error("project is null");
1245
- const { apis: s = [], meta: r = [] } = this.project, o = window;
1246
- o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis = St(s, r, this.adapter), $e(), bt(s), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
1251
+ const { apis: n = [], meta: r = [] } = this.project, o = window;
1252
+ o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.initMock(o), this.apis = St(n, r, this.adapter), $e(), bt(n), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
1253
+ }
1254
+ initMock(e) {
1255
+ const t = A(e);
1256
+ t && t.setup({
1257
+ timeout: "50-500"
1258
+ });
1247
1259
  }
1248
1260
  async loadDependencies(e) {
1249
1261
  const t = Object.entries(this.dependencies);
1250
- for (const [s, r] of t)
1251
- e[s] || (e[s] = this.library[s] = await r());
1262
+ for (const [n, r] of t)
1263
+ e[n] || (e[n] = this.library[n] = await r());
1252
1264
  }
1253
1265
  async loadAssets(e) {
1254
- const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
1266
+ const { dependencies: t = [] } = this.project, { dependencies: n, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
1255
1267
  libraryExports: c,
1256
1268
  libraryMap: l,
1257
1269
  materials: f,
1258
1270
  materialExports: u,
1259
- materialMapLibrary: p
1271
+ materialMapLibrary: d
1260
1272
  } = ct(
1261
1273
  t,
1262
1274
  a,
@@ -1264,86 +1276,86 @@ class ws extends Me {
1264
1276
  /* Development */
1265
1277
  );
1266
1278
  for (const h of c) {
1267
- const m = s[h], d = e[h];
1268
- if (d)
1269
- r[h] = d;
1279
+ const m = n[h], p = e[h];
1280
+ if (p)
1281
+ r[h] = p;
1270
1282
  else if (m)
1271
1283
  e[h] = r[h] = await m();
1272
1284
  else {
1273
1285
  const w = l[h] || [];
1274
1286
  for (const g of w)
1275
- se(g) && await ut(h, P.append(g, { v: C })), ne(g) && await ce(P.append(g, { v: C }));
1287
+ ne(g) && await ut(h, R.append(g, { v: x })), se(g) && await ce(R.append(g, { v: x }));
1276
1288
  r[h] = e[h];
1277
1289
  }
1278
1290
  }
1279
1291
  if (i === "development") {
1280
1292
  for (const m of f)
1281
- await ce(P.append(m, { v: C }));
1293
+ await ce(R.append(m, { v: x }));
1282
1294
  const h = this.materials || {};
1283
1295
  for (const m of u) {
1284
- const d = e[p[m]], w = De[m];
1296
+ const p = e[d[m]], w = De[m];
1285
1297
  if (w)
1286
- d && w.forEach((g) => {
1287
- o[g] = d[g];
1298
+ p && w.forEach((g) => {
1299
+ o[g] = p[g];
1288
1300
  });
1289
1301
  else {
1290
1302
  const g = h[m] ? (await h[m]()).default : e[m];
1291
- g && d && (g.components || []).forEach((S) => {
1292
- o[S.name] = lt(S, d);
1303
+ g && p && (g.components || []).forEach((S) => {
1304
+ o[S.name] = lt(S, p);
1293
1305
  });
1294
1306
  }
1295
1307
  }
1296
1308
  }
1297
1309
  }
1298
1310
  initRouter() {
1299
- const { router: e, project: t, options: s, adapter: r } = this;
1311
+ const { router: e, project: t, options: n, adapter: r } = this;
1300
1312
  if (!e) return;
1301
- const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, c = o ? "" : "/", l = {
1313
+ const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = n, c = o ? "" : "/", l = {
1302
1314
  path: `${c}${a}/:id`,
1303
- name: A,
1304
- component: pe
1315
+ name: C,
1316
+ component: de
1305
1317
  }, f = {
1306
1318
  path: c,
1307
1319
  name: H,
1308
- component: t?.homepage ? pe : r.startupComponent || ys,
1320
+ component: t?.homepage ? de : r.startupComponent || _n,
1309
1321
  meta: i
1310
1322
  };
1311
- e.hasRoute(A) && e.removeRoute(A), e.hasRoute(H) && e.removeRoute(H), o ? (e.addRoute(o, l), e.addRoute(o, f)) : (e.addRoute(l), e.addRoute(f));
1323
+ e.hasRoute(C) && e.removeRoute(C), e.hasRoute(H) && e.removeRoute(H), o ? (e.addRoute(o, l), e.addRoute(o, f)) : (e.addRoute(l), e.addRoute(f));
1312
1324
  }
1313
1325
  install(e) {
1314
1326
  const t = e.config.globalProperties.installed || {};
1315
- for (const [s, r] of Object.entries(this.library))
1316
- !t[s] && ft(r) && (e.use(r), t[s] = !0);
1317
- this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Pe, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
1318
- const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
1327
+ for (const [n, r] of Object.entries(this.library))
1328
+ !t[n] && ft(r) && (e.use(r), t[n] = !0);
1329
+ this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Pe, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (n, r, o) => {
1330
+ const a = r?.$options.name, i = typeof n == "string" ? n : n?.message || n?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
1319
1331
  console.error(
1320
1332
  "[VTJ Error]:",
1321
1333
  {
1322
- err: s,
1334
+ err: n,
1323
1335
  instance: r,
1324
1336
  info: o
1325
1337
  },
1326
- s?.stack
1338
+ n?.stack
1327
1339
  ), this.adapter.notify && this.adapter.notify(c, "组件渲染错误", "error");
1328
1340
  });
1329
1341
  }
1330
1342
  getFile(e) {
1331
1343
  const { blocks: t = [] } = this.project || {};
1332
- return this.getPage(e) || t.find((s) => s.id === e) || null;
1344
+ return this.getPage(e) || t.find((n) => n.id === e) || null;
1333
1345
  }
1334
1346
  getPage(e) {
1335
- const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
1347
+ const { pages: t = [] } = this.project || {}, n = (r, o = []) => {
1336
1348
  for (const a of o) {
1337
1349
  if (a.id === r)
1338
1350
  return a;
1339
1351
  if (a.children && a.children.length) {
1340
- const i = s(r, a.children);
1352
+ const i = n(r, a.children);
1341
1353
  if (i)
1342
1354
  return i;
1343
1355
  }
1344
1356
  }
1345
1357
  };
1346
- return s(e, t) || null;
1358
+ return n(e, t) || null;
1347
1359
  }
1348
1360
  getHomepage() {
1349
1361
  const { homepage: e } = this.project || {};
@@ -1362,14 +1374,14 @@ class ws extends Me {
1362
1374
  validSuccess: !1,
1363
1375
  originResponse: !0
1364
1376
  }
1365
- }).then((s) => s.data).catch(() => null));
1377
+ }).then((n) => n.data).catch(() => null));
1366
1378
  }
1367
1379
  createDslRenderer(e, t = {}) {
1368
- const { library: s, components: r, mode: o, apis: a } = this, i = {
1380
+ const { library: n, components: r, mode: o, apis: a } = this, i = {
1369
1381
  mode: o,
1370
- Vue: s.Vue,
1382
+ Vue: n.Vue,
1371
1383
  components: r,
1372
- libs: s,
1384
+ libs: n,
1373
1385
  apis: a,
1374
1386
  window,
1375
1387
  ...t
@@ -1385,42 +1397,42 @@ class ws extends Me {
1385
1397
  });
1386
1398
  }
1387
1399
  async getRenderComponent(e, t) {
1388
- const s = this.getFile(e);
1389
- if (!s)
1390
- return x.warn(`Can not find file: ${e}`), null;
1391
- t && t(s);
1400
+ const n = this.getFile(e);
1401
+ if (!n)
1402
+ return P.warn(`Can not find file: ${e}`), null;
1403
+ t && t(n);
1392
1404
  const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
1393
1405
  if (o)
1394
1406
  return (await o())?.default;
1395
- const a = await this.getDsl(s.id);
1396
- return a ? this.createDslRenderer(a).renderer : (x.warn(`Can not find dsl: ${e}`), null);
1407
+ const a = await this.getDsl(n.id);
1408
+ return a ? this.createDslRenderer(a).renderer : (P.warn(`Can not find dsl: ${e}`), null);
1397
1409
  }
1398
1410
  defineUrlSchemaComponent(e, t) {
1399
1411
  return le(async () => {
1400
- const s = await this.getDslByUrl(e);
1401
- return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
1412
+ const n = await this.getDslByUrl(e);
1413
+ return n ? (n.name = t || n.name, this.createDslRenderer(n).renderer) : null;
1402
1414
  });
1403
1415
  }
1404
1416
  definePluginComponent(e) {
1405
- return le(async () => await Ee(e, window));
1417
+ return le(async () => await ke(e, window));
1406
1418
  }
1407
1419
  }
1408
- function Ds(n) {
1409
- const e = new ws(n);
1420
+ function Dn(s) {
1421
+ const e = new Sn(s);
1410
1422
  return {
1411
1423
  provider: e,
1412
- onReady: (s) => e.ready(s)
1424
+ onReady: (n) => e.ready(n)
1413
1425
  };
1414
1426
  }
1415
- function xe(n = {}) {
1427
+ function xe(s = {}) {
1416
1428
  const e = ge(Pe);
1417
1429
  if (!e)
1418
1430
  throw new Error("Can not find provider");
1419
1431
  if (e.nodeEnv === "development") {
1420
- const { id: t, version: s } = n;
1421
- t && s && (async () => {
1432
+ const { id: t, version: n } = s;
1433
+ t && n && (async () => {
1422
1434
  const r = await e.getDsl(t);
1423
- r?.__VERSION__ !== s && e.adapter.notify && e.adapter.notify(
1435
+ r?.__VERSION__ !== n && e.adapter.notify && e.adapter.notify(
1424
1436
  `[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,
1425
1437
  "版本不一致",
1426
1438
  "warning"
@@ -1434,30 +1446,30 @@ const Ce = {
1434
1446
  validSuccess: !0,
1435
1447
  originResponse: !1,
1436
1448
  failMessage: !0,
1437
- validate: (n) => n.data?.code === 0
1438
- }, Ss = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
1449
+ validate: (s) => s.data?.code === 0
1450
+ }, bn = (s, e = "/__vtj__/api/:type.json") => (t, n, r) => s.send({
1439
1451
  url: e,
1440
1452
  method: "post",
1441
1453
  params: { type: t },
1442
1454
  query: r,
1443
1455
  data: {
1444
1456
  type: t,
1445
- data: s
1457
+ data: n
1446
1458
  },
1447
1459
  settings: Ce
1448
- }), bs = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
1460
+ }), jn = (s, e = "/__vtj__/api/uploader.json") => async (t, n) => await s.send({
1449
1461
  url: e,
1450
1462
  method: "post",
1451
1463
  data: {
1452
1464
  files: t,
1453
- projectId: s
1465
+ projectId: n
1454
1466
  },
1455
1467
  settings: {
1456
1468
  ...Ce,
1457
1469
  type: "data"
1458
1470
  }
1459
1471
  }).then((r) => r && r[0] ? r[0] : null).catch(() => null);
1460
- function Hs(n) {
1472
+ function Hn(s) {
1461
1473
  return he({
1462
1474
  settings: {
1463
1475
  type: "json",
@@ -1466,7 +1478,7 @@ function Hs(n) {
1466
1478
  failMessage: !0,
1467
1479
  validate: (e) => e.data?.code === 0,
1468
1480
  showError: (e) => {
1469
- n && n(e || "未知错误");
1481
+ s && s(e || "未知错误");
1470
1482
  }
1471
1483
  }
1472
1484
  });
@@ -1476,7 +1488,7 @@ class re {
1476
1488
  pluginCaches = {};
1477
1489
  uploader;
1478
1490
  constructor(e = K) {
1479
- this.api = Ss(e), this.uploader = bs(e);
1491
+ this.api = bn(e), this.uploader = jn(e);
1480
1492
  }
1481
1493
  async getExtension() {
1482
1494
  console.log("BaseService.getExtension");
@@ -1551,11 +1563,11 @@ class re {
1551
1563
  return await this.api("clearStaticFiles", e).catch(() => "");
1552
1564
  }
1553
1565
  async getPluginMaterial(e) {
1554
- const { urls: t = [] } = e, s = t.filter((o) => it(o))[0];
1555
- if (!s) return null;
1556
- const r = this.pluginCaches[s];
1557
- return r || (this.pluginCaches[s] = K.send({
1558
- url: s,
1566
+ const { urls: t = [] } = e, n = t.filter((o) => it(o))[0];
1567
+ if (!n) return null;
1568
+ const r = this.pluginCaches[n];
1569
+ return r || (this.pluginCaches[n] = K.send({
1570
+ url: n,
1559
1571
  method: "get",
1560
1572
  settings: {
1561
1573
  validSuccess: !1,
@@ -1572,9 +1584,9 @@ const v = new ze({
1572
1584
  expired: 0,
1573
1585
  prefix: "__VTJ_"
1574
1586
  });
1575
- class Os extends re {
1587
+ class On extends re {
1576
1588
  init(e) {
1577
- const t = new O(e), s = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
1589
+ const t = new O(e), n = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), n || {});
1578
1590
  return v.save(`project_${t.id}`, r), Promise.resolve(r);
1579
1591
  }
1580
1592
  saveProject(e) {
@@ -1606,30 +1618,30 @@ class Os extends re {
1606
1618
  return Promise.resolve(!0);
1607
1619
  }
1608
1620
  getHistory(e) {
1609
- const t = v.get(`history_${e}`), s = new de(t || { id: e });
1610
- return Promise.resolve(s.toDsl());
1621
+ const t = v.get(`history_${e}`), n = new pe(t || { id: e });
1622
+ return Promise.resolve(n.toDsl());
1611
1623
  }
1612
1624
  getHistoryItem(e, t) {
1613
- const s = v.get(`history_${e}_${t}`);
1614
- return Promise.resolve(s);
1625
+ const n = v.get(`history_${e}_${t}`);
1626
+ return Promise.resolve(n);
1615
1627
  }
1616
1628
  saveHistoryItem(e, t) {
1617
1629
  return v.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
1618
1630
  }
1619
1631
  removeHistoryItem(e, t) {
1620
- return t.forEach((s) => {
1621
- v.remove(`history_${e}_${s}`);
1632
+ return t.forEach((n) => {
1633
+ v.remove(`history_${e}_${n}`);
1622
1634
  }), Promise.resolve(!0);
1623
1635
  }
1624
1636
  }
1625
- class js extends re {
1637
+ class $n extends re {
1626
1638
  projects = {};
1627
1639
  materials = {};
1628
1640
  files = {};
1629
1641
  histories = {};
1630
1642
  historyItems = {};
1631
1643
  init(e) {
1632
- const t = new O(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
1644
+ const t = new O(e), n = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), n);
1633
1645
  return this.projects[r.id] = r, Promise.resolve(r);
1634
1646
  }
1635
1647
  saveProject(e) {
@@ -1661,29 +1673,29 @@ class js extends re {
1661
1673
  return Promise.resolve(!0);
1662
1674
  }
1663
1675
  getHistory(e) {
1664
- const t = this.histories[e], s = new de(t || { id: e });
1665
- return Promise.resolve(s);
1676
+ const t = this.histories[e], n = new pe(t || { id: e });
1677
+ return Promise.resolve(n);
1666
1678
  }
1667
1679
  getHistoryItem(e, t) {
1668
- const s = `${e}_${t}`, r = this.historyItems[s] || {};
1680
+ const n = `${e}_${t}`, r = this.historyItems[n] || {};
1669
1681
  return Promise.resolve(r);
1670
1682
  }
1671
1683
  saveHistoryItem(e, t) {
1672
- const s = `${e}_${t.id}`;
1673
- return this.historyItems[s] = t, Promise.resolve(!0);
1684
+ const n = `${e}_${t.id}`;
1685
+ return this.historyItems[n] = t, Promise.resolve(!0);
1674
1686
  }
1675
1687
  removeHistoryItem(e, t) {
1676
- return t.forEach((s) => {
1677
- const r = `${e}_${s}`;
1688
+ return t.forEach((n) => {
1689
+ const r = `${e}_${n}`;
1678
1690
  delete this.historyItems[r];
1679
1691
  }), Promise.resolve(!0);
1680
1692
  }
1681
1693
  }
1682
1694
  let D = null;
1683
- function Bs() {
1684
- return D || (D = new js(), D);
1695
+ function Bn() {
1696
+ return D || (D = new $n(), D);
1685
1697
  }
1686
- class Ns extends re {
1698
+ class Nn extends re {
1687
1699
  getFileCaches = {};
1688
1700
  async getExtension() {
1689
1701
  return await this.api("getExtension", {}).catch(() => {
@@ -1740,48 +1752,48 @@ class Ns extends re {
1740
1752
  );
1741
1753
  }
1742
1754
  }
1743
- function Ae(n, e, t = []) {
1744
- return t.map((s) => {
1745
- const { id: r, title: o, icon: a, children: i, hidden: c } = s;
1755
+ function Me(s, e, t = []) {
1756
+ return t.map((n) => {
1757
+ const { id: r, title: o, icon: a, children: i, hidden: c } = n;
1746
1758
  return {
1747
1759
  id: r,
1748
1760
  title: o,
1749
1761
  icon: a,
1750
1762
  hidden: c,
1751
- url: `${n}/${e}/${r}`,
1752
- children: i && i.length ? Ae(n, e, i) : void 0
1763
+ url: `${s}/${e}/${r}`,
1764
+ children: i && i.length ? Me(s, e, i) : void 0
1753
1765
  };
1754
1766
  });
1755
1767
  }
1756
- function Fe(n, e) {
1757
- if (!e) return n;
1768
+ function Ae(s, e) {
1769
+ if (!e) return s;
1758
1770
  let t = [];
1759
- for (const s of n)
1760
- if (s.children && s.children.length) {
1761
- const r = Fe(s.children, e);
1762
- r.length && (s.children = r, t.push(s));
1771
+ for (const n of s)
1772
+ if (n.children && n.children.length) {
1773
+ const r = Ae(n.children, e);
1774
+ r.length && (n.children = r, t.push(n));
1763
1775
  } else
1764
- e.can(s.id.toString()) && t.push(s);
1776
+ e.can(n.id.toString()) && t.push(n);
1765
1777
  return t;
1766
1778
  }
1767
- function Us(n) {
1779
+ function Un(s) {
1768
1780
  const {
1769
1781
  menuPathPrefix: e = "",
1770
1782
  pageRouteName: t = "page",
1771
- disableMenusFilter: s = !1
1772
- } = n || {}, r = xe(), o = we(), a = yt(), i = F(!1), c = F(!1), l = r.project;
1783
+ disableMenusFilter: n = !1
1784
+ } = s || {}, r = xe(), o = we(), a = yt(), i = M(!1), c = M(!1), l = r.project;
1773
1785
  tt(() => {
1774
- const { name: p, params: h, meta: m } = o;
1775
- if (p === A) {
1776
- const d = r.getPage(h.id);
1777
- i.value = !d?.mask, c.value = !!d?.pure;
1778
- } else if (p === H) {
1779
- const d = r.getHomepage();
1780
- i.value = !d?.mask, c.value = !!d?.pure;
1786
+ const { name: d, params: h, meta: m } = o;
1787
+ if (d === C) {
1788
+ const p = r.getPage(h.id);
1789
+ i.value = !p?.mask, c.value = !!p?.pure;
1790
+ } else if (d === H) {
1791
+ const p = r.getHomepage();
1792
+ i.value = !p?.mask, c.value = !!p?.pure;
1781
1793
  } else
1782
1794
  i.value = !m.mask, c.value = !!m.pure;
1783
1795
  });
1784
- const f = Ae(
1796
+ const f = Me(
1785
1797
  e,
1786
1798
  t,
1787
1799
  l?.pages
@@ -1791,75 +1803,76 @@ function Us(n) {
1791
1803
  logo: u?.logo,
1792
1804
  themeSwitchable: u?.themeSwitchable,
1793
1805
  title: u?.title || l?.description || l?.name || "VTJ App",
1794
- menus: s ? f : Fe(f, a),
1806
+ menus: n ? f : Ae(f, a),
1795
1807
  pure: c
1796
1808
  };
1797
1809
  }
1798
1810
  export {
1799
1811
  je as ACCESS_KEY,
1800
- Ts as Access,
1812
+ Fn as Access,
1801
1813
  ot as BUILD_IN_TAGS,
1802
- st as BUILT_IN_DIRECTIVES,
1814
+ nt as BUILT_IN_DIRECTIVES,
1803
1815
  re as BaseService,
1804
1816
  ue as CONTEXT_HOST,
1805
- Et as Context,
1817
+ kt as Context,
1806
1818
  y as ContextMode,
1807
- nt as DATA_TYPES,
1819
+ st as DATA_TYPES,
1808
1820
  H as HOMEPAGE_ROUTE_NAME,
1809
1821
  rt as HTML_TAGS,
1810
- Fs as JSCodeToString,
1811
- xs as LIFE_CYCLES_LIST,
1812
- Ns as LocalService,
1813
- js as MemoryService,
1814
- _s as NodeEnv,
1815
- A as PAGE_ROUTE_NAME,
1816
- ws as Provider,
1817
- vs as Startup,
1818
- Os as StorageService,
1819
- C as VTJ_RENDERER_VERSION,
1822
+ An as JSCodeToString,
1823
+ xn as LIFE_CYCLES_LIST,
1824
+ Nn as LocalService,
1825
+ $n as MemoryService,
1826
+ wn as NodeEnv,
1827
+ C as PAGE_ROUTE_NAME,
1828
+ Sn as Provider,
1829
+ yn as Startup,
1830
+ On as StorageService,
1831
+ x as VTJ_RENDERER_VERSION,
1820
1832
  be as adoptedStyleSheets,
1821
- Ms as clearLoaderCache,
1822
- Is as createAdapter,
1823
- Cs as createAssetScripts,
1824
- As as createAssetsCss,
1825
- Ft as createDataSources,
1833
+ In as clearLoaderCache,
1834
+ Tn as createAdapter,
1835
+ Cn as createAssetScripts,
1836
+ Mn as createAssetsCss,
1837
+ At as createDataSources,
1826
1838
  Q as createLoader,
1827
- Bs as createMemoryService,
1839
+ Bn as createMemoryService,
1828
1840
  wt as createMetaApi,
1829
1841
  jt as createMock,
1830
- Ds as createProvider,
1842
+ Dn as createProvider,
1831
1843
  Y as createRenderer,
1832
1844
  _t as createSchemaApi,
1833
1845
  St as createSchemaApis,
1834
- Hs as createServiceRequest,
1835
- Mt as defaultLoader,
1836
- M as fillBasePath,
1837
- ke as getModifiers,
1838
- Ee as getPlugin,
1846
+ Hn as createServiceRequest,
1847
+ It as defaultLoader,
1848
+ I as fillBasePath,
1849
+ A as getMock,
1850
+ Ee as getModifiers,
1851
+ ke as getPlugin,
1839
1852
  lt as getRawComponent,
1840
1853
  ht as isBuiltInTag,
1841
- se as isCSSUrl,
1854
+ ne as isCSSUrl,
1842
1855
  gt as isJSCode,
1843
1856
  _ as isJSExpression,
1844
- I as isJSFunction,
1857
+ T as isJSFunction,
1845
1858
  it as isJSON,
1846
- ne as isJSUrl,
1859
+ se as isJSUrl,
1847
1860
  mt as isNativeTag,
1848
1861
  ft as isVuePlugin,
1849
1862
  ut as loadCss,
1850
- pt as loadCssUrl,
1851
- dt as loadScriptUrl,
1863
+ dt as loadCssUrl,
1864
+ pt as loadScriptUrl,
1852
1865
  $t as mockApi,
1853
1866
  bt as mockApis,
1854
1867
  $e as mockCleanup,
1855
1868
  B as nodeRender,
1856
1869
  ct as parseDeps,
1857
- T as parseExpression,
1870
+ F as parseExpression,
1858
1871
  G as parseFunction,
1859
1872
  Pe as providerKey,
1860
1873
  at as removeProdFlag,
1861
1874
  Se as toString,
1862
1875
  yt as useAccess,
1863
- Us as useMask,
1876
+ Un as useMask,
1864
1877
  xe as useProvider
1865
1878
  };