mce 0.15.36 → 0.15.38

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";
@@ -895,7 +895,7 @@ const _0_context = defineMixin((editor) => {
895
895
  const nodes = ref([]);
896
896
  const nodeIndexMap = reactive(/* @__PURE__ */ new Map());
897
897
  const selection = ref([]);
898
- const selectionArea = ref(new Aabb2D());
898
+ const selectionMarquee = ref(new Aabb2D());
899
899
  const elementSelection = computed({
900
900
  get: () => selection.value.filter((v) => isElement(v)),
901
901
  set: (val) => selection.value = val
@@ -973,7 +973,7 @@ const _0_context = defineMixin((editor) => {
973
973
  nodes,
974
974
  nodeIndexMap,
975
975
  selection,
976
- selectionArea,
976
+ selectionMarquee,
977
977
  elementSelection,
978
978
  textSelection,
979
979
  hoverElement,
@@ -1725,7 +1725,7 @@ function parseKey(key) {
1725
1725
  default:
1726
1726
  return String.fromCharCode(getCharCode(v));
1727
1727
  }
1728
- }).filter(Boolean).map((v) => v.toLowerCase()).sort().join("+");
1728
+ }).filter(Boolean).sort().join("+");
1729
1729
  }
1730
1730
  function parseKeyboardEvent(event) {
1731
1731
  if (event.key.toLowerCase() === "capslock") {
@@ -1741,7 +1741,7 @@ function parseKeyboardEvent(event) {
1741
1741
  event.altKey && "Alt",
1742
1742
  event.shiftKey && "Shift",
1743
1743
  !["Meta", "Control", "Alt", "Shift"].includes(event.key) && String.fromCharCode(key)
1744
- ].filter(Boolean).map((v) => v.toLowerCase()).sort().join("+");
1744
+ ].filter(Boolean).sort().join("+");
1745
1745
  }
1746
1746
  const _1_hotkey = defineMixin((editor) => {
1747
1747
  const {
@@ -3167,17 +3167,16 @@ const _4_1_text = defineMixin((editor) => {
3167
3167
  textSelection,
3168
3168
  fonts
3169
3169
  } = editor;
3170
- const element = computed(() => elementSelection.value[0]);
3171
3170
  const hasTextSelectionRange = computed(() => {
3172
3171
  return (textSelection.value?.length ?? 0) > 1 && textSelection.value[0] !== textSelection.value[1];
3173
3172
  });
3174
3173
  const isTextAllSelected = computed(() => {
3175
3174
  return textSelection.value?.[0].isFirst && textSelection.value?.[1].isLast && textSelection.value?.[1].isLastSelected;
3176
3175
  });
3177
- function textFontSizeToFit(element2, scale) {
3178
- function _handle(element3) {
3176
+ function textFontSizeToFit(element, scale) {
3177
+ function _handle(element2) {
3179
3178
  if (!scale) {
3180
- const chars = element3.text.base.characters;
3179
+ const chars = element2.text.base.characters;
3181
3180
  let pos = 0;
3182
3181
  let char;
3183
3182
  chars.forEach((_char) => {
@@ -3199,7 +3198,7 @@ const _4_1_text = defineMixin((editor) => {
3199
3198
  const { boundingBox } = measureText({
3200
3199
  fonts,
3201
3200
  style: {
3202
- ...element3.style.toJSON(),
3201
+ ...element2.style.toJSON(),
3203
3202
  width: "auto"
3204
3203
  },
3205
3204
  content: [
@@ -3210,8 +3209,8 @@ const _4_1_text = defineMixin((editor) => {
3210
3209
  }
3211
3210
  ]
3212
3211
  });
3213
- const fontSize = (element3.style.fontSize || 12) / 2;
3214
- scale = (element3.style.width ?? 0) / (boundingBox.width + fontSize);
3212
+ const fontSize = (element2.style.fontSize || 12) / 2;
3213
+ scale = (element2.style.width ?? 0) / (boundingBox.width + fontSize);
3215
3214
  }
3216
3215
  function _scaleStyle(style) {
3217
3216
  if (style.fontSize)
@@ -3219,39 +3218,39 @@ const _4_1_text = defineMixin((editor) => {
3219
3218
  if (style.letterSpacing)
3220
3219
  style.letterSpacing = style.letterSpacing * scale;
3221
3220
  }
3222
- _scaleStyle(element3.style);
3223
- if (element3.text?.isValid?.() && Array.isArray(element3.text?.content)) {
3224
- element3.text.content.forEach((p) => {
3221
+ _scaleStyle(element2.style);
3222
+ if (element2.text?.isValid?.() && Array.isArray(element2.text?.content)) {
3223
+ element2.text.content.forEach((p) => {
3225
3224
  _scaleStyle(p);
3226
3225
  p.fragments.forEach((f) => {
3227
3226
  _scaleStyle(f);
3228
3227
  });
3229
3228
  });
3230
3229
  }
3231
- element3.requestRender();
3230
+ element2.requestRender();
3232
3231
  }
3233
- _handle(element2);
3234
- element2.findOne((descendant) => {
3232
+ _handle(element);
3233
+ element.findOne((descendant) => {
3235
3234
  if (isElement(descendant)) {
3236
3235
  _handle(descendant);
3237
3236
  }
3238
3237
  return false;
3239
3238
  });
3240
3239
  }
3241
- function textToFit(element2, typography) {
3240
+ function textToFit(element, typography) {
3242
3241
  const strategy = typography ?? config.value.typographyStrategy;
3243
3242
  if (strategy === "fixedWidthHeight") {
3244
3243
  return;
3245
3244
  } else if (strategy === "autoFontSize") {
3246
- textFontSizeToFit(element2);
3245
+ textFontSizeToFit(element);
3247
3246
  return;
3248
3247
  }
3249
- function _handle(element3) {
3250
- if (!element3.text?.isValid?.() || typeof element3.text?.content !== "object") {
3248
+ function _handle(element2) {
3249
+ if (!element2.text?.isValid?.() || typeof element2.text?.content !== "object") {
3251
3250
  return;
3252
3251
  }
3253
- const isVertical = element3.text.base.isVertical;
3254
- const style = element3.style.toJSON();
3252
+ const isVertical = element2.text.base.isVertical;
3253
+ const style = element2.style.toJSON();
3255
3254
  switch (strategy) {
3256
3255
  case "autoWidth":
3257
3256
  if (isVertical) {
@@ -3271,16 +3270,16 @@ const _4_1_text = defineMixin((editor) => {
3271
3270
  const { boundingBox } = measureText({
3272
3271
  fonts,
3273
3272
  style,
3274
- content: element3.text.content
3273
+ content: element2.text.content
3275
3274
  });
3276
- if (element3.style.width !== boundingBox.width || element3.style.height !== boundingBox.height) {
3277
- element3.style.width = boundingBox.width;
3278
- element3.style.height = boundingBox.height;
3279
- element3.requestRender();
3275
+ if (element2.style.width !== boundingBox.width || element2.style.height !== boundingBox.height) {
3276
+ element2.style.width = boundingBox.width;
3277
+ element2.style.height = boundingBox.height;
3278
+ element2.requestRender();
3280
3279
  }
3281
3280
  }
3282
- _handle(element2);
3283
- element2.findOne((descendant) => {
3281
+ _handle(element);
3282
+ element.findOne((descendant) => {
3284
3283
  if (isElement(descendant)) {
3285
3284
  _handle(descendant);
3286
3285
  }
@@ -3289,7 +3288,7 @@ const _4_1_text = defineMixin((editor) => {
3289
3288
  }
3290
3289
  function handleTextSelection([start, end], cb) {
3291
3290
  let flag = true;
3292
- element.value?.text?.content.forEach((p, pIndex, pItems) => {
3291
+ elementSelection.value[0]?.text?.content.forEach((p, pIndex, pItems) => {
3293
3292
  if (!flag)
3294
3293
  return;
3295
3294
  p.fragments.forEach((f, fIndex, fItems) => {
@@ -3315,13 +3314,21 @@ const _4_1_text = defineMixin((editor) => {
3315
3314
  });
3316
3315
  }
3317
3316
  function getTextStyle(key) {
3318
- const el = element.value;
3317
+ const el = elementSelection.value[0];
3319
3318
  if (!el) {
3320
3319
  return void 0;
3321
3320
  }
3322
- let value = el.style[key];
3323
- const content = el.text.content;
3324
- if (hasTextSelectionRange.value) {
3321
+ let value;
3322
+ switch (key) {
3323
+ case "fill":
3324
+ case "outline":
3325
+ value = el.text[key];
3326
+ break;
3327
+ default:
3328
+ value = el.style[key];
3329
+ break;
3330
+ }
3331
+ if (hasTextSelectionRange.value && !isTextAllSelected.value) {
3325
3332
  const selection = textSelection.value;
3326
3333
  if (selection && selection[0] && selection[1]) {
3327
3334
  handleTextSelection(selection, ({ selected, fStyle }) => {
@@ -3333,6 +3340,7 @@ const _4_1_text = defineMixin((editor) => {
3333
3340
  });
3334
3341
  }
3335
3342
  } else {
3343
+ const content = el.text.content;
3336
3344
  switch (key) {
3337
3345
  case "fontSize":
3338
3346
  return content?.reduce((prev, p) => {
@@ -3349,7 +3357,7 @@ const _4_1_text = defineMixin((editor) => {
3349
3357
  return value;
3350
3358
  }
3351
3359
  function setTextContentByEachFragment(handler) {
3352
- const el = element.value;
3360
+ const el = elementSelection.value[0];
3353
3361
  if (!el) {
3354
3362
  return;
3355
3363
  }
@@ -3392,7 +3400,7 @@ const _4_1_text = defineMixin((editor) => {
3392
3400
  }
3393
3401
  }
3394
3402
  function setTextStyle(key, value) {
3395
- const el = element.value;
3403
+ const el = elementSelection.value[0];
3396
3404
  if (!el) {
3397
3405
  return;
3398
3406
  }
@@ -3436,7 +3444,7 @@ const _4_1_text = defineMixin((editor) => {
3436
3444
  }
3437
3445
  }
3438
3446
  function getTextFill() {
3439
- const el = element.value;
3447
+ const el = elementSelection.value[0];
3440
3448
  if (!el) {
3441
3449
  return void 0;
3442
3450
  }
@@ -3451,7 +3459,7 @@ const _4_1_text = defineMixin((editor) => {
3451
3459
  return fill;
3452
3460
  }
3453
3461
  function setTextFill(value) {
3454
- const el = element.value;
3462
+ const el = elementSelection.value[0];
3455
3463
  if (!el) {
3456
3464
  return void 0;
3457
3465
  }
@@ -3536,11 +3544,7 @@ const _4_3_element = defineMixin((editor) => {
3536
3544
  textFontSizeToFit,
3537
3545
  textToFit,
3538
3546
  log,
3539
- root,
3540
3547
  isElement,
3541
- inEditorIs,
3542
- isLock,
3543
- getObb,
3544
3548
  config,
3545
3549
  getAabb,
3546
3550
  getGlobalPointer,
@@ -3735,24 +3739,10 @@ const _4_3_element = defineMixin((editor) => {
3735
3739
  options.textToFit && textToFit(el);
3736
3740
  options.textFontSizeToFit && textFontSizeToFit(el, scaleX);
3737
3741
  }
3738
- function selectArea(areaInDrawboard) {
3739
- const area2 = new Obb2D(areaInDrawboard);
3740
- const selected = root.value?.children.flatMap((node) => {
3741
- if (inEditorIs(node, "Frame") && node.parent?.equal(root.value)) {
3742
- return node.children;
3743
- }
3744
- return [node];
3745
- }).filter((node) => {
3746
- return "isVisibleInTree" in node && node.isVisibleInTree() && getObb(node, "drawboard").overlap(area2) && !isLock(node) && !node.findAncestor((ancestor) => isLock(ancestor));
3747
- }) ?? [];
3748
- selection.value = selected;
3749
- return selected;
3750
- }
3751
3742
  Object.assign(editor, {
3752
3743
  addElement,
3753
3744
  addElements: addElement,
3754
- resizeElement,
3755
- selectArea
3745
+ resizeElement
3756
3746
  });
3757
3747
  });
3758
3748
  const _4_4_doc = defineMixin((editor, options) => {
@@ -4410,7 +4400,7 @@ const _hoisted_1$r = {
4410
4400
  key: 0,
4411
4401
  class: "mce-drawing__tip"
4412
4402
  };
4413
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
4403
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4414
4404
  __name: "Drawing",
4415
4405
  setup(__props) {
4416
4406
  const {
@@ -4443,7 +4433,7 @@ const _drawingTool = definePlugin((editor) => {
4443
4433
  { command: "setActiveDrawingTool", handle: (val) => setActiveDrawingTool(val) }
4444
4434
  ],
4445
4435
  components: [
4446
- { name: "drawing", type: "overlay", component: _sfc_main$D }
4436
+ { name: "drawing", type: "overlay", component: _sfc_main$E }
4447
4437
  ]
4448
4438
  };
4449
4439
  });
@@ -4737,7 +4727,7 @@ const ComponentIcon = defineComponent({
4737
4727
  };
4738
4728
  }
4739
4729
  });
4740
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
4730
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4741
4731
  __name: "Icon",
4742
4732
  props: {
4743
4733
  disabled: Boolean,
@@ -5395,7 +5385,7 @@ const defaultHoverStrategy = (context) => {
5395
5385
  }
5396
5386
  return element.findAncestor(cb);
5397
5387
  };
5398
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
5388
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
5399
5389
  __name: "Frame",
5400
5390
  props: {
5401
5391
  "modelValue": { required: true },
@@ -5471,7 +5461,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5471
5461
  }
5472
5462
  });
5473
5463
  const _hoisted_1$q = { class: "mce-frames" };
5474
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
5464
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5475
5465
  __name: "Frames",
5476
5466
  setup(__props) {
5477
5467
  const {
@@ -5480,7 +5470,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5480
5470
  return (_ctx, _cache) => {
5481
5471
  return openBlock(), createElementBlock("div", _hoisted_1$q, [
5482
5472
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(frames), (frame, key) => {
5483
- return openBlock(), createBlock(_sfc_main$B, {
5473
+ return openBlock(), createBlock(_sfc_main$C, {
5484
5474
  key,
5485
5475
  "model-value": frame
5486
5476
  }, null, 8, ["model-value"]);
@@ -5540,7 +5530,7 @@ const _frame = definePlugin((editor) => {
5540
5530
  { command: "setActiveDrawingTool:frame", key: "F" }
5541
5531
  ],
5542
5532
  components: [
5543
- { type: "overlay", component: _sfc_main$A, order: "before" }
5533
+ { type: "overlay", component: _sfc_main$B, order: "before" }
5544
5534
  ]
5545
5535
  };
5546
5536
  });
@@ -5620,7 +5610,7 @@ const _history = definePlugin((editor) => {
5620
5610
  };
5621
5611
  });
5622
5612
  const _hoisted_1$p = ["data-name"];
5623
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
5613
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5624
5614
  __name: "Hover",
5625
5615
  setup(__props) {
5626
5616
  const {
@@ -5649,7 +5639,7 @@ const _hover = definePlugin(() => {
5649
5639
  return {
5650
5640
  name: "mce:hover",
5651
5641
  components: [
5652
- { type: "overlay", component: _sfc_main$z, order: "before" }
5642
+ { type: "overlay", component: _sfc_main$A, order: "before" }
5653
5643
  ]
5654
5644
  };
5655
5645
  });
@@ -5928,7 +5918,7 @@ const _json = definePlugin((editor) => {
5928
5918
  ]
5929
5919
  };
5930
5920
  });
5931
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
5921
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5932
5922
  __name: "Btn",
5933
5923
  props: {
5934
5924
  active: { type: Boolean },
@@ -5950,7 +5940,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5950
5940
  const _hoisted_1$o = ["data-id"];
5951
5941
  const _hoisted_2$d = { class: "mce-layer__content" };
5952
5942
  const _hoisted_3$b = { class: "mce-layer__prepend" };
5953
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
5943
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5954
5944
  ...{
5955
5945
  name: "MceLayer",
5956
5946
  inheritAttrs: false
@@ -6174,7 +6164,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6174
6164
  _cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
6175
6165
  createElementVNode("div", _hoisted_2$d, [
6176
6166
  createElementVNode("div", _hoisted_3$b, [
6177
- childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$C), {
6167
+ childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$D), {
6178
6168
  key: 0,
6179
6169
  class: "mce-layer__arrow",
6180
6170
  icon: "$arrowRight",
@@ -6187,7 +6177,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6187
6177
  class: "mce-layer__thumbnail",
6188
6178
  onDblclick: onDblclickThumbnail
6189
6179
  }, [
6190
- createVNode(unref(_sfc_main$C), { icon: thumbnailIcon.value }, null, 8, ["icon"])
6180
+ createVNode(unref(_sfc_main$D), { icon: thumbnailIcon.value }, null, 8, ["icon"])
6191
6181
  ], 32),
6192
6182
  createElementVNode("div", {
6193
6183
  class: "mce-layer__name",
@@ -6220,7 +6210,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6220
6210
  }])
6221
6211
  }, [
6222
6212
  props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6223
- Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$y, {
6213
+ Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$z, {
6224
6214
  key: 0,
6225
6215
  icon: "",
6226
6216
  class: "mce-layer__btn mce-layer__btn--show",
@@ -6231,12 +6221,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6231
6221
  }), ["prevent", "stop"]))
6232
6222
  }, {
6233
6223
  default: withCtx(() => [
6234
- createVNode(unref(_sfc_main$C), { icon: "$collapse" })
6224
+ createVNode(unref(_sfc_main$D), { icon: "$collapse" })
6235
6225
  ]),
6236
6226
  _: 1
6237
6227
  })) : createCommentVNode("", true)
6238
6228
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
6239
- createVNode(_sfc_main$y, {
6229
+ createVNode(_sfc_main$z, {
6240
6230
  icon: "",
6241
6231
  class: normalizeClass(["mce-layer__btn", {
6242
6232
  "mce-layer__btn--show": unref(isLock)(props.node)
@@ -6244,13 +6234,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6244
6234
  onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
6245
6235
  }, {
6246
6236
  default: withCtx(() => [
6247
- createVNode(unref(_sfc_main$C), {
6237
+ createVNode(unref(_sfc_main$D), {
6248
6238
  icon: unref(isLock)(props.node) ? "$lock" : "$unlock"
6249
6239
  }, null, 8, ["icon"])
6250
6240
  ]),
6251
6241
  _: 1
6252
6242
  }, 8, ["class"]),
6253
- createVNode(_sfc_main$y, {
6243
+ createVNode(_sfc_main$z, {
6254
6244
  icon: "",
6255
6245
  class: normalizeClass(["mce-layer__btn", {
6256
6246
  "mce-layer__btn--show": !unref(isVisible)(props.node)
@@ -6258,7 +6248,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6258
6248
  onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
6259
6249
  }, {
6260
6250
  default: withCtx(() => [
6261
- createVNode(unref(_sfc_main$C), {
6251
+ createVNode(unref(_sfc_main$D), {
6262
6252
  icon: unref(isVisible)(props.node) ? "$visible" : "$unvisible"
6263
6253
  }, null, 8, ["icon"])
6264
6254
  ]),
@@ -6282,7 +6272,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6282
6272
  });
6283
6273
  const _hoisted_1$n = { class: "mce-layers" };
6284
6274
  const _hoisted_2$c = { class: "mce-layers__wrapper" };
6285
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
6275
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6286
6276
  __name: "Layers",
6287
6277
  setup(__props) {
6288
6278
  const {
@@ -6328,7 +6318,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6328
6318
  return (_ctx, _cache) => {
6329
6319
  return openBlock(), createElementBlock("div", _hoisted_1$n, [
6330
6320
  createElementVNode("div", _hoisted_2$c, [
6331
- createVNode(_sfc_main$x, {
6321
+ createVNode(_sfc_main$y, {
6332
6322
  root: true,
6333
6323
  node: unref(root),
6334
6324
  opened: true
@@ -6342,7 +6332,7 @@ const _layers = definePlugin(() => {
6342
6332
  return {
6343
6333
  name: "mce:layers",
6344
6334
  components: [
6345
- { name: "layers", type: "panel", position: "float", component: _sfc_main$w }
6335
+ { name: "layers", type: "panel", position: "float", component: _sfc_main$x }
6346
6336
  ]
6347
6337
  };
6348
6338
  });
@@ -6353,7 +6343,7 @@ const _export_sfc = (sfc, props) => {
6353
6343
  }
6354
6344
  return target;
6355
6345
  };
6356
- const _sfc_main$v = {};
6346
+ const _sfc_main$w = {};
6357
6347
  const _hoisted_1$m = {
6358
6348
  class: "mce-made-with",
6359
6349
  href: "https://github.com/qq15725/mce",
@@ -6365,7 +6355,7 @@ function _sfc_render(_ctx, _cache) {
6365
6355
  createElementVNode("div", null, "MCE", -1)
6366
6356
  ])]);
6367
6357
  }
6368
- const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render]]);
6358
+ const MadeWith = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render]]);
6369
6359
  const _madeWith = definePlugin((editor) => {
6370
6360
  const {
6371
6361
  config,
@@ -6383,7 +6373,7 @@ const _madeWith = definePlugin((editor) => {
6383
6373
  ]
6384
6374
  };
6385
6375
  });
6386
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
6376
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6387
6377
  ...{
6388
6378
  inheritAttrs: false
6389
6379
  },
@@ -6528,7 +6518,7 @@ const _hoisted_7$3 = {
6528
6518
  key: 3,
6529
6519
  class: "mce-list-item__append"
6530
6520
  };
6531
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
6521
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
6532
6522
  ...{
6533
6523
  name: "MceMenu"
6534
6524
  },
@@ -6611,7 +6601,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6611
6601
  });
6612
6602
  return (_ctx, _cache) => {
6613
6603
  const _component_MceMenu = resolveComponent("MceMenu");
6614
- return openBlock(), createBlock(_sfc_main$u, {
6604
+ return openBlock(), createBlock(_sfc_main$v, {
6615
6605
  ref: "overlayTpl",
6616
6606
  modelValue: isActive.value,
6617
6607
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isActive.value = $event),
@@ -6658,7 +6648,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6658
6648
  onClick: (e) => onClickItem(item, index, e)
6659
6649
  }, [
6660
6650
  hasPrepend.value ? (openBlock(), createElementBlock("div", _hoisted_3$a, [
6661
- item.checked ? (openBlock(), createBlock(unref(_sfc_main$C), {
6651
+ item.checked ? (openBlock(), createBlock(unref(_sfc_main$D), {
6662
6652
  key: 0,
6663
6653
  icon: "$check"
6664
6654
  })) : createCommentVNode("", true)
@@ -6676,7 +6666,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6676
6666
  ])) : createCommentVNode("", true),
6677
6667
  item.children?.length || _ctx.$slots.append ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
6678
6668
  renderSlot(_ctx.$slots, "append", { item }),
6679
- item.children?.length ? (openBlock(), createBlock(unref(_sfc_main$C), {
6669
+ item.children?.length ? (openBlock(), createBlock(unref(_sfc_main$D), {
6680
6670
  key: 0,
6681
6671
  icon: "$arrowRight"
6682
6672
  })) : createCommentVNode("", true)
@@ -6733,7 +6723,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6733
6723
  };
6734
6724
  }
6735
6725
  });
6736
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
6726
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6737
6727
  __name: "ContextMenu",
6738
6728
  props: {
6739
6729
  "modelValue": { type: Boolean },
@@ -6819,7 +6809,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6819
6809
  updateLocation
6820
6810
  });
6821
6811
  return (_ctx, _cache) => {
6822
- return openBlock(), createBlock(_sfc_main$t, {
6812
+ return openBlock(), createBlock(_sfc_main$u, {
6823
6813
  ref: "menuTplRef",
6824
6814
  modelValue: isActive.value,
6825
6815
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -7109,7 +7099,7 @@ const _menu = definePlugin((editor, options) => {
7109
7099
  return {
7110
7100
  name: "mce:menu",
7111
7101
  components: [
7112
- { type: "overlay", component: _sfc_main$s, order: "after" }
7102
+ { type: "overlay", component: _sfc_main$t, order: "after" }
7113
7103
  ]
7114
7104
  };
7115
7105
  });
@@ -7176,7 +7166,7 @@ const _new = definePlugin((editor) => {
7176
7166
  const _hoisted_1$k = { class: "mce-node-creator" };
7177
7167
  const _hoisted_2$a = { class: "mce-node-creator__tree" };
7178
7168
  const _hoisted_3$9 = { class: "mce-node-creator__actions" };
7179
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
7169
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
7180
7170
  __name: "NodeCreator",
7181
7171
  props: {
7182
7172
  "isActive": { type: Boolean },
@@ -7269,13 +7259,13 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
7269
7259
  }), 128))
7270
7260
  ]),
7271
7261
  createElementVNode("div", _hoisted_3$9, [
7272
- createVNode(_sfc_main$y, { onClick: cancel }, {
7262
+ createVNode(_sfc_main$z, { onClick: cancel }, {
7273
7263
  default: withCtx(() => [
7274
7264
  createTextVNode(toDisplayString(unref(t)("cancel")), 1)
7275
7265
  ]),
7276
7266
  _: 1
7277
7267
  }),
7278
- createVNode(_sfc_main$y, { onClick: create }, {
7268
+ createVNode(_sfc_main$z, { onClick: create }, {
7279
7269
  default: withCtx(() => [
7280
7270
  createTextVNode(toDisplayString(unref(t)("create")), 1)
7281
7271
  ]),
@@ -7295,7 +7285,7 @@ const _node = definePlugin((editor) => {
7295
7285
  return {
7296
7286
  name: "mce:node",
7297
7287
  components: [
7298
- { name: "nodeCreator", type: "panel", position: "float", component: _sfc_main$r }
7288
+ { name: "nodeCreator", type: "panel", position: "float", component: _sfc_main$s }
7299
7289
  ],
7300
7290
  commands: [
7301
7291
  { command: "addSubNode", handle: () => config.value.nodeCreator = true }
@@ -11437,7 +11427,7 @@ const _hoisted_3$8 = {
11437
11427
  key: 0,
11438
11428
  class: "mce-tooltip__kbd"
11439
11429
  };
11440
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
11430
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
11441
11431
  __name: "Tooltip",
11442
11432
  props: /* @__PURE__ */ mergeModels({
11443
11433
  ...makeMceOverlayProps({
@@ -11468,7 +11458,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
11468
11458
  updateLocation
11469
11459
  });
11470
11460
  return (_ctx, _cache) => {
11471
- return openBlock(), createBlock(_sfc_main$u, {
11461
+ return openBlock(), createBlock(_sfc_main$v, {
11472
11462
  ref: "overlayTpl",
11473
11463
  modelValue: isActive.value,
11474
11464
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -11512,7 +11502,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
11512
11502
  const _hoisted_1$i = ["width", "height"];
11513
11503
  const _hoisted_2$8 = ["onDblclick", "onMousedown", "onMousemove"];
11514
11504
  const _hoisted_3$7 = { style: { "font-size": "0.75rem", "text-wrap": "nowrap" } };
11515
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
11505
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
11516
11506
  ...{
11517
11507
  inheritAttrs: false
11518
11508
  },
@@ -11792,7 +11782,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11792
11782
  onMouseleave: onLeave
11793
11783
  }, null, 46, _hoisted_2$8);
11794
11784
  }), 128)),
11795
- createVNode(_sfc_main$q, {
11785
+ createVNode(_sfc_main$r, {
11796
11786
  "model-value": !!tipText.value,
11797
11787
  target: tipPos.value,
11798
11788
  offset: 24
@@ -11807,7 +11797,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11807
11797
  }
11808
11798
  });
11809
11799
  const _hoisted_1$h = { class: "mce-rulers" };
11810
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
11800
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11811
11801
  __name: "Rulers",
11812
11802
  setup(__props) {
11813
11803
  const {
@@ -11816,7 +11806,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
11816
11806
  } = useEditor();
11817
11807
  return (_ctx, _cache) => {
11818
11808
  return openBlock(), createElementBlock("div", _hoisted_1$h, [
11819
- createVNode(_sfc_main$p, {
11809
+ createVNode(_sfc_main$q, {
11820
11810
  refline: "",
11821
11811
  zoom: unref(camera).zoom.x,
11822
11812
  position: unref(camera).position.x,
@@ -11824,7 +11814,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
11824
11814
  axis: "",
11825
11815
  size: 16
11826
11816
  }, null, 8, ["zoom", "position", "selected"]),
11827
- createVNode(_sfc_main$p, {
11817
+ createVNode(_sfc_main$q, {
11828
11818
  refline: "",
11829
11819
  zoom: unref(camera).zoom.y,
11830
11820
  position: unref(camera).position.y,
@@ -11849,7 +11839,7 @@ const _ruler = definePlugin((editor) => {
11849
11839
  components: [
11850
11840
  {
11851
11841
  type: "overlay",
11852
- component: _sfc_main$o,
11842
+ component: _sfc_main$p,
11853
11843
  ignore: () => !config.value.ruler,
11854
11844
  order: "after"
11855
11845
  }
@@ -11891,7 +11881,7 @@ const _hoisted_1$g = {
11891
11881
  ref: "trackTplRef",
11892
11882
  class: "mce-scrollbar__track"
11893
11883
  };
11894
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
11884
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
11895
11885
  __name: "Scrollbar",
11896
11886
  props: /* @__PURE__ */ mergeModels({
11897
11887
  length: {},
@@ -11999,7 +11989,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
11999
11989
  }
12000
11990
  });
12001
11991
  const _hoisted_1$f = { class: "mce-scrollbars" };
12002
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
11992
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
12003
11993
  __name: "Scrollbars",
12004
11994
  props: {
12005
11995
  offset: { default: 0 },
@@ -12013,13 +12003,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
12013
12003
  } = useEditor();
12014
12004
  return (_ctx, _cache) => {
12015
12005
  return openBlock(), createElementBlock("div", _hoisted_1$f, [
12016
- createVNode(_sfc_main$n, mergeProps(props, {
12006
+ createVNode(_sfc_main$o, mergeProps(props, {
12017
12007
  modelValue: unref(camera).position.y,
12018
12008
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(camera).position.y = $event),
12019
12009
  vertical: "",
12020
12010
  length: unref(rootAabb).height * unref(camera).zoom.y
12021
12011
  }), null, 16, ["modelValue", "length"]),
12022
- createVNode(_sfc_main$n, mergeProps(props, {
12012
+ createVNode(_sfc_main$o, mergeProps(props, {
12023
12013
  modelValue: unref(camera).position.x,
12024
12014
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(camera).position.x = $event),
12025
12015
  length: unref(rootAabb).width * unref(camera).zoom.x
@@ -12136,7 +12126,7 @@ const _scroll = definePlugin((editor) => {
12136
12126
  components: [
12137
12127
  {
12138
12128
  type: "overlay",
12139
- component: _sfc_main$m,
12129
+ component: _sfc_main$n,
12140
12130
  ignore: () => !config.value.scrollbar,
12141
12131
  order: "after"
12142
12132
  }
@@ -12173,7 +12163,7 @@ const _scroll = definePlugin((editor) => {
12173
12163
  // },
12174
12164
  };
12175
12165
  });
12176
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
12166
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
12177
12167
  __name: "ScrollToSelection",
12178
12168
  setup(__props) {
12179
12169
  const {
@@ -12191,7 +12181,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
12191
12181
  class: "mce-scroll-to-selection",
12192
12182
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
12193
12183
  }, [
12194
- createVNode(unref(_sfc_main$C), { icon: "$gps" }),
12184
+ createVNode(unref(_sfc_main$D), { icon: "$gps" }),
12195
12185
  createElementVNode("span", null, toDisplayString(unref(t)("scrollToSelection")), 1)
12196
12186
  ])) : createCommentVNode("", true);
12197
12187
  };
@@ -12213,7 +12203,7 @@ const _hoisted_10$1 = {
12213
12203
  key: 0,
12214
12204
  class: "mce-transform-controls__tip"
12215
12205
  };
12216
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
12206
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
12217
12207
  __name: "TransformControls",
12218
12208
  props: /* @__PURE__ */ mergeModels({
12219
12209
  tag: { default: "div" },
@@ -12863,8 +12853,202 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
12863
12853
  };
12864
12854
  }
12865
12855
  });
12866
- const _hoisted_1$d = { class: "mce-selection" };
12856
+ const _hoisted_1$d = { class: "mce-cropper" };
12857
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
12858
+ __name: "Cropper",
12859
+ props: /* @__PURE__ */ mergeModels({
12860
+ image: {},
12861
+ minScale: { default: 0.1 },
12862
+ maxScale: { default: 3 }
12863
+ }, {
12864
+ "modelValue": { default: () => ({}) },
12865
+ "modelModifiers": {},
12866
+ "style": { default: () => ({}) },
12867
+ "styleModifiers": {}
12868
+ }),
12869
+ emits: /* @__PURE__ */ mergeModels(["start", "end", "update:transform"], ["update:modelValue", "update:style"]),
12870
+ setup(__props, { emit: __emit }) {
12871
+ const props = __props;
12872
+ const emit = __emit;
12873
+ const cropRect = useModel(__props, "modelValue");
12874
+ const styleModel = useModel(__props, "style");
12875
+ const rootBox = ref({ width: 0, height: 0 });
12876
+ const { state: imageRef } = useImage(
12877
+ computed(() => ({
12878
+ src: props.image
12879
+ }))
12880
+ );
12881
+ const backup = cloneDeep(cropRect.value);
12882
+ const canvasRef = useTemplateRef("canvasRef");
12883
+ const computedCropRect = computed({
12884
+ get: () => {
12885
+ const { left = 0, top = 0, right = 0, bottom = 0 } = cropRect.value;
12886
+ return { left, top, right, bottom };
12887
+ },
12888
+ set: (val) => cropRect.value = val
12889
+ });
12890
+ const inverseMat = computed(() => {
12891
+ const { left, top, right, bottom } = computedCropRect.value;
12892
+ const sx = 1 / (1 - left - right);
12893
+ const sy = 1 / (1 - top - bottom);
12894
+ const tx = -left;
12895
+ const ty = -top;
12896
+ return { sx, sy, tx, ty };
12897
+ });
12898
+ const sourceTransform = computed({
12899
+ get: () => {
12900
+ const { sx, sy, tx, ty } = inverseMat.value;
12901
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12902
+ const { width, height } = rootBox.value;
12903
+ return {
12904
+ width: sx * width,
12905
+ height: sy * height,
12906
+ left: tx * scaleX * (sx * width),
12907
+ top: ty * scaleY * (sy * height)
12908
+ };
12909
+ },
12910
+ set: (newValue) => {
12911
+ const { width, height } = rootBox.value;
12912
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12913
+ const transform = {
12914
+ sx: newValue.width / width,
12915
+ sy: newValue.height / height,
12916
+ tx: newValue.left / newValue.width / scaleX,
12917
+ ty: newValue.top / newValue.height / scaleY
12918
+ };
12919
+ const left = -transform.tx;
12920
+ const top = -transform.ty;
12921
+ const w = 1 - 1 / transform.sx;
12922
+ const h2 = 1 - 1 / transform.sy;
12923
+ const right = w - left;
12924
+ const bottom = h2 - top;
12925
+ computedCropRect.value = { left, top, right, bottom };
12926
+ }
12927
+ });
12928
+ const scale = computed({
12929
+ get: () => inverseMat.value.sx,
12930
+ set: (value) => {
12931
+ const transform = inverseMat.value;
12932
+ const rate = transform.sx / value;
12933
+ const left = -transform.tx;
12934
+ const top = -transform.ty;
12935
+ const w = 1 - 1 / value;
12936
+ const h2 = 1 - 1 / transform.sy * rate;
12937
+ const right = w - left;
12938
+ const bottom = h2 - top;
12939
+ computedCropRect.value = { left, top, right, bottom };
12940
+ }
12941
+ });
12942
+ onBeforeMount(() => emit("start"));
12943
+ onBeforeUnmount(() => emit("end"));
12944
+ const sourceStyle = computed(() => {
12945
+ const { sx, sy, tx, ty } = inverseMat.value;
12946
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12947
+ return {
12948
+ transform: [
12949
+ `scale(${sx}, ${sy})`,
12950
+ `translate(${tx * scaleX * 100}%, ${ty * scaleY * 100}%)`
12951
+ ].join(" ")
12952
+ };
12953
+ });
12954
+ watch([canvasRef, imageRef], render2);
12955
+ watch(computedCropRect, render2, { deep: true });
12956
+ watch([() => styleModel.value.scaleX, () => styleModel.value.scaleY], render2);
12957
+ function render2() {
12958
+ const ctx = canvasRef.value?.getContext("2d");
12959
+ if (!ctx || !imageRef.value)
12960
+ return;
12961
+ const { scaleX = 1, scaleY = 1 } = styleModel.value;
12962
+ const { naturalWidth, naturalHeight } = imageRef.value;
12963
+ ctx.canvas.width = naturalWidth;
12964
+ ctx.canvas.height = naturalHeight;
12965
+ ctx.clearRect(0, 0, naturalWidth, naturalHeight);
12966
+ ctx.globalAlpha = 0.4;
12967
+ ctx.scale(scaleX, scaleY);
12968
+ ctx.drawImage(imageRef.value, 0, 0, naturalWidth, naturalHeight);
12969
+ }
12970
+ function ok() {
12971
+ emit("end");
12972
+ }
12973
+ function cancel() {
12974
+ cropRect.value = backup;
12975
+ ok();
12976
+ }
12977
+ function onResizeObserver(entries) {
12978
+ const { width, height } = entries[0].contentRect;
12979
+ rootBox.value = { width, height };
12980
+ }
12981
+ function applySourceTransformToStyle() {
12982
+ const { left = 0, top = 0, width = 0, height = 0 } = styleModel.value;
12983
+ const { sx, sy, tx, ty } = inverseMat.value;
12984
+ cropRect.value = {};
12985
+ styleModel.value = {
12986
+ ...styleModel.value,
12987
+ width: sx * width,
12988
+ height: sy * height,
12989
+ left: left + tx * (sx * width),
12990
+ top: top + ty * (sy * height)
12991
+ };
12992
+ ok();
12993
+ }
12994
+ return (_ctx, _cache) => {
12995
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$d, [
12996
+ createElementVNode("div", {
12997
+ class: "mce-cropper__source",
12998
+ style: normalizeStyle$1(sourceStyle.value)
12999
+ }, [
13000
+ createElementVNode("canvas", {
13001
+ ref_key: "canvasRef",
13002
+ ref: canvasRef
13003
+ }, null, 512)
13004
+ ], 4),
13005
+ createVNode(_sfc_main$l, {
13006
+ modelValue: sourceTransform.value,
13007
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
13008
+ class: "mce-cropper__transform",
13009
+ rotatable: false
13010
+ }, {
13011
+ default: withCtx(({ props: slotProps }) => [
13012
+ createElementVNode("div", mergeProps({ class: "mce-cropper__transform_rect" }, slotProps), null, 16)
13013
+ ]),
13014
+ _: 1
13015
+ }, 8, ["modelValue"]),
13016
+ renderSlot(_ctx.$slots, "default", {
13017
+ scale: scale.value,
13018
+ ok,
13019
+ cancel,
13020
+ applySourceTransformToStyle
13021
+ })
13022
+ ])), [
13023
+ [unref(vResizeObserver), onResizeObserver]
13024
+ ]);
13025
+ };
13026
+ }
13027
+ });
12867
13028
  const _sfc_main$j = /* @__PURE__ */ defineComponent({
13029
+ __name: "ForegroundCropper",
13030
+ setup(__props) {
13031
+ const {
13032
+ state,
13033
+ elementSelection
13034
+ } = useEditor();
13035
+ const element = computed(() => elementSelection.value[0]);
13036
+ return (_ctx, _cache) => {
13037
+ return unref(state) === "cropping" && element.value?.foreground.isValid() ? (openBlock(), createBlock(_sfc_main$k, {
13038
+ key: 0,
13039
+ modelValue: element.value.foreground.cropRect,
13040
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => element.value.foreground.cropRect = $event),
13041
+ style: normalizeStyle$1(element.value.style.toJSON()),
13042
+ image: element.value.foreground.image,
13043
+ class: "pointer-events-auto",
13044
+ "onUpdate:style": _cache[1] || (_cache[1] = (val) => element.value.style.setProperties(val)),
13045
+ onEnd: _cache[2] || (_cache[2] = () => state.value = void 0)
13046
+ }, null, 8, ["modelValue", "style", "image"])) : createCommentVNode("", true);
13047
+ };
13048
+ }
13049
+ });
13050
+ const _hoisted_1$c = { class: "mce-selection" };
13051
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
12868
13052
  __name: "Selection",
12869
13053
  setup(__props, { expose: __expose }) {
12870
13054
  const {
@@ -12873,7 +13057,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
12873
13057
  state,
12874
13058
  resizeElement,
12875
13059
  selection,
12876
- selectionArea,
13060
+ selectionMarquee,
12877
13061
  elementSelection,
12878
13062
  selectionObb,
12879
13063
  selectionObbInDrawboard,
@@ -13097,36 +13281,27 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
13097
13281
  transformControls
13098
13282
  });
13099
13283
  return (_ctx, _cache) => {
13100
- return openBlock(), createElementBlock("div", _hoisted_1$d, [
13284
+ return openBlock(), createElementBlock("div", _hoisted_1$c, [
13101
13285
  (openBlock(true), createElementBlock(Fragment, null, renderList(parentObbStyles.value, (style, index) => {
13102
13286
  return openBlock(), createElementBlock("div", {
13103
13287
  key: index,
13104
13288
  class: "mce-selection__parent",
13105
- style: normalizeStyle$1({
13106
- borderColor: "currentColor",
13107
- ...style
13108
- })
13289
+ style: normalizeStyle$1(style)
13109
13290
  }, null, 4);
13110
13291
  }), 128)),
13111
13292
  unref(state) !== "transforming" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selectionObbStyles.value, (style, index) => {
13112
13293
  return openBlock(), createElementBlock("div", {
13113
13294
  key: index,
13114
13295
  class: "mce-selection__node",
13115
- style: normalizeStyle$1({
13116
- borderColor: "currentcolor",
13117
- ...style
13118
- })
13296
+ style: normalizeStyle$1(style)
13119
13297
  }, null, 4);
13120
13298
  }), 128)) : createCommentVNode("", true),
13121
13299
  unref(state) === "selecting" ? (openBlock(), createElementBlock("div", {
13122
13300
  key: 1,
13123
- class: "mce-selection__area",
13124
- style: normalizeStyle$1({
13125
- borderColor: "currentcolor",
13126
- ...unref(selectionArea).toCssStyle()
13127
- })
13301
+ class: "mce-selection__marquee",
13302
+ style: normalizeStyle$1(unref(selectionMarquee).toCssStyle())
13128
13303
  }, null, 4)) : createCommentVNode("", true),
13129
- transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
13304
+ transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
13130
13305
  key: 2,
13131
13306
  ref: "transformControlsTpl"
13132
13307
  }, unref(config).transformControls, {
@@ -13147,18 +13322,19 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
13147
13322
  }), createSlots({ _: 2 }, [
13148
13323
  _ctx.$slots.transform ? {
13149
13324
  name: "svg",
13150
- fn: withCtx((slotProps) => [
13151
- renderSlot(_ctx.$slots, "transform", normalizeProps(guardReactiveProps(slotProps)))
13325
+ fn: withCtx(() => [
13326
+ renderSlot(_ctx.$slots, "transform")
13152
13327
  ]),
13153
13328
  key: "0"
13154
13329
  } : void 0
13155
13330
  ]), 1040, ["modelValue", "movable", "resizable", "rotatable", "roundable", "resize-strategy", "scale", "offset"])) : createCommentVNode("", true),
13156
- transform.value.width && transform.value.height && _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
13331
+ transform.value.width && transform.value.height ? (openBlock(), createElementBlock("div", {
13157
13332
  key: 3,
13158
13333
  class: "mce-selection__slot",
13159
13334
  style: normalizeStyle$1(unref(selectionObbInDrawboard).toCssStyle())
13160
13335
  }, [
13161
- renderSlot(_ctx.$slots, "default", { transform: transform.value })
13336
+ createVNode(_sfc_main$j),
13337
+ renderSlot(_ctx.$slots, "default")
13162
13338
  ], 4)) : createCommentVNode("", true)
13163
13339
  ]);
13164
13340
  };
@@ -13168,6 +13344,7 @@ const _selection = definePlugin((editor) => {
13168
13344
  const {
13169
13345
  isElement,
13170
13346
  selection,
13347
+ selectionMarquee,
13171
13348
  elementSelection,
13172
13349
  getObb,
13173
13350
  getAabb,
@@ -13175,6 +13352,7 @@ const _selection = definePlugin((editor) => {
13175
13352
  root,
13176
13353
  findSibling,
13177
13354
  inEditorIs,
13355
+ isTopFrame,
13178
13356
  addElement,
13179
13357
  addElements,
13180
13358
  obbToFit,
@@ -13211,9 +13389,9 @@ const _selection = definePlugin((editor) => {
13211
13389
  }
13212
13390
  case "previousSibling":
13213
13391
  case "nextSibling": {
13214
- const value = findSibling(target === "previousSibling" ? "previous" : "next");
13215
- if (value) {
13216
- selection.value = [value];
13392
+ const sibling = findSibling(target === "previousSibling" ? "previous" : "next");
13393
+ if (sibling) {
13394
+ selection.value = [sibling];
13217
13395
  exec("zoomTo", "selection", {
13218
13396
  intoView: true,
13219
13397
  behavior: "smooth"
@@ -13226,6 +13404,17 @@ const _selection = definePlugin((editor) => {
13226
13404
  break;
13227
13405
  }
13228
13406
  }
13407
+ function marqueeSelect(marquee = selectionMarquee.value) {
13408
+ const area2 = new Obb2D(marquee);
13409
+ selection.value = root.value?.children.flatMap((node) => {
13410
+ if (isTopFrame(node) && !area2.contains(getObb(node, "drawboard"))) {
13411
+ return node.children;
13412
+ }
13413
+ return [node];
13414
+ }).filter((node) => {
13415
+ return "isVisibleInTree" in node && node.isVisibleInTree() && getObb(node, "drawboard").overlap(area2) && !isLock(node) && !node.findAncestor((ancestor) => isLock(ancestor));
13416
+ }) ?? [];
13417
+ }
13229
13418
  function groupSelection(inEditorIs2) {
13230
13419
  const elements = elementSelection.value;
13231
13420
  if (!elements.length) {
@@ -13319,6 +13508,7 @@ const _selection = definePlugin((editor) => {
13319
13508
  name: "mce:selection",
13320
13509
  commands: [
13321
13510
  { command: "select", handle: select },
13511
+ { command: "marqueeSelect", handle: marqueeSelect },
13322
13512
  { command: "selectAll", handle: () => select("all") },
13323
13513
  { command: "selectInverse", handle: () => select("inverse") },
13324
13514
  { command: "selectNone", handle: () => select("none") },
@@ -13359,8 +13549,8 @@ const _selection = definePlugin((editor) => {
13359
13549
  }
13360
13550
  },
13361
13551
  components: [
13362
- { slot: "selection", type: "overlay", component: _sfc_main$j },
13363
- { type: "overlay", component: _sfc_main$l }
13552
+ { slot: "selection", type: "overlay", component: _sfc_main$i },
13553
+ { type: "overlay", component: _sfc_main$m }
13364
13554
  ]
13365
13555
  };
13366
13556
  });
@@ -13635,15 +13825,15 @@ const _slice = definePlugin((editor) => {
13635
13825
  ]
13636
13826
  };
13637
13827
  });
13638
- const _hoisted_1$c = { class: "mce-smart-guides" };
13639
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
13828
+ const _hoisted_1$b = { class: "mce-smart-guides" };
13829
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
13640
13830
  __name: "SmartGuides",
13641
13831
  props: {
13642
13832
  snapLines: {}
13643
13833
  },
13644
13834
  setup(__props) {
13645
13835
  return (_ctx, _cache) => {
13646
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
13836
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
13647
13837
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.snapLines, (item, key) => {
13648
13838
  return openBlock(), createElementBlock("div", {
13649
13839
  key,
@@ -14958,7 +15148,7 @@ const _smartGuides = definePlugin((editor) => {
14958
15148
  components: [
14959
15149
  {
14960
15150
  type: "overlay",
14961
- component: () => h(_sfc_main$i, { snapLines: snapLines.value })
15151
+ component: () => h(_sfc_main$h, { snapLines: snapLines.value })
14962
15152
  }
14963
15153
  ]
14964
15154
  };
@@ -14989,12 +15179,12 @@ function flipType(type) {
14989
15179
  function isLeftTopLine(line) {
14990
15180
  return ["vt", "hl"].includes(line.type);
14991
15181
  }
14992
- const _hoisted_1$b = {
15182
+ const _hoisted_1$a = {
14993
15183
  key: 0,
14994
15184
  class: "mce-smart-selection"
14995
15185
  };
14996
15186
  const _hoisted_2$6 = ["onMousedown"];
14997
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
15187
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
14998
15188
  __name: "SmartSelection",
14999
15189
  props: {
15000
15190
  "modelValue": {},
@@ -15170,7 +15360,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15170
15360
  return;
15171
15361
  }
15172
15362
  return (_ctx, _cache) => {
15173
- return info.value.active ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
15363
+ return info.value.active ? (openBlock(), createElementBlock("div", _hoisted_1$a, [
15174
15364
  (openBlock(true), createElementBlock(Fragment, null, renderList(handles.value, (item, index) => {
15175
15365
  return openBlock(), createElementBlock("div", {
15176
15366
  key: index,
@@ -15188,7 +15378,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
15188
15378
  }, null, 42, _hoisted_2$6)
15189
15379
  ], 6);
15190
15380
  }), 128)),
15191
- transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$k, {
15381
+ transform.value.width && transform.value.height ? (openBlock(), createBlock(_sfc_main$l, {
15192
15382
  key: 0,
15193
15383
  modelValue: transform.value,
15194
15384
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => transform.value = $event),
@@ -15215,7 +15405,7 @@ const _smartSelection = definePlugin((_editor) => {
15215
15405
  components: [
15216
15406
  {
15217
15407
  type: "overlay",
15218
- component: () => h(_sfc_main$h, {
15408
+ component: () => h(_sfc_main$g, {
15219
15409
  "modelValue": currentElement.value,
15220
15410
  "onUpdate:modelValue": (el) => currentElement.value = el
15221
15411
  })
@@ -15238,7 +15428,7 @@ const _state = definePlugin((editor) => {
15238
15428
  ]
15239
15429
  };
15240
15430
  });
15241
- const _hoisted_1$a = { class: "progress-indicator" };
15431
+ const _hoisted_1$9 = { class: "progress-indicator" };
15242
15432
  const _hoisted_2$5 = {
15243
15433
  key: 0,
15244
15434
  class: "progress-indicator__status"
@@ -15248,7 +15438,7 @@ const _hoisted_4$2 = {
15248
15438
  key: 1,
15249
15439
  class: "progress-indicator__bar-indeterminate"
15250
15440
  };
15251
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
15441
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15252
15442
  __name: "ProgressIndicator",
15253
15443
  props: /* @__PURE__ */ mergeModels({
15254
15444
  label: {},
@@ -15261,7 +15451,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
15261
15451
  setup(__props) {
15262
15452
  const progress = useModel(__props, "modelValue");
15263
15453
  return (_ctx, _cache) => {
15264
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
15454
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
15265
15455
  __props.label ? (openBlock(), createElementBlock("span", _hoisted_2$5, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
15266
15456
  createElementVNode("div", _hoisted_3$5, [
15267
15457
  !__props.indeterminate ? (openBlock(), createElementBlock("div", {
@@ -15274,8 +15464,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
15274
15464
  };
15275
15465
  }
15276
15466
  });
15277
- const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-3b286483"]]);
15278
- const _hoisted_1$9 = { class: "mce-statusbar" };
15467
+ const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-3b286483"]]);
15468
+ const _hoisted_1$8 = { class: "mce-statusbar" };
15279
15469
  const _hoisted_2$4 = { class: "mce-statusbar__main" };
15280
15470
  const _hoisted_3$4 = { class: "mce-statusbar__item" };
15281
15471
  const _hoisted_4$1 = { class: "mce-statusbar__kbd" };
@@ -15297,7 +15487,7 @@ const _hoisted_19 = { class: "mce-statusbar__kbd" };
15297
15487
  const _hoisted_20 = { class: "mce-statusbar__item" };
15298
15488
  const _hoisted_21 = { class: "mce-statusbar__item" };
15299
15489
  const _hoisted_22 = { class: "mce-statusbar__progress" };
15300
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
15490
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15301
15491
  __name: "Statusbar",
15302
15492
  setup(__props) {
15303
15493
  const {
@@ -15310,7 +15500,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15310
15500
  isElement
15311
15501
  } = useEditor();
15312
15502
  return (_ctx, _cache) => {
15313
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
15503
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
15314
15504
  createElementVNode("div", _hoisted_2$4, [
15315
15505
  unref(state) === "typing" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
15316
15506
  createElementVNode("div", _hoisted_3$4, [
@@ -15324,7 +15514,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15324
15514
  ])
15325
15515
  ], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
15326
15516
  createElementVNode("div", _hoisted_8, [
15327
- createVNode(unref(_sfc_main$C), { icon: "$mouseRightClick" })
15517
+ createVNode(unref(_sfc_main$D), { icon: "$mouseRightClick" })
15328
15518
  ]),
15329
15519
  _cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
15330
15520
  createElementVNode("div", _hoisted_9, [
@@ -15338,7 +15528,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15338
15528
  ])
15339
15529
  ], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
15340
15530
  createElementVNode("div", _hoisted_14, [
15341
- createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
15531
+ createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
15342
15532
  createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
15343
15533
  ]),
15344
15534
  _cache[5] || (_cache[5] = createElementVNode("span", null, " + ", -1)),
@@ -15348,7 +15538,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15348
15538
  ]),
15349
15539
  _cache[6] || (_cache[6] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
15350
15540
  createElementVNode("div", _hoisted_17, [
15351
- createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
15541
+ createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
15352
15542
  createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
15353
15543
  ]),
15354
15544
  _cache[7] || (_cache[7] = createElementVNode("span", null, " + ", -1)),
@@ -15358,7 +15548,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15358
15548
  ]),
15359
15549
  _cache[8] || (_cache[8] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
15360
15550
  createElementVNode("div", _hoisted_20, [
15361
- createVNode(unref(_sfc_main$C), { icon: "$mouseLeftClick" }),
15551
+ createVNode(unref(_sfc_main$D), { icon: "$mouseLeftClick" }),
15362
15552
  createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
15363
15553
  ]),
15364
15554
  unref(selection).length === 1 && unref(isElement)(unref(selection)[0]) && unref(selection)[0].text.isValid() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
@@ -15382,7 +15572,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
15382
15572
  };
15383
15573
  }
15384
15574
  });
15385
- const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-a1f0e31b"]]);
15575
+ const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-a1f0e31b"]]);
15386
15576
  const _statusbar = definePlugin((editor) => {
15387
15577
  const {
15388
15578
  registerConfig
@@ -15401,7 +15591,7 @@ const _statusbar = definePlugin((editor) => {
15401
15591
  ]
15402
15592
  };
15403
15593
  });
15404
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
15594
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
15405
15595
  __name: "TextEditor",
15406
15596
  setup(__props, { expose: __expose }) {
15407
15597
  const {
@@ -15572,23 +15762,23 @@ const _text = definePlugin((editor) => {
15572
15762
  { command: "setActiveDrawingTool:text", key: "T" }
15573
15763
  ],
15574
15764
  components: [
15575
- { type: "overlay", component: _sfc_main$e }
15765
+ { type: "overlay", component: _sfc_main$d }
15576
15766
  ]
15577
15767
  };
15578
15768
  });
15579
- const _hoisted_1$8 = { class: "mce-payhead" };
15580
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
15769
+ const _hoisted_1$7 = { class: "mce-payhead" };
15770
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15581
15771
  __name: "Playhead",
15582
15772
  setup(__props) {
15583
15773
  return (_ctx, _cache) => {
15584
- return openBlock(), createElementBlock("div", _hoisted_1$8, [..._cache[0] || (_cache[0] = [
15774
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [..._cache[0] || (_cache[0] = [
15585
15775
  createElementVNode("header", { class: "mce-payhead__header" }, null, -1),
15586
15776
  createElementVNode("main", { class: "mce-payhead__main" }, null, -1)
15587
15777
  ])]);
15588
15778
  };
15589
15779
  }
15590
15780
  });
15591
- const _hoisted_1$7 = {
15781
+ const _hoisted_1$6 = {
15592
15782
  key: 0,
15593
15783
  class: "mce-segment__edge mce-segment__edge--front"
15594
15784
  };
@@ -15600,7 +15790,7 @@ const _hoisted_3$3 = {
15600
15790
  key: 1,
15601
15791
  class: "mce-segment__edge mce-segment__edge--end"
15602
15792
  };
15603
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
15793
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
15604
15794
  __name: "Segment",
15605
15795
  props: {
15606
15796
  node: {},
@@ -15666,25 +15856,25 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15666
15856
  style: normalizeStyle$1(block.style)
15667
15857
  }, toDisplayString(block.name), 5);
15668
15858
  }), 128)),
15669
- __props.active ? (openBlock(), createElementBlock("div", _hoisted_1$7)) : createCommentVNode("", true),
15859
+ __props.active ? (openBlock(), createElementBlock("div", _hoisted_1$6)) : createCommentVNode("", true),
15670
15860
  createElementVNode("span", _hoisted_2$3, toDisplayString(props.node.name), 1),
15671
15861
  __props.active ? (openBlock(), createElementBlock("div", _hoisted_3$3)) : createCommentVNode("", true)
15672
15862
  ], 6);
15673
15863
  };
15674
15864
  }
15675
15865
  });
15676
- const _hoisted_1$6 = { class: "mce-track" };
15677
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
15866
+ const _hoisted_1$5 = { class: "mce-track" };
15867
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15678
15868
  __name: "Track",
15679
15869
  setup(__props) {
15680
15870
  return (_ctx, _cache) => {
15681
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
15871
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
15682
15872
  renderSlot(_ctx.$slots, "default")
15683
15873
  ]);
15684
15874
  };
15685
15875
  }
15686
15876
  });
15687
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
15877
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15688
15878
  __name: "Trackhead",
15689
15879
  props: {
15690
15880
  node: {}
@@ -15700,14 +15890,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15700
15890
  };
15701
15891
  }
15702
15892
  });
15703
- const _hoisted_1$5 = { class: "mce-timeline__toolbar" };
15893
+ const _hoisted_1$4 = { class: "mce-timeline__toolbar" };
15704
15894
  const _hoisted_2$2 = { class: "mce-timeline__main" };
15705
15895
  const _hoisted_3$2 = { class: "mce-timeline__left" };
15706
15896
  const _hoisted_4 = { class: "mce-timeline__left-wrapper" };
15707
15897
  const _hoisted_5 = { class: "mce-timeline__right-wrapper" };
15708
15898
  const _hoisted_6 = { class: "mce-timeline__ruler" };
15709
15899
  const _hoisted_7 = { class: "mce-timeline__track" };
15710
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15900
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15711
15901
  __name: "Timeline",
15712
15902
  setup(__props) {
15713
15903
  const {
@@ -15808,12 +15998,12 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15808
15998
  onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
15809
15999
  }, ["prevent"]))
15810
16000
  }, [
15811
- createElementVNode("div", _hoisted_1$5, [
16001
+ createElementVNode("div", _hoisted_1$4, [
15812
16002
  createElementVNode("div", {
15813
16003
  class: "mce-timeline__play",
15814
16004
  onClick: toggle
15815
16005
  }, [
15816
- createVNode(unref(_sfc_main$C), {
16006
+ createVNode(unref(_sfc_main$D), {
15817
16007
  icon: paused.value ? "$play" : "$pause"
15818
16008
  }, null, 8, ["icon"])
15819
16009
  ])
@@ -15827,7 +16017,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15827
16017
  })
15828
16018
  }, [
15829
16019
  (openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
15830
- return openBlock(), createBlock(_sfc_main$a, {
16020
+ return openBlock(), createBlock(_sfc_main$9, {
15831
16021
  key: index,
15832
16022
  node
15833
16023
  }, null, 8, ["node"]);
@@ -15842,7 +16032,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15842
16032
  }, [
15843
16033
  createElementVNode("div", _hoisted_5, [
15844
16034
  createElementVNode("div", _hoisted_6, [
15845
- createVNode(_sfc_main$p, {
16035
+ createVNode(_sfc_main$q, {
15846
16036
  ref: "rulerTpl",
15847
16037
  zoom: 1 / unref(msPerPx) * fps.value,
15848
16038
  unit: 100,
@@ -15860,9 +16050,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15860
16050
  })
15861
16051
  }, [
15862
16052
  (openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
15863
- return openBlock(), createBlock(_sfc_main$b, { key: index }, {
16053
+ return openBlock(), createBlock(_sfc_main$a, { key: index }, {
15864
16054
  default: withCtx(() => [
15865
- createVNode(_sfc_main$c, {
16055
+ createVNode(_sfc_main$b, {
15866
16056
  node,
15867
16057
  "ms-per-px": unref(msPerPx),
15868
16058
  active: unref(selection).some((v) => v.equal(node)),
@@ -15874,7 +16064,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15874
16064
  }), 128))
15875
16065
  ], 4)
15876
16066
  ]),
15877
- createVNode(_sfc_main$d, {
16067
+ createVNode(_sfc_main$c, {
15878
16068
  style: normalizeStyle$1({
15879
16069
  transform: `translate(${offset2.value[0] + Math.ceil(unref(currentTime) / unref(msPerPx))}px, 0px)`
15880
16070
  })
@@ -15899,7 +16089,7 @@ const _timeline = definePlugin((editor) => {
15899
16089
  type: "panel",
15900
16090
  position: "bottom",
15901
16091
  size: 160,
15902
- component: _sfc_main$9
16092
+ component: _sfc_main$8
15903
16093
  }
15904
16094
  ],
15905
16095
  hotkeys: [
@@ -15907,10 +16097,10 @@ const _timeline = definePlugin((editor) => {
15907
16097
  ]
15908
16098
  };
15909
16099
  });
15910
- const _hoisted_1$4 = { class: "mce-toolbelt" };
16100
+ const _hoisted_1$3 = { class: "mce-toolbelt" };
15911
16101
  const _hoisted_2$1 = { key: 0 };
15912
16102
  const _hoisted_3$1 = { key: 1 };
15913
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16103
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
15914
16104
  __name: "Toolbelt",
15915
16105
  setup(__props) {
15916
16106
  const {
@@ -16009,19 +16199,19 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16009
16199
  ];
16010
16200
  });
16011
16201
  return (_ctx, _cache) => {
16012
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
16202
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
16013
16203
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (tool, key) => {
16014
16204
  return openBlock(), createElementBlock("div", {
16015
16205
  key,
16016
16206
  class: "mce-toolbelt__group"
16017
16207
  }, [
16018
- createVNode(_sfc_main$q, {
16208
+ createVNode(_sfc_main$r, {
16019
16209
  location: "top",
16020
16210
  offset: 12,
16021
16211
  "show-arrow": ""
16022
16212
  }, {
16023
16213
  activator: withCtx(({ props: slotProps }) => [
16024
- createVNode(_sfc_main$y, mergeProps({
16214
+ createVNode(_sfc_main$z, mergeProps({
16025
16215
  icon: "",
16026
16216
  class: "mce-toolbelt__btn",
16027
16217
  active: tool.active || tool.checked || false
@@ -16029,7 +16219,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16029
16219
  onClick: tool.handle
16030
16220
  }), {
16031
16221
  default: withCtx(() => [
16032
- createVNode(unref(_sfc_main$C), {
16222
+ createVNode(unref(_sfc_main$D), {
16033
16223
  icon: `$${tool.key}`
16034
16224
  }, null, 8, ["icon"])
16035
16225
  ]),
@@ -16044,19 +16234,19 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16044
16234
  ]),
16045
16235
  _: 2
16046
16236
  }, 1024),
16047
- tool.children?.length ? (openBlock(), createBlock(_sfc_main$t, {
16237
+ tool.children?.length ? (openBlock(), createBlock(_sfc_main$u, {
16048
16238
  key: 0,
16049
16239
  items: tool.children,
16050
16240
  offset: 12,
16051
16241
  location: "top-start"
16052
16242
  }, {
16053
16243
  activator: withCtx(({ props }) => [
16054
- createVNode(_sfc_main$y, mergeProps({
16244
+ createVNode(_sfc_main$z, mergeProps({
16055
16245
  icon: "",
16056
16246
  class: "mce-toolbelt__arrow"
16057
16247
  }, { ref_for: true }, props), {
16058
16248
  default: withCtx(() => [
16059
- createVNode(unref(_sfc_main$C), { icon: "$arrowDown" })
16249
+ createVNode(unref(_sfc_main$D), { icon: "$arrowDown" })
16060
16250
  ]),
16061
16251
  _: 1
16062
16252
  }, 16)
@@ -16072,7 +16262,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
16072
16262
  ], 64)) : createCommentVNode("", true)
16073
16263
  ]),
16074
16264
  prepend: withCtx(({ item }) => [
16075
- createVNode(unref(_sfc_main$C), {
16265
+ createVNode(unref(_sfc_main$D), {
16076
16266
  class: "mce-toolbelt__icon",
16077
16267
  icon: `$${item.key}`
16078
16268
  }, null, 8, ["icon"])
@@ -16096,7 +16286,7 @@ const _toolbelt = definePlugin((editor) => {
16096
16286
  {
16097
16287
  name: "toolbelt",
16098
16288
  type: "overlay",
16099
- component: _sfc_main$8,
16289
+ component: _sfc_main$7,
16100
16290
  ignore: () => !toolbelt.value
16101
16291
  }
16102
16292
  ]
@@ -16601,7 +16791,7 @@ function useEditor() {
16601
16791
  }
16602
16792
  return editor;
16603
16793
  }
16604
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
16794
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16605
16795
  __name: "Floatbar",
16606
16796
  props: {
16607
16797
  ...makeMceOverlayProps({
@@ -16646,7 +16836,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
16646
16836
  updateLocation
16647
16837
  });
16648
16838
  return (_ctx, _cache) => {
16649
- return openBlock(), createBlock(_sfc_main$u, {
16839
+ return openBlock(), createBlock(_sfc_main$v, {
16650
16840
  ref: "overlayTpl",
16651
16841
  "content-style": style.value,
16652
16842
  class: "mce-floatbar",
@@ -16665,11 +16855,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
16665
16855
  };
16666
16856
  }
16667
16857
  });
16668
- const _hoisted_1$3 = {
16858
+ const _hoisted_1$2 = {
16669
16859
  key: 0,
16670
16860
  class: "mce-float-panel__title"
16671
16861
  };
16672
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16862
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
16673
16863
  __name: "FloatPanel",
16674
16864
  props: /* @__PURE__ */ mergeModels({
16675
16865
  title: {},
@@ -16693,7 +16883,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16693
16883
  isActive
16694
16884
  };
16695
16885
  return (_ctx, _cache) => {
16696
- return openBlock(), createBlock(_sfc_main$k, {
16886
+ return openBlock(), createBlock(_sfc_main$l, {
16697
16887
  modelValue: transform.value,
16698
16888
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => transform.value = $event),
16699
16889
  class: "mce-float-panel",
@@ -16703,14 +16893,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16703
16893
  }, {
16704
16894
  default: withCtx(({ props: slotProps }) => [
16705
16895
  createElementVNode("div", mergeProps({ class: "mce-float-panel__card" }, slotProps), [
16706
- __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
16896
+ __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
16707
16897
  createElementVNode("div", null, toDisplayString(__props.title), 1),
16708
- createVNode(_sfc_main$y, {
16898
+ createVNode(_sfc_main$z, {
16709
16899
  icon: "",
16710
16900
  onClick: _cache[0] || (_cache[0] = ($event) => isActive.value = false)
16711
16901
  }, {
16712
16902
  default: withCtx(() => [
16713
- createVNode(unref(_sfc_main$C), { icon: "$close" })
16903
+ createVNode(unref(_sfc_main$D), { icon: "$close" })
16714
16904
  ]),
16715
16905
  _: 1
16716
16906
  })
@@ -16729,7 +16919,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
16729
16919
  };
16730
16920
  }
16731
16921
  });
16732
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
16922
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16733
16923
  __name: "Layout",
16734
16924
  props: {
16735
16925
  class: [String, Array, Object],
@@ -16763,7 +16953,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
16763
16953
  };
16764
16954
  }
16765
16955
  });
16766
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16956
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16767
16957
  __name: "LayoutItem",
16768
16958
  props: {
16769
16959
  class: [String, Array, Object],
@@ -16809,11 +16999,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16809
16999
  };
16810
17000
  }
16811
17001
  });
16812
- const _hoisted_1$2 = {
17002
+ const _hoisted_1$1 = {
16813
17003
  key: 0,
16814
17004
  class: "mce-main__scroller"
16815
17005
  };
16816
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
17006
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
16817
17007
  __name: "Main",
16818
17008
  props: {
16819
17009
  scrollable: Boolean
@@ -16828,14 +17018,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16828
17018
  ]]),
16829
17019
  style: normalizeStyle$1([unref(mainStyles)])
16830
17020
  }, [
16831
- props.scrollable ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
17021
+ props.scrollable ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
16832
17022
  renderSlot(_ctx.$slots, "default")
16833
17023
  ])) : renderSlot(_ctx.$slots, "default", { key: 1 })
16834
17024
  ], 6);
16835
17025
  };
16836
17026
  }
16837
17027
  });
16838
- const _hoisted_1$1 = ["data-pixel-ratio"];
17028
+ const _hoisted_1 = ["data-pixel-ratio"];
16839
17029
  const _hoisted_2 = {
16840
17030
  ref: "canvasTpl",
16841
17031
  class: "mce-editor__canvas"
@@ -16844,7 +17034,7 @@ const _hoisted_3 = {
16844
17034
  ref: "overlayContainerTpl",
16845
17035
  class: "mce-overlay-container"
16846
17036
  };
16847
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17037
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16848
17038
  __name: "EditorLayout",
16849
17039
  props: {
16850
17040
  ...makeMceStrategyProps({
@@ -16881,12 +17071,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
16881
17071
  hoverElement,
16882
17072
  state,
16883
17073
  setCursor,
16884
- selectArea,
16885
17074
  exec,
16886
17075
  isLock,
16887
17076
  t,
16888
17077
  selectionAabbInDrawboard,
16889
- selectionArea,
17078
+ selectionMarquee,
16890
17079
  elementSelection,
16891
17080
  drawboardAabb,
16892
17081
  drawboardPointer,
@@ -17016,11 +17205,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17016
17205
  if (state.value !== "selecting") {
17017
17206
  state.value = "selecting";
17018
17207
  }
17019
- selectionArea.value.x = Math.min(start.x, current.x) - drawboardAabb.value.left;
17020
- selectionArea.value.y = Math.min(start.y, current.y) - drawboardAabb.value.top;
17021
- selectionArea.value.width = Math.abs(start.x - current.x);
17022
- selectionArea.value.height = Math.abs(start.y - current.y);
17023
- selected = selectArea(selectionArea.value);
17208
+ selectionMarquee.value.x = Math.min(start.x, current.x) - drawboardAabb.value.left;
17209
+ selectionMarquee.value.y = Math.min(start.y, current.y) - drawboardAabb.value.top;
17210
+ selectionMarquee.value.width = Math.abs(start.x - current.x);
17211
+ selectionMarquee.value.height = Math.abs(start.y - current.y);
17212
+ exec("marqueeSelect");
17213
+ selected = elementSelection.value;
17024
17214
  }
17025
17215
  function onActivate() {
17026
17216
  const result = props.activeStrategy({
@@ -17204,7 +17394,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17204
17394
  editor
17205
17395
  };
17206
17396
  return (_ctx, _cache) => {
17207
- return openBlock(), createBlock(_sfc_main$5, {
17397
+ return openBlock(), createBlock(_sfc_main$4, {
17208
17398
  class: normalizeClass(["mce-editor", [
17209
17399
  unref(state) && `mce-editor--${unref(state)}`,
17210
17400
  unref(activeDrawingTool) && `mce-editor--drawing-tool-${unref(activeDrawingTool).name}`,
@@ -17212,7 +17402,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17212
17402
  ]])
17213
17403
  }, {
17214
17404
  default: withCtx(() => [
17215
- createVNode(_sfc_main$3, null, {
17405
+ createVNode(_sfc_main$2, null, {
17216
17406
  default: withCtx(() => [
17217
17407
  createElementVNode("div", {
17218
17408
  ref_key: "drawboardDom",
@@ -17225,7 +17415,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17225
17415
  }, ["prevent"]))
17226
17416
  }, [
17227
17417
  createElementVNode("canvas", _hoisted_2, null, 512),
17228
- slots["floatbar-top"] || slots.floatbar ? (openBlock(), createBlock(_sfc_main$7, {
17418
+ slots["floatbar-top"] || slots.floatbar ? (openBlock(), createBlock(_sfc_main$6, {
17229
17419
  key: 0,
17230
17420
  location: "top-start",
17231
17421
  target: unref(state) === "typing" ? unref(componentRefs)["mce:text"]?.[0]?.textEditor : unref(componentRefs)["mce:selection"]?.[0]?.transformControls?.$el,
@@ -17237,7 +17427,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17237
17427
  ]),
17238
17428
  _: 3
17239
17429
  }, 8, ["target"])) : createCommentVNode("", true),
17240
- slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$7, {
17430
+ slots["floatbar-bottom"] ? (openBlock(), createBlock(_sfc_main$6, {
17241
17431
  key: 1,
17242
17432
  location: "bottom-start",
17243
17433
  target: unref(componentRefs)["mce:selection"]?.[0]?.transformControls?.$el,
@@ -17249,7 +17439,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17249
17439
  _: 3
17250
17440
  }, 8, ["target"])) : createCommentVNode("", true),
17251
17441
  renderSlot(_ctx.$slots, "drawboard", normalizeProps(guardReactiveProps(slotProps)))
17252
- ], 40, _hoisted_1$1)
17442
+ ], 40, _hoisted_1)
17253
17443
  ]),
17254
17444
  _: 3
17255
17445
  }),
@@ -17265,7 +17455,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17265
17455
  ], 8, ["to"])) : createCommentVNode("", true)
17266
17456
  ], 64)) : item.type === "panel" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
17267
17457
  item.position === "float" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
17268
- unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$6, {
17458
+ unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$5, {
17269
17459
  key: 0,
17270
17460
  modelValue: unref(config)[item.name],
17271
17461
  "onUpdate:modelValue": ($event) => unref(config)[item.name] = $event,
@@ -17287,7 +17477,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17287
17477
  _: 2
17288
17478
  }, 1032, ["modelValue", "onUpdate:modelValue", "title", "default-transform"])) : createCommentVNode("", true)
17289
17479
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
17290
- unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$4, {
17480
+ unref(config)[item.name] ? (openBlock(), createBlock(_sfc_main$3, {
17291
17481
  key: 0,
17292
17482
  modelValue: unref(config)[item.name],
17293
17483
  "onUpdate:modelValue": ($event) => unref(config)[item.name] = $event,
@@ -17311,178 +17501,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17311
17501
  };
17312
17502
  }
17313
17503
  });
17314
- const _hoisted_1 = { class: "mce-cropper" };
17315
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17316
- __name: "Cropper",
17317
- props: /* @__PURE__ */ mergeModels({
17318
- image: {},
17319
- minScale: { default: 0.1 },
17320
- maxScale: { default: 3 }
17321
- }, {
17322
- "modelValue": { default: () => ({}) },
17323
- "modelModifiers": {},
17324
- "style": { default: () => ({}) },
17325
- "styleModifiers": {}
17326
- }),
17327
- emits: /* @__PURE__ */ mergeModels(["start", "end", "update:transform"], ["update:modelValue", "update:style"]),
17328
- setup(__props, { emit: __emit }) {
17329
- const props = __props;
17330
- const emit = __emit;
17331
- const cropRect = useModel(__props, "modelValue");
17332
- const styleModel = useModel(__props, "style");
17333
- const rootBox = ref({ width: 0, height: 0 });
17334
- const { state: imageRef } = useImage(
17335
- computed(() => ({
17336
- src: props.image
17337
- }))
17338
- );
17339
- const backup = cloneDeep(cropRect.value);
17340
- const canvasRef = useTemplateRef("canvasRef");
17341
- const computedCropRect = computed({
17342
- get: () => {
17343
- const { left = 0, top = 0, right = 0, bottom = 0 } = cropRect.value;
17344
- return { left, top, right, bottom };
17345
- },
17346
- set: (val) => cropRect.value = val
17347
- });
17348
- const inverseMat = computed(() => {
17349
- const { left, top, right, bottom } = computedCropRect.value;
17350
- const sx = 1 / (1 - left - right);
17351
- const sy = 1 / (1 - top - bottom);
17352
- const tx = -left;
17353
- const ty = -top;
17354
- return { sx, sy, tx, ty };
17355
- });
17356
- const sourceTransform = computed({
17357
- get: () => {
17358
- const { sx, sy, tx, ty } = inverseMat.value;
17359
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17360
- const { width, height } = rootBox.value;
17361
- return {
17362
- width: sx * width,
17363
- height: sy * height,
17364
- left: tx * scaleX * (sx * width),
17365
- top: ty * scaleY * (sy * height)
17366
- };
17367
- },
17368
- set: (newValue) => {
17369
- const { width, height } = rootBox.value;
17370
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17371
- const transform = {
17372
- sx: newValue.width / width,
17373
- sy: newValue.height / height,
17374
- tx: newValue.left / newValue.width / scaleX,
17375
- ty: newValue.top / newValue.height / scaleY
17376
- };
17377
- const left = -transform.tx;
17378
- const top = -transform.ty;
17379
- const w = 1 - 1 / transform.sx;
17380
- const h2 = 1 - 1 / transform.sy;
17381
- const right = w - left;
17382
- const bottom = h2 - top;
17383
- computedCropRect.value = { left, top, right, bottom };
17384
- }
17385
- });
17386
- const scale = computed({
17387
- get: () => inverseMat.value.sx,
17388
- set: (value) => {
17389
- const transform = inverseMat.value;
17390
- const rate = transform.sx / value;
17391
- const left = -transform.tx;
17392
- const top = -transform.ty;
17393
- const w = 1 - 1 / value;
17394
- const h2 = 1 - 1 / transform.sy * rate;
17395
- const right = w - left;
17396
- const bottom = h2 - top;
17397
- computedCropRect.value = { left, top, right, bottom };
17398
- }
17399
- });
17400
- onBeforeMount(() => emit("start"));
17401
- onBeforeUnmount(() => emit("end"));
17402
- const sourceStyle = computed(() => {
17403
- const { sx, sy, tx, ty } = inverseMat.value;
17404
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17405
- return {
17406
- transform: [
17407
- `scale(${sx}, ${sy})`,
17408
- `translate(${tx * scaleX * 100}%, ${ty * scaleY * 100}%)`
17409
- ].join(" ")
17410
- };
17411
- });
17412
- watch([canvasRef, imageRef], render2);
17413
- watch(computedCropRect, render2, { deep: true });
17414
- watch([() => styleModel.value.scaleX, () => styleModel.value.scaleY], render2);
17415
- function render2() {
17416
- const ctx = canvasRef.value?.getContext("2d");
17417
- if (!ctx || !imageRef.value)
17418
- return;
17419
- const { scaleX = 1, scaleY = 1 } = styleModel.value;
17420
- const { naturalWidth, naturalHeight } = imageRef.value;
17421
- ctx.canvas.width = naturalWidth;
17422
- ctx.canvas.height = naturalHeight;
17423
- ctx.clearRect(0, 0, naturalWidth, naturalHeight);
17424
- ctx.globalAlpha = 0.4;
17425
- ctx.scale(scaleX, scaleY);
17426
- ctx.drawImage(imageRef.value, 0, 0, naturalWidth, naturalHeight);
17427
- }
17428
- function ok() {
17429
- emit("end");
17430
- }
17431
- function cancel() {
17432
- cropRect.value = backup;
17433
- ok();
17434
- }
17435
- function onResizeObserver(entries) {
17436
- const { width, height } = entries[0].contentRect;
17437
- rootBox.value = { width, height };
17438
- }
17439
- function applySourceTransformToStyle() {
17440
- const { left = 0, top = 0, width = 0, height = 0 } = styleModel.value;
17441
- const { sx, sy, tx, ty } = inverseMat.value;
17442
- cropRect.value = {};
17443
- styleModel.value = {
17444
- ...styleModel.value,
17445
- width: sx * width,
17446
- height: sy * height,
17447
- left: left + tx * (sx * width),
17448
- top: top + ty * (sy * height)
17449
- };
17450
- ok();
17451
- }
17452
- return (_ctx, _cache) => {
17453
- return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
17454
- createElementVNode("div", {
17455
- class: "mce-cropper__source",
17456
- style: normalizeStyle$1(sourceStyle.value)
17457
- }, [
17458
- createElementVNode("canvas", {
17459
- ref_key: "canvasRef",
17460
- ref: canvasRef
17461
- }, null, 512)
17462
- ], 4),
17463
- createVNode(_sfc_main$k, {
17464
- modelValue: sourceTransform.value,
17465
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
17466
- class: "mce-cropper__transform",
17467
- rotatable: false
17468
- }, {
17469
- default: withCtx(({ props: slotProps }) => [
17470
- createElementVNode("div", mergeProps({ class: "mce-cropper__transform_rect" }, slotProps), null, 16)
17471
- ]),
17472
- _: 1
17473
- }, 8, ["modelValue"]),
17474
- renderSlot(_ctx.$slots, "default", {
17475
- scale: scale.value,
17476
- ok,
17477
- cancel,
17478
- applySourceTransformToStyle
17479
- })
17480
- ])), [
17481
- [unref(vResizeObserver), onResizeObserver]
17482
- ]);
17483
- };
17484
- }
17485
- });
17486
17504
  const _sfc_main = /* @__PURE__ */ defineComponent({
17487
17505
  __name: "Dialog",
17488
17506
  props: /* @__PURE__ */ mergeModels({
@@ -17510,7 +17528,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17510
17528
  updateLocation
17511
17529
  });
17512
17530
  return (_ctx, _cache) => {
17513
- return openBlock(), createBlock(_sfc_main$u, {
17531
+ return openBlock(), createBlock(_sfc_main$v, {
17514
17532
  ref: "overlayTpl",
17515
17533
  modelValue: isActive.value,
17516
17534
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -17534,14 +17552,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17534
17552
  }
17535
17553
  });
17536
17554
  export {
17537
- _sfc_main$1 as Cropper,
17555
+ _sfc_main$k as Cropper,
17538
17556
  _sfc_main as Dialog,
17539
17557
  Doc,
17540
17558
  Editor,
17541
- _sfc_main$w as EditorLayers,
17542
- _sfc_main$2 as EditorLayout,
17543
- _sfc_main$4 as EditorLayoutItem,
17544
- _sfc_main$8 as EditorToolbelt,
17559
+ _sfc_main$x as EditorLayers,
17560
+ _sfc_main$1 as EditorLayout,
17561
+ _sfc_main$3 as EditorLayoutItem,
17562
+ _sfc_main$7 as EditorToolbelt,
17545
17563
  IconsSymbol,
17546
17564
  MceLayerItemKey,
17547
17565
  MceLayerKey,
@@ -17549,12 +17567,12 @@ export {
17549
17567
  MceLayoutKey,
17550
17568
  MceMenuSymbol,
17551
17569
  MceOverlaySymbol,
17552
- _sfc_main$t as Menu,
17570
+ _sfc_main$u as Menu,
17553
17571
  Model,
17554
- _sfc_main$p as Ruler,
17572
+ _sfc_main$q as Ruler,
17555
17573
  SUPPORTS_CLIPBOARD,
17556
- _sfc_main$n as Scrollbar,
17557
- _sfc_main$k as TransformControls,
17574
+ _sfc_main$o as Scrollbar,
17575
+ _sfc_main$l as TransformControls,
17558
17576
  USER_AGENT,
17559
17577
  boundingBoxToStyle,
17560
17578
  consoleError,