@vtj/designer 0.12.20 → 0.12.21

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.
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./index-BwxXEIL4.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,11 +1,11 @@
1
1
  var cl = Object.defineProperty;
2
2
  var ul = (r, t, e) => t in r ? cl(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
3
  var Z = (r, t, e) => ul(r, typeof t != "symbol" ? t + "" : t, e);
4
- import { computed as E, unref as n, ref as x, watch as te, reactive as Pt, toValue as it, shallowRef as ft, shallowReadonly as dl, onMounted as cn, nextTick as st, getCurrentScope as pl, onScopeDispose as ml, getCurrentInstance as Na, toRaw as $o, defineComponent as P, createElementBlock as R, openBlock as u, toDisplayString as oe, createVNode as d, withCtx as b, createElementVNode as T, createBlock as y, createCommentVNode as j, createTextVNode as Q, mergeProps as Me, h as Xt, Fragment as K, renderList as se, normalizeClass as he, defineAsyncComponent as vl, resolveDynamicComponent as No, createSlots as Po, renderSlot as It, withDirectives as jt, vShow as ln, withModifiers as lt, isRef as Un, normalizeStyle as gn, inject as Pa, provide as gl, withKeys as wt, normalizeProps as Bo, guardReactiveProps as Mo, onUnmounted as Ba, markRaw as Ia, createApp as Lo, shallowReactive as fl, triggerRef as Ht, KeepAlive as zo } from "vue";
4
+ import { computed as E, unref as n, ref as x, watch as te, reactive as Bt, toValue as it, shallowRef as ft, shallowReadonly as dl, onMounted as cn, nextTick as st, getCurrentScope as pl, onScopeDispose as ml, getCurrentInstance as Na, toRaw as $o, defineComponent as P, createElementBlock as R, openBlock as u, toDisplayString as oe, createVNode as d, withCtx as b, createElementVNode as T, createBlock as y, createCommentVNode as j, createTextVNode as Q, mergeProps as Me, h as Xt, Fragment as K, renderList as se, normalizeClass as he, defineAsyncComponent as vl, resolveDynamicComponent as No, createSlots as Po, renderSlot as It, withDirectives as jt, vShow as ln, withModifiers as lt, isRef as Un, normalizeStyle as gn, inject as Pa, provide as gl, withKeys as wt, normalizeProps as Bo, guardReactiveProps as Mo, onUnmounted as Ba, markRaw as Ia, createApp as Lo, shallowReactive as fl, triggerRef as Gt, KeepAlive as zo } from "vue";
5
5
  import { ElNotification as Ma, ElMessage as ht, ElMessageBox as St, ElButton as ue, ElDivider as rt, ElInput as Le, ElRadioGroup as Uo, ElRadioButton as xn, ElButtonGroup as hl, ElSwitch as Fn, ElImage as Qn, ElUpload as La, ElDropdown as Fo, ElDropdownMenu as Wo, ElDropdownItem as Ln, ElEmpty as De, ElAlert as Qt, ElTooltip as Jo, ElTag as za, ElTree as Ua, ElCollapse as Yn, ElCollapseItem as Zn, ElRow as Wn, ElCol as Jn, ElDrawer as Fa, ElForm as nt, ElFormItem as fn, ElBreadcrumb as bl, ElBreadcrumbItem as yl, ElLoading as _l, ElBadge as wl, ElAvatar as ea, vLoading as Ho, ElSelect as Go, ElOption as qo, ElCheckbox as Ko, ElSegmented as kl, ElDialog as Sl, ElSteps as xl, ElStep as _a, ElInputNumber as Cl, ElColorPicker as El, ElSlider as Al, ElConfigProvider as Vl, ElContainer as fo, ElHeader as Tl, ElAside as ho, ElMain as Il, ElFooter as jl } from "element-plus";
6
6
  import Rl from "element-plus/es/locale/lang/zh-cn";
7
7
  import { XDialogForm as Rt, XField as W, XIcon as ct, createDialog as Xo, XDialog as xt, XPanel as ta, XAction as Re, XTabs as na, XContainer as fe, XForm as Wa, XAttachment as Ol, XActionBar as Qo, XInputUnit as Yo, vResizable as bo } from "@vtj/ui";
8
- import { kebabCase as Dl, jsonp as qt, groupBy as En, storage as Yt, delay as Bt, dataURLtoBlob as $l, fileToBase64 as Zo, upperFirstCamelCase as es, toRawType as wa, cloneDeep as In, logger as Mt, isPlainObject as Nl, merge as Ja, toArray as Ha, debounce as ts, uuid as Pl, getClientInfo as Bl, base64 as Ml, arrayToMap as Ll, isBoolean as zl } from "@vtj/utils";
8
+ import { kebabCase as Dl, jsonp as Kt, groupBy as En, storage as Yt, delay as Mt, dataURLtoBlob as $l, fileToBase64 as Zo, upperFirstCamelCase as es, toRawType as wa, cloneDeep as In, logger as Lt, isPlainObject as Nl, merge as Ja, toArray as Ha, debounce as ts, uuid as Pl, getClientInfo as Bl, base64 as Ml, arrayToMap as Ll, isBoolean as zl } from "@vtj/utils";
9
9
  import { BUILT_IN_NAME as Hn, isBlock as Oe, DirectiveModel as ns, createNodeFrom as Ul, BUILT_IN_VUE as yo, BUILT_IN_VUE_ROUTER as Fl, emitter as Pe, EVENT_PROJECT_ACTIVED as ja, EVENT_NODE_CHANGE as An, NodeModel as ka, EVENT_BLOCK_CHANGE as Ra, Base as as, BUILT_IN_LIBRARAY_MAP as Wl, ProjectModel as Jl, EVENT_PROJECT_CHANGE as Hl, EVENT_PROJECT_BLOCKS_CHANGE as Gl, EVENT_PROJECT_PAGES_CHANGE as ql, EVENT_PROJECT_DEPS_CHANGE as Kl, EVENT_PROJECT_PUBLISH as Xl, EVENT_PROJECT_FILE_PUBLISH as Ql, EVENT_HISTORY_CHANGE as Yl, EVENT_HISTORY_LOAD as Zl, EVENT_PROJECT_GEN_SOURCE as ei, BlockModel as Sa, HistoryModel as ti } from "@vtj/core";
10
10
  import { parseExpression as Vn, parseFunction as os, BUILT_IN_DIRECTIVES as ni, JSCodeToString as hn, LIFE_CYCLES_LIST as ai, DATA_TYPES as oi, createMock as si, isJSExpression as rn, ContextMode as ss, clearLoaderCache as li, parseDeps as ii, parseUrls as ri, createAssetsCss as ci, createAssetScripts as _o, getRawComponent as wo, createSchemaApis as ui, mockCleanup as di, mockApis as pi, Provider as mi, Access as vi, isJSFunction as gi } from "@vtj/renderer";
11
11
  import * as fi from "@vtj/icons";
@@ -19,10 +19,10 @@ import { editor as bc } from "monaco-editor";
19
19
  * Copyright (c) 2025, VTJ.PRO All rights reserved.
20
20
  * @name @vtj/designer
21
21
  * @author CHC chenhuachun1549@dingtalk.com
22
- * @version 0.12.20
22
+ * @version 0.12.21
23
23
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
24
24
  */
25
- const Tn = "0.12.20", yc = {
25
+ const Tn = "0.12.21", yc = {
26
26
  width: 390,
27
27
  height: 844
28
28
  }, _c = {
@@ -238,7 +238,7 @@ function Nc() {
238
238
  },
239
239
  { immediate: !0 }
240
240
  );
241
- const o = Pt({}), l = E(() => {
241
+ const o = Bt({}), l = E(() => {
242
242
  const v = {};
243
243
  return e.value && e.value.forEach((p) => {
244
244
  v[p.name] = p;
@@ -514,7 +514,7 @@ function Uc(r) {
514
514
  isExist: s
515
515
  };
516
516
  }
517
- function Kt(r, t) {
517
+ function Pt(r, t) {
518
518
  return St.alert(r, {
519
519
  title: "提示",
520
520
  type: "warning",
@@ -527,7 +527,7 @@ function xe(r, t = "提示") {
527
527
  message: r
528
528
  });
529
529
  }
530
- async function Lt(r, t) {
530
+ async function zt(r, t) {
531
531
  return await St.confirm(r, "提示", {
532
532
  type: "warning",
533
533
  ...t
@@ -737,7 +737,7 @@ function qc(r) {
737
737
  e.value?.setDirective($);
738
738
  },
739
739
  onRemoveCustom: async ($) => {
740
- await Lt("确定删除指令?") && e.value?.removeDirective($);
740
+ await zt("确定删除指令?") && e.value?.removeDirective($);
741
741
  },
742
742
  onCustomChange: ($) => (N, J) => {
743
743
  $.update({ [N]: J }), e.value?.setDirective($);
@@ -765,7 +765,7 @@ function en() {
765
765
  }
766
766
  if (!(!e || !I)) {
767
767
  if (typeof I == "string") {
768
- const M = `${e}/api/open/auth/${I}`, z = await qt(M).catch(() => null);
768
+ const M = `${e}/api/open/auth/${I}`, z = await Kt(M).catch(() => null);
769
769
  z && z.data && t.login(z.data);
770
770
  } else if (typeof I == "function") {
771
771
  const M = await I().catch(() => null);
@@ -787,7 +787,7 @@ function en() {
787
787
  return await a?.isLogined();
788
788
  const I = t?.getData()?.token;
789
789
  if (I) {
790
- const M = `${e}/api/open/user/${I}`, z = await qt(M).catch(() => null);
790
+ const M = `${e}/api/open/user/${I}`, z = await Kt(M).catch(() => null);
791
791
  return z && z.data ? (t?.login(z.data), !0) : !1;
792
792
  }
793
793
  return !1;
@@ -795,29 +795,29 @@ function en() {
795
795
  if (a?.getTemplates)
796
796
  return await a?.getTemplates(I);
797
797
  const M = `${e}/api/open/templates`, z = t?.getData()?.token;
798
- return (await qt(M, {
798
+ return (await Kt(M, {
799
799
  query: z ? { platform: I, token: z } : { platform: I }
800
800
  }))?.data || [];
801
801
  }, m = async (I) => {
802
802
  if (a?.getTemplateById)
803
803
  return await a?.getTemplateById(I);
804
804
  const M = t?.getData()?.token, z = `${e}/api/open/template/${M}`;
805
- return (await qt(z, { query: { id: I } }))?.data || null;
805
+ return (await Kt(z, { query: { id: I } }))?.data || null;
806
806
  }, g = async (I) => {
807
807
  if (a?.removeTemplate)
808
808
  return await a?.removeTemplate(I);
809
809
  const M = t?.getData()?.token, z = `${e}/api/open/template/remove/${M}`;
810
- return !!(await qt(z, { query: { id: I } }))?.data;
810
+ return !!(await Kt(z, { query: { id: I } }))?.data;
811
811
  }, v = async (I) => {
812
812
  if (a?.getTemplateDsl)
813
813
  return await a?.getTemplateDsl(I);
814
- const M = t?.getData()?.token, z = `${e}/api/open/dsl/${M}`, ne = await qt(z, { query: { id: I } });
814
+ const M = t?.getData()?.token, z = `${e}/api/open/dsl/${M}`, ne = await Kt(z, { query: { id: I } });
815
815
  return ne?.data ? ne.data : null;
816
816
  }, p = async (I) => {
817
817
  if (a?.getDictOptions)
818
818
  return await a?.getDictOptions(I);
819
819
  const M = `${e}/api/open/dict/${I}`;
820
- return (await qt(M).catch(() => null))?.data || [];
820
+ return (await Kt(M).catch(() => null))?.data || [];
821
821
  };
822
822
  return {
823
823
  engine: r,
@@ -853,7 +853,7 @@ function en() {
853
853
  },
854
854
  body: JSON.stringify(I)
855
855
  }).then((me) => me.json()).catch(() => null);
856
- return ne?.success || await Kt(ne.message || "未知错误"), ne;
856
+ return ne?.success || await Pt(ne.message || "未知错误"), ne;
857
857
  },
858
858
  getChats: async (I) => {
859
859
  if (a?.getChats)
@@ -881,7 +881,7 @@ function en() {
881
881
  },
882
882
  body: JSON.stringify(I)
883
883
  }).then((me) => me.json()).catch(() => null);
884
- return ne?.success || await Kt(ne.message || "未知错误"), ne;
884
+ return ne?.success || await Pt(ne.message || "未知错误"), ne;
885
885
  },
886
886
  removeTopic: async (I) => {
887
887
  if (a?.removeTopic)
@@ -960,7 +960,7 @@ function en() {
960
960
  const I = t?.getData()?.token, M = `${e}/api/open/order/${I}`, z = await window.fetch(M, {
961
961
  method: "post"
962
962
  }).then((ne) => ne.json()).catch(() => null);
963
- return z?.success || await Kt(z.message || "未知错误"), z;
963
+ return z?.success || await Pt(z.message || "未知错误"), z;
964
964
  },
965
965
  cancelOrder: async (I) => {
966
966
  if (a?.cancelOrder)
@@ -990,7 +990,7 @@ function en() {
990
990
  method: "post",
991
991
  body: ne
992
992
  }).then((de) => de.json()).catch((de) => de);
993
- return me?.success || await Kt(me.message || "未知错误"), me;
993
+ return me?.success || await Pt(me.message || "未知错误"), me;
994
994
  },
995
995
  cancelChat: async (I) => {
996
996
  if (a?.cancelChat)
@@ -1508,10 +1508,10 @@ function gu() {
1508
1508
  if (O.value = !1, ye && ye.success) {
1509
1509
  const { topic: Fe, chat: we } = ye.data;
1510
1510
  q.value = [], J.value.unshift(Fe), D.value = !1, F.value = Fe;
1511
- const Ye = Pt(we);
1511
+ const Ye = Bt(we);
1512
1512
  q.value.push(Ye), pt(Ye, (an) => {
1513
1513
  U.auto && pn(an);
1514
- }), await Bt(0), M.value && M.value.scrollToBottom();
1514
+ }), await Mt(0), M.value && M.value.scrollToBottom();
1515
1515
  } else
1516
1516
  await et(null);
1517
1517
  return ye;
@@ -1521,10 +1521,10 @@ function gu() {
1521
1521
  if (O.value = !1, ye && ye.success) {
1522
1522
  const { topic: Fe, chat: we } = ye.data;
1523
1523
  q.value = [], J.value.unshift(Fe), D.value = !1, F.value = Fe, Fe.image && (we.image = S(Fe.image));
1524
- const Ye = Pt(we);
1524
+ const Ye = Bt(we);
1525
1525
  q.value.push(Ye), pt(Ye, (an) => {
1526
1526
  U.auto && pn(an);
1527
- }), await Bt(0), M.value && M.value.scrollToBottom();
1527
+ }), await Mt(0), M.value && M.value.scrollToBottom();
1528
1528
  } else
1529
1529
  await et(null);
1530
1530
  return ye;
@@ -1536,10 +1536,10 @@ function gu() {
1536
1536
  prompt: U.prompt
1537
1537
  }, ye = await s(ve).catch(() => null);
1538
1538
  if (O.value = !1, ye && ye.success) {
1539
- const Fe = Pt(ye.data);
1539
+ const Fe = Bt(ye.data);
1540
1540
  q.value.push(Fe), pt(Fe, (we) => {
1541
1541
  U.auto && pn(we);
1542
- }), await Bt(0), M.value && M.value.scrollToBottom();
1542
+ }), await Mt(0), M.value && M.value.scrollToBottom();
1543
1543
  } else
1544
1544
  await et(null);
1545
1545
  return ye;
@@ -1548,7 +1548,7 @@ function gu() {
1548
1548
  ve && ve.success && (J.value = J.value.filter((ye) => ye.id !== U.id), U.id === F.value?.id && (q.value = [], F.value = null, D.value = !0));
1549
1549
  }, At = async (U) => {
1550
1550
  if (!F.value) return;
1551
- const ve = F.value?.fileId, ye = t.project.value?.toDsl(), { name: Fe = "" } = t.current.value || {}, we = zt(U.content);
1551
+ const ve = F.value?.fileId, ye = t.project.value?.toDsl(), { name: Fe = "" } = t.current.value || {}, we = Ut(U.content);
1552
1552
  if (we)
1553
1553
  return await t.service.parseVue(ye, {
1554
1554
  id: ve,
@@ -1569,7 +1569,7 @@ function gu() {
1569
1569
  $t && (U.content += $t), bt && (U.reasoning += bt, ye += Date.now() - Fe);
1570
1570
  }
1571
1571
  if (we?.usage && (U.tokens = we.usage.total_tokens || 0), Ye && U.status === "Pending") {
1572
- U.status = "Success", U.thinking = Math.ceil(ye / 1e3), U.vue = zt(U.content);
1572
+ U.status = "Success", U.thinking = Math.ceil(ye / 1e3), U.vue = Ut(U.content);
1573
1573
  const $t = await At(U).catch((bt) => {
1574
1574
  if (Array.isArray(bt))
1575
1575
  U.message = bt.join(`
@@ -1593,10 +1593,10 @@ function gu() {
1593
1593
  (we.message || we.name || "未知错误") === "network error" ? U.message = "网络异常,请稍后再试" : U.message = "请求失败,请稍后再试", U.status = "Failed", console.warn("completions error", we), await m(U), ve && ve(U);
1594
1594
  }
1595
1595
  ), Sn;
1596
- }, zt = (U) => {
1596
+ }, Ut = (U) => {
1597
1597
  const ve = /```vue\n([\w\W]*)```/;
1598
1598
  return U.match(ve)?.[1] ?? "";
1599
- }, Ut = async (U) => {
1599
+ }, Ft = async (U) => {
1600
1600
  if (!F.value || !Y.value || !U) return;
1601
1601
  const ve = F.value?.fileId, ye = t.project.value?.toDsl(), { name: Fe = "" } = t.current.value || {}, we = await t.service.parseVue(ye, {
1602
1602
  id: ve,
@@ -1619,7 +1619,7 @@ function gu() {
1619
1619
  D.value || de.value || q.value.map((U) => {
1620
1620
  U.collapsed = !1;
1621
1621
  });
1622
- }, Ft = () => {
1622
+ }, Wt = () => {
1623
1623
  D.value || de.value || q.value.map((U) => {
1624
1624
  U.collapsed = !0;
1625
1625
  });
@@ -1629,7 +1629,7 @@ function gu() {
1629
1629
  }, pn = (U) => {
1630
1630
  U.dsl && t.applyAI(U.dsl), $.value = !1, Y.value = null;
1631
1631
  }, ca = (U) => {
1632
- U.vue = zt(U.content), Y.value = U, $.value = !0;
1632
+ U.vue = Ut(U.content), Y.value = U, $.value = !0;
1633
1633
  }, ua = (U) => {
1634
1634
  if (!F.value) return;
1635
1635
  const ve = U.message ? `页面存在以下问题:
@@ -1673,7 +1673,7 @@ function gu() {
1673
1673
  onPostChat: Et,
1674
1674
  loadChats: at,
1675
1675
  onRemoveTopic: Dt,
1676
- getVueCode: zt,
1676
+ getVueCode: Ut,
1677
1677
  vue2Dsl: At,
1678
1678
  onRefresh: ra,
1679
1679
  onApply: pn,
@@ -1685,7 +1685,7 @@ function gu() {
1685
1685
  scrollToTop: nn,
1686
1686
  scrollToBottom: mt,
1687
1687
  expandAll: Qe,
1688
- collapseAll: Ft,
1688
+ collapseAll: Wt,
1689
1689
  isPending: de,
1690
1690
  toggleHideCode: pa,
1691
1691
  isHideCode: z,
@@ -1698,7 +1698,7 @@ function gu() {
1698
1698
  createOrder: p,
1699
1699
  cancelOrder: f,
1700
1700
  getOrder: h,
1701
- updateChatDsl: Ut,
1701
+ updateChatDsl: Ft,
1702
1702
  getImage: S,
1703
1703
  onPostImageTopic: dt,
1704
1704
  onCancelChat: da
@@ -1938,7 +1938,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
1938
1938
  dsl: {}
1939
1939
  },
1940
1940
  setup(r) {
1941
- const t = r, { getTemplateCategories: e, publishTemplate: a, getTemplateById: o, engine: l } = en(), s = Pt({
1941
+ const t = r, { getTemplateCategories: e, publishTemplate: a, getTemplateById: o, engine: l } = en(), s = Bt({
1942
1942
  name: t.name,
1943
1943
  label: t.label,
1944
1944
  share: !1
@@ -2100,7 +2100,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
2100
2100
  const t = r, { engine: e, designer: a } = Ct(), { isLogined: o, toRemoteAuth: l } = en(), s = x(!1), i = x(!1), c = x(), m = () => {
2101
2101
  e.current.value ? (s.value ? e.skeleton?.getWidget("Previewer")?.widgetRef.refresh() : (a.value?.setSelected(null), e.simulator.refresh()), Ie("刷新完成", "success")) : Ie("请先打开文件", "warning");
2102
2102
  }, g = async () => {
2103
- e.current.value ? (s.value && (e.skeleton?.closePreview(), s.value = !1, await Bt(1e3)), a.value?.setSelected(e.current.value)) : Ie("请先打开文件", "warning");
2103
+ e.current.value ? (s.value && (e.skeleton?.closePreview(), s.value = !1, await Mt(1e3)), a.value?.setSelected(e.current.value)) : Ie("请先打开文件", "warning");
2104
2104
  }, v = () => {
2105
2105
  if (e.project.value)
2106
2106
  if (e.current.value) {
@@ -2173,7 +2173,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
2173
2173
  const C = e.project.value?.locked, A = !!C;
2174
2174
  if (await o()) {
2175
2175
  const O = e.access?.getData();
2176
- A ? O?.name && O.name === C ? (e.project.value?.unlock(O.name), Ie("项目已解除锁定")) : alert(`项目已被[ ${C} ]锁定`) : O?.name && (e.project.value?.lock(O.name), Ie("项目已锁定,只有你才能更改项目"));
2176
+ A ? O?.name && O.name === C ? (e.project.value?.unlock(O.name), Ie("项目已解除锁定")) : Pt(`项目已被[ ${C} ]锁定`) : O?.name && (e.project.value?.lock(O.name), Ie("项目已锁定,只有你才能更改项目"));
2177
2177
  } else
2178
2178
  await St.confirm(
2179
2179
  `${A ? "解锁" : "锁定"}项目需要登录,您还没登录或已过期,请重新登录!`,
@@ -2416,7 +2416,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
2416
2416
  ]));
2417
2417
  }
2418
2418
  }), je = vl({
2419
- loader: () => import("./Editor-C5icbnkA.js"),
2419
+ loader: () => import("./Editor-Ztb6qR4r.js"),
2420
2420
  loadingComponent: P({
2421
2421
  render() {
2422
2422
  return Xt("div", "正在拼命加载...");
@@ -4402,7 +4402,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
4402
4402
  const { history: t, load: e, total: a } = xs(), o = E(() => `(共 ${a.value} 条)`), l = (i) => {
4403
4403
  i.name === "remove" && t.value?.remove(i.modelValue.id);
4404
4404
  }, s = async () => {
4405
- await Lt("确定要清空历史记录吗?") && t.value?.clear();
4405
+ await zt("确定要清空历史记录吗?") && t.value?.clear();
4406
4406
  };
4407
4407
  return (i, c) => (u(), y(n(ge), {
4408
4408
  class: "v-history-widget",
@@ -5080,7 +5080,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
5080
5080
  ], c = (g) => {
5081
5081
  a("action", { type: "selected", model: g.command });
5082
5082
  }, m = async (g) => {
5083
- g.name === "remove" ? await Lt("确定删除?") && a("action", { type: g.name, model: e.model }) : a("action", { type: g.name, model: e.model });
5083
+ g.name === "remove" ? await zt("确定删除?") && a("action", { type: g.name, model: e.model }) : a("action", { type: g.name, model: e.model });
5084
5084
  };
5085
5085
  return (g, v) => (u(), R("div", {
5086
5086
  class: he(["v-actions", [`is-${e.position}`]])
@@ -5157,13 +5157,13 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
5157
5157
  return te(
5158
5158
  h,
5159
5159
  async (q) => {
5160
- _.value && (await Bt(100), _.value.outlineEnabled.value = q);
5160
+ _.value && (await Mt(100), _.value.outlineEnabled.value = q);
5161
5161
  },
5162
5162
  { immediate: !0 }
5163
5163
  ), te(
5164
5164
  S,
5165
5165
  async (q) => {
5166
- _.value && (await Bt(100), _.value.activeEvent.value = q);
5166
+ _.value && (await Mt(100), _.value.activeEvent.value = q);
5167
5167
  },
5168
5168
  { immediate: !0 }
5169
5169
  ), t({
@@ -5702,7 +5702,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
5702
5702
  const _ = Object.keys(o.value?.props || {});
5703
5703
  return !v(V.name) && !_.includes(V.name) ? (m(V.name), !0) : (xe("已存在该属性名称"), !1);
5704
5704
  }, w = async (V) => {
5705
- await Lt("确定删除?") && g(V);
5705
+ await zt("确定删除?") && g(V);
5706
5706
  };
5707
5707
  return (V, _) => n(t) ? (u(), y(n(fe), {
5708
5708
  key: 0,
@@ -5779,7 +5779,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
5779
5779
  value: {}
5780
5780
  },
5781
5781
  setup(r) {
5782
- const t = r, e = x(), a = Pt({
5782
+ const t = r, e = x(), a = Bt({
5783
5783
  type: "JSExpression",
5784
5784
  value: t.value
5785
5785
  }), o = (l) => {
@@ -5826,7 +5826,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
5826
5826
  event: {}
5827
5827
  },
5828
5828
  setup(r) {
5829
- const t = r, e = x(), o = Pt({
5829
+ const t = r, e = x(), o = Bt({
5830
5830
  name: t.name,
5831
5831
  ...t.event,
5832
5832
  modifiers: Object.keys(t.event?.modifiers || {}),
@@ -5896,7 +5896,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
5896
5896
  const S = a.value?.model;
5897
5897
  h.name && (S.removeEvent(h.name), c.value = !1);
5898
5898
  }, p = async () => {
5899
- i.value.name && await Lt("确定要删除该事件吗?") && v(i.value);
5899
+ i.value.name && await zt("确定要删除该事件吗?") && v(i.value);
5900
5900
  }, f = (h) => {
5901
5901
  const { name: S, modelValue: w } = h;
5902
5902
  S === "edit" && m(w), S === "remove" && v(w);
@@ -6843,7 +6843,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
6843
6843
  let J = t.context?.$apis[c.value.ref];
6844
6844
  if (J)
6845
6845
  return await J.apply(J, N);
6846
- Mt.warn(`API【${c.value.ref}】不存在`);
6846
+ Lt.warn(`API【${c.value.ref}】不存在`);
6847
6847
  }
6848
6848
  }, D = Vn(c.value.test, {
6849
6849
  runApi: O
@@ -6854,7 +6854,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
6854
6854
  const N = await D();
6855
6855
  g.value = JSON.stringify(await $(N), null, 2), s?.enableIntercept();
6856
6856
  } catch (N) {
6857
- Mt.error(N);
6857
+ Lt.error(N);
6858
6858
  }
6859
6859
  m.value = !1, v.value = !0;
6860
6860
  };
@@ -7289,7 +7289,6 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
7289
7289
  }, {
7290
7290
  default: b(() => [
7291
7291
  d(n(je), {
7292
- readonly: "",
7293
7292
  ref_key: "editorRef",
7294
7293
  ref: e,
7295
7294
  "model-value": l.value,
@@ -8730,7 +8729,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
8730
8729
  () => JSON.stringify(t.value?.toDsl() || {}, null, 2)
8731
8730
  ), o = E(() => t.value ? t.value.name : ""), l = async () => {
8732
8731
  const i = (e.value?.getEditor()).getValue();
8733
- if (i && await Lt(
8732
+ if (i && await zt(
8734
8733
  "手动修改DSL有风险,可能导致页面无法加载,请确认您的操作无误。"
8735
8734
  ))
8736
8735
  try {
@@ -8769,7 +8768,7 @@ const fu = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!
8769
8768
  const { current: t, engine: e } = Xe(), a = x(), o = x(""), l = E(() => t.value ? `$vtj/vue/${t.value.id}.vue` : ""), s = E(() => t.value ? t.value.name : ""), i = async () => {
8770
8769
  const m = (a.value?.getEditor()).getValue();
8771
8770
  if (m) {
8772
- const g = await Lt(
8771
+ const g = await zt(
8773
8772
  "手动修改源码有风险,可能导致页面无法加载,请确认您的操作无误。"
8774
8773
  ), v = e.project.value?.toDsl();
8775
8774
  if (g && t.value && v) {
@@ -10096,7 +10095,7 @@ function jm() {
10096
10095
  begin: "\\.\\s*" + N,
10097
10096
  relevance: 0
10098
10097
  };
10099
- var Ut = /* @__PURE__ */ Object.freeze({
10098
+ var Ft = /* @__PURE__ */ Object.freeze({
10100
10099
  __proto__: null,
10101
10100
  APOS_STRING_MODE: z,
10102
10101
  BACKSLASH_ESCAPE: M,
@@ -10146,7 +10145,7 @@ function jm() {
10146
10145
  function Qe(k, B) {
10147
10146
  B && k.beginKeywords && (k.begin = "\\b(" + k.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", k.__beforeBegin = nn, k.keywords = k.keywords || k.beginKeywords, delete k.beginKeywords, k.relevance === void 0 && (k.relevance = 0));
10148
10147
  }
10149
- function Ft(k, B) {
10148
+ function Wt(k, B) {
10150
10149
  Array.isArray(k.illegal) && (k.illegal = V(...k.illegal));
10151
10150
  }
10152
10151
  function ra(k, B) {
@@ -10328,7 +10327,7 @@ function jm() {
10328
10327
  Qe,
10329
10328
  // do this later so compiler extensions that come earlier have access to the
10330
10329
  // raw array if they wanted to perhaps manipulate it, etc.
10331
- Ft,
10330
+ Wt,
10332
10331
  // default to 1 relevance if not specified
10333
10332
  pn
10334
10333
  ].forEach((Be) => Be(ee, X)), ee.isCompiled = !0;
@@ -10391,10 +10390,10 @@ function jm() {
10391
10390
  le += L.parentNode ? L.parentNode.className : "";
10392
10391
  const _e = X.languageDetectRe.exec(le);
10393
10392
  if (_e) {
10394
- const Ce = Wt(_e[1]);
10393
+ const Ce = Jt(_e[1]);
10395
10394
  return Ce || (Fe(Ne.replace("{}", _e[1])), Fe("Falling back to no-highlight mode for this block.", L)), Ce ? _e[1] : "no-highlight";
10396
10395
  }
10397
- return le.split(/\s+/).find((Ce) => ie(Ce) || Wt(Ce));
10396
+ return le.split(/\s+/).find((Ce) => ie(Ce) || Jt(Ce));
10398
10397
  }
10399
10398
  function Be(L, le, _e) {
10400
10399
  let Ce = "", We = "";
@@ -10405,15 +10404,15 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10405
10404
  language: We
10406
10405
  };
10407
10406
  Dn("before:highlight", yt);
10408
- const Jt = yt.result ? yt.result : kn(yt.language, yt.code, _e);
10409
- return Jt.code = yt.code, Dn("after:highlight", Jt), Jt;
10407
+ const Ht = yt.result ? yt.result : kn(yt.language, yt.code, _e);
10408
+ return Ht.code = yt.code, Dn("after:highlight", Ht), Ht;
10410
10409
  }
10411
10410
  function kn(L, le, _e, Ce) {
10412
10411
  const We = /* @__PURE__ */ Object.create(null);
10413
10412
  function yt(G, ae) {
10414
10413
  return G.keywords[ae];
10415
10414
  }
10416
- function Jt() {
10415
+ function Ht() {
10417
10416
  if (!pe.keywords) {
10418
10417
  qe.addText(Ee);
10419
10418
  return;
@@ -10453,7 +10452,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10453
10452
  pe.relevance > 0 && (Pn += G.relevance), qe.__addSublanguage(G._emitter, G.language);
10454
10453
  }
10455
10454
  function ot() {
10456
- pe.subLanguage != null ? $n() : Jt(), Ee = "";
10455
+ pe.subLanguage != null ? $n() : Ht(), Ee = "";
10457
10456
  }
10458
10457
  function Vt(G, ae) {
10459
10458
  G !== "" && (qe.startScope(ae), qe.addText(G), qe.endScope());
@@ -10467,7 +10466,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10467
10466
  continue;
10468
10467
  }
10469
10468
  const Ze = Tt.classNameAliases[G[be]] || G[be], Nt = ae[be];
10470
- Ze ? Vt(Nt, Ze) : (Ee = Nt, Jt(), Ee = ""), be++;
10469
+ Ze ? Vt(Nt, Ze) : (Ee = Nt, Ht(), Ee = ""), be++;
10471
10470
  }
10472
10471
  }
10473
10472
  function po(G, ae) {
@@ -10545,7 +10544,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10545
10544
  throw new Error("potential infinite loop, way more iterations than matches");
10546
10545
  return Ee += be, be.length;
10547
10546
  }
10548
- const Tt = Wt(L);
10547
+ const Tt = Jt(L);
10549
10548
  if (!Tt)
10550
10549
  throw ye(Ne.replace("{}", L)), new Error('Unknown language: "' + L + '"');
10551
10550
  const ll = Ls(Tt);
@@ -10615,21 +10614,21 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10615
10614
  }
10616
10615
  function ga(L, le) {
10617
10616
  le = le || X.languages || Object.keys(B);
10618
- const _e = va(L), Ce = le.filter(Wt).filter(co).map(
10617
+ const _e = va(L), Ce = le.filter(Jt).filter(co).map(
10619
10618
  (ot) => kn(ot, L, !1)
10620
10619
  );
10621
10620
  Ce.unshift(_e);
10622
10621
  const We = Ce.sort((ot, Vt) => {
10623
10622
  if (ot.relevance !== Vt.relevance) return Vt.relevance - ot.relevance;
10624
10623
  if (ot.language && Vt.language) {
10625
- if (Wt(ot.language).supersetOf === Vt.language)
10624
+ if (Jt(ot.language).supersetOf === Vt.language)
10626
10625
  return 1;
10627
- if (Wt(Vt.language).supersetOf === ot.language)
10626
+ if (Jt(Vt.language).supersetOf === ot.language)
10628
10627
  return -1;
10629
10628
  }
10630
10629
  return 0;
10631
- }), [yt, Jt] = We, $n = yt;
10632
- return $n.secondBest = Jt, $n;
10630
+ }), [yt, Ht] = We, $n = yt;
10631
+ return $n.secondBest = Ht, $n;
10633
10632
  }
10634
10633
  function Js(L, le, _e) {
10635
10634
  const Ce = le && H[le] || _e;
@@ -10704,7 +10703,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10704
10703
  function Qs() {
10705
10704
  return Object.keys(B);
10706
10705
  }
10707
- function Wt(L) {
10706
+ function Jt(L) {
10708
10707
  return L = (L || "").toLowerCase(), B[L] || B[H[L]];
10709
10708
  }
10710
10709
  function ro(L, { languageName: le }) {
@@ -10713,7 +10712,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10713
10712
  });
10714
10713
  }
10715
10714
  function co(L) {
10716
- const le = Wt(L);
10715
+ const le = Jt(L);
10717
10716
  return le && !le.disableAutodetect;
10718
10717
  }
10719
10718
  function Ys(L) {
@@ -10756,7 +10755,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10756
10755
  registerLanguage: Ks,
10757
10756
  unregisterLanguage: Xs,
10758
10757
  listLanguages: Qs,
10759
- getLanguage: Wt,
10758
+ getLanguage: Jt,
10760
10759
  registerAliases: ro,
10761
10760
  autoDetection: co,
10762
10761
  inherit: oo,
@@ -10773,9 +10772,9 @@ https://github.com/highlightjs/highlight.js/issues/2277`), We = L, Ce = le), _e
10773
10772
  optional: h,
10774
10773
  anyNumberOfTimes: f
10775
10774
  };
10776
- for (const L in Ut)
10777
- typeof Ut[L] == "object" && r(Ut[L]);
10778
- return Object.assign(k, Ut), k;
10775
+ for (const L in Ft)
10776
+ typeof Ft[L] == "object" && r(Ft[L]);
10777
+ return Object.assign(k, Ft), k;
10779
10778
  }, mn = lo({});
10780
10779
  return mn.newInstance = () => lo({}), Va = mn, mn.HighlightJS = mn, mn.default = mn, Va;
10781
10780
  }
@@ -13192,12 +13191,12 @@ const qm = ["innerHTML"], Km = /* @__PURE__ */ P({
13192
13191
  const p = await t.createOrder();
13193
13192
  p?.success && (a.value = !0, o.value = p.data);
13194
13193
  }, g = async () => {
13195
- ((await t.getOrder(o.value?.id))?.data).status === "Completed" ? (await Kt("订单已经支付成功,你权限已经开通!").catch(() => null), location.reload()) : await Kt("您的订单状态还没更新,支付后请与客服联系!", {
13194
+ ((await t.getOrder(o.value?.id))?.data).status === "Completed" ? (await Pt("订单已经支付成功,你权限已经开通!").catch(() => null), location.reload()) : await Pt("您的订单状态还没更新,支付后请与客服联系!", {
13196
13195
  type: "success",
13197
13196
  confirmButtonText: "再等等"
13198
13197
  }).catch(() => null);
13199
13198
  }, v = async () => {
13200
- await Lt("您确定取消该订单?", {
13199
+ await zt("您确定取消该订单?", {
13201
13200
  confirmButtonText: "确认取消",
13202
13201
  cancelButtonText: "再想想"
13203
13202
  }).catch(() => !1) && await t.cancelOrder(o.value?.id) && (a.value = !1);
@@ -13437,13 +13436,13 @@ const qm = ["innerHTML"], Km = /* @__PURE__ */ P({
13437
13436
  return;
13438
13437
  }
13439
13438
  dt.value = !dt.value;
13440
- }, zt = () => {
13439
+ }, Ut = () => {
13441
13440
  if (N.value) {
13442
13441
  Ie("当前有对话未结束,不能开启新对话", "warning");
13443
13442
  return;
13444
13443
  }
13445
13444
  a.value = !0, dt.value = !1;
13446
- }, Ut = (nn) => {
13445
+ }, Ft = (nn) => {
13447
13446
  dt.value = !1, a.value = !1, c.value = nn, v(nn.id);
13448
13447
  };
13449
13448
  return (nn, mt) => (u(), y(n(fe), {
@@ -13547,11 +13546,11 @@ const qm = ["innerHTML"], Km = /* @__PURE__ */ P({
13547
13546
  type: "ai",
13548
13547
  data: Qe,
13549
13548
  code: !n(q),
13550
- onView: (Ft) => n(f)(Qe),
13551
- onRefresh: (Ft) => n(h)(Qe),
13552
- onApply: (Ft) => n(S)(Qe),
13553
- onFix: (Ft) => n(F)(Qe),
13554
- onCancel: (Ft) => n(et)(Qe)
13549
+ onView: (Wt) => n(f)(Qe),
13550
+ onRefresh: (Wt) => n(h)(Qe),
13551
+ onApply: (Wt) => n(S)(Qe),
13552
+ onFix: (Wt) => n(F)(Qe),
13553
+ onCancel: (Wt) => n(et)(Qe)
13555
13554
  }, null, 8, ["data", "code", "onView", "onRefresh", "onApply", "onFix", "onCancel"])
13556
13555
  ], 64))), 128)),
13557
13556
  n(i).length ? j("", !0) : (u(), y(n(De), { key: 0 }))
@@ -13578,7 +13577,7 @@ const qm = ["innerHTML"], Km = /* @__PURE__ */ P({
13578
13577
  type: "primary",
13579
13578
  size: "small",
13580
13579
  icon: n(ys),
13581
- onClick: zt
13580
+ onClick: Ut
13582
13581
  }, {
13583
13582
  default: b(() => mt[2] || (mt[2] = [
13584
13583
  Q(" 开启新对话 ")
@@ -13633,8 +13632,8 @@ const qm = ["innerHTML"], Km = /* @__PURE__ */ P({
13633
13632
  d(Cm, {
13634
13633
  current: n(c),
13635
13634
  topics: n(g),
13636
- onNew: zt,
13637
- onLoad: Ut,
13635
+ onNew: Ut,
13636
+ onLoad: Ft,
13638
13637
  onRemove: n(p)
13639
13638
  }, null, 8, ["current", "topics", "onRemove"])
13640
13639
  ]),
@@ -15526,7 +15525,7 @@ class fg {
15526
15525
  set(t, e) {
15527
15526
  const a = this.widgets[t];
15528
15527
  if (!a) {
15529
- Mt.warn(`widget '${t}' is not found`);
15528
+ Lt.warn(`widget '${t}' is not found`);
15530
15529
  return;
15531
15530
  }
15532
15531
  Ja(a, e), e.component && (a.component = e.component);
@@ -15667,7 +15666,7 @@ class yg {
15667
15666
  set(t, e) {
15668
15667
  const a = this.setters[t];
15669
15668
  if (!a) {
15670
- Mt.warn(`setter '${t}' is not found`);
15669
+ Lt.warn(`setter '${t}' is not found`);
15671
15670
  return;
15672
15671
  }
15673
15672
  Ja(a, e), e.component && (a.component = e.component);
@@ -15701,7 +15700,7 @@ class _g {
15701
15700
  });
15702
15701
  }
15703
15702
  async load(t) {
15704
- this.enabled && (await Bt(200), this.window && this.appUnmount(this.window), t && this.appInit(t), this.isInited = !0);
15703
+ this.enabled && (await Mt(200), this.window && this.appUnmount(this.window), t && this.appInit(t), this.isInited = !0);
15705
15704
  }
15706
15705
  updateState(t) {
15707
15706
  t.key === xa && (this.isOpen.value = !!this.getState().open);
@@ -15982,7 +15981,7 @@ class kg {
15982
15981
  this.setSelected(null), this.setHover(null), this.setDragging(null), this.setDropping(null);
15983
15982
  }
15984
15983
  async updateRect() {
15985
- await Bt(100);
15984
+ await Mt(100);
15986
15985
  const t = n(this.selected), e = n(this.hover);
15987
15986
  if (t) {
15988
15987
  const a = t.el.getBoundingClientRect();
@@ -16004,7 +16003,7 @@ class kg {
16004
16003
  this.lines.value = [];
16005
16004
  return;
16006
16005
  }
16007
- await Bt(50);
16006
+ await Mt(50);
16008
16007
  const t = this.engine.simulator.renderer?.context?.__refs || {}, e = [], a = Object.keys(ka.nodes);
16009
16008
  for (const o of a) {
16010
16009
  const l = t[o];
@@ -16160,7 +16159,7 @@ class xg {
16160
16159
  body: g
16161
16160
  }).catch(() => null);
16162
16161
  } else
16163
- qt(this.api, {
16162
+ Kt(this.api, {
16164
16163
  query: { data: m }
16165
16164
  }).catch(() => null);
16166
16165
  }
@@ -16405,7 +16404,7 @@ class Eg extends as {
16405
16404
  setup(e, a) {
16406
16405
  const o = e.contentWindow;
16407
16406
  if (!o) {
16408
- Mt.warn("Simulator contentWindow is null");
16407
+ Lt.warn("Simulator contentWindow is null");
16409
16408
  return;
16410
16409
  }
16411
16410
  o.__simulator__ = this;
@@ -16624,30 +16623,50 @@ class bf {
16624
16623
  }
16625
16624
  const Ms = Symbol("VtjEngine"), Ta = "SAVE_BLOCK_FILE_FINISH";
16626
16625
  class yf extends as {
16626
+ // OpenAPI服务
16627
16627
  constructor(e) {
16628
16628
  super();
16629
16629
  Z(this, "app");
16630
+ // Vue应用实例
16630
16631
  Z(this, "skeleton");
16632
+ // 设计器骨架实例
16631
16633
  Z(this, "container");
16634
+ // 设计器挂载容器
16632
16635
  Z(this, "service");
16636
+ // 文件服务接口
16633
16637
  Z(this, "assets");
16638
+ // 资源管理器
16634
16639
  Z(this, "simulator");
16640
+ // 模拟器实例
16635
16641
  Z(this, "emitter", Pe);
16642
+ // 事件发射器
16636
16643
  Z(this, "project", x(null));
16644
+ // 当前项目模型
16637
16645
  Z(this, "current", x(null));
16646
+ // 当前编辑的区块模型
16638
16647
  Z(this, "context", x(null));
16648
+ // 当前上下文
16639
16649
  Z(this, "isEmptyCurrent", x(!1));
16650
+ // 当前区块是否为空
16640
16651
  Z(this, "history", x(null));
16652
+ // 历史记录管理器
16641
16653
  Z(this, "provider");
16654
+ // 提供者实例
16642
16655
  Z(this, "adapter");
16656
+ // 适配器配置
16643
16657
  /**
16644
16658
  * 当current变化时,更新该值,用于通知组件更新
16645
16659
  */
16646
16660
  Z(this, "changed", x(Symbol()));
16661
+ // 变更标记
16647
16662
  Z(this, "access");
16663
+ // 权限控制器
16648
16664
  Z(this, "remote", null);
16665
+ // 远程服务地址
16649
16666
  Z(this, "report");
16667
+ // 报告服务
16650
16668
  Z(this, "checkVersion", !0);
16669
+ // 是否检查版本
16651
16670
  Z(this, "openApi");
16652
16671
  this.options = e;
16653
16672
  const {
@@ -16682,10 +16701,14 @@ class yf extends as {
16682
16701
  engine: this,
16683
16702
  materialPath: m,
16684
16703
  enhance: this.getEnhanceConfig(V)
16685
- }), this.access = f || new vi({ alert: Kt, ...Ic }), this.remote = h, this.report = new xg(this.remote, this.access, this.service), this.checkVersion = S, this.bindEvents(), this.init(l).then(this.render.bind(this)), Ba(this.dispose.bind(this));
16704
+ }), this.access = f || new vi({ alert: Pt, ...Ic }), this.remote = h, this.report = new xg(this.remote, this.access, this.service), this.checkVersion = S, this.bindEvents(), this.init(l).then(this.render.bind(this)), Ba(this.dispose.bind(this));
16686
16705
  }
16706
+ /**
16707
+ * 初始化引擎
16708
+ * @param project 项目Schema
16709
+ */
16687
16710
  async init(e) {
16688
- const a = await this.service.init(e).catch((o) => (Mt.warn("VTJEngine service init fail.", o), null));
16711
+ const a = await this.service.init(e).catch((o) => (Lt.warn("VTJEngine service init fail.", o), null));
16689
16712
  if (a) {
16690
16713
  const o = a.platform || "web";
16691
16714
  o === "uniapp" && Xn.set("UniConfig", {
@@ -16693,6 +16716,11 @@ class yf extends as {
16693
16716
  }), a.dependencies = bg.merge(a.dependencies || [], o), this.project.value = new Jl(a), this.saveMaterials(), this.triggerReady(), this.report.init();
16694
16717
  }
16695
16718
  }
16719
+ /**
16720
+ * 获取增强配置
16721
+ * @param enhance 增强配置或布尔值
16722
+ * @returns 增强配置对象
16723
+ */
16696
16724
  getEnhanceConfig(e) {
16697
16725
  if (e) {
16698
16726
  const a = location.pathname;
@@ -16705,22 +16733,37 @@ class yf extends as {
16705
16733
  } : e;
16706
16734
  }
16707
16735
  }
16736
+ /**
16737
+ * 检查项目是否被锁定
16738
+ * @param slient 是否静默检查
16739
+ * @returns 是否被锁定
16740
+ */
16708
16741
  checkLocked(e) {
16709
16742
  const a = this.project.value?.locked, o = !!a, l = this.access?.getData();
16710
16743
  if (o && l?.name !== a)
16711
- return e || Kt(`项目已被[ ${a} ]锁定,无法更新`), !0;
16744
+ return e || Pt(`项目已被[ ${a} ]锁定,无法更新`), !0;
16712
16745
  }
16746
+ /**
16747
+ * 渲染设计器界面
16748
+ */
16713
16749
  render() {
16714
16750
  const e = n(this.container);
16715
16751
  if (e) {
16716
16752
  const a = Lo(Vg);
16717
16753
  this.options.install && a.use(this.options.install, this), a.provide(Ms, fl(this)), a.mount(e), this.app = a;
16718
16754
  } else
16719
- Mt.warn("VTJEngine constructor param [ container ] is undefined");
16755
+ Lt.warn("VTJEngine constructor param [ container ] is undefined");
16720
16756
  }
16757
+ /**
16758
+ * 绑定所有事件监听器
16759
+ */
16721
16760
  bindEvents() {
16722
16761
  Pe.on(Hl, (e) => this.saveProject(e)), Pe.on(Gl, (e) => this.saveBlockFile(e)), Pe.on(ql, (e) => this.saveBlockFile(e)), Pe.on(Kl, () => this.saveMaterials()), Pe.on(ja, (e) => this.activeFile(e)), Pe.on(Xl, () => this.publish()), Pe.on(Ql, () => this.publishCurrent()), Pe.on(Ra, (e) => this.changeFile(e)), Pe.on(An, () => this.changeCurrentFile()), Pe.on(Yl, (e) => this.saveHistory(e)), Pe.on(Zl, (e) => this.loadHistory(e)), Pe.on(ei, () => this.genSource());
16723
16762
  }
16763
+ /**
16764
+ * 激活文件处理
16765
+ * @param e 项目模型事件
16766
+ */
16724
16767
  async activeFile(e) {
16725
16768
  await st();
16726
16769
  const a = e.model, o = e.model.currentFile;
@@ -16735,25 +16778,37 @@ class yf extends as {
16735
16778
  this.updateCurrent(l), this.initHistory(l);
16736
16779
  } else
16737
16780
  this.updateCurrent(null);
16738
- Ht(this.project);
16781
+ Gt(this.project);
16739
16782
  }
16783
+ /**
16784
+ * 处理文件变更
16785
+ * @param e 区块模型
16786
+ */
16740
16787
  async changeFile(e) {
16741
16788
  if (this.checkLocked()) return;
16742
16789
  await st();
16743
16790
  const a = e.toDsl();
16744
- this.service.saveFile(a, this.project.value?.toDsl()), this.updateCurrent(e), this.history.value?.add(a), Ht(this.history);
16791
+ this.service.saveFile(a, this.project.value?.toDsl()), this.updateCurrent(e), this.history.value?.add(a), Gt(this.history);
16745
16792
  }
16746
16793
  changeCurrentFile() {
16747
- this.saveCurrentFile(), this.current.value && (this.history.value?.add(this.current.value.toDsl()), Ht(this.history));
16794
+ this.saveCurrentFile(), this.current.value && (this.history.value?.add(this.current.value.toDsl()), Gt(this.history));
16748
16795
  }
16749
16796
  async updateCurrent(e, a = !0) {
16750
- this.current.value = e, await st(), this.context.value = this.simulator.renderer?.context || null, this.isEmptyCurrent.value = this.current.value?.nodes.length === 0, this.changed.value = Symbol(), a && Ht(this.context);
16797
+ this.current.value = e, await st(), this.context.value = this.simulator.renderer?.context || null, this.isEmptyCurrent.value = this.current.value?.nodes.length === 0, this.changed.value = Symbol(), a && Gt(this.context);
16751
16798
  }
16799
+ /**
16800
+ * 保存项目
16801
+ * @param e 项目模型事件
16802
+ */
16752
16803
  async saveProject(e) {
16753
16804
  if (this.checkLocked()) return;
16754
16805
  const o = e.model.toDsl();
16755
- await this.service.saveProject(o, e.type), Ht(this.project);
16806
+ await this.service.saveProject(o, e.type), Gt(this.project);
16756
16807
  }
16808
+ /**
16809
+ * 保存区块文件
16810
+ * @param e 项目模型事件
16811
+ */
16757
16812
  async saveBlockFile(e) {
16758
16813
  if (this.checkLocked()) return;
16759
16814
  const a = e.type, o = e.model, l = o.toDsl();
@@ -16776,7 +16831,7 @@ class yf extends as {
16776
16831
  const { source: s, target: i } = e.data, c = await this.service.getFile(s.id, l);
16777
16832
  c && (c.id = i.id, c.name = i.name, await this.service.saveFile(c, l));
16778
16833
  }
16779
- Ht(this.project), this.emitter.emit(Ta, e);
16834
+ Gt(this.project), this.emitter.emit(Ta, e);
16780
16835
  }
16781
16836
  onSaveBlockFileFinish(e) {
16782
16837
  const a = (o) => {
@@ -16784,6 +16839,9 @@ class yf extends as {
16784
16839
  };
16785
16840
  this.emitter.on(Ta, a);
16786
16841
  }
16842
+ /**
16843
+ * 保存物料资源
16844
+ */
16787
16845
  async saveMaterials() {
16788
16846
  await st(), this.simulator.ready(() => {
16789
16847
  const e = this.project.value;
@@ -16798,6 +16856,10 @@ class yf extends as {
16798
16856
  const e = this.current.value;
16799
16857
  e && (this.updateCurrent(e), this.service.saveFile(e.toDsl(), this.project.value?.toDsl()));
16800
16858
  }
16859
+ /**
16860
+ * 初始化历史记录
16861
+ * @param block 区块模型
16862
+ */
16801
16863
  async initHistory(e) {
16802
16864
  if (e) {
16803
16865
  const a = await this.service.getHistory(e.id, this.project.value?.toDsl()).catch(() => null);
@@ -16807,6 +16869,10 @@ class yf extends as {
16807
16869
  } else
16808
16870
  this.history.value = null;
16809
16871
  }
16872
+ /**
16873
+ * 保存历史记录
16874
+ * @param e 历史模型事件
16875
+ */
16810
16876
  async saveHistory(e) {
16811
16877
  if (this.checkLocked(!0)) return;
16812
16878
  const a = e.type, o = e.model, l = this.project.value?.toDsl();
@@ -16824,8 +16890,12 @@ class yf extends as {
16824
16890
  l
16825
16891
  );
16826
16892
  const s = o.toDsl();
16827
- await this.service.saveHistory(s, l), Ht(this.history);
16893
+ await this.service.saveHistory(s, l), Gt(this.history);
16828
16894
  }
16895
+ /**
16896
+ * 加载历史记录
16897
+ * @param e 历史模型事件
16898
+ */
16829
16899
  async loadHistory(e) {
16830
16900
  const a = e.model, o = e.data, l = this.project.value?.toDsl(), s = await this.service.getHistoryItem(
16831
16901
  a.id,
@@ -16834,9 +16904,12 @@ class yf extends as {
16834
16904
  );
16835
16905
  if (s && s.dsl) {
16836
16906
  const i = new Sa(s.dsl);
16837
- await this.updateCurrent(i), this.service.saveFile(s.dsl, l), Ht(this.history);
16907
+ await this.updateCurrent(i), this.service.saveFile(s.dsl, l), Gt(this.history);
16838
16908
  }
16839
16909
  }
16910
+ /**
16911
+ * 发布项目
16912
+ */
16840
16913
  async publish() {
16841
16914
  if (this.checkLocked()) return;
16842
16915
  const e = this.project.value;
@@ -16848,6 +16921,10 @@ class yf extends as {
16848
16921
  await this.service.publish(a) && Ie("整站发布成功", "success");
16849
16922
  }
16850
16923
  }
16924
+ /**
16925
+ * 生成源代码
16926
+ * @returns 生成的源代码
16927
+ */
16851
16928
  async genSource() {
16852
16929
  if (this.checkLocked()) return;
16853
16930
  const e = this.project.value;
@@ -16859,9 +16936,16 @@ class yf extends as {
16859
16936
  return a ? await this.service.genSource(a) : void 0;
16860
16937
  }
16861
16938
  }
16939
+ /**
16940
+ * 应用AI生成的DSL
16941
+ * @param dsl 区块Schema
16942
+ */
16862
16943
  async applyAI(e) {
16863
16944
  new Sa(e).update(e);
16864
16945
  }
16946
+ /**
16947
+ * 发布当前文件
16948
+ */
16865
16949
  async publishCurrent() {
16866
16950
  if (this.checkLocked()) return;
16867
16951
  const e = this.project.value, a = e?.currentFile;
@@ -16873,9 +16957,16 @@ class yf extends as {
16873
16957
  await this.service.publishFile(o, a) && Ie("发布成功", "success");
16874
16958
  }
16875
16959
  }
16960
+ /**
16961
+ * 销毁引擎,清理资源
16962
+ */
16876
16963
  dispose() {
16877
16964
  this.emitter.all.clear(), this.simulator.dispose(), this.app && (this.app.unmount(), this.container = void 0);
16878
16965
  }
16966
+ /**
16967
+ * 打开指定文件
16968
+ * @param fileId 文件ID
16969
+ */
16879
16970
  async openFile(e) {
16880
16971
  const a = this.project.value, o = this.skeleton?.getRegion("Apps"), l = e || a?.homepage;
16881
16972
  if (!a || !o || !l) return;
@@ -16891,9 +16982,9 @@ class yf extends as {
16891
16982
  }
16892
16983
  function ze() {
16893
16984
  const r = Pa(Ms, null);
16894
- return r || Mt.error("VTJEngine is not exist"), r;
16985
+ return r || Lt.error("VTJEngine is not exist"), r;
16895
16986
  }
16896
- const Gt = P({
16987
+ const qt = P({
16897
16988
  name: "RegionWrapper",
16898
16989
  props: {
16899
16990
  region: {
@@ -16997,7 +17088,7 @@ const Gt = P({
16997
17088
  getWidget(r) {
16998
17089
  const t = Xn.get(r);
16999
17090
  if (!t) {
17000
- Mt.warn(`widget [ ${r} ] is not exsit`);
17091
+ Lt.warn(`widget [ ${r} ] is not exsit`);
17001
17092
  return;
17002
17093
  }
17003
17094
  return this.getWidgets(t.region).find((a) => a.widget.name === r);
@@ -17192,18 +17283,18 @@ const Gt = P({
17192
17283
  height: $.headerHeight
17193
17284
  }, {
17194
17285
  default: b(() => [
17195
- d(n(Gt), {
17286
+ d(n(qt), {
17196
17287
  ref_key: "brand",
17197
17288
  ref: p,
17198
17289
  region: "Brand"
17199
17290
  }, null, 512),
17200
- d(n(Gt), {
17291
+ d(n(qt), {
17201
17292
  ref_key: "toolbar",
17202
17293
  ref: f,
17203
17294
  region: "Toolbar",
17204
17295
  preview: s.value
17205
17296
  }, null, 8, ["preview"]),
17206
- d(n(Gt), {
17297
+ d(n(qt), {
17207
17298
  ref_key: "actions",
17208
17299
  ref: h,
17209
17300
  region: "Actions"
@@ -17221,7 +17312,7 @@ const Gt = P({
17221
17312
  }])
17222
17313
  }, {
17223
17314
  default: b(() => [
17224
- d(n(Gt), {
17315
+ d(n(qt), {
17225
17316
  ref_key: "apps",
17226
17317
  ref: S,
17227
17318
  region: "Apps"
@@ -17233,14 +17324,14 @@ const Gt = P({
17233
17324
  ]),
17234
17325
  d(n(Il), { class: "v-skeleton__main" }, {
17235
17326
  default: b(() => [
17236
- s.value ? (u(), y(n(Gt), {
17327
+ s.value ? (u(), y(n(qt), {
17237
17328
  key: 0,
17238
17329
  ref_key: "preview",
17239
17330
  ref: C,
17240
17331
  region: "Preview",
17241
17332
  preview: s.value
17242
17333
  }, null, 8, ["preview"])) : j("", !0),
17243
- jt(d(n(Gt), {
17334
+ jt(d(n(qt), {
17244
17335
  ref_key: "workspace",
17245
17336
  ref: w,
17246
17337
  region: "Workspace"
@@ -17256,7 +17347,7 @@ const Gt = P({
17256
17347
  class: "v-skeleton__right"
17257
17348
  }, {
17258
17349
  default: b(() => [
17259
- d(n(Gt), {
17350
+ d(n(qt), {
17260
17351
  ref_key: "settings",
17261
17352
  ref: V,
17262
17353
  region: "Settings"
@@ -17276,7 +17367,7 @@ const Gt = P({
17276
17367
  height: $.footerHeight
17277
17368
  }, {
17278
17369
  default: b(() => [
17279
- d(n(Gt), {
17370
+ d(n(qt), {
17280
17371
  ref_key: "status",
17281
17372
  ref: _,
17282
17373
  region: "Status"
@@ -17341,7 +17432,7 @@ const Gt = P({
17341
17432
  }, h = () => {
17342
17433
  o.value = !1, l.value = "";
17343
17434
  }, S = async (V) => Ke(V, e.context, !0) ? (m[s.value.name] = i.value, i.value = V, a("change", V), !0) : !1, w = async () => {
17344
- await Lt("确定要解除绑定吗?") && (h(), i.value = void 0, a("change", void 0));
17435
+ await zt("确定要解除绑定吗?") && (h(), i.value = void 0, a("change", void 0));
17345
17436
  };
17346
17437
  return (V, _) => (u(), y(n(fn), {
17347
17438
  class: "v-setter",
@@ -17602,7 +17693,7 @@ const Gt = P({
17602
17693
  region: {}
17603
17694
  },
17604
17695
  setup(r, { expose: t }) {
17605
- const e = r, { widgets: a, widgetsRef: o } = Zt(e.region), l = x(Symbol()), s = Pt(
17696
+ const e = r, { widgets: a, widgetsRef: o } = Zt(e.region), l = x(Symbol()), s = Bt(
17606
17697
  a.value.map((_) => ({
17607
17698
  name: _.name,
17608
17699
  command: _.name,
@@ -17836,7 +17927,7 @@ const Gt = P({
17836
17927
  region: {}
17837
17928
  },
17838
17929
  setup(r, { expose: t }) {
17839
- const e = r, { widgets: a, widgetsRef: o } = Zt(e.region), l = Pt(
17930
+ const e = r, { widgets: a, widgetsRef: o } = Zt(e.region), l = Bt(
17840
17931
  a.value.map((c) => ({
17841
17932
  name: c.name,
17842
17933
  command: c.name,
@@ -17917,12 +18008,12 @@ export {
17917
18008
  bg as a1,
17918
18009
  Cn as a2,
17919
18010
  Vg as a3,
17920
- Gt as a4,
18011
+ qt as a4,
17921
18012
  tn as a5,
17922
18013
  ce as a6,
17923
- Kt as a7,
18014
+ Pt as a7,
17924
18015
  xe as a8,
17925
- Lt as a9,
18016
+ zt as a9,
17926
18017
  Ie as aa,
17927
18018
  Fc as ab,
17928
18019
  Ke as ac,
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { f as e, A as E, H as r, p as t, o as i, O as n, Q as S, E as _, j as o, F as I, z as p, k as T, n as l, K as O, M as V, a as R, x as g, N as d, e as A, T as M, P as D, l as P, R as L, g as N, B as u, a4 as b, J as c, D as B, S as W, i as m, a6 as Y, I as w, h as x, a3 as y, t as C, m as G, V as K, v as U, b as f, d as k, c as F, y as H, q as v, u as X, W as Z, a5 as z, a7 as J, X as h, Y as j, $ as q, U as Q, a9 as $, L as aa, Z as sa, a1 as ea, C as Ea, ac as ra, ad as ta, aa as ia, ae as na, a8 as Sa, ab as _a, r as oa, a2 as Ia, s as pa, G as Ta, a0 as la, w as Oa } from "./index-Dk3wQ7we.js";
1
+ import { f as e, A as E, H as r, p as t, o as i, O as n, Q as S, E as _, j as o, F as I, z as p, k as T, n as l, K as O, M as V, a as R, x as g, N as d, e as A, T as M, P as D, l as P, R as L, g as N, B as u, a4 as b, J as c, D as B, S as W, i as m, a6 as Y, I as w, h as x, a3 as y, t as C, m as G, V as K, v as U, b as f, d as k, c as F, y as H, q as v, u as X, W as Z, a5 as z, a7 as J, X as h, Y as j, $ as q, U as Q, a9 as $, L as aa, Z as sa, a1 as ea, C as Ea, ac as ra, ad as ta, aa as ia, ae as na, a8 as Sa, ab as _a, r as oa, a2 as Ia, s as pa, G as Ta, a0 as la, w as Oa } from "./index-BwxXEIL4.js";
2
2
  export {
3
3
  e as ACCESS,
4
4
  E as API_METHOD_TYPES,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/designer",
3
3
  "private": false,
4
- "version": "0.12.20",
4
+ "version": "0.12.21",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "低代码引擎",
@@ -26,12 +26,12 @@
26
26
  "marked": "~15.0.8",
27
27
  "mockjs": "~1.1.0",
28
28
  "monaco-editor": "~0.52.0",
29
- "@vtj/core": "~0.12.20",
30
- "@vtj/renderer": "~0.12.20",
31
- "@vtj/ui": "~0.12.20",
32
- "@vtj/icons": "~0.12.20",
33
- "@vtj/uni": "~0.12.20",
34
- "@vtj/utils": "~0.12.20"
29
+ "@vtj/core": "~0.12.21",
30
+ "@vtj/renderer": "~0.12.21",
31
+ "@vtj/icons": "~0.12.21",
32
+ "@vtj/uni": "~0.12.21",
33
+ "@vtj/utils": "~0.12.21",
34
+ "@vtj/ui": "~0.12.21"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/mockjs": "~1.0.10",
@@ -7,6 +7,9 @@ import { Assets } from './assets';
7
7
  import { Report } from './report';
8
8
  import { OpenApi } from './openapi';
9
9
  export declare const engineKey: InjectionKey<ShallowReactive<Engine>>;
10
+ /**
11
+ * 设计器引擎配置选项
12
+ */
10
13
  export interface EngineOptions {
11
14
  /**
12
15
  * 设计器渲染容器
@@ -78,6 +81,10 @@ export interface EngineOptions {
78
81
  enhance?: boolean | EnhanceConfig;
79
82
  }
80
83
  export declare const SAVE_BLOCK_FILE_FINISH = "SAVE_BLOCK_FILE_FINISH";
84
+ /**
85
+ * 设计器引擎核心类,负责管理设计器的整体生命周期和状态
86
+ * 包括项目管理、文件操作、历史记录、渲染等核心功能
87
+ */
81
88
  export declare class Engine extends Base {
82
89
  options: EngineOptions;
83
90
  app?: App;
@@ -104,28 +111,104 @@ export declare class Engine extends Base {
104
111
  checkVersion: boolean;
105
112
  openApi?: OpenApi;
106
113
  constructor(options: EngineOptions);
114
+ /**
115
+ * 初始化引擎
116
+ * @param project 项目Schema
117
+ */
107
118
  private init;
119
+ /**
120
+ * 获取增强配置
121
+ * @param enhance 增强配置或布尔值
122
+ * @returns 增强配置对象
123
+ */
108
124
  private getEnhanceConfig;
125
+ /**
126
+ * 检查项目是否被锁定
127
+ * @param slient 是否静默检查
128
+ * @returns 是否被锁定
129
+ */
109
130
  private checkLocked;
131
+ /**
132
+ * 渲染设计器界面
133
+ */
110
134
  private render;
135
+ /**
136
+ * 绑定所有事件监听器
137
+ */
111
138
  private bindEvents;
139
+ /**
140
+ * 激活文件处理
141
+ * @param e 项目模型事件
142
+ */
112
143
  private activeFile;
144
+ /**
145
+ * 处理文件变更
146
+ * @param e 区块模型
147
+ */
113
148
  private changeFile;
114
149
  private changeCurrentFile;
115
150
  private updateCurrent;
151
+ /**
152
+ * 保存项目
153
+ * @param e 项目模型事件
154
+ */
116
155
  private saveProject;
156
+ /**
157
+ * 保存区块文件
158
+ * @param e 项目模型事件
159
+ */
117
160
  private saveBlockFile;
118
161
  onSaveBlockFileFinish(callback: (e: ProjectModelEvent) => void): void;
162
+ /**
163
+ * 保存物料资源
164
+ */
119
165
  private saveMaterials;
120
166
  private saveCurrentFile;
167
+ /**
168
+ * 初始化历史记录
169
+ * @param block 区块模型
170
+ */
121
171
  private initHistory;
172
+ /**
173
+ * 保存历史记录
174
+ * @param e 历史模型事件
175
+ */
122
176
  private saveHistory;
177
+ /**
178
+ * 加载历史记录
179
+ * @param e 历史模型事件
180
+ */
123
181
  private loadHistory;
182
+ /**
183
+ * 发布项目
184
+ */
124
185
  private publish;
186
+ /**
187
+ * 生成源代码
188
+ * @returns 生成的源代码
189
+ */
125
190
  genSource(): Promise<string | undefined>;
191
+ /**
192
+ * 应用AI生成的DSL
193
+ * @param dsl 区块Schema
194
+ */
126
195
  applyAI(dsl: BlockSchema): Promise<void>;
196
+ /**
197
+ * 发布当前文件
198
+ */
127
199
  private publishCurrent;
200
+ /**
201
+ * 销毁引擎,清理资源
202
+ */
128
203
  dispose(): void;
204
+ /**
205
+ * 打开指定文件
206
+ * @param fileId 文件ID
207
+ */
129
208
  openFile(fileId?: string): Promise<void>;
130
209
  }
210
+ /**
211
+ * 在Vue组件中使用引擎的hook
212
+ * @returns 引擎实例
213
+ */
131
214
  export declare function useEngine(): ShallowReactive<Engine>;
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2025, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/designer
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.12.19
5
+ * @version 0.12.20
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export declare const version = "0.12.19";
8
+ export declare const version = "0.12.20";
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./index-Dk3wQ7we.js";
2
- export {
3
- f as default
4
- };