@vtj/designer 0.7.9 → 0.7.11

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
@@ -2,19 +2,19 @@ import { defineComponent as E, openBlock as c, createElementBlock as j, toDispla
2
2
  import { ElNotification as Ue, ElMessageBox as ct, ElMessage as dt, ElButton as re, ElDivider as Le, ElRadioGroup as fn, ElRadioButton as Ze, ElButtonGroup as gn, ElBadge as hn, ElDropdown as Bt, ElDropdownMenu as Tt, ElDropdownItem as nt, ElInput as pe, ElEmpty as Z, ElTooltip as Ft, ElTag as bn, ElSwitch as zt, ElTree as pt, ElAlert as _n, ElRow as st, ElCol as lt, ElCollapse as yn, ElCollapseItem as kn, ElForm as Ne, ElDrawer as wn, ElBreadcrumb as Sn, ElBreadcrumbItem as Vn, ElLoading as xn, ElSelect as Cn, ElOption as En, ElInputNumber as jn, ElColorPicker as An, ElConfigProvider as Dn, ElContainer as ht, ElHeader as Pn, ElAside as bt, ElMain as In, ElFooter as Rn, ElFormItem as $n } from "element-plus";
3
3
  import Bn from "element-plus/es/locale/lang/zh-cn";
4
4
  import { XAction as ke, XIcon as De, XDialog as $e, XDialogForm as ce, XField as P, XPanel as mt, XTabs as Mt, XContainer as O, XForm as Tn, XActionBar as Fn, vResizable as _t, createDialog as zn } from "@vtj/ui";
5
- import { delay as Nt, upperFirstCamelCase as Ot, toRawType as Qe, cloneDeep as He, isPlainObject as Mn, merge as Wt, arrayToMap as Nn, toArray as On } from "@vtj/utils";
6
- import { parseExpression as Je, parseFunction as Wn, JSCodeToString as Ce, LIFE_CYCLES_LIST as Ln, DATA_TYPES as Jn, logger as me, isJSExpression as Pe, createLoader as Un, ContextMode as at, createRenderer as Hn, parseDeps as qn, createAssetsCss as Gn, createAssetScripts as yt, getRawComponent as Kn, createSchemaApis as Zn, Provider as Qn, isJSFunction as Xn } from "@vtj/renderer";
7
- import { isBlock as U, DirectiveModel as Lt, emitter as q, EVENT_PROJECT_ACTIVED as ot, EVENT_NODE_CHANGE as Ie, NodeModel as kt, EVENT_BLOCK_CHANGE as rt, Base as Jt, ProjectModel as Yn, EVENT_PROJECT_CHANGE as es, EVENT_PROJECT_BLOCKS_CHANGE as ts, EVENT_PROJECT_PAGES_CHANGE as ns, EVENT_PROJECT_DEPS_CHANGE as ss, EVENT_PROJECT_PUBLISH as ls, EVENT_PROJECT_FILE_PUBLISH as as, EVENT_HISTORY_CHANGE as os, EVENT_HISTORY_LOAD as rs, BlockModel as wt, HistoryModel as is } from "@vtj/core";
5
+ import { delay as Nt, upperFirstCamelCase as Ot, toRawType as Qe, cloneDeep as He, logger as me, isPlainObject as Mn, merge as Wt, arrayToMap as Nn, toArray as On } from "@vtj/utils";
6
+ import { isBlock as U, DirectiveModel as Lt, emitter as q, EVENT_PROJECT_ACTIVED as at, EVENT_NODE_CHANGE as Pe, NodeModel as yt, EVENT_BLOCK_CHANGE as ot, Base as Jt, ProjectModel as Wn, EVENT_PROJECT_CHANGE as Ln, EVENT_PROJECT_BLOCKS_CHANGE as Jn, EVENT_PROJECT_PAGES_CHANGE as Un, EVENT_PROJECT_DEPS_CHANGE as Hn, EVENT_PROJECT_PUBLISH as qn, EVENT_PROJECT_FILE_PUBLISH as Gn, EVENT_HISTORY_CHANGE as Kn, EVENT_HISTORY_LOAD as Zn, BlockModel as kt, HistoryModel as Qn } from "@vtj/core";
7
+ import { parseExpression as Je, parseFunction as Xn, JSCodeToString as Ce, LIFE_CYCLES_LIST as Yn, DATA_TYPES as es, isJSExpression as Ie, createLoader as ts, ContextMode as rt, createRenderer as ns, parseDeps as ss, createAssetsCss as ls, createAssetScripts as wt, getRawComponent as as, createSchemaApis as os, Provider as rs, isJSFunction as is } from "@vtj/renderer";
8
8
  import { VtjIconBack as us, VtjIconPc as cs, VtjIconPhone as ds, VtjIconPad as ps, VtjIconUndo as ms, VtjIconRedo as vs, VtjIconBug as fs, VtjIconPreview as gs, VtjIconRefresh as hs, VtjIconSetting as bs, icons as it, ArrowDown as _s, Search as Ut, Back as ys, VtjIconPlus as Ht, Delete as ks, VtjIconSave as ws, MoreFilled as vt, VtjIconCheck as qt, VtjIconCopy as Gt, VtjIconEdit as Kt, VtjIconRemove as qe, VtjIconLock as Zt, VtjIconUnlock as Ss, VtjIconInvisible as Qt, VtjIconVisible as Vs, VtjIconHome as xs, VtjIconSearch as Cs, VtjIconLayers as Xt, VtjIconArrowUp as Es, VtjIconArrowDown as js, ArrowRight as As, VtjIconDocument as Ds, VtjIconComponents as Ps, VtjIconBlock as Is, VtjIconOutline as Rs, VtjIconHistory as $s, VtjIconApi as Bs, VtjIconCategory as Ts, VtjIconInfo as Fs, VtjIconVars as zs, VtjIconSwitch as Ms, VtjIconHelp as Ns } from "@vtj/icons";
9
9
  import { useClipboard as Os, useElementSize as Yt } from "@vueuse/core";
10
10
  /**!
11
11
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
12
12
  * @name @vtj/designer
13
13
  * @author CHC chenhuachun1549@dingtalk.com
14
- * @version 0.7.9
14
+ * @version 0.7.11
15
15
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
16
16
  */
17
- const Ws = "0.7.9", St = {
17
+ const Ws = "0.7.11", St = {
18
18
  width: 390,
19
19
  height: 844
20
20
  }, Vt = {
@@ -371,7 +371,7 @@ function ae(i, e = "success") {
371
371
  function ee(i, e, t = !1) {
372
372
  let s = !0;
373
373
  try {
374
- i.type === "JSExpression" ? Je(i, e, t, !0) : Wn(i, e, t, !0);
374
+ i.type === "JSExpression" ? Je(i, e, t, !0) : Xn(i, e, t, !0);
375
375
  } catch (l) {
376
376
  s = !1, Ue.error({
377
377
  title: "代码错误",
@@ -2938,7 +2938,7 @@ const pl = { class: "v-switcher-widget" }, ml = { key: 1 }, vl = /* @__PURE__ */
2938
2938
  current: {}
2939
2939
  },
2940
2940
  setup(i) {
2941
- const e = i, t = S(() => Ln.map((o) => ({
2941
+ const e = i, t = S(() => Yn.map((o) => ({
2942
2942
  label: o,
2943
2943
  value: o
2944
2944
  }))), s = S(() => Object.entries(e.current?.lifeCycles || {}).map(([u, p]) => ({ name: u, value: Ce(p) }))), l = () => ({
@@ -3698,7 +3698,7 @@ const pl = { class: "v-switcher-widget" }, ml = { key: 1 }, vl = /* @__PURE__ */
3698
3698
  },
3699
3699
  e.item
3700
3700
  )
3701
- ), l = Object.keys(Jn).map((r) => ({
3701
+ ), l = Object.keys(es).map((r) => ({
3702
3702
  label: r,
3703
3703
  value: r
3704
3704
  })), a = async (r) => {
@@ -5277,7 +5277,7 @@ const pl = { class: "v-switcher-widget" }, ml = { key: 1 }, vl = /* @__PURE__ */
5277
5277
  setup(i, { emit: e }) {
5278
5278
  const t = (u = "") => ({
5279
5279
  type: "JSExpression",
5280
- value: Pe(u) ? u.value : u
5280
+ value: Ie(u) ? u.value : u
5281
5281
  }), s = i, l = e, a = (u) => ee(u, s.context, !0), r = w(t(s.modelValue).value);
5282
5282
  X(
5283
5283
  () => s.modelValue,
@@ -5335,7 +5335,7 @@ const pl = { class: "v-switcher-widget" }, ml = { key: 1 }, vl = /* @__PURE__ */
5335
5335
  },
5336
5336
  emits: ["change"],
5337
5337
  setup(i, { emit: e }) {
5338
- const t = i, s = e, l = S(() => Pe(t.modelValue) ? void 0 : Number(t.modelValue || 0)), a = (r) => {
5338
+ const t = i, s = e, l = S(() => Ie(t.modelValue) ? void 0 : Number(t.modelValue || 0)), a = (r) => {
5339
5339
  s("change", r);
5340
5340
  };
5341
5341
  return (r, o) => (c(), _(n(jn), ue({
@@ -5768,9 +5768,9 @@ class Qa {
5768
5768
  "scroll",
5769
5769
  this.bind(this.onViewChange, "onViewChange")
5770
5770
  ), e.addEventListener("resize", this.bind(this.onViewChange, "onViewChange")), t.addEventListener("mouseleave", this.bind(this.onLeave, "onLeave")), t.addEventListener("dragleave", this.bind(this.onLeave, "onLeave")), t.addEventListener("dragover", this.bind(this.onDragOver, "onDragOver")), t.addEventListener("drop", this.bind(this.onDrop, "onDrop")), t.addEventListener("click", this.bind(this.onSelected, "onSelected")), q.on(
5771
- ot,
5771
+ at,
5772
5772
  this.bind(this.onActiveChange, "onActiveChange")
5773
- ), q.on(Ie, this.bind(this.onViewChange, "onViewChange"));
5773
+ ), q.on(Pe, this.bind(this.onViewChange, "onViewChange"));
5774
5774
  }
5775
5775
  unbindEvents(e, t) {
5776
5776
  t.removeEventListener(
@@ -5786,10 +5786,10 @@ class Qa {
5786
5786
  "dragover",
5787
5787
  this.bind(this.onDragOver, "onDragOver")
5788
5788
  ), t.removeEventListener("drop", this.bind(this.onDrop, "onDrop")), t.removeEventListener("click", this.bind(this.onSelected, "onSelected")), q.off(
5789
- ot,
5789
+ at,
5790
5790
  this.bind(this.onActiveChange, "onActiveChange")
5791
5791
  ), q.off(
5792
- Ie,
5792
+ Pe,
5793
5793
  this.bind(this.onViewChange, "onViewChange")
5794
5794
  );
5795
5795
  }
@@ -5837,7 +5837,7 @@ class Qa {
5837
5837
  const o = r.model, u = l.value.type;
5838
5838
  if (!await this.allowDrop(o, u))
5839
5839
  return;
5840
- const p = this.createNodeDsl(s), m = new kt(p);
5840
+ const p = this.createNodeDsl(s), m = new yt(p);
5841
5841
  if (U(o))
5842
5842
  a.addNode(m, void 0, u);
5843
5843
  else {
@@ -5868,7 +5868,7 @@ class Qa {
5868
5868
  }
5869
5869
  getNodeByElement(e) {
5870
5870
  const t = e.__vtj__ ?? "";
5871
- return kt.nodes[t] || null;
5871
+ return yt.nodes[t] || null;
5872
5872
  }
5873
5873
  getDropType(e, t, s) {
5874
5874
  const { left: l, top: a, width: r, height: o } = e;
@@ -6047,19 +6047,19 @@ class Xa {
6047
6047
  apis: o
6048
6048
  } = this.env, u = t.document.createElement("div");
6049
6049
  u.id = "app", s.appendChild(u), this.dsl = l.reactive(e.toDsl());
6050
- const p = Un({
6050
+ const p = ts({
6051
6051
  getDsl: async (b) => await this.service.getFile(b) || null,
6052
6052
  options: {
6053
- mode: at.Design,
6053
+ mode: rt.Design,
6054
6054
  Vue: l,
6055
6055
  components: a,
6056
6056
  libs: r,
6057
6057
  apis: o,
6058
6058
  window: t
6059
6059
  }
6060
- }), { renderer: m, context: f } = Hn({
6060
+ }), { renderer: m, context: f } = ns({
6061
6061
  Vue: l,
6062
- mode: at.Design,
6062
+ mode: rt.Design,
6063
6063
  dsl: this.dsl,
6064
6064
  components: a,
6065
6065
  libs: r,
@@ -6073,7 +6073,7 @@ class Xa {
6073
6073
  } catch (b) {
6074
6074
  Q(b.message || "未知错误", "运行时错误"), console.error(b);
6075
6075
  }
6076
- this.context = f, q.on(Ie, this.nodeChange), q.on(rt, this.blockChange);
6076
+ this.context = f, q.on(Pe, this.nodeChange), q.on(ot, this.blockChange);
6077
6077
  }
6078
6078
  dispose() {
6079
6079
  if (this.app) {
@@ -6081,7 +6081,7 @@ class Xa {
6081
6081
  const e = this.app._container;
6082
6082
  e && e.parentNode && (e.parentNode.removeChild(e), this.app._container = null), this.app = null;
6083
6083
  }
6084
- this.dsl = null, this.context = null, q.off(Ie, this.nodeChange), q.off(rt, this.blockChange);
6084
+ this.dsl = null, this.context = null, q.off(Pe, this.nodeChange), q.off(ot, this.blockChange);
6085
6085
  }
6086
6086
  updateChild(e, t) {
6087
6087
  const s = t.children || t.nodes || [];
@@ -6144,7 +6144,7 @@ class Ya extends Jt {
6144
6144
  libraryExports: u,
6145
6145
  materialExports: p,
6146
6146
  materialMapLibrary: m
6147
- } = qn(t, this.materialPath);
6147
+ } = ss(t, this.materialPath);
6148
6148
  l.open(), l.write(`
6149
6149
  <!DOCTYPE html>
6150
6150
  <html lang="zh-CN">
@@ -6162,9 +6162,9 @@ class Ya extends Jt {
6162
6162
  background: #fff;
6163
6163
  }
6164
6164
  </style>
6165
- ${Gn(r)}
6166
- ${yt(a)}
6167
- ${yt(o)}
6165
+ ${ls(r)}
6166
+ ${wt(a)}
6167
+ ${wt(o)}
6168
6168
  </head>
6169
6169
  <body>
6170
6170
  </body>
@@ -6193,10 +6193,10 @@ class Ya extends Jt {
6193
6193
  const V = y.names || [], x = p[t[y.library || ""]];
6194
6194
  x && V.forEach((D) => {
6195
6195
  const F = b.get(D);
6196
- F ? m[D] = Kn(F, x) : m[D] = x[D];
6196
+ F ? m[D] = as(F, x) : m[D] = x[D];
6197
6197
  });
6198
6198
  }
6199
- const { adapter: h, globals: d } = u, k = Zn(r.value?.apis, h);
6199
+ const { adapter: h, globals: d } = u, k = os(r.value?.apis, h);
6200
6200
  return {
6201
6201
  window: l,
6202
6202
  Vue: l.Vue,
@@ -6328,8 +6328,8 @@ class Mo extends Jt {
6328
6328
  materials: o,
6329
6329
  materialPath: u = "./"
6330
6330
  } = e;
6331
- this.container = t, this.service = s, this.provider = new Qn({
6332
- mode: at.Design,
6331
+ this.container = t, this.service = s, this.provider = new rs({
6332
+ mode: rt.Design,
6333
6333
  globals: a,
6334
6334
  project: l,
6335
6335
  service: s,
@@ -6343,7 +6343,7 @@ class Mo extends Jt {
6343
6343
  }
6344
6344
  async init(e) {
6345
6345
  const t = await this.service.init(e).catch((s) => (me.warn("VTJEngine service init fail.", s), null));
6346
- t && (t.dependencies = Ga.merge(t.dependencies || []), this.project.value = new Yn(t), this.saveMaterials(), this.triggerReady());
6346
+ t && (t.dependencies = Ga.merge(t.dependencies || []), this.project.value = new Wn(t), this.saveMaterials(), this.triggerReady());
6347
6347
  }
6348
6348
  render() {
6349
6349
  const e = n(this.container);
@@ -6354,7 +6354,7 @@ class Mo extends Jt {
6354
6354
  me.warn("VTJEngine constructor param [ container ] is undefined");
6355
6355
  }
6356
6356
  bindEvents() {
6357
- q.on(es, (e) => this.saveProject(e)), q.on(ts, (e) => this.saveBlockFile(e)), q.on(ns, (e) => this.saveBlockFile(e)), q.on(ss, () => this.saveMaterials()), q.on(ot, (e) => this.activeFile(e)), q.on(ls, () => this.publish()), q.on(as, () => this.publishCurrent()), q.on(rt, (e) => this.changeFile(e)), q.on(Ie, () => this.changeCurrentFile()), q.on(os, (e) => this.saveHistory(e)), q.on(rs, (e) => this.loadHistory(e));
6357
+ q.on(Ln, (e) => this.saveProject(e)), q.on(Jn, (e) => this.saveBlockFile(e)), q.on(Un, (e) => this.saveBlockFile(e)), q.on(Hn, () => this.saveMaterials()), q.on(at, (e) => this.activeFile(e)), q.on(qn, () => this.publish()), q.on(Gn, () => this.publishCurrent()), q.on(ot, (e) => this.changeFile(e)), q.on(Pe, () => this.changeCurrentFile()), q.on(Kn, (e) => this.saveHistory(e)), q.on(Zn, (e) => this.loadHistory(e));
6358
6358
  }
6359
6359
  async activeFile(e) {
6360
6360
  await ye();
@@ -6366,7 +6366,7 @@ class Mo extends Jt {
6366
6366
  l && (s.dsl = l);
6367
6367
  }
6368
6368
  if (s?.dsl) {
6369
- const l = new wt(s.dsl);
6369
+ const l = new kt(s.dsl);
6370
6370
  this.updateCurrent(l), this.initHistory(l);
6371
6371
  } else
6372
6372
  this.updateCurrent(null);
@@ -6426,7 +6426,7 @@ class Mo extends Jt {
6426
6426
  async initHistory(e) {
6427
6427
  if (e) {
6428
6428
  const t = await this.service.getHistory(e.id).catch(() => null);
6429
- this.history.value = new is(
6429
+ this.history.value = new Qn(
6430
6430
  Object.assign(t || {}, { id: e.id })
6431
6431
  );
6432
6432
  } else
@@ -6444,7 +6444,7 @@ class Mo extends Jt {
6444
6444
  async loadHistory(e) {
6445
6445
  const t = e.model, s = e.data, l = await this.service.getHistoryItem(t.id, s.id);
6446
6446
  if (l && l.dsl) {
6447
- const a = new wt(l.dsl);
6447
+ const a = new kt(l.dsl);
6448
6448
  await this.updateCurrent(a), he(this.history);
6449
6449
  }
6450
6450
  }
@@ -6672,7 +6672,7 @@ const be = E({
6672
6672
  defaultSetter() {
6673
6673
  const { value: i, computedSetters: e } = this;
6674
6674
  let t = typeof i;
6675
- t === "Object" && (Array.isArray(i) ? t = "Array" : Pe(i) ? t = "Object" : Xn(i) && (t = "Function"));
6675
+ t === "Object" && (Array.isArray(i) ? t = "Array" : Ie(i) ? t = "Object" : is(i) && (t = "Function"));
6676
6676
  const s = Oe.getByType(t) || [];
6677
6677
  return s.length ? (e.find((l) => s.includes(l.name)) || e[0])?.name : e[0]?.name;
6678
6678
  }
@@ -6896,7 +6896,7 @@ const be = E({
6896
6896
  setup(i, { emit: e }) {
6897
6897
  const t = i, s = e, l = w(!1), a = w(""), r = w(
6898
6898
  t.setters.find((V) => V.name === t.defaultSetter) || t.setters[0]
6899
- ), o = w(t.value), u = S(() => !!Pe(o.value)), p = {
6899
+ ), o = w(t.value), u = S(() => !!Ie(o.value)), p = {
6900
6900
  [r.value.name]: o.value
6901
6901
  }, m = (V) => {
6902
6902
  p[r.value.name] = o.value, r.value = V, o.value = p[V.name] ?? void 0, f(o.value);
@@ -6919,7 +6919,7 @@ const be = E({
6919
6919
  }, b = () => {
6920
6920
  s("remove", t.name);
6921
6921
  }, h = () => {
6922
- l.value = !0, a.value = Pe(o.value) ? o.value.value : "";
6922
+ l.value = !0, a.value = Ie(o.value) ? o.value.value : "";
6923
6923
  }, d = () => {
6924
6924
  l.value = !1, a.value = "";
6925
6925
  }, k = async (V) => ee(V, t.context, !0) ? (p[r.value.name] = o.value, o.value = V, s("change", V), !0) : !1, y = async () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/designer",
3
3
  "private": false,
4
- "version": "0.7.9",
4
+ "version": "0.7.11",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "vue-tsc && vite build",
@@ -10,15 +10,15 @@
10
10
  "coverage": "vitest run --coverage"
11
11
  },
12
12
  "dependencies": {
13
- "@vtj/core": "^0.7.9",
14
- "@vtj/icons": "^0.7.9",
15
- "@vtj/renderer": "^0.7.9",
16
- "@vtj/ui": "^0.7.9",
17
- "@vtj/utils": "^0.7.9",
13
+ "@vtj/core": "^0.7.11",
14
+ "@vtj/icons": "^0.7.11",
15
+ "@vtj/renderer": "^0.7.11",
16
+ "@vtj/ui": "^0.7.11",
17
+ "@vtj/utils": "^0.7.11",
18
18
  "monaco-editor": "~0.45.0"
19
19
  },
20
20
  "devDependencies": {
21
- "@vtj/cli": "^0.7.7",
21
+ "@vtj/cli": "^0.7.8",
22
22
  "vue": "~3.4.15",
23
23
  "vue-router": "~4.2.5"
24
24
  },
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "923aab791b5aacf1f0e75255ad7aa2b1b71e26bf"
43
+ "gitHead": "c06eab62d9b15ba39fd489316dc9389030b2d040"
44
44
  }
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/designer
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.7.8
5
+ * @version 0.7.10
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export declare const version = "0.7.8";
8
+ export declare const version = "0.7.10";