@vtj/renderer 0.7.30 → 0.7.32

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,21 +1,22 @@
1
- import { Base as ae, BUILT_IN_COMPONENTS as ce, ProjectModel as R, HistoryModel as Y } from "@vtj/core";
2
- import { isUrl as le, url as F, dedupArray as ue, isString as P, isFunction as L, logger as C, createRequest as pe, merge as fe, camelCase as j, upperFirst as de, pick as me, jsonp as he, loadScript as q, Request as ve, Storage as _e, mapToObject as A } from "@vtj/utils";
3
- import * as M from "vue";
4
- import { defineComponent as D, h as k, openBlock as ye, createElementBlock as ge, createElementVNode as b, toDisplayString as B, createVNode as we, unref as U, withCtx as Se, createTextVNode as $e, inject as je, ref as Ee, watchEffect as Pe } from "vue";
5
- import { useRoute as G } from "vue-router";
6
- import { ElNotification as V, ElLoading as be, ElButton as Fe } from "element-plus";
7
- import { useTitle as Ie } from "@vueuse/core";
8
- import { EditPen as He } from "@vtj/icons";
1
+ import { Base as le, BUILT_IN_COMPONENTS as ue, ProjectModel as C, HistoryModel as G } from "@vtj/core";
2
+ import { isUrl as pe, url as P, dedupArray as fe, isString as b, isFunction as q, logger as T, createRequest as me, merge as de, pathToRegexp as he, pathToRegexpMatch as ve, formDataToJson as _e, camelCase as j, upperFirst as ye, pick as ge, jsonp as we, loadScript as U, Request as Se, Storage as $e, mapToObject as D } from "@vtj/utils";
3
+ import * as k from "vue";
4
+ import { defineComponent as V, h as B, openBlock as je, createElementBlock as Ee, createElementVNode as F, toDisplayString as A, createVNode as Pe, unref as z, withCtx as be, createTextVNode as Fe, inject as Ie, ref as Re, watchEffect as xe } from "vue";
5
+ import { useRoute as X } from "vue-router";
6
+ import { ElNotification as J, ElLoading as He, ElButton as Ce } from "element-plus";
7
+ import M from "mockjs";
8
+ import { useTitle as Te } from "@vueuse/core";
9
+ import { EditPen as Me } from "@vtj/icons";
9
10
  /**!
10
11
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
11
12
  * @name @vtj/renderer
12
13
  * @author CHC chenhuachun1549@dingtalk.com
13
- * @version 0.7.30
14
+ * @version 0.7.32
14
15
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
15
16
  */
