@opentiny/tiny-engine-canvas 2.0.0-rc.0 → 2.0.0-rc.1

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.
Files changed (2) hide show
  1. package/dist/index.js +111 -112
  2. package/package.json +9 -10
package/dist/index.js CHANGED
@@ -1,21 +1,20 @@
1
- var bb = Object.defineProperty;
2
- var cb = (l, Z, c) => Z in l ? bb(l, Z, { enumerable: !0, configurable: !0, writable: !0, value: c }) : l[Z] = c;
3
- var Il = (l, Z, c) => cb(l, typeof Z != "symbol" ? Z + "" : Z, c);
1
+ var cb = Object.defineProperty;
2
+ var Gb = (l, Z, c) => Z in l ? cb(l, Z, { enumerable: !0, configurable: !0, writable: !0, value: c }) : l[Z] = c;
3
+ var Il = (l, Z, c) => Gb(l, typeof Z != "symbol" ? Z + "" : Z, c);
4
4
  import "./index.css";
5
- import { getMetaApi as Gb, useResource as Bl, useTranslate as bZ, useCanvas as v, useMaterial as il, useLayout as M, useHistory as al, getMergeMeta as Al, useModal as nZ, useProperty as db, useProperties as oZ, getMergeRegistry as mb, getOptions as Xb, HOOK_NAME as Wb } from "@opentiny/tiny-engine-meta-register";
6
- import { Steps as Vb, Popover as ib } from "@opentiny/vue";
7
- import { resolveComponent as k, openBlock as L, createElementBlock as n, createElementVNode as N, withDirectives as ml, createVNode as t, vShow as Xl, shallowReactive as pb, reactive as Gl, nextTick as Ql, toRaw as Yb, ref as C, normalizeStyle as $, Fragment as Wl, renderList as RZ, normalizeClass as tl, toDisplayString as wl, createCommentVNode as P, withModifiers as w, createBlock as Vl, resolveDynamicComponent as Hl, computed as ll, withCtx as Zl, createSlots as hb, renderSlot as Fl, watch as bl, watchPostEffect as Rb, useCssVars as cZ, onMounted as Ib, onUnmounted as KZ, normalizeProps as yb } from "vue";
8
- import { _ as D, c as GZ, N as Jl, a as UZ, b as ub, d as ab, e as Jb } from "./utils.js";
9
- import { iframeMonitoring as Lb } from "@opentiny/tiny-engine-common/js/monitor";
10
- import { isVsCodeEnv as Nb, VITE_CDN_DOMAIN as dl } from "@opentiny/tiny-engine-common/js/environments";
11
- import { iconRight as sb, iconSetting as Sb, iconClose as xb, IconDel as Hb, IconSetting as Fb, IconChevronLeft as nb, IconArrowDown as ob, IconArrowUp as Kb, IconCopy as Ub, IconEyeclose as zb } from "@opentiny/vue-icon";
5
+ import { getMetaApi as nZ, useResource as Bl, useTranslate as bZ, useCanvas as v, useMaterial as il, useLayout as M, useHistory as al, getMergeMeta as Al, useModal as oZ, useProperty as db, useProperties as KZ, getMergeRegistry as mb, getOptions as Xb, META_SERVICE as Wb, HOOK_NAME as Vb } from "@opentiny/tiny-engine-meta-register";
6
+ import { Steps as ib, Popover as pb } from "@opentiny/vue";
7
+ import { resolveComponent as k, openBlock as L, createElementBlock as n, createElementVNode as N, withDirectives as ml, createVNode as t, vShow as Xl, shallowReactive as Yb, reactive as Gl, nextTick as Ql, toRaw as hb, ref as C, normalizeStyle as $, Fragment as Wl, renderList as RZ, normalizeClass as tl, toDisplayString as wl, createCommentVNode as P, withModifiers as w, createBlock as Vl, resolveDynamicComponent as Hl, computed as ll, withCtx as Zl, createSlots as Rb, renderSlot as Fl, watch as bl, watchPostEffect as Ib, useCssVars as cZ, onMounted as yb, onUnmounted as UZ, normalizeProps as ub } from "vue";
8
+ import { _ as D, c as GZ, N as Jl, a as zZ, b as ab, d as Jb, e as Lb } from "./utils.js";
9
+ import { iframeMonitoring as Nb } from "@opentiny/tiny-engine-common/js/monitor";
10
+ import { isVsCodeEnv as sb, VITE_CDN_DOMAIN as dl } from "@opentiny/tiny-engine-common/js/environments";
11
+ import { iconRight as Sb, iconSetting as xb, iconClose as Hb, IconDel as Fb, IconSetting as nb, IconChevronLeft as ob, IconArrowDown as Kb, IconArrowUp as Ub, IconCopy as zb, IconEyeclose as Cb } from "@opentiny/vue-icon";
12
12
  import { extend as q } from "@opentiny/vue-renderless/common/object";
13
- import { useHttp as Cb } from "@opentiny/tiny-engine-http";
14
- import { constants as zZ } from "@opentiny/tiny-engine-utils";
13
+ import { constants as CZ } from "@opentiny/tiny-engine-utils";
15
14
  import * as Tb from "@opentiny/tiny-engine-common/js/ast";
