mce 0.15.35 → 0.15.37

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,6 +1,6 @@
1
1
  import { Node as Node$1, Element2D, Timeline, Engine, Camera2D, DrawboardEffect, Aabb2D, IN_BROWSER, clamp, assets, TimelineNode, Video2D, Transform2D, Obb2D, render, Vector2 as Vector2$1, Lottie2D, customNodes, Animation, IN_MAC_OS } from "modern-canvas";
2
2
  import { reactive, computed, watch, markRaw, isReactive, ref, onBeforeMount, onScopeDispose, warn, shallowRef, defineComponent, createElementBlock, createCommentVNode, unref, openBlock, normalizeStyle as normalizeStyle$1, toDisplayString, onMounted, createVNode, useAttrs, createBlock, resolveDynamicComponent, normalizeClass, mergeProps, createElementVNode, inject, toValue, getCurrentInstance, provide, useId, onBeforeUnmount, readonly, toRef, onDeactivated, onActivated, useModel, useTemplateRef, withDirectives, withModifiers, vModelText, vShow, nextTick, Fragment, renderList, renderSlot, mergeModels, resolveComponent, withCtx, Teleport, createTextVNode, createSlots, normalizeProps, guardReactiveProps, h, isRef, effectScope, useSlots } from "vue";
3
- import { useFileDialog, useEventListener, isClient, onClickOutside, useDebounceFn, useResizeObserver as useResizeObserver$1, useLocalStorage, useImage } from "@vueuse/core";
3
+ import { useFileDialog, useEventListener, isClient, onClickOutside, useDebounceFn, useImage, useResizeObserver as useResizeObserver$1, useLocalStorage } from "@vueuse/core";
4
4
  import { getObjectValueByPath, setObjectValueByPath, Observable, Reactivable, idGenerator, property, normalizeTextContent, isCRLF, textContentToString, normalizeCRLF, isEqualObject } from "modern-idoc";
5
5
  import { saveAs } from "file-saver";
6
6
  import { Fonts } from "modern-font";
