mce 0.13.6 → 0.13.8

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();
@@ -6572,7 +6571,7 @@ function useResizeObserver(callback, box = "content") {
6572
6571
  }
6573
6572
  const MceLayoutKey = Symbol.for("mce:layout");
6574
6573
  const MceLayoutItemKey = Symbol.for("mce:layout-item");
6575
- const ROOT_ZINDEX = 1e3;
6574
+ const ROOT_ZINDEX = 999;
6576
6575
  function makeLayoutProps() {
6577
6576
  return {
6578
6577
  overlaps: {
@@ -6590,8 +6589,7 @@ function makeLayoutItemProps() {
6590
6589
  order: {
6591
6590
  type: [Number, String],
6592
6591
  default: 0
6593
- },
6594
- absolute: Boolean
6592
+ }
6595
6593
  };
6596
6594
  }
6597
6595
  function useLayout() {
@@ -6727,8 +6725,7 @@ function createLayout(props) {
6727
6725
  layoutSize,
6728
6726
  elementSize,
6729
6727
  active,
6730
- disableTransitions,
6731
- absolute
6728
+ disableTransitions
6732
6729
  }) => {
6733
6730
  priorities.set(id, order);
6734
6731
  positions.set(id, position);
@@ -6752,7 +6749,6 @@ function createLayout(props) {
6752
6749
  [position.value]: 0,
6753
6750
  zIndex: zIndex.value,
6754
6751
  transform: `translate${isHorizontal ? "X" : "Y"}(${(active.value ? 0 : -(size === 0 ? 100 : size)) * (isOppositeHorizontal || isOppositeVertical ? -1 : 1)}${unit})`,
6755
- position: absolute.value || rootZIndex.value !== ROOT_ZINDEX ? "absolute" : "fixed",
6756
6752
  ...transitionsEnabled.value ? void 0 : { transition: "none" }
6757
6753
  };
6758
6754
  if (!isMounted.value)
@@ -6813,7 +6809,7 @@ function createLayout(props) {
6813
6809
  };
6814
6810
  }
6815
6811
  const MceMenuSymbol = Symbol.for("MceMenuSymbol");
6816
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
6812
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
6817
6813
  __name: "Icon",
6818
6814
  props: {
6819
6815
  disabled: Boolean,
@@ -6838,7 +6834,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6838
6834
  };
6839
6835
  }
6840
6836
  });
6841
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
6837
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
6842
6838
  ...{
6843
6839
  inheritAttrs: false
6844
6840
  },
@@ -6962,7 +6958,7 @@ const _hoisted_5$3 = {
6962
6958
  key: 1,
6963
6959
  class: "mce-list-item__append"
6964
6960
  };
6965
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
6961
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
6966
6962
  ...{
6967
6963
  name: "MceMenu"
6968
6964
  },
@@ -7041,7 +7037,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
7041
7037
  });
7042
7038
  return (_ctx, _cache) => {
7043
7039
  const _component_MceMenu = resolveComponent("MceMenu");
7044
- return openBlock(), createBlock(_sfc_main$B, {
7040
+ return openBlock(), createBlock(_sfc_main$A, {
7045
7041
  ref: "overlayTpl",
7046
7042
  modelValue: isActive.value,
7047
7043
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isActive.value = $event),
@@ -7085,7 +7081,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
7085
7081
  onClick: (e) => onClickItem(item, index, e)
7086
7082
  }, [
7087
7083
  hasPrepend.value ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
7088
- item.checked ? (openBlock(), createBlock(_sfc_main$C, {
7084
+ item.checked ? (openBlock(), createBlock(_sfc_main$B, {
7089
7085
  key: 0,
7090
7086
  icon: "$check"
7091
7087
  })) : createCommentVNode("", true)
@@ -7096,7 +7092,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
7096
7092
  ])
7097
7093
  ]),
7098
7094
  item.children?.length ? (openBlock(), createElementBlock("div", _hoisted_5$3, [
7099
- createVNode(_sfc_main$C, { icon: "$arrowRight" })
7095
+ createVNode(_sfc_main$B, { icon: "$arrowRight" })
7100
7096
  ])) : createCommentVNode("", true)
7101
7097
  ], 10, _hoisted_2$a)
7102
7098
  ], 40, _hoisted_1$m))
@@ -7134,7 +7130,7 @@ const _hoisted_2$9 = {
7134
7130
  key: 0,
7135
7131
  class: "mce-context-menu__kbd"
7136
7132
  };
7137
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
7133
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7138
7134
  __name: "ContextMenu",
7139
7135
  props: {
7140
7136
  "modelValue": { type: Boolean },
@@ -7192,7 +7188,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
7192
7188
  updateLocation
7193
7189
  });