16
- const I = "0.7.30";
17
- var w = /* @__PURE__ */ ((s) => (s.Runtime = "Runtime", s.Design = "Design", s.Raw = "Raw", s.VNode = "VNode", s))(w || {});
18
- const z = [
17
+ const I = "0.7.32";
18
+ var w = /* @__PURE__ */ ((r) => (r.Runtime = "Runtime", r.Design = "Design", r.Raw = "Raw", r.VNode = "VNode", r))(w || {});
19
+ const K = [
19
20
  "$el",
20
21
  "$emit",
21
22
  "$nextTick",
@@ -27,7 +28,7 @@ const z = [
27
28
  "$props",
28
29
  "$options",
29
30
  "$forceUpdate"
30
- ], Ht = [
31
+ ], Nt = [
31
32
  "beforeCreate",
32
33
  "created",
33
34
  "beforeMount",
@@ -41,7 +42,7 @@ const z = [
41
42
  "renderTriggered",
42
43
  "activated",
43
44
  "deactivated"
44
- ], xe = ["vIf", "vShow", "vModel", "vFor", "vBind"], Re = {
45
+ ], Oe = ["vIf", "vShow", "vModel", "vFor", "vBind"], ke = {
45
46
  String,
46
47
  Number,
47
48
  Boolean,
@@ -50,123 +51,123 @@ const z = [
50
51
  Function,
51
52
  Date
52
53
  };
53
- function H(s, e) {
54
- return s.map((t) => le(t) ? t : `${e}${t}`);
54
+ function x(r, e) {
55
+ return r.map((t) => pe(t) ? t : `${e}${t}`);
55
56
  }
56
- function X(s) {
57
- return /\.css$/.test(s);
57
+ function Q(r) {
58
+ return /\.css$/.test(r);
58
59
  }
59
- function Q(s) {
60
- return /\.js$/.test(s);
60
+ function Z(r) {
61
+ return /\.js$/.test(r);
61
62
  }
62
- function xt(s) {
63
- return s.map(
64
- (e) => `<script src="${F.append(e, { v: I })}"><\/script>`
63
+ function At(r) {
64
+ return r.map(
65
+ (e) => `<script src="${P.append(e, { v: I })}"><\/script>`
65
66
  ).join("");
66
67
  }
67
- function Rt(s = []) {
68
- return s.map(
69
- (e) => `<link rel="stylesheet" href="${F.append(e, { v: I })}" />`
68
+ function Bt(r = []) {
69
+ return r.map(
70
+ (e) => `<link rel="stylesheet" href="${P.append(e, { v: I })}" />`
70
71
  ).join("");
71
72
  }
72
- function Ce(s, e) {
73
- const t = s.filter((d) => !!d.enabled), r = [], n = [], o = [], i = [], a = {}, l = [], c = {};
74
- return t.forEach(({ urls: d, assetsUrl: f, library: u, assetsLibrary: v }) => {
75
- d?.forEach((_) => {
76
- Q(_) && r.push(_), X(_) && n.push(_);
77
- }), u && (i.push(u), a[u] = H(d || [], e)), f && o.push(f), v && l.push(v), u && v && (c[v] = u);
73
+ function Ne(r, e) {
74
+ const t = r.filter((m) => !!m.enabled), s = [], n = [], o = [], i = [], a = {}, l = [], c = {};
75
+ return t.forEach(({ urls: m, assetsUrl: f, library: u, assetsLibrary: v }) => {
76
+ m?.forEach((_) => {
77
+ Z(_) && s.push(_), Q(_) && n.push(_);
78
+ }), u && (i.push(u), a[u] = x(m || [], e)), f && o.push(f), v && l.push(v), u && v && (c[v] = u);
78
79
  }), {
79
- scripts: H(r, e),
80
- css: H(n, e),
81
- materials: H(o, e),
80
+ scripts: x(s, e),
81
+ css: x(n, e),
82
+ materials: x(o, e),
82
83
  libraryExports: i,
83
- materialExports: ue(l),
84
+ materialExports: fe(l),
84
85
  materialMapLibrary: c,
85
86
  libraryMap: a
86
87
  };
87
88
  }
88
- function Oe(s, e) {
89
- const { name: t, parent: r, alias: n } = s;
90
- return r ? e[r]?.[n || t] : e[n || t];
89
+ function Ae(r, e) {
90
+ const { name: t, parent: s, alias: n } = r;
91
+ return s ? e[s]?.[n || t] : e[n || t];
91
92
  }
92
- function Z(s) {
93
- return P(s) ? s : JSON.stringify(s);
93
+ function ee(r) {
94
+ return b(r) ? r : JSON.stringify(r);
94
95
  }
95
- function ee(s, e, t) {
96
- const r = s.CSSStyleSheet;
97
- if (r.prototype.replaceSync) {
98
- const n = new r();
96
+ function te(r, e, t) {
97
+ const s = r.CSSStyleSheet;
98
+ if (s.prototype.replaceSync) {
99
+ const n = new s();
99
100
  n.id = e, n.replaceSync(t);
100
- const o = s.document, i = o.adoptedStyleSheets, a = Array.from(i).filter(
101
+ const o = r.document, i = o.adoptedStyleSheets, a = Array.from(i).filter(
101
102
  (l) => l.id !== e
102
103
  );
103
104
  o.adoptedStyleSheets = [...a, n];
104
105
  } else {
105
- const n = s.document;
106
+ const n = r.document;
106
107
  let o = n.getElementById(e);
107
108
  o ? o.innerHTML = t : (o = n.createElement("style"), o.id = e, o.innerHTML = t, n.head.appendChild(o));
108
109
  }
109
110
  }
110
- async function Te(s, e) {
111
- const t = await window.fetch(e).then((r) => r.text()).catch(() => "");
112
- t && ee(window, s, t);
111
+ async function Be(r, e) {
112
+ const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
113
+ t && te(window, r, t);
113
114
  }
114
- function Me(s) {
115
- return L(s) || L(s?.install);
115
+ function De(r) {
116
+ return q(r) || q(r?.install);
116
117
  }
117
- function O(s, e, t = !1, r = !1) {
118
+ function R(r, e, t = !1, s = !1) {
118
119
  try {
119
120
  const n = ['"use strict";', "var __self = arguments[0];"];
120
121
  n.push("return ");
121
- let o = (s.value || "").trim();
122
+ let o = (r.value || "").trim();
122
123
  o = o.replace(/this(\W|$)/g, (a, l) => `__self${l}`), o = n.join(`
123
124
  `) + o;
124
125
  const i = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
125
126
  return new Function("$scope", i)(e);
126
127
  } catch (n) {
127
- if (C.error("parseExpression.error", n, s, e?.__self ?? e), r)
128
+ if (T.error("parseExpression.error", n, r, e?.__self ?? e), s)
128
129
  throw n;
129
130
  }
130
131
  }
131
- function K(s, e, t = !1, r = !1) {
132
- const n = O(s, e, t, r);
133
- if (typeof n != "function" && (C.error(
132
+ function W(r, e, t = !1, s = !1) {
133
+ const n = R(r, e, t, s);
134
+ if (typeof n != "function" && (T.error(
134
135
  "parseFunction.error",
135
136
  "not a function",
136
- s,
137
+ r,
137
138
  e?.__self ?? e
138
- ), r))
139
- throw new Error(`"${s.value}" not a function`);
139
+ ), s))
140
+ throw new Error(`"${r.value}" not a function`);
140
141
  return n;
141
142
  }
142
- function g(s) {
143
- return s && s.type === "JSExpression";
143
+ function g(r) {
144
+ return r && r.type === "JSExpression";
144
145
  }
145
- function N(s) {
146
- return typeof s == "object" && s && s.type === "JSFunction";
146
+ function N(r) {
147
+ return typeof r == "object" && r && r.type === "JSFunction";
147
148
  }
148
- function Ne(s) {
149
- return g(s) || N(s);
149
+ function Ve(r) {
150
+ return g(r) || N(r);
150
151
  }
151
- function Ct(s) {
152
- return Ne(s) ? s.value : JSON.stringify(s);
152
+ function Dt(r) {
153
+ return Ve(r) ? r.value : JSON.stringify(r);
153
154
  }
154
155
  let E = null;
155
- const Be = pe({
156
+ const Je = me({
156
157
  settings: {
157
158
  type: "form",
158
159
  validSuccess: !0,
159
160
  originResponse: !1,
160
161
  loading: !0,
161
- validate: (s) => s.data?.code === 0 || !!s.data?.success,
162
+ validate: (r) => r.data?.code === 0 || !!r.data?.success,
162
163
  failMessage: !0,
163
- showError: (s) => {
164
- V.error({
165
- message: s || "未知错误"
164
+ showError: (r) => {
165
+ J.error({
166
+ message: r || "未知错误"
166
167
  });
167
168
  },
168
169
  showLoading: () => {
169
- E && E.close(), E = be.service({
170
+ E && E.close(), E = He.service({
170
171
  lock: !0,
171
172
  text: "Loading",
172
173
  background: "rgba(0, 0, 0, 0.05)"
@@ -177,29 +178,52 @@ const Be = pe({
177
178
  }
178
179
  }
179
180
  });
180
- function ke(s, e) {
181
- const { jsonp: t, request: r } = e;
182
- if (s.method === "jsonp")
183
- return (n = {}) => t(s.url, {
184
- ...s.jsonpOptions,
181
+ function Le(r, e) {
182
+ const { jsonp: t, request: s } = e;
183
+ if (r.method === "jsonp")
184
+ return (n = {}) => t(r.url, {
185
+ ...r.jsonpOptions,
185
186
  query: n
186
187
  });
187
188
  {
188
- const n = s.headers ? O(s.headers, {}, !0) : void 0, o = {
189
- url: s.url,
190
- method: s.method,
189
+ const n = r.headers ? R(r.headers, {}, !0) : void 0, o = {
190
+ url: r.url,
191
+ method: r.method,
191
192
  settings: {
192
- ...s.settings,
193
+ ...r.settings,
193
194
  headers: n
194
195
  }
195
196
  };
196
- return (i, a) => r.send(fe(o, a || {}, { data: i }));
197
+ return (i, a) => s.send(de(o, a || {}, { data: i }));
197
198
  }
198
199
  }
199
- function Ae(s = [], e) {
200
- return s.reduce((t, r) => (t[r.id] = ke(r, e), t), {});
200
+ function qe(r = [], e) {
201
+ return r.reduce(
202
+ (t, s) => (t[s.id] = Le(s, e), t),
203
+ {}
204
+ );
205
+ }
206
+ function Ue(r = []) {
207
+ M.setup({
208
+ timeout: "50-500"
209
+ }), re(), r.forEach((e) => ze(e));
210
+ }
211
+ function ze(r) {
212
+ if (!r.mock)
213
+ return;
214
+ const { url: e, mockTemplate: t } = r;
215
+ if (e && t) {
216
+ const s = he(`${e}(.*)`), n = ve(e, { decode: decodeURIComponent }), o = R(t, {}, !0);
217
+ M.mock(s, (i) => {
218
+ const a = P.parse(i.url) || {}, l = i.body instanceof FormData ? _e(i.body) : i.body, c = n(i.url)?.params;
219
+ return Object.assign(i, { data: l, params: a, query: c }), M.mock(o(i));
220
+ });
221
+ }
222
+ }
223
+ function re() {
224
+ M._mocked = {};
201
225
  }
202
- class De {
226
+ class Ke {
203
227
  __id = null;
204
228
  __mode;
205
229
  __instance = null;
@@ -224,15 +248,15 @@ class De {
224
248
  $apis = {};
225
249
  __transform = {};
226
250
  constructor(e) {
227
- const { mode: t, dsl: r, attrs: n } = e;
228
- this.__mode = t, r && (this.__id = r.id || null, this.__transform = r.transform || {}), n && Object.assign(this, n);
251
+ const { mode: t, dsl: s, attrs: n } = e;
252
+ this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), n && Object.assign(this, n);
229
253
  }
230
- setup(e, t = M) {
231
- const r = t.getCurrentInstance();
232
- if (!r)
254
+ setup(e, t = k) {
255
+ const s = t.getCurrentInstance();
256
+ if (!s)
233
257
  return;
234
- this.__instance = r.proxy;
235
- const n = r.appContext.config.globalProperties;
258
+ this.__instance = s.proxy;
259
+ const n = s.appContext.config.globalProperties;
236
260
  Object.assign(this, n), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
237
261
  this.__proxy();
238
262
  }), t.onUnmounted(() => {
@@ -240,88 +264,88 @@ class De {
240
264
  });
241
265
  }
242
266
  __proxy() {
243
- this.__instance && z.forEach((e) => {
267
+ this.__instance && K.forEach((e) => {
244
268
  this[e] = this.__instance?.[e];
245
269
  });
246
270
  }
247
271
  __cleanup() {
248
- z.forEach((e) => {
272
+ K.forEach((e) => {
249
273
  this[e] = null;
250
274
  });
251
275
  }
252
276
  __parseFunction(e) {
253
277
  if (e)
254
278
  if (this.__mode === w.Runtime) {
255
- const { id: t, type: r } = e, n = t ? this.__transform[t] ?? e.value : e.value;
256
- return K({ type: r, value: n }, this);
279
+ const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
280
+ return W({ type: s, value: n }, this);
257
281
  } else
258
- return K(e, this);
282
+ return W(e, this);
259
283
  }
260
284
  __parseExpression(e) {
261
285
  if (e)
262
286
  if (this.__mode === w.Runtime) {
263
- const { id: t, type: r } = e, n = t ? this.__transform[t] ?? e.value : e.value;
264
- return O({ type: r, value: n }, this);
287
+ const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
288
+ return R({ type: s, value: n }, this);
265
289
  } else
266
- return O(e, this);
290
+ return R(e, this);
267
291
  }
268
292
  __ref(e = null, t) {
269
293
  if (this.__mode !== w.VNode)
270
- return e && e !== this.__id && (this.__contextRefs[e] = this), (r) => {
271
- let n = r?.$vtjEl || r?.$el || r;
294
+ return e && e !== this.__id && (this.__contextRefs[e] = this), (s) => {
295
+ let n = s?.$vtjEl || s?.$el || s;
272
296
  if (!n) {
273
297
  typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
274
298
  return;
275
299
  }
276
- if (n.__vtj__ = e, n.nodeType === 3 && n.nextSibling && (n = n.nextSibling), w.Design === this.__mode && (n.__context__ = this), e && (this.__refs[e] = r), typeof t == "function")
277
- t(r);
300
+ if (n.__vtj__ = e, n.nodeType === 3 && n.nextSibling && (n = n.nextSibling), w.Design === this.__mode && (n.__context__ = this), e && (this.__refs[e] = s), typeof t == "function")
301
+ t(s);
278
302
  else if (t) {
279
303
  const o = this.$refs[t];
280
304
  if (o) {
281
- const i = new Set([].concat(o, r));
305
+ const i = new Set([].concat(o, s));
282
306
  this.$refs[t] = Array.from(i);
283
307
  } else
284
- this.$refs[t] = r;
308
+ this.$refs[t] = s;
285
309
  }
286
- return r;
310
+ return s;
287
311
  };
288
312
  }
289
313
  __clone(e = {}) {
290
- const t = { ...this.context, ...e }, r = {
314
+ const t = { ...this.context, ...e }, s = {
291
315
  ...t,
292
316
  context: t
293
317
  };
294
- return r.context.__proto__ = this.context, r.__proto__ = this, r;
318
+ return s.context.__proto__ = this.context, s.__proto__ = this, s;
295
319
  }
296
320
  }
297
- function te(s) {
321
+ function se(r) {
298
322
  const {
299
- Vue: e = M,
323
+ Vue: e = k,
300
324
  mode: t = w.Runtime,
301
- components: r = {},
325
+ components: s = {},
302
326
  libs: n = {},
303
327
  apis: o = {},
304
328
  loader: i
305
- } = s, a = e.computed(() => s.dsl), l = {
306
- $components: r,
329
+ } = r, a = e.computed(() => r.dsl), l = {
330
+ $components: s,
307
331
  $libs: n,
308
332
  $apis: o
309
- }, c = new De({
333
+ }, c = new Ke({
310
334
  mode: t,
311
335
  dsl: a.value,
312
336
  attrs: l
313
- }), d = e.defineComponent({
337
+ }), m = e.defineComponent({
314
338
  name: a.value.name,
315
339
  props: {
316
- ...Ve(a.value.props ?? [], c)
340
+ ...We(a.value.props ?? [], c)
317
341
  },
318
342
  setup(f) {
319
- c.$props = f, a.value.id && ee(
320
- s.window || window,
343
+ c.$props = f, a.value.id && te(
344
+ r.window || window,
321
345
  a.value.id,
322
346
  a.value.css || ""
323
- ), c.state = Je(e, a.value.state ?? {}, c);
324
- const u = Le(e, a.value.computed ?? {}, c), v = qe(a.value.methods ?? {}, c), _ = Ue(e, a.value.inject, c), p = ze(
347
+ ), c.state = Ye(e, a.value.state ?? {}, c);
348
+ const u = Ge(e, a.value.computed ?? {}, c), v = Xe(a.value.methods ?? {}, c), _ = Qe(e, a.value.inject, c), p = Ze(
325
349
  a.value.dataSources || {},
326
350
  c
327
351
  ), y = {
@@ -330,7 +354,7 @@ function te(s) {
330
354
  ...v,
331
355
  ...p
332
356
  };
333
- return c.setup(y, e), Ke(e, a.value.watch ?? [], c), {
357
+ return c.setup(y, e), et(e, a.value.watch ?? [], c), {
334
358
  vtj: c
335
359
  };
336
360
  },
@@ -340,72 +364,72 @@ function te(s) {
340
364
  if (!a.value.nodes)
341
365
  return null;
342
366
  const f = a.value.nodes || [];
343
- return f.length === 1 ? T(f[0], c, e, i) : f.map((u) => T(u, c, e, i));
367
+ return f.length === 1 ? O(f[0], c, e, i) : f.map((u) => O(u, c, e, i));
344
368
  },
345
- ...We(a.value.lifeCycles ?? {}, c)
369
+ ...tt(a.value.lifeCycles ?? {}, c)
346
370
  });
347
371
  return {
348
- renderer: e.markRaw(d),
372
+ renderer: e.markRaw(m),
349
373
  context: c
350
374
  };
351
375
  }
352
- function Ve(s = [], e) {
353
- const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) => Re[o]) : void 0;
354
- return s.map((r) => P(r) ? {
355
- name: r
376
+ function We(r = [], e) {
377
+ const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => ke[o]) : void 0;
378
+ return r.map((s) => b(s) ? {
379
+ name: s
356
380
  } : {
357
- name: r.name,
358
- type: r.type,
359
- required: r.required,
360
- default: g(r.default) ? e.__parseExpression(r.default) : r.default
381
+ name: s.name,
382
+ type: s.type,
383
+ required: s.required,
384
+ default: g(s.default) ? e.__parseExpression(s.default) : s.default
361
385
  }).reduce(
362
- (r, n) => (r[n.name] = {
386
+ (s, n) => (s[n.name] = {
363
387
  type: t(n.type),
364
388
  required: n.required,
365
389
  default: n.default
366
- }, r),
390
+ }, s),
367
391
  {}
368
392
  );
369
393
  }
370
- function Je(s, e, t) {
371
- return s.reactive(
394
+ function Ye(r, e, t) {
395
+ return r.reactive(
372
396
  Object.keys(e || {}).reduce(
373
- (r, n) => {
397
+ (s, n) => {
374
398
  let o = e[n];
375
- return g(o) ? o = t.__parseExpression(o) : N(o) && (o = t.__parseFunction(o)), r[n] = o, r;
399
+ return g(o) ? o = t.__parseExpression(o) : N(o) && (o = t.__parseFunction(o)), s[n] = o, s;
376
400
  },
377
401
  {}
378
402
  )
379
403
  );
380
404
  }
381
- function Le(s, e, t) {
405
+ function Ge(r, e, t) {
382
406
  return Object.entries(e ?? {}).reduce(
383
- (r, [n, o]) => (r[n] = s.computed(t.__parseFunction(o)), r),
407
+ (s, [n, o]) => (s[n] = r.computed(t.__parseFunction(o)), s),
384
408
  {}
385
409
  );
386
410
  }
387
- function qe(s, e) {
388
- return Object.entries(s ?? {}).reduce(
389
- (t, [r, n]) => (t[r] = e.__parseFunction(n), t),
411
+ function Xe(r, e) {
412
+ return Object.entries(r ?? {}).reduce(
413
+ (t, [s, n]) => (t[s] = e.__parseFunction(n), t),
390
414
  {}
391
415
  );
392
416
  }
393
- function Ue(s, e = [], t) {
417
+ function Qe(r, e = [], t) {
394
418
  return e.reduce(
395
- (r, n) => {
419
+ (s, n) => {
396
420
  const { name: o, from: i } = n || {};
397
421
  n.default;
398
422
  const a = g(i) ? t.__parseExpression(i) || o : i ?? o, l = g(n.default) ? t.__parseExpression(n.default) : n.default ?? null;
399
- return r[o] = s.inject(a, l), r;
423
+ return s[o] = r.inject(a, l), s;
400
424
  },
401
425
  {}
402
426
  );
403
427
  }
404
- function ze(s, e) {
405
- return Object.keys(s).reduce(
406
- (t, r) => {
407
- const n = s[r], o = e.$apis[n.ref], i = N(n.transform) ? n.transform.value ? e.__parseFunction(n.transform) : void 0 : n.transform;
408
- return t[r] = async (...a) => {
428
+ function Ze(r, e) {
429
+ return Object.keys(r).reduce(
430
+ (t, s) => {
431
+ const n = r[s], o = e.$apis[n.ref], i = N(n.transform) ? n.transform.value ? e.__parseFunction(n.transform) : void 0 : n.transform;
432
+ return t[s] = async (...a) => {
409
433
  const l = await o.apply(e, a);
410
434
  return i ? i(l) : l;
411
435
  }, t;
@@ -413,204 +437,204 @@ function ze(s, e) {
413
437
  {}
414
438
  );
415
439
  }
416
- function Ke(s, e = [], t) {
417
- e.forEach((r) => {
418
- s.watch(
419
- t.__parseExpression(r.source),
420
- t.__parseFunction(r.handler),
440
+ function et(r, e = [], t) {
441
+ e.forEach((s) => {
442
+ r.watch(
443
+ t.__parseExpression(s.source),
444
+ t.__parseFunction(s.handler),
421
445
  {
422
- deep: r.deep,
423
- immediate: r.immediate
446
+ deep: s.deep,
447
+ immediate: s.immediate
424
448
  }
425
449
  );
426
450
  });
427
451
  }
428
- function We(s, e) {
429
- return Object.entries(s ?? {}).reduce(
430
- (t, [r, n]) => (t[r] = e.__parseFunction(n), t),
452
+ function tt(r, e) {
453
+ return Object.entries(r ?? {}).reduce(
454
+ (t, [s, n]) => (t[s] = e.__parseFunction(n), t),
431
455
  {}
432
456
  );
433
457
  }
434
- const Ye = (s) => s;
435
- function re(s) {
436
- const { getDsl: e, options: t } = s;
437
- return (r, n, o = M) => !n || typeof n == "string" ? r : n.type === "Schema" ? o.defineAsyncComponent(async () => {
458
+ const rt = (r) => r;
459
+ function ne(r) {
460
+ const { getDsl: e, options: t } = r;
461
+ return (s, n, o = k) => !n || typeof n == "string" ? s : n.type === "Schema" ? o.defineAsyncComponent(async () => {
438
462
  const i = await e(n.id);
439
- return i ? te({
463
+ return i ? se({
440
464
  ...t,
441
465
  Vue: o,
442
466
  dsl: i,
443
467
  mode: w.Runtime,
444
- loader: re(s)
468
+ loader: ne(r)
445
469
  }).renderer : null;
446
- }) : r;
470
+ }) : s;
447
471
  }
448
- function T(s, e, t = M, r = Ye) {
449
- if (!s || !s.name || s.invisible)
472
+ function O(r, e, t = k, s = rt) {
473
+ if (!r || !r.name || r.invisible)
450
474
  return null;
451
- const { id: n = null, directives: o = [] } = s, { vIf: i, vFor: a, vShow: l, vModels: c, vBind: d } = Ge(o);
452
- if (i && !Xe(i, e))
475
+ const { id: n = null, directives: o = [] } = r, { vIf: i, vFor: a, vShow: l, vModels: c, vBind: m } = st(o);
476
+ if (i && !nt(i, e))
453
477
  return null;
454
478
  const f = (u) => {
455
479
  const v = u.$components, _ = (() => {
456
- if (s.name === "component")
457
- return Qe(u, s.props?.is);
458
- if (s.name === "slot")
459
- return s.name;
460
- const m = r(s.name, s.from, t);
461
- return P(m) ? v[m] ?? m : m;
462
- })(), p = Ze(n, s.props ?? {}, u), y = et(t, s.events ?? {}, u);
463
- if (s.name === "slot")
464
- return tt(t, s, p, u);
465
- d && Object.assign(p, u.__parseExpression(d.value)), l && (p.style = Object.assign(
480
+ if (r.name === "component")
481
+ return ot(u, r.props?.is);
482
+ if (r.name === "slot")
483
+ return r.name;
484
+ const d = s(r.name, r.from, t);
485
+ return b(d) ? v[d] ?? d : d;
486
+ })(), p = it(n, r.props ?? {}, u), y = at(t, r.events ?? {}, u);
487
+ if (r.name === "slot")
488
+ return ct(t, r, p, u);
489
+ m && Object.assign(p, u.__parseExpression(m.value)), l && (p.style = Object.assign(
466
490
  p.style ?? {},
467
- st(l, u)
468
- )), c.forEach((m) => {
469
- Object.assign(p, nt(t, m, u));
491
+ ut(l, u)
492
+ )), c.forEach((d) => {
493
+ Object.assign(p, pt(t, d, u));
470
494
  });
471
- const S = ot(t, s.children ?? [], u, s);
495
+ const S = ft(t, r.children ?? [], u, r);
472
496
  return t.createVNode(_, { ...p, ...y }, S);
473
497
  };
474
- return a ? ct(a, f, e) : f(e);
498
+ return a ? ht(a, f, e) : f(e);
475
499
  }
476
- function Ge(s = []) {
477
- const e = s.find((a) => j(a.name) === "vIf"), t = s.find((a) => j(a.name) === "vFor"), r = s.find((a) => j(a.name) === "vShow"), n = s.find((a) => j(a.name) === "vBind"), o = s.filter((a) => j(a.name) === "vModel"), i = s.filter(
478
- (a) => !xe.includes(j(a.name))
500
+ function st(r = []) {
501
+ const e = r.find((a) => j(a.name) === "vIf"), t = r.find((a) => j(a.name) === "vFor"), s = r.find((a) => j(a.name) === "vShow"), n = r.find((a) => j(a.name) === "vBind"), o = r.filter((a) => j(a.name) === "vModel"), i = r.filter(
502
+ (a) => !Oe.includes(j(a.name))
479
503
  );
480
504
  return {
481
505
  vIf: e,
482
506
  vFor: t,
483
- vShow: r,
507
+ vShow: s,
484
508
  vModels: o,
485
509
  vBind: n,
486
510
  others: i
487
511
  };
488
512
  }
489
- function Xe(s, e) {
490
- return !!e.__parseExpression(s.value);
513
+ function nt(r, e) {
514
+ return !!e.__parseExpression(r.value);
491
515
  }
492
- function Qe(s, e) {
493
- return e ? g(e) ? s.__parseExpression(e) : e : "div";
516
+ function ot(r, e) {
517
+ return e ? g(e) ? r.__parseExpression(e) : e : "div";
494
518
  }
495
- function Ze(s, e, t) {
496
- const r = Object.keys(e || {}).reduce(
519
+ function it(r, e, t) {
520
+ const s = Object.keys(e || {}).reduce(
497
521
  (n, o) => {
498
522
  let i = e[o];
499
523
  return g(i) ? i = t.__parseExpression(i) : N(i) && (i = t.__parseFunction(i)), n[o] = i, n;
500
524
  },
501
525
  {}
502
526
  );
503
- return r.ref = t.__ref(s, r.ref), r;
527
+ return s.ref = t.__ref(r, s.ref), s;
504
528
  }
505
- function et(s, e, t) {
506
- const r = ["passive", "capture", "once"], n = {
529
+ function at(r, e, t) {
530
+ const s = ["passive", "capture", "once"], n = {
507
531
  capture: "Capture",
508
532
  once: "Once",
509
533
  passive: "OnceCapture"
510
534
  };
511
535
  return Object.keys(e || {}).reduce(
512
536
  (o, i) => {
513
- const a = e[i], l = se(a.modifiers), c = l.find((u) => r.includes(u)), d = "on" + de(i) + (c && n[c] || ""), f = t.__parseFunction(a.handler);
514
- return f && (o[d] = s.withModifiers(f, l)), o;
537
+ const a = e[i], l = oe(a.modifiers), c = l.find((u) => s.includes(u)), m = "on" + ye(i) + (c && n[c] || ""), f = t.__parseFunction(a.handler);
538
+ return f && (o[m] = r.withModifiers(f, l)), o;
515
539
  },
516
540
  {}
517
541
  );
518
542
  }
519
- function se(s = {}, e = !1) {
520
- const t = Object.keys(s);
521
- return e ? t.map((r) => "." + r) : t;
543
+ function oe(r = {}, e = !1) {
544
+ const t = Object.keys(r);
545
+ return e ? t.map((s) => "." + s) : t;
522
546
  }
523
- function tt(s, e, t, r) {
524
- const { children: n } = e, o = rt(e, r), i = r.$slots?.[o.name];
525
- return i ? i(t) : n ? P(n) ? s.createTextVNode(n) : g(n) ? s.createTextVNode(
526
- Z(r.__parseExpression(n))
527
- ) : Array.isArray(n) ? n.map((a) => T(a, r, s)) : null : null;
547
+ function ct(r, e, t, s) {
548
+ const { children: n } = e, o = lt(e, s), i = s.$slots?.[o.name];
549
+ return i ? i(t) : n ? b(n) ? r.createTextVNode(n) : g(n) ? r.createTextVNode(
550
+ ee(s.__parseExpression(n))
551
+ ) : Array.isArray(n) ? n.map((a) => O(a, s, r)) : null : null;
528
552
  }
529
- function rt(s, e) {
530
- const { props: t } = s, r = t?.name || "default";
553
+ function lt(r, e) {
554
+ const { props: t } = r, s = t?.name || "default";
531
555
  return {
532
- name: g(r) ? e.__parseExpression(r) : r,
556
+ name: g(s) ? e.__parseExpression(s) : s,
533
557
  params: []
534
558
  };
535
559
  }
536
- function st(s, e) {
537
- return e.__parseExpression(s.value) ? {} : {
560
+ function ut(r, e) {
561
+ return e.__parseExpression(r.value) ? {} : {
538
562
  display: "none"
539
563
  };
540
564
  }
541
- function nt(s, e, t) {
542
- const r = {
565
+ function pt(r, e, t) {
566
+ const s = {
543
567
  type: "JSFunction",
544
568
  value: e.value?.value ? `(v) => {
545
569
  ${e.value.value} = v;
546
570
  }` : "(v) => {}"
547
- }, n = t.__parseFunction(r), o = se(e.modifiers), i = g(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
571
+ }, n = t.__parseFunction(s), o = oe(e.modifiers), i = g(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
548
572
  return {
549
573
  [i]: t.__parseExpression(e.value),
550
- [`onUpdate:${i}`]: o.length && n ? s.withModifiers(n, o) : n
574
+ [`onUpdate:${i}`]: o.length && n ? r.withModifiers(n, o) : n
551
575
  };
552
576
  }
553
- function ot(s, e, t, r) {
577
+ function ft(r, e, t, s) {
554
578
  if (!e)
555
579
  return null;
556
- if (P(e))
580
+ if (b(e))
557
581
  return { default: () => e };
558
582
  if (g(e))
559
583
  return {
560
- default: () => Z(t.__parseExpression(e))
584
+ default: () => ee(t.__parseExpression(e))
561
585
  };
562
586
  if (Array.isArray(e) && e.length > 0) {
563
- const n = it(e), o = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
564
- [`scope_${r.id}`]: i
587
+ const n = mt(e), o = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
588
+ [`scope_${s.id}`]: i
565
589
  } : {};
566
- return Object.entries(n).reduce((i, [a, { nodes: l, params: c }]) => (i[a] = (d) => {
567
- const f = c.length ? me(d ?? {}, c) : o(d);
590
+ return Object.entries(n).reduce((i, [a, { nodes: l, params: c }]) => (i[a] = (m) => {
591
+ const f = c.length ? ge(m ?? {}, c) : o(m);
568
592
  return l.map(
569
- (u) => T(u, t.__clone(f), s)
593
+ (u) => O(u, t.__clone(f), r)
570
594
  );
571
595
  }, i), {});
572
596
  }
573
597
  return null;
574
598
  }
575
- function it(s) {
599
+ function mt(r) {
576
600
  const e = {
577
601
  default: {
578
602
  params: [],
579
603
  nodes: []
580
604
  }
581
605
  };
582
- for (const t of s) {
583
- const r = at(t.slot), n = r.name;
584
- e[n] ? (e[n].nodes.push(t), e[n].params = e[n].params.concat(r.params)) : e[n] = {
606
+ for (const t of r) {
607
+ const s = dt(t.slot), n = s.name;
608
+ e[n] ? (e[n].nodes.push(t), e[n].params = e[n].params.concat(s.params)) : e[n] = {
585
609
  nodes: [t],
586
- params: r.params
610
+ params: s.params
587
611
  };
588
612
  }
589
613
  return e;
590
614
  }
591
- function at(s = "default") {
592
- return P(s) ? { name: s, params: [] } : { params: [], ...s };
615
+ function dt(r = "default") {
616
+ return b(r) ? { name: r, params: [] } : { params: [], ...r };
593
617
  }
594
- function ct(s, e, t) {
595
- const { value: r, iterator: n } = s, { item: o = "item", index: i = "index" } = n || {};
596
- let a = t.__parseExpression(r) || [];
597
- return Number.isInteger(a) && (a = new Array(a).fill(!0).map((l, c) => c + 1)), Array.isArray(a) ? a.map((l, c) => e(t.__clone({ [o]: l, [i]: c }))) : (console.warn("[vForRender]:", `${r?.value} is not a Arrary`), []);
618
+ function ht(r, e, t) {
619
+ const { value: s, iterator: n } = r, { item: o = "item", index: i = "index" } = n || {};
620
+ let a = t.__parseExpression(s) || [];
621
+ return Number.isInteger(a) && (a = new Array(a).fill(!0).map((l, c) => c + 1)), Array.isArray(a) ? a.map((l, c) => e(t.__clone({ [o]: l, [i]: c }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
598
622
  }
599
- const W = D({
623
+ const Y = V({
600
624
  name: "VtjPageContainer",
601
625
  async setup() {
602
- const s = oe(), e = G(), t = e.params.id, r = t ? s.getPage(t) : s.getHomepage(), n = r ? await s.getRenderComponent(r.id) : null;
603
- return r && Ie(r.title || "VTJ"), {
604
- provider: s,
626
+ const r = ae(), e = X(), t = e.params.id, s = t ? r.getPage(t) : r.getHomepage(), n = s ? await r.getRenderComponent(s.id) : null;
627
+ return s && Te(s.title || "VTJ"), {
628
+ provider: r,
605
629
  component: n,
606
- file: r,
630
+ file: s,
607
631
  query: e.query
608
632
  };
609
633
  },
610
634
  render() {
611
- return this.component ? k(this.component, this.query) : k("div", "页面不存在");
635
+ return this.component ? B(this.component, this.query) : B("div", "页面不存在");
612
636
  }
613
- }), lt = {
637
+ }), vt = {
614
638
  name: {
615
639
  type: String,
616
640
  default: "VTJ.PRO"
@@ -627,32 +651,32 @@ const W = D({
627
651
  type: String,
628
652
  default: "/@vtj/pro/"
629
653
  }
630
- }, ut = { class: "x-startup" }, pt = { class: "x-startup__wrapper" }, ft = { class: "x-startup__name" }, dt = { class: "clip" }, mt = { class: "x-startup__tagline" }, ht = { class: "x-startup__actions" }, vt = /* @__PURE__ */ D({
654
+ }, _t = { class: "x-startup" }, yt = { class: "x-startup__wrapper" }, gt = { class: "x-startup__name" }, wt = { class: "clip" }, St = { class: "x-startup__tagline" }, $t = { class: "x-startup__actions" }, jt = /* @__PURE__ */ V({
631
655
  __name: "Startup",
632
- props: lt,
633
- setup(s) {
634
- const e = s, t = () => {
656
+ props: vt,
657
+ setup(r) {
658
+ const e = r, t = () => {
635
659
  if (typeof window < "u") {
636
- let r = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "@vtj/pro/#/";
637
- window.location.href = r;
660
+ let s = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "@vtj/pro/#/";
661
+ window.location.href = s;
638
662
  }
639
663
  };
640
- return (r, n) => (ye(), ge("div", ut, [
641
- b("div", pt, [
642
- b("div", ft, [
643
- b("span", dt, B(e.name), 1)
664
+ return (s, n) => (je(), Ee("div", _t, [
665
+ F("div", yt, [
666
+ F("div", gt, [
667
+ F("span", wt, A(e.name), 1)
644
668
  ]),
645
- b("div", mt, B(e.tagline), 1),
646
- b("div", ht, [
647
- we(U(Fe), {
669
+ F("div", St, A(e.tagline), 1),
670
+ F("div", $t, [
671
+ Pe(z(Ce), {
648
672
  type: "primary",
649
673
  size: "large",
650
674
  round: "",
651
- icon: U(He),
675
+ icon: z(Me),
652
676
  onClick: t
653
677
  }, {
654
- default: Se(() => [
655
- $e(B(e.actionText), 1)
678
+ default: be(() => [
679
+ Fe(A(e.actionText), 1)
656
680
  ]),
657
681
  _: 1
658
682
  }, 8, ["icon"])
@@ -660,17 +684,17 @@ const W = D({
660
684
  ])
661
685
  ]));
662
686
  }
663
- }), _t = D({
687
+ }), Et = V({
664
688
  name: "VtjStartupContainer",
665
689
  render() {
666
- return k(vt);
690
+ return B(jt);
667
691
  }
668
- }), ne = Symbol("Provider");
669
- class yt extends ae {
692
+ }), ie = Symbol("Provider");
693
+ class Pt extends le {
670
694
  mode;
671
695
  globals = {};
672
696
  modules = {};
673
- adapter = { request: Be, jsonp: he };
697
+ adapter = { request: Je, jsonp: we };
674
698
  apis = {};
675
699
  dependencies = {};
676
700
  materials = {};
@@ -685,30 +709,30 @@ class yt extends ae {
685
709
  super();
686
710
  const {
687
711
  service: t,
688
- mode: r = w.Raw,
712
+ mode: s = w.Raw,
689
713
  dependencies: n,
690
714
  materials: o,
691
715
  project: i = {},
692
716
  adapter: a = {},
693
717
  globals: l = {},
694
718
  modules: c = {},
695
- router: d = null,
719
+ router: m = null,
696
720
  materialPath: f = "./",
697
721
  nodeEnv: u = "development"
698
722
  } = e;
699
- this.mode = r, this.modules = c, this.service = t, this.router = d, this.materialPath = f, this.nodeEnv = u, n && (this.dependencies = n), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, a), r !== w.Design && this.load(i);
723
+ this.mode = s, this.modules = c, this.service = t, this.router = m, this.materialPath = f, this.nodeEnv = u, n && (this.dependencies = n), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, a), s !== w.Design && this.load(i);
700
724
  }
701
725
  async load(e) {
702
726
  const t = this.modules[`.vtj/projects/${e.id}.json`];
703
727
  if (this.project = t ? await t() : await this.service.init(e), !this.project)
704
728
  throw new Error("project is null");
705
- const { dependencies: r = [], apis: n } = this.project, { dependencies: o, library: i, components: a, materialPath: l } = this, {
729
+ const { dependencies: s = [], apis: n } = this.project, { dependencies: o, library: i, components: a, materialPath: l } = this, {
706
730
  libraryExports: c,
707
- libraryMap: d,
731
+ libraryMap: m,
708
732
  materials: f,
709
733
  materialExports: u,
710
734
  materialMapLibrary: v
711
- } = Ce(r, l);
735
+ } = Ne(s, l);
712
736
  for (const p of c) {
713
737
  const y = o[p], S = window[p];
714
738
  if (S)
@@ -716,64 +740,64 @@ class yt extends ae {
716
740
  else if (y)
717
741
  window[p] = i[p] = await y();
718
742
  else {
719
- const m = d[p] || [];
720
- for (const $ of m)
721
- X($) && await Te(p, F.append($, { v: I })), Q($) && await q(F.append($, { v: I })), i[p] = window[p];
743
+ const d = m[p] || [];
744
+ for (const $ of d)
745
+ Q($) && await Be(p, P.append($, { v: I })), Z($) && await U(P.append($, { v: I })), i[p] = window[p];
722
746
  }
723
747
  }
724
748
  for (const p of f)
725
- await q(F.append(p, { v: I }));
749
+ await U(P.append(p, { v: I }));
726
750
  const _ = this.materials || {};
727
751
  for (const p of u) {
728
- const y = window[v[p]], S = ce[p];
752
+ const y = window[v[p]], S = ue[p];
729
753
  if (S)
730
- y && S.forEach((m) => {
731
- a[m] = y[m];
754
+ y && S.forEach((d) => {
755
+ a[d] = y[d];
732
756
  });
733
757
  else {
734
- const m = _[p] ? (await _[p]()).default : window[p];
735
- m && y && (m.components || []).forEach(($) => {
736
- a[$.name] = Oe($, y);
758
+ const d = _[p] ? (await _[p]()).default : window[p];
759
+ d && y && (d.components || []).forEach(($) => {
760
+ a[$.name] = Ae($, y);
737
761
  });
738
762
  }
739
763
  }
740
- n && (this.apis = Ae(n, this.adapter)), this.initRouter(), this.triggerReady();
764
+ n && (this.apis = qe(n, this.adapter), re(), this.project.config?.mock && Ue(n)), this.initRouter(), this.triggerReady();
741
765
  }
742
766
  initRouter() {
743
767
  const { router: e, project: t } = this;
744
768
  e && (e.addRoute({
745
769
  path: "/page/:id",
746
770
  name: "VtjPage",
747
- component: W
771
+ component: Y
748
772
  }), e.addRoute({
749
773
  path: "/",
750
774
  name: "VtjHomepage",
751
- component: t?.homepage ? W : _t
775
+ component: t?.homepage ? Y : Et
752
776
  }));
753
777
  }
754
778
  install(e) {
755
779
  const t = e.config.globalProperties.installed || {};
756
- for (const [r, n] of Object.entries(this.library))
757
- !t[r] && Me(n) && (e.use(n), t[r] = !0);
758
- e.provide(ne, this), e.config.globalProperties.installed = t;
780
+ for (const [s, n] of Object.entries(this.library))
781
+ !t[s] && De(n) && (e.use(n), t[s] = !0);
782
+ e.provide(ie, this), e.config.globalProperties.installed = t;
759
783
  }
760
784
  getFile(e) {
761
785
  const { blocks: t = [] } = this.project || {};
762
- return this.getPage(e) || t.find((r) => r.id === e) || null;
786
+ return this.getPage(e) || t.find((s) => s.id === e) || null;
763
787
  }
764
788
  getPage(e) {
765
- const { pages: t = [] } = this.project || {}, r = (n, o = []) => {
789
+ const { pages: t = [] } = this.project || {}, s = (n, o = []) => {
766
790
  for (const i of o) {
767
791
  if (i.id === n)
768
792
  return i;
769
793
  if (i.children && i.children.length) {
770
- const a = r(n, i.children);
794
+ const a = s(n, i.children);
771
795
  if (a)
772
796
  return a;
773
797
  }
774
798
  }
775
799
  };
776
- return r(e, t) || null;
800
+ return s(e, t) || null;
777
801
  }
778
802
  getHomepage() {
779
803
  const { homepage: e } = this.project || {};
@@ -786,47 +810,47 @@ class yt extends ae {
786
810
  async getRenderComponent(e) {
787
811
  const t = this.getFile(e);
788
812
  if (!t)
789
- return C.warn(`Can not find file: ${e}`), null;
790
- const r = `.vtj/vue/${e}.vue`, n = this.modules[r];
813
+ return T.warn(`Can not find file: ${e}`), null;
814
+ const s = `.vtj/vue/${e}.vue`, n = this.modules[s];
791
815
  if (n)
792
816
  return (await n())?.default;
793
817
  const o = await this.getDsl(t.id);
794
818
  if (!o)
795
- return C.warn(`Can not find dsl: ${e}`), null;
796
- const { library: i, components: a, mode: l, apis: c } = this, d = {
819
+ return T.warn(`Can not find dsl: ${e}`), null;
820
+ const { library: i, components: a, mode: l, apis: c } = this, m = {
797
821
  mode: l,
798
822
  Vue: i.Vue,
799
823
  components: a,
800
824
  libs: i,
801
825
  apis: c,
802
826
  window
803
- }, f = re({
827
+ }, f = ne({
804
828
  getDsl: async (v) => await this.getDsl(v) || null,
805
- options: d
806
- }), { renderer: u } = te({
807
- ...d,
829
+ options: m
830
+ }), { renderer: u } = se({
831
+ ...m,
808
832
  dsl: o,
809
833
  loader: f
810
834
  });
811
835
  return u;
812
836
  }
813
837
  }
814
- function Ot(s) {
815
- const e = new yt(s);
838
+ function Vt(r) {
839
+ const e = new Pt(r);
816
840
  return {
817
841
  provider: e,
818
- onReady: (r) => e.ready(r)
842
+ onReady: (s) => e.ready(s)
819
843
  };
820
844
  }
821
- function oe(s = {}) {
822
- const e = je(ne);
845
+ function ae(r = {}) {
846
+ const e = Ie(ie);
823
847
  if (!e)
824
848
  throw new Error("Can not find provider");
825
849
  if (e.mode === w.Raw && e.nodeEnv === "development") {
826
- const { id: t, version: r } = s;
827
- t && r && (async () => {
850
+ const { id: t, version: s } = r;
851
+ t && s && (async () => {
828
852
  const n = await e.getDsl(t);
829
- n?.__VERSION__ !== r && V.warning({
853
+ n?.__VERSION__ !== s && J.warning({
830
854
  title: n?.name,
831
855
  message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
832
856
  });
@@ -834,21 +858,21 @@ function oe(s = {}) {
834
858
  }
835
859
  return e;
836
860
  }
837
- const gt = new ve({
861
+ const bt = new Se({
838
862
  settings: {
839
863
  type: "json",
840
864
  validSuccess: !0,
841
865
  originResponse: !1,
842
866
  failMessage: !0,
843
- validate: (s) => s.data?.code === 0,
844
- showError: (s) => {
845
- V.error({
846
- message: s || "未知错误"
867
+ validate: (r) => r.data?.code === 0,
868
+ showError: (r) => {
869
+ J.error({
870
+ message: r || "未知错误"
847
871
  });
848
872
  }
849
873
  }
850
- }), wt = (s = "/vtj/local/repository/${type}.json") => (e, t) => gt.send({
851
- url: s,
874
+ }), Ft = (r = "/vtj/local/repository/${type}.json") => (e, t) => bt.send({
875
+ url: r,
852
876
  method: "post",
853
877
  query: { type: e },
854
878
  data: {
@@ -856,10 +880,10 @@ const gt = new ve({
856
880
  data: t
857
881
  }
858
882
  });
859
- class J {
883
+ class L {
860
884
  api;
861
885
  constructor() {
862
- this.api = wt();
886
+ this.api = Ft();
863
887
  }
864
888
  async init(e) {
865
889
  return console.log("BaseService.init", e), {};
@@ -915,22 +939,22 @@ class J {
915
939
  return await this.api("removeRawPage", e).catch(() => "");
916
940
  }
917
941
  }
918
- const h = new _e({
942
+ const h = new $e({
919
943
  type: "local",
920
944
  expired: 0,
921
945
  prefix: "__VTJ_"
922
946
  });
923
- class Tt extends J {
947
+ class Jt extends L {
924
948
  init(e) {
925
- const t = new R(e), r = h.get(`project_${t.id}`), n = Object.assign(t.toDsl(), r || {});
949
+ const t = new C(e), s = h.get(`project_${t.id}`), n = Object.assign(t.toDsl(), s || {});
926
950
  return h.save(`project_${t.id}`, n), Promise.resolve(n);
927
951
  }
928
952
  saveProject(e) {
929
- const t = new R(e);
953
+ const t = new C(e);
930
954
  return h.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
931
955
  }
932
956
  saveMaterials(e, t) {
933
- return h.save(`materials_${e.id}`, A(t)), Promise.resolve(!0);
957
+ return h.save(`materials_${e.id}`, D(t)), Promise.resolve(!0);
934
958
  }
935
959
  saveFile(e) {
936
960
  return h.save(`file_${e.id}`, e), Promise.resolve(!0);
@@ -954,38 +978,38 @@ class Tt extends J {
954
978
  return Promise.resolve(!0);
955
979
  }
956
980
  getHistory(e) {
957
- const t = h.get(`history_${e}`), r = new Y(t || { id: e });
958
- return Promise.resolve(r.toDsl());
981
+ const t = h.get(`history_${e}`), s = new G(t || { id: e });
982
+ return Promise.resolve(s.toDsl());
959
983
  }
960
984
  getHistoryItem(e, t) {
961
- const r = h.get(`history_${e}_${t}`);
962
- return Promise.resolve(r);
985
+ const s = h.get(`history_${e}_${t}`);
986
+ return Promise.resolve(s);
963
987
  }
964
988
  saveHistoryItem(e, t) {
965
989
  return h.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
966
990
  }
967
991
  removeHistoryItem(e, t) {
968
- return t.forEach((r) => {
969
- h.remove(`history_${e}_${r}`);
992
+ return t.forEach((s) => {
993
+ h.remove(`history_${e}_${s}`);
970
994
  }), Promise.resolve(!0);
971
995
  }
972
996
  }
973
- class St extends J {
997
+ class It extends L {
974
998
  projects = {};
975
999
  materials = {};
976
1000
  files = {};
977
1001
  histories = {};
978
1002
  historyItems = {};
979
1003
  init(e) {
980
- const t = new R(e), r = this.projects[t.id] || {}, n = Object.assign(t.toDsl(), r);
1004
+ const t = new C(e), s = this.projects[t.id] || {}, n = Object.assign(t.toDsl(), s);
981
1005
  return this.projects[n.id] = n, Promise.resolve(n);
982
1006
  }
983
1007
  saveProject(e) {
984
- const t = new R(e);
1008
+ const t = new C(e);
985
1009
  return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
986
1010
  }
987
1011
  saveMaterials(e, t) {
988
- return e.id && (this.materials[e.id] = A(t)), Promise.resolve(!0);
1012
+ return e.id && (this.materials[e.id] = D(t)), Promise.resolve(!0);
989
1013
  }
990
1014
  saveFile(e) {
991
1015
  return this.files[e.id] = e, Promise.resolve(!0);
@@ -1009,29 +1033,29 @@ class St extends J {
1009
1033
  return Promise.resolve(!0);
1010
1034
  }
1011
1035
  getHistory(e) {
1012
- const t = this.histories[e], r = new Y(t || { id: e });
1013
- return Promise.resolve(r);
1036
+ const t = this.histories[e], s = new G(t || { id: e });
1037
+ return Promise.resolve(s);
1014
1038
  }
1015
1039
  getHistoryItem(e, t) {
1016
- const r = `${e}_${t}`, n = this.historyItems[r] || {};
1040
+ const s = `${e}_${t}`, n = this.historyItems[s] || {};
1017
1041
  return Promise.resolve(n);
1018
1042
  }
1019
1043
  saveHistoryItem(e, t) {
1020
- const r = `${e}_${t.id}`;
1021
- return this.historyItems[r] = t, Promise.resolve(!0);
1044
+ const s = `${e}_${t.id}`;
1045
+ return this.historyItems[s] = t, Promise.resolve(!0);
1022
1046
  }
1023
1047
  removeHistoryItem(e, t) {
1024
- return t.forEach((r) => {
1025
- const n = `${e}_${r}`;
1048
+ return t.forEach((s) => {
1049
+ const n = `${e}_${s}`;
1026
1050
  delete this.historyItems[n];
1027
1051
  }), Promise.resolve(!0);
1028
1052
  }
1029
1053
  }
1030
- let x = null;
1031
- function Mt() {
1032
- return x || (x = new St(), x);
1054
+ let H = null;
1055
+ function Lt() {
1056
+ return H || (H = new It(), H);
1033
1057
  }
1034
- class Nt extends J {
1058
+ class qt extends L {
1035
1059
  async init(e) {
1036
1060
  return await this.api("init", e).catch(() => null) || {};
1037
1061
  }
@@ -1041,7 +1065,7 @@ class Nt extends J {
1041
1065
  async saveMaterials(e, t) {
1042
1066
  return !!await this.api("saveMaterials", {
1043
1067
  project: e,
1044
- materials: A(t)
1068
+ materials: D(t)
1045
1069
  }).catch(() => !1);
1046
1070
  }
1047
1071
  async saveFile(e) {
@@ -1076,80 +1100,85 @@ class Nt extends J {
1076
1100
  );
1077
1101
  }
1078
1102
  }
1079
- function ie(s = []) {
1080
- return s.map((e) => {
1081
- const { id: t, title: r, icon: n, children: o, hidden: i } = e;
1103
+ function ce(r = []) {
1104
+ return r.map((e) => {
1105
+ const { id: t, title: s, icon: n, children: o, hidden: i } = e;
1082
1106
  return {
1083
1107
  id: t,
1084
- title: r,
1108
+ title: s,
1085
1109
  icon: n,
1086
1110
  hidden: i,
1087
1111
  url: `/page/${t}`,
1088
- children: o && o.length ? ie(o) : void 0
1112
+ children: o && o.length ? ce(o) : void 0
1089
1113
  };
1090
1114
  });
1091
1115
  }
1092
- function Bt() {
1093
- const s = oe(), e = G(), t = Ee(!1), r = s.project;
1094
- Pe(() => {
1095
- const { name: o, params: i, meta: a } = e;
1096
- if (o === "VtjPage") {
1097
- const l = s.getPage(i.id);
1098
- t.value = !l?.mask;
1099
- } else if (o === "VtjHomepage") {
1100
- const l = s.getHomepage();
1101
- t.value = !l?.mask;
1116
+ function Ut() {
1117
+ const r = ae(), e = X(), t = Re(!1), s = r.project;
1118
+ xe(() => {
1119
+ const { name: i, params: a, meta: l } = e;
1120
+ if (i === "VtjPage") {
1121
+ const c = r.getPage(a.id);
1122
+ t.value = !c?.mask;
1123
+ } else if (i === "VtjHomepage") {
1124
+ const c = r.getHomepage();
1125
+ t.value = !c?.mask;
1102
1126
  } else
1103
- t.value = !a.mask;
1127
+ t.value = !l.mask;
1104
1128
  });
1105
- const n = ie(r?.pages);
1129
+ const n = ce(s?.pages), o = s?.config;
1106
1130
  return {
1107
1131
  disabled: t,
1108
- title: r?.description || r?.name || "VTJ App",
1132
+ logo: o?.logo,
1133
+ themeSwitchable: o?.themeSwitchable,
1134
+ title: o?.title || s?.description || s?.name || "VTJ App",
1109
1135
  menus: n
1110
1136
  };
1111
1137
  }
1112
1138
  export {
1113
- xe as BUILT_IN_DIRECTIVES,
1114
- J as BaseService,
1115
- z as CONTEXT_HOST,
1116
- De as Context,
1139
+ Oe as BUILT_IN_DIRECTIVES,
1140
+ L as BaseService,
1141
+ K as CONTEXT_HOST,
1142
+ Ke as Context,
1117
1143
  w as ContextMode,
1118
- Re as DATA_TYPES,
1119
- Ct as JSCodeToString,
1120
- Ht as LIFE_CYCLES_LIST,
1121
- Nt as LocalService,
1122
- St as MemoryService,
1123
- yt as Provider,
1124
- Tt as StorageService,
1144
+ ke as DATA_TYPES,
1145
+ Dt as JSCodeToString,
1146
+ Nt as LIFE_CYCLES_LIST,
1147
+ qt as LocalService,
1148
+ It as MemoryService,
1149
+ Pt as Provider,
1150
+ Jt as StorageService,
1125
1151
  I as VTJ_RENDERER_VERSION,
1126
- ee as adoptedStyleSheets,
1127
- xt as createAssetScripts,
1128
- Rt as createAssetsCss,
1129
- ze as createDataSources,
1130
- re as createLoader,
1131
- Mt as createMemoryService,
1132
- Ot as createProvider,
1133
- te as createRenderer,
1134
- ke as createSchemaApi,
1135
- Ae as createSchemaApis,
1136
- Ye as defaultLoader,
1137
- H as fillBasePath,
1138
- se as getModifiers,
1139
- Oe as getRawComponent,
1140
- X as isCSSUrl,
1141
- Ne as isJSCode,
1152
+ te as adoptedStyleSheets,
1153
+ At as createAssetScripts,
1154
+ Bt as createAssetsCss,
1155
+ Ze as createDataSources,
1156
+ ne as createLoader,
1157
+ Lt as createMemoryService,
1158
+ Vt as createProvider,
1159
+ se as createRenderer,
1160
+ Le as createSchemaApi,
1161
+ qe as createSchemaApis,
1162
+ rt as defaultLoader,
1163
+ x as fillBasePath,
1164
+ oe as getModifiers,
1165
+ Ae as getRawComponent,
1166
+ Q as isCSSUrl,
1167
+ Ve as isJSCode,
1142
1168
  g as isJSExpression,
1143
1169
  N as isJSFunction,
1144
- Q as isJSUrl,
1145
- Me as isVuePlugin,
1146
- Te as loadCss,
1147
- T as nodeRender,
1148
- Ce as parseDeps,
1149
- O as parseExpression,
1150
- K as parseFunction,
1151
- ne as providerKey,
1152
- Z as toString,
1153
- Bt as useMask,
1154
- oe as useProvider
1170
+ Z as isJSUrl,
1171
+ De as isVuePlugin,
1172
+ Be as loadCss,
1173
+ ze as mockApi,
1174
+ Ue as mockApis,
1175
+ re as mockCleanup,
1176
+ O as nodeRender,
1177
+ Ne as parseDeps,
1178
+ R as parseExpression,
1179
+ W as parseFunction,
1180
+ ie as providerKey,
1181
+ ee as toString,
1182
+ Ut as useMask,
1183
+ ae as useProvider
1155
1184
  };