mce 0.13.6 → 0.13.7

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Node as Node$1, Element2D, Timeline, Engine, Camera2D, DrawboardEffect, IN_BROWSER, clamp, assets, TimelineNode, Transform2D, DEG_TO_RAD, render, Animation } from "modern-canvas";
2
- import { ref, computed, watch, markRaw, reactive, warn, shallowRef, onBeforeUnmount, onMounted, inject, provide, defineComponent, createVNode, mergeProps, createElementVNode, toValue, getCurrentInstance, onScopeDispose, createElementBlock, openBlock, Fragment, renderList, unref, normalizeStyle, normalizeClass, readonly, toRef, useId, onDeactivated, onActivated, useAttrs, createBlock, resolveDynamicComponent, useTemplateRef, renderSlot, Teleport, createCommentVNode, mergeModels, useModel, resolveComponent, withCtx, createTextVNode, toDisplayString, createSlots, normalizeProps, guardReactiveProps, onBeforeMount, nextTick, h, withDirectives, vShow, vModelText, withModifiers, isRef } from "vue";
2
+ import { ref, computed, watch, markRaw, reactive, warn, shallowRef, onBeforeUnmount, onMounted, inject, getCurrentInstance, defineComponent, createVNode, mergeProps, createElementVNode, toValue, onScopeDispose, provide, createElementBlock, openBlock, Fragment, renderList, unref, normalizeStyle, normalizeClass, readonly, toRef, useId, onDeactivated, onActivated, useAttrs, createBlock, resolveDynamicComponent, useTemplateRef, renderSlot, Teleport, createCommentVNode, mergeModels, useModel, resolveComponent, withCtx, createTextVNode, toDisplayString, createSlots, normalizeProps, guardReactiveProps, onBeforeMount, nextTick, h, withDirectives, vShow, vModelText, withModifiers, isRef } from "vue";
3
3
  import { useFileDialog, useEventListener, isClient, useResizeObserver as useResizeObserver$1, useLocalStorage, onClickOutside, useMouse, useImage, useDebounceFn } from "@vueuse/core";
4
4
  import { getObjectValueByPath, setObjectValueByPath, Observable, Reactivable, idGenerator, property, normalizeElement, normalizeTextContent, normalizeCRLF, isEqualObject } from "modern-idoc";
5
5
  import { saveAs } from "file-saver";