7194
7190
  return (_ctx, _cache) => {
7195
- return openBlock(), createBlock(_sfc_main$A, {
7191
+ return openBlock(), createBlock(_sfc_main$z, {
7196
7192
  ref: "menuTplRef",
7197
7193
  modelValue: model.value,
7198
7194
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
@@ -7219,7 +7215,7 @@ const _hoisted_1$k = {
7219
7215
  key: 0,
7220
7216
  class: "mce-drawing__content"
7221
7217
  };
7222
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
7218
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7223
7219
  __name: "Drawing",
7224
7220
  setup(__props) {
7225
7221
  const {
@@ -7254,7 +7250,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7254
7250
  };
7255
7251
  }
7256
7252
  });
7257
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
7253
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7258
7254
  __name: "Floatbar",
7259
7255
  props: {
7260
7256
  ...makeMceOverlayProps({
@@ -7265,27 +7261,46 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7265
7261
  setup(__props, { expose: __expose }) {
7266
7262
  const props = __props;
7267
7263
  const {
7268
- getAabbInDrawboard,
7269
7264
  selection,
7265
+ selectionAabbInDrawboard,
7270
7266
  isFrame
7271
7267
  } = useEditor();
7272
7268
  const overlay = useTemplateRef("overlayTpl");
7269
+ const style = computed(() => {
7270
+ const location = props.location;
7271
+ const aabb = selectionAabbInDrawboard.value;
7272
+ if (location?.startsWith("top") || location?.startsWith("bottom")) {
7273
+ return {
7274
+ width: `${aabb.width}px`
7275
+ };
7276
+ } else if (location?.startsWith("left") || location?.startsWith("right")) {
7277
+ return {
7278
+ height: `${aabb.height}px`
7279
+ };
7280
+ }
7281
+ return {};
7282
+ });
7283
+ const offset2 = computed(() => {
7284
+ if (selection.value.some((v) => isFrame(v)) || props.location?.startsWith("bottom")) {
7285
+ return 32;
7286
+ }
7287
+ return 8;
7288
+ });
7273
7289
  function updateLocation() {
7274
7290
  overlay.value?.updateLocation();
7275
7291
  }
7276
- watch(() => getAabbInDrawboard(selection.value), updateLocation, {
7277
- deep: true
7278
- });
7292
+ watch(selectionAabbInDrawboard, updateLocation, { deep: true });
7279
7293
  __expose({
7280
7294
  updateLocation
7281
7295
  });
7282
7296
  return (_ctx, _cache) => {
7283
- return openBlock(), createBlock(_sfc_main$B, {
7297
+ return openBlock(), createBlock(_sfc_main$A, {
7284
7298
  ref: "overlayTpl",
7299
+ style: normalizeStyle(style.value),
7285
7300
  class: "mce-floatbar",
7286
7301
  location: props.location,
7287
7302
  middlewares: props.middlewares,
7288
- offset: unref(selection)[0] && unref(isFrame)(unref(selection)[0]) ? 32 : 8,
7303
+ offset: offset2.value,
7289
7304
  target: props.target,
7290
7305
  attach: false,
7291
7306
  "model-value": true
@@ -7294,7 +7309,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7294
7309
  unref(selection).length > 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
7295
7310
  ]),
7296
7311
  _: 3
7297
- }, 8, ["location", "middlewares", "offset", "target"]);
7312
+ }, 8, ["style", "location", "middlewares", "offset", "target"]);
7298
7313
  };
7299
7314
  }
7300
7315
  });
@@ -7312,7 +7327,7 @@ const _hoisted_8$1 = {
7312
7327
  key: 0,
7313
7328
  class: "mce-transformable__tip"
7314
7329
  };
7315
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
7330
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
7316
7331
  __name: "Transformable",
7317
7332
  props: {
7318
7333
  tag: { default: "div" },
@@ -7450,12 +7465,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7450
7465
  y: center.y - item.y > 0 ? 1 : -1
7451
7466
  };
7452
7467
  const offset2 = minSize * 0.1;
7468
+ const ws = (borderRadius + offset2) / (width / 2 + offset2);
7469
+ const hs = (borderRadius + offset2) / (height / 2 + offset2);
7453
7470
  return {
7454
7471
  ...item,
7455
7472
  shape: "circle",
7456
7473
  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)
7474
+ x: item.x + sign.x * width / 2 * ws,
7475
+ y: item.y + sign.y * height / 2 * hs
7459
7476
  };
7460
7477
  }) : [];
7461
7478
  let handles;
@@ -7596,11 +7613,10 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7596
7613
  }
7597
7614
  } else if (isBorderRadius) {
7598
7615
  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
- );
7616
+ const dx = -sign.x * offset2.x;
7617
+ const dy = -sign.y * offset2.y;
7618
+ const _offset = Math.abs(dx) < Math.abs(dy) ? dy : dx;
7619
+ updated.borderRadius = borderRadius + _offset;
7604
7620
  } else if (isHorizontalVertical) {
7605
7621
  const currentPoint = rotatePoint(rotatedCurrentPoint, centerPoint, -rotate);
7606
7622
  const newCurrentPoint = isHorizontal ? { x: currentPoint.x, y: startPoint.y } : { x: startPoint.x, y: currentPoint.y };
@@ -7628,7 +7644,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7628
7644
  let newRotatedCurrentPoint;
7629
7645
  if ((props.resizeStrategy === "lockAspectRatio" || props.resizeStrategy === "lockAspectRatioDiagonal") && aspectRatio) {
7630
7646
  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;
7647
+ const dx = sign.x * offset2.x;
7648
+ const dy = sign.y * offset2.y * aspectRatio;
7649
+ const _offset = Math.abs(dx) < Math.abs(dy) ? dx : dy;
7632
7650
  newRotatedCurrentPoint = rotatePoint(
7633
7651
  {
7634
7652
  x: startPoint.x + sign.x * _offset,
@@ -7655,6 +7673,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7655
7673
  if ("width" in updated && updated.width <= 0 || "height" in updated && updated.height <= 0) {
7656
7674
  return;
7657
7675
  }
7676
+ if (updated.borderRadius ?? borderRadius) {
7677
+ updated.borderRadius = Math.min(
7678
+ Math.max(0, updated.borderRadius ?? borderRadius),
7679
+ Math.min((updated.width ?? width) / 2, (updated.height ?? height) / 2)
7680
+ );
7681
+ }
7658
7682
  const oldValue = { ...model.value };
7659
7683
  const newValue = { ...model.value, ...updated };
7660
7684
  model.value = newValue;
@@ -7681,11 +7705,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7681
7705
  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
7706
  }
7683
7707
  function getCursor(type) {
7684
- if (type === "move")
7708
+ if (type === "move") {
7685
7709
  return "move";
7710
+ }
7686
7711
  const create = cursors[type];
7687
7712
  if (!create) {
7688
- return "default";
7713
+ return void 0;
7689
7714
  }
7690
7715
  return `url("data:image/svg+xml,${create(model.value.rotate ?? 0)}") 16 16, pointer`;
7691
7716
  }
@@ -7872,7 +7897,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
7872
7897
  }
7873
7898
  });
7874
7899
  const _hoisted_1$i = { class: "mce-cropper" };
7875
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
7900
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
7876
7901
  __name: "Cropper",
7877
7902
  props: /* @__PURE__ */ mergeModels({
7878
7903
  image: {},
@@ -8020,7 +8045,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
8020
8045
  ref: canvasRef
8021
8046
  }, null, 512)
8022
8047
  ], 4),
8023
- createVNode(_sfc_main$w, {
8048
+ createVNode(_sfc_main$v, {
8024
8049
  modelValue: sourceTransform.value,
8025
8050
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
8026
8051
  class: "mce-cropper__transformable",
@@ -8043,7 +8068,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
8043
8068
  };
8044
8069
  }
8045
8070
  });
8046
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
8071
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8047
8072
  __name: "ForegroundCropper",