@@ -1996,7 +1996,8 @@ const _2_box = defineMixin((editor) => {
1996
1996
  selection,
1997
1997
  getAncestorFrame,
1998
1998
  drawboardAabb,
1999
- screenControlsOffset
1999
+ screenControlsOffset,
2000
+ getGlobalPointer
2000
2001
  } = editor;
2001
2002
  function obbToFit(element) {
2002
2003
  const min = {
@@ -2208,6 +2209,7 @@ const _2_box = defineMixin((editor) => {
2208
2209
  const selectionAabbInDrawboard = computed(() => aabbToDrawboardAabb(selectionAabb.value));
2209
2210
  const selectionObb = computed(() => getObb(selection.value));
2210
2211
  const selectionObbInDrawboard = computed(() => obbToDrawboardObb(selectionObb.value));
2212
+ const isPointerInSelection = computed(() => selectionAabb.value.contains(getGlobalPointer()));
2211
2213
  Object.assign(editor, {
2212
2214
  obbToFit,
2213
2215
  getObb,
@@ -2219,7 +2221,8 @@ const _2_box = defineMixin((editor) => {
2219
2221
  selectionAabb,
2220
2222
  selectionAabbInDrawboard,
2221
2223
  selectionObb,
2222
- selectionObbInDrawboard
2224
+ selectionObbInDrawboard,
2225
+ isPointerInSelection
2223
2226
  });
2224
2227
  });
2225
2228
  const _2_export = defineMixin((editor) => {
@@ -4291,7 +4294,7 @@ const _autoNest = definePlugin((editor) => {
4291
4294
  let flag = true;
4292
4295
  for (let i = 0, len = frames.value.length; i < len; i++) {
4293
4296
  const frame2 = frames.value[i];
4294
- if (frame2.equal(el)) {
4297
+ if (options?.excluded.has(frame2.instanceId) || frame2.equal(el)) {
4295
4298
  continue;
4296
4299
  }
4297
4300
  const aabb2 = frame2.getGlobalAabb();
@@ -4359,12 +4362,14 @@ const _autoNest = definePlugin((editor) => {
4359
4362
  selectionTransform: ({ handle, startEvent, elements }) => {
4360
4363
  if (handle === "move" && !startEvent?.__FROM__) {
4361
4364
  if (Object.keys(startContext).length > 0) {
4365
+ const excluded = new Set(elements.map((el) => el.instanceId));
4362
4366
  elements.forEach((el) => {
4363
4367
  nestIntoFrame(
4364
4368
  el,
4365
4369
  {
4366
4370
  ...startContext[el.instanceId],
4367
- pointer: getGlobalPointer()
4371
+ pointer: getGlobalPointer(),
4372
+ excluded
4368
4373
  }
4369
4374
  );
4370
4375
  });
@@ -4405,7 +4410,7 @@ const _hoisted_1$r = {
4405
4410
  key: 0,
4406
4411
  class: "mce-drawing__tip"
4407
4412
  };
4408
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
4413
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4409
4414
  __name: "Drawing",
4410
4415
  setup(__props) {
4411
4416
  const {
@@ -4438,7 +4443,7 @@ const _drawingTool = definePlugin((editor) => {
4438
4443
  { command: "setActiveDrawingTool", handle: (val) => setActiveDrawingTool(val) }
4439
4444
  ],
4440
4445
  components: [
4441
- { name: "drawing", type: "overlay", component: _sfc_main$D }
4446
+ { name: "drawing", type: "overlay", component: _sfc_main$E }
4442
4447
  ]
4443
4448
  };
4444
4449
  });
@@ -4732,7 +4737,7 @@ const ComponentIcon = defineComponent({
4732
4737
  };
4733
4738
  }
4734
4739
  });
4735
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
4740
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4736
4741
  __name: "Icon",
4737
4742
  props: {
4738
4743
  disabled: Boolean,
@@ -5390,7 +5395,7 @@ const defaultHoverStrategy = (context) => {
5390
5395
  }
5391
5396
  return element.findAncestor(cb);
5392
5397
  };
5393
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
5398
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
5394
5399
  __name: "Frame",
5395
5400
  props: {
5396
5401
  "modelValue": { required: true },
@@ -5466,7 +5471,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5466
5471
  }
5467
5472
  });
5468
5473
  const _hoisted_1$q = { class: "mce-frames" };
5469
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
5474
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5470
5475
  __name: "Frames",
5471
5476
  setup(__props) {
5472
5477
  const {
@@ -5475,7 +5480,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5475
5480
  return (_ctx, _cache) => {
5476
5481
  return openBlock(), createElementBlock("div", _hoisted_1$q, [
5477
5482
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(frames), (frame, key) => {
5478
- return openBlock(), createBlock(_sfc_main$B, {
5483
+ return openBlock(), createBlock(_sfc_main$C, {
5479
5484
  key,
5480
5485
  "model-value": frame
5481
5486
  }, null, 8, ["model-value"]);
@@ -5535,7 +5540,7 @@ const _frame = definePlugin((editor) => {
5535
5540
  { command: "setActiveDrawingTool:frame", key: "F" }
5536
5541
  ],
5537
5542
  components: [
5538
- { type: "overlay", component: _sfc_main$A, order: "before" }
5543
+ { type: "overlay", component: _sfc_main$B, order: "before" }
5539
5544
  ]
5540
5545
  };
5541
5546
  });
@@ -5615,7 +5620,7 @@ const _history = definePlugin((editor) => {
5615
5620
  };
5616
5621
  });
5617
5622
  const _hoisted_1$p = ["data-name"];
5618
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
5623
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5619
5624
  __name: "Hover",
5620
5625
  setup(__props) {
5621
5626
  const {
@@ -5624,6 +5629,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5624
5629
  getObb,
5625
5630
  camera
5626
5631
  } = useEditor();
5632
+ watch(selection, () => hoverElement.value = void 0);
5627
5633
  const hoverElementObb = computed(() => getObb(hoverElement.value, "drawboard"));
5628
5634
  return (_ctx, _cache) => {
5629
5635
  return unref(hoverElement) && !unref(selection).some((node) => node.equal(unref(hoverElement))) ? (openBlock(), createElementBlock("div", {
@@ -5643,7 +5649,7 @@ const _hover = definePlugin(() => {
5643
5649
  return {
5644
5650
  name: "mce:hover",
5645
5651
  components: [
5646
- { type: "overlay", component: _sfc_main$z, order: "before" }
5652
+ { type: "overlay", component: _sfc_main$A, order: "before" }
5647
5653
  ]
5648
5654
  };
5649
5655
  });
@@ -5922,7 +5928,7 @@ const _json = definePlugin((editor) => {
5922
5928
  ]
5923
5929
  };
5924
5930
  });
5925
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
5931
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5926
5932
  __name: "Btn",
5927
5933
  props: {
5928
5934
  active: { type: Boolean },
@@ -5944,7 +5950,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5944
5950
  const _hoisted_1$o = ["data-id"];
5945
5951
  const _hoisted_2$d = { class: "mce-layer__content" };
5946
5952
  const _hoisted_3$b = { class: "mce-layer__prepend" };
5947
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
5953
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5948
5954
  ...{
5949
5955
  name: "MceLayer",
5950
5956
  inheritAttrs: false
@@ -6168,7 +6174,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6168
6174
  _cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
6169
6175
  createElementVNode("div", _hoisted_2$d, [
6170
6176
  createElementVNode("div", _hoisted_3$b, [
6171
- childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$C), {
6177
+ childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$D), {
6172
6178
  key: 0,
6173
6179
  class: "mce-layer__arrow",
6174
6180
  icon: "$arrowRight",
@@ -6181,7 +6187,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6181
6187
  class: "mce-layer__thumbnail",
6182
6188
  onDblclick: onDblclickThumbnail
6183
6189
  }, [
6184
- createVNode(unref(_sfc_main$C), { icon: thumbnailIcon.value }, null, 8, ["icon"])
6190
+ createVNode(unref(_sfc_main$D), { icon: thumbnailIcon.value }, null, 8, ["icon"])
6185
6191
  ], 32),
6186
6192
  createElementVNode("div", {
6187
6193
  class: "mce-layer__name",
@@ -6214,7 +6220,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6214
6220
  }])
6215
6221
  }, [
6216
6222
  props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6217
- Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$y, {
6223
+ Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$z, {
6218
6224
  key: 0,
6219
6225
  icon: "",
6220
6226
  class: "mce-layer__btn mce-layer__btn--show",
@@ -6225,12 +6231,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6225
6231
  }), ["prevent", "stop"]))
6226
6232
  }, {
6227
6233
  default: withCtx(() => [
6228
- createVNode(unref(_sfc_main$C), { icon: "$collapse" })
6234
+ createVNode(unref(_sfc_main$D), { icon: "$collapse" })
6229
6235
  ]),
6230
6236
  _: 1
6231
6237
  })) : createCommentVNode("", true)
6232
6238
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
6233
- createVNode(_sfc_main$y, {
6239
+ createVNode(_sfc_main$z, {
6234
6240
  icon: "",
6235
6241
  class: normalizeClass(["mce-layer__btn", {
6236
6242
  "mce-layer__btn--show": unref(isLock)(props.node)
@@ -6238,13 +6244,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6238
6244
  onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
6239
6245
  }, {
6240
6246
  default: withCtx(() => [
6241
- createVNode(unref(_sfc_main$C), {
6247
+ createVNode(unref(_sfc_main$D), {
6242
6248
  icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
6243
6249
  }, null, 8, ["icon"])
6244
6250
  ]),
6245
6251
  _: 1
6246
6252
  }, 8, ["class"]),
6247
- createVNode(_sfc_main$y, {
6253
+ createVNode(_sfc_main$z, {
6248
6254
  icon: "",
6249
6255
  class: normalizeClass(["mce-layer__btn", {
6250
6256
  "mce-layer__btn--show": !unref(isVisible)(props.node)
@@ -6252,7 +6258,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6252
6258
  onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
6253
6259
  }, {
6254
6260
  default: withCtx(() => [
6255
- createVNode(unref(_sfc_main$C), {
6261
+ createVNode(unref(_sfc_main$D), {
6256
6262
  icon: unref(isVisible)(props.node) ? "$visible" : "$unvisible"
6257
6263
  }, null, 8, ["icon"])
6258
6264
  ]),
@@ -6276,7 +6282,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6276
6282
  });
6277
6283
  const _hoisted_1$n = { class: "mce-layers" };
6278
6284
  const _hoisted_2$c = { class: "mce-layers__wrapper" };
6279
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
6285
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6280
6286
  __name: "Layers",
6281
6287
  setup(__props) {
6282
6288
  const {
@@ -6322,7 +6328,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6322
6328
  return (_ctx, _cache) => {
6323
6329
  return openBlock(), createElementBlock("div", _hoisted_1$n, [
6324
6330
  createElementVNode("div", _hoisted_2$c, [
6325
- createVNode(_sfc_main$x, {
6331
+ createVNode(_sfc_main$y, {
6326
6332
  root: true,
6327
6333
  node: unref(root),
6328
6334
  opened: true
@@ -6336,7 +6342,7 @@ const _layers = definePlugin(() => {
6336
6342
  return {
6337
6343
  name: "mce:layers",
6338
6344
  components: [
6339
- { name: "layers", type: "panel", position: "float", component: _sfc_main$w }
6345
+ { name: "layers", type: "panel", position: "float", component: _sfc_main$x }
6340
6346
  ]
6341
6347
  };
6342
6348
  });
@@ -6347,7 +6353,7 @@ const _export_sfc = (sfc, props) => {
6347
6353
  }
6348
6354
  return target;
6349
6355
  };
6350
- const _sfc_main$v = {};
6356
+ const _sfc_main$w = {};
6351
6357
  const _hoisted_1$m = {
6352
6358
  class: "mce-made-with",
6353
6359
  href: "https://github.com/qq15725/mce",
@@ -6359,7 +6365,7 @@ function _sfc_render(_ctx, _cache) {
6359
6365
  createElementVNode("div", null, "MCE", -1)
6360
6366
  ])]);
6361
6367
  }
6362
- const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render]]);
6368
+ const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render]]);
6363
6369
  const _madeWith = definePlugin((editor) => {
6364
6370
  const {
6365
6371
  config,
@@ -6377,7 +6383,7 @@ const _madeWith = definePlugin((editor) => {
6377
6383
  ]
6378
6384
  };
6379
6385
  });
6380
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
6386
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6381
6387
  ...{
6382
6388
  inheritAttrs: false
6383
6389
  },
@@ -6522,7 +6528,7 @@ const _hoisted_7$3 = {
6522
6528
  key: 3,
6523
6529
  class: "mce-list-item__append"
6524
6530
  };
6525
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
6531
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
6526
6532
  ...{
6527
6533
  name: "MceMenu"
6528
6534
  },
@@ -6605,7 +6611,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6605
6611
  });
6606
6612
  return (_ctx, _cache) => {
6607
6613
  const _component_MceMenu = resolveComponent("MceMenu");
6608
- return openBlock(), createBlock(_sfc_main$u, {
6614
+ return openBlock(), createBlock(_sfc_main$v, {
6609
6615
  ref: "overlayTpl",
6610
6616
  modelValue: isActive.value,
6611
6617
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isActive.value = $event),
@@ -6652,7 +6658,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6652
6658
  onClick: (e) => onClickItem(item, index, e)
6653
6659
  }, [
6654
6660
  hasPrepend.value ? (openBlock(), createElementBlock("div", _hoisted_3$a, [
6655
- item.checked ? (openBlock(), createBlock(unref(_sfc_main$C), {
6661
+ item.checked ? (openBlock(), createBlock(unref(_sfc_main$D), {
6656
6662
  key: 0,
6657
6663
  icon: "$check"
6658
6664
  })) : createCommentVNode("", true)
@@ -6670,7 +6676,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6670
6676
  ])) : createCommentVNode("", true),
6671
6677
  item.children?.length || _ctx.$slots.append ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
6672
6678
  renderSlot(_ctx.$slots, "append", { item }),
6673
- item.children?.length ? (openBlock(), createBlock(unref(_sfc_main$C), {
6679
+ item.children?.length ? (openBlock(), createBlock(unref(_sfc_main$D), {
6674
6680
  key: 0,
6675
6681
  icon: "$arrowRight"
6676
6682
  })) : createCommentVNode("", true)
@@ -6727,7 +6733,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6727
6733
  };
6728
6734
  }
6729
6735
  });
6730
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
6736
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6731
6737
  __name: "ContextMenu",
6732
6738
  props: {
6733
6739
  "modelValue": { type: Boolean },
@@ -6813,7 +6819,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6813
6819
  updateLocation
6814
6820
  });
6815
6821
  return (_ctx, _cache) => {
6816
- return openBlock(), createBlock(_sfc_main$t, {
6822
+ return openBlock(), createBlock(_sfc_main$u, {
6817
6823
  ref: "menuTplRef",
6818
6824
  modelValue: isActive.value,
6819
6825
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -7103,7 +7109,7 @@ const _menu = definePlugin((editor, options) => {
7103
7109
  return {
7104
7110
  name: "mce:menu",
7105
7111
  components: [
7106
- { type: "overlay", component: _sfc_main$s, order: "after" }
7112
+ { type: "overlay", component: _sfc_main$t, order: "after" }
7107
7113
  ]
7108
7114
  };
7109
7115
  });
@@ -7170,7 +7176,7 @@ const _new = definePlugin((editor) => {
7170
7176
  const _hoisted_1$k = { class: "mce-node-creator" };
7171
7177
  const _hoisted_2$a = { class: "mce-node-creator__tree" };
7172
7178
  const _hoisted_3$9 = { class: "mce-node-creator__actions" };
7173
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
7179
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
7174
7180
  __name: "NodeCreator",
7175
7181
  props: {
7176
7182
  "isActive": { type: Boolean },
@@ -7263,13 +7269,13 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
7263
7269
  }), 128))
7264
7270
  ]),
7265
7271
  createElementVNode("div", _hoisted_3$9, [
7266
- createVNode(_sfc_main$y, { onClick: cancel }, {
7272
+ createVNode(_sfc_main$z, { onClick: cancel }, {
7267
7273
  default: withCtx(() => [
7268
7274
  createTextVNode(toDisplayString(unref(t)("cancel")), 1)
7269
7275
  ]),
7270
7276
  _: 1
7271
7277
  }),
7272
- createVNode(_sfc_main$y, { onClick: create }, {
7278
+ createVNode(_sfc_main$z, { onClick: create }, {
7273
7279
  default: withCtx(() => [
7274
7280
  createTextVNode(toDisplayString(unref(t)("create")), 1)
7275
7281
  ]),
@@ -7289,7 +7295,7 @@ const _node = definePlugin((editor) => {
7289
7295
  return {
7290
7296
  name: "mce:node",
7291
7297
  components: [
7292
- { name: "nodeCreator", type: "panel", position: "float", component: _sfc_main$r }
7298
+ { name: "nodeCreator", type: "panel", position: "float", component: _sfc_main$s }
7293
7299
  ],
7294
7300
  commands: [
7295
7301
  { command: "addSubNode", handle: () => config.value.nodeCreator = true }
@@ -11431,7 +11437,7 @@ const _hoisted_3$8 = {
11431
11437
  key: 0,
11432
11438
  class: "mce-tooltip__kbd"
11433
11439
  };
11434
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
11440
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
11435
11441
  __name: "Tooltip",
11436
11442
  props: /* @__PURE__ */ mergeModels({
11437
11443
  ...makeMceOverlayProps({
@@ -11462,7 +11468,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
11462
11468
  updateLocation
11463
11469
  });
11464
11470
  return (_ctx, _cache) => {
11465
- return openBlock(), createBlock(_sfc_main$u, {
11471
+ return openBlock(), createBlock(_sfc_main$v, {
11466
11472
  ref: "overlayTpl",
11467
11473
  modelValue: isActive.value,
11468
11474
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -11506,7 +11512,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
11506
11512
  const _hoisted_1$i = ["width", "height"];
11507
11513
  const _hoisted_2$8 = ["onDblclick", "onMousedown", "onMousemove"];
11508
11514
  const _hoisted_3$7 = { style: { "font-size": "0.75rem", "text-wrap": "nowrap" } };
11509
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
11515
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
11510
11516
  ...{
11511
11517
  inheritAttrs: false
11512
11518
  },
@@ -11786,7 +11792,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11786
11792
  onMouseleave: onLeave
11787
11793
  }, null, 46, _hoisted_2$8);
11788
11794
  }), 128)),
11789
- createVNode(_sfc_main$q, {
11795
+ createVNode(_sfc_main$r, {
11790
11796
  "model-value": !!tipText.value,
11791
11797
  target: tipPos.value,
11792
11798
  offset: 24
@@ -11801,7 +11807,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11801
11807
  }
11802
11808
  });
11803
11809
  const _hoisted_1$h = { class: "mce-rulers" };
11804
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
11810
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11805
11811
  __name: "Rulers",
11806
11812
  setup(__props) {
11807
11813
  const {
@@ -11810,7 +11816,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
11810
11816
  } = useEditor();
11811
11817
  return (_ctx, _cache) => {
11812
11818
  return openBlock(), createElementBlock("div", _hoisted_1$h, [
11813
- createVNode(_sfc_main$p, {
11819
+ createVNode(_sfc_main$q, {
11814
11820
  refline: "",
11815
11821
  zoom: unref(camera).zoom.x,
11816
11822
  position: unref(camera).position.x,
@@ -11818,7 +11824,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
11818
11824
  axis: "",
11819
11825
  size: 16
11820
11826
  }, null, 8, ["zoom", "position", "selected"]),
11821
- createVNode(_sfc_main$p, {
11827
+ createVNode(_sfc_main$q, {
11822
11828
  refline: "",
11823
11829
  zoom: unref(camera).zoom.y,
11824
11830
  position: unref(camera).position.y,
@@ -11843,7 +11849,7 @@ const _ruler = definePlugin((editor) => {
11843
11849
  components: [
11844
11850
  {
11845
11851
  type: "overlay",
11846
- component: _sfc_main$o,
11852
+ component: _sfc_main$p,
11847
11853
  ignore: () => !config.value.ruler,
11848
11854
  order: "after"
11849
11855
  }
@@ -11885,7 +11891,7 @@ const _hoisted_1$g = {
11885
11891
  ref: "trackTplRef",
11886
11892
  class: "mce-scrollbar__track"
11887
11893
  };
11888
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
11894
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
11889
11895
  __name: "Scrollbar",
11890
11896
  props: /* @__PURE__ */ mergeModels({
11891
11897
  length: {},
@@ -11993,7 +11999,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
11993
11999
  }
11994
12000
  });
11995
12001
  const _hoisted_1$f = { class: "mce-scrollbars" };
11996
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
12002
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
11997
12003
  __name: "Scrollbars",
11998
12004
  props: {
11999
12005
  offset: { default: 0 },
@@ -12007,13 +12013,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
12007
12013
  } = useEditor();
12008
12014
  return (_ctx, _cache) => {
12009
12015
  return openBlock(), createElementBlock("div", _hoisted_1$f, [
12010
- createVNode(_sfc_main$n, mergeProps(props, {
12016
+ createVNode(_sfc_main$o, mergeProps(props, {
12011
12017
  modelValue: unref(camera).position.y,
12012
12018
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(camera).position.y = $event),
12013
12019
  vertical: "",
12014
12020
  length: unref(rootAabb).height * unref(camera).zoom.y
12015
12021
  }), null, 16, ["modelValue", "length"]),
12016
- createVNode(_sfc_main$n, mergeProps(props, {
12022
+ createVNode(_sfc_main$o, mergeProps(props, {
12017
12023
  modelValue: unref(camera).position.x,
12018
12024
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(camera).position.x = $event),
12019
12025
  length: unref(rootAabb).width * unref(camera).zoom.x
@@ -12130,7 +12136,7 @@ const _scroll = definePlugin((editor) => {
12130
12136
  components: [
12131
12137
  {
12132
12138
  type: "overlay",
12133
- component: _sfc_main$m,
12139
+ component: _sfc_main$n,
12134
12140
  ignore: () => !config.value.scrollbar,
12135
12141
  order: "after"
12136
12142
  }
@@ -12167,7 +12173,7 @@ const _scroll = definePlugin((editor) => {
12167
12173
  // },
12168
12174
  };
12169
12175
  });
12170
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
12176
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
12171
12177
  __name: "ScrollToSelection",
12172
12178
  setup(__props) {
12173
12179
  const {
@@ -12185,7 +12191,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
12185
12191
  class: "mce-scroll-to-selection",
12186
12192
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
12187
12193
  }, [
12188
- createVNode(unref(_sfc_main$C), { icon: "$gps" }),
12194
+ createVNode(unref(_sfc_main$D), { icon: "$gps" }),
12189
12195
  createElementVNode("span", null, toDisplayString(unref(t)("scrollToSelection")), 1)
12190
12196
  ])) : createCommentVNode("", true);
12191
12197
  };
@@ -12207,7 +12213,7 @@ const _hoisted_10$1 = {
12207
12213
  key: 0,
12208
12214
  class: "mce-transform-controls__tip"
12209
12215
  };
12210
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
12216
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
12211
12217
  __name: "TransformControls",
12212
12218
  props: /* @__PURE__ */ mergeModels({
12213
12219
  tag: { default: "div" },
@@ -12857,8 +12863,202 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
12857
12863
  };
12858
12864
  }
12859
12865
  });
12860
- const _hoisted_1$d = { class: "mce-selection" };
12866
+ const _hoisted_1$d = { class: "mce-cropper" };
12867
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
12868
+ __name: "Cropper",
12869
+ props: /* @__PURE__ */ mergeModels({
12870
+ image: {},
12871
+ minScale: { default: 0.1 },
12872
+ maxScale: { default: 3 }
12873
+ }, {
12874
+ "modelValue": { default: () => ({}) },
12875
+ "modelModifiers": {},
12876
+ "style": { default: () => ({}) },
12877
+ "styleModifiers": {}
12878
+ }),
12879
+ emits: /* @__PURE__ */ mergeModels(["start", "end", "update:transform"], ["update:modelValue", "update:style"]),
12880
+ setup(__props, { emit: __emit }) {
12881
+ const props = __props;
12882
+ const emit = __emit;
12883
+ const cropRect = useModel(__props, "modelValue");
12884
+ const styleModel = useModel(__props, "style");
12885
+ const rootBox = ref({ width: 0, height: 0 });
12886
+ const { state: imageRef } = useImage(
12887
+ computed(() => ({
12888
+ src: props.image
12889
+ }))
12890
+ );
12891
+ const backup = cloneDeep(cropRect.value);
12892
+ const canvasRef = useTemplateRef("canvasRef");
12893
+ const computedCropRect = computed({
12894
+ get: () => {
12895
+ const { left = 0, top = 0, right = 0, bottom = 0 } = cropRect.value;
12896
+ return { left, top, right, bottom };
12897
+ },
12898
+ set: (val) => cropRect.value = val
12899
+ });
12900
+ const inverseMat = computed(() => {
12901
+ const { left, top, right, bottom } = computedCropRect.value;
12902
+ const sx = 1 / (1 - left - right);
12903
+ const sy = 1 / (1 - top - bottom);
12904
+ const tx = -left;
12905
+ const ty = -top;
12906
+ return { sx, sy, tx, ty };
12907
+ });
12908
+ const sourceTransform = computed({
12909
+ get: () => {
12910
+ const { sx, sy, tx, ty } = inverseMat.value;
12911
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12912
+ const { width, height } = rootBox.value;
12913
+ return {
12914
+ width: sx * width,
12915
+ height: sy * height,
12916
+ left: tx * scaleX * (sx * width),
12917
+ top: ty * scaleY * (sy * height)
12918
+ };
12919
+ },
12920
+ set: (newValue) => {
12921
+ const { width, height } = rootBox.value;
12922
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12923
+ const transform = {
12924
+ sx: newValue.width / width,
12925
+ sy: newValue.height / height,
12926
+ tx: newValue.left / newValue.width / scaleX,
12927
+ ty: newValue.top / newValue.height / scaleY
12928
+ };
12929
+ const left = -transform.tx;
12930
+ const top = -transform.ty;
12931
+ const w = 1 - 1 / transform.sx;
12932
+ const h2 = 1 - 1 / transform.sy;
12933
+ const right = w - left;
12934
+ const bottom = h2 - top;
12935
+ computedCropRect.value = { left, top, right, bottom };
12936
+ }
12937
+ });
12938
+ const scale = computed({
12939
+ get: () => inverseMat.value.sx,
12940
+ set: (value) => {
12941
+ const transform = inverseMat.value;
12942
+ const rate = transform.sx / value;
12943
+ const left = -transform.tx;
12944
+ const top = -transform.ty;
12945
+ const w = 1 - 1 / value;
12946
+ const h2 = 1 - 1 / transform.sy * rate;
12947
+ const right = w - left;
12948
+ const bottom = h2 - top;
12949
+ computedCropRect.value = { left, top, right, bottom };
12950
+ }
12951
+ });
12952
+ onBeforeMount(() => emit("start"));
12953
+ onBeforeUnmount(() => emit("end"));
12954
+ const sourceStyle = computed(() => {
12955
+ const { sx, sy, tx, ty } = inverseMat.value;
12956
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12957
+ return {
12958
+ transform: [
12959
+ `scale(${sx}, ${sy})`,
12960
+ `translate(${tx * scaleX * 100}%, ${ty * scaleY * 100}%)`
12961
+ ].join(" ")
12962
+ };
12963
+ });
12964
+ watch([canvasRef, imageRef], render2);
12965
+ watch(computedCropRect, render2, { deep: true });
12966
+ watch([() => styleModel.value.scaleX, () => styleModel.value.scaleY], render2);
12967
+ function render2() {
12968
+ const ctx = canvasRef.value?.getContext("2d");
12969
+ if (!ctx || !imageRef.value)
12970
+ return;
12971
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12972
+ const { naturalWidth, naturalHeight } = imageRef.value;
12973
+ ctx.canvas.width = naturalWidth;
12974
+ ctx.canvas.height = naturalHeight;
12975
+ ctx.clearRect(0, 0, naturalWidth, naturalHeight);
12976
+ ctx.globalAlpha = 0.4;
12977
+ ctx.scale(scaleX, scaleY);
12978
+ ctx.drawImage(imageRef.value, 0, 0, naturalWidth, naturalHeight);
12979
+ }
12980
+ function ok() {
12981
+ emit("end");
12982
+ }
12983
+ function cancel() {
12984
+ cropRect.value = backup;
12985
+ ok();
12986
+ }
12987
+ function onResizeObserver(entries) {
12988
+ const { width, height } = entries[0].contentRect;
12989
+ rootBox.value = { width, height };
12990
+ }
12991
+ function applySourceTransformToStyle() {
12992
+ const { left = 0, top = 0, width = 0, height = 0 } = styleModel.value;
12993
+ const { sx, sy, tx, ty } = inverseMat.value;
12994
+ cropRect.value = {};
12995
+ styleModel.value = {
12996
+ ...styleModel.value,
12997
+ width: sx * width,
12998
+ height: sy * height,
12999
+ left: left + tx * (sx * width),
13000
+ top: top + ty * (sy * height)
13001
+ };
13002
+ ok();
13003
+ }
13004
+ return (_ctx, _cache) => {
13005
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$d, [
13006
+ createElementVNode("div", {
13007
+ class: "mce-cropper__source",
13008
+ style: normalizeStyle$1(sourceStyle.value)
13009
+ }, [
13010
+ createElementVNode("canvas", {
13011
+ ref_key: "canvasRef",
13012
+ ref: canvasRef
13013
+ }, null, 512)
13014
+ ], 4),
13015
+ createVNode(_sfc_main$l, {
13016
+ modelValue: sourceTransform.value,
13017
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
13018
+ class: "mce-cropper__transform",
13019
+ rotatable: false
13020
+ }, {
13021
+ default: withCtx(({ props: slotProps }) => [
13022
+ createElementVNode("div", mergeProps({ class: "mce-cropper__transform_rect" }, slotProps), null, 16)
13023
+ ]),
13024
+ _: 1
13025
+ }, 8, ["modelValue"]),
13026
+ renderSlot(_ctx.$slots, "default", {
13027
+ scale: scale.value,
13028
+ ok,
13029
+ cancel,
13030
+ applySourceTransformToStyle
13031
+ })
13032
+ ])), [
13033
+ [unref(vResizeObserver), onResizeObserver]
13034
+ ]);
13035
+ };
13036
+ }
13037
+ });
12861
13038
  const _sfc_main$j = /* @__PURE__ */ defineComponent({
13039
+ __name: "ForegroundCropper",
13040
+ setup(__props) {
13041
+ const {
13042
+ state,
13043
+ elementSelection
13044
+ } = useEditor();
13045
+ const element = computed(() => elementSelection.value[0]);
13046
+ return (_ctx, _cache) => {
13047
+ return unref(state) === "cropping" && element.value?.foreground.isValid() ? (openBlock(), createBlock(_sfc_main$k, {
13048
+ key: 0,
13049
+ modelValue: element.value.foreground.cropRect,
13050
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => element.value.foreground.cropRect = $event),
13051
+ style: normalizeStyle$1(element.value.style.toJSON()),
13052
+ image: element.value.foreground.image,
13053
+ class: "pointer-events-auto",
13054
+ "onUpdate:style": _cache[1] || (_cache[1] = (val) => element.value.style.setProperties(val)),
13055
+ onEnd: _cache[2] || (_cache[2] = () => state.value = void 0)
13056
+ }, null, 8, ["modelValue", "style", "image"])) : createCommentVNode("", true);
13057
+ };
13058
+ }
13059
+ });
13060
+ const _hoisted_1$c = { class: "mce-selection" };
13061
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
12862
13062
  __name: "Selection",
12863
13063
  setup(__props, { expose: __expose }) {
12864
13064
  const {
@@ -13091,7 +13291,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
13091
13291
  transformControls
13092
13292
  });
13093
13293
  return (_ctx, _cache) => {
13094
- return openBlock(), createElementBlock("div", _hoisted_1$d, [
13294
+ return openBlock(), createElementBlock("div", _hoisted_1$c, [
13095
13295
  (openBlock(true), createElementBlock(Fragment, null, renderList(parentObbStyles.value, (style, index) => {
13096
13296
  return openBlock(), createElementBlock("div", {
13097
13297
  key: index,
@@ -13120,7 +13320,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
13120
13320
  ...unref(selectionArea).toCssStyle()
13121
13321
  })
13122
13322
  }, null, 4)) : createCommentVNode("", true),
13123
- transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
13323
+ transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
13124
13324
  key: 2,
13125
13325
  ref: "transformControlsTpl"
13126
13326
  }, unref(config).transformControls, {
@@ -13141,18 +13341,19 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
13141
13341
  }), createSlots({ _: 2 }, [
13142
13342
  _ctx.$slots.transform ? {
13143
13343
  name: "svg",
13144
- fn: withCtx((slotProps) => [
13145
- renderSlot(_ctx.$slots, "transform", normalizeProps(guardReactiveProps(slotProps)))
13344
+ fn: withCtx(() => [
13345
+ renderSlot(_ctx.$slots, "transform")
13146
13346
  ]),
13147
13347
  key: "0"
13148
13348
  } : void 0
13149
13349
  ]), 1040, ["modelValue", "movable", "resizable", "rotatable", "roundable", "resize-strategy", "scale", "offset"])) : createCommentVNode("", true),
13150
- transform.value.width && transform.value.height && _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
13350
+ transform.value.width && transform.value.height ? (openBlock(), createElementBlock("div", {
13151
13351
  key: 3,
13152
13352
  class: "mce-selection__slot",
13153
13353
  style: normalizeStyle$1(unref(selectionObbInDrawboard).toCssStyle())
13154
13354
  }, [
13155
- renderSlot(_ctx.$slots, "default", { transform: transform.value })
13355
+ createVNode(_sfc_main$j),
13356
+ renderSlot(_ctx.$slots, "default")
13156
13357
  ], 4)) : createCommentVNode("", true)
13157
13358
  ]);
13158
13359
  };
@@ -13353,8 +13554,8 @@ const _selection = definePlugin((editor) => {
13353
13554
  }
13354
13555
  },
13355
13556
  components: [
13356
- { slot: "selection", type: "overlay", component: _sfc_main$j },
13357
- { type: "overlay", component: _sfc_main$l }
13557
+ { slot: "selection", type: "overlay", component: _sfc_main$i },
13558
+ { type: "overlay", component: _sfc_main$m }
13358
13559
  ]
13359
13560
  };
13360
13561
  });
@@ -13629,15 +13830,15 @@ const _slice = definePlugin((editor) => {
13629
13830
  ]
13630
13831
  };
13631
13832
  });
13632
- const _hoisted_1$c = { class: "mce-smart-guides" };
13633
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
13833
+ const _hoisted_1$b = { class: "mce-smart-guides" };
13834
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
13634
13835
  __name: "SmartGuides",
13635
13836
  props: {
13636
13837
  snapLines: {}
13637
13838
  },
13638
13839
  setup(__props) {
13639
13840
  return (_ctx, _cache) => {
13640
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
13841
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
13641
13842
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.snapLines, (item, key) => {
13642
13843
  return openBlock(), createElementBlock("div", {
13643
13844
  key,
@@ -14602,7 +14803,6 @@ const _smartGuides = definePlugin((editor) => {
14602
14803
  viewportAabb
14603
14804
  } = editor;
14604
14805
  const snapThreshold = computed(() => Math.max(1, 5 / camera.value.zoom.x));
14605
- const excluded = computed(() => new Set(elementSelection.value.map((el) => el.id)));
14606
14806
  const parnet = computed(() => elementSelection.value[0]?.parent ?? root.value);
14607
14807
  const parentBox = computed(() => createBox(parnet.value));
14608
14808
  function createBox(node) {
@@ -14720,8 +14920,9 @@ const _smartGuides = definePlugin((editor) => {
14720
14920
  const _linePairs = [];
14721
14921
  const box = createBox(selectionAabb.value);
14722
14922
  if (box) {
14923
+ const excluded = new Set(elementSelection.value.map((el) => el.instanceId));
14723
14924
  const boxes = parnet.value.children.filter((node) => {
14724
- return !excluded.value.has(node.id) && isElement(node) && viewportAabb.value.overlap(node.getGlobalAabb());
14925
+ return !excluded.has(node.instanceId) && isElement(node) && viewportAabb.value.overlap(node.getGlobalAabb());
14725
14926
  }).map((node) => createBox(node)).filter(Boolean);
14726
14927
  const { vLines, hLines } = boxes.reduce(
14727
14928
  (store, box2) => {
@@ -14952,7 +15153,7 @@ const _smartGuides = definePlugin((editor) => {
14952
15153
  components: [
14953
15154
  {
14954
15155
  type: "overlay",
14955
- component: () => h(_sfc_main$i, { snapLines: snapLines.value })
15156
+ component: () => h(_sfc_main$h, { snapLines: snapLines.value })
14956
15157
  }
14957
15158
  ]
14958
15159
  };
@@ -14983,12 +15184,12 @@ function flipType(type) {
14983
15184
  function isLeftTopLine(line) {
14984
15185
  return ["vt", "hl"].includes(line.type);
14985
15186
  }
14986
- const _hoisted_1$b = {
15187
+ const _hoisted_1$a = {
14987
15188
  key: 0,
14988
15189
  class: "mce-smart-selection"
14989
15190
  };
14990
- const _hoisted_2$6 = ["onClick"];
14991
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
15191
+ const _hoisted_2$6 = ["onMousedown"];
15192
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
14992
15193
  __name: "SmartSelection",
14993
15194
  props: {
14994
15195
  "modelValue": {},
@@ -14998,16 +15199,19 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14998
15199
  setup(__props) {
14999
15200
  const currentElement = useModel(__props, "modelValue");
15000
15201
  const {
15202
+ isPointerInSelection,
15001
15203
  elementSelection,
15002
15204
  getObb,
15003
15205
  getAabb,
15004
15206
  state,
15005
15207
  camera,
15006
15208
  resizeElement,
15007
- inEditorIs
15209
+ inEditorIs,
15210
+ getGlobalPointer
15008
15211
  } = useEditor();
15009
15212
  const info = ref({
15010
15213
  active: false,
15214
+ direction: void 0,
15011
15215
  spacing: void 0,
15012
15216
  xItems: [],
15013
15217
  yItems: []
@@ -15018,6 +15222,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15018
15222
  }
15019
15223
  const els = elementSelection.value;
15020
15224
  let active = false;
15225
+ let direction;
15021
15226
  let spacing;
15022
15227
  let xItems = [];
15023
15228
  let yItems = [];
@@ -15044,6 +15249,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15044
15249
  }
15045
15250
  if (active) {
15046
15251
  yItems = sorted;
15252
+ direction = "vertical";
15047
15253
  } else {
15048
15254
  active = true;
15049
15255
  prev = void 0;
@@ -15067,23 +15273,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15067
15273
  }
15068
15274
  if (active) {
15069
15275
  xItems = sorted2;
15276
+ direction = "horizontal";
15070
15277
  }
15071
15278
  }
15072
15279
  }
15073
15280
  info.value = {
15074
15281
  active,
15282
+ direction,
15075
15283
  spacing,
15076
15284
  xItems,
15077
15285
  yItems
15078
15286
  };
15079
15287
  }
15080
15288
  watch(() => elementSelection.value.map((el) => getAabb(el)), update);
15081
- watch(
15082
- state,
15083
- () => {
15084
- currentElement.value = void 0;
15085
- }
15086
- );
15289
+ watch(elementSelection, () => currentElement.value = void 0);
15087
15290
  const handles = computed(() => {
15088
15291
  return elementSelection.value.map((el) => {
15089
15292
  return {
@@ -15156,23 +15359,31 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15156
15359
  });
15157
15360
  }
15158
15361
  });
15362
+ function onMouseDown(item, downEvent) {
15363
+ const el = item.el;
15364
+ currentElement.value = el;
15365
+ return;
15366
+ }
15159
15367
  return (_ctx, _cache) => {
15160
- return info.value.active ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
15368
+ return info.value.active ? (openBlock(), createElementBlock("div", _hoisted_1$a, [
15161
15369
  (openBlock(true), createElementBlock(Fragment, null, renderList(handles.value, (item, index) => {
15162
15370
  return openBlock(), createElementBlock("div", {
15163
15371
  key: index,
15164
15372
  class: normalizeClass(["mce-smart-handle", {
15165
15373
  "mce-smart-handle--active": item.el.equal(currentElement.value)
15166
15374
  }]),
15167
- style: normalizeStyle$1(item.style)
15375
+ style: normalizeStyle$1(item.style),
15376
+ "data-pointerdown_to_drawboard": ""
15168
15377
  }, [
15169
15378
  createElementVNode("div", {
15170
- class: "mce-smart-handle__btn",
15171
- onClick: ($event) => currentElement.value = item.el
15172
- }, null, 8, _hoisted_2$6)
15379
+ class: normalizeClass(["mce-smart-handle__btn", {
15380
+ "mce-smart-handle__btn--active": unref(state) === "transforming" || unref(isPointerInSelection)
15381
+ }]),
15382
+ onMousedown: ($event) => onMouseDown(item)
15383
+ }, null, 42, _hoisted_2$6)
15173
15384
  ], 6);
15174
15385
  }), 128)),
15175
- transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$k, {
15386
+ transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$l, {
15176
15387
  key: 0,
15177
15388
  modelValue: transform.value,
15178
15389
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => transform.value = $event),
@@ -15199,7 +15410,7 @@ const _smartSelection = definePlugin((_editor) => {
15199
15410
  components: [
15200
15411
  {
15201
15412
  type: "overlay",
15202
- component: () => h(_sfc_main$h, {
15413
+ component: () => h(_sfc_main$g, {
15203
15414
  "modelValue": currentElement.value,
15204
15415
  "onUpdate:modelValue": (el) => currentElement.value = el
15205
15416
  })
@@ -15222,7 +15433,7 @@ const _state = definePlugin((editor) => {
15222
15433
  ]
15223
15434
  };
15224
15435
  });
15225
- const _hoisted_1$a = { class: "progress-indicator" };
15436
+ const _hoisted_1$9 = { class: "progress-indicator" };
15226
15437
  const _hoisted_2$5 = {
15227
15438
  key: 0,
15228
15439
  class: "progress-indicator__status"
@@ -15232,7 +15443,7 @@ const _hoisted_4$2 = {
15232
15443
  key: 1,
15233
15444
  class: "progress-indicator__bar-indeterminate"
15234
15445
  };
15235
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
15446
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15236
15447
  __name: "ProgressIndicator",
15237
15448
  props: /* @__PURE__ */ mergeModels({
15238
15449
  label: {},
@@ -15245,7 +15456,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
15245
15456
  setup(__props) {
15246
15457
  const progress = useModel(__props, "modelValue");
15247
15458
  return (_ctx, _cache) => {
15248
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
15459
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
15249
15460
  __props.label ? (openBlock(), createElementBlock("span", _hoisted_2$5, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
15250
15461
  createElementVNode("div", _hoisted_3$5, [
15251
15462
  !__props.indeterminate ? (openBlock(), createElementBlock("div", {
@@ -15258,8 +15469,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
15258
15469
  };
15259
15470
  }
15260
15471
  });
15261
- const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-3b286483"]]);
15262
- const _hoisted_1$9 = { class: "mce-statusbar" };
15472
+ const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-3b286483"]]);
15473
+ const _hoisted_1$8 = { class: "mce-statusbar" };
15263
15474
  const _hoisted_2$4 = { class: "mce-statusbar__main" };
15264
15475
  const _hoisted_3$4 = { class: "mce-statusbar__item" };
15265
15476
  const _hoisted_4$1 = { class: "mce-statusbar__kbd" };
@@ -15281,7 +15492,7 @@ const _hoisted_19 = { class: "mce-statusbar__kbd" };
15281
15492
  const _hoisted_20 = { class: "mce-statusbar__item" };
15282
15493
  const _hoisted_21 = { class: "mce-statusbar__item" };
15283
15494
  const _hoisted_22 = { class: "mce-statusbar__progress" };
15284
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
15495
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15285
15496
  __name: "Statusbar",
15286
15497
  setup(__props) {
15287
15498
  const {
@@ -15294,7 +15505,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15294
15505
  isElement
15295
15506
  } = useEditor();
15296
15507
  return (_ctx, _cache) => {
15297
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
15508
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
15298
15509
  createElementVNode("div", _hoisted_2$4, [
15299
15510
  unref(state) === "typing" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
15300
15511
  createElementVNode("div", _hoisted_3$4, [
@@ -15308,7 +15519,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15308
15519
  ])
15309
15520
  ], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
15310
15521
  createElementVNode("div", _hoisted_8, [
15311
- createVNode(unref(_sfc_main$C), { icon: "$mouseRightClick" })
15522
+ createVNode(unref(_sfc_main$D), { icon: "$mouseRightClick" })
15312
15523
  ]),
15313
15524
  _cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
15314
15525
  createElementVNode("div", _hoisted_9, [
@@ -15322,7 +15533,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15322
15533
  ])
15323
15534
  ], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
15324
15535
  createElementVNode("div", _hoisted_14, [
15325
- createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
15536
+ createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
15326
15537
  createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
15327
15538
  ]),
15328
15539
  _cache[5] || (_cache[5] = createElementVNode("span", null, " + ", -1)),
@@ -15332,7 +15543,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15332
15543
  ]),
15333
15544
  _cache[6] || (_cache[6] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
15334
15545
  createElementVNode("div", _hoisted_17, [
15335
- createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
15546
+ createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
15336
15547
  createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
15337
15548
  ]),
15338
15549
  _cache[7] || (_cache[7] = createElementVNode("span", null, " + ", -1)),
@@ -15342,7 +15553,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15342
15553
  ]),
15343
15554
  _cache[8] || (_cache[8] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
15344
15555
  createElementVNode("div", _hoisted_20, [
15345
- createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
15556
+ createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
15346
15557
  createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
15347
15558
  ]),
15348
15559
  unref(selection).length === 1 && unref(isElement)(unref(selection)[0]) && unref(selection)[0].text.isValid() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
@@ -15366,7 +15577,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15366
15577
  };
15367
15578
  }
15368
15579
  });
15369
- const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-a1f0e31b"]]);
15580
+ const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-a1f0e31b"]]);
15370
15581
  const _statusbar = definePlugin((editor) => {
15371
15582
  const {
15372
15583
  registerConfig
@@ -15385,7 +15596,7 @@ const _statusbar = definePlugin((editor) => {
15385
15596
  ]
15386
15597
  };
15387
15598
  });
15388
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
15599
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
15389
15600
  __name: "TextEditor",
15390
15601
  setup(__props, { expose: __expose }) {
15391
15602
  const {
@@ -15556,23 +15767,23 @@ const _text = definePlugin((editor) => {
15556
15767
  { command: "setActiveDrawingTool:text", key: "T" }
15557
15768
  ],
15558
15769
  components: [
15559
- { type: "overlay", component: _sfc_main$e }
15770
+ { type: "overlay", component: _sfc_main$d }
15560
15771
  ]
15561
15772
  };
15562
15773
  });
15563
- const _hoisted_1$8 = { class: "mce-payhead" };
15564
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
15774
+ const _hoisted_1$7 = { class: "mce-payhead" };
15775
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15565
15776
  __name: "Playhead",
15566
15777
  setup(__props) {
15567
15778
  return (_ctx, _cache) => {
15568
- return openBlock(), createElementBlock("div", _hoisted_1$8, [..._cache[0] || (_cache[0] = [
15779
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [..._cache[0] || (_cache[0] = [
15569
15780
  createElementVNode("header", { class: "mce-payhead__header" }, null, -1),
15570
15781
  createElementVNode("main", { class: "mce-payhead__main" }, null, -1)
15571
15782
  ])]);
15572
15783
  };
15573
15784
  }
15574
15785
  });
15575
- const _hoisted_1$7 = {
15786
+ const _hoisted_1$6 = {
15576
15787
  key: 0,
15577
15788
  class: "mce-segment__edge mce-segment__edge--front"
15578
15789
  };
@@ -15584,7 +15795,7 @@ const _hoisted_3$3 = {
15584
15795
  key: 1,
15585
15796
  class: "mce-segment__edge mce-segment__edge--end"
15586
15797
  };
15587
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
15798
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
15588
15799
  __name: "Segment",
15589
15800
  props: {
15590
15801
  node: {},
@@ -15650,25 +15861,25 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15650
15861
  style: normalizeStyle$1(block.style)
15651
15862
  }, toDisplayString(block.name), 5);
15652
15863
  }), 128)),
15653
- __props.active ? (openBlock(), createElementBlock("div", _hoisted_1$7)) : createCommentVNode("", true),
15864
+ __props.active ? (openBlock(), createElementBlock("div", _hoisted_1$6)) : createCommentVNode("", true),
15654
15865
  createElementVNode("span", _hoisted_2$3, toDisplayString(props.node.name), 1),
15655
15866
  __props.active ? (openBlock(), createElementBlock("div", _hoisted_3$3)) : createCommentVNode("", true)
15656
15867
  ], 6);
15657
15868
  };
15658
15869
  }
15659
15870
  });
15660
- const _hoisted_1$6 = { class: "mce-track" };
15661
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
15871
+ const _hoisted_1$5 = { class: "mce-track" };
15872
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15662
15873
  __name: "Track",
15663
15874
  setup(__props) {
15664
15875
  return (_ctx, _cache) => {
15665
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
15876
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
15666
15877
  renderSlot(_ctx.$slots, "default")
15667
15878
  ]);
15668
15879
  };
15669
15880
  }
15670
15881
  });
15671
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
15882
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15672
15883
  __name: "Trackhead",
15673
15884
  props: {
15674
15885
  node: {}
@@ -15684,14 +15895,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15684
15895
  };
15685
15896
  }
15686
15897
  });
15687
- const _hoisted_1$5 = { class: "mce-timeline__toolbar" };
15898
+ const _hoisted_1$4 = { class: "mce-timeline__toolbar" };
15688
15899
  const _hoisted_2$2 = { class: "mce-timeline__main" };
15689
15900
  const _hoisted_3$2 = { class: "mce-timeline__left" };
15690
15901
  const _hoisted_4 = { class: "mce-timeline__left-wrapper" };
15691
15902
  const _hoisted_5 = { class: "mce-timeline__right-wrapper" };
15692
15903
  const _hoisted_6 = { class: "mce-timeline__ruler" };
15693
15904
  const _hoisted_7 = { class: "mce-timeline__track" };
15694
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15905
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15695
15906
  __name: "Timeline",
15696
15907
  setup(__props) {
15697
15908
  const {
@@ -15792,12 +16003,12 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15792
16003
  onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
15793
16004
  }, ["prevent"]))
15794
16005
  }, [
15795
- createElementVNode("div", _hoisted_1$5, [
16006
+ createElementVNode("div", _hoisted_1$4, [
15796
16007
  createElementVNode("div", {
15797
16008
  class: "mce-timeline__play",
15798
16009
  onClick: toggle
15799
16010
  }, [
15800
- createVNode(unref(_sfc_main$C), {
16011
+ createVNode(unref(_sfc_main$D), {
15801
16012
  icon: paused.value ? "$play" : "$pause"
15802
16013
  }, null, 8, ["icon"])
15803
16014
  ])
@@ -15811,7 +16022,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15811
16022
  })
15812
16023
  }, [
15813
16024
  (openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
15814
- return openBlock(), createBlock(_sfc_main$a, {
16025
+ return openBlock(), createBlock(_sfc_main$9, {
15815
16026
  key: index,
15816
16027
  node
15817
16028
  }, null, 8, ["node"]);
@@ -15826,7 +16037,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15826
16037
  }, [
15827
16038
  createElementVNode("div", _hoisted_5, [
15828
16039
  createElementVNode("div", _hoisted_6, [
15829
- createVNode(_sfc_main$p, {
16040
+ createVNode(_sfc_main$q, {
15830
16041
  ref: "rulerTpl",
15831
16042
  zoom: 1 / unref(msPerPx) * fps.value,
15832
16043
  unit: 100,
@@ -15844,9 +16055,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15844
16055
  })
15845
16056
  }, [
15846
16057
  (openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
15847
- return openBlock(), createBlock(_sfc_main$b, { key: index }, {
16058
+ return openBlock(), createBlock(_sfc_main$a, { key: index }, {
15848
16059
  default: withCtx(() => [
15849
- createVNode(_sfc_main$c, {
16060
+ createVNode(_sfc_main$b, {
15850
16061
  node,
15851
16062
  "ms-per-px": unref(msPerPx),
15852
16063
  active: unref(selection).some((v) => v.equal(node)),
@@ -15858,7 +16069,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15858
16069
  }), 128))
15859
16070
  ], 4)
15860
16071
  ]),
15861
- createVNode(_sfc_main$d, {
16072
+ createVNode(_sfc_main$c, {
15862
16073
  style: normalizeStyle$1({
15863
16074
  transform: `translate(${offset2.value[0] + Math.ceil(unref(currentTime) / unref(msPerPx))}px, 0px)`
15864
16075
  })
@@ -15883,7 +16094,7 @@ const _timeline = definePlugin((editor) => {
15883
16094
  type: "panel",
15884
16095
  position: "bottom",
15885
16096
  size: 160,
15886
- component: _sfc_main$9
16097
+ component: _sfc_main$8
15887
16098
  }
15888
16099
  ],
15889
16100
  hotkeys: [
@@ -15891,10 +16102,10 @@ const _timeline = definePlugin((editor) => {
15891
16102
  ]
15892
16103
  };
15893
16104
  });
15894
- const _hoisted_1$4 = { class: "mce-toolbelt" };
16105
+ const _hoisted_1$3 = { class: "mce-toolbelt" };
15895
16106
  const _hoisted_2$1 = { key: 0 };
15896
16107
  const _hoisted_3$1 = { key: 1 };
15897
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16108
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
15898
16109
  __name: "Toolbelt",
15899
16110
  setup(__props) {
15900
16111
  const {
@@ -15993,19 +16204,19 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15993
16204
  ];
15994
16205
  });
15995
16206
  return (_ctx, _cache) => {
15996
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
16207
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
15997
16208
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (tool, key) => {
15998
16209
  return openBlock(), createElementBlock("div", {
15999
16210
  key,
16000
16211
  class: "mce-toolbelt__group"
16001
16212
  }, [
16002
- createVNode(_sfc_main$q, {
16213
+ createVNode(_sfc_main$r, {
16003
16214
  location: "top",
16004
16215
  offset: 12,
16005
16216
  "show-arrow": ""
16006
16217
  }, {
16007
16218
  activator: withCtx(({ props: slotProps }) => [
16008
- createVNode(_sfc_main$y, mergeProps({
16219
+ createVNode(_sfc_main$z, mergeProps({
16009
16220
  icon: "",
16010
16221
  class: "mce-toolbelt__btn",
16011
16222
  active: tool.active || tool.checked || false
@@ -16013,7 +16224,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16013
16224
  onClick: tool.handle
16014
16225
  }), {
16015
16226
  default: withCtx(() => [
16016
- createVNode(unref(_sfc_main$C), {
16227
+ createVNode(unref(_sfc_main$D), {
16017
16228
  icon: `$${tool.key}`
16018
16229
  }, null, 8, ["icon"])
16019
16230
  ]),
@@ -16028,19 +16239,19 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16028
16239
  ]),
16029
16240
  _: 2
16030
16241
  }, 1024),
16031
- tool.children?.length ? (openBlock(), createBlock(_sfc_main$t, {
16242
+ tool.children?.length ? (openBlock(), createBlock(_sfc_main$u, {
16032
16243
  key: 0,
16033
16244
  items: tool.children,
16034
16245
  offset: 12,
16035
16246
  location: "top-start"
16036
16247
  }, {
16037
16248
  activator: withCtx(({ props }) => [
16038
- createVNode(_sfc_main$y, mergeProps({
16249
+ createVNode(_sfc_main$z, mergeProps({
16039
16250
  icon: "",
16040
16251
  class: "mce-toolbelt__arrow"
16041
16252
  }, { ref_for: true }, props), {
16042
16253
  default: withCtx(() => [
16043
- createVNode(unref(_sfc_main$C), { icon: "$arrowDown" })
16254
+ createVNode(unref(_sfc_main$D), { icon: "$arrowDown" })
16044
16255
  ]),
16045
16256
  _: 1
16046
16257
  }, 16)
@@ -16056,7 +16267,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16056
16267
  ], 64)) : createCommentVNode("", true)
16057
16268
  ]),
16058
16269
  prepend: withCtx(({ item }) => [
16059
- createVNode(unref(_sfc_main$C), {
16270
+ createVNode(unref(_sfc_main$D), {
16060
16271
  class: "mce-toolbelt__icon",
16061
16272
  icon: `$${item.key}`
16062
16273
  }, null, 8, ["icon"])
@@ -16080,7 +16291,7 @@ const _toolbelt = definePlugin((editor) => {
16080
16291
  {
16081
16292
  name: "toolbelt",
16082
16293
  type: "overlay",
16083
- component: _sfc_main$8,
16294
+ component: _sfc_main$7,
16084
16295
  ignore: () => !toolbelt.value
16085
16296
  }
16086
16297
  ]
@@ -16585,7 +16796,7 @@ function useEditor() {
16585
16796
  }
16586
16797
  return editor;
16587
16798
  }
16588
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
16799
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16589
16800
  __name: "Floatbar",
16590
16801
  props: {
16591
16802
  ...makeMceOverlayProps({
@@ -16630,7 +16841,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
16630
16841
  updateLocation
16631
16842
  });
16632
16843
  return (_ctx, _cache) => {
16633
- return openBlock(), createBlock(_sfc_main$u, {
16844
+ return openBlock(), createBlock(_sfc_main$v, {
16634
16845
  ref: "overlayTpl",
16635
16846
  "content-style": style.value,
16636
16847
  class: "mce-floatbar",
@@ -16649,11 +16860,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
16649
16860
  };
16650
16861
  }
16651
16862
  });
16652
- const _hoisted_1$3 = {
16863
+ const _hoisted_1$2 = {
16653
16864
  key: 0,
16654
16865
  class: "mce-float-panel__title"
16655
16866
  };
16656
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16867
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
16657
16868
  __name: "FloatPanel",
16658
16869
  props: /* @__PURE__ */ mergeModels({
16659
16870
  title: {},
@@ -16677,7 +16888,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16677
16888
  isActive
16678
16889
  };
16679
16890
  return (_ctx, _cache) => {
16680
- return openBlock(), createBlock(_sfc_main$k, {
16891
+ return openBlock(), createBlock(_sfc_main$l, {
16681
16892
  modelValue: transform.value,
16682
16893
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => transform.value = $event),
16683
16894
  class: "mce-float-panel",
@@ -16687,14 +16898,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16687
16898
  }, {
16688
16899
  default: withCtx(({ props: slotProps }) => [
16689
16900
  createElementVNode("div", mergeProps({ class: "mce-float-panel__card" }, slotProps), [
16690
- __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
16901
+ __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
16691
16902
  createElementVNode("div", null, toDisplayString(__props.title), 1),
16692
- createVNode(_sfc_main$y, {
16903
+ createVNode(_sfc_main$z, {
16693
16904
  icon: "",
16694
16905
  onClick: _cache[0] || (_cache[0] = ($event) => isActive.value = false)
16695
16906
  }, {
16696
16907
  default: withCtx(() => [
16697
- createVNode(unref(_sfc_main$C), { icon: "$close" })
16908
+ createVNode(unref(_sfc_main$D), { icon: "$close" })
16698
16909
  ]),
16699
16910
  _: 1
16700
16911
  })
@@ -16713,7 +16924,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16713
16924
  };
16714
16925
  }
16715
16926
  });
16716
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
16927
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16717
16928
  __name: "Layout",
16718
16929
  props: {
16719
16930
  class: [String, Array, Object],
@@ -16747,7 +16958,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
16747
16958
  };
16748
16959
  }
16749
16960
  });
16750
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16961
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16751
16962
  __name: "LayoutItem",
16752
16963
  props: {
16753
16964
  class: [String, Array, Object],
@@ -16793,11 +17004,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16793
17004
  };
16794
17005
  }
16795
17006
  });
16796
- const _hoisted_1$2 = {
17007
+ const _hoisted_1$1 = {
16797
17008
  key: 0,
16798
17009
  class: "mce-main__scroller"
16799
17010
  };
16800
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
17011
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
16801
17012
  __name: "Main",
16802
17013
  props: {
16803
17014
  scrollable: Boolean
@@ -16812,14 +17023,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16812
17023
  ]]),
16813
17024
  style: normalizeStyle$1([unref(mainStyles)])
16814
17025
  }, [
16815
- props.scrollable ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
17026
+ props.scrollable ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
16816
17027
  renderSlot(_ctx.$slots, "default")
16817
17028
  ])) : renderSlot(_ctx.$slots, "default", { key: 1 })
16818
17029
  ], 6);
16819
17030
  };
16820
17031
  }
16821
17032
  });
16822
- const _hoisted_1$1 = ["data-pixel-ratio"];
17033
+ const _hoisted_1 = ["data-pixel-ratio"];
16823
17034
  const _hoisted_2 = {
16824
17035
  ref: "canvasTpl",
16825
17036
  class: "mce-editor__canvas"
@@ -16828,7 +17039,7 @@ const _hoisted_3 = {
16828
17039
  ref: "overlayContainerTpl",
16829
17040
  class: "mce-overlay-container"
16830
17041
  };
16831
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17042
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16832
17043
  __name: "EditorLayout",
16833
17044
  props: {
16834
17045
  ...makeMceStrategyProps({
@@ -17188,7 +17399,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17188
17399
  editor
17189
17400
  };
17190
17401
  return (_ctx, _cache) => {
17191
- return openBlock(), createBlock(_sfc_main$5, {
17402
+ return openBlock(), createBlock(_sfc_main$4, {
17192
17403
  class: normalizeClass(["mce-editor", [
17193
17404
  unref(state) && `mce-editor--${unref(state)}`,
17194
17405
  unref(activeDrawingTool) && `mce-editor--drawing-tool-${unref(activeDrawingTool).name}`,
@@ -17196,7 +17407,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17196
17407
  ]])
17197
17408
  }, {
17198
17409
  default: withCtx(() => [
17199
- createVNode(_sfc_main$3, null, {
17410
+ createVNode(_sfc_main$2, null, {
17200
17411
  default: withCtx(() => [
17201
17412
  createElementVNode("div", {
17202
17413
  ref_key: "drawboardDom",
@@ -17209,7 +17420,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17209
17420
  }, ["prevent"]))
17210
17421
  }, [
17211
17422
  createElementVNode("canvas", _hoisted_2, null, 512),
17212
- slots["floatbar-top"] || slots.floatbar ? (openBlock(), createBlock(_sfc_main$7, {
17423
+ slots["floatbar-top"] || slots.floatbar ? (openBlock(), createBlock(_sfc_main$6, {
17213
17424
  key: 0,
17214
17425
  location: "top-start",
17215
17426
  target: unref(state) === "typing" ? unref(componentRefs)["mce:text"]?.[0]?.textEditor : unref(componentRefs)["mce:selection"]?.[0]?.transformControls?.$el,
@@ -17221,7 +17432,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17221
17432
  ]),
17222
17433
  _: 3
17223
17434
  }, 8, ["target"])) : createCommentVNode("", true),
17224
- slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$7, {
17435
+ slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$6, {
17225
17436
  key: 1,
17226
17437
  location: "bottom-start",
17227
17438
  target: unref(componentRefs)["mce:selection"]?.[0]?.transformControls?.$el,
@@ -17233,15 +17444,23 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17233
17444
  _: 3
17234
17445
  }, 8, ["target"])) : createCommentVNode("", true),
17235
17446
  renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
17236
- ], 40, _hoisted_1$1)
17447
+ ], 40, _hoisted_1)
17237
17448
  ]),
17238
17449
  _: 3
17239
17450
  }),
17451
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps))),
17240
17452
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(components), (item, key) => {
17241
17453
  return openBlock(), createElementBlock(Fragment, { key }, [
17242
- item.type === "panel" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
17454
+ item.type === "overlay" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
17455
+ unref(drawboardDom) ? (openBlock(), createBlock(Teleport, {
17456
+ key: 0,
17457
+ to: unref(drawboardDom)
17458
+ }, [
17459
+ createVNode(RenderComponent, { item }, null, 8, ["item"])
17460
+ ], 8, ["to"])) : createCommentVNode("", true)
17461
+ ], 64)) : item.type === "panel" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
17243
17462
  item.position === "float" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
17244
- unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$6, {
17463
+ unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$5, {
17245
17464
  key: 0,
17246
17465
  modelValue: unref(config)[item.name],
17247
17466
  "onUpdate:modelValue": ($event) => unref(config)[item.name] = $event,
@@ -17263,7 +17482,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17263
17482
  _: 2
17264
17483
  }, 1032, ["modelValue", "onUpdate:modelValue", "title", "default-transform"])) : createCommentVNode("", true)
17265
17484
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
17266
- unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$4, {
17485
+ unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$3, {
17267
17486
  key: 0,
17268
17487
  modelValue: unref(config)[item.name],
17269
17488
  "onUpdate:modelValue": ($event) => unref(config)[item.name] = $event,
@@ -17277,196 +17496,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17277
17496
  _: 2
17278
17497
  }, 1032, ["modelValue", "onUpdate:modelValue", "position", "size", "order"])) : createCommentVNode("", true)
17279
17498
  ], 64))
17280
- ], 64)) : item.type === "overlay" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
17281
- unref(drawboardDom) ? (openBlock(), createBlock(Teleport, {
17282
- key: 0,
17283
- to: unref(drawboardDom)
17284
- }, [
17285
- createVNode(RenderComponent, { item }, null, 8, ["item"])
17286
- ], 8, ["to"])) : createCommentVNode("", true)
17287
17499
  ], 64)) : createCommentVNode("", true)
17288
17500
  ], 64);
17289
17501
  }), 128)),
17290
- createElementVNode("div", _hoisted_3, null, 512),
17291
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)))
17502
+ createElementVNode("div", _hoisted_3, null, 512)
17292
17503
  ]),
17293
17504
  _: 3
17294
17505
  }, 8, ["class"]);
17295
17506
  };
17296
17507
  }
17297
17508
  });
17298
- const _hoisted_1 = { class: "mce-cropper" };
17299
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17300
- __name: "Cropper",
17301
- props: /* @__PURE__ */ mergeModels({
17302
- image: {},
17303
- minScale: { default: 0.1 },
17304
- maxScale: { default: 3 }
17305
- }, {
17306
- "modelValue": { default: () => ({}) },
17307
- "modelModifiers": {},
17308
- "style": { default: () => ({}) },
17309
- "styleModifiers": {}
17310
- }),
17311
- emits: /* @__PURE__ */ mergeModels(["start", "end", "update:transform"], ["update:modelValue", "update:style"]),
17312
- setup(__props, { emit: __emit }) {
17313
- const props = __props;
17314
- const emit = __emit;
17315
- const cropRect = useModel(__props, "modelValue");
17316
- const styleModel = useModel(__props, "style");
17317
- const rootBox = ref({ width: 0, height: 0 });
17318
- const { state: imageRef } = useImage(
17319
- computed(() => ({
17320
- src: props.image
17321
- }))
17322
- );
17323
- const backup = cloneDeep(cropRect.value);
17324
- const canvasRef = useTemplateRef("canvasRef");
17325
- const computedCropRect = computed({
17326
- get: () => {
17327
- const { left = 0, top = 0, right = 0, bottom = 0 } = cropRect.value;
17328
- return { left, top, right, bottom };
17329
- },
17330
- set: (val) => cropRect.value = val
17331
- });
17332
- const inverseMat = computed(() => {
17333
- const { left, top, right, bottom } = computedCropRect.value;
17334
- const sx = 1 / (1 - left - right);
17335
- const sy = 1 / (1 - top - bottom);
17336
- const tx = -left;
17337
- const ty = -top;
17338
- return { sx, sy, tx, ty };
17339
- });
17340
- const sourceTransform = computed({
17341
- get: () => {
17342
- const { sx, sy, tx, ty } = inverseMat.value;
17343
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17344
- const { width, height } = rootBox.value;
17345
- return {
17346
- width: sx * width,
17347
- height: sy * height,
17348
- left: tx * scaleX * (sx * width),
17349
- top: ty * scaleY * (sy * height)
17350
- };
17351
- },
17352
- set: (newValue) => {
17353
- const { width, height } = rootBox.value;
17354
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17355
- const transform = {
17356
- sx: newValue.width / width,
17357
- sy: newValue.height / height,
17358
- tx: newValue.left / newValue.width / scaleX,
17359
- ty: newValue.top / newValue.height / scaleY
17360
- };
17361
- const left = -transform.tx;
17362
- const top = -transform.ty;
17363
- const w = 1 - 1 / transform.sx;
17364
- const h2 = 1 - 1 / transform.sy;
17365
- const right = w - left;
17366
- const bottom = h2 - top;
17367
- computedCropRect.value = { left, top, right, bottom };
17368
- }
17369
- });
17370
- const scale = computed({
17371
- get: () => inverseMat.value.sx,
17372
- set: (value) => {
17373
- const transform = inverseMat.value;
17374
- const rate = transform.sx / value;
17375
- const left = -transform.tx;
17376
- const top = -transform.ty;
17377
- const w = 1 - 1 / value;
17378
- const h2 = 1 - 1 / transform.sy * rate;
17379
- const right = w - left;
17380
- const bottom = h2 - top;
17381
- computedCropRect.value = { left, top, right, bottom };
17382
- }
17383
- });
17384
- onBeforeMount(() => emit("start"));
17385
- onBeforeUnmount(() => emit("end"));
17386
- const sourceStyle = computed(() => {
17387
- const { sx, sy, tx, ty } = inverseMat.value;
17388
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17389
- return {
17390
- transform: [
17391
- `scale(${sx}, ${sy})`,
17392
- `translate(${tx * scaleX * 100}%, ${ty * scaleY * 100}%)`
17393
- ].join(" ")
17394
- };
17395
- });
17396
- watch([canvasRef, imageRef], render2);
17397
- watch(computedCropRect, render2, { deep: true });
17398
- watch([() => styleModel.value.scaleX, () => styleModel.value.scaleY], render2);
17399
- function render2() {
17400
- const ctx = canvasRef.value?.getContext("2d");
17401
- if (!ctx || !imageRef.value)
17402
- return;
17403
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17404
- const { naturalWidth, naturalHeight } = imageRef.value;
17405
- ctx.canvas.width = naturalWidth;
17406
- ctx.canvas.height = naturalHeight;
17407
- ctx.clearRect(0, 0, naturalWidth, naturalHeight);
17408
- ctx.globalAlpha = 0.4;
17409
- ctx.scale(scaleX, scaleY);
17410
- ctx.drawImage(imageRef.value, 0, 0, naturalWidth, naturalHeight);
17411
- }
17412
- function ok() {
17413
- emit("end");
17414
- }
17415
- function cancel() {
17416
- cropRect.value = backup;
17417
- ok();
17418
- }
17419
- function onResizeObserver(entries) {
17420
- const { width, height } = entries[0].contentRect;
17421
- rootBox.value = { width, height };
17422
- }
17423
- function applySourceTransformToStyle() {
17424
- const { left = 0, top = 0, width = 0, height = 0 } = styleModel.value;
17425
- const { sx, sy, tx, ty } = inverseMat.value;
17426
- cropRect.value = {};
17427
- styleModel.value = {
17428
- ...styleModel.value,
17429
- width: sx * width,
17430
- height: sy * height,
17431
- left: left + tx * (sx * width),
17432
- top: top + ty * (sy * height)
17433
- };
17434
- ok();
17435
- }
17436
- return (_ctx, _cache) => {
17437
- return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
17438
- createElementVNode("div", {
17439
- class: "mce-cropper__source",
17440
- style: normalizeStyle$1(sourceStyle.value)
17441
- }, [
17442
- createElementVNode("canvas", {
17443
- ref_key: "canvasRef",
17444
- ref: canvasRef
17445
- }, null, 512)
17446
- ], 4),
17447
- createVNode(_sfc_main$k, {
17448
- modelValue: sourceTransform.value,
17449
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
17450
- class: "mce-cropper__transform",
17451
- rotatable: false
17452
- }, {
17453
- default: withCtx(({ props: slotProps }) => [
17454
- createElementVNode("div", mergeProps({ class: "mce-cropper__transform_rect" }, slotProps), null, 16)
17455
- ]),
17456
- _: 1
17457
- }, 8, ["modelValue"]),
17458
- renderSlot(_ctx.$slots, "default", {
17459
- scale: scale.value,
17460
- ok,
17461
- cancel,
17462
- applySourceTransformToStyle
17463
- })
17464
- ])), [
17465
- [unref(vResizeObserver), onResizeObserver]
17466
- ]);
17467
- };
17468
- }
17469
- });
17470
17509
  const _sfc_main = /* @__PURE__ */ defineComponent({
17471
17510
  __name: "Dialog",
17472
17511
  props: /* @__PURE__ */ mergeModels({
@@ -17494,7 +17533,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17494
17533
  updateLocation
17495
17534
  });
17496
17535
  return (_ctx, _cache) => {
17497
- return openBlock(), createBlock(_sfc_main$u, {
17536
+ return openBlock(), createBlock(_sfc_main$v, {
17498
17537
  ref: "overlayTpl",
17499
17538
  modelValue: isActive.value,
17500
17539
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -17518,14 +17557,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17518
17557
  }
17519
17558
  });
17520
17559
  export {
17521
- _sfc_main$1 as Cropper,
17560
+ _sfc_main$k as Cropper,
17522
17561
  _sfc_main as Dialog,
17523
17562
  Doc,
17524
17563
  Editor,
17525
- _sfc_main$w as EditorLayers,
17526
- _sfc_main$2 as EditorLayout,
17527
- _sfc_main$4 as EditorLayoutItem,
17528
- _sfc_main$8 as EditorToolbelt,
17564
+ _sfc_main$x as EditorLayers,
17565
+ _sfc_main$1 as EditorLayout,
17566
+ _sfc_main$3 as EditorLayoutItem,
17567
+ _sfc_main$7 as EditorToolbelt,
17529
17568
  IconsSymbol,
17530
17569
  MceLayerItemKey,
17531
17570
  MceLayerKey,
@@ -17533,12 +17572,12 @@ export {
17533
17572
  MceLayoutKey,
17534
17573
  MceMenuSymbol,
17535
17574
  MceOverlaySymbol,
17536
- _sfc_main$t as Menu,
17575
+ _sfc_main$u as Menu,
17537
17576
  Model,
17538
- _sfc_main$p as Ruler,
17577
+ _sfc_main$q as Ruler,
17539
17578
  SUPPORTS_CLIPBOARD,
17540
- _sfc_main$n as Scrollbar,
17541
- _sfc_main$k as TransformControls,
17579
+ _sfc_main$o as Scrollbar,
17580
+ _sfc_main$l as TransformControls,
17542
17581
  USER_AGENT,
17543
17582
  boundingBoxToStyle,
17544
17583
  consoleError,