@@ -902,7 +902,7 @@ const _0_context = defineMixin((editor) => {
902
902
  const nodeIndexMap = reactive(/* @__PURE__ */ new Map());
903
903
  const selection = ref([]);
904
904
  const elementSelection = computed({
905
- get: () => selection.value.filter((v) => v instanceof Element2D),
905
+ get: () => selection.value.filter((v) => isElement(v)),
906
906
  set: (val) => selection.value = val
907
907
  });
908
908
  const textSelection = ref();
@@ -930,6 +930,48 @@ const _0_context = defineMixin((editor) => {
930
930
  y: y - drawboardAabb.value.top
931
931
  }, { x: 0, y: 0 });
932
932
  }
933
+ const block = ["top", "bottom"];
934
+ const inline = ["start", "end", "left", "right"];
935
+ function toPhysical(str, isRtl) {
936
+ if (str === "start")
937
+ return isRtl ? "right" : "left";
938
+ if (str === "end")
939
+ return isRtl ? "left" : "right";
940
+ return str;
941
+ }
942
+ const parseAnchor = (anchor, isRtl) => {
943
+ let [side, align] = anchor.split(" ");
944
+ if (!align) {
945
+ align = block.includes(side) ? "start" : inline.includes(side) ? "top" : "center";
946
+ }
947
+ return {
948
+ side: toPhysical(side, isRtl),
949
+ align: toPhysical(align, isRtl)
950
+ };
951
+ };
952
+ function isRoot(value) {
953
+ return value instanceof Node$1 && root.value.equal(value);
954
+ }
955
+ function isElement(value) {
956
+ return value instanceof Element2D;
957
+ }
958
+ function isFrame(value) {
959
+ return isElement(value) && value.meta.inEditorIs === "Frame";
960
+ }
961
+ function isVisible(node) {
962
+ return isElement(node) && node.style.visibility === "visible";
963
+ }
964
+ function setVisible(node, visible) {
965
+ if (isElement(node)) {
966
+ node.style.visibility = visible ? "visible" : "hidden";
967
+ }
968
+ }
969
+ function isLock(node) {
970
+ return Boolean(node.meta.lock);
971
+ }
972
+ function setLock(node, lock) {
973
+ node.meta.lock = lock;
974
+ }
933
975
  Object.assign(editor, {
934
976
  fonts,
935
977
  renderEngine,
@@ -951,7 +993,15 @@ const _0_context = defineMixin((editor) => {
951
993
  setState,
952
994
  setCursor,
953
995
  drawboardPointer,
954
- getGlobalPointer
996
+ getGlobalPointer,
997
+ parseAnchor,
998
+ isRoot,
999
+ isElement,
1000
+ isFrame,
1001
+ isVisible,
1002
+ setVisible,
1003
+ isLock,
1004
+ setLock
955
1005
  });
956
1006
  return () => {
957
1007
  const {
@@ -1025,63 +1075,6 @@ const _0_font = defineMixin((editor, options) => {
1025
1075
  }
1026
1076
  };
1027
1077
  });
1028
- const _0_helper = defineMixin((editor) => {
1029
- const {
1030
- root
1031
- } = editor;
1032
- const block = ["top", "bottom"];
1033
- const inline = ["start", "end", "left", "right"];
1034
- function toPhysical(str, isRtl) {
1035
- if (str === "start")
1036
- return isRtl ? "right" : "left";
1037
- if (str === "end")
1038
- return isRtl ? "left" : "right";
1039
- return str;
1040
- }
1041
- const parseAnchor = (anchor, isRtl) => {
1042
- let [side, align] = anchor.split(" ");
1043
- if (!align) {
1044
- align = block.includes(side) ? "start" : inline.includes(side) ? "top" : "center";
1045
- }
1046
- return {
1047
- side: toPhysical(side, isRtl),
1048
- align: toPhysical(align, isRtl)
1049
- };
1050
- };
1051
- function isRoot(value) {
1052
- return value instanceof Node$1 && root.value.equal(value);
1053
- }
1054
- function isElement(value) {
1055
- return value instanceof Element2D;
1056
- }
1057
- function isFrame(value) {
1058
- return isElement(value) && value.meta.inEditorIs === "Frame";
1059
- }
1060
- function isVisible(node) {
1061
- return isElement(node) && node.style.visibility === "visible";
1062
- }
1063
- function setVisible(node, visible) {
1064
- if (isElement(node)) {
1065
- node.style.visibility = visible ? "visible" : "hidden";
1066
- }
1067
- }
1068
- function isLock(node) {
1069
- return Boolean(node.meta.lock);
1070
- }
1071
- function setLock(node, lock) {
1072
- node.meta.lock = lock;
1073
- }
1074
- Object.assign(editor, {
1075
- parseAnchor,
1076
- isRoot,
1077
- isElement,
1078
- isFrame,
1079
- isVisible,
1080
- setVisible,
1081
- isLock,
1082
- setLock
1083
- });
1084
- });
1085
1078
  const en = {
1086
1079
  "cancel": "Cancel",
1087
1080
  "constrainToAxis": "Constrain to axis",
@@ -1866,7 +1859,7 @@ const _2_box = defineMixin((editor) => {
1866
1859
  };
1867
1860
  let flag = false;
1868
1861
  element.children.forEach((child) => {
1869
- if (child instanceof Element2D) {
1862
+ if (isElement(child)) {
1870
1863
  const _minmax = child.getAabb().toMinmax();
1871
1864
  minmax.minX = Math.min(minmax.minX, _minmax.minX);
1872
1865
  minmax.minY = Math.min(minmax.minY, _minmax.minY);
@@ -1884,7 +1877,7 @@ const _2_box = defineMixin((editor) => {
1884
1877
  };
1885
1878
  const aabbs = {};
1886
1879
  element.children.forEach((child, index) => {
1887
- if (child instanceof Element2D) {
1880
+ if (isElement(child)) {
1888
1881
  aabbs[index] = child.getGlobalAabb();
1889
1882
  }
1890
1883
  });
@@ -1894,7 +1887,7 @@ const _2_box = defineMixin((editor) => {
1894
1887
  element.style.height = box.height;
1895
1888
  element.updateGlobalTransform();
1896
1889
  element.children.forEach((child, index) => {
1897
- if (child instanceof Element2D) {
1890
+ if (isElement(child)) {
1898
1891
  child.updateGlobalTransform();
1899
1892
  const oldAabb = aabbs[index];
1900
1893
  const localCenter = child.toLocal({
@@ -1949,7 +1942,7 @@ const _2_box = defineMixin((editor) => {
1949
1942
  obb.top -= position.y;
1950
1943
  } else if (inTarget === "frame") {
1951
1944
  const first = Array.isArray(node) ? node[0] : node;
1952
- if (first instanceof Element2D) {
1945
+ if (isElement(first)) {
1953
1946
  const frame = getAncestorFrame(first);
1954
1947
  if (frame) {
1955
1948
  obb.left -= frame.style.left;
@@ -1958,8 +1951,8 @@ const _2_box = defineMixin((editor) => {
1958
1951
  }
1959
1952
  } else if (inTarget === "parent") {
1960
1953
  const first = Array.isArray(node) ? node[0] : node;
1961
- if (first instanceof Element2D) {
1962
- const parent = first.findAncestor((el) => el instanceof Element2D);
1954
+ if (isElement(first)) {
1955
+ const parent = first.findAncestor((el) => isElement(el));
1963
1956
  if (parent) {
1964
1957
  const parentBox = getAabb(parent);
1965
1958
  obb.left -= parentBox.left;
@@ -1969,9 +1962,6 @@ const _2_box = defineMixin((editor) => {
1969
1962
  }
1970
1963
  return obb;
1971
1964
  }
1972
- function getObbInDrawboard(node) {
1973
- return getObb(node, "drawboard");
1974
- }
1975
1965
  function getAabb(node, inTarget) {
1976
1966
  let aabb;
1977
1967
  if (Array.isArray(node) && node.length > 0) {
@@ -1985,7 +1975,7 @@ const _2_box = defineMixin((editor) => {
1985
1975
  maxY: Number.MIN_SAFE_INTEGER
1986
1976
  };
1987
1977
  node.forEach((child) => {
1988
- if (child instanceof Element2D) {
1978
+ if (isElement(child)) {
1989
1979
  const aabb2 = getAabb(child);
1990
1980
  minmax.minX = Math.min(minmax.minX, aabb2.left);
1991
1981
  minmax.minY = Math.min(minmax.minY, aabb2.top);
@@ -2017,7 +2007,7 @@ const _2_box = defineMixin((editor) => {
2017
2007
  aabb = aabbToDrawboardAabb(aabb);
2018
2008
  } else if (inTarget === "frame") {
2019
2009
  const first = Array.isArray(node) ? node[0] : node;
2020
- if (first instanceof Element2D) {
2010
+ if (isElement(first)) {
2021
2011
  const frame = getAncestorFrame(first);
2022
2012
  if (frame) {
2023
2013
  aabb.left -= frame.style.left;
@@ -2026,8 +2016,8 @@ const _2_box = defineMixin((editor) => {
2026
2016
  }
2027
2017
  } else if (inTarget === "parent") {
2028
2018
  const first = Array.isArray(node) ? node[0] : node;
2029
- if (first instanceof Element2D) {
2030
- const parent = first.findAncestor((el) => el instanceof Element2D);
2019
+ if (isElement(first)) {
2020
+ const parent = first.findAncestor((el) => isElement(el));
2031
2021
  if (parent) {
2032
2022
  const parentBox = getAabb(parent);
2033
2023
  aabb.left -= parentBox.left;
@@ -2037,9 +2027,6 @@ const _2_box = defineMixin((editor) => {
2037
2027
  }
2038
2028
  return aabb;
2039
2029
  }
2040
- function getAabbInDrawboard(node) {
2041
- return getAabb(node, "drawboard");
2042
- }
2043
2030
  function aabbToDrawboardAabb(aabb) {
2044
2031
  const _aabb = { ...aabb };
2045
2032
  const zoom = camera.value.zoom;
@@ -2054,15 +2041,19 @@ const _2_box = defineMixin((editor) => {
2054
2041
  }
2055
2042
  const rootAabb = computed(() => getAabb(root.value.children));
2056
2043
  const selectionAabb = computed(() => getAabb(selection.value));
2044
+ const selectionAabbInDrawboard = computed(() => getAabb(selection.value, "drawboard"));
2045
+ const selectionObb = computed(() => getObb(selection.value));
2046
+ const selectionObbInDrawboard = computed(() => getObb(selection.value, "drawboard"));
2057
2047
  Object.assign(editor, {
2058
2048
  obbToFit,
2059
2049
  getObb,
2060
- getObbInDrawboard,
2061
2050
  getAabb,
2062
- getAabbInDrawboard,
2063
2051
  aabbToDrawboardAabb,
2064
2052
  rootAabb,
2065
- selectionAabb
2053
+ selectionAabb,
2054
+ selectionAabbInDrawboard,
2055
+ selectionObb,
2056
+ selectionObbInDrawboard
2066
2057
  });
2067
2058
  });
2068
2059
  const _2_export = defineMixin((editor) => {
@@ -2227,6 +2218,7 @@ const _3_view = defineMixin((editor) => {
2227
2218
  });
2228
2219
  return () => {
2229
2220
  const {
2221
+ isElement,
2230
2222
  root,
2231
2223
  currentFrame,
2232
2224
  on,
@@ -2236,14 +2228,14 @@ const _3_view = defineMixin((editor) => {
2236
2228
  switch (config.value.viewMode) {
2237
2229
  case "frame":
2238
2230
  root.value.children.forEach((child) => {
2239
- if (child instanceof Element2D) {
2231
+ if (isElement(child)) {
2240
2232
  child.visible = child.equal(currentFrame.value);
2241
2233
  }
2242
2234
  });
2243
2235
  break;
2244
2236
  case "edgeless":
2245
2237
  root.value.children.forEach((child) => {
2246
- if (child instanceof Element2D) {
2238
+ if (isElement(child)) {
2247
2239
  child.visible = true;
2248
2240
  }
2249
2241
  });
@@ -2258,6 +2250,7 @@ const _3_view = defineMixin((editor) => {
2258
2250
  });
2259
2251
  const _4_0_text = defineMixin((editor) => {
2260
2252
  const {
2253
+ isElement,
2261
2254
  config,
2262
2255
  elementSelection,
2263
2256
  textSelection
@@ -2319,7 +2312,7 @@ const _4_0_text = defineMixin((editor) => {
2319
2312
  }
2320
2313
  _handle(element2);
2321
2314
  element2.findOne((descendant) => {
2322
- if (descendant instanceof Element2D) {
2315
+ if (isElement(descendant)) {
2323
2316
  _handle(descendant);
2324
2317
  }
2325
2318
  return false;
@@ -2358,7 +2351,7 @@ const _4_0_text = defineMixin((editor) => {
2358
2351
  }
2359
2352
  _handle(element2);
2360
2353
  element2.findOne((descendant) => {
2361
- if (descendant instanceof Element2D) {
2354
+ if (isElement(descendant)) {
2362
2355
  _handle(descendant);
2363
2356
  }
2364
2357
  return false;
@@ -2564,7 +2557,7 @@ const _4_2_element = defineMixin((editor) => {
2564
2557
  root,
2565
2558
  isFrame,
2566
2559
  isLock,
2567
- getObbInDrawboard,
2560
+ getObb,
2568
2561
  config,
2569
2562
  getAncestorFrame,
2570
2563
  getAabb,
@@ -2785,7 +2778,7 @@ const _4_2_element = defineMixin((editor) => {
2785
2778
  }
2786
2779
  return [node];
2787
2780
  }).filter((node) => {
2788
- return "isVisibleInTree" in node && node.isVisibleInTree() && isOverlappingObb(areaInDrawboard, getObbInDrawboard(node)) && !isLock(node);
2781
+ return "isVisibleInTree" in node && node.isVisibleInTree() && isOverlappingObb(areaInDrawboard, getObb(node, "drawboard")) && !isLock(node);
2789
2782
  }) ?? [];
2790
2783
  selection.value = selected;
2791
2784
  return selected;
@@ -3060,6 +3053,7 @@ const _scroll$1 = defineMixin((editor) => {
3060
3053
  });
3061
3054
  const _snapshot = defineMixin((editor) => {
3062
3055
  const {
3056
+ isElement,
3063
3057
  renderEngine,
3064
3058
  frames,
3065
3059
  currentFrameAabb,
@@ -3079,7 +3073,7 @@ const _snapshot = defineMixin((editor) => {
3079
3073
  async function captureElementScreenshot(element) {
3080
3074
  await editor.waitUntilFontLoad();
3081
3075
  let data;
3082
- if (element instanceof Element2D) {
3076
+ if (isElement(element)) {
3083
3077
  data = element.toJSON();
3084
3078
  } else {
3085
3079
  data = { ...element };
@@ -3283,7 +3277,6 @@ const mixins = [
3283
3277
  _0_config_base,
3284
3278
  _0_context,
3285
3279
  _0_font,
3286
- _0_helper,
3287
3280
  _0_locale,
3288
3281
  _1_frame,
3289
3282
  _1_hotkey,
@@ -4265,10 +4258,11 @@ function isLeftTopLine(line) {
4265
4258
  }
4266
4259
  const _auxiliary = definePlugin((editor) => {
4267
4260
  const {
4261
+ isElement,
4268
4262
  currentFrame,
4269
4263
  elementSelection,
4270
4264
  state,
4271
- getObbInDrawboard,
4265
+ getObb,
4272
4266
  root
4273
4267
  } = editor;
4274
4268
  function createBox(node) {
@@ -4281,7 +4275,7 @@ const _auxiliary = definePlugin((editor) => {
4281
4275
  let width;
4282
4276
  if (node.instanceId) {
4283
4277
  box.id = node.instanceId;
4284
- ({ top, left, height, width } = getObbInDrawboard(node));
4278
+ ({ top, left, height, width } = getObb(node, "drawboard"));
4285
4279
  } else {
4286
4280
  box.id = Math.random();
4287
4281
  ({ top, left, height, width } = node);
@@ -4310,7 +4304,7 @@ const _auxiliary = definePlugin((editor) => {
4310
4304
  });
4311
4305
  const parnet = computed(() => {
4312
4306
  const p = elementSelection.value[0].parent;
4313
- return p instanceof Element2D ? p : void 0;
4307
+ return isElement(p) ? p : void 0;
4314
4308
  });
4315
4309
  const parentBox = computed(() => createBox(
4316
4310
  parnet.value ?? { left: 0, top: 0, width: 0, height: 0 }
@@ -5085,9 +5079,11 @@ const _image = definePlugin((editor) => {
5085
5079
  onBefore: (engine) => {
5086
5080
  engine.root.append(
5087
5081
  new DrawboardEffect({
5082
+ ...drawboardEffect.value.getProperties(),
5088
5083
  internalMode: "back",
5089
5084
  effectMode: "before",
5090
- ...drawboardEffect.value.getProperties()
5085
+ checkerboard: false,
5086
+ pixelGrid: false
5091
5087
  })
5092
5088
  );
5093
5089
  }
@@ -5797,6 +5793,7 @@ const _scroll = definePlugin((editor) => {
5797
5793
  });
5798
5794
  const _select = definePlugin((editor) => {
5799
5795
  const {
5796
+ isElement,
5800
5797
  selection,
5801
5798
  root
5802
5799
  } = editor;
@@ -5808,7 +5805,7 @@ const _select = definePlugin((editor) => {
5808
5805
  }
5809
5806
  function selectParent() {
5810
5807
  const parent = selection.value[0]?.parent;
5811
- if (parent instanceof Element2D) {
5808
+ if (isElement(parent)) {
5812
5809
  selection.value = [parent];
5813
5810
  }
5814
5811
  }
@@ -5904,15 +5901,14 @@ const _text = definePlugin((editor) => {
5904
5901
  });
5905
5902
  const _ui = definePlugin((editor) => {
5906
5903
  const {
5907
- selection,
5908
- getAabbInDrawboard,
5904
+ selectionAabbInDrawboard,
5909
5905
  emit
5910
5906
  } = editor;
5911
5907
  return {
5912
5908
  name: "mce:ui",
5913
5909
  setup: () => {
5914
5910
  watch(
5915
- () => getAabbInDrawboard(selection.value),
5911
+ selectionAabbInDrawboard,
5916
5912
  (aabb) => emit("setTransform", { aabb }),
5917
5913
  { deep: true }
5918
5914
  );
@@ -6211,10 +6207,13 @@ function defineMixin(cb) {
6211
6207
  return cb;
6212
6208
  }
6213
6209
  function useEditor() {
6214
- return inject(Editor.injectionKey);
6215
- }
6216
- function provideEditor(editor = new Editor()) {
6217
- provide(Editor.injectionKey, editor);
6210
+ let editor = inject(Editor.injectionKey, null);
6211
+ if (!editor) {
6212
+ const _editor = getCurrentInstance()?.proxy?.editor;
6213
+ if (_editor instanceof Editor) {
6214
+ editor = _editor;
6215
+ }
6216
+ }
6218
6217
  return editor;
6219
6218
  }
6220
6219
  function makeIconProps() {
@@ -6416,7 +6415,7 @@ const defaultActiveStrategy = (context) => {
6416
6415
  const { isRoot, isFrame, isElement, elementSelection } = editor;
6417
6416
  const activeElement = elementSelection.value[0];
6418
6417
  const cb = (node) => {
6419
- if (isElement(node) && (node.equal(activeElement) || node.parent?.equal(activeElement) || node.parent?.equal(activeElement?.parent) || isFrame(node.parent) && isRoot(node.parent.parent) || isRoot(node.parent) && !isFrame(node))) {
6418
+ if (isElement(node) && (node.equal(activeElement) || node.parent?.equal(activeElement) || node.parent?.equal(activeElement?.parent) || isFrame(node.parent) && isRoot(node.parent.parent) || isRoot(node.parent))) {
6420
6419
  return true;
6421
6420
  }
6422
6421
  return false;
@@ -6443,7 +6442,7 @@ const defaultHoverStrategy = (context) => {
6443
6442
  const { isRoot, isFrame, isElement, elementSelection } = editor;
6444
6443
  const activeElement = elementSelection.value[0];
6445
6444
  const cb = (node) => {
6446
- if (isElement(node) && (node.equal(activeElement) || node.parent?.equal(activeElement) || node.parent?.equal(activeElement?.parent) || isFrame(node.parent) && isRoot(node.parent.parent) || isRoot(node.parent) && !isFrame(node))) {
6445
+ if (isElement(node) && (node.equal(activeElement) || node.parent?.equal(activeElement) || node.parent?.equal(activeElement?.parent) || isFrame(node.parent) && isRoot(node.parent.parent) || isRoot(node.parent))) {
6447
6446
  return true;
6448
6447
  }
6449
6448
  return false;
@@ -6454,7 +6453,7 @@ const defaultHoverStrategy = (context) => {
6454
6453
  return element.findAncestor(cb);
6455
6454
  };
6456
6455
  const _hoisted_1$n = { class: "mce-auxiliary" };
6457
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
6456
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6458
6457
  __name: "Auxiliary",
6459
6458
  setup(__props) {
6460
6459
  const { auxiliaryLines } = useEditor();
@@ -6813,7 +6812,7 @@ function createLayout(props) {
6813
6812
  };
6814
6813
  }
6815
6814
  const MceMenuSymbol = Symbol.for("MceMenuSymbol");
6816
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
6815
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
6817
6816
  __name: "Icon",
6818
6817
  props: {
6819
6818
  disabled: Boolean,
@@ -6838,7 +6837,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6838
6837
  };
6839
6838
  }
6840
6839
  });
6841
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
6840
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6842
6841
  ...{
6843
6842
  inheritAttrs: false
6844
6843
  },
@@ -6962,7 +6961,7 @@ const _hoisted_5$3 = {
6962
6961
  key: 1,
6963
6962
  class: "mce-list-item__append"
6964
6963
  };
6965
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
6964
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
6966
6965
  ...{
6967
6966
  name: "MceMenu"
6968
6967
  },
@@ -7041,7 +7040,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
7041
7040
  });
7042
7041
  return (_ctx, _cache) => {
7043
7042
  const _component_MceMenu = resolveComponent("MceMenu");
7044
- return openBlock(), createBlock(_sfc_main$B, {
7043
+ return openBlock(), createBlock(_sfc_main$A, {
7045
7044
  ref: "overlayTpl",
7046
7045
  modelValue: isActive.value,
7047
7046
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isActive.value = $event),
@@ -7085,7 +7084,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
7085
7084
  onClick: (e) => onClickItem(item, index, e)
7086
7085
  }, [
7087
7086
  hasPrepend.value ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
7088
- item.checked ? (openBlock(), createBlock(_sfc_main$C, {
7087
+ item.checked ? (openBlock(), createBlock(_sfc_main$B, {
7089
7088
  key: 0,
7090
7089
  icon: "$check"
7091
7090
  })) : createCommentVNode("", true)
@@ -7096,7 +7095,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
7096
7095
  ])
7097
7096
  ]),
7098
7097
  item.children?.length ? (openBlock(), createElementBlock("div", _hoisted_5$3, [
7099
- createVNode(_sfc_main$C, { icon: "$arrowRight" })
7098
+ createVNode(_sfc_main$B, { icon: "$arrowRight" })
7100
7099
  ])) : createCommentVNode("", true)
7101
7100
  ], 10, _hoisted_2$a)
7102
7101
  ], 40, _hoisted_1$m))
@@ -7134,7 +7133,7 @@ const _hoisted_2$9 = {
7134
7133
  key: 0,
7135
7134
  class: "mce-context-menu__kbd"
7136
7135
  };
7137
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
7136
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7138
7137
  __name: "ContextMenu",
7139
7138
  props: {
7140
7139
  "modelValue": { type: Boolean },
@@ -7192,7 +7191,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
7192
7191
  updateLocation
7193
7192
  });
7194
7193
  return (_ctx, _cache) => {
7195
- return openBlock(), createBlock(_sfc_main$A, {
7194
+ return openBlock(), createBlock(_sfc_main$z, {
7196
7195
  ref: "menuTplRef",
7197
7196
  modelValue: model.value,
7198
7197
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
@@ -7219,7 +7218,7 @@ const _hoisted_1$k = {
7219
7218
  key: 0,
7220
7219
  class: "mce-drawing__content"
7221
7220
  };
7222
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
7221
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7223
7222
  __name: "Drawing",
7224
7223
  setup(__props) {
7225
7224
  const {
@@ -7254,7 +7253,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7254
7253
  };
7255
7254
  }
7256
7255
  });
7257
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
7256
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7258
7257
  __name: "Floatbar",
7259
7258
  props: {
7260
7259
  ...makeMceOverlayProps({
@@ -7265,27 +7264,46 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7265
7264
  setup(__props, { expose: __expose }) {
7266
7265
  const props = __props;
7267
7266
  const {
7268
- getAabbInDrawboard,
7269
7267
  selection,
7268
+ selectionAabbInDrawboard,
7270
7269
  isFrame
7271
7270
  } = useEditor();
7272
7271
  const overlay = useTemplateRef("overlayTpl");
7272
+ const style = computed(() => {
7273
+ const location = props.location;
7274
+ const aabb = selectionAabbInDrawboard.value;
7275
+ if (location?.startsWith("top") || location?.startsWith("bottom")) {
7276
+ return {
7277
+ width: `${aabb.width}px`
7278
+ };
7279
+ } else if (location?.startsWith("left") || location?.startsWith("right")) {
7280
+ return {
7281
+ height: `${aabb.height}px`
7282
+ };
7283
+ }
7284
+ return {};
7285
+ });
7286
+ const offset2 = computed(() => {
7287
+ if (selection.value.some((v) => isFrame(v)) || props.location?.startsWith("bottom")) {
7288
+ return 32;
7289
+ }
7290
+ return 8;
7291
+ });
7273
7292
  function updateLocation() {
7274
7293
  overlay.value?.updateLocation();
7275
7294
  }
7276
- watch(() => getAabbInDrawboard(selection.value), updateLocation, {
7277
- deep: true
7278
- });
7295
+ watch(selectionAabbInDrawboard, updateLocation, { deep: true });
7279
7296
  __expose({
7280
7297
  updateLocation
7281
7298
  });
7282
7299
  return (_ctx, _cache) => {
7283
- return openBlock(), createBlock(_sfc_main$B, {
7300
+ return openBlock(), createBlock(_sfc_main$A, {
7284
7301
  ref: "overlayTpl",
7302
+ style: normalizeStyle(style.value),
7285
7303
  class: "mce-floatbar",
7286
7304
  location: props.location,
7287
7305
  middlewares: props.middlewares,
7288
- offset: unref(selection)[0] && unref(isFrame)(unref(selection)[0]) ? 32 : 8,
7306
+ offset: offset2.value,
7289
7307
  target: props.target,
7290
7308
  attach: false,
7291
7309
  "model-value": true
@@ -7294,7 +7312,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7294
7312
  unref(selection).length > 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
7295
7313
  ]),
7296
7314
  _: 3
7297
- }, 8, ["location", "middlewares", "offset", "target"]);
7315
+ }, 8, ["style", "location", "middlewares", "offset", "target"]);
7298
7316
  };
7299
7317
  }
7300
7318
  });
@@ -7312,7 +7330,7 @@ const _hoisted_8$1 = {
7312
7330
  key: 0,
7313
7331
  class: "mce-transformable__tip"
7314
7332
  };
7315
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
7333
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
7316
7334
  __name: "Transformable",
7317
7335
  props: {
7318
7336
  tag: { default: "div" },
@@ -7450,12 +7468,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7450
7468
  y: center.y - item.y > 0 ? 1 : -1
7451
7469
  };
7452
7470
  const offset2 = minSize * 0.1;
7471
+ const ws = (borderRadius + offset2) / (width / 2 + offset2);
7472
+ const hs = (borderRadius + offset2) / (height / 2 + offset2);
7453
7473
  return {
7454
7474
  ...item,
7455
7475
  shape: "circle",
7456
7476
  type: `border-radius-${item.type}`,
7457
- x: item.x + sign.x * Math.min(width / 2, offset2 + borderRadius),
7458
- y: item.y + sign.y * Math.min(height / 2, offset2 + borderRadius)
7477
+ x: item.x + sign.x * width / 2 * ws,
7478
+ y: item.y + sign.y * height / 2 * hs
7459
7479
  };
7460
7480
  }) : [];
7461
7481
  let handles;
@@ -7596,11 +7616,10 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7596
7616
  }
7597
7617
  } else if (isBorderRadius) {
7598
7618
  const offset2 = rotatePoint(rotatedOffset, { x: 0, y: 0 }, -rotate);
7599
- const _offset = Math.abs(offset2.x) < Math.abs(offset2.y) ? -sign.x * offset2.x : -sign.y * offset2.y * aspectRatio;
7600
- updated.borderRadius = Math.min(
7601
- Math.max(0, borderRadius + _offset),
7602
- Math.min(width / 2, height / 2)
7603
- );
7619
+ const dx = -sign.x * offset2.x;
7620
+ const dy = -sign.y * offset2.y;
7621
+ const _offset = Math.abs(dx) < Math.abs(dy) ? dy : dx;
7622
+ updated.borderRadius = borderRadius + _offset;
7604
7623
  } else if (isHorizontalVertical) {
7605
7624
  const currentPoint = rotatePoint(rotatedCurrentPoint, centerPoint, -rotate);
7606
7625
  const newCurrentPoint = isHorizontal ? { x: currentPoint.x, y: startPoint.y } : { x: startPoint.x, y: currentPoint.y };
@@ -7628,7 +7647,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7628
7647
  let newRotatedCurrentPoint;
7629
7648
  if ((props.resizeStrategy === "lockAspectRatio" || props.resizeStrategy === "lockAspectRatioDiagonal") && aspectRatio) {
7630
7649
  const offset2 = rotatePoint(rotatedOffset, { x: 0, y: 0 }, -rotate);
7631
- const _offset = Math.abs(offset2.x) < Math.abs(offset2.y) ? sign.x * offset2.x : sign.y * offset2.y * aspectRatio;
7650
+ const dx = sign.x * offset2.x;
7651
+ const dy = sign.y * offset2.y * aspectRatio;
7652
+ const _offset = Math.abs(dx) < Math.abs(dy) ? dx : dy;
7632
7653
  newRotatedCurrentPoint = rotatePoint(
7633
7654
  {
7634
7655
  x: startPoint.x + sign.x * _offset,
@@ -7655,6 +7676,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7655
7676
  if ("width" in updated && updated.width <= 0 || "height" in updated && updated.height <= 0) {
7656
7677
  return;
7657
7678
  }
7679
+ if (updated.borderRadius ?? borderRadius) {
7680
+ updated.borderRadius = Math.min(
7681
+ Math.max(0, updated.borderRadius ?? borderRadius),
7682
+ Math.min((updated.width ?? width) / 2, (updated.height ?? height) / 2)
7683
+ );
7684
+ }
7658
7685
  const oldValue = { ...model.value };
7659
7686
  const newValue = { ...model.value, ...updated };
7660
7687
  model.value = newValue;
@@ -7681,11 +7708,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7681
7708
  return `<svg height="32" width="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><defs><filter id="shadow" color-interpolation-filters="sRGB"><feDropShadow dx="1" dy="1" stdDeviation="1.2" flood-opacity=".5"/></filter></defs><g fill="none" transform="rotate(${angle} 16 16)" filter="url(%23shadow)">${path}</g></svg>`.replace(/"/g, "'");
7682
7709
  }
7683
7710
  function getCursor(type) {
7684
- if (type === "move")
7711
+ if (type === "move") {
7685
7712
  return "move";
7713
+ }
7686
7714
  const create = cursors[type];
7687
7715
  if (!create) {
7688
- return "default";
7716
+ return void 0;
7689
7717
  }
7690
7718
  return `url("data:image/svg+xml,${create(model.value.rotate ?? 0)}") 16 16, pointer`;
7691
7719
  }
@@ -7872,7 +7900,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7872
7900
  }
7873
7901
  });
7874
7902
  const _hoisted_1$i = { class: "mce-cropper" };
7875
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
7903
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
7876
7904
  __name: "Cropper",
7877
7905
  props: /* @__PURE__ */ mergeModels({
7878
7906
  image: {},
@@ -8020,7 +8048,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
8020
8048
  ref: canvasRef
8021
8049
  }, null, 512)
8022
8050
  ], 4),
8023
- createVNode(_sfc_main$w, {
8051
+ createVNode(_sfc_main$v, {
8024
8052
  modelValue: sourceTransform.value,
8025
8053
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
8026
8054
  class: "mce-cropper__transformable",
@@ -8043,7 +8071,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
8043
8071
  };
8044
8072
  }
8045
8073
  });
8046
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
8074
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8047
8075
  __name: "ForegroundCropper",
8048
8076
  setup(__props) {
8049
8077
  const {
@@ -8053,7 +8081,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
8053
8081
  } = useEditor();
8054
8082
  const element = computed(() => elementSelection.value[0]);
8055
8083
  return (_ctx, _cache) => {
8056
- return unref(state) === "cropping" && element.value?.foreground.isValid() ? (openBlock(), createBlock(_sfc_main$v, {
8084
+ return unref(state) === "cropping" && element.value?.foreground.isValid() ? (openBlock(), createBlock(_sfc_main$u, {
8057
8085
  key: 0,
8058
8086
  modelValue: element.value.foreground.cropRect,
8059
8087
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => element.value.foreground.cropRect = $event),
@@ -8066,7 +8094,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
8066
8094
  };
8067
8095
  }
8068
8096
  });
8069
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
8097
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
8070
8098
  __name: "Frame",
8071
8099
  props: {
8072
8100
  "modelValue": { required: true },
@@ -8077,7 +8105,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8077
8105
  const frame = useModel(__props, "modelValue");
8078
8106
  const input = useTemplateRef("inputTpl");
8079
8107
  const {
8080
- getObbInDrawboard,
8108
+ getObb,
8081
8109
  hoverElement,
8082
8110
  selection,
8083
8111
  state,
@@ -8102,9 +8130,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8102
8130
  }
8103
8131
  return (_ctx, _cache) => {
8104
8132
  return withDirectives((openBlock(), createElementBlock("div", {
8105
- style: normalizeStyle(unref(boundingBoxToStyle)(unref(getObbInDrawboard)(frame.value))),
8133
+ style: normalizeStyle(unref(boundingBoxToStyle)(unref(getObb)(frame.value, "drawboard"))),
8106
8134
  class: normalizeClass(["mce-frame", [
8107
- unref(config).frameOutline && "mce-frame--outline"
8135
+ unref(config).frameOutline && "mce-frame--outline",
8136
+ unref(hoverElement)?.equal(frame.value) && "mce-frame--hover",
8137
+ unref(selection).some((v) => v.equal(frame.value)) && "mce-frame--selected"
8108
8138
  ]])
8109
8139
  }, [
8110
8140
  withDirectives(createElementVNode("div", {
@@ -8132,7 +8162,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8132
8162
  };
8133
8163
  }
8134
8164
  });
8135
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
8165
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
8136
8166
  __name: "Frames",
8137
8167
  setup(__props) {
8138
8168
  const {
@@ -8140,7 +8170,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
8140
8170
  } = useEditor();
8141
8171
  return (_ctx, _cache) => {
8142
8172
  return openBlock(true), createElementBlock(Fragment, null, renderList(unref(frames), (frame, key) => {
8143
- return openBlock(), createBlock(_sfc_main$t, {
8173
+ return openBlock(), createBlock(_sfc_main$s, {
8144
8174
  key,
8145
8175
  "model-value": frame
8146
8176
  }, null, 8, ["model-value"]);
@@ -8148,7 +8178,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
8148
8178
  };
8149
8179
  }
8150
8180
  });
8151
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
8181
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
8152
8182
  __name: "GoBackSelectedArea",
8153
8183
  setup(__props) {
8154
8184
  const {
@@ -8170,22 +8200,23 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
8170
8200
  class: "mce-back-selected-aera",
8171
8201
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
8172
8202
  }, [
8173
- createVNode(_sfc_main$C, { icon: "$gps" }),
8203
+ createVNode(_sfc_main$B, { icon: "$gps" }),
8174
8204
  createElementVNode("span", null, toDisplayString(unref(t)("goBackSelectedArea")), 1)
8175
8205
  ])) : createCommentVNode("", true);
8176
8206
  };
8177
8207
  }
8178
8208
  });
8179
8209
  const _hoisted_1$h = ["data-name"];
8180
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
8210
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
8181
8211
  __name: "Hover",
8182
8212
  setup(__props) {
8183
8213
  const {
8184
8214
  selection,
8185
8215
  hoverElement,
8186
- getObbInDrawboard
8216
+ getObb,
8217
+ camera
8187
8218
  } = useEditor();
8188
- const hoverElementObb = computed(() => getObbInDrawboard(hoverElement.value));
8219
+ const hoverElementObb = computed(() => getObb(hoverElement.value, "drawboard"));
8189
8220
  return (_ctx, _cache) => {
8190
8221
  return unref(hoverElement) && !unref(hoverElement).equal(unref(selection)[0]) ? (openBlock(), createElementBlock("div", {
8191
8222
  key: 0,
@@ -8193,6 +8224,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
8193
8224
  "data-name": unref(hoverElement).name,
8194
8225
  style: normalizeStyle({
8195
8226
  borderColor: "currentcolor",
8227
+ borderRadius: `${(unref(hoverElement).style.borderRadius ?? 0) * unref(camera).zoom.x}px`,
8196
8228
  ...unref(boundingBoxToStyle)(hoverElementObb.value)
8197
8229
  })
8198
8230
  }, null, 12, _hoisted_1$h)) : createCommentVNode("", true);
@@ -8200,7 +8232,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
8200
8232
  }
8201
8233
  });
8202
8234
  const _hoisted_1$g = { class: "mce-btn" };
8203
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
8235
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8204
8236
  __name: "Btn",
8205
8237
  setup(__props) {
8206
8238
  return (_ctx, _cache) => {
@@ -8212,7 +8244,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
8212
8244
  });
8213
8245
  const _hoisted_1$f = { class: "mce-layer__name" };
8214
8246
  const _hoisted_2$7 = { class: "mce-layer__action" };
8215
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
8247
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8216
8248
  ...{
8217
8249
  name: "MceLayer",
8218
8250
  inheritAttrs: false
@@ -8359,7 +8391,11 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8359
8391
  editing.value = true;
8360
8392
  editValue.value = props.node.name;
8361
8393
  nextTick().then(() => {
8362
- inputDom.value?.focus();
8394
+ const dom2 = inputDom.value;
8395
+ if (dom2) {
8396
+ dom2.focus();
8397
+ dom2.select();
8398
+ }
8363
8399
  });
8364
8400
  }
8365
8401
  function onMouseenter() {
@@ -8381,7 +8417,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8381
8417
  }
8382
8418
  }
8383
8419
  function onInputBlur() {
8384
- console.log("onInputBlur");
8385
8420
  editing.value = false;
8386
8421
  if (editValue.value) {
8387
8422
  props.node.name = editValue.value;
@@ -8414,7 +8449,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8414
8449
  class: "mce-layer__expand",
8415
8450
  onClick: onClickExpand
8416
8451
  }, [
8417
- props.node.children.length ? (openBlock(), createBlock(_sfc_main$C, {
8452
+ props.node.children.length ? (openBlock(), createBlock(_sfc_main$B, {
8418
8453
  key: 0,
8419
8454
  icon: "$arrowRight"
8420
8455
  })) : createCommentVNode("", true)
@@ -8428,7 +8463,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8428
8463
  class: "mce-layer__thumbnail",
8429
8464
  onDblclick: onDblclickThumbnail
8430
8465
  }, [
8431
- createVNode(_sfc_main$C, { icon: thumbnailIcon.value }, null, 8, ["icon"])
8466
+ createVNode(_sfc_main$B, { icon: thumbnailIcon.value }, null, 8, ["icon"])
8432
8467
  ], 32),
8433
8468
  createElementVNode("div", _hoisted_1$f, [
8434
8469
  withDirectives(createElementVNode("input", {
@@ -8455,31 +8490,31 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8455
8490
  }]),
8456
8491
  onClick: _cache[1] || (_cache[1] = ($event) => unref(setLock)(props.node, !unref(isLock)(props.node)))
8457
8492
  }, [
8458
- createVNode(_sfc_main$C, {
8493
+ createVNode(_sfc_main$B, {
8459
8494
  icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
8460
8495
  }, null, 8, ["icon"])
8461
8496
  ], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
8462
- createVNode(_sfc_main$p, {
8497
+ createVNode(_sfc_main$o, {
8463
8498
  class: normalizeClass({
8464
8499
  "mce-btn--hide": !hovering.value && !unref(isLock)(props.node)
8465
8500
  }),
8466
8501
  onClick: _cache[2] || (_cache[2] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
8467
8502
  }, {
8468
8503
  default: withCtx(() => [
8469
- createVNode(_sfc_main$C, {
8504
+ createVNode(_sfc_main$B, {
8470
8505
  icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
8471
8506
  }, null, 8, ["icon"])
8472
8507
  ]),
8473
8508
  _: 1
8474
8509
  }, 8, ["class"]),
8475
- createVNode(_sfc_main$p, {
8510
+ createVNode(_sfc_main$o, {
8476
8511
  class: normalizeClass({
8477
8512
  "mce-btn--hide": !hovering.value && unref(isVisible)(props.node)
8478
8513
  }),
8479
8514
  onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
8480
8515
  }, {
8481
8516
  default: withCtx(() => [
8482
- createVNode(_sfc_main$C, {
8517
+ createVNode(_sfc_main$B, {
8483
8518
  icon: unref(isVisible)(props.node) ? "$visible" : "$unvisible"
8484
8519
  }, null, 8, ["icon"])
8485
8520
  ]),
@@ -8503,7 +8538,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8503
8538
  });
8504
8539
  const _hoisted_1$e = { class: "mce-layers" };
8505
8540
  const _hoisted_2$6 = { class: "mce-layers__wrapper" };
8506
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
8541
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8507
8542
  __name: "Layers",
8508
8543
  setup(__props) {
8509
8544
  const {
@@ -8553,7 +8588,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8553
8588
  return (_ctx, _cache) => {
8554
8589
  return openBlock(), createElementBlock("div", _hoisted_1$e, [
8555
8590
  createElementVNode("div", _hoisted_2$6, [
8556
- createVNode(_sfc_main$o, {
8591
+ createVNode(_sfc_main$n, {
8557
8592
  root: true,
8558
8593
  node: unref(root),
8559
8594
  opened: true
@@ -8570,7 +8605,7 @@ const _export_sfc = (sfc, props) => {
8570
8605
  }
8571
8606
  return target;
8572
8607
  };
8573
- const _sfc_main$m = {};
8608
+ const _sfc_main$l = {};
8574
8609
  const _hoisted_1$d = {
8575
8610
  class: "mce-made-with",
8576
8611
  href: "https://github.com/qq15725/mce",
@@ -8582,8 +8617,8 @@ function _sfc_render$1(_ctx, _cache) {
8582
8617
  createElementVNode("div", null, "MCE", -1)
8583
8618
  ])]);
8584
8619
  }
8585
- const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$1]]);
8586
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
8620
+ const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$1]]);
8621
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8587
8622
  __name: "Tooltip",
8588
8623
  props: /* @__PURE__ */ mergeModels({
8589
8624
  ...makeMceOverlayProps({
@@ -8606,7 +8641,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8606
8641
  updateLocation
8607
8642
  });
8608
8643
  return (_ctx, _cache) => {
8609
- return openBlock(), createBlock(_sfc_main$B, {
8644
+ return openBlock(), createBlock(_sfc_main$A, {
8610
8645
  ref: "overlayTpl",
8611
8646
  modelValue: isActive.value,
8612
8647
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -8635,7 +8670,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8635
8670
  const _hoisted_1$c = ["width", "height"];
8636
8671
  const _hoisted_2$5 = ["onDblclick", "onMousedown", "onMousemove"];
8637
8672
  const _hoisted_3$5 = { style: { "font-size": "12px", "text-wrap": "nowrap" } };
8638
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
8673
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
8639
8674
  ...{
8640
8675
  inheritAttrs: false
8641
8676
  },
@@ -8915,7 +8950,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8915
8950
  onMouseleave: onLeave
8916
8951
  }, null, 46, _hoisted_2$5);
8917
8952
  }), 128)),
8918
- createVNode(_sfc_main$l, {
8953
+ createVNode(_sfc_main$k, {
8919
8954
  "model-value": !!tipText.value,
8920
8955
  target: tipPos.value,
8921
8956
  offset: 24
@@ -8930,7 +8965,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8930
8965
  }
8931
8966
  });
8932
8967
  const _hoisted_1$b = { class: "mce-rulers" };
8933
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
8968
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8934
8969
  ...{
8935
8970
  inheritAttrs: false
8936
8971
  },
@@ -8938,25 +8973,23 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
8938
8973
  setup(__props) {
8939
8974
  const {
8940
8975
  camera,
8941
- getAabbInDrawboard,
8942
- selection
8976
+ selectionAabbInDrawboard
8943
8977
  } = useEditor();
8944
- const activeAabb = computed(() => getAabbInDrawboard(selection.value));
8945
8978
  return (_ctx, _cache) => {
8946
8979
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
8947
- createVNode(_sfc_main$k, {
8980
+ createVNode(_sfc_main$j, {
8948
8981
  refline: "",
8949
8982
  zoom: unref(camera).zoom.x,
8950
8983
  position: unref(camera).position.x,
8951
- selected: activeAabb.value,
8984
+ selected: unref(selectionAabbInDrawboard),
8952
8985
  axis: "",
8953
8986
  size: 16
8954
8987
  }, null, 8, ["zoom", "position", "selected"]),
8955
- createVNode(_sfc_main$k, {
8988
+ createVNode(_sfc_main$j, {
8956
8989
  refline: "",
8957
8990
  zoom: unref(camera).zoom.y,
8958
8991
  position: unref(camera).position.y,
8959
- selected: activeAabb.value,
8992
+ selected: unref(selectionAabbInDrawboard),
8960
8993
  axis: "",
8961
8994
  vertical: "",
8962
8995
  size: 16
@@ -8970,7 +9003,7 @@ const _hoisted_1$a = {
8970
9003
  ref: "trackTplRef",
8971
9004
  class: "mce-scrollbar__track"
8972
9005
  };
8973
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
9006
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
8974
9007
  __name: "Scrollbar",
8975
9008
  props: /* @__PURE__ */ mergeModels({
8976
9009
  length: {},
@@ -9077,7 +9110,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
9077
9110
  };
9078
9111
  }
9079
9112
  });
9080
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
9113
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9081
9114
  ...{
9082
9115
  inheritAttrs: false
9083
9116
  },
@@ -9095,13 +9128,13 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
9095
9128
  } = useEditor();
9096
9129
  return (_ctx, _cache) => {
9097
9130
  return openBlock(), createElementBlock(Fragment, null, [
9098
- createVNode(_sfc_main$i, mergeProps(props, {
9131
+ createVNode(_sfc_main$h, mergeProps(props, {
9099
9132
  modelValue: unref(camera).position.y,
9100
9133
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(camera).position.y = $event),
9101
9134
  vertical: "",
9102
9135
  length: unref(viewAabb).height * unref(camera).zoom.y
9103
9136
  }), null, 16, ["modelValue", "length"]),
9104
- createVNode(_sfc_main$i, mergeProps(props, {
9137
+ createVNode(_sfc_main$h, mergeProps(props, {
9105
9138
  modelValue: unref(camera).position.x,
9106
9139
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(camera).position.x = $event),
9107
9140
  length: unref(viewAabb).width * unref(camera).zoom.x
@@ -9110,7 +9143,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
9110
9143
  };
9111
9144
  }
9112
9145
  });
9113
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
9146
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
9114
9147
  ...{
9115
9148
  inheritAttrs: false
9116
9149
  },
@@ -9122,12 +9155,14 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9122
9155
  setup(__props, { expose: __expose }) {
9123
9156
  const props = __props;
9124
9157
  const {
9158
+ isElement,
9125
9159
  state,
9126
9160
  resizeElement,
9127
9161
  elementSelection,
9162
+ selectionObb,
9163
+ selectionObbInDrawboard,
9128
9164
  camera,
9129
9165
  obbToFit,
9130
- getObbInDrawboard,
9131
9166
  getObb,
9132
9167
  registerCommand,
9133
9168
  unregisterCommand,
@@ -9148,8 +9183,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9148
9183
  }
9149
9184
  const obbs = [];
9150
9185
  elementSelection.value[0]?.findAncestor((ancestor) => {
9151
- if (ancestor instanceof Element2D) {
9152
- obbs.push(getObbInDrawboard(ancestor));
9186
+ if (isElement(ancestor)) {
9187
+ obbs.push(getObb(ancestor, "drawboard"));
9153
9188
  }
9154
9189
  return false;
9155
9190
  });
@@ -9161,15 +9196,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9161
9196
  }
9162
9197
  return elementSelection.value.map((el) => {
9163
9198
  return {
9164
- name: el.name,
9165
- box: getObbInDrawboard(el)
9199
+ element: el,
9200
+ box: getObb(el, "drawboard")
9166
9201
  };
9167
9202
  });
9168
9203
  });
9169
9204
  const _selectionTransform = computed(() => {
9170
9205
  const zoom = camera.value.zoom;
9171
9206
  return {
9172
- ...getObbInDrawboard(elementSelection.value),
9207
+ ...selectionObbInDrawboard.value,
9173
9208
  borderRadius: (elementSelection.value[0]?.style.borderRadius ?? 0) * zoom.x
9174
9209
  };
9175
9210
  });
@@ -9210,7 +9245,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9210
9245
  Object.assign(style, newStyle);
9211
9246
  element.updateGlobalTransform();
9212
9247
  element.findAncestor((ancestor) => {
9213
- if (ancestor instanceof Element2D && !isFrame(ancestor)) {
9248
+ if (isElement(ancestor) && !isFrame(ancestor)) {
9214
9249
  obbToFit(ancestor);
9215
9250
  }
9216
9251
  return false;
@@ -9238,7 +9273,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9238
9273
  return elementSelection.value.length === 1 && !isLock(element) && element.foreground.isValid();
9239
9274
  });
9240
9275
  function tipFormat() {
9241
- const obb = elementSelection.value.length === 1 ? elementSelection.value[0].style : getObb(elementSelection.value);
9276
+ const obb = elementSelection.value.length === 1 ? elementSelection.value[0].style : selectionObb.value;
9242
9277
  return `${Number(obb.width.toFixed(2))} × ${Number(obb.height.toFixed(2))}`;
9243
9278
  }
9244
9279
  __expose({
@@ -9249,7 +9284,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9249
9284
  (openBlock(true), createElementBlock(Fragment, null, renderList(parentObbs.value, (obb, index) => {
9250
9285
  return openBlock(), createElementBlock("div", {
9251
9286
  key: index,
9252
- class: "mce-parent-element-obb",
9287
+ class: "mce-selector__parent-element",
9253
9288
  style: normalizeStyle({
9254
9289
  borderColor: "currentColor",
9255
9290
  ...unref(boundingBoxToStyle)(obb)
@@ -9258,7 +9293,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9258
9293
  }), 128)),
9259
9294
  unref(state) === "selecting" ? (openBlock(), createElementBlock("div", {
9260
9295
  key: 0,
9261
- class: "mce-selected-area",
9296
+ class: "mce-selector__selected-area",
9262
9297
  style: normalizeStyle({
9263
9298
  borderColor: "currentcolor",
9264
9299
  ...unref(boundingBoxToStyle)(props.selectedArea)
@@ -9267,14 +9302,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9267
9302
  (openBlock(true), createElementBlock(Fragment, null, renderList(selectionObbs.value, (item, index) => {
9268
9303
  return openBlock(), createElementBlock("div", {
9269
9304
  key: index,
9270
- class: "mce-element-obb",
9305
+ class: "mce-selector__element",
9271
9306
  style: normalizeStyle({
9272
9307
  borderColor: "currentcolor",
9308
+ borderRadius: `${(item.element.style.borderRadius ?? 0) * unref(camera).zoom.x}px`,
9273
9309
  ...unref(boundingBoxToStyle)(item.box)
9274
9310
  })
9275
9311
  }, null, 4);
9276
9312
  }), 128)),
9277
- selectionTransform.value.width && selectionTransform.value.height ? (openBlock(), createBlock(_sfc_main$w, {
9313
+ selectionTransform.value.width && selectionTransform.value.height ? (openBlock(), createBlock(_sfc_main$v, {
9278
9314
  key: 1,
9279
9315
  ref: "transformableRef",
9280
9316
  modelValue: selectionTransform.value,
@@ -9285,7 +9321,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9285
9321
  "adjustable-border-radius": adjustableBorderRadius.value,
9286
9322
  "resize-strategy": props.resizeStrategy,
9287
9323
  "handle-shape": unref(config).handleShape,
9288
- class: "mce-selection-obb",
9324
+ class: "mce-selector__transform",
9289
9325
  "border-style": unref(elementSelection).length > 1 ? "dashed" : "solid",
9290
9326
  "tip-format": tipFormat,
9291
9327
  onMove: _cache[1] || (_cache[1] = () => !unref(state) && (state.value = "transforming")),
@@ -9301,7 +9337,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9301
9337
  ]), 1032, ["modelValue", "movable", "resizable", "rotatable", "adjustable-border-radius", "resize-strategy", "handle-shape", "border-style"])) : createCommentVNode("", true),
9302
9338
  selectionTransform.value.width && selectionTransform.value.height && _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
9303
9339
  key: 2,
9304
- style: normalizeStyle([{ "position": "absolute" }, unref(boundingBoxToStyle)(selectionTransform.value)])
9340
+ class: "mce-selector__slot",
9341
+ style: normalizeStyle(unref(boundingBoxToStyle)(selectionTransform.value))
9305
9342
  }, [
9306
9343
  renderSlot(_ctx.$slots, "default", { box: selectionTransform.value })
9307
9344
  ], 4)) : createCommentVNode("", true)
@@ -9309,15 +9346,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9309
9346
  };
9310
9347
  }
9311
9348
  });
9312
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
9313
- __name: "Setup",
9314
- setup(__props) {
9315
- useEditor().setup();
9316
- return (_ctx, _cache) => {
9317
- return null;
9318
- };
9319
- }
9320
- });
9321
9349
  const _hoisted_1$9 = {
9322
9350
  key: 0,
9323
9351
  class: "mce-float-panel__title"
@@ -9343,7 +9371,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
9343
9371
  ...props.defaultTransform
9344
9372
  });
9345
9373
  return (_ctx, _cache) => {
9346
- return openBlock(), createBlock(_sfc_main$w, {
9374
+ return openBlock(), createBlock(_sfc_main$v, {
9347
9375
  modelValue: transform.value,
9348
9376
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => transform.value = $event),
9349
9377
  class: "mce-float-panel",
@@ -9355,11 +9383,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
9355
9383
  createElementVNode("div", mergeProps({ class: "mce-float-panel__card" }, slotProps), [
9356
9384
  __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
9357
9385
  createElementVNode("div", null, toDisplayString(__props.title), 1),
9358
- createVNode(_sfc_main$p, {
9386
+ createVNode(_sfc_main$o, {
9359
9387
  onClick: _cache[0] || (_cache[0] = ($event) => isActive.value = false)
9360
9388
  }, {
9361
9389
  default: withCtx(() => [
9362
- createVNode(_sfc_main$C, { icon: "$close" })
9390
+ createVNode(_sfc_main$B, { icon: "$close" })
9363
9391
  ]),
9364
9392
  _: 1
9365
9393
  })
@@ -9556,7 +9584,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9556
9584
  ])
9557
9585
  ], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
9558
9586
  createElementVNode("div", _hoisted_8, [
9559
- createVNode(_sfc_main$C, { icon: "$mouseRightClick" })
9587
+ createVNode(_sfc_main$B, { icon: "$mouseRightClick" })
9560
9588
  ]),
9561
9589
  _cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
9562
9590
  createElementVNode("div", _hoisted_9, [
@@ -9570,7 +9598,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9570
9598
  ])
9571
9599
  ], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
9572
9600
  createElementVNode("div", _hoisted_14, [
9573
- createVNode(_sfc_main$C, { icon: "$mouseLeftClick" }),
9601
+ createVNode(_sfc_main$B, { icon: "$mouseLeftClick" }),
9574
9602
  createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
9575
9603
  ]),
9576
9604
  _cache[4] || (_cache[4] = createElementVNode("span", null, " + ", -1)),
@@ -9580,7 +9608,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9580
9608
  ]),
9581
9609
  _cache[5] || (_cache[5] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
9582
9610
  createElementVNode("div", _hoisted_17, [
9583
- createVNode(_sfc_main$C, { icon: "$mouseLeftClick" }),
9611
+ createVNode(_sfc_main$B, { icon: "$mouseLeftClick" }),
9584
9612
  createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
9585
9613
  ]),
9586
9614
  _cache[6] || (_cache[6] = createElementVNode("span", null, " + ", -1)),
@@ -9590,7 +9618,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9590
9618
  ]),
9591
9619
  _cache[7] || (_cache[7] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
9592
9620
  createElementVNode("div", _hoisted_20, [
9593
- createVNode(_sfc_main$C, { icon: "$mouseLeftClick" }),
9621
+ createVNode(_sfc_main$B, { icon: "$mouseLeftClick" }),
9594
9622
  createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
9595
9623
  ])
9596
9624
  ], 64))
@@ -9667,6 +9695,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9667
9695
  await nextTick();
9668
9696
  if (editor.pointerDown(e)) {
9669
9697
  editor.selectAll();
9698
+ editor._updateSelectionByDom();
9670
9699
  return true;
9671
9700
  }
9672
9701
  return false;
@@ -9913,7 +9942,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9913
9942
  class: "mce-timeline__play",
9914
9943
  onClick: toggle
9915
9944
  }, [
9916
- createVNode(_sfc_main$C, {
9945
+ createVNode(_sfc_main$B, {
9917
9946
  icon: paused.value ? "$play" : "$pause"
9918
9947
  }, null, 8, ["icon"])
9919
9948
  ])
@@ -9942,7 +9971,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9942
9971
  }, [
9943
9972
  createElementVNode("div", _hoisted_5, [
9944
9973
  createElementVNode("div", _hoisted_6, [
9945
- createVNode(_sfc_main$k, {
9974
+ createVNode(_sfc_main$j, {
9946
9975
  ref: "rulerTpl",
9947
9976
  zoom: 1 / unref(msPerPx) * fps.value,
9948
9977
  unit: 100,
@@ -10016,12 +10045,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10016
10045
  const props = __props;
10017
10046
  let editor;
10018
10047
  if (props.editor) {
10019
- editor = provideEditor(props.editor);
10048
+ editor = props.editor;
10049
+ provide(Editor.injectionKey, editor);
10020
10050
  } else {
10021
10051
  editor = useEditor();
10022
10052
  }
10053
+ editor.setup();
10023
10054
  provide(IconsSymbol, createIcons());
10024
10055
  const {
10056
+ isElement,
10025
10057
  showMadeWith,
10026
10058
  config,
10027
10059
  drawboardDom,
@@ -10031,12 +10063,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10031
10063
  hoverElement,
10032
10064
  state,
10033
10065
  setCursor,
10034
- isFrame,
10035
10066
  selectArea,
10036
10067
  exec,
10037
10068
  isLock,
10069
+ selectionAabbInDrawboard,
10038
10070
  elementSelection,
10039
- getAabbInDrawboard,
10040
10071
  drawboardAabb,
10041
10072
  drawboardPointer,
10042
10073
  screenCenterOffset,
@@ -10082,7 +10113,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10082
10113
  let hovered;
10083
10114
  if (elementSelection.value.length > 1 && isPointInsideAabb(
10084
10115
  { x: event.clientX, y: event.clientY },
10085
- getAabbInDrawboard(elementSelection.value)
10116
+ selectionAabbInDrawboard.value
10086
10117
  )) {
10087
10118
  cursor = "move";
10088
10119
  } else {
@@ -10092,7 +10123,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10092
10123
  event,
10093
10124
  editor
10094
10125
  });
10095
- if (result && !(result instanceof Element2D)) {
10126
+ if (result && !isElement(result)) {
10096
10127
  hovered = result.element;
10097
10128
  cursor = result.cursor;
10098
10129
  } else {
@@ -10117,7 +10148,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10117
10148
  const inSelection = isPointInsideAabb({
10118
10149
  x: start.x + -drawboardAabb.value.left,
10119
10150
  y: start.y + -drawboardAabb.value.top
10120
- }, getAabbInDrawboard(elementSelection.value));
10151
+ }, selectionAabbInDrawboard.value);
10121
10152
  if (downEvent.button === 2) {
10122
10153
  if (!inSelection) {
10123
10154
  const result = props.activeStrategy({
@@ -10125,7 +10156,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10125
10156
  event: downEvent,
10126
10157
  editor
10127
10158
  });
10128
- if (result && !(result instanceof Element2D)) {
10159
+ if (result && !isElement(result)) {
10129
10160
  selected = result.element ? [result.element] : [];
10130
10161
  } else {
10131
10162
  selected = result ? [result] : [];
@@ -10140,7 +10171,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10140
10171
  event,
10141
10172
  editor
10142
10173
  });
10143
- if (result && !(result instanceof Element2D)) {
10174
+ if (result && !isElement(result)) {
10144
10175
  selected = result.element ? [result.element] : [];
10145
10176
  } else {
10146
10177
  selected = result ? [result] : [];
@@ -10167,7 +10198,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10167
10198
  editor
10168
10199
  });
10169
10200
  let _element;
10170
- if (result && !(result instanceof Element2D)) {
10201
+ if (result && !isElement(result)) {
10171
10202
  _element = result.element;
10172
10203
  ctxState = result.state;
10173
10204
  } else {
@@ -10193,7 +10224,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10193
10224
  exec("startTransform", downEvent);
10194
10225
  }
10195
10226
  } else {
10196
- if (element && !isFrame(element)) {
10227
+ if (element) {
10197
10228
  if (canStartDrag()) {
10198
10229
  dragging = true;
10199
10230
  onDrag(moveEvent);
@@ -10209,7 +10240,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10209
10240
  function onMove(moveEvent) {
10210
10241
  current = { x: moveEvent.clientX, y: moveEvent.clientY };
10211
10242
  if (!inSelection) {
10212
- if (!element || isFrame(element)) {
10243
+ if (!element) {
10213
10244
  onSelectArea();
10214
10245
  }
10215
10246
  }
@@ -10281,10 +10312,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10281
10312
  }
10282
10313
  }
10283
10314
  }
10315
+ const slotProps = {
10316
+ editor
10317
+ };
10284
10318
  return (_ctx, _cache) => {
10285
10319
  return openBlock(), createBlock(_sfc_main$d, { class: "mce-editor" }, {
10286
10320
  default: withCtx(() => [
10287
- createVNode(_sfc_main$f),
10288
10321
  createVNode(_sfc_main$b, null, {
10289
10322
  default: withCtx(() => [
10290
10323
  createElementVNode("div", {
@@ -10299,51 +10332,52 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10299
10332
  }, [
10300
10333
  createElementVNode("canvas", _hoisted_2, null, 512),
10301
10334
  createVNode(_sfc_main$8, { ref: "textEditorTpl" }, null, 512),
10302
- createVNode(_sfc_main$D),
10303
- createVNode(_sfc_main$q),
10304
- createVNode(_sfc_main$s),
10305
- createVNode(_sfc_main$y),
10306
- createVNode(_sfc_main$g, {
10335
+ createVNode(_sfc_main$C),
10336
+ createVNode(_sfc_main$p),
10337
+ createVNode(_sfc_main$r),
10338
+ createVNode(_sfc_main$x),
10339
+ unref(config).ruler ? (openBlock(), createBlock(_sfc_main$i, { key: 0 })) : createCommentVNode("", true),
10340
+ unref(config).scrollbar ? (openBlock(), createBlock(_sfc_main$g, { key: 1 })) : createCommentVNode("", true),
10341
+ unref(showMadeWith) ? (openBlock(), createBlock(MadeWith, { key: 2 })) : createCommentVNode("", true),
10342
+ createVNode(_sfc_main$f, {
10307
10343
  ref: "selectorTpl",
10308
10344
  "selected-area": selectedArea.value,
10309
10345
  "resize-strategy": resizeStrategy.value
10310
10346
  }, {
10311
10347
  transformable: withCtx(({ box }) => [
10312
- renderSlot(_ctx.$slots, "transformer", { box })
10348
+ renderSlot(_ctx.$slots, "transformer", mergeProps({ box }, slotProps))
10313
10349
  ]),
10314
10350
  default: withCtx(({ box }) => [
10315
- createVNode(_sfc_main$u),
10316
- renderSlot(_ctx.$slots, "selector", { box })
10351
+ createVNode(_sfc_main$t),
10352
+ renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
10317
10353
  ]),
10318
10354
  _: 3
10319
10355
  }, 8, ["selected-area", "resize-strategy"]),
10320
- unref(config).scrollbar ? (openBlock(), createBlock(_sfc_main$h, { key: 0 })) : createCommentVNode("", true),
10321
- _ctx.$slots.floatbar || _ctx.$slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$x, {
10322
- key: 1,
10356
+ _ctx.$slots.floatbar || _ctx.$slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$w, {
10357
+ key: 3,
10323
10358
  location: "top-start",
10324
10359
  target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el
10325
10360
  }, {
10326
10361
  default: withCtx(() => [
10327
- renderSlot(_ctx.$slots, "floatbar"),
10328
- renderSlot(_ctx.$slots, "floatbar-top")
10362
+ renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps))),
10363
+ renderSlot(_ctx.$slots, "floatbar-top", normalizeProps(guardReactiveProps(slotProps)))
10329
10364
  ]),
10330
10365
  _: 3
10331
10366
  }, 8, ["target"])) : createCommentVNode("", true),
10332
- _ctx.$slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$x, {
10333
- key: 2,
10367
+ _ctx.$slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$w, {
10368
+ key: 4,
10334
10369
  location: "bottom-start",
10335
10370
  target: selector.value?.transformable?.$el
10336
10371
  }, {
10337
10372
  default: withCtx(() => [
10338
- renderSlot(_ctx.$slots, "floatbar-bottom")
10373
+ renderSlot(_ctx.$slots, "floatbar-bottom", normalizeProps(guardReactiveProps(slotProps)))
10339
10374
  ]),
10340
10375
  _: 3
10341
10376
  }, 8, ["target"])) : createCommentVNode("", true),
10342
- createVNode(_sfc_main$z),
10343
- createVNode(_sfc_main$r),
10344
- unref(config).ruler ? (openBlock(), createBlock(_sfc_main$j, { key: 3 })) : createCommentVNode("", true),
10377
+ createVNode(_sfc_main$y),
10378
+ createVNode(_sfc_main$q),
10345
10379
  unref(config).layers ? (openBlock(), createBlock(_sfc_main$e, {
10346
- key: 4,
10380
+ key: 5,
10347
10381
  modelValue: unref(config).layers,
10348
10382
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(config).layers = $event),
10349
10383
  title: unref(t)("layers"),
@@ -10355,18 +10389,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10355
10389
  }
10356
10390
  }, {
10357
10391
  default: withCtx(() => [
10358
- createVNode(_sfc_main$n)
10392
+ createVNode(_sfc_main$m)
10359
10393
  ]),
10360
10394
  _: 1
10361
10395
  }, 8, ["modelValue", "title", "default-transform"])) : createCommentVNode("", true),
10362
- unref(showMadeWith) ? (openBlock(), createBlock(MadeWith, { key: 5 })) : createCommentVNode("", true),
10363
10396
  createVNode(Toolbelt),
10364
- renderSlot(_ctx.$slots, "drawboard")
10397
+ renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
10365
10398
  ], 40, _hoisted_1)
10366
10399
  ]),
10367
10400
  _: 3
10368
10401
  }),
10369
- renderSlot(_ctx.$slots, "default"),
10402
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps))),
10370
10403
  createVNode(_sfc_main$c, {
10371
10404
  modelValue: unref(config).statusbar,
10372
10405
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(config).statusbar = $event),
@@ -10423,7 +10456,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10423
10456
  updateLocation
10424
10457
  });
10425
10458
  return (_ctx, _cache) => {
10426
- return openBlock(), createBlock(_sfc_main$B, {
10459
+ return openBlock(), createBlock(_sfc_main$A, {
10427
10460
  ref: "overlayTpl",
10428
10461
  modelValue: isActive.value,
10429
10462
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -10447,11 +10480,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10447
10480
  }
10448
10481
  });
10449
10482
  export {
10450
- _sfc_main$v as Cropper,
10483
+ _sfc_main$u as Cropper,
10451
10484
  _sfc_main as Dialog,
10452
10485
  Doc,
10453
10486
  Editor,
10454
- _sfc_main$n as EditorLayers,
10487
+ _sfc_main$m as EditorLayers,
10455
10488
  _sfc_main$1 as EditorLayout,
10456
10489
  _sfc_main$c as EditorLayoutItem,
10457
10490
  Toolbelt as EditorToolbelt,
@@ -10464,12 +10497,12 @@ export {
10464
10497
  MceMenuSymbol,
10465
10498
  MceOverlaySymbol,
10466
10499
  MceSvgIcon,
10467
- _sfc_main$A as Menu,
10500
+ _sfc_main$z as Menu,
10468
10501
  Model,
10469
- _sfc_main$k as Ruler,
10502
+ _sfc_main$j as Ruler,
10470
10503
  SUPPORTS_CLIPBOARD,
10471
- _sfc_main$i as Scrollbar,
10472
- _sfc_main$w as Transformable,
10504
+ _sfc_main$h as Scrollbar,
10505
+ _sfc_main$v as Transformable,
10473
10506
  USER_AGENT,
10474
10507
  boundingBoxToStyle,
10475
10508
  consoleError,
@@ -10509,7 +10542,6 @@ export {
10509
10542
  mixins,
10510
10543
  plugins,
10511
10544
  propsFactory,
10512
- provideEditor,
10513
10545
  provideOverlay,
10514
10546
  refElement,
10515
10547
  templateRef,