16
15
  const kb = {
17
16
  components: {
18
- TinySteps: Vb
17
+ TinySteps: ib
19
18
  },
20
19
  props: {
21
20
  data: {
@@ -25,7 +24,7 @@ const kb = {
25
24
  },
26
25
  emits: ["click"],
27
26
  setup() {
28
- const { selectNode: l } = Gb("engine.canvas").canvasApi.value;
27
+ const { selectNode: l } = nZ("engine.canvas").canvasApi.value;
29
28
  return {
30
29
  selectFooterNode: ({ node: c }) => {
31
30
  l(c);
@@ -615,7 +614,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
615
614
  LEFT: "left",
616
615
  RIGHT: "right",
617
616
  IN: "in"
618
- }), CZ = {
617
+ }), TZ = {
619
618
  keydown: !1,
620
619
  draging: !1,
621
620
  data: null,
@@ -625,7 +624,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
625
624
  // iframe里鼠标位置
626
625
  element: null,
627
626
  offset: {}
628
- }, a = pb({
627
+ }, a = Yb({
629
628
  type: "normal",
630
629
  schema: null,
631
630
  renderer: null,
@@ -646,7 +645,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
646
645
  var l;
647
646
  return (l = g()) == null ? void 0 : l.getSchema();
648
647
  }, Eb = () => g().getContext(), U = Gl({
649
- ...CZ
648
+ ...TZ
650
649
  }), jl = {
651
650
  top: 0,
652
651
  height: 0,
@@ -655,7 +654,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
655
654
  schema: null,
656
655
  configure: null,
657
656
  componentName: ""
658
- }, TZ = {
657
+ }, kZ = {
659
658
  top: 0,
660
659
  height: 0,
661
660
  width: 0,
@@ -670,7 +669,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
670
669
  }), pl = Gl({
671
670
  ...jl
672
671
  }), E = Gl({
673
- ...TZ
672
+ ...kZ
674
673
  }), Nl = () => {
675
674
  Object.assign(pl, jl, { slot: null });
676
675
  }, gl = () => {
@@ -696,11 +695,11 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
696
695
  }
697
696
  }, dZ = (l, Z, { offsetX: c = 0, offsetY: b = 0, horizontal: G, vertical: d, width: X, height: m, x: i, y: W } = {}) => {
698
697
  U.keydown = !0, U.data = l || {}, U.timer = Date.now(), U.element = Z, U.offset = { offsetX: c, offsetY: b, horizontal: G, vertical: d, width: X, height: m, x: i, y: W }, Nl();
699
- }, kZ = () => {
700
- Object.assign(E, TZ);
698
+ }, BZ = () => {
699
+ Object.assign(E, kZ);
701
700
  }, Pb = () => {
702
701
  const { element: l, data: Z } = U;
703
- l && a.type === "absolute" && (Z.props = Z.props || {}, Z.props.style = l.style.cssText, Yl().addHistory()), Object.assign(U, CZ), kZ(), Ml.stop();
702
+ l && a.type === "absolute" && (Z.props = Z.props || {}, Z.props.style = l.style.cssText, Yl().addHistory()), Object.assign(U, TZ), BZ(), Ml.stop();
704
703
  }, Ob = (l) => {
705
704
  if (l.ownerDocument === document)
706
705
  return { x: 0, y: 0 };
@@ -732,7 +731,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
732
731
  };
733
732
  }
734
733
  return l.getBoundingClientRect();
735
- }, BZ = ({ parent: l, node: Z, data: c }) => {
734
+ }, MZ = ({ parent: l, node: Z, data: c }) => {
736
735
  const G = l.children.indexOf(Z);
737
736
  l.children.splice(G + 1, 0, c);
738
737
  }, Db = ({ parent: l, node: Z, data: c }) => {
@@ -755,7 +754,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
755
754
  const G = b == null ? void 0 : b.getAttribute("loop-id");
756
755
  if (b && G) {
757
756
  const d = x().loopId;
758
- Z = `[${Jl}="${l}"][${UZ}="${d}"]`, b = c.querySelector(Z);
757
+ Z = `[${Jl}="${l}"][${zZ}="${d}"]`, b = c.querySelector(Z);
759
758
  }
760
759
  return b;
761
760
  }, fb = () => {
@@ -767,7 +766,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
767
766
  d < 0 ? p.left = Z.scrollLeft + G - Cl : G > c && (p.left = Z.scrollLeft + G - c + i + Cl), m < 0 ? p.top = Z.scrollTop + X - Cl : X > b && (p.top = Z.scrollTop + X - b + W + Cl), (typeof p.left == "number" || typeof p.top == "number") && Z.scrollTo(p);
768
767
  }
769
768
  return Ql();
770
- }, MZ = (l) => {
769
+ }, tZ = (l) => {
771
770
  var X;
772
771
  l = l || O().body;
773
772
  const { left: Z, height: c, top: b, width: G } = rl(l), d = ((X = x().schema) == null ? void 0 : X.componentName) || "";
@@ -782,7 +781,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
782
781
  }, A = (l) => {
783
782
  var Z;
784
783
  if (l = typeof l == "string" && l || ((Z = x().schema) == null ? void 0 : Z.id), Nl(), l)
785
- setTimeout(() => MZ(hl(l)));
784
+ setTimeout(() => tZ(hl(l)));
786
785
  else {
787
786
  if (!cl.componentName && cl.width > 0)
788
787
  return;
@@ -794,7 +793,7 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
794
793
  return l === "Template" ? {
795
794
  isContainer: !0
796
795
  } : ((c = Z == null ? void 0 : Z.content) == null ? void 0 : c.configure) || Z.configure || {};
797
- }, tZ = (l = pl.configure || {}, Z = U.data || {}) => {
796
+ }, wZ = (l = pl.configure || {}, Z = U.data || {}) => {
798
797
  const { nestingRule: c = {} } = l, { childWhitelist: b = [], descendantBlacklist: G = [] } = c;
799
798
  if (!l.isContainer)
800
799
  return !1;
@@ -814,13 +813,13 @@ const vb = /* @__PURE__ */ D(kb, [["render", wb], ["__scopeId", "data-v-5d85802b
814
813
  var i;
815
814
  const c = U.mouse, b = Math.min(IZ, l.height / 3), G = Math.min(IZ, l.width / 3);
816
815
  let d, X = !1;
817
- c.y < l.top + b ? d = Q.TOP : c.y > l.bottom - b ? d = Q.BOTTOM : c.x < l.left + G ? d = Q.LEFT : c.x > l.right - G ? d = Q.RIGHT : Z.isContainer ? (d = Q.IN, tZ() || (X = !0)) : d = Q.BOTTOM;
816
+ c.y < l.top + b ? d = Q.TOP : c.y > l.bottom - b ? d = Q.BOTTOM : c.x < l.left + G ? d = Q.LEFT : c.x > l.right - G ? d = Q.RIGHT : Z.isContainer ? (d = Q.IN, wZ() || (X = !0)) : d = Q.BOTTOM;
818
817
  const m = (i = U.data) == null ? void 0 : i.id;
819
818
  return m && rb(m, E.id) && (X = !0), { type: d, forbidden: X };
820
819
  }, Dl = (l) => l.nodeName === "BODY", ql = (l, Z) => {
821
820
  if (!l)
822
821
  return Nl();
823
- const c = l.getAttribute(Jb), b = l.getAttribute(Jl), G = nl(c), d = rl(l), { left: X, height: m, top: i, width: W } = d;
822
+ const c = l.getAttribute(Lb), b = l.getAttribute(Jl), G = nl(c), d = rl(l), { left: X, height: m, top: i, width: W } = d;
824
823
  if (pl.configure = G, Z) {
825
824
  let p = null;
826
825
  E.id = b, E.configure = G;
@@ -896,7 +895,7 @@ const qb = (l, Z) => {
896
895
  const { rootSelector: d } = nl(c.componentName);
897
896
  G = d ? G.querySelector(d) : G;
898
897
  }
899
- return a.current = c, a.parent = b, await Ab(G), MZ(G), a.emit("selected", c, b, Z), c;
898
+ return a.current = c, a.parent = b, await Ab(G), tZ(G), a.emit("selected", c, b, Z), c;
900
899
  }, $b = (l, Z) => {
901
900
  const c = hl(l);
902
901
  c && ql(c, Z);
@@ -911,7 +910,7 @@ const qb = (l, Z) => {
911
910
  break;
912
911
  case Q.BOTTOM:
913
912
  case Q.RIGHT:
914
- BZ(l);
913
+ MZ(l);
915
914
  break;
916
915
  case Q.IN:
917
916
  Pl(l);
@@ -924,15 +923,15 @@ const qb = (l, Z) => {
924
923
  }, lc = (l, Z) => {
925
924
  const { schema: c, parent: b } = x();
926
925
  ol({ node: c, parent: b, data: l }, Z);
927
- }, wZ = (l) => {
926
+ }, vZ = (l) => {
928
927
  if (!l)
929
928
  return;
930
929
  const { node: Z, parent: c } = f(l, !0);
931
- BZ({ parent: c, node: Z, data: GZ(Z) }), Yl().addHistory();
930
+ MZ({ parent: c, node: Z, data: GZ(Z) }), Yl().addHistory();
932
931
  }, Zc = () => {
933
932
  const { draging: l, data: Z } = U, { position: c, forbidden: b } = E, G = a.type === "absolute", d = Z == null ? void 0 : Z.id, X = E.id;
934
933
  if (l && !b) {
935
- const { parent: m, node: i } = f(X, !0) || {}, W = { parent: m, node: i, data: Yb(Z) };
934
+ const { parent: m, node: i } = f(X, !0) || {}, W = { parent: m, node: i, data: hb(Z) };
936
935
  d ? d !== X && !G && (mZ(f(d, !0)), ol(W, c)) : (G && (W.node = Ll(), Z.props = Z.props || {}, Z.props.style = `position: absolute; top: ${U.mouse.y}px; left: ${U.mouse.x}px`), ol(W, c));
937
936
  }
938
937
  Pb();
@@ -941,7 +940,7 @@ const qb = (l, Z) => {
941
940
  let b = c.getElementById(Z);
942
941
  const G = c.querySelector("head");
943
942
  c.body.setAttribute("style", ""), b ? b.innerHTML = l : (b = c.createElement("style"), b.setAttribute("type", "text/css"), b.setAttribute("id", Z), b.innerHTML = l, G.appendChild(b));
944
- }, cc = (l) => ub(l, O()), Gc = (l) => ab(l, O()), vZ = (l, Z) => {
943
+ }, cc = (l) => ab(l, O()), Gc = (l) => Jb(l, O()), QZ = (l, Z) => {
945
944
  const c = g().getI18n();
946
945
  Object.keys(l).forEach((b) => {
947
946
  const G = Z ? "mergeLocaleMessage" : "setLocaleMessage";
@@ -949,7 +948,7 @@ const qb = (l, Z) => {
949
948
  });
950
949
  }, dc = (l) => {
951
950
  g().setState(l);
952
- }, QZ = (l, Z, c) => {
951
+ }, jZ = (l, Z, c) => {
953
952
  g().setUtils(l, Z, c);
954
953
  }, mc = (l) => {
955
954
  g().updateUtils(l);
@@ -957,12 +956,12 @@ const qb = (l, Z) => {
957
956
  g().deleteUtils(l);
958
957
  }, Wc = (l) => {
959
958
  g().deleteState(l);
960
- }, jZ = (l) => {
959
+ }, gZ = (l) => {
961
960
  Bl().resState.globalState = l, g().setGlobalState(l);
962
- }, gZ = (l, Z = []) => {
961
+ }, eZ = (l, Z = []) => {
963
962
  const { parent: c, node: b } = f(l, !0) || {};
964
- return b && Z.unshift({ name: b.componentName, node: l }), c ? c && gZ(c.id, Z) : Z.unshift({ name: "BODY", node: l }), Z;
965
- }, eZ = async (l) => {
963
+ return b && Z.unshift({ name: b.componentName, node: l }), c ? c && eZ(c.id, Z) : Z.unshift({ name: "BODY", node: l }), Z;
964
+ }, EZ = async (l) => {
966
965
  var Z;
967
966
  return Nl(), gl(), a.schema = await ((Z = g()) == null ? void 0 : Z.setSchema(l)), a.schema;
968
967
  }, Vc = (l) => {
@@ -977,15 +976,15 @@ const qb = (l, Z) => {
977
976
  });
978
977
  }, Yc = (l) => {
979
978
  a.type = l || "normal", O().body.className = l === "absolute" ? "canvas-grid-bg" : "";
980
- }, hc = () => a.type, EZ = (l, Z, c = O()) => {
979
+ }, hc = () => a.type, PZ = (l, Z, c = O()) => {
981
980
  c && c.dispatchEvent(new CustomEvent(l, Z));
982
981
  }, Rc = {
983
982
  dragStart: dZ,
984
983
  updateRect: A,
985
984
  getContext: Eb,
986
- getNodePath: gZ,
985
+ getNodePath: eZ,
987
986
  dragMove: _l,
988
- setLocales: vZ,
987
+ setLocales: QZ,
989
988
  setState: dc,
990
989
  deleteState: Wc,
991
990
  getRenderer: g,
@@ -1000,8 +999,8 @@ const qb = (l, Z) => {
1000
999
  addStyle: cc,
1001
1000
  getNode: f,
1002
1001
  getCurrent: x,
1003
- setSchema: eZ,
1004
- setUtils: QZ,
1002
+ setSchema: EZ,
1003
+ setUtils: jZ,
1005
1004
  updateUtils: mc,
1006
1005
  deleteUtils: Xc,
1007
1006
  getSchema: Ll,
@@ -1009,21 +1008,21 @@ const qb = (l, Z) => {
1009
1008
  getCanvasType: hc,
1010
1009
  setCanvasType: Yc,
1011
1010
  setProps: ic,
1012
- setGlobalState: jZ,
1011
+ setGlobalState: gZ,
1013
1012
  getGlobalState: eb,
1014
1013
  getDocument: O,
1015
- canvasDispatch: EZ,
1014
+ canvasDispatch: PZ,
1016
1015
  Builtin: jb,
1017
1016
  setDataSourceMap: (...l) => a.renderer.setDataSourceMap(...l),
1018
1017
  getDataSourceMap: (...l) => a.renderer.getDataSourceMap(...l)
1019
1018
  }, Ic = ({ renderer: l, iframe: Z, emit: c, controller: b }) => {
1020
1019
  const G = Ll(), d = G || v().getPageSchema();
1021
- if (a.iframe = Z, a.emit = c, a.controller = b, a.renderer = l, l.setController(b), vZ(bZ().getData(), !0), Nb) {
1020
+ if (a.iframe = Z, a.emit = c, a.controller = b, a.renderer = l, l.setController(b), QZ(bZ().getData(), !0), sb) {
1022
1021
  const m = window.parent.postMessage;
1023
1022
  m({ type: "i18nReady", value: !0 }, "*");
1024
1023
  }
1025
- jZ(Bl().resState.globalState), l.setDataSourceMap(Bl().resState.dataSource), QZ(Bl().resState.utils), eZ(d), Vc(il().getConfigureMap()), EZ("updateDependencies", { detail: il().materialState.thirdPartyDeps }), a.loading = !1;
1026
- }, PZ = (l, Z) => {
1024
+ gZ(Bl().resState.globalState), l.setDataSourceMap(Bl().resState.dataSource), jZ(Bl().resState.utils), EZ(d), Vc(il().getConfigureMap()), PZ("updateDependencies", { detail: il().materialState.thirdPartyDeps }), a.loading = !1;
1025
+ }, OZ = (l, Z) => {
1027
1026
  let c;
1028
1027
  return typeof Z == "object" ? c = JSON.stringify(Z) : c = String(Z), l.clipboardData.setData("text/plain", c), l.preventDefault(), c;
1029
1028
  }, yc = (l) => {
@@ -1079,14 +1078,14 @@ const Uc = (l) => {
1079
1078
  break;
1080
1079
  }
1081
1080
  }, Cc = (l, Z) => {
1082
- PZ(l, GZ(Z)) && Kl(Z == null ? void 0 : Z.id);
1081
+ OZ(l, GZ(Z)) && Kl(Z == null ? void 0 : Z.id);
1083
1082
  }, Tc = (l, Z, c) => {
1084
- l != null && l.componentName && (Z != null && Z.componentName) && tZ(nl(Z.componentName), l) && ol({ parent: c, node: Z, data: { ...l } }, Q.IN);
1083
+ l != null && l.componentName && (Z != null && Z.componentName) && wZ(nl(Z.componentName), l) && ol({ parent: c, node: Z, data: { ...l } }, Q.IN);
1085
1084
  }, ul = (l) => {
1086
1085
  const { schema: Z, parent: c } = x(), b = uc(l);
1087
1086
  switch (l.type) {
1088
1087
  case "copy":
1089
- PZ(l, GZ(Z));
1088
+ OZ(l, GZ(Z));
1090
1089
  break;
1091
1090
  case "paste":
1092
1091
  Tc(b, Z, c);
@@ -1095,18 +1094,18 @@ const Uc = (l) => {
1095
1094
  Cc(l, Z);
1096
1095
  break;
1097
1096
  }
1098
- }, OZ = (l) => {
1097
+ }, DZ = (l) => {
1099
1098
  var Z;
1100
1099
  l.ctrlKey && (Z = x()) != null && Z.schema && zc(l.keyCode), Uc(l.keyCode);
1101
- }, DZ = (l) => {
1102
- l.removeEventListener("keydown", OZ), l.removeEventListener("copy", ul), l.removeEventListener("cut", ul), l.removeEventListener("paste", ul);
1100
+ }, fZ = (l) => {
1101
+ l.removeEventListener("keydown", DZ), l.removeEventListener("copy", ul), l.removeEventListener("cut", ul), l.removeEventListener("paste", ul);
1103
1102
  }, kc = (l) => {
1104
- DZ(l), l.addEventListener("keydown", OZ), l.addEventListener("copy", ul), l.addEventListener("cut", ul), l.addEventListener("paste", ul);
1103
+ fZ(l), l.addEventListener("keydown", DZ), l.addEventListener("copy", ul), l.addEventListener("cut", ul), l.addEventListener("paste", ul);
1105
1104
  }, _ = Gl({
1106
1105
  position: null,
1107
1106
  show: !1,
1108
1107
  menus: []
1109
- }), $l = C(null), lZ = C(null), ZZ = C(null), fZ = () => {
1108
+ }), $l = C(null), lZ = C(null), ZZ = C(null), AZ = () => {
1110
1109
  _.show = !1, $l.value = null;
1111
1110
  }, Bc = (l) => {
1112
1111
  _.position = {
@@ -1129,7 +1128,7 @@ const Uc = (l) => {
1129
1128
  });
1130
1129
  }, Mc = {
1131
1130
  components: {
1132
- IconRight: sb()
1131
+ IconRight: Sb()
1133
1132
  },
1134
1133
  setup(l, {
1135
1134
  emit: Z
@@ -1195,7 +1194,7 @@ const Uc = (l) => {
1195
1194
  },
1196
1195
  copy() {
1197
1196
  var V;
1198
- wZ((V = x().schema) == null ? void 0 : V.id);
1197
+ vZ((V = x().schema) == null ? void 0 : V.id);
1199
1198
  },
1200
1199
  config() {
1201
1200
  M().activeSetting("props");
@@ -1258,7 +1257,7 @@ const Uc = (l) => {
1258
1257
  }), H.children.splice(h, 1, R), Yl().addHistory();
1259
1258
  },
1260
1259
  createBlock() {
1261
- v().isSaved() ? G.value = !0 : nZ().message({
1260
+ v().isSaved() ? G.value = !0 : oZ().message({
1262
1261
  message: "请先保存当前页面",
1263
1262
  status: "error"
1264
1263
  });
@@ -1273,7 +1272,7 @@ const Uc = (l) => {
1273
1272
  menus: c,
1274
1273
  doOperation: (V) => {
1275
1274
  var u, I;
1276
- V.check && !((u = V.check) != null && u.call(V)) || X(V) || V != null && V.code && ((I = d[V.code]) == null || I.call(d, V), fZ());
1275
+ V.check && !((u = V.check) != null && u.call(V)) || X(V) || V != null && V.code && ((I = d[V.code]) == null || I.call(d, V), AZ());
1277
1276
  },
1278
1277
  boxVisibility: G,
1279
1278
  close: () => {
@@ -1339,13 +1338,13 @@ function jc(l, Z, c, b, G, d) {
1339
1338
  }
1340
1339
  const gc = /* @__PURE__ */ D(Mc, [["render", jc], ["__scopeId", "data-v-8a0ba437"]]), ec = {
1341
1340
  components: {
1342
- IconSetting: Sb(),
1343
- IconClose: xb()
1341
+ IconSetting: xb(),
1342
+ IconClose: Hb()
1344
1343
  },
1345
1344
  setup(l, { emit: Z }) {
1346
1345
  const { getMaterial: c } = il(), { pageState: b } = v(), { properties: G } = db().getProperty({ pageState: b }), d = C("props"), X = ll(() => {
1347
1346
  var u, I;
1348
- const i = [], W = oZ().getSchema();
1347
+ const i = [], W = KZ().getSchema();
1349
1348
  if (!W) return [];
1350
1349
  const V = ((I = (u = c(W.componentName).configure) == null ? void 0 : u.shortcuts) == null ? void 0 : I.properties) || [];
1351
1350
  return G.value.forEach((J) => {
@@ -1389,7 +1388,7 @@ function Oc(l, Z, c, b, G, d) {
1389
1388
  "data-prop-index": V,
1390
1389
  "data-group-index": l.groupIndex,
1391
1390
  isTopLayer: !0
1392
- }, hb({
1391
+ }, Rb({
1393
1392
  prefix: Zl(() => [
1394
1393
  Fl(l.$slots, "prefix", { data: p }, void 0, !0)
1395
1394
  ]),
@@ -1410,15 +1409,15 @@ function Oc(l, Z, c, b, G, d) {
1410
1409
  }
1411
1410
  const Dc = /* @__PURE__ */ D(ec, [["render", Oc], ["__scopeId", "data-v-761846f3"]]), uZ = 24, aZ = 24, fc = 8, fl = 6, Ac = 2, Tl = "unset", XZ = {
1412
1411
  components: {
1413
- IconDel: Hb(),
1414
- IconSetting: Fb(),
1415
- IconChevronLeft: nb(),
1416
- IconArrowDown: ob(),
1417
- IconArrowUp: Kb(),
1418
- IconCopy: Ub(),
1419
- IconEyeclose: zb(),
1412
+ IconDel: Fb(),
1413
+ IconSetting: nb(),
1414
+ IconChevronLeft: ob(),
1415
+ IconArrowDown: Kb(),
1416
+ IconArrowUp: Ub(),
1417
+ IconCopy: zb(),
1418
+ IconEyeclose: Cb(),
1420
1419
  shortCutPopover: Dc,
1421
- TinyPopover: ib
1420
+ TinyPopover: pb
1422
1421
  },
1423
1422
  props: {
1424
1423
  hoverState: {
@@ -1463,7 +1462,7 @@ const Dc = /* @__PURE__ */ D(ec, [["render", Oc], ["__scopeId", "data-v-761846f3
1463
1462
  const Y = (y = x().parent) == null ? void 0 : y.id;
1464
1463
  Y && r(Y);
1465
1464
  }, X = () => {
1466
- wZ(x().schema.id);
1465
+ vZ(x().schema.id);
1467
1466
  }, m = () => {
1468
1467
  var Y;
1469
1468
  g().setCondition((Y = x().schema) == null ? void 0 : Y.id, !1), A();
@@ -1562,7 +1561,7 @@ const Dc = /* @__PURE__ */ D(ec, [["render", Oc], ["__scopeId", "data-v-761846f3
1562
1561
  optionStyleValue: xl.toStyleValue()
1563
1562
  };
1564
1563
  };
1565
- return Rb(async () => {
1564
+ return Ib(async () => {
1566
1565
  const { left: Y, top: y, width: s, height: K, doc: z } = l.selectState;
1567
1566
  if (await Ql(), R.value && !V.value) {
1568
1567
  o.value = "left: 0; right: unset; top: unset; bottom: 0";
@@ -2095,12 +2094,12 @@ const yG = /* @__PURE__ */ D(VZ, [["render", IG], ["__scopeId", "data-v-240bfa7b
2095
2094
  const i = ll(() => l.canvasSrc ? "src" : "srcdoc"), W = async (R) => {
2096
2095
  var Y;
2097
2096
  const { clientX: o, clientY: S } = R, T = vl(R.target);
2098
- fZ();
2097
+ AZ();
2099
2098
  let F = x().schema;
2100
2099
  if (T) {
2101
2100
  const y = hl((Y = x().schema) == null ? void 0 : Y.id);
2102
2101
  if (!(y != null && y.contains(T)) || R.button === 0) {
2103
- const s = T.getAttribute(UZ);
2102
+ const s = T.getAttribute(zZ);
2104
2103
  s ? F = await r(T.getAttribute(Jl), `loop-id=${s}`) : F = await r(T.getAttribute(Jl));
2105
2104
  }
2106
2105
  if (R.button === 0 && T !== T.ownerDocument.body) {
@@ -2118,7 +2117,7 @@ const yG = /* @__PURE__ */ D(VZ, [["render", IG], ["__scopeId", "data-v-240bfa7b
2118
2117
  }
2119
2118
  }, V = ({ detail: R }) => {
2120
2119
  if (c.value) {
2121
- Lb(), Ic({ emit: Z, renderer: R, iframe: c.value, controller: l.controller });
2120
+ Nb(), Ic({ emit: Z, renderer: R, iframe: c.value, controller: l.controller });
2122
2121
  const o = c.value.contentDocument, S = c.value.contentWindow;
2123
2122
  let T = !1;
2124
2123
  S.addEventListener("mousedown", (F) => {
@@ -2156,16 +2155,16 @@ const yG = /* @__PURE__ */ D(VZ, [["render", IG], ["__scopeId", "data-v-240bfa7b
2156
2155
  var o;
2157
2156
  G.value = (o = b.value) == null ? void 0 : o.contains(R.target), m.value = R.target;
2158
2157
  }), window.addEventListener("dragenter", () => {
2159
- kZ();
2158
+ BZ();
2160
2159
  }), window.addEventListener("message", I);
2161
2160
  }, H = (R) => {
2162
2161
  G.value = R;
2163
2162
  }, h = (R) => {
2164
2163
  pl.slot = R;
2165
2164
  };
2166
- return Ib(() => J()), KZ(() => {
2165
+ return yb(() => J()), UZ(() => {
2167
2166
  var R;
2168
- (R = c.value) != null && R.contentDocument && DZ(c.value.contentDocument), window.removeEventListener("message", I, !1);
2167
+ (R = c.value) != null && R.contentDocument && fZ(c.value.contentDocument), window.removeEventListener("message", I, !1);
2169
2168
  }), document.addEventListener("beforeCanvasReady", p), document.addEventListener("canvasReady", V), {
2170
2169
  iframe: c,
2171
2170
  dragState: U,
@@ -2209,7 +2208,7 @@ function LG(l, Z, c, b, G, d) {
2209
2208
  t(i, { iframe: b.iframe }, null, 8, ["iframe"]),
2210
2209
  t(W, null, {
2211
2210
  default: Zl(() => [
2212
- b.loading ? (L(), n("div", aG, "应用数据初始化中...")) : (L(), n("iframe", yb({
2211
+ b.loading ? (L(), n("div", aG, "应用数据初始化中...")) : (L(), n("iframe", ub({
2213
2212
  key: 0,
2214
2213
  id: "canvas",
2215
2214
  ref: "iframe",
@@ -2571,9 +2570,9 @@ function CG(l = {}) {
2571
2570
  importStyles: d
2572
2571
  };
2573
2572
  }
2574
- const AZ = {
2573
+ const rZ = {
2575
2574
  id: "engine.canvas"
2576
- }, { PAGE_STATUS: FZ } = zZ, kl = {
2575
+ }, { PAGE_STATUS: FZ } = CZ, kl = {
2577
2576
  Block: "区块",
2578
2577
  Page: "页面"
2579
2578
  }, TG = {
@@ -2581,7 +2580,7 @@ const AZ = {
2581
2580
  var J, H;
2582
2581
  const l = mb("canvas"), Z = (J = Al("engine.plugins.materials")) == null ? void 0 : J.entry, { CanvasBreadcrumb: c } = l.components, b = l.layout.entry, [G] = l.metas, d = C([]), X = C(!0), m = C(null);
2583
2582
  let i = !1;
2584
- const { canvasSrc: W = "" } = Xb(AZ.id) || {};
2583
+ const { canvasSrc: W = "" } = Xb(rZ.id) || {};
2585
2584
  let p = "";
2586
2585
  if (!W) {
2587
2586
  const { importMap: h, importStyles: R } = CG((H = Al("engine.config")) == null ? void 0 : H.importMapVersion);
@@ -2608,7 +2607,7 @@ const AZ = {
2608
2607
  }, e = () => {
2609
2608
  i = !1, !h && S && z();
2610
2609
  };
2611
- i = !0, nZ().confirm({
2610
+ i = !0, oZ().confirm({
2612
2611
  title: "提示",
2613
2612
  message: s,
2614
2613
  status: "info",
@@ -2624,7 +2623,7 @@ const AZ = {
2624
2623
  const { toolbars: S } = M().layoutState;
2625
2624
  o !== "clickTree" && M().closePlugin();
2626
2625
  const { getSchema: T, getNodePath: F } = v().canvasApi.value, Y = T();
2627
- oZ().getProps(h || Y, R), v().setCurrentSchema(h || Y), d.value = F(h == null ? void 0 : h.id), S.visiblePopover = !1;
2626
+ KZ().getProps(h || Y, R), v().setCurrentSchema(h || Y), d.value = F(h == null ? void 0 : h.id), S.visiblePopover = !1;
2628
2627
  };
2629
2628
  let I = null;
2630
2629
  return bl(
@@ -2633,7 +2632,7 @@ const AZ = {
2633
2632
  var R;
2634
2633
  !h || !m.value || (document.removeEventListener("canvasResize", v().canvasApi.value.updateRect), (R = I == null ? void 0 : I.disconnect) == null || R.call(I), document.addEventListener("canvasResize", v().canvasApi.value.updateRect), I = new ResizeObserver(v().canvasApi.value.updateRect).observe(m.value));
2635
2634
  }
2636
- ), KZ(() => {
2635
+ ), UZ(() => {
2637
2636
  var h;
2638
2637
  document.removeEventListener("canvasResize", v().canvasApi.value.updateRect), (h = I == null ? void 0 : I.disconnect) == null || h.call(I);
2639
2638
  }), {
@@ -2649,7 +2648,7 @@ const AZ = {
2649
2648
  getMaterial: il().getMaterial,
2650
2649
  addHistory: al().addHistory,
2651
2650
  registerBlock: il().registerBlock,
2652
- request: Cb(),
2651
+ request: nZ(Wb.Http).getHttp(),
2653
2652
  ast: Tb
2654
2653
  },
2655
2654
  CanvasLayout: b,
@@ -2677,7 +2676,7 @@ function kG(l, Z, c, b, G, d) {
2677
2676
  _: 1
2678
2677
  });
2679
2678
  }
2680
- const BG = /* @__PURE__ */ D(TG, [["render", kG]]), { COMPONENT_NAME: MG } = zZ, rZ = {
2679
+ const BG = /* @__PURE__ */ D(TG, [["render", kG]]), { COMPONENT_NAME: MG } = CZ, qZ = {
2681
2680
  currentVm: null,
2682
2681
  currentSchema: null,
2683
2682
  currentType: null,
@@ -2690,7 +2689,7 @@ const BG = /* @__PURE__ */ D(TG, [["render", kG]]), { COMPONENT_NAME: MG } = zZ,
2690
2689
  isBlock: !1,
2691
2690
  nodesStatus: {},
2692
2691
  loading: !1
2693
- }, qZ = {
2692
+ }, _Z = {
2694
2693
  componentName: "Page",
2695
2694
  fileName: "",
2696
2695
  css: "",
@@ -2707,32 +2706,32 @@ const BG = /* @__PURE__ */ D(TG, [["render", kG]]), { COMPONENT_NAME: MG } = zZ,
2707
2706
  state: {},
2708
2707
  inputs: [],
2709
2708
  outputs: []
2710
- }, iZ = C({}), _Z = C(!1), tG = (l) => {
2711
- iZ.value = l, _Z.value = !0;
2712
- }, j = Gl({ ...rZ, loading: !0 }), pZ = async (l = {}) => {
2709
+ }, iZ = C({}), $Z = C(!1), tG = (l) => {
2710
+ iZ.value = l, $Z.value = !0;
2711
+ }, j = Gl({ ...qZ, loading: !0 }), pZ = async (l = {}) => {
2713
2712
  var Z;
2714
- Object.assign(j, rZ, l), await ((Z = iZ.value) == null ? void 0 : Z.setSchema(j.pageSchema));
2715
- }, $Z = (l = {}) => {
2713
+ Object.assign(j, qZ, l), await ((Z = iZ.value) == null ? void 0 : Z.setSchema(j.pageSchema));
2714
+ }, lb = (l = {}) => {
2716
2715
  l.isBlock = !1, pZ(l), al().addHistory(l.pageSchema);
2717
- }, lb = async (l = {}) => {
2716
+ }, Zb = async (l = {}) => {
2718
2717
  l.isBlock = !0, await pZ(l);
2719
2718
  }, wG = (l = "Page", Z = "") => ({
2720
- ...qZ,
2719
+ ..._Z,
2721
2720
  componentName: l,
2722
2721
  fileName: Z
2723
- }), Zb = (l = !1) => {
2722
+ }), bb = (l = !1) => {
2724
2723
  j.isSaved = l;
2725
2724
  }, vG = () => {
2726
2725
  j.properties = null;
2727
2726
  const { fileName: l, componentName: Z } = j.pageSchema || {};
2728
2727
  pZ({
2729
2728
  pageSchema: { ...wG(Z, l) }
2730
- }), Zb(!1);
2731
- }, QG = () => j.isBlock, jG = (l = { ...qZ }, Z) => {
2732
- l.componentName === MG.Block ? lb({
2729
+ }), bb(!1);
2730
+ }, QG = () => j.isBlock, jG = (l = { ..._Z }, Z) => {
2731
+ l.componentName === MG.Block ? Zb({
2733
2732
  pageSchema: l,
2734
2733
  loading: !1
2735
- }) : $Z({
2734
+ }) : lb({
2736
2735
  pageSchema: l,
2737
2736
  currentPage: Z,
2738
2737
  loading: !1
@@ -2749,28 +2748,28 @@ function AG() {
2749
2748
  isSaved: gG,
2750
2749
  isLoading: eG,
2751
2750
  initData: jG,
2752
- setSaved: Zb,
2751
+ setSaved: bb,
2753
2752
  clearCanvas: vG,
2754
2753
  getPageSchema: EG,
2755
- resetPageCanvasState: $Z,
2756
- resetBlockCanvasState: lb,
2754
+ resetPageCanvasState: lb,
2755
+ resetBlockCanvasState: Zb,
2757
2756
  clearCurrentState: DG,
2758
2757
  getCurrentSchema: OG,
2759
2758
  setCurrentSchema: PG,
2760
2759
  getCurrentPage: fG,
2761
2760
  initCanvasApi: tG,
2762
2761
  canvasApi: iZ,
2763
- isCanvasApiReady: _Z
2762
+ isCanvasApiReady: $Z
2764
2763
  };
2765
2764
  }
2766
2765
  const rG = {
2767
- ...AZ,
2766
+ ...rZ,
2768
2767
  entry: BG,
2769
2768
  apis: AG(),
2770
2769
  composable: {
2771
- name: Wb.useCanvas
2770
+ name: Vb.useCanvas
2772
2771
  }
2773
- }, pd = {
2772
+ }, id = {
2774
2773
  ...rG,
2775
2774
  components: {
2776
2775
  CanvasBreadcrumb: vb
@@ -2782,5 +2781,5 @@ export {
2782
2781
  SG as CanvasContainer,
2783
2782
  oG as CanvasLayout,
2784
2783
  rG as DesignCanvas,
2785
- pd as default
2784
+ id as default
2786
2785
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-canvas",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.0-rc.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,19 +36,18 @@
36
36
  "type": "module",
37
37
  "dependencies": {
38
38
  "@babel/core": "7.18.13",
39
- "@opentiny/tiny-engine-builtin-component": "2.0.0-rc.0",
40
- "@opentiny/tiny-engine-common": "2.0.0-rc.0",
41
- "@opentiny/tiny-engine-http": "2.0.0-rc.0",
42
- "@opentiny/tiny-engine-i18n-host": "2.0.0-rc.0",
43
- "@opentiny/tiny-engine-meta-register": "2.0.0-rc.0",
44
- "@opentiny/tiny-engine-utils": "2.0.0-rc.0",
45
- "@opentiny/tiny-engine-webcomponent-core": "2.0.0-rc.0",
39
+ "@opentiny/tiny-engine-builtin-component": "2.0.0-rc.1",
40
+ "@opentiny/tiny-engine-common": "2.0.0-rc.1",
41
+ "@opentiny/tiny-engine-i18n-host": "2.0.0-rc.1",
42
+ "@opentiny/tiny-engine-meta-register": "2.0.0-rc.1",
43
+ "@opentiny/tiny-engine-utils": "2.0.0-rc.1",
44
+ "@opentiny/tiny-engine-webcomponent-core": "2.0.0-rc.1",
46
45
  "@vue/babel-plugin-jsx": "1.1.1",
47
46
  "@vue/shared": "^3.3.4",
48
47
  "@vueuse/core": "^9.6.0"
49
48
  },
50
49
  "devDependencies": {
51
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-rc.0",
50
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-rc.1",
52
51
  "@vitejs/plugin-vue": "^5.1.2",
53
52
  "@vitejs/plugin-vue-jsx": "^4.0.1",
54
53
  "rollup-plugin-polyfill-node": "^0.13.0",
@@ -61,5 +60,5 @@
61
60
  "vue": "^3.4.15",
62
61
  "vue-i18n": "^9.9.0"
63
62
  },
64
- "gitHead": "d158fcd9aa5bbc2aaa7adf40b26a0ed8dcef80f3"
63
+ "gitHead": "ea0440b4ed95feec9a3964dd9095f47edcb30a0b"
65
64
  }