@vtj/renderer 0.8.49 → 0.8.51

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,21 @@
1
- import { Base as _e, BUILT_IN_COMPONENTS as we, ProjectModel as M, HistoryModel as re } from "@vtj/core";
2
- import { isUrl as Se, url as C, dedupArray as $e, isString as E, isFunction as Y, logger as O, createRequest as je, merge as Ee, pathToRegexp as be, pathToRegexpMatch as Pe, formDataToJson as Ce, camelCase as b, upperFirst as Re, pick as Fe, jsonp as Ie, loadScript as z, Request as xe, Storage as He, mapToObject as J } from "@vtj/utils";
3
- import * as T from "vue";
4
- import { toRef as Me, readonly as Oe, customRef as De, ref as L, onBeforeUnmount as ke, getCurrentScope as Te, onScopeDispose as Be, unref as Ae, getCurrentInstance as se, watch as oe, computed as ie, onMounted as Ue, defineComponent as ae, h as U, inject as Ne, defineAsyncComponent as Z, watchEffect as qe } from "vue";
5
- import { useRoute as ce } from "vue-router";
6
- import { ElNotification as V, ElLoading as Je } from "element-plus";
7
- import D from "mockjs";
8
- import { XStartup as Le } from "@vtj/ui";
1
+ import { Base as ve, BUILT_IN_COMPONENTS as ye, ProjectModel as I, HistoryModel as ee } from "@vtj/core";
2
+ import { isUrl as ge, url as b, dedupArray as _e, isString as S, isFunction as K, logger as x, createRequest as we, merge as Se, pathToRegexp as $e, pathToRegexpMatch as je, formDataToJson as Ee, camelCase as j, upperFirst as be, pick as Pe, jsonp as Ce, loadScript as Q, Request as Re, Storage as Fe, mapToObject as U } from "@vtj/utils";
3
+ import * as O from "vue";
4
+ import { toRef as Ie, readonly as xe, customRef as He, ref as N, onBeforeUnmount as Me, getCurrentScope as Oe, onScopeDispose as De, unref as ke, getCurrentInstance as te, watch as ne, computed as re, onMounted as Te, defineComponent as se, h as T, inject as Ae, defineAsyncComponent as X, watchEffect as Be } from "vue";
5
+ import { useRoute as oe } from "vue-router";
6
+ import { ElNotification as q, ElLoading as Ue } from "element-plus";
7
+ import H from "mockjs";
8
+ import { XStartup as Ne } from "@vtj/ui";
9
9
  /**!
10
10
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
11
11
  * @name @vtj/renderer
12
12
  * @author CHC chenhuachun1549@dingtalk.com
13
- * @version 0.8.49
13
+ * @version 0.8.51
14
14
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
15
15
  */