8048
8073
  setup(__props) {
8049
8074
  const {
@@ -8053,7 +8078,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
8053
8078
  } = useEditor();
8054
8079
  const element = computed(() => elementSelection.value[0]);
8055
8080
  return (_ctx, _cache) => {
8056
- return unref(state) === "cropping" && element.value?.foreground.isValid() ? (openBlock(), createBlock(_sfc_main$v, {
8081
+ return unref(state) === "cropping" && element.value?.foreground.isValid() ? (openBlock(), createBlock(_sfc_main$u, {
8057
8082
  key: 0,
8058
8083
  modelValue: element.value.foreground.cropRect,
8059
8084
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => element.value.foreground.cropRect = $event),
@@ -8066,7 +8091,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
8066
8091
  };
8067
8092
  }
8068
8093
  });
8069
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
8094
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
8070
8095
  __name: "Frame",
8071
8096
  props: {
8072
8097
  "modelValue": { required: true },
@@ -8077,7 +8102,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8077
8102
  const frame = useModel(__props, "modelValue");
8078
8103
  const input = useTemplateRef("inputTpl");
8079
8104
  const {
8080
- getObbInDrawboard,
8105
+ getObb,
8081
8106
  hoverElement,
8082
8107
  selection,
8083
8108
  state,
@@ -8102,9 +8127,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8102
8127
  }
8103
8128
  return (_ctx, _cache) => {
8104
8129
  return withDirectives((openBlock(), createElementBlock("div", {
8105
- style: normalizeStyle(unref(boundingBoxToStyle)(unref(getObbInDrawboard)(frame.value))),
8130
+ style: normalizeStyle(unref(boundingBoxToStyle)(unref(getObb)(frame.value, "drawboard"))),
8106
8131
  class: normalizeClass(["mce-frame", [
8107
- unref(config).frameOutline && "mce-frame--outline"
8132
+ unref(config).frameOutline && "mce-frame--outline",
8133
+ unref(hoverElement)?.equal(frame.value) && "mce-frame--hover",
8134
+ unref(selection).some((v) => v.equal(frame.value)) && "mce-frame--selected"
8108
8135
  ]])
8109
8136
  }, [
8110
8137
  withDirectives(createElementVNode("div", {
@@ -8132,7 +8159,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
8132
8159
  };
8133
8160
  }
8134
8161
  });
8135
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
8162
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
8136
8163
  __name: "Frames",
8137
8164
  setup(__props) {
8138
8165
  const {
@@ -8140,7 +8167,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
8140
8167
  } = useEditor();
8141
8168
  return (_ctx, _cache) => {
8142
8169
  return openBlock(true), createElementBlock(Fragment, null, renderList(unref(frames), (frame, key) => {
8143
- return openBlock(), createBlock(_sfc_main$t, {
8170
+ return openBlock(), createBlock(_sfc_main$s, {
8144
8171
  key,
8145
8172
  "model-value": frame
8146
8173
  }, null, 8, ["model-value"]);
@@ -8148,7 +8175,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
8148
8175
  };
8149
8176
  }
8150
8177
  });
8151
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
8178
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
8152
8179
  __name: "GoBackSelectedArea",
8153
8180
  setup(__props) {
8154
8181
  const {
@@ -8170,22 +8197,23 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
8170
8197
  class: "mce-back-selected-aera",
8171
8198
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
8172
8199
  }, [
8173
- createVNode(_sfc_main$C, { icon: "$gps" }),
8200
+ createVNode(_sfc_main$B, { icon: "$gps" }),
8174
8201
  createElementVNode("span", null, toDisplayString(unref(t)("goBackSelectedArea")), 1)
8175
8202
  ])) : createCommentVNode("", true);
8176
8203
  };
8177
8204
  }
8178
8205
  });
8179
8206
  const _hoisted_1$h = ["data-name"];
8180
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
8207
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
8181
8208
  __name: "Hover",
8182
8209
  setup(__props) {
8183
8210
  const {
8184
8211
  selection,
8185
8212
  hoverElement,
8186
- getObbInDrawboard
8213
+ getObb,
8214
+ camera
8187
8215
  } = useEditor();
8188
- const hoverElementObb = computed(() => getObbInDrawboard(hoverElement.value));
8216
+ const hoverElementObb = computed(() => getObb(hoverElement.value, "drawboard"));
8189
8217
  return (_ctx, _cache) => {
8190
8218
  return unref(hoverElement) && !unref(hoverElement).equal(unref(selection)[0]) ? (openBlock(), createElementBlock("div", {
8191
8219
  key: 0,
@@ -8193,6 +8221,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
8193
8221
  "data-name": unref(hoverElement).name,
8194
8222
  style: normalizeStyle({
8195
8223
  borderColor: "currentcolor",
8224
+ borderRadius: `${(unref(hoverElement).style.borderRadius ?? 0) * unref(camera).zoom.x}px`,
8196
8225
  ...unref(boundingBoxToStyle)(hoverElementObb.value)
8197
8226
  })
8198
8227
  }, null, 12, _hoisted_1$h)) : createCommentVNode("", true);
@@ -8200,7 +8229,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
8200
8229
  }
8201
8230
  });
8202
8231
  const _hoisted_1$g = { class: "mce-btn" };
8203
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
8232
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8204
8233
  __name: "Btn",
8205
8234
  setup(__props) {
8206
8235
  return (_ctx, _cache) => {
@@ -8212,7 +8241,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
8212
8241
  });
8213
8242
  const _hoisted_1$f = { class: "mce-layer__name" };
8214
8243
  const _hoisted_2$7 = { class: "mce-layer__action" };
8215
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
8244
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8216
8245
  ...{
8217
8246
  name: "MceLayer",
8218
8247
  inheritAttrs: false
@@ -8359,7 +8388,11 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8359
8388
  editing.value = true;
8360
8389
  editValue.value = props.node.name;
8361
8390
  nextTick().then(() => {
8362
- inputDom.value?.focus();
8391
+ const dom2 = inputDom.value;
8392
+ if (dom2) {
8393
+ dom2.focus();
8394
+ dom2.select();
8395
+ }
8363
8396
  });
8364
8397
  }
8365
8398
  function onMouseenter() {
@@ -8381,7 +8414,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8381
8414
  }
8382
8415
  }
8383
8416
  function onInputBlur() {
8384
- console.log("onInputBlur");
8385
8417
  editing.value = false;
8386
8418
  if (editValue.value) {
8387
8419
  props.node.name = editValue.value;
@@ -8414,7 +8446,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8414
8446
  class: "mce-layer__expand",
8415
8447
  onClick: onClickExpand
8416
8448
  }, [
8417
- props.node.children.length ? (openBlock(), createBlock(_sfc_main$C, {
8449
+ props.node.children.length ? (openBlock(), createBlock(_sfc_main$B, {
8418
8450
  key: 0,
8419
8451
  icon: "$arrowRight"
8420
8452
  })) : createCommentVNode("", true)
@@ -8428,7 +8460,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8428
8460
  class: "mce-layer__thumbnail",
8429
8461
  onDblclick: onDblclickThumbnail
8430
8462
  }, [
8431
- createVNode(_sfc_main$C, { icon: thumbnailIcon.value }, null, 8, ["icon"])
8463
+ createVNode(_sfc_main$B, { icon: thumbnailIcon.value }, null, 8, ["icon"])
8432
8464
  ], 32),
8433
8465
  createElementVNode("div", _hoisted_1$f, [
8434
8466
  withDirectives(createElementVNode("input", {
@@ -8455,31 +8487,31 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8455
8487
  }]),
8456
8488
  onClick: _cache[1] || (_cache[1] = ($event) => unref(setLock)(props.node, !unref(isLock)(props.node)))
8457
8489
  }, [
8458
- createVNode(_sfc_main$C, {
8490
+ createVNode(_sfc_main$B, {
8459
8491
  icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
8460
8492
  }, null, 8, ["icon"])
8461
8493
  ], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
8462
- createVNode(_sfc_main$p, {
8494
+ createVNode(_sfc_main$o, {
8463
8495
  class: normalizeClass({
8464
8496
  "mce-btn--hide": !hovering.value && !unref(isLock)(props.node)
8465
8497
  }),
8466
8498
  onClick: _cache[2] || (_cache[2] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
8467
8499
  }, {
8468
8500
  default: withCtx(() => [
8469
- createVNode(_sfc_main$C, {
8501
+ createVNode(_sfc_main$B, {
8470
8502
  icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
8471
8503
  }, null, 8, ["icon"])
8472
8504
  ]),
8473
8505
  _: 1
8474
8506
  }, 8, ["class"]),
8475
- createVNode(_sfc_main$p, {
8507
+ createVNode(_sfc_main$o, {
8476
8508
  class: normalizeClass({
8477
8509
  "mce-btn--hide": !hovering.value && unref(isVisible)(props.node)
8478
8510
  }),
8479
8511
  onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
8480
8512
  }, {
8481
8513
  default: withCtx(() => [
8482
- createVNode(_sfc_main$C, {
8514
+ createVNode(_sfc_main$B, {
8483
8515
  icon: unref(isVisible)(props.node) ? "$visible" : "$unvisible"
8484
8516
  }, null, 8, ["icon"])
8485
8517
  ]),
@@ -8503,7 +8535,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8503
8535
  });
8504
8536
  const _hoisted_1$e = { class: "mce-layers" };
8505
8537
  const _hoisted_2$6 = { class: "mce-layers__wrapper" };
8506
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
8538
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8507
8539
  __name: "Layers",
8508
8540
  setup(__props) {
8509
8541
  const {
@@ -8553,7 +8585,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8553
8585
  return (_ctx, _cache) => {
8554
8586
  return openBlock(), createElementBlock("div", _hoisted_1$e, [
8555
8587
  createElementVNode("div", _hoisted_2$6, [
8556
- createVNode(_sfc_main$o, {
8588
+ createVNode(_sfc_main$n, {
8557
8589
  root: true,
8558
8590
  node: unref(root),
8559
8591
  opened: true
@@ -8570,7 +8602,7 @@ const _export_sfc = (sfc, props) => {
8570
8602
  }
8571
8603
  return target;
8572
8604
  };
8573
- const _sfc_main$m = {};
8605
+ const _sfc_main$l = {};
8574
8606
  const _hoisted_1$d = {
8575
8607
  class: "mce-made-with",
8576
8608
  href: "https://github.com/qq15725/mce",
@@ -8582,8 +8614,8 @@ function _sfc_render$1(_ctx, _cache) {
8582
8614
  createElementVNode("div", null, "MCE", -1)
8583
8615
  ])]);
8584
8616
  }
8585
- const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$1]]);
8586
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
8617
+ const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$1]]);
8618
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8587
8619
  __name: "Tooltip",
8588
8620
  props: /* @__PURE__ */ mergeModels({
8589
8621
  ...makeMceOverlayProps({
@@ -8606,7 +8638,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8606
8638
  updateLocation
8607
8639
  });
8608
8640
  return (_ctx, _cache) => {
8609
- return openBlock(), createBlock(_sfc_main$B, {
8641
+ return openBlock(), createBlock(_sfc_main$A, {
8610
8642
  ref: "overlayTpl",
8611
8643
  modelValue: isActive.value,
8612
8644
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -8635,7 +8667,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8635
8667
  const _hoisted_1$c = ["width", "height"];
8636
8668
  const _hoisted_2$5 = ["onDblclick", "onMousedown", "onMousemove"];
8637
8669
  const _hoisted_3$5 = { style: { "font-size": "12px", "text-wrap": "nowrap" } };
8638
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
8670
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
8639
8671
  ...{
8640
8672
  inheritAttrs: false
8641
8673
  },
@@ -8915,7 +8947,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8915
8947
  onMouseleave: onLeave
8916
8948
  }, null, 46, _hoisted_2$5);
8917
8949
  }), 128)),
8918
- createVNode(_sfc_main$l, {
8950
+ createVNode(_sfc_main$k, {
8919
8951
  "model-value": !!tipText.value,
8920
8952
  target: tipPos.value,
8921
8953
  offset: 24
@@ -8930,7 +8962,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8930
8962
  }
8931
8963
  });
8932
8964
  const _hoisted_1$b = { class: "mce-rulers" };
8933
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
8965
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8934
8966
  ...{
8935
8967
  inheritAttrs: false
8936
8968
  },
@@ -8938,25 +8970,23 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
8938
8970
  setup(__props) {
8939
8971
  const {
8940
8972
  camera,
8941
- getAabbInDrawboard,
8942
- selection
8973
+ selectionAabbInDrawboard
8943
8974
  } = useEditor();
8944
- const activeAabb = computed(() => getAabbInDrawboard(selection.value));
8945
8975
  return (_ctx, _cache) => {
8946
8976
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
8947
- createVNode(_sfc_main$k, {
8977
+ createVNode(_sfc_main$j, {
8948
8978
  refline: "",
8949
8979
  zoom: unref(camera).zoom.x,
8950
8980
  position: unref(camera).position.x,
8951
- selected: activeAabb.value,
8981
+ selected: unref(selectionAabbInDrawboard),
8952
8982
  axis: "",
8953
8983
  size: 16
8954
8984
  }, null, 8, ["zoom", "position", "selected"]),
8955
- createVNode(_sfc_main$k, {
8985
+ createVNode(_sfc_main$j, {
8956
8986
  refline: "",
8957
8987
  zoom: unref(camera).zoom.y,
8958
8988
  position: unref(camera).position.y,
8959
- selected: activeAabb.value,
8989
+ selected: unref(selectionAabbInDrawboard),
8960
8990
  axis: "",
8961
8991
  vertical: "",
8962
8992
  size: 16
@@ -8970,7 +9000,7 @@ const _hoisted_1$a = {
8970
9000
  ref: "trackTplRef",
8971
9001
  class: "mce-scrollbar__track"
8972
9002
  };
8973
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
9003
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
8974
9004
  __name: "Scrollbar",
8975
9005
  props: /* @__PURE__ */ mergeModels({
8976
9006
  length: {},
@@ -9077,7 +9107,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
9077
9107
  };
9078
9108
  }
9079
9109
  });
9080
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
9110
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9081
9111
  ...{
9082
9112
  inheritAttrs: false
9083
9113
  },
@@ -9095,13 +9125,13 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
9095
9125
  } = useEditor();
9096
9126
  return (_ctx, _cache) => {
9097
9127
  return openBlock(), createElementBlock(Fragment, null, [
9098
- createVNode(_sfc_main$i, mergeProps(props, {
9128
+ createVNode(_sfc_main$h, mergeProps(props, {
9099
9129
  modelValue: unref(camera).position.y,
9100
9130
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(camera).position.y = $event),
9101
9131
  vertical: "",
9102
9132
  length: unref(viewAabb).height * unref(camera).zoom.y
9103
9133
  }), null, 16, ["modelValue", "length"]),
9104
- createVNode(_sfc_main$i, mergeProps(props, {
9134
+ createVNode(_sfc_main$h, mergeProps(props, {
9105
9135
  modelValue: unref(camera).position.x,
9106
9136
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(camera).position.x = $event),
9107
9137
  length: unref(viewAabb).width * unref(camera).zoom.x
@@ -9110,7 +9140,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
9110
9140
  };
9111
9141
  }
9112
9142
  });
9113
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
9143
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
9114
9144
  ...{
9115
9145
  inheritAttrs: false
9116
9146
  },
@@ -9122,12 +9152,14 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9122
9152
  setup(__props, { expose: __expose }) {
9123
9153
  const props = __props;
9124
9154
  const {
9155
+ isElement,
9125
9156
  state,
9126
9157
  resizeElement,
9127
9158
  elementSelection,
9159
+ selectionObb,
9160
+ selectionObbInDrawboard,
9128
9161
  camera,
9129
9162
  obbToFit,
9130
- getObbInDrawboard,
9131
9163
  getObb,
9132
9164
  registerCommand,
9133
9165
  unregisterCommand,
@@ -9148,8 +9180,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9148
9180
  }
9149
9181
  const obbs = [];
9150
9182
  elementSelection.value[0]?.findAncestor((ancestor) => {
9151
- if (ancestor instanceof Element2D) {
9152
- obbs.push(getObbInDrawboard(ancestor));
9183
+ if (isElement(ancestor)) {
9184
+ obbs.push(getObb(ancestor, "drawboard"));
9153
9185
  }
9154
9186
  return false;
9155
9187
  });
@@ -9161,15 +9193,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9161
9193
  }
9162
9194
  return elementSelection.value.map((el) => {
9163
9195
  return {
9164
- name: el.name,
9165
- box: getObbInDrawboard(el)
9196
+ element: el,
9197
+ box: getObb(el, "drawboard")
9166
9198
  };
9167
9199
  });
9168
9200
  });
9169
9201
  const _selectionTransform = computed(() => {
9170
9202
  const zoom = camera.value.zoom;
9171
9203
  return {
9172
- ...getObbInDrawboard(elementSelection.value),
9204
+ ...selectionObbInDrawboard.value,
9173
9205
  borderRadius: (elementSelection.value[0]?.style.borderRadius ?? 0) * zoom.x
9174
9206
  };
9175
9207
  });
@@ -9210,7 +9242,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9210
9242
  Object.assign(style, newStyle);
9211
9243
  element.updateGlobalTransform();
9212
9244
  element.findAncestor((ancestor) => {
9213
- if (ancestor instanceof Element2D && !isFrame(ancestor)) {
9245
+ if (isElement(ancestor) && !isFrame(ancestor)) {
9214
9246
  obbToFit(ancestor);
9215
9247
  }
9216
9248
  return false;
@@ -9238,7 +9270,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9238
9270
  return elementSelection.value.length === 1 && !isLock(element) && element.foreground.isValid();
9239
9271
  });
9240
9272
  function tipFormat() {
9241
- const obb = elementSelection.value.length === 1 ? elementSelection.value[0].style : getObb(elementSelection.value);
9273
+ const obb = elementSelection.value.length === 1 ? elementSelection.value[0].style : selectionObb.value;
9242
9274
  return `${Number(obb.width.toFixed(2))} × ${Number(obb.height.toFixed(2))}`;
9243
9275
  }
9244
9276
  __expose({
@@ -9249,7 +9281,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9249
9281
  (openBlock(true), createElementBlock(Fragment, null, renderList(parentObbs.value, (obb, index) => {
9250
9282
  return openBlock(), createElementBlock("div", {
9251
9283
  key: index,
9252
- class: "mce-parent-element-obb",
9284
+ class: "mce-selector__parent-element",
9253
9285
  style: normalizeStyle({
9254
9286
  borderColor: "currentColor",
9255
9287
  ...unref(boundingBoxToStyle)(obb)
@@ -9258,7 +9290,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9258
9290
  }), 128)),
9259
9291
  unref(state) === "selecting" ? (openBlock(), createElementBlock("div", {
9260
9292
  key: 0,
9261
- class: "mce-selected-area",
9293
+ class: "mce-selector__selected-area",
9262
9294
  style: normalizeStyle({
9263
9295
  borderColor: "currentcolor",
9264
9296
  ...unref(boundingBoxToStyle)(props.selectedArea)
@@ -9267,14 +9299,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9267
9299
  (openBlock(true), createElementBlock(Fragment, null, renderList(selectionObbs.value, (item, index) => {
9268
9300
  return openBlock(), createElementBlock("div", {
9269
9301
  key: index,
9270
- class: "mce-element-obb",
9302
+ class: "mce-selector__element",
9271
9303
  style: normalizeStyle({
9272
9304
  borderColor: "currentcolor",
9305
+ borderRadius: `${(item.element.style.borderRadius ?? 0) * unref(camera).zoom.x}px`,
9273
9306
  ...unref(boundingBoxToStyle)(item.box)
9274
9307
  })
9275
9308
  }, null, 4);
9276
9309
  }), 128)),
9277
- selectionTransform.value.width && selectionTransform.value.height ? (openBlock(), createBlock(_sfc_main$w, {
9310
+ selectionTransform.value.width && selectionTransform.value.height ? (openBlock(), createBlock(_sfc_main$v, {
9278
9311
  key: 1,
9279
9312
  ref: "transformableRef",
9280
9313
  modelValue: selectionTransform.value,
@@ -9285,7 +9318,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9285
9318
  "adjustable-border-radius": adjustableBorderRadius.value,
9286
9319
  "resize-strategy": props.resizeStrategy,
9287
9320
  "handle-shape": unref(config).handleShape,
9288
- class: "mce-selection-obb",
9321
+ class: "mce-selector__transform",
9289
9322
  "border-style": unref(elementSelection).length > 1 ? "dashed" : "solid",
9290
9323
  "tip-format": tipFormat,
9291
9324
  onMove: _cache[1] || (_cache[1] = () => !unref(state) && (state.value = "transforming")),
@@ -9301,7 +9334,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9301
9334
  ]), 1032, ["modelValue", "movable", "resizable", "rotatable", "adjustable-border-radius", "resize-strategy", "handle-shape", "border-style"])) : createCommentVNode("", true),
9302
9335
  selectionTransform.value.width && selectionTransform.value.height && _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
9303
9336
  key: 2,
9304
- style: normalizeStyle([{ "position": "absolute" }, unref(boundingBoxToStyle)(selectionTransform.value)])
9337
+ class: "mce-selector__slot",
9338
+ style: normalizeStyle(unref(boundingBoxToStyle)(selectionTransform.value))
9305
9339
  }, [
9306
9340
  renderSlot(_ctx.$slots, "default", { box: selectionTransform.value })
9307
9341
  ], 4)) : createCommentVNode("", true)
@@ -9309,15 +9343,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
9309
9343
  };
9310
9344
  }
9311
9345
  });
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
9346
  const _hoisted_1$9 = {
9322
9347
  key: 0,
9323
9348
  class: "mce-float-panel__title"
@@ -9343,7 +9368,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
9343
9368
  ...props.defaultTransform
9344
9369
  });
9345
9370
  return (_ctx, _cache) => {
9346
- return openBlock(), createBlock(_sfc_main$w, {
9371
+ return openBlock(), createBlock(_sfc_main$v, {
9347
9372
  modelValue: transform.value,
9348
9373
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => transform.value = $event),
9349
9374
  class: "mce-float-panel",
@@ -9355,11 +9380,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
9355
9380
  createElementVNode("div", mergeProps({ class: "mce-float-panel__card" }, slotProps), [
9356
9381
  __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
9357
9382
  createElementVNode("div", null, toDisplayString(__props.title), 1),
9358
- createVNode(_sfc_main$p, {
9383
+ createVNode(_sfc_main$o, {
9359
9384
  onClick: _cache[0] || (_cache[0] = ($event) => isActive.value = false)
9360
9385
  }, {
9361
9386
  default: withCtx(() => [
9362
- createVNode(_sfc_main$C, { icon: "$close" })
9387
+ createVNode(_sfc_main$B, { icon: "$close" })
9363
9388
  ]),
9364
9389
  _: 1
9365
9390
  })
@@ -9381,6 +9406,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
9381
9406
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
9382
9407
  __name: "Layout",
9383
9408
  props: {
9409
+ class: [String, Array, Object],
9410
+ style: {
9411
+ type: [String, Array, Object],
9412
+ default: null
9413
+ },
9384
9414
  ...makeLayoutProps()
9385
9415
  },
9386
9416
  setup(__props, { expose: __expose }) {
@@ -9399,8 +9429,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
9399
9429
  return (_ctx, _cache) => {
9400
9430
  return openBlock(), createElementBlock("div", {
9401
9431
  ref: unref(layoutRef),
9402
- class: normalizeClass([unref(layoutClasses)]),
9403
- style: normalizeStyle([unref(layoutStyles)])
9432
+ class: normalizeClass(normalizeClass([unref(layoutClasses), props.class])),
9433
+ style: normalizeStyle(normalizeStyle([unref(layoutStyles), props.style]))
9404
9434
  }, [
9405
9435
  renderSlot(_ctx.$slots, "default")
9406
9436
  ], 6);
@@ -9410,6 +9440,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
9410
9440
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
9411
9441
  __name: "LayoutItem",
9412
9442
  props: {
9443
+ class: [String, Array, Object],
9444
+ style: {
9445
+ type: [String, Array, Object],
9446
+ default: null
9447
+ },
9413
9448
  position: {
9414
9449
  type: String,
9415
9450
  required: true
@@ -9432,15 +9467,16 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9432
9467
  position: toRef(() => props.position),
9433
9468
  elementSize: toRef(() => props.size),
9434
9469
  layoutSize: toRef(() => props.size),
9435
- active: toRef(() => props.modelValue),
9436
- absolute: toRef(() => props.absolute)
9470
+ active: toRef(() => props.modelValue)
9437
9471
  });
9438
9472
  return (_ctx, _cache) => {
9439
9473
  return openBlock(), createElementBlock("div", {
9440
- class: normalizeClass(["mce-layout-item", [
9441
- `mce-layout-item--${props.position}`
9442
- ]]),
9443
- style: normalizeStyle([unref(layoutItemStyles)])
9474
+ class: normalizeClass(normalizeClass([
9475
+ "mce-layout-item",
9476
+ `mce-layout-item--${props.position}`,
9477
+ props.class
9478
+ ])),
9479
+ style: normalizeStyle(normalizeStyle([unref(layoutItemStyles), props.style]))
9444
9480
  }, [
9445
9481
  renderSlot(_ctx.$slots, "default")
9446
9482
  ], 6);
@@ -9556,7 +9592,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9556
9592
  ])
9557
9593
  ], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
9558
9594
  createElementVNode("div", _hoisted_8, [
9559
- createVNode(_sfc_main$C, { icon: "$mouseRightClick" })
9595
+ createVNode(_sfc_main$B, { icon: "$mouseRightClick" })
9560
9596
  ]),
9561
9597
  _cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
9562
9598
  createElementVNode("div", _hoisted_9, [
@@ -9570,7 +9606,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9570
9606
  ])
9571
9607
  ], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
9572
9608
  createElementVNode("div", _hoisted_14, [
9573
- createVNode(_sfc_main$C, { icon: "$mouseLeftClick" }),
9609
+ createVNode(_sfc_main$B, { icon: "$mouseLeftClick" }),
9574
9610
  createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
9575
9611
  ]),
9576
9612
  _cache[4] || (_cache[4] = createElementVNode("span", null, " + ", -1)),
@@ -9580,7 +9616,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9580
9616
  ]),
9581
9617
  _cache[5] || (_cache[5] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
9582
9618
  createElementVNode("div", _hoisted_17, [
9583
- createVNode(_sfc_main$C, { icon: "$mouseLeftClick" }),
9619
+ createVNode(_sfc_main$B, { icon: "$mouseLeftClick" }),
9584
9620
  createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
9585
9621
  ]),
9586
9622
  _cache[6] || (_cache[6] = createElementVNode("span", null, " + ", -1)),
@@ -9590,7 +9626,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9590
9626
  ]),
9591
9627
  _cache[7] || (_cache[7] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
9592
9628
  createElementVNode("div", _hoisted_20, [
9593
- createVNode(_sfc_main$C, { icon: "$mouseLeftClick" }),
9629
+ createVNode(_sfc_main$B, { icon: "$mouseLeftClick" }),
9594
9630
  createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
9595
9631
  ])
9596
9632
  ], 64))
@@ -9667,6 +9703,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9667
9703
  await nextTick();
9668
9704
  if (editor.pointerDown(e)) {
9669
9705
  editor.selectAll();
9706
+ editor._updateSelectionByDom();
9670
9707
  return true;
9671
9708
  }
9672
9709
  return false;
@@ -9913,7 +9950,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9913
9950
  class: "mce-timeline__play",
9914
9951
  onClick: toggle
9915
9952
  }, [
9916
- createVNode(_sfc_main$C, {
9953
+ createVNode(_sfc_main$B, {
9917
9954
  icon: paused.value ? "$play" : "$pause"
9918
9955
  }, null, 8, ["icon"])
9919
9956
  ])
@@ -9942,7 +9979,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9942
9979
  }, [
9943
9980
  createElementVNode("div", _hoisted_5, [
9944
9981
  createElementVNode("div", _hoisted_6, [
9945
- createVNode(_sfc_main$k, {
9982
+ createVNode(_sfc_main$j, {
9946
9983
  ref: "rulerTpl",
9947
9984
  zoom: 1 / unref(msPerPx) * fps.value,
9948
9985
  unit: 100,
@@ -10016,12 +10053,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10016
10053
  const props = __props;
10017
10054
  let editor;
10018
10055
  if (props.editor) {
10019
- editor = provideEditor(props.editor);
10056
+ editor = props.editor;
10057
+ provide(Editor.injectionKey, editor);
10020
10058
  } else {
10021
10059
  editor = useEditor();
10022
10060
  }
10061
+ editor.setup();
10023
10062
  provide(IconsSymbol, createIcons());
10024
10063
  const {
10064
+ isElement,
10025
10065
  showMadeWith,
10026
10066
  config,
10027
10067
  drawboardDom,
@@ -10031,12 +10071,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10031
10071
  hoverElement,
10032
10072
  state,
10033
10073
  setCursor,
10034
- isFrame,
10035
10074
  selectArea,
10036
10075
  exec,
10037
10076
  isLock,
10077
+ selectionAabbInDrawboard,
10038
10078
  elementSelection,
10039
- getAabbInDrawboard,
10040
10079
  drawboardAabb,
10041
10080
  drawboardPointer,
10042
10081
  screenCenterOffset,
@@ -10082,7 +10121,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10082
10121
  let hovered;
10083
10122
  if (elementSelection.value.length > 1 && isPointInsideAabb(
10084
10123
  { x: event.clientX, y: event.clientY },
10085
- getAabbInDrawboard(elementSelection.value)
10124
+ selectionAabbInDrawboard.value
10086
10125
  )) {
10087
10126
  cursor = "move";
10088
10127
  } else {
@@ -10092,7 +10131,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10092
10131
  event,
10093
10132
  editor
10094
10133
  });
10095
- if (result && !(result instanceof Element2D)) {
10134
+ if (result && !isElement(result)) {
10096
10135
  hovered = result.element;
10097
10136
  cursor = result.cursor;
10098
10137
  } else {
@@ -10117,7 +10156,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10117
10156
  const inSelection = isPointInsideAabb({
10118
10157
  x: start.x + -drawboardAabb.value.left,
10119
10158
  y: start.y + -drawboardAabb.value.top
10120
- }, getAabbInDrawboard(elementSelection.value));
10159
+ }, selectionAabbInDrawboard.value);
10121
10160
  if (downEvent.button === 2) {
10122
10161
  if (!inSelection) {
10123
10162
  const result = props.activeStrategy({
@@ -10125,7 +10164,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10125
10164
  event: downEvent,
10126
10165
  editor
10127
10166
  });
10128
- if (result && !(result instanceof Element2D)) {
10167
+ if (result && !isElement(result)) {
10129
10168
  selected = result.element ? [result.element] : [];
10130
10169
  } else {
10131
10170
  selected = result ? [result] : [];
@@ -10140,7 +10179,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10140
10179
  event,
10141
10180
  editor
10142
10181
  });
10143
- if (result && !(result instanceof Element2D)) {
10182
+ if (result && !isElement(result)) {
10144
10183
  selected = result.element ? [result.element] : [];
10145
10184
  } else {
10146
10185
  selected = result ? [result] : [];
@@ -10167,7 +10206,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10167
10206
  editor
10168
10207
  });
10169
10208
  let _element;
10170
- if (result && !(result instanceof Element2D)) {
10209
+ if (result && !isElement(result)) {
10171
10210
  _element = result.element;
10172
10211
  ctxState = result.state;
10173
10212
  } else {
@@ -10193,7 +10232,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10193
10232
  exec("startTransform", downEvent);
10194
10233
  }
10195
10234
  } else {
10196
- if (element && !isFrame(element)) {
10235
+ if (element) {
10197
10236
  if (canStartDrag()) {
10198
10237
  dragging = true;
10199
10238
  onDrag(moveEvent);
@@ -10209,7 +10248,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10209
10248
  function onMove(moveEvent) {
10210
10249
  current = { x: moveEvent.clientX, y: moveEvent.clientY };
10211
10250
  if (!inSelection) {
10212
- if (!element || isFrame(element)) {
10251
+ if (!element) {
10213
10252
  onSelectArea();
10214
10253
  }
10215
10254
  }
@@ -10281,10 +10320,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10281
10320
  }
10282
10321
  }
10283
10322
  }
10323
+ const slotProps = {
10324
+ editor
10325
+ };
10284
10326
  return (_ctx, _cache) => {
10285
10327
  return openBlock(), createBlock(_sfc_main$d, { class: "mce-editor" }, {
10286
10328
  default: withCtx(() => [
10287
- createVNode(_sfc_main$f),
10288
10329
  createVNode(_sfc_main$b, null, {
10289
10330
  default: withCtx(() => [
10290
10331
  createElementVNode("div", {
@@ -10299,51 +10340,52 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10299
10340
  }, [
10300
10341
  createElementVNode("canvas", _hoisted_2, null, 512),
10301
10342
  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, {
10343
+ createVNode(_sfc_main$C),
10344
+ createVNode(_sfc_main$p),
10345
+ createVNode(_sfc_main$r),
10346
+ createVNode(_sfc_main$x),
10347
+ unref(config).ruler ? (openBlock(), createBlock(_sfc_main$i, { key: 0 })) : createCommentVNode("", true),
10348
+ unref(config).scrollbar ? (openBlock(), createBlock(_sfc_main$g, { key: 1 })) : createCommentVNode("", true),
10349
+ unref(showMadeWith) ? (openBlock(), createBlock(MadeWith, { key: 2 })) : createCommentVNode("", true),
10350
+ createVNode(_sfc_main$f, {
10307
10351
  ref: "selectorTpl",
10308
10352
  "selected-area": selectedArea.value,
10309
10353
  "resize-strategy": resizeStrategy.value
10310
10354
  }, {
10311
10355
  transformable: withCtx(({ box }) => [
10312
- renderSlot(_ctx.$slots, "transformer", { box })
10356
+ renderSlot(_ctx.$slots, "transformer", mergeProps({ box }, slotProps))
10313
10357
  ]),
10314
10358
  default: withCtx(({ box }) => [
10315
- createVNode(_sfc_main$u),
10316
- renderSlot(_ctx.$slots, "selector", { box })
10359
+ createVNode(_sfc_main$t),
10360
+ renderSlot(_ctx.$slots, "selector", mergeProps({ box }, slotProps))
10317
10361
  ]),
10318
10362
  _: 3
10319
10363
  }, 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,
10364
+ _ctx.$slots.floatbar || _ctx.$slots["floatbar-top"] ? (openBlock(), createBlock(_sfc_main$w, {
10365
+ key: 3,
10323
10366
  location: "top-start",
10324
10367
  target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el
10325
10368
  }, {
10326
10369
  default: withCtx(() => [
10327
- renderSlot(_ctx.$slots, "floatbar"),
10328
- renderSlot(_ctx.$slots, "floatbar-top")
10370
+ renderSlot(_ctx.$slots, "floatbar", normalizeProps(guardReactiveProps(slotProps))),
10371
+ renderSlot(_ctx.$slots, "floatbar-top", normalizeProps(guardReactiveProps(slotProps)))
10329
10372
  ]),
10330
10373
  _: 3
10331
10374
  }, 8, ["target"])) : createCommentVNode("", true),
10332
- _ctx.$slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$x, {
10333
- key: 2,
10375
+ _ctx.$slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$w, {
10376
+ key: 4,
10334
10377
  location: "bottom-start",
10335
10378
  target: selector.value?.transformable?.$el
10336
10379
  }, {
10337
10380
  default: withCtx(() => [
10338
- renderSlot(_ctx.$slots, "floatbar-bottom")
10381
+ renderSlot(_ctx.$slots, "floatbar-bottom", normalizeProps(guardReactiveProps(slotProps)))
10339
10382
  ]),
10340
10383
  _: 3
10341
10384
  }, 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),
10385
+ createVNode(_sfc_main$y),
10386
+ createVNode(_sfc_main$q),
10345
10387
  unref(config).layers ? (openBlock(), createBlock(_sfc_main$e, {
10346
- key: 4,
10388
+ key: 5,
10347
10389
  modelValue: unref(config).layers,
10348
10390
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(config).layers = $event),
10349
10391
  title: unref(t)("layers"),
@@ -10355,18 +10397,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10355
10397
  }
10356
10398
  }, {
10357
10399
  default: withCtx(() => [
10358
- createVNode(_sfc_main$n)
10400
+ createVNode(_sfc_main$m)
10359
10401
  ]),
10360
10402
  _: 1
10361
10403
  }, 8, ["modelValue", "title", "default-transform"])) : createCommentVNode("", true),
10362
- unref(showMadeWith) ? (openBlock(), createBlock(MadeWith, { key: 5 })) : createCommentVNode("", true),
10363
10404
  createVNode(Toolbelt),
10364
- renderSlot(_ctx.$slots, "drawboard")
10405
+ renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
10365
10406
  ], 40, _hoisted_1)
10366
10407
  ]),
10367
10408
  _: 3
10368
10409
  }),
10369
- renderSlot(_ctx.$slots, "default"),
10410
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps))),
10370
10411
  createVNode(_sfc_main$c, {
10371
10412
  modelValue: unref(config).statusbar,
10372
10413
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(config).statusbar = $event),
@@ -10423,7 +10464,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10423
10464
  updateLocation
10424
10465
  });
10425
10466
  return (_ctx, _cache) => {
10426
- return openBlock(), createBlock(_sfc_main$B, {
10467
+ return openBlock(), createBlock(_sfc_main$A, {
10427
10468
  ref: "overlayTpl",
10428
10469
  modelValue: isActive.value,
10429
10470
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -10447,11 +10488,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10447
10488
  }
10448
10489
  });
10449
10490
  export {
10450
- _sfc_main$v as Cropper,
10491
+ _sfc_main$u as Cropper,
10451
10492
  _sfc_main as Dialog,
10452
10493
  Doc,
10453
10494
  Editor,
10454
- _sfc_main$n as EditorLayers,
10495
+ _sfc_main$m as EditorLayers,
10455
10496
  _sfc_main$1 as EditorLayout,
10456
10497
  _sfc_main$c as EditorLayoutItem,
10457
10498
  Toolbelt as EditorToolbelt,
@@ -10464,12 +10505,12 @@ export {
10464
10505
  MceMenuSymbol,
10465
10506
  MceOverlaySymbol,
10466
10507
  MceSvgIcon,
10467
- _sfc_main$A as Menu,
10508
+ _sfc_main$z as Menu,
10468
10509
  Model,
10469
- _sfc_main$k as Ruler,
10510
+ _sfc_main$j as Ruler,
10470
10511
  SUPPORTS_CLIPBOARD,
10471
- _sfc_main$i as Scrollbar,
10472
- _sfc_main$w as Transformable,
10512
+ _sfc_main$h as Scrollbar,
10513
+ _sfc_main$v as Transformable,
10473
10514
  USER_AGENT,
10474
10515
  boundingBoxToStyle,
10475
10516
  consoleError,
@@ -10509,7 +10550,6 @@ export {
10509
10550
  mixins,
10510
10551
  plugins,
10511
10552
  propsFactory,
10512
- provideEditor,
10513
10553
  provideOverlay,
10514
10554
  refElement,
10515
10555
  templateRef,