16
- const F = "0.8.49";
17
- var S = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(S || {});
18
- const ee = [
16
+ const P = "0.8.51";
17
+ var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
18
+ const Y = [
19
19
  "$el",
20
20
  "$emit",
21
21
  "$nextTick",
@@ -27,7 +27,7 @@ const ee = [
27
27
  "$props",
28
28
  "$options",
29
29
  "$forceUpdate"
30
- ], tn = [
30
+ ], zt = [
31
31
  "beforeCreate",
32
32
  "created",
33
33
  "beforeMount",
@@ -41,7 +41,7 @@ const ee = [
41
41
  "renderTriggered",
42
42
  "activated",
43
43
  "deactivated"
44
- ], Ve = ["vIf", "vShow", "vModel", "vFor", "vBind"], We = {
44
+ ], qe = ["vIf", "vShow", "vModel", "vFor", "vBind"], Je = {
45
45
  String,
46
46
  Number,
47
47
  Boolean,
@@ -50,55 +50,55 @@ const ee = [
50
50
  Function,
51
51
  Date
52
52
  };
53
- function x(n, e) {
54
- return n.map((t) => Se(t) ? t : `${e}${t}`);
53
+ function R(n, e) {
54
+ return n.map((t) => ge(t) ? t : `${e}${t}`);
55
55
  }
56
- function W(n) {
56
+ function J(n) {
57
57
  return /\.css$/.test(n);
58
58
  }
59
- function G(n) {
59
+ function L(n) {
60
60
  return /\.js$/.test(n);
61
61
  }
62
- function Ge(n) {
62
+ function Le(n) {
63
63
  return /\.json$/.test(n);
64
64
  }
65
- function nn(n) {
65
+ function Zt(n) {
66
66
  return n.map(
67
- (e) => `<script src="${C.append(e, { v: F })}"><\/script>`
67
+ (e) => `<script src="${b.append(e, { v: P })}"><\/script>`
68
68
  ).join("");
69
69
  }
70
- function rn(n = []) {
70
+ function en(n = []) {
71
71
  return n.map(
72
- (e) => `<link rel="stylesheet" href="${C.append(e, { v: F })}" />`
72
+ (e) => `<link rel="stylesheet" href="${b.append(e, { v: P })}" />`
73
73
  ).join("");
74
74
  }
75
- function Ke(n, e) {
76
- const t = n.filter((u) => !!u.enabled), r = [], s = [], o = [], a = [], i = {}, l = {}, c = [], p = {};
75
+ function Ve(n, e) {
76
+ const t = n.filter((u) => !!u.enabled), r = [], s = [], o = [], a = [], i = {}, l = {}, c = [], d = {};
77
77
  return t.forEach(
78
- ({ urls: u, assetsUrl: f, library: m, assetsLibrary: w, localeLibrary: h }) => {
79
- u?.forEach((g) => {
80
- G(g) && r.push(g), W(g) && s.push(g);
81
- }), m && (a.push(m), i[m] = x(u || [], e), h && (l[m] = h)), f && o.push(f), w && c.push(w), m && w && (p[w] = m);
78
+ ({ urls: u, assetsUrl: f, library: p, assetsLibrary: h, localeLibrary: m }) => {
79
+ u?.forEach((v) => {
80
+ L(v) && r.push(v), J(v) && s.push(v);
81
+ }), p && (a.push(p), i[p] = R(u || [], e), m && (l[p] = m)), f && o.push(f), h && c.push(h), p && h && (d[h] = p);
82
82
  }
83
83
  ), {
84
- scripts: x(r, e),
85
- css: x(s, e),
86
- materials: x(o, e),
84
+ scripts: R(r, e),
85
+ css: R(s, e),
86
+ materials: R(o, e),
87
87
  libraryExports: a,
88
- materialExports: $e(c),
89
- materialMapLibrary: p,
88
+ materialExports: _e(c),
89
+ materialMapLibrary: d,
90
90
  libraryMap: i,
91
91
  libraryLocaleMap: l
92
92
  };
93
93
  }
94
- function Qe(n, e) {
94
+ function We(n, e) {
95
95
  const { name: t, parent: r, alias: s } = n;
96
96
  return r ? e[r]?.[s || t] : e[s || t];
97
97
  }
98
- function le(n) {
99
- return E(n) ? n : JSON.stringify(n);
98
+ function ie(n) {
99
+ return S(n) ? n : JSON.stringify(n);
100
100
  }
101
- function ue(n, e, t) {
101
+ function ae(n, e, t) {
102
102
  const r = n.CSSStyleSheet;
103
103
  if (r.prototype.replaceSync) {
104
104
  const s = new r();
@@ -113,11 +113,11 @@ function ue(n, e, t) {
113
113
  o ? o.innerHTML = t : (o = s.createElement("style"), o.id = e, o.innerHTML = t, s.head.appendChild(o));
114
114
  }
115
115
  }
116
- async function Xe(n, e) {
116
+ async function Ge(n, e) {
117
117
  const t = await window.fetch(e).then((r) => r.text()).catch(() => "");
118
- t && ue(window, n, t);
118
+ t && ae(window, n, t);
119
119
  }
120
- function fe(n, e = window) {
120
+ function ce(n, e = window) {
121
121
  const t = e.document, r = e.document.head;
122
122
  for (const s of n)
123
123
  if (!t.getElementById(s)) {
@@ -125,7 +125,7 @@ function fe(n, e = window) {
125
125
  a.rel = "stylesheet", a.id = s, a.href = s, r.appendChild(a);
126
126
  }
127
127
  }
128
- async function Ye(n, e, t = window) {
128
+ async function Ke(n, e, t = window) {
129
129
  const r = t.document, s = t.document.head;
130
130
  let o = t[e];
131
131
  return o ? o.default || o : new Promise((a, i) => {
@@ -133,16 +133,16 @@ async function Ye(n, e, t = window) {
133
133
  const c = r.createElement("script");
134
134
  c.src = l, c.onload = () => {
135
135
  o = t[e], o ? a(o.default || o) : i(null);
136
- }, c.onerror = (p) => {
137
- i(p);
136
+ }, c.onerror = (d) => {
137
+ i(d);
138
138
  }, s.appendChild(c);
139
139
  }
140
140
  });
141
141
  }
142
- function ze(n) {
143
- return Y(n) || Y(n?.install);
142
+ function Qe(n) {
143
+ return K(n) || K(n?.install);
144
144
  }
145
- function I(n, e, t = !1, r = !1) {
145
+ function C(n, e, t = !1, r = !1) {
146
146
  try {
147
147
  const s = ['"use strict";', "var __self = arguments[0];"];
148
148
  s.push("return ");
@@ -152,13 +152,13 @@ function I(n, e, t = !1, r = !1) {
152
152
  const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
153
153
  return new Function("$scope", a)(e);
154
154
  } catch (s) {
155
- if (O.error("parseExpression.error", s, n, e?.__self ?? e), r)
155
+ if (x.error("parseExpression.error", s, n, e?.__self ?? e), r)
156
156
  throw s;
157
157
  }
158
158
  }
159
- function te(n, e, t = !1, r = !1) {
160
- const s = I(n, e, t, r);
161
- if (typeof s != "function" && (O.error(
159
+ function z(n, e, t = !1, r = !1) {
160
+ const s = C(n, e, t, r);
161
+ if (typeof s != "function" && (x.error(
162
162
  "parseFunction.error",
163
163
  "not a function",
164
164
  n,
@@ -167,20 +167,20 @@ function te(n, e, t = !1, r = !1) {
167
167
  throw new Error(`"${n.value}" not a function`);
168
168
  return s;
169
169
  }
170
- function _(n) {
170
+ function g(n) {
171
171
  return n && n.type === "JSExpression";
172
172
  }
173
- function B(n) {
173
+ function D(n) {
174
174
  return typeof n == "object" && n && n.type === "JSFunction";
175
175
  }
176
- function Ze(n) {
177
- return _(n) || B(n);
176
+ function Xe(n) {
177
+ return g(n) || D(n);
178
178
  }
179
- function sn(n) {
180
- return Ze(n) ? n.value : JSON.stringify(n);
179
+ function tn(n) {
180
+ return Xe(n) ? n.value : JSON.stringify(n);
181
181
  }
182
- let P = null;
183
- const et = je({
182
+ let E = null;
183
+ const Ye = we({
184
184
  settings: {
185
185
  type: "form",
186
186
  validSuccess: !0,
@@ -189,23 +189,23 @@ const et = je({
189
189
  validate: (n) => n.data?.code === 0 || !!n.data?.success,
190
190
  failMessage: !0,
191
191
  showError: (n) => {
192
- V.error({
192
+ q.error({
193
193
  message: n || "未知错误"
194
194
  });
195
195
  },
196
196
  showLoading: () => {
197
- P && P.close(), P = Je.service({
197
+ E && E.close(), E = Ue.service({
198
198
  lock: !0,
199
199
  text: "Loading",
200
200
  background: "rgba(0, 0, 0, 0.05)"
201
201
  });
202
202
  },
203
203
  hideLoading: () => {
204
- P && (P.close(), P = null);
204
+ E && (E.close(), E = null);
205
205
  }
206
206
  }
207
207
  });
208
- function tt(n, e) {
208
+ function ze(n, e) {
209
209
  const { jsonp: t, request: r } = e;
210
210
  if (n.method === "jsonp")
211
211
  return (s = {}) => t(n.url, {
@@ -213,7 +213,7 @@ function tt(n, e) {
213
213
  query: s
214
214
  });
215
215
  {
216
- const s = n.headers ? I(n.headers, {}, !0) : void 0, o = {
216
+ const s = n.headers ? C(n.headers, {}, !0) : void 0, o = {
217
217
  url: n.url,
218
218
  method: n.method,
219
219
  settings: {
@@ -221,10 +221,10 @@ function tt(n, e) {
221
221
  headers: s
222
222
  }
223
223
  };
224
- return (a, i) => r.send(Ee(o, i || {}, { data: a }));
224
+ return (a, i) => r.send(Se(o, i || {}, { data: a }));
225
225
  }
226
226
  }
227
- function nt(n, e) {
227
+ function Ze(n, e) {
228
228
  const { metaQuery: t } = e;
229
229
  if (!t)
230
230
  return;
@@ -237,35 +237,35 @@ function nt(n, e) {
237
237
  return t(r, s, o, a);
238
238
  };
239
239
  }
240
- function rt(n = [], e = [], t) {
240
+ function et(n = [], e = [], t) {
241
241
  const r = {};
242
242
  for (const s of n)
243
- r[s.id] = tt(s, t);
243
+ r[s.id] = ze(s, t);
244
244
  for (const s of e)
245
- r[s.id] = nt(s, t);
245
+ r[s.id] = Ze(s, t);
246
246
  return r;
247
247
  }
248
- function st(n = []) {
249
- D.setup({
248
+ function tt(n = []) {
249
+ H.setup({
250
250
  timeout: "50-500"
251
- }), pe(), n.forEach((e) => ot(e));
251
+ }), le(), n.forEach((e) => nt(e));
252
252
  }
253
- function ot(n) {
253
+ function nt(n) {
254
254
  if (!n.mock)
255
255
  return;
256
256
  const { url: e, mockTemplate: t } = n;
257
257
  if (e && t) {
258
- const r = be(`${e}(.*)`), s = Pe(e, { decode: decodeURIComponent }), o = I(t, {}, !0);
259
- D.mock(r, (a) => {
260
- const i = C.parse(a.url) || {}, l = a.body instanceof FormData ? Ce(a.body) : a.body, c = s(a.url)?.params;
261
- return Object.assign(a, { data: l, params: i, query: c }), D.mock(o(a));
258
+ const r = $e(`${e}(.*)`), s = je(e, { decode: decodeURIComponent }), o = C(t, {}, !0);
259
+ H.mock(r, (a) => {
260
+ const i = b.parse(a.url) || {}, l = a.body instanceof FormData ? Ee(a.body) : a.body, c = s(a.url)?.params;
261
+ return Object.assign(a, { data: l, params: i, query: c }), H.mock(o(a));
262
262
  });
263
263
  }
264
264
  }
265
- function pe() {
266
- D._mocked = {};
265
+ function le() {
266
+ H._mocked = {};
267
267
  }
268
- class it {
268
+ class rt {
269
269
  __id = null;
270
270
  __mode;
271
271
  __instance = null;
@@ -294,7 +294,7 @@ class it {
294
294
  const { mode: t, dsl: r, attrs: s } = e;
295
295
  this.__mode = t, r && (this.__id = r.id || null, this.__transform = r.transform || {}), s && Object.assign(this, s);
296
296
  }
297
- setup(e, t = T) {
297
+ setup(e, t = O) {
298
298
  const r = t.getCurrentInstance();
299
299
  if (!r)
300
300
  return;
@@ -309,40 +309,40 @@ class it {
309
309
  });
310
310
  }
311
311
  __proxy() {
312
- this.__instance && ee.forEach((e) => {
312
+ this.__instance && Y.forEach((e) => {
313
313
  this[e] = this.__instance?.[e];
314
314
  });
315
315
  }
316
316
  __cleanup() {
317
- ee.forEach((e) => {
317
+ Y.forEach((e) => {
318
318
  this[e] = null;
319
319
  });
320
320
  }
321
321
  __parseFunction(e) {
322
322
  if (e)
323
- if (this.__mode === S.Runtime) {
323
+ if (this.__mode === _.Runtime) {
324
324
  const { id: t, type: r } = e, s = t ? this.__transform[t] ?? e.value : e.value;
325
- return te({ type: r, value: s }, this);
325
+ return z({ type: r, value: s }, this);
326
326
  } else
327
- return te(e, this);
327
+ return z(e, this);
328
328
  }
329
329
  __parseExpression(e) {
330
330
  if (e)
331
- if (this.__mode === S.Runtime) {
331
+ if (this.__mode === _.Runtime) {
332
332
  const { id: t, type: r } = e, s = t ? this.__transform[t] ?? e.value : e.value;
333
- return I({ type: r, value: s }, this);
333
+ return C({ type: r, value: s }, this);
334
334
  } else
335
- return I(e, this);
335
+ return C(e, this);
336
336
  }
337
337
  __ref(e = null, t) {
338
- if (this.__mode !== S.VNode)
338
+ if (this.__mode !== _.VNode)
339
339
  return e && e !== this.__id && (this.__contextRefs[e] = this), (r) => {
340
340
  let s = r?.$vtjEl || r?.$el || r;
341
341
  if (!s) {
342
342
  typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
343
343
  return;
344
344
  }
345
- if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e, S.Design === this.__mode && (s.__context__ = this), e && (this.__refs[e] = r), typeof t == "function")
345
+ if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e, _.Design === this.__mode && (s.__context__ = this), e && (this.__refs[e] = r), typeof t == "function")
346
346
  t(r);
347
347
  else if (t) {
348
348
  const o = this.$refs[t];
@@ -363,10 +363,10 @@ class it {
363
363
  return r.context.__proto__ = this.context, r.__proto__ = this, r;
364
364
  }
365
365
  }
366
- function N(n) {
366
+ function A(n) {
367
367
  const {
368
- Vue: e = T,
369
- mode: t = S.Runtime,
368
+ Vue: e = O,
369
+ mode: t = _.Runtime,
370
370
  components: r = {},
371
371
  libs: s = {},
372
372
  apis: o = {},
@@ -375,61 +375,61 @@ function N(n) {
375
375
  $components: r,
376
376
  $libs: s,
377
377
  $apis: o
378
- }, c = new it({
378
+ }, c = new rt({
379
379
  mode: t,
380
380
  dsl: i.value,
381
381
  attrs: l
382
- }), p = e.defineComponent({
382
+ }), d = e.defineComponent({
383
383
  name: i.value.name,
384
384
  props: {
385
- ...ct(i.value.props ?? [], c)
385
+ ...ot(i.value.props ?? [], c)
386
386
  },
387
387
  setup(u) {
388
- c.$props = u, c.props = u, i.value.id && ue(
388
+ c.$props = u, c.props = u, i.value.id && ae(
389
389
  n.window || window,
390
390
  i.value.id,
391
391
  i.value.css || ""
392
- ), c.state = lt(e, i.value.state ?? {}, c);
393
- const f = ut(e, i.value.computed ?? {}, c), m = ft(i.value.methods ?? {}, c), w = pt(e, i.value.inject, c), h = dt(
392
+ ), c.state = it(e, i.value.state ?? {}, c);
393
+ const f = at(e, i.value.computed ?? {}, c), p = ct(i.value.methods ?? {}, c), h = lt(e, i.value.inject, c), m = ut(
394
394
  i.value.dataSources || {},
395
395
  c
396
- ), g = {
397
- ...w,
396
+ ), v = {
397
+ ...h,
398
398
  ...f,
399
- ...m,
400
- ...h
399
+ ...p,
400
+ ...m
401
401
  };
402
- return c.setup(g, e), mt(e, i.value.watch ?? [], c), {
402
+ return c.setup(v, e), ft(e, i.value.watch ?? [], c), {
403
403
  vtj: c
404
404
  };
405
405
  },
406
- emits: at(i.value.emits),
406
+ emits: st(i.value.emits),
407
407
  expose: ["vtj"],
408
408
  render() {
409
409
  if (!i.value.nodes)
410
410
  return null;
411
411
  const u = i.value.nodes || [];
412
- return u.length === 1 ? k(u[0], c, e, a) : u.map((f) => k(f, c, e, a));
412
+ return u.length === 1 ? M(u[0], c, e, a) : u.map((f) => M(f, c, e, a));
413
413
  },
414
- ...ht(i.value.lifeCycles ?? {}, c)
414
+ ...pt(i.value.lifeCycles ?? {}, c)
415
415
  });
416
416
  return {
417
- renderer: e.markRaw(p),
417
+ renderer: e.markRaw(d),
418
418
  context: c
419
419
  };
420
420
  }
421
- function at(n = []) {
422
- return n.map((e) => E(e) ? e : e.name);
421
+ function st(n = []) {
422
+ return n.map((e) => S(e) ? e : e.name);
423
423
  }
424
- function ct(n = [], e) {
425
- const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) => We[o]) : void 0;
426
- return n.map((r) => E(r) ? {
424
+ function ot(n = [], e) {
425
+ const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) => Je[o]) : void 0;
426
+ return n.map((r) => S(r) ? {
427
427
  name: r
428
428
  } : {
429
429
  name: r.name,
430
430
  type: r.type,
431
431
  required: r.required,
432
- default: _(r.default) ? e.__parseExpression(r.default) : r.default
432
+ default: g(r.default) ? e.__parseExpression(r.default) : r.default
433
433
  }).reduce(
434
434
  (r, s) => (r[s.name] = {
435
435
  type: t(s.type),
@@ -439,44 +439,44 @@ function ct(n = [], e) {
439
439
  {}
440
440
  );
441
441
  }
442
- function lt(n, e, t) {
442
+ function it(n, e, t) {
443
443
  return n.reactive(
444
444
  Object.keys(e || {}).reduce(
445
445
  (r, s) => {
446
446
  let o = e[s];
447
- return _(o) ? o = t.__parseExpression(o) : B(o) && (o = t.__parseFunction(o)), r[s] = o, r;
447
+ return g(o) ? o = t.__parseExpression(o) : D(o) && (o = t.__parseFunction(o)), r[s] = o, r;
448
448
  },
449
449
  {}
450
450
  )
451
451
  );
452
452
  }
453
- function ut(n, e, t) {
453
+ function at(n, e, t) {
454
454
  return Object.entries(e ?? {}).reduce(
455
455
  (r, [s, o]) => (r[s] = n.computed(t.__parseFunction(o)), r),
456
456
  {}
457
457
  );
458
458
  }
459
- function ft(n, e) {
459
+ function ct(n, e) {
460
460
  return Object.entries(n ?? {}).reduce(
461
461
  (t, [r, s]) => (t[r] = e.__parseFunction(s), t),
462
462
  {}
463
463
  );
464
464
  }
465
- function pt(n, e = [], t) {
465
+ function lt(n, e = [], t) {
466
466
  return e.reduce(
467
467
  (r, s) => {
468
468
  const { name: o, from: a } = s || {};
469
469
  s.default;
470
- const i = _(a) ? t.__parseExpression(a) || o : a ?? o, l = _(s.default) ? t.__parseExpression(s.default) : s.default ?? null;
470
+ const i = g(a) ? t.__parseExpression(a) || o : a ?? o, l = g(s.default) ? t.__parseExpression(s.default) : s.default ?? null;
471
471
  return r[o] = n.inject(i, l), r;
472
472
  },
473
473
  {}
474
474
  );
475
475
  }
476
- function dt(n, e) {
476
+ function ut(n, e) {
477
477
  return Object.keys(n).reduce(
478
478
  (t, r) => {
479
- const s = n[r], o = e.$apis[s.ref], a = B(s.transform) ? s.transform.value ? e.__parseFunction(s.transform) : void 0 : s.transform;
479
+ const s = n[r], o = e.$apis[s.ref], a = D(s.transform) ? s.transform.value ? e.__parseFunction(s.transform) : void 0 : s.transform;
480
480
  return t[r] = async (...i) => {
481
481
  const l = await o.apply(e, i);
482
482
  return a ? a(l) : l;
@@ -485,7 +485,7 @@ function dt(n, e) {
485
485
  {}
486
486
  );
487
487
  }
488
- function mt(n, e = [], t) {
488
+ function ft(n, e = [], t) {
489
489
  e.forEach((r) => {
490
490
  n.watch(
491
491
  t.__parseExpression(r.source),
@@ -497,19 +497,19 @@ function mt(n, e = [], t) {
497
497
  );
498
498
  });
499
499
  }
500
- function ht(n, e) {
500
+ function pt(n, e) {
501
501
  return Object.entries(n ?? {}).reduce(
502
502
  (t, [r, s]) => (t[r] = e.__parseFunction(s), t),
503
503
  {}
504
504
  );
505
505
  }
506
- let A = [];
507
- const vt = (n) => n;
508
- async function de(n, e = window) {
509
- const { urls: t = [], library: r } = n, s = t.filter((i) => G(i));
506
+ let k = [];
507
+ const dt = (n) => n;
508
+ async function ue(n, e = window) {
509
+ const { urls: t = [], library: r } = n, s = t.filter((i) => L(i));
510
510
  if (s.length === 0 || !r)
511
511
  return null;
512
- const o = t.filter((i) => W(i)), a = await Ye(s, r, e).catch(
512
+ const o = t.filter((i) => J(i)), a = await Ke(s, r, e).catch(
513
513
  (i) => (console.warn("loadScriptUrl error", s, r, i), null)
514
514
  );
515
515
  return a ? {
@@ -517,70 +517,70 @@ async function de(n, e = window) {
517
517
  css: o
518
518
  } : null;
519
519
  }
520
- function q(n) {
520
+ function B(n) {
521
521
  const { getDsl: e, getDslByUrl: t, options: r } = n;
522
- return r.window && (A.forEach((s) => {
522
+ return r.window && (k.forEach((s) => {
523
523
  delete r.window[s];
524
- }), A = []), (s, o, a = T) => !o || typeof o == "string" ? s : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
524
+ }), k = []), (s, o, a = O) => !o || typeof o == "string" ? s : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
525
525
  const i = await e(o.id);
526
- return i && (i.name = s), i ? N({
526
+ return i && (i.name = s), i ? A({
527
527
  ...r,
528
528
  Vue: a,
529
529
  dsl: i,
530
- mode: S.Runtime,
531
- loader: q(n)
530
+ mode: _.Runtime,
531
+ loader: B(n)
532
532
  }).renderer : null;
533
533
  }) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
534
534
  const i = await t(o.url);
535
- return i && (i.name = s), i ? N({
535
+ return i && (i.name = s), i ? A({
536
536
  ...r,
537
537
  Vue: a,
538
538
  dsl: i,
539
- mode: S.Runtime,
540
- loader: q(n)
539
+ mode: _.Runtime,
540
+ loader: B(n)
541
541
  }).renderer : null;
542
- }) : o.type === "Plugin" ? (o.library && A.push(o.library), a.defineAsyncComponent(async () => {
543
- const i = await de(o, r.window);
544
- return i ? (fe(i.css, r.window), i.component) : (console.warn("getPlugin result is null", o), null);
542
+ }) : o.type === "Plugin" ? (o.library && k.push(o.library), a.defineAsyncComponent(async () => {
543
+ const i = await ue(o, r.window);
544
+ return i ? (ce(i.css, r.window), i.component) : (console.warn("getPlugin result is null", o), null);
545
545
  })) : s;
546
546
  }
547
- function k(n, e, t = T, r = vt) {
547
+ function M(n, e, t = O, r = dt) {
548
548
  if (!n || !n.name || n.invisible)
549
549
  return null;
550
- const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: p } = yt(o);
551
- if (a && !gt(a, e))
550
+ const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } = mt(o);
551
+ if (a && !ht(a, e))
552
552
  return null;
553
553
  const u = (f) => {
554
- const m = f.$components, w = (() => {
554
+ const p = f.$components, h = (() => {
555
555
  if (n.name === "component")
556
- return _t(f, n.props?.is);
556
+ return vt(f, n.props?.is);
557
557
  if (n.name === "slot")
558
558
  return n.name;
559
- const v = r(n.name, n.from, t);
560
- return E(v) ? m[v] ?? v : v;
561
- })(), h = wt(s, n.props ?? {}, f), g = St(t, n.events ?? {}, f);
559
+ const $ = r(n.name, n.from, t);
560
+ return S($) ? p[$] ?? $ : $;
561
+ })(), m = yt(s, n.props ?? {}, f), v = gt(t, n.events ?? {}, f);
562
562
  if (n.name === "slot")
563
- return $t(t, n, h, f, r);
564
- p && Object.assign(h, f.__parseExpression(p.value)), l && (h.style = Object.assign(
565
- h.style ?? {},
566
- Et(l, f)
567
- )), c.forEach((v) => {
568
- Object.assign(h, bt(t, v, f));
563
+ return _t(t, n, m, f, r);
564
+ d && Object.assign(m, f.__parseExpression(d.value)), l && (m.style = Object.assign(
565
+ m.style ?? {},
566
+ St(l, f)
567
+ )), c.forEach(($) => {
568
+ Object.assign(m, $t(t, $, f));
569
569
  });
570
- const d = Pt(
570
+ const w = jt(
571
571
  t,
572
572
  n.children ?? [],
573
573
  f,
574
574
  r,
575
575
  n
576
576
  );
577
- return t.createVNode(w, { ...h, ...g }, d);
577
+ return t.createVNode(h, { ...m, ...v }, w);
578
578
  };
579
- return i ? Ft(i, u, e) : u(e);
579
+ return i ? Pt(i, u, e) : u(e);
580
580
  }
581
- function yt(n = []) {
582
- const e = n.find((i) => b(i.name) === "vIf"), t = n.find((i) => b(i.name) === "vFor"), r = n.find((i) => b(i.name) === "vShow"), s = n.find((i) => b(i.name) === "vBind"), o = n.filter((i) => b(i.name) === "vModel"), a = n.filter(
583
- (i) => !Ve.includes(b(i.name))
581
+ function mt(n = []) {
582
+ const e = n.find((i) => j(i.name) === "vIf"), t = n.find((i) => j(i.name) === "vFor"), r = n.find((i) => j(i.name) === "vShow"), s = n.find((i) => j(i.name) === "vBind"), o = n.filter((i) => j(i.name) === "vModel"), a = n.filter(
583
+ (i) => !qe.includes(j(i.name))
584
584
  );
585
585
  return {
586
586
  vIf: e,
@@ -591,23 +591,23 @@ function yt(n = []) {
591
591
  others: a
592
592
  };
593
593
  }
594
- function gt(n, e) {
594
+ function ht(n, e) {
595
595
  return !!e.__parseExpression(n.value);
596
596
  }
597
- function _t(n, e) {
598
- return e ? _(e) ? n.__parseExpression(e) : e : "div";
597
+ function vt(n, e) {
598
+ return e ? g(e) ? n.__parseExpression(e) : e : "div";
599
599
  }
600
- function wt(n, e, t) {
600
+ function yt(n, e, t) {
601
601
  const r = Object.keys(e || {}).reduce(
602
602
  (s, o) => {
603
603
  let a = e[o];
604
- return _(a) ? a = t.__parseExpression(a) : B(a) && (a = t.__parseFunction(a)), s[o] = a, s;
604
+ return g(a) ? a = t.__parseExpression(a) : D(a) && (a = t.__parseFunction(a)), s[o] = a, s;
605
605
  },
606
606
  {}
607
607
  );
608
608
  return r.ref = t.__ref(n, r.ref), r;
609
609
  }
610
- function St(n, e, t) {
610
+ function gt(n, e, t) {
611
611
  const r = ["passive", "capture", "once"], s = {
612
612
  capture: "Capture",
613
613
  once: "Once",
@@ -615,71 +615,71 @@ function St(n, e, t) {
615
615
  };
616
616
  return Object.keys(e || {}).reduce(
617
617
  (o, a) => {
618
- const i = e[a], l = me(i.modifiers), c = l.find((f) => r.includes(f)), p = "on" + Re(a) + (c && s[c] || ""), u = t.__parseFunction(i.handler);
619
- return u && (o[p] = n.withModifiers(u, l)), o;
618
+ const i = e[a], l = fe(i.modifiers), c = l.find((f) => r.includes(f)), d = "on" + be(a) + (c && s[c] || ""), u = t.__parseFunction(i.handler);
619
+ return u && (o[d] = n.withModifiers(u, l)), o;
620
620
  },
621
621
  {}
622
622
  );
623
623
  }
624
- function me(n = {}, e = !1) {
624
+ function fe(n = {}, e = !1) {
625
625
  const t = Object.keys(n);
626
626
  return e ? t.map((r) => "." + r) : t;
627
627
  }
628
- function $t(n, e, t, r, s) {
629
- const { children: o } = e, a = jt(e, r), i = r.$slots?.[a.name];
630
- return i ? i(t) : o ? E(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
631
- le(r.__parseExpression(o))
628
+ function _t(n, e, t, r, s) {
629
+ const { children: o } = e, a = wt(e, r), i = r.$slots?.[a.name];
630
+ return i ? i(t) : o ? S(o) ? n.createTextVNode(o) : g(o) ? n.createTextVNode(
631
+ ie(r.__parseExpression(o))
632
632
  ) : Array.isArray(o) ? o.map(
633
- (l) => k(l, r, n, s)
633
+ (l) => M(l, r, n, s)
634
634
  ) : null : null;
635
635
  }
636
- function jt(n, e) {
636
+ function wt(n, e) {
637
637
  const { props: t } = n, r = t?.name || "default";
638
638
  return {
639
- name: _(r) ? e.__parseExpression(r) : r,
639
+ name: g(r) ? e.__parseExpression(r) : r,
640
640
  params: []
641
641
  };
642
642
  }
643
- function Et(n, e) {
643
+ function St(n, e) {
644
644
  return e.__parseExpression(n.value) ? {} : {
645
645
  display: "none"
646
646
  };
647
647
  }
648
- function bt(n, e, t) {
648
+ function $t(n, e, t) {
649
649
  const r = {
650
650
  type: "JSFunction",
651
651
  value: e.value?.value ? `(v) => {
652
652
  ${e.value.value} = v;
653
653
  }` : "(v) => {}"
654
- }, s = t.__parseFunction(r), o = me(e.modifiers), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
654
+ }, s = t.__parseFunction(r), o = fe(e.modifiers), a = g(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
655
655
  return {
656
656
  [a]: t.__parseExpression(e.value),
657
657
  [`onUpdate:${a}`]: o.length && s ? n.withModifiers(s, o) : s
658
658
  };
659
659
  }
660
- function Pt(n, e, t, r, s) {
660
+ function jt(n, e, t, r, s) {
661
661
  if (!e)
662
662
  return null;
663
- if (E(e))
663
+ if (S(e))
664
664
  return { default: () => e };
665
- if (_(e))
665
+ if (g(e))
666
666
  return {
667
- default: () => le(t.__parseExpression(e))
667
+ default: () => ie(t.__parseExpression(e))
668
668
  };
669
669
  if (Array.isArray(e) && e.length > 0) {
670
- const o = Ct(e), a = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
670
+ const o = Et(e), a = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
671
671
  [`scope_${s.id}`]: i
672
672
  } : {};
673
- return Object.entries(o).reduce((i, [l, { nodes: c, params: p }]) => (i[l] = (u) => {
674
- const f = p.length ? Fe(u ?? {}, p) : a(u);
673
+ return Object.entries(o).reduce((i, [l, { nodes: c, params: d }]) => (i[l] = (u) => {
674
+ const f = d.length ? Pe(u ?? {}, d) : a(u);
675
675
  return c.map(
676
- (m) => k(m, t.__clone(f), n, r)
676
+ (p) => M(p, t.__clone(f), n, r)
677
677
  );
678
678
  }, i), {});
679
679
  }
680
680
  return null;
681
681
  }
682
- function Ct(n) {
682
+ function Et(n) {
683
683
  const e = {
684
684
  default: {
685
685
  params: [],
@@ -687,7 +687,7 @@ function Ct(n) {
687
687
  }
688
688
  };
689
689
  for (const t of n) {
690
- const r = Rt(t.slot), s = r.name;
690
+ const r = bt(t.slot), s = r.name;
691
691
  e[s] ? (e[s].nodes.push(t), e[s].params = e[s].params.concat(r.params)) : e[s] = {
692
692
  nodes: [t],
693
693
  params: r.params
@@ -695,111 +695,111 @@ function Ct(n) {
695
695
  }
696
696
  return e;
697
697
  }
698
- function Rt(n = "default") {
699
- return E(n) ? { name: n, params: [] } : { params: [], ...n };
698
+ function bt(n = "default") {
699
+ return S(n) ? { name: n, params: [] } : { params: [], ...n };
700
700
  }
701
- function Ft(n, e, t) {
701
+ function Pt(n, e, t) {
702
702
  const { value: r, iterator: s } = n, { item: o = "item", index: a = "index" } = s || {};
703
703
  let i = t.__parseExpression(r) || [];
704
704
  return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }))) : (console.warn("[vForRender]:", `${r?.value} is not a Arrary`), []);
705
705
  }
706
- function It(n) {
707
- return Te() ? (Be(n), !0) : !1;
706
+ function Ct(n) {
707
+ return Oe() ? (De(n), !0) : !1;
708
708
  }
709
- function K(n) {
710
- return typeof n == "function" ? n() : Ae(n);
709
+ function V(n) {
710
+ return typeof n == "function" ? n() : ke(n);
711
711
  }
712
- const he = typeof window < "u" && typeof document < "u";
712
+ const pe = typeof window < "u" && typeof document < "u";
713
713
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
714
- const xt = (n) => n != null, Ht = () => {
714
+ const Rt = (n) => n != null, Ft = () => {
715
715
  };
716
- function Mt(n) {
717
- return se();
716
+ function It(n) {
717
+ return te();
718
718
  }
719
- function Ot(...n) {
719
+ function xt(...n) {
720
720
  if (n.length !== 1)
721
- return Me(...n);
721
+ return Ie(...n);
722
722
  const e = n[0];
723
- return typeof e == "function" ? Oe(De(() => ({ get: e, set: Ht }))) : L(e);
723
+ return typeof e == "function" ? xe(He(() => ({ get: e, set: Ft }))) : N(e);
724
724
  }
725
- function Dt(n, e) {
726
- Mt() && ke(n, e);
725
+ function Ht(n, e) {
726
+ It() && Me(n, e);
727
727
  }
728
- function kt(n) {
728
+ function Mt(n) {
729
729
  var e;
730
- const t = K(n);
730
+ const t = V(n);
731
731
  return (e = t?.$el) != null ? e : t;
732
732
  }
733
- const Tt = he ? window : void 0, Bt = he ? window.document : void 0;
734
- function At() {
735
- const n = L(!1), e = se();
736
- return e && Ue(() => {
733
+ const Ot = pe ? window : void 0, Dt = pe ? window.document : void 0;
734
+ function kt() {
735
+ const n = N(!1), e = te();
736
+ return e && Te(() => {
737
737
  n.value = !0;
738
738
  }, e), n;
739
739
  }
740
- function Ut(n) {
741
- const e = At();
742
- return ie(() => (e.value, !!n()));
740
+ function Tt(n) {
741
+ const e = kt();
742
+ return re(() => (e.value, !!n()));
743
743
  }
744
- function Nt(n, e, t = {}) {
745
- const { window: r = Tt, ...s } = t;
744
+ function At(n, e, t = {}) {
745
+ const { window: r = Ot, ...s } = t;
746
746
  let o;
747
- const a = Ut(() => r && "MutationObserver" in r), i = () => {
747
+ const a = Tt(() => r && "MutationObserver" in r), i = () => {
748
748
  o && (o.disconnect(), o = void 0);
749
- }, l = ie(() => {
750
- const f = K(n), m = (Array.isArray(f) ? f : [f]).map(kt).filter(xt);
751
- return new Set(m);
752
- }), c = oe(
749
+ }, l = re(() => {
750
+ const f = V(n), p = (Array.isArray(f) ? f : [f]).map(Mt).filter(Rt);
751
+ return new Set(p);
752
+ }), c = ne(
753
753
  () => l.value,
754
754
  (f) => {
755
- i(), a.value && f.size && (o = new MutationObserver(e), f.forEach((m) => o.observe(m, s)));
755
+ i(), a.value && f.size && (o = new MutationObserver(e), f.forEach((p) => o.observe(p, s)));
756
756
  },
757
757
  { immediate: !0, flush: "post" }
758
- ), p = () => o?.takeRecords(), u = () => {
758
+ ), d = () => o?.takeRecords(), u = () => {
759
759
  i(), c();
760
760
  };
761
- return It(u), {
761
+ return Ct(u), {
762
762
  isSupported: a,
763
763
  stop: u,
764
- takeRecords: p
764
+ takeRecords: d
765
765
  };
766
766
  }
767
- function qt(n = null, e = {}) {
767
+ function Bt(n = null, e = {}) {
768
768
  var t, r, s;
769
769
  const {
770
- document: o = Bt,
770
+ document: o = Dt,
771
771
  restoreOnUnmount: a = (u) => u
772
- } = e, i = (t = o?.title) != null ? t : "", l = Ot((r = n ?? o?.title) != null ? r : null), c = n && typeof n == "function";
773
- function p(u) {
772
+ } = e, i = (t = o?.title) != null ? t : "", l = xt((r = n ?? o?.title) != null ? r : null), c = n && typeof n == "function";
773
+ function d(u) {
774
774
  if (!("titleTemplate" in e))
775
775
  return u;
776
776
  const f = e.titleTemplate || "%s";
777
- return typeof f == "function" ? f(u) : K(f).replace(/%s/g, u);
777
+ return typeof f == "function" ? f(u) : V(f).replace(/%s/g, u);
778
778
  }
779
- return oe(
779
+ return ne(
780
780
  l,
781
781
  (u, f) => {
782
- u !== f && o && (o.title = p(typeof u == "string" ? u : ""));
782
+ u !== f && o && (o.title = d(typeof u == "string" ? u : ""));
783
783
  },
784
784
  { immediate: !0 }
785
- ), e.observe && !e.titleTemplate && o && !c && Nt(
785
+ ), e.observe && !e.titleTemplate && o && !c && At(
786
786
  (s = o.head) == null ? void 0 : s.querySelector("title"),
787
787
  () => {
788
- o && o.title !== l.value && (l.value = p(o.title));
788
+ o && o.title !== l.value && (l.value = d(o.title));
789
789
  },
790
790
  { childList: !0 }
791
- ), Dt(() => {
791
+ ), Ht(() => {
792
792
  if (a) {
793
793
  const u = a(i, l.value || "");
794
794
  u != null && o && (o.title = u);
795
795
  }
796
796
  }), l;
797
797
  }
798
- const ne = ae({
798
+ const Z = se({
799
799
  name: "VtjPageContainer",
800
800
  async setup() {
801
- const n = ye(), e = ce(), t = e.params.id, r = t ? n.getPage(t) : n.getHomepage(), s = r ? await n.getRenderComponent(r.id) : null;
802
- return r && qt(r.title || "VTJ"), {
801
+ const n = me(), e = oe(), t = e.params.id, r = t ? n.getPage(t) : n.getHomepage(), s = r ? await n.getRenderComponent(r.id) : null;
802
+ return r && Bt(r.title || "VTJ"), {
803
803
  provider: n,
804
804
  component: s,
805
805
  file: r,
@@ -807,36 +807,36 @@ const ne = ae({
807
807
  };
808
808
  },
809
809
  render() {
810
- return this.component ? U(this.component, this.query) : U("div", "页面不存在");
810
+ return this.component ? T(this.component, this.query) : T("div", "页面不存在");
811
811
  }
812
- }), Jt = ae({
812
+ }), Ut = se({
813
813
  name: "VtjStartupContainer",
814
814
  render() {
815
- return U(Le);
815
+ return T(Ne);
816
816
  }
817
- }), ve = Symbol("Provider");
818
- class Lt extends _e {
817
+ }), de = Symbol("Provider");
818
+ class Nt extends ve {
819
819
  constructor(e) {
820
820
  super(), this.options = e;
821
821
  const {
822
822
  service: t,
823
- mode: r = S.Raw,
823
+ mode: r = _.Raw,
824
824
  dependencies: s,
825
825
  materials: o,
826
826
  project: a = {},
827
827
  adapter: i = {},
828
828
  globals: l = {},
829
829
  modules: c = {},
830
- router: p = null,
830
+ router: d = null,
831
831
  materialPath: u = "./",
832
832
  nodeEnv: f = "development"
833
833
  } = e;
834
- this.mode = r, this.modules = c, this.service = t, this.router = p, this.materialPath = u, this.nodeEnv = f, s && (this.dependencies = s), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i), r !== S.Design && this.load(a);
834
+ this.mode = r, this.modules = c, this.service = t, this.router = d, this.materialPath = u, this.nodeEnv = f, s && (this.dependencies = s), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i), r !== _.Design && this.load(a);
835
835
  }
836
836
  mode;
837
837
  globals = {};
838
838
  modules = {};
839
- adapter = { request: et, jsonp: Ie };
839
+ adapter = { request: Ye, jsonp: Ce };
840
840
  apis = {};
841
841
  dependencies = {};
842
842
  materials = {};
@@ -852,66 +852,64 @@ class Lt extends _e {
852
852
  const t = this.modules[`.vtj/projects/${e.id}.json`];
853
853
  if (this.project = t ? await t() : await this.service.init(e), !this.project)
854
854
  throw new Error("project is null");
855
- const {
856
- dependencies: r = [],
857
- apis: s = [],
858
- meta: o = []
859
- } = this.project, { dependencies: a, library: i, components: l, materialPath: c } = this, {
860
- libraryExports: p,
861
- libraryMap: u,
862
- materials: f,
863
- materialExports: m,
864
- materialMapLibrary: w
865
- } = Ke(r, c), h = window;
866
- h.CKEDITOR_VERSION = void 0;
867
- for (const d of p) {
868
- const v = a[d], R = h[d];
869
- if (R)
870
- i[d] = R;
871
- else if (v)
872
- h[d] = i[d] = await v();
855
+ const { apis: r = [], meta: s = [] } = this.project, o = window;
856
+ o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" && await this.loadAssets(o), this.apis = et(r, s, this.adapter), le(), this.project.config?.mock && tt(r), this.initRouter(), this.triggerReady();
857
+ }
858
+ async loadAssets(e) {
859
+ const { dependencies: t = [] } = this.project, { dependencies: r, library: s, components: o, materialPath: a } = this, {
860
+ libraryExports: i,
861
+ libraryMap: l,
862
+ materials: c,
863
+ materialExports: d,
864
+ materialMapLibrary: u
865
+ } = Ve(t, a);
866
+ for (const p of i) {
867
+ const h = r[p], m = e[p];
868
+ if (m)
869
+ s[p] = m;
870
+ else if (h)
871
+ e[p] = s[p] = await h();
873
872
  else {
874
- const $ = u[d] || [];
875
- for (const j of $)
876
- W(j) && await Xe(d, C.append(j, { v: F })), G(j) && await z(C.append(j, { v: F }));
877
- i[d] = h[d];
873
+ const v = l[p] || [];
874
+ for (const w of v)
875
+ J(w) && await Ge(p, b.append(w, { v: P })), L(w) && await Q(b.append(w, { v: P }));
876
+ s[p] = e[p];
878
877
  }
879
878
  }
880
- for (const d of f)
881
- await z(C.append(d, { v: F }));
882
- const g = this.materials || {};
883
- for (const d of m) {
884
- const v = h[w[d]], R = we[d];
885
- if (R)
886
- v && R.forEach(($) => {
887
- l[$] = v[$];
879
+ for (const p of c)
880
+ await Q(b.append(p, { v: P }));
881
+ const f = this.materials || {};
882
+ for (const p of d) {
883
+ const h = e[u[p]], m = ye[p];
884
+ if (m)
885
+ h && m.forEach((v) => {
886
+ o[v] = h[v];
888
887
  });
889
888
  else {
890
- const $ = g[d] ? (await g[d]()).default : h[d];
891
- $ && v && ($.components || []).forEach((j) => {
892
- l[j.name] = Qe(j, v);
889
+ const v = f[p] ? (await f[p]()).default : e[p];
890
+ v && h && (v.components || []).forEach((w) => {
891
+ o[w.name] = We(w, h);
893
892
  });
894
893
  }
895
894
  }
896
- this.apis = rt(s, o, this.adapter), pe(), this.project.config?.mock && st(s), this.initRouter(), this.triggerReady();
897
895
  }
898
896
  initRouter() {
899
897
  const { router: e, project: t } = this;
900
898
  e && (e.addRoute({
901
899
  path: "/page/:id",
902
900
  name: "VtjPage",
903
- component: ne
901
+ component: Z
904
902
  }), e.addRoute({
905
903
  path: "/",
906
904
  name: "VtjHomepage",
907
- component: t?.homepage ? ne : Jt
905
+ component: t?.homepage ? Z : Ut
908
906
  }));
909
907
  }
910
908
  install(e) {
911
909
  const t = e.config.globalProperties.installed || {};
912
910
  for (const [r, s] of Object.entries(this.library))
913
- !t[r] && ze(s) && (e.use(s), t[r] = !0);
914
- this.options.install && e.use(this.options.install), e.provide(ve, this), e.config.globalProperties.installed = t;
911
+ !t[r] && Qe(s) && (e.use(s), t[r] = !0);
912
+ this.options.install && e.use(this.options.install), e.provide(de, this), e.config.globalProperties.installed = t;
915
913
  }
916
914
  getFile(e) {
917
915
  const { blocks: t = [] } = this.project || {};
@@ -959,12 +957,12 @@ class Lt extends _e {
959
957
  apis: a,
960
958
  window,
961
959
  ...t
962
- }, l = q({
960
+ }, l = B({
963
961
  getDsl: async (c) => await this.getDsl(c) || null,
964
962
  getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
965
963
  options: i
966
964
  });
967
- return N({
965
+ return A({
968
966
  ...i,
969
967
  dsl: e,
970
968
  loader: l
@@ -973,42 +971,42 @@ class Lt extends _e {
973
971
  async getRenderComponent(e) {
974
972
  const t = this.getFile(e);
975
973
  if (!t)
976
- return O.warn(`Can not find file: ${e}`), null;
974
+ return x.warn(`Can not find file: ${e}`), null;
977
975
  const r = `.vtj/vue/${e}.vue`, s = this.modules[r];
978
976
  if (s)
979
977
  return (await s())?.default;
980
978
  const o = await this.getDsl(t.id);
981
- return o ? this.createDslRenderer(o).renderer : (O.warn(`Can not find dsl: ${e}`), null);
979
+ return o ? this.createDslRenderer(o).renderer : (x.warn(`Can not find dsl: ${e}`), null);
982
980
  }
983
981
  defineUrlSchemaComponent(e, t) {
984
- return Z(async () => {
982
+ return X(async () => {
985
983
  const r = await this.getDslByUrl(e);
986
984
  return r ? (r.name = t || r.name, this.createDslRenderer(r).renderer) : null;
987
985
  });
988
986
  }
989
987
  definePluginComponent(e) {
990
- return Z(async () => {
991
- const t = await de(e, window);
992
- return t ? (fe(t.css), t.component) : null;
988
+ return X(async () => {
989
+ const t = await ue(e, window);
990
+ return t ? (ce(t.css), t.component) : null;
993
991
  });
994
992
  }
995
993
  }
996
- function on(n) {
997
- const e = new Lt(n);
994
+ function nn(n) {
995
+ const e = new Nt(n);
998
996
  return {
999
997
  provider: e,
1000
998
  onReady: (r) => e.ready(r)
1001
999
  };
1002
1000
  }
1003
- function ye(n = {}) {
1004
- const e = Ne(ve);
1001
+ function me(n = {}) {
1002
+ const e = Ae(de);
1005
1003
  if (!e)
1006
1004
  throw new Error("Can not find provider");
1007
1005
  if (e.nodeEnv === "development") {
1008
1006
  const { id: t, version: r } = n;
1009
1007
  t && r && (async () => {
1010
1008
  const s = await e.getDsl(t);
1011
- s?.__VERSION__ !== r && V.warning({
1009
+ s?.__VERSION__ !== r && q.warning({
1012
1010
  title: s?.name,
1013
1011
  message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
1014
1012
  });
@@ -1016,7 +1014,7 @@ function ye(n = {}) {
1016
1014
  }
1017
1015
  return e;
1018
1016
  }
1019
- const Q = new xe({
1017
+ const W = new Re({
1020
1018
  settings: {
1021
1019
  type: "json",
1022
1020
  validSuccess: !0,
@@ -1024,12 +1022,12 @@ const Q = new xe({
1024
1022
  failMessage: !0,
1025
1023
  validate: (n) => n.data?.code === 0,
1026
1024
  showError: (n) => {
1027
- V.error({
1025
+ q.error({
1028
1026
  message: n || "未知错误"
1029
1027
  });
1030
1028
  }
1031
1029
  }
1032
- }), Vt = (n = "/vtj/local/repository/${type}.json") => (e, t) => Q.send({
1030
+ }), qt = (n = "/vtj/local/repository/${type}.json") => (e, t) => W.send({
1033
1031
  url: n,
1034
1032
  method: "post",
1035
1033
  query: { type: e },
@@ -1037,7 +1035,7 @@ const Q = new xe({
1037
1035
  type: e,
1038
1036
  data: t
1039
1037
  }
1040
- }), Wt = (n = "/vtj/local/repository/uploader.json") => async (e, t) => await Q.send({
1038
+ }), Jt = (n = "/vtj/local/repository/uploader.json") => async (e, t) => await W.send({
1041
1039
  url: n,
1042
1040
  method: "post",
1043
1041
  data: {
@@ -1048,12 +1046,12 @@ const Q = new xe({
1048
1046
  type: "data"
1049
1047
  }
1050
1048
  }).then((r) => r && r[0] ? r[0] : null).catch(() => null);
1051
- class X {
1049
+ class G {
1052
1050
  api;
1053
1051
  pluginCaches = {};
1054
1052
  uploader;
1055
1053
  constructor() {
1056
- this.api = Vt(), this.uploader = Wt();
1054
+ this.api = qt(), this.uploader = Jt();
1057
1055
  }
1058
1056
  async getExtension() {
1059
1057
  console.log("BaseService.getExtension");
@@ -1126,11 +1124,11 @@ class X {
1126
1124
  return await this.api("clearStaticFiles", e).catch(() => "");
1127
1125
  }
1128
1126
  async getPluginMaterial(e) {
1129
- const { urls: t = [] } = e, r = t.filter((o) => Ge(o))[0];
1127
+ const { urls: t = [] } = e, r = t.filter((o) => Le(o))[0];
1130
1128
  if (!r)
1131
1129
  return null;
1132
1130
  const s = this.pluginCaches[r];
1133
- return s || (this.pluginCaches[r] = Q.send({
1131
+ return s || (this.pluginCaches[r] = W.send({
1134
1132
  url: r,
1135
1133
  method: "get",
1136
1134
  settings: {
@@ -1140,22 +1138,22 @@ class X {
1140
1138
  }).then((o) => o.data).catch(() => null));
1141
1139
  }
1142
1140
  }
1143
- const y = new He({
1141
+ const y = new Fe({
1144
1142
  type: "local",
1145
1143
  expired: 0,
1146
1144
  prefix: "__VTJ_"
1147
1145
  });
1148
- class an extends X {
1146
+ class rn extends G {
1149
1147
  init(e) {
1150
- const t = new M(e), r = y.get(`project_${t.id}`), s = Object.assign(t.toDsl(), r || {});
1148
+ const t = new I(e), r = y.get(`project_${t.id}`), s = Object.assign(t.toDsl(), r || {});
1151
1149
  return y.save(`project_${t.id}`, s), Promise.resolve(s);
1152
1150
  }
1153
1151
  saveProject(e) {
1154
- const t = new M(e);
1152
+ const t = new I(e);
1155
1153
  return y.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
1156
1154
  }
1157
1155
  saveMaterials(e, t) {
1158
- return y.save(`materials_${e.id}`, J(t)), Promise.resolve(!0);
1156
+ return y.save(`materials_${e.id}`, U(t)), Promise.resolve(!0);
1159
1157
  }
1160
1158
  saveFile(e) {
1161
1159
  return y.save(`file_${e.id}`, e), Promise.resolve(!0);
@@ -1179,7 +1177,7 @@ class an extends X {
1179
1177
  return Promise.resolve(!0);
1180
1178
  }
1181
1179
  getHistory(e) {
1182
- const t = y.get(`history_${e}`), r = new re(t || { id: e });
1180
+ const t = y.get(`history_${e}`), r = new ee(t || { id: e });
1183
1181
  return Promise.resolve(r.toDsl());
1184
1182
  }
1185
1183
  getHistoryItem(e, t) {
@@ -1195,22 +1193,22 @@ class an extends X {
1195
1193
  }), Promise.resolve(!0);
1196
1194
  }
1197
1195
  }
1198
- class Gt extends X {
1196
+ class Lt extends G {
1199
1197
  projects = {};
1200
1198
  materials = {};
1201
1199
  files = {};
1202
1200
  histories = {};
1203
1201
  historyItems = {};
1204
1202
  init(e) {
1205
- const t = new M(e), r = this.projects[t.id] || {}, s = Object.assign(t.toDsl(), r);
1203
+ const t = new I(e), r = this.projects[t.id] || {}, s = Object.assign(t.toDsl(), r);
1206
1204
  return this.projects[s.id] = s, Promise.resolve(s);
1207
1205
  }
1208
1206
  saveProject(e) {
1209
- const t = new M(e);
1207
+ const t = new I(e);
1210
1208
  return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
1211
1209
  }
1212
1210
  saveMaterials(e, t) {
1213
- return e.id && (this.materials[e.id] = J(t)), Promise.resolve(!0);
1211
+ return e.id && (this.materials[e.id] = U(t)), Promise.resolve(!0);
1214
1212
  }
1215
1213
  saveFile(e) {
1216
1214
  return this.files[e.id] = e, Promise.resolve(!0);
@@ -1234,7 +1232,7 @@ class Gt extends X {
1234
1232
  return Promise.resolve(!0);
1235
1233
  }
1236
1234
  getHistory(e) {
1237
- const t = this.histories[e], r = new re(t || { id: e });
1235
+ const t = this.histories[e], r = new ee(t || { id: e });
1238
1236
  return Promise.resolve(r);
1239
1237
  }
1240
1238
  getHistoryItem(e, t) {
@@ -1252,11 +1250,11 @@ class Gt extends X {
1252
1250
  }), Promise.resolve(!0);
1253
1251
  }
1254
1252
  }
1255
- let H = null;
1256
- function cn() {
1257
- return H || (H = new Gt(), H);
1253
+ let F = null;
1254
+ function sn() {
1255
+ return F || (F = new Lt(), F);
1258
1256
  }
1259
- class ln extends X {
1257
+ class on extends G {
1260
1258
  getFileCaches = {};
1261
1259
  async getExtension() {
1262
1260
  return await this.api("getExtension", {}).catch(() => {
@@ -1271,7 +1269,7 @@ class ln extends X {
1271
1269
  async saveMaterials(e, t) {
1272
1270
  return !!await this.api("saveMaterials", {
1273
1271
  project: e,
1274
- materials: J(t)
1272
+ materials: U(t)
1275
1273
  }).catch(() => !1);
1276
1274
  }
1277
1275
  async saveFile(e) {
@@ -1311,7 +1309,7 @@ class ln extends X {
1311
1309
  );
1312
1310
  }
1313
1311
  }
1314
- function ge(n = []) {
1312
+ function he(n = []) {
1315
1313
  return n.map((e) => {
1316
1314
  const { id: t, title: r, icon: s, children: o, hidden: a } = e;
1317
1315
  return {
@@ -1320,13 +1318,13 @@ function ge(n = []) {
1320
1318
  icon: s,
1321
1319
  hidden: a,
1322
1320
  url: `/page/${t}`,
1323
- children: o && o.length ? ge(o) : void 0
1321
+ children: o && o.length ? he(o) : void 0
1324
1322
  };
1325
1323
  });
1326
1324
  }
1327
- function un() {
1328
- const n = ye(), e = ce(), t = L(!1), r = n.project;
1329
- qe(() => {
1325
+ function an() {
1326
+ const n = me(), e = oe(), t = N(!1), r = n.project;
1327
+ Be(() => {
1330
1328
  const { name: a, params: i, meta: l } = e;
1331
1329
  if (a === "VtjPage") {
1332
1330
  const c = n.getPage(i.id);
@@ -1337,7 +1335,7 @@ function un() {
1337
1335
  } else
1338
1336
  t.value = !l.mask;
1339
1337
  });
1340
- const s = ge(r?.pages), o = r?.config;
1338
+ const s = he(r?.pages), o = r?.config;
1341
1339
  return {
1342
1340
  disabled: t,
1343
1341
  logo: o?.logo,
@@ -1347,54 +1345,54 @@ function un() {
1347
1345
  };
1348
1346
  }
1349
1347
  export {
1350
- Ve as BUILT_IN_DIRECTIVES,
1351
- X as BaseService,
1352
- ee as CONTEXT_HOST,
1353
- it as Context,
1354
- S as ContextMode,
1355
- We as DATA_TYPES,
1356
- sn as JSCodeToString,
1357
- tn as LIFE_CYCLES_LIST,
1358
- ln as LocalService,
1359
- Gt as MemoryService,
1360
- Lt as Provider,
1361
- an as StorageService,
1362
- F as VTJ_RENDERER_VERSION,
1363
- ue as adoptedStyleSheets,
1364
- nn as createAssetScripts,
1365
- rn as createAssetsCss,
1366
- dt as createDataSources,
1367
- q as createLoader,
1368
- cn as createMemoryService,
1369
- nt as createMetaApi,
1370
- on as createProvider,
1371
- N as createRenderer,
1372
- tt as createSchemaApi,
1373
- rt as createSchemaApis,
1374
- vt as defaultLoader,
1375
- x as fillBasePath,
1376
- me as getModifiers,
1377
- de as getPlugin,
1378
- Qe as getRawComponent,
1379
- W as isCSSUrl,
1380
- Ze as isJSCode,
1381
- _ as isJSExpression,
1382
- B as isJSFunction,
1383
- Ge as isJSON,
1384
- G as isJSUrl,
1385
- ze as isVuePlugin,
1386
- Xe as loadCss,
1387
- fe as loadCssUrl,
1388
- Ye as loadScriptUrl,
1389
- ot as mockApi,
1390
- st as mockApis,
1391
- pe as mockCleanup,
1392
- k as nodeRender,
1393
- Ke as parseDeps,
1394
- I as parseExpression,
1395
- te as parseFunction,
1396
- ve as providerKey,
1397
- le as toString,
1398
- un as useMask,
1399
- ye as useProvider
1348
+ qe as BUILT_IN_DIRECTIVES,
1349
+ G as BaseService,
1350
+ Y as CONTEXT_HOST,
1351
+ rt as Context,
1352
+ _ as ContextMode,
1353
+ Je as DATA_TYPES,
1354
+ tn as JSCodeToString,
1355
+ zt as LIFE_CYCLES_LIST,
1356
+ on as LocalService,
1357
+ Lt as MemoryService,
1358
+ Nt as Provider,
1359
+ rn as StorageService,
1360
+ P as VTJ_RENDERER_VERSION,
1361
+ ae as adoptedStyleSheets,
1362
+ Zt as createAssetScripts,
1363
+ en as createAssetsCss,
1364
+ ut as createDataSources,
1365
+ B as createLoader,
1366
+ sn as createMemoryService,
1367
+ Ze as createMetaApi,
1368
+ nn as createProvider,
1369
+ A as createRenderer,
1370
+ ze as createSchemaApi,
1371
+ et as createSchemaApis,
1372
+ dt as defaultLoader,
1373
+ R as fillBasePath,
1374
+ fe as getModifiers,
1375
+ ue as getPlugin,
1376
+ We as getRawComponent,
1377
+ J as isCSSUrl,
1378
+ Xe as isJSCode,
1379
+ g as isJSExpression,
1380
+ D as isJSFunction,
1381
+ Le as isJSON,
1382
+ L as isJSUrl,
1383
+ Qe as isVuePlugin,
1384
+ Ge as loadCss,
1385
+ ce as loadCssUrl,
1386
+ Ke as loadScriptUrl,
1387
+ nt as mockApi,
1388
+ tt as mockApis,
1389
+ le as mockCleanup,
1390
+ M as nodeRender,
1391
+ Ve as parseDeps,
1392
+ C as parseExpression,
1393
+ z as parseFunction,
1394
+ de as providerKey,
1395
+ ie as toString,
1396
+ an as useMask,
1397
+ me as useProvider
1400
1398
  };