mce 0.11.4 → 0.12.0

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,4 +1,4 @@
1
- import { ref, computed, watch, markRaw, reactive, warn, shallowRef, onBeforeUnmount, onMounted, inject, provide, defineComponent, createVNode, mergeProps, createElementVNode, toValue, getCurrentInstance, onScopeDispose, createElementBlock, openBlock, Fragment, renderList, unref, normalizeStyle, normalizeClass, readonly, toRef, useId, onDeactivated, onActivated, useAttrs, createBlock, resolveDynamicComponent, useTemplateRef, renderSlot, Teleport, createCommentVNode, mergeModels, useModel, resolveComponent, withCtx, createTextVNode, toDisplayString, createSlots, normalizeProps, guardReactiveProps, withDirectives, vShow, vModelText, nextTick, withModifiers, onBeforeMount, isRef } from "vue";
1
+ import { ref, computed, watch, markRaw, reactive, warn, shallowRef, onBeforeUnmount, onMounted, inject, provide, defineComponent, createVNode, mergeProps, createElementVNode, toValue, getCurrentInstance, onScopeDispose, createElementBlock, openBlock, Fragment, renderList, unref, normalizeStyle, normalizeClass, readonly, toRef, useId, onDeactivated, onActivated, useAttrs, createBlock, resolveDynamicComponent, useTemplateRef, renderSlot, Teleport, createCommentVNode, mergeModels, useModel, resolveComponent, withCtx, createTextVNode, toDisplayString, createSlots, normalizeProps, guardReactiveProps, onBeforeMount, withDirectives, vShow, vModelText, nextTick, withModifiers, isRef } from "vue";
2
2
  import { useFileDialog, useEventListener, isClient, useResizeObserver as useResizeObserver$1, useLocalStorage, onClickOutside, useMouse, useDebounceFn } from "@vueuse/core";
3
3
  import { Node as Node$1, Element2D, Timeline, Engine, Camera2D, DrawboardEffect, IN_BROWSER, clamp, assets, TimelineNode, Transform2D, DEG_TO_RAD, render, Animation } from "modern-canvas";
4
4
  import { getObjectValueByPath, setObjectValueByPath, Observable, Reactivable, idGenerator, property, normalizeElement, normalizeTextContent } from "modern-idoc";
@@ -124,6 +124,26 @@ const _0_config_base = defineMixin((editor, options) => {
124
124
  registerConfig("typographyStrategy", "autoHeight");
125
125
  registerConfig("handleShape", "rect");
126
126
  registerConfig("localDb", false);
127
+ const screenCenterOffset = { left: 0, top: 0, bottom: 0, right: 0 };
128
+ registerConfig("screenCenterOffset", { ...screenCenterOffset });
129
+ const getScreenCenterOffset = () => {
130
+ const offset2 = {
131
+ ...screenCenterOffset,
132
+ ...config.value.screenCenterOffset
133
+ };
134
+ if (config.value.scrollbar) {
135
+ offset2.right += 8;
136
+ offset2.bottom += 8;
137
+ }
138
+ if (config.value.ruler) {
139
+ offset2.left += 16;
140
+ offset2.top += 16;
141
+ }
142
+ return offset2;
143
+ };
144
+ Object.assign(editor, {
145
+ getScreenCenterOffset
146
+ });
127
147
  return () => {
128
148
  const {
129
149
  camera,
@@ -490,7 +510,8 @@ function initYElement(yMap, element = {}, parentId, regenId = false) {
490
510
  yMap.set("name", normalized.name ?? id);
491
511
  yMap.set("childrenIds", yChildrenIds);
492
512
  yMap.set("meta", new Y.Map(Object.entries(normalized.meta ?? {})));
493
- if (normalized?.meta?.inCanvasIs === "Element2D") {
513
+ const inCanvasIs = normalized?.meta?.inCanvasIs;
514
+ if (inCanvasIs === "Element2D" || inCanvasIs === "Lottie2D") {
494
515
  yMap.set("style", new Y.Map(Object.entries(normalized.style ?? {})));
495
516
  yMap.set("background", new Y.Map(Object.entries(normalized.background ?? {})));
496
517
  yMap.set("shape", new Y.Map(Object.entries(normalized.shape ?? {})));
@@ -1026,7 +1047,6 @@ const en = {
1026
1047
  "view:timeline": "Timeline",
1027
1048
  "view:statusbar": "Statusbar",
1028
1049
  "view:frameOutline": "Frame outlines",
1029
- "zoom": "Zoom",
1030
1050
  "zoomIn": "Zoom in",
1031
1051
  "zoomOut": "Zoom out",
1032
1052
  "zoomTo100": "Zoom to 100%",
@@ -1256,10 +1276,10 @@ function getImageSizeFromUrl(url, opts = {}) {
1256
1276
  });
1257
1277
  }
1258
1278
  const imageMimeTypeExtMap = {
1279
+ // 'image/svg+xml': ['.svg'],
1259
1280
  "image/jpeg": [".jpg", ".jpeg"],
1260
1281
  "image/png": [".png"],
1261
1282
  "image/gif": [".gif"],
1262
- "image/svg+xml": [".svg"],
1263
1283
  "image/tiff": [".tif", ".tiff"],
1264
1284
  "image/bmp": [".bmp"],
1265
1285
  "image/x-ms-bmp": [".bmp"],
@@ -1711,8 +1731,8 @@ const _2_box = defineMixin((editor) => {
1711
1731
  obb.top *= zoom.y;
1712
1732
  obb.width *= zoom.x;
1713
1733
  obb.height *= zoom.y;
1714
- obb.left += position.x;
1715
- obb.top += position.y;
1734
+ obb.left -= position.x;
1735
+ obb.top -= position.y;
1716
1736
  } else if (inTarget === "frame") {
1717
1737
  const first = Array.isArray(node) ? node[0] : node;
1718
1738
  if (first instanceof Element2D) {
@@ -1814,12 +1834,12 @@ const _2_box = defineMixin((editor) => {
1814
1834
  _aabb.top *= zoom.y;
1815
1835
  _aabb.width *= zoom.x;
1816
1836
  _aabb.height *= zoom.y;
1817
- _aabb.left += position.x;
1818
- _aabb.top += position.y;
1837
+ _aabb.left -= position.x;
1838
+ _aabb.top -= position.y;
1819
1839
  return _aabb;
1820
1840
  }
1821
1841
  const rootAabb = computed(() => getAabb(root.value.children));
1822
- const currentAabb = computed(() => getAabb(selection.value));
1842
+ const selectionAabb = computed(() => getAabb(selection.value));
1823
1843
  Object.assign(editor, {
1824
1844
  obbToFit,
1825
1845
  getObb,
@@ -1828,7 +1848,7 @@ const _2_box = defineMixin((editor) => {
1828
1848
  getAabbInDrawboard,
1829
1849
  aabbToDrawboardAabb,
1830
1850
  rootAabb,
1831
- currentAabb
1851
+ selectionAabb
1832
1852
  });
1833
1853
  });
1834
1854
  const _2_export = defineMixin((editor) => {
@@ -2516,6 +2536,88 @@ const _4_4_doc = defineMixin((editor, options) => {
2516
2536
  }
2517
2537
  };
2518
2538
  });
2539
+ const _scroll$1 = defineMixin((editor) => {
2540
+ const {
2541
+ camera,
2542
+ getAabb,
2543
+ selectionAabb,
2544
+ viewAabb,
2545
+ drawboardAabb,
2546
+ getScreenCenterOffset
2547
+ } = editor;
2548
+ const scrollTo = async (target, options = {}) => {
2549
+ const {
2550
+ behavior,
2551
+ duration = 500
2552
+ } = options;
2553
+ const _camera = camera.value;
2554
+ const screenCenterOffset = getScreenCenterOffset();
2555
+ const offset2 = { x: 0, y: 0 };
2556
+ let position = { x: 0, y: 0 };
2557
+ if (typeof target === "object" && "x" in target && "y" in target) {
2558
+ position.x = target.x;
2559
+ position.y = target.y;
2560
+ } else {
2561
+ let aabb;
2562
+ if (Array.isArray(target)) {
2563
+ aabb = getAabb(target);
2564
+ } else {
2565
+ switch (target) {
2566
+ case "selection":
2567
+ aabb = selectionAabb.value;
2568
+ break;
2569
+ case "root":
2570
+ default:
2571
+ aabb = viewAabb.value;
2572
+ break;
2573
+ }
2574
+ }
2575
+ position = { x: aabb.left + aabb.width / 2, y: aabb.top + aabb.height / 2 };
2576
+ offset2.x -= screenCenterOffset.left;
2577
+ offset2.y -= screenCenterOffset.top;
2578
+ offset2.x -= (drawboardAabb.value.width - screenCenterOffset.left - screenCenterOffset.right) / 2;
2579
+ offset2.y -= (drawboardAabb.value.height - screenCenterOffset.top - screenCenterOffset.bottom) / 2;
2580
+ }
2581
+ position.x *= _camera.zoom.x;
2582
+ position.x += offset2.x;
2583
+ position.y *= _camera.zoom.y;
2584
+ position.y += offset2.y;
2585
+ const oldPosition = { x: _camera.position.x, y: _camera.position.y };
2586
+ switch (behavior) {
2587
+ case "smooth":
2588
+ await new Promise((resolve) => {
2589
+ const positionDistance = {
2590
+ x: position.x - oldPosition.x,
2591
+ y: position.y - oldPosition.y
2592
+ };
2593
+ const startTime = performance.now();
2594
+ function step(now) {
2595
+ const elapsed = now - startTime;
2596
+ const progress = Math.min(elapsed / duration, 1);
2597
+ const ease = progress < 0.5 ? 2 * progress * progress : -1 + (4 - 2 * progress) * progress;
2598
+ _camera.position.set(
2599
+ oldPosition.x + positionDistance.x * ease,
2600
+ oldPosition.y + positionDistance.y * ease
2601
+ );
2602
+ if (elapsed < duration) {
2603
+ requestAnimationFrame(step);
2604
+ } else {
2605
+ resolve();
2606
+ }
2607
+ }
2608
+ requestAnimationFrame(step);
2609
+ });
2610
+ break;
2611
+ case "instant":
2612
+ default:
2613
+ _camera.position.set(position.x, position.y);
2614
+ break;
2615
+ }
2616
+ };
2617
+ Object.assign(editor, {
2618
+ scrollTo
2619
+ });
2620
+ });
2519
2621
  const _snapshot = defineMixin((editor) => {
2520
2622
  const {
2521
2623
  renderEngine,
@@ -2627,6 +2729,114 @@ const _snapshot = defineMixin((editor) => {
2627
2729
  });
2628
2730
  };
2629
2731
  });
2732
+ const _zoom$1 = defineMixin((editor) => {
2733
+ const {
2734
+ camera,
2735
+ drawboardAabb,
2736
+ selectionAabb,
2737
+ viewAabb,
2738
+ getAabb,
2739
+ getScreenCenterOffset
2740
+ } = editor;
2741
+ const zoomTo = async (target, options = {}) => {
2742
+ const {
2743
+ mode = "contain",
2744
+ duration = 500,
2745
+ behavior
2746
+ } = options;
2747
+ let aabb;
2748
+ if (Array.isArray(target)) {
2749
+ aabb = getAabb(target);
2750
+ } else {
2751
+ switch (target) {
2752
+ case "selection":
2753
+ aabb = selectionAabb.value;
2754
+ break;
2755
+ case "root":
2756
+ default:
2757
+ aabb = viewAabb.value;
2758
+ break;
2759
+ }
2760
+ }
2761
+ const offset2 = getScreenCenterOffset();
2762
+ const { width, height } = drawboardAabb.value;
2763
+ const tw = width - (offset2.left + offset2.right);
2764
+ const th = height - (offset2.top + offset2.bottom);
2765
+ const sx = aabb.left;
2766
+ const sy = aabb.top;
2767
+ const sw = aabb.width;
2768
+ const sh = aabb.height;
2769
+ if (!sw || !sh)
2770
+ return;
2771
+ const zw = tw / sw;
2772
+ const zh = th / sh;
2773
+ const _camera = camera.value;
2774
+ let targetZoom;
2775
+ if (typeof target === "number") {
2776
+ targetZoom = target;
2777
+ } else if (mode === "cover") {
2778
+ targetZoom = Math.max(zw, zh);
2779
+ } else {
2780
+ targetZoom = Math.min(zw, zh);
2781
+ }
2782
+ const oldZoom = Math.min(_camera.zoom.x, _camera.zoom.y);
2783
+ const newZoom = Math.min(
2784
+ clamp(targetZoom, _camera.minZoom.x, _camera.maxZoom.x),
2785
+ clamp(targetZoom, _camera.minZoom.y, _camera.maxZoom.y)
2786
+ );
2787
+ let x = offset2.left;
2788
+ let y = offset2.top;
2789
+ if (zw < zh) {
2790
+ y += (th - sh * newZoom) / 2;
2791
+ } else {
2792
+ x += (tw - sw * newZoom) / 2;
2793
+ }
2794
+ const oldPosition = {
2795
+ x: _camera.position.x,
2796
+ y: _camera.position.y
2797
+ };
2798
+ const newPosition = {
2799
+ x: sx * newZoom - x,
2800
+ y: sy * newZoom - y
2801
+ };
2802
+ switch (behavior) {
2803
+ case "smooth":
2804
+ await new Promise((resolve) => {
2805
+ const zoomDistance = newZoom - oldZoom;
2806
+ const positionDistance = {
2807
+ x: newPosition.x - oldPosition.x,
2808
+ y: newPosition.y - oldPosition.y
2809
+ };
2810
+ const startTime = performance.now();
2811
+ function step(now) {
2812
+ const elapsed = now - startTime;
2813
+ const progress = Math.min(elapsed / duration, 1);
2814
+ const ease = progress < 0.5 ? 2 * progress * progress : -1 + (4 - 2 * progress) * progress;
2815
+ _camera.zoom.set(oldZoom + zoomDistance * ease);
2816
+ _camera.position.set(
2817
+ oldPosition.x + positionDistance.x * ease,
2818
+ oldPosition.y + positionDistance.y * ease
2819
+ );
2820
+ if (elapsed < duration) {
2821
+ requestAnimationFrame(step);
2822
+ } else {
2823
+ resolve();
2824
+ }
2825
+ }
2826
+ requestAnimationFrame(step);
2827
+ });
2828
+ break;
2829
+ case "instant":
2830
+ default:
2831
+ _camera.zoom.set(newZoom);
2832
+ _camera.position.set(newPosition.x, newPosition.y);
2833
+ break;
2834
+ }
2835
+ };
2836
+ Object.assign(editor, {
2837
+ zoomTo
2838
+ });
2839
+ });
2630
2840
  const mixins = [
2631
2841
  _0_command,
2632
2842
  _0_config,
@@ -2648,7 +2858,9 @@ const mixins = [
2648
2858
  _4_2_element,
2649
2859
  _4_3_frame,
2650
2860
  _4_4_doc,
2651
- _snapshot
2861
+ _scroll$1,
2862
+ _snapshot,
2863
+ _zoom$1
2652
2864
  ];
2653
2865
  function defaultCompare(a, b) {
2654
2866
  if (a < b) {
@@ -4291,7 +4503,7 @@ const _gif = definePlugin((editor, options) => {
4291
4503
  height,
4292
4504
  fonts,
4293
4505
  keyframes: Array.from({ length: ~~((endTime - startTime) / 100) }, (_, i) => startTime + i * 100),
4294
- onFrame: async (data2, { duration, progress }) => {
4506
+ onKeyframe: async (data2, { duration, progress }) => {
4295
4507
  await encoder.encode({ data: data2, delay: duration });
4296
4508
  onProgress?.(progress);
4297
4509
  }
@@ -4507,7 +4719,7 @@ const _image = definePlugin((editor) => {
4507
4719
  accept: imageExts.join(","),
4508
4720
  test: (source) => {
4509
4721
  if (source instanceof Blob) {
4510
- if (source.type.startsWith("image/")) {
4722
+ if (!source.type.startsWith("image/svg+xml") && source.type.startsWith("image/")) {
4511
4723
  return true;
4512
4724
  }
4513
4725
  }
@@ -4861,8 +5073,8 @@ const _menu = definePlugin((editor, options) => {
4861
5073
  ...selectMenu.value.children
4862
5074
  ]
4863
5075
  }));
4864
- const zoomMenu = computed(() => ({
4865
- key: "zoom",
5076
+ const zoomViewMenu = computed(() => ({
5077
+ key: "view",
4866
5078
  children: [
4867
5079
  { key: "zoomIn" },
4868
5080
  { key: "zoomOut" },
@@ -4882,7 +5094,7 @@ const _menu = definePlugin((editor, options) => {
4882
5094
  { key: "view:statusbar", checked: config.value.statusbar },
4883
5095
  { key: "view:frameOutline", checked: config.value.frameOutline },
4884
5096
  { type: "divider" },
4885
- ...zoomMenu.value.children
5097
+ ...zoomViewMenu.value.children
4886
5098
  ]
4887
5099
  }));
4888
5100
  const objectMenu1 = computed(() => [
@@ -4958,6 +5170,7 @@ const _menu = definePlugin((editor, options) => {
4958
5170
  layerOrderMenu.value,
4959
5171
  layerPositionMenu.value,
4960
5172
  flipMenu.value,
5173
+ zoomViewMenu.value,
4961
5174
  { type: "divider" },
4962
5175
  exportMenu.value
4963
5176
  ];
@@ -5096,6 +5309,17 @@ const _saveAs = definePlugin((editor) => {
5096
5309
  ]
5097
5310
  };
5098
5311
  });
5312
+ const _scroll = definePlugin((editor) => {
5313
+ const {
5314
+ scrollTo
5315
+ } = editor;
5316
+ return {
5317
+ name: "mce:scroll",
5318
+ commands: [
5319
+ { command: "scrollToSelection", handle: (options) => scrollTo("selection", options) }
5320
+ ]
5321
+ };
5322
+ });
5099
5323
  const _select = definePlugin((editor) => {
5100
5324
  const {
5101
5325
  selection,
@@ -5295,85 +5519,23 @@ const _visibility = definePlugin((editor) => {
5295
5519
  ]
5296
5520
  };
5297
5521
  });
5298
- const defaultZoomToFitOffset = { left: 0, top: 0, bottom: 0, right: 0 };
5299
5522
  const _zoom = definePlugin((editor) => {
5300
5523
  const {
5301
5524
  camera,
5302
5525
  drawboardAabb,
5303
- viewAabb,
5304
- config,
5305
- currentAabb,
5306
- registerConfig,
5307
- selection
5526
+ zoomTo,
5527
+ selection,
5528
+ exec
5308
5529
  } = editor;
5309
- registerConfig("zoomToFitOffset", { ...defaultZoomToFitOffset });
5310
- function zoomIn() {
5311
- camera.value.addZoom(0.25);
5312
- }
5313
- function zoomOut() {
5314
- camera.value.addZoom(-0.25);
5315
- }
5316
- function zoomTo100() {
5317
- camera.value.setZoom(1);
5318
- }
5319
- function _zoomToFit(mode, selection2 = false) {
5320
- const targetAabb = selection2 ? currentAabb.value : viewAabb.value;
5321
- const offset2 = {
5322
- ...defaultZoomToFitOffset,
5323
- ...config.value.zoomToFitOffset
5324
- };
5325
- if (config.value.scrollbar) {
5326
- offset2.right += 8;
5327
- offset2.bottom += 8;
5328
- }
5329
- if (config.value.ruler) {
5330
- offset2.left += 16;
5331
- offset2.top += 16;
5332
- }
5333
- const tw = drawboardAabb.value.width - (offset2.left + offset2.right);
5334
- const th = drawboardAabb.value.height - (offset2.top + offset2.bottom);
5335
- const sx = targetAabb.left;
5336
- const sy = targetAabb.top;
5337
- const sw = targetAabb.width;
5338
- const sh = targetAabb.height;
5339
- if (sw && sh) {
5340
- const zw = tw / sw;
5341
- const zh = th / sh;
5342
- camera.value.setZoom(
5343
- mode === "contain" ? Math.min(zw, zh) : Math.max(zw, zh)
5344
- );
5345
- const zoom = camera.value.zoom.x;
5346
- let x = offset2.left;
5347
- let y = offset2.top;
5348
- if (zw < zh) {
5349
- y += (th - sh * zoom) / 2;
5350
- } else {
5351
- x += (tw - sw * zoom) / 2;
5352
- }
5353
- camera.value.position.set(
5354
- -sx * zoom + x,
5355
- -sy * zoom + y
5356
- );
5357
- }
5358
- }
5359
- function zoomToFit() {
5360
- _zoomToFit("contain");
5361
- }
5362
- function zoomToCover() {
5363
- _zoomToFit("cover");
5364
- }
5365
- function zoomToSelection() {
5366
- _zoomToFit("contain", true);
5367
- }
5368
5530
  return {
5369
5531
  name: "mce:zoom",
5370
5532
  commands: [
5371
- { command: "zoomIn", handle: zoomIn },
5372
- { command: "zoomOut", handle: zoomOut },
5373
- { command: "zoomTo100", handle: zoomTo100 },
5374
- { command: "zoomToFit", handle: zoomToFit },
5375
- { command: "zoomToCover", handle: zoomToCover },
5376
- { command: "zoomToSelection", handle: zoomToSelection }
5533
+ { command: "zoomIn", handle: () => camera.value.addZoom(0.25) },
5534
+ { command: "zoomOut", handle: () => camera.value.addZoom(-0.25) },
5535
+ { command: "zoomTo100", handle: () => camera.value.setZoom(1) },
5536
+ { command: "zoomToCover", handle: () => zoomTo("root", { mode: "cover" }) },
5537
+ { command: "zoomToFit", handle: () => zoomTo("root", { mode: "contain" }) },
5538
+ { command: "zoomToSelection", handle: (options) => zoomTo("selection", options) }
5377
5539
  ],
5378
5540
  hotkeys: [
5379
5541
  { command: "zoomIn", key: "CmdOrCtrl+=" },
@@ -5383,26 +5545,26 @@ const _zoom = definePlugin((editor) => {
5383
5545
  { command: "zoomToSelection", key: "Shift+™" }
5384
5546
  ],
5385
5547
  events: {
5386
- setDoc: zoomToFit,
5548
+ setDoc: () => exec("zoomToFit"),
5387
5549
  setCurrentFrame: () => {
5388
5550
  if (selection.value.length) {
5389
- zoomToSelection();
5551
+ exec("zoomToSelection");
5390
5552
  } else {
5391
- zoomToFit();
5553
+ exec("zoomToFit");
5392
5554
  }
5393
5555
  }
5394
5556
  },
5395
5557
  setup: () => {
5396
5558
  const {
5397
5559
  drawboardDom,
5398
- config: config2
5560
+ config
5399
5561
  } = editor;
5400
- watch(() => config2.value.viewMode, zoomToFit);
5562
+ watch(() => config.value.viewMode, () => exec("zoomToFit"));
5401
5563
  useResizeObserver$1(drawboardDom, (entries) => {
5402
5564
  const { left: _left, top: _top, width, height } = entries[0].contentRect;
5403
5565
  const { left = _left, top = _top } = drawboardDom.value?.getBoundingClientRect() ?? {};
5404
5566
  drawboardAabb.value = { left, top, width, height };
5405
- zoomToFit();
5567
+ exec("zoomToFit");
5406
5568
  });
5407
5569
  }
5408
5570
  };
@@ -5429,6 +5591,7 @@ const plugins = [
5429
5591
  _new,
5430
5592
  _open,
5431
5593
  _saveAs,
5594
+ _scroll,
5432
5595
  _select,
5433
5596
  _text,
5434
5597
  _ui,
@@ -5676,10 +5839,19 @@ const aliases = {
5676
5839
  play: "M8 5.14v14l11-7z",
5677
5840
  pause: "M14 19h4V5h-4M6 19h4V5H6z",
5678
5841
  gps: "M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m-8.95 5H1v-2h2.05C3.5 6.83 6.83 3.5 11 3.05V1h2v2.05c4.17.45 7.5 3.78 7.95 7.95H23v2h-2.05c-.45 4.17-3.78 7.5-7.95 7.95V23h-2v-2.05C6.83 20.5 3.5 17.17 3.05 13M12 5a7 7 0 0 0-7 7a7 7 0 0 0 7 7a7 7 0 0 0 7-7a7 7 0 0 0-7-7",
5679
- menuRight: "m10 17l5-5l-5-5z",
5842
+ arrowRight: "M12.6 12L8 7.4L9.4 6l6 6l-6 6L8 16.6z",
5680
5843
  mouseLeftClick: "M13 9V1.07A8.01 8.01 0 0 1 19.75 7c.16.64.25 1.31.25 2zm4.66-2c-.48-1.35-1.43-2.5-2.66-3.19V7zM6 15v-2h12v2c0 1.59-.63 3.12-1.76 4.24A5.97 5.97 0 0 1 12 21a5.97 5.97 0 0 1-4.24-1.76A5.97 5.97 0 0 1 6 15m-2 0c0 2.12.84 4.16 2.34 5.66S9.88 23 12 23s4.16-.84 5.66-2.34S20 17.12 20 15v-4H4zm7-6V1.07C7.06 1.56 4 4.92 4 9z",
5681
5844
  mouseRightClick: "M13 9V1.07c3.94.49 7 3.85 7 7.93zm-2 0V1.07A8.01 8.01 0 0 0 4.25 7C4.09 7.64 4 8.31 4 9zM6.34 7C6.82 5.65 7.78 4.5 9 3.81V7zM6 15v-2h12v2c0 1.59-.63 3.12-1.76 4.24A5.97 5.97 0 0 1 12 21a5.97 5.97 0 0 1-4.24-1.76A5.97 5.97 0 0 1 6 15m-2 0c0 2.12.84 4.16 2.34 5.66S9.88 23 12 23s4.16-.84 5.66-2.34S20 17.12 20 15v-4H4z",
5682
- check: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z"
5845
+ check: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z",
5846
+ frame: "M17 9v6H7V9zm2-6h-2v3h2zM7 3H5v3h2zm16 4h-3v2h3zm-4 0H5v10h14zM4 7H1v2h3zm19 8h-3v2h3zM4 15H1v2h3zm15 3h-2v3h2zM7 18H5v3h2z",
5847
+ group: "M10 22q-.825 0-1.412-.587T8 20v-4H4q-.825 0-1.412-.587T2 14V4q0-.825.588-1.412T4 2h10q.825 0 1.413.588T16 4v4h4q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22zm0-2h10V10h-6V4H4v10h6zm2-8",
5848
+ shape: "M8 17.95q.25.025.488.038T9 18t.513-.012t.487-.038V20h10V10h-2.05q.025-.25.038-.488T18 9t-.012-.513T17.95 8H20q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22H10q-.825 0-1.412-.587T8 20zM9 16q-2.925 0-4.962-2.037T2 9t2.038-4.962T9 2t4.963 2.038T16 9t-2.037 4.963T9 16m0-2q2.075 0 3.538-1.463T14 9t-1.463-3.537T9 4T5.463 5.463T4 9t1.463 3.538T9 14m0-5",
5849
+ text: "m18.5 4l1.16 4.35l-.96.26c-.45-.87-.91-1.74-1.44-2.18C16.73 6 16.11 6 15.5 6H13v10.5c0 .5 0 1 .33 1.25c.34.25 1 .25 1.67.25v1H9v-1c.67 0 1.33 0 1.67-.25c.33-.25.33-.75.33-1.25V6H8.5c-.61 0-1.23 0-1.76.43c-.53.44-.99 1.31-1.44 2.18l-.96-.26L5.5 4z",
5850
+ image: "M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-2h14V5H5zm1-2h12l-3.75-5l-3 4L9 13zm-1 2V5zm3.5-9q.625 0 1.063-.437T10 8.5t-.437-1.062T8.5 7t-1.062.438T7 8.5t.438 1.063T8.5 10",
5851
+ lock: "M6 22q-.825 0-1.412-.587T4 20V10q0-.825.588-1.412T6 8h1V6q0-2.075 1.463-3.537T12 1t3.538 1.463T17 6v2h1q.825 0 1.413.588T20 10v10q0 .825-.587 1.413T18 22zm0-2h12V10H6zm6-3q.825 0 1.413-.587T14 15t-.587-1.412T12 13t-1.412.588T10 15t.588 1.413T12 17M9 8h6V6q0-1.25-.875-2.125T12 3t-2.125.875T9 6zM6 20V10z",
5852
+ unlock: "M6 8h9V6q0-1.25-.875-2.125T12 3t-2.125.875T9 6H7q0-2.075 1.463-3.537T12 1t3.538 1.463T17 6v2h1q.825 0 1.413.588T20 10v10q0 .825-.587 1.413T18 22H6q-.825 0-1.412-.587T4 20V10q0-.825.588-1.412T6 8m0 12h12V10H6zm6-3q.825 0 1.413-.587T14 15t-.587-1.412T12 13t-1.412.588T10 15t.588 1.413T12 17m-6 3V10z",
5853
+ visible: "M12 16q1.875 0 3.188-1.312T16.5 11.5t-1.312-3.187T12 7T8.813 8.313T7.5 11.5t1.313 3.188T12 16m0-1.8q-1.125 0-1.912-.788T9.3 11.5t.788-1.912T12 8.8t1.913.788t.787 1.912t-.787 1.913T12 14.2m0 4.8q-3.65 0-6.65-2.037T1 11.5q1.35-3.425 4.35-5.462T12 4t6.65 2.038T23 11.5q-1.35 3.425-4.35 5.463T12 19m0-2q2.825 0 5.188-1.487T20.8 11.5q-1.25-2.525-3.613-4.012T12 6T6.813 7.488T3.2 11.5q1.25 2.525 3.613 4.013T12 17",
5854
+ unvisible: "m16.1 13.3l-1.45-1.45q.225-1.175-.675-2.2t-2.325-.8L10.2 7.4q.425-.2.863-.3T12 7q1.875 0 3.188 1.313T16.5 11.5q0 .5-.1.938t-.3.862m3.2 3.15l-1.45-1.4q.95-.725 1.688-1.587T20.8 11.5q-1.25-2.525-3.588-4.012T12 6q-.725 0-1.425.1T9.2 6.4L7.65 4.85q1.025-.425 2.1-.638T12 4q3.775 0 6.725 2.087T23 11.5q-.575 1.475-1.513 2.738T19.3 16.45m.5 6.15l-4.2-4.15q-.875.275-1.762.413T12 19q-3.775 0-6.725-2.087T1 11.5q.525-1.325 1.325-2.463T4.15 7L1.4 4.2l1.4-1.4l18.4 18.4zM5.55 8.4q-.725.65-1.325 1.425T3.2 11.5q1.25 2.525 3.588 4.013T12 17q.5 0 .975-.062t.975-.138l-.9-.95q-.275.075-.525.113T12 16q-1.875 0-3.188-1.312T7.5 11.5q0-.275.038-.525t.112-.525zm4.2 4.2"
5683
5855
  };
5684
5856
  const svg = {
5685
5857
  component: MceSvgIcon
@@ -5784,13 +5956,13 @@ const defaultHoverStrategy = (context) => {
5784
5956
  }
5785
5957
  return void 0;
5786
5958
  };
5787
- const _hoisted_1$g = { class: "mce-auxiliary" };
5788
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
5959
+ const _hoisted_1$h = { class: "mce-auxiliary" };
5960
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5789
5961
  __name: "Auxiliary",
5790
5962
  setup(__props) {
5791
5963
  const { auxiliaryLines } = useEditor();
5792
5964
  return (_ctx, _cache) => {
5793
- return openBlock(), createElementBlock("div", _hoisted_1$g, [
5965
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
5794
5966
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(auxiliaryLines), (item, key) => {
5795
5967
  return openBlock(), createElementBlock("div", {
5796
5968
  key,
@@ -6083,7 +6255,7 @@ function createLayout(props) {
6083
6255
  };
6084
6256
  }
6085
6257
  const MceMenuSymbol = Symbol.for("MceMenuSymbol");
6086
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
6258
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
6087
6259
  __name: "Icon",
6088
6260
  props: {
6089
6261
  disabled: Boolean,
@@ -6108,7 +6280,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
6108
6280
  };
6109
6281
  }
6110
6282
  });
6111
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
6283
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
6112
6284
  ...{
6113
6285
  inheritAttrs: false
6114
6286
  },
@@ -6220,7 +6392,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6220
6392
  };
6221
6393
  }
6222
6394
  });
6223
- const _hoisted_1$f = ["onMouseenter"];
6395
+ const _hoisted_1$g = ["onMouseenter"];
6224
6396
  const _hoisted_2$8 = ["onClick"];
6225
6397
  const _hoisted_3$7 = {
6226
6398
  key: 0,
@@ -6231,7 +6403,7 @@ const _hoisted_5$3 = {
6231
6403
  key: 1,
6232
6404
  class: "mce-list-item__append"
6233
6405
  };
6234
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
6406
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
6235
6407
  ...{
6236
6408
  name: "MceMenu"
6237
6409
  },
@@ -6304,7 +6476,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6304
6476
  });
6305
6477
  return (_ctx, _cache) => {
6306
6478
  const _component_MceMenu = resolveComponent("MceMenu");
6307
- return openBlock(), createBlock(_sfc_main$t, {
6479
+ return openBlock(), createBlock(_sfc_main$v, {
6308
6480
  ref: "overlayTpl",
6309
6481
  modelValue: isActive.value,
6310
6482
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isActive.value = $event),
@@ -6348,7 +6520,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6348
6520
  onClick: (e) => onClickItem(item, index, e)
6349
6521
  }, [
6350
6522
  hasPrepend.value ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
6351
- item.checked ? (openBlock(), createBlock(_sfc_main$u, {
6523
+ item.checked ? (openBlock(), createBlock(_sfc_main$w, {
6352
6524
  key: 0,
6353
6525
  icon: "$check"
6354
6526
  })) : createCommentVNode("", true)
@@ -6359,10 +6531,10 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6359
6531
  ])
6360
6532
  ]),
6361
6533
  item.children?.length ? (openBlock(), createElementBlock("div", _hoisted_5$3, [
6362
- createVNode(_sfc_main$u, { icon: "$menuRight" })
6534
+ createVNode(_sfc_main$w, { icon: "$arrowRight" })
6363
6535
  ])) : createCommentVNode("", true)
6364
6536
  ], 10, _hoisted_2$8)
6365
- ], 40, _hoisted_1$f))
6537
+ ], 40, _hoisted_1$g))
6366
6538
  ], 64);
6367
6539
  }), 128)),
6368
6540
  opened.value > -1 && __props.items?.[opened.value]?.children?.length ? (openBlock(), createBlock(_component_MceMenu, {
@@ -6392,12 +6564,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6392
6564
  };
6393
6565
  }
6394
6566
  });
6395
- const _hoisted_1$e = { class: "mce-context-menu__title" };
6567
+ const _hoisted_1$f = { class: "mce-context-menu__title" };
6396
6568
  const _hoisted_2$7 = {
6397
6569
  key: 0,
6398
6570
  class: "mce-context-menu__kbd"
6399
6571
  };
6400
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
6572
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6401
6573
  __name: "ContextMenu",
6402
6574
  props: {
6403
6575
  "modelValue": { type: Boolean },
@@ -6416,11 +6588,19 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
6416
6588
  exec,
6417
6589
  getKbd,
6418
6590
  t,
6419
- hotkeys
6591
+ hotkeys,
6592
+ registerCommand,
6593
+ unregisterCommand
6420
6594
  } = useEditor();
6421
6595
  const model = useModel(__props, "modelValue");
6422
6596
  const position = useModel(__props, "position");
6423
6597
  const menuRef = useTemplateRef("menuTplRef");
6598
+ onBeforeMount(() => {
6599
+ registerCommand({ command: "openContextMenu", handle: onContextmenu });
6600
+ });
6601
+ onBeforeUnmount(() => {
6602
+ unregisterCommand("openContextMenu");
6603
+ });
6424
6604
  function updateLocation() {
6425
6605
  menuRef.value?.updateLocation();
6426
6606
  }
@@ -6447,7 +6627,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
6447
6627
  updateLocation
6448
6628
  });
6449
6629
  return (_ctx, _cache) => {
6450
- return openBlock(), createBlock(_sfc_main$s, {
6630
+ return openBlock(), createBlock(_sfc_main$u, {
6451
6631
  ref: "menuTplRef",
6452
6632
  modelValue: model.value,
6453
6633
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
@@ -6462,7 +6642,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
6462
6642
  "onClick:item": onClickItem
6463
6643
  }, {
6464
6644
  title: withCtx(({ item }) => [
6465
- createElementVNode("span", _hoisted_1$e, toDisplayString(unref(t)(item.key)), 1),
6645
+ createElementVNode("span", _hoisted_1$f, toDisplayString(unref(t)(item.key)), 1),
6466
6646
  unref(hotkeys).has(item.key) ? (openBlock(), createElementBlock("span", _hoisted_2$7, toDisplayString(unref(getKbd)(item.key)), 1)) : createCommentVNode("", true)
6467
6647
  ]),
6468
6648
  _: 1
@@ -6470,11 +6650,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
6470
6650
  };
6471
6651
  }
6472
6652
  });
6473
- const _hoisted_1$d = {
6653
+ const _hoisted_1$e = {
6474
6654
  key: 0,
6475
6655
  class: "mce-drawing__content"
6476
6656
  };
6477
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
6657
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6478
6658
  __name: "Drawing",
6479
6659
  setup(__props) {
6480
6660
  const {
@@ -6504,12 +6684,12 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
6504
6684
  }),
6505
6685
  onMousedown
6506
6686
  }, [
6507
- unref(stateContext)?.content ? (openBlock(), createElementBlock("div", _hoisted_1$d, toDisplayString(unref(t)(unref(stateContext).content)), 1)) : createCommentVNode("", true)
6687
+ unref(stateContext)?.content ? (openBlock(), createElementBlock("div", _hoisted_1$e, toDisplayString(unref(t)(unref(stateContext).content)), 1)) : createCommentVNode("", true)
6508
6688
  ], 36)) : createCommentVNode("", true);
6509
6689
  };
6510
6690
  }
6511
6691
  });
6512
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
6692
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
6513
6693
  __name: "Floatbar",
6514
6694
  props: {
6515
6695
  ...makeMceOverlayProps({
@@ -6535,7 +6715,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6535
6715
  updateLocation
6536
6716
  });
6537
6717
  return (_ctx, _cache) => {
6538
- return openBlock(), createBlock(_sfc_main$t, {
6718
+ return openBlock(), createBlock(_sfc_main$v, {
6539
6719
  ref: "overlayTpl",
6540
6720
  class: "mce-floatbar",
6541
6721
  location: props.location,
@@ -6552,7 +6732,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6552
6732
  };
6553
6733
  }
6554
6734
  });
6555
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
6735
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
6556
6736
  __name: "Frame",
6557
6737
  props: {
6558
6738
  "modelValue": { required: true },
@@ -6618,7 +6798,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6618
6798
  };
6619
6799
  }
6620
6800
  });
6621
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
6801
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6622
6802
  __name: "Frames",
6623
6803
  setup(__props) {
6624
6804
  const {
@@ -6626,7 +6806,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6626
6806
  } = useEditor();
6627
6807
  return (_ctx, _cache) => {
6628
6808
  return openBlock(true), createElementBlock(Fragment, null, renderList(unref(frames), (frame, key) => {
6629
- return openBlock(), createBlock(_sfc_main$o, {
6809
+ return openBlock(), createBlock(_sfc_main$q, {
6630
6810
  key,
6631
6811
  "model-value": frame
6632
6812
  }, null, 8, ["model-value"]);
@@ -6634,36 +6814,36 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6634
6814
  };
6635
6815
  }
6636
6816
  });
6637
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
6817
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6638
6818
  __name: "GoBackSelectedArea",
6639
6819
  setup(__props) {
6640
6820
  const {
6641
- currentAabb,
6821
+ selectionAabb,
6642
6822
  drawboardAabb,
6643
6823
  aabbToDrawboardAabb,
6644
- exec,
6645
- t
6824
+ t,
6825
+ exec
6646
6826
  } = useEditor();
6647
6827
  const isActive = computed(() => {
6648
- return currentAabb.value.width && currentAabb.value.height && !isOverlappingAabb(
6828
+ return selectionAabb.value.width && selectionAabb.value.height && !isOverlappingAabb(
6649
6829
  drawboardAabb.value,
6650
- aabbToDrawboardAabb(currentAabb.value)
6830
+ aabbToDrawboardAabb(selectionAabb.value)
6651
6831
  );
6652
6832
  });
6653
6833
  return (_ctx, _cache) => {
6654
6834
  return isActive.value ? (openBlock(), createElementBlock("div", {
6655
6835
  key: 0,
6656
6836
  class: "mce-back-selected-aera",
6657
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("zoomToSelection"), ["prevent"]))
6837
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
6658
6838
  }, [
6659
- createVNode(_sfc_main$u, { icon: "$gps" }),
6839
+ createVNode(_sfc_main$w, { icon: "$gps" }),
6660
6840
  createElementVNode("span", null, toDisplayString(unref(t)("goBackSelectedArea")), 1)
6661
6841
  ])) : createCommentVNode("", true);
6662
6842
  };
6663
6843
  }
6664
6844
  });
6665
- const _hoisted_1$c = ["data-name"];
6666
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
6845
+ const _hoisted_1$d = ["data-name"];
6846
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6667
6847
  __name: "Hover",
6668
6848
  setup(__props) {
6669
6849
  const {
@@ -6681,11 +6861,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6681
6861
  borderColor: "currentcolor",
6682
6862
  ...unref(boundingBoxToStyle)(hoverElementObb.value)
6683
6863
  })
6684
- }, null, 12, _hoisted_1$c)) : createCommentVNode("", true);
6864
+ }, null, 12, _hoisted_1$d)) : createCommentVNode("", true);
6685
6865
  };
6686
6866
  }
6687
6867
  });
6688
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
6868
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6689
6869
  __name: "Tooltip",
6690
6870
  props: /* @__PURE__ */ mergeModels({
6691
6871
  ...makeMceOverlayProps({
@@ -6708,7 +6888,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6708
6888
  updateLocation
6709
6889
  });
6710
6890
  return (_ctx, _cache) => {
6711
- return openBlock(), createBlock(_sfc_main$t, {
6891
+ return openBlock(), createBlock(_sfc_main$v, {
6712
6892
  ref: "overlayTpl",
6713
6893
  modelValue: isActive.value,
6714
6894
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -6734,10 +6914,10 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6734
6914
  };
6735
6915
  }
6736
6916
  });
6737
- const _hoisted_1$b = ["width", "height"];
6917
+ const _hoisted_1$c = ["width", "height"];
6738
6918
  const _hoisted_2$6 = ["onDblclick", "onMousedown", "onMousemove"];
6739
6919
  const _hoisted_3$6 = { style: { "font-size": "12px", "text-wrap": "nowrap" } };
6740
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
6920
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6741
6921
  ...{
6742
6922
  inheritAttrs: false
6743
6923
  },
@@ -6822,7 +7002,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6822
7002
  return niceFraction * 10 ** exponent;
6823
7003
  });
6824
7004
  const start = computed(() => {
6825
- const value = -props.position / props.zoom;
7005
+ const value = props.position / props.zoom;
6826
7006
  return Math.floor(value / unit.value) * unit.value;
6827
7007
  });
6828
7008
  const end = computed(() => {
@@ -6831,10 +7011,10 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6831
7011
  return start.value + Math.ceil(value / unit.value) * unit.value;
6832
7012
  });
6833
7013
  function numToPx(num) {
6834
- return Math.round(num * props.zoom + props.position);
7014
+ return Math.round(num * props.zoom - props.position);
6835
7015
  }
6836
7016
  function pxToNum(px) {
6837
- return Math.round((px - props.position) / props.zoom);
7017
+ return Math.round((px + props.position) / props.zoom);
6838
7018
  }
6839
7019
  function render2() {
6840
7020
  const cvs = canvas.value;
@@ -6993,7 +7173,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6993
7173
  class: "mce-ruler__canvas",
6994
7174
  width: props.size,
6995
7175
  height: props.size
6996
- }, null, 8, _hoisted_1$b)
7176
+ }, null, 8, _hoisted_1$c)
6997
7177
  ], 16)), [
6998
7178
  [unref(vResizeObserver), unref(resize)]
6999
7179
  ]),
@@ -7017,7 +7197,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7017
7197
  onMouseleave: onLeave
7018
7198
  }, null, 46, _hoisted_2$6);
7019
7199
  }), 128)),
7020
- createVNode(_sfc_main$k, {
7200
+ createVNode(_sfc_main$m, {
7021
7201
  "model-value": !!tipText.value,
7022
7202
  target: tipPos.value,
7023
7203
  offset: 24
@@ -7031,8 +7211,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7031
7211
  };
7032
7212
  }
7033
7213
  });
7034
- const _hoisted_1$a = { class: "mce-rulers" };
7035
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
7214
+ const _hoisted_1$b = { class: "mce-rulers" };
7215
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
7036
7216
  ...{
7037
7217
  inheritAttrs: false
7038
7218
  },
@@ -7045,8 +7225,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7045
7225
  } = useEditor();
7046
7226
  const activeAabb = computed(() => getAabbInDrawboard(selection.value));
7047
7227
  return (_ctx, _cache) => {
7048
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
7049
- createVNode(_sfc_main$j, {
7228
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
7229
+ createVNode(_sfc_main$l, {
7050
7230
  refline: "",
7051
7231
  zoom: unref(camera).zoom.x,
7052
7232
  position: unref(camera).position.x,
@@ -7054,7 +7234,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7054
7234
  axis: "",
7055
7235
  size: 16
7056
7236
  }, null, 8, ["zoom", "position", "selected"]),
7057
- createVNode(_sfc_main$j, {
7237
+ createVNode(_sfc_main$l, {
7058
7238
  refline: "",
7059
7239
  zoom: unref(camera).zoom.y,
7060
7240
  position: unref(camera).position.y,
@@ -7068,13 +7248,13 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7068
7248
  };
7069
7249
  }
7070
7250
  });
7071
- const _hoisted_1$9 = {
7251
+ const _hoisted_1$a = {
7072
7252
  ref: "trackTplRef",
7073
7253
  class: "mce-scrollbar__track"
7074
7254
  };
7075
7255
  const AMOUNT_STEP = 50;
7076
7256
  const AMOUNT_REPEAR_DELAY = 50;
7077
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
7257
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7078
7258
  __name: "Scrollbar",
7079
7259
  props: /* @__PURE__ */ mergeModels({
7080
7260
  zoom: {},
@@ -7164,7 +7344,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7164
7344
  [props.vertical ? "top" : "left"]: `${props.offset}px`
7165
7345
  })
7166
7346
  }, [
7167
- createElementVNode("div", _hoisted_1$9, [
7347
+ createElementVNode("div", _hoisted_1$a, [
7168
7348
  withDirectives(createElementVNode("div", {
7169
7349
  ref: "thumbTplRef",
7170
7350
  class: normalizeClass(["mce-scrollbar__thumb", {
@@ -7187,7 +7367,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7187
7367
  };
7188
7368
  }
7189
7369
  });
7190
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
7370
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7191
7371
  ...{
7192
7372
  inheritAttrs: false
7193
7373
  },
@@ -7205,14 +7385,14 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7205
7385
  } = useEditor();
7206
7386
  return (_ctx, _cache) => {
7207
7387
  return openBlock(), createElementBlock(Fragment, null, [
7208
- createVNode(_sfc_main$h, mergeProps(props, {
7388
+ createVNode(_sfc_main$j, mergeProps(props, {
7209
7389
  modelValue: unref(camera).position.y,
7210
7390
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(camera).position.y = $event),
7211
7391
  zoom: unref(camera).zoom.y,
7212
7392
  vertical: "",
7213
7393
  length: unref(viewAabb).height
7214
7394
  }), null, 16, ["modelValue", "zoom", "length"]),
7215
- createVNode(_sfc_main$h, mergeProps(props, {
7395
+ createVNode(_sfc_main$j, mergeProps(props, {
7216
7396
  modelValue: unref(camera).position.x,
7217
7397
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(camera).position.x = $event),
7218
7398
  zoom: unref(camera).zoom.x,
@@ -7222,7 +7402,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7222
7402
  };
7223
7403
  }
7224
7404
  });
7225
- const _hoisted_1$8 = { class: "mce-transformable__svg" };
7405
+ const _hoisted_1$9 = { class: "mce-transformable__svg" };
7226
7406
  const _hoisted_2$5 = { "pointer-events": "all" };
7227
7407
  const _hoisted_3$5 = ["x", "y", "width", "height", "aria-label", "fill"];
7228
7408
  const _hoisted_4$3 = ["cx", "cy", "r", "aria-label", "fill"];
@@ -7231,7 +7411,7 @@ const _hoisted_6$2 = {
7231
7411
  key: 0,
7232
7412
  class: "mce-transformable__tip"
7233
7413
  };
7234
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
7414
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7235
7415
  __name: "Transformable",
7236
7416
  props: {
7237
7417
  tag: { default: "div" },
@@ -7604,7 +7784,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7604
7784
  },
7605
7785
  start
7606
7786
  }),
7607
- (openBlock(), createElementBlock("svg", _hoisted_1$8, [
7787
+ (openBlock(), createElementBlock("svg", _hoisted_1$9, [
7608
7788
  createElementVNode("rect", {
7609
7789
  width: "100%",
7610
7790
  height: "100%",
@@ -7680,7 +7860,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7680
7860
  };
7681
7861
  }
7682
7862
  });
7683
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
7863
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7684
7864
  ...{
7685
7865
  inheritAttrs: false
7686
7866
  },
@@ -7819,7 +7999,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7819
7999
  })
7820
8000
  }, null, 4);
7821
8001
  }), 128)),
7822
- selectionObb.value.width && selectionObb.value.height ? (openBlock(), createBlock(_sfc_main$f, {
8002
+ selectionObb.value.width && selectionObb.value.height ? (openBlock(), createBlock(_sfc_main$h, {
7823
8003
  key: 1,
7824
8004
  ref: "transformableRef",
7825
8005
  modelValue: selectionObb.value,
@@ -7852,7 +8032,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7852
8032
  };
7853
8033
  }
7854
8034
  });
7855
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
8035
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7856
8036
  __name: "Setup",
7857
8037
  setup(__props) {
7858
8038
  useEditor().setup();
@@ -7861,7 +8041,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7861
8041
  };
7862
8042
  }
7863
8043
  });
7864
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
8044
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7865
8045
  __name: "Layout",
7866
8046
  props: {
7867
8047
  ...makeLayoutProps()
@@ -7890,7 +8070,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
7890
8070
  };
7891
8071
  }
7892
8072
  });
7893
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
8073
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7894
8074
  __name: "LayoutItem",
7895
8075
  props: {
7896
8076
  position: {
@@ -7901,7 +8081,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
7901
8081
  type: [Number, String],
7902
8082
  default: 300
7903
8083
  },
7904
- modelValue: Boolean,
8084
+ modelValue: {
8085
+ type: Boolean,
8086
+ default: true
8087
+ },
7905
8088
  ...makeLayoutItemProps()
7906
8089
  },
7907
8090
  setup(__props) {
@@ -7927,11 +8110,11 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
7927
8110
  };
7928
8111
  }
7929
8112
  });
7930
- const _hoisted_1$7 = {
8113
+ const _hoisted_1$8 = {
7931
8114
  key: 0,
7932
8115
  class: "mce-main__scroller"
7933
8116
  };
7934
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
8117
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
7935
8118
  __name: "Main",
7936
8119
  props: {
7937
8120
  scrollable: Boolean
@@ -7946,14 +8129,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
7946
8129
  ]]),
7947
8130
  style: normalizeStyle([unref(mainStyles)])
7948
8131
  }, [
7949
- props.scrollable ? (openBlock(), createElementBlock("div", _hoisted_1$7, [
8132
+ props.scrollable ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
7950
8133
  renderSlot(_ctx.$slots, "default")
7951
8134
  ])) : renderSlot(_ctx.$slots, "default", { key: 1 })
7952
8135
  ], 6);
7953
8136
  };
7954
8137
  }
7955
8138
  });
7956
- const _hoisted_1$6 = { class: "progress-indicator" };
8139
+ const _hoisted_1$7 = { class: "progress-indicator" };
7957
8140
  const _hoisted_2$4 = {
7958
8141
  key: 0,
7959
8142
  class: "progress-indicator__status"
@@ -7963,7 +8146,7 @@ const _hoisted_4$2 = {
7963
8146
  key: 1,
7964
8147
  class: "progress-indicator__bar-indeterminate"
7965
8148
  };
7966
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8149
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
7967
8150
  __name: "ProgressIndicator",
7968
8151
  props: /* @__PURE__ */ mergeModels({
7969
8152
  label: {},
@@ -7976,7 +8159,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7976
8159
  setup(__props) {
7977
8160
  const progress = useModel(__props, "modelValue");
7978
8161
  return (_ctx, _cache) => {
7979
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
8162
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
7980
8163
  __props.label ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
7981
8164
  createElementVNode("div", _hoisted_3$4, [
7982
8165
  !__props.indeterminate ? (openBlock(), createElementBlock("div", {
@@ -7996,8 +8179,8 @@ const _export_sfc = (sfc, props) => {
7996
8179
  }
7997
8180
  return target;
7998
8181
  };
7999
- const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-c4234331"]]);
8000
- const _hoisted_1$5 = { class: "mce-statusbar" };
8182
+ const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-c4234331"]]);
8183
+ const _hoisted_1$6 = { class: "mce-statusbar" };
8001
8184
  const _hoisted_2$3 = { class: "mce-statusbar__main" };
8002
8185
  const _hoisted_3$3 = { class: "mce-statusbar__item" };
8003
8186
  const _hoisted_4$1 = { class: "mce-statusbar__kbd" };
@@ -8018,7 +8201,7 @@ const _hoisted_18 = { class: "mce-statusbar__item" };
8018
8201
  const _hoisted_19 = { class: "mce-statusbar__kbd" };
8019
8202
  const _hoisted_20 = { class: "mce-statusbar__item" };
8020
8203
  const _hoisted_21 = { class: "mce-statusbar__progress" };
8021
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8204
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8022
8205
  __name: "Statusbar",
8023
8206
  setup(__props) {
8024
8207
  const {
@@ -8029,7 +8212,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8029
8212
  exportProgress
8030
8213
  } = useEditor();
8031
8214
  return (_ctx, _cache) => {
8032
- return openBlock(), createElementBlock("div", _hoisted_1$5, [
8215
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
8033
8216
  createElementVNode("div", _hoisted_2$3, [
8034
8217
  unref(state) === "typing" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
8035
8218
  createElementVNode("div", _hoisted_3$3, [
@@ -8043,7 +8226,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8043
8226
  ])
8044
8227
  ], 64)) : unref(state) === "transforming" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
8045
8228
  createElementVNode("div", _hoisted_8, [
8046
- createVNode(_sfc_main$u, { icon: "$mouseRightClick" })
8229
+ createVNode(_sfc_main$w, { icon: "$mouseRightClick" })
8047
8230
  ]),
8048
8231
  _cache[2] || (_cache[2] = createElementVNode("span", null, " / ", -1)),
8049
8232
  createElementVNode("div", _hoisted_9, [
@@ -8057,7 +8240,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8057
8240
  ])
8058
8241
  ], 64)) : unref(state) ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(t)(unref(state))), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
8059
8242
  createElementVNode("div", _hoisted_14, [
8060
- createVNode(_sfc_main$u, { icon: "$mouseLeftClick" }),
8243
+ createVNode(_sfc_main$w, { icon: "$mouseLeftClick" }),
8061
8244
  createElementVNode("span", null, toDisplayString(unref(t)("selectObject")), 1)
8062
8245
  ]),
8063
8246
  _cache[4] || (_cache[4] = createElementVNode("span", null, " + ", -1)),
@@ -8067,7 +8250,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8067
8250
  ]),
8068
8251
  _cache[5] || (_cache[5] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
8069
8252
  createElementVNode("div", _hoisted_17, [
8070
- createVNode(_sfc_main$u, { icon: "$mouseLeftClick" }),
8253
+ createVNode(_sfc_main$w, { icon: "$mouseLeftClick" }),
8071
8254
  createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
8072
8255
  ]),
8073
8256
  _cache[6] || (_cache[6] = createElementVNode("span", null, " + ", -1)),
@@ -8077,7 +8260,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8077
8260
  ]),
8078
8261
  _cache[7] || (_cache[7] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
8079
8262
  createElementVNode("div", _hoisted_20, [
8080
- createVNode(_sfc_main$u, { icon: "$mouseLeftClick" }),
8263
+ createVNode(_sfc_main$w, { icon: "$mouseLeftClick" }),
8081
8264
  createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
8082
8265
  ])
8083
8266
  ], 64))
@@ -8094,8 +8277,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8094
8277
  };
8095
8278
  }
8096
8279
  });
8097
- const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-36c89bd7"]]);
8098
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8280
+ const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-36c89bd7"]]);
8281
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8099
8282
  __name: "TextEditor",
8100
8283
  setup(__props, { expose: __expose }) {
8101
8284
  const {
@@ -8190,19 +8373,19 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8190
8373
  };
8191
8374
  }
8192
8375
  });
8193
- const _hoisted_1$4 = { class: "mce-payhead" };
8194
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8376
+ const _hoisted_1$5 = { class: "mce-payhead" };
8377
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8195
8378
  __name: "Playhead",
8196
8379
  setup(__props) {
8197
8380
  return (_ctx, _cache) => {
8198
- return openBlock(), createElementBlock("div", _hoisted_1$4, [..._cache[0] || (_cache[0] = [
8381
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [..._cache[0] || (_cache[0] = [
8199
8382
  createElementVNode("header", { class: "mce-payhead__header" }, null, -1),
8200
8383
  createElementVNode("main", { class: "mce-payhead__main" }, null, -1)
8201
8384
  ])]);
8202
8385
  };
8203
8386
  }
8204
8387
  });
8205
- const _hoisted_1$3 = {
8388
+ const _hoisted_1$4 = {
8206
8389
  key: 0,
8207
8390
  class: "mce-segment__edge mce-segment__edge--front"
8208
8391
  };
@@ -8214,7 +8397,7 @@ const _hoisted_3$2 = {
8214
8397
  key: 1,
8215
8398
  class: "mce-segment__edge mce-segment__edge--end"
8216
8399
  };
8217
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
8400
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8218
8401
  __name: "Segment",
8219
8402
  props: {
8220
8403
  node: {},
@@ -8245,25 +8428,25 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
8245
8428
  ]]),
8246
8429
  style: normalizeStyle(style.value)
8247
8430
  }, [
8248
- __props.active ? (openBlock(), createElementBlock("div", _hoisted_1$3)) : createCommentVNode("", true),
8431
+ __props.active ? (openBlock(), createElementBlock("div", _hoisted_1$4)) : createCommentVNode("", true),
8249
8432
  createElementVNode("span", _hoisted_2$2, toDisplayString(props.node.name), 1),
8250
8433
  __props.active ? (openBlock(), createElementBlock("div", _hoisted_3$2)) : createCommentVNode("", true)
8251
8434
  ], 6);
8252
8435
  };
8253
8436
  }
8254
8437
  });
8255
- const _hoisted_1$2 = { class: "mce-track" };
8256
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
8438
+ const _hoisted_1$3 = { class: "mce-track" };
8439
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8257
8440
  __name: "Track",
8258
8441
  setup(__props) {
8259
8442
  return (_ctx, _cache) => {
8260
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
8443
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
8261
8444
  renderSlot(_ctx.$slots, "default")
8262
8445
  ]);
8263
8446
  };
8264
8447
  }
8265
8448
  });
8266
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
8449
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
8267
8450
  __name: "Trackhead",
8268
8451
  props: {
8269
8452
  node: {}
@@ -8279,7 +8462,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
8279
8462
  };
8280
8463
  }
8281
8464
  });
8282
- const _hoisted_1$1 = { class: "mce-timeline__toolbar" };
8465
+ const _hoisted_1$2 = { class: "mce-timeline__toolbar" };
8283
8466
  const _hoisted_2$1 = { class: "mce-timeline__main" };
8284
8467
  const _hoisted_3$1 = { class: "mce-timeline__left" };
8285
8468
  const _hoisted_4 = { class: "mce-timeline__left-wrapper" };
@@ -8287,7 +8470,7 @@ const _hoisted_5 = { class: "mce-timeline__right-wrapper" };
8287
8470
  const _hoisted_6 = { class: "mce-timeline__ruler" };
8288
8471
  const _hoisted_7 = { class: "mce-timeline__track" };
8289
8472
  const wheelSensitivity = 0.02;
8290
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8473
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
8291
8474
  __name: "Timeline",
8292
8475
  setup(__props) {
8293
8476
  const {
@@ -8390,12 +8573,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8390
8573
  onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
8391
8574
  }, ["prevent"]))
8392
8575
  }, [
8393
- createElementVNode("div", _hoisted_1$1, [
8576
+ createElementVNode("div", _hoisted_1$2, [
8394
8577
  createElementVNode("div", {
8395
8578
  class: "mce-timeline__play",
8396
8579
  onClick: toggle
8397
8580
  }, [
8398
- createVNode(_sfc_main$u, {
8581
+ createVNode(_sfc_main$w, {
8399
8582
  icon: paused.value ? "$play" : "$pause"
8400
8583
  }, null, 8, ["icon"])
8401
8584
  ])
@@ -8409,7 +8592,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8409
8592
  })
8410
8593
  }, [
8411
8594
  (openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
8412
- return openBlock(), createBlock(_sfc_main$3, {
8595
+ return openBlock(), createBlock(_sfc_main$5, {
8413
8596
  key: index,
8414
8597
  node
8415
8598
  }, null, 8, ["node"]);
@@ -8424,7 +8607,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8424
8607
  }, [
8425
8608
  createElementVNode("div", _hoisted_5, [
8426
8609
  createElementVNode("div", _hoisted_6, [
8427
- createVNode(_sfc_main$j, {
8610
+ createVNode(_sfc_main$l, {
8428
8611
  ref: "rulerTpl",
8429
8612
  zoom: 1 / unref(msPerPx) * fps.value,
8430
8613
  unit: 100,
@@ -8442,9 +8625,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8442
8625
  })
8443
8626
  }, [
8444
8627
  (openBlock(true), createElementBlock(Fragment, null, renderList(elements.value, (node, index) => {
8445
- return openBlock(), createBlock(_sfc_main$4, { key: index }, {
8628
+ return openBlock(), createBlock(_sfc_main$6, { key: index }, {
8446
8629
  default: withCtx(() => [
8447
- createVNode(_sfc_main$5, {
8630
+ createVNode(_sfc_main$7, {
8448
8631
  node,
8449
8632
  "ms-per-px": unref(msPerPx),
8450
8633
  active: unref(selection).some((v) => v.equal(node)),
@@ -8456,7 +8639,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8456
8639
  }), 128))
8457
8640
  ], 4)
8458
8641
  ]),
8459
- createVNode(_sfc_main$6, {
8642
+ createVNode(_sfc_main$8, {
8460
8643
  style: normalizeStyle({
8461
8644
  transform: `translate(${position.value[0] + Math.ceil(unref(currentTime) / unref(msPerPx))}px, 0px)`
8462
8645
  })
@@ -8468,6 +8651,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8468
8651
  };
8469
8652
  }
8470
8653
  });
8654
+ const _sfc_main$3 = {};
8655
+ const _hoisted_1$1 = { class: "mce-toolbelt" };
8656
+ function _sfc_render(_ctx, _cache) {
8657
+ return openBlock(), createElementBlock("div", _hoisted_1$1);
8658
+ }
8659
+ const Toolbelt = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
8471
8660
  const _hoisted_1 = ["data-pixel-ratio"];
8472
8661
  const _hoisted_2 = {
8473
8662
  ref: "canvasTpl",
@@ -8477,7 +8666,7 @@ const _hoisted_3 = {
8477
8666
  ref: "overlayContainerTpl",
8478
8667
  class: "mce-editor__overlay-container"
8479
8668
  };
8480
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8669
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8481
8670
  __name: "EditorLayout",
8482
8671
  props: {
8483
8672
  ...makeMceStrategyProps({
@@ -8741,10 +8930,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8741
8930
  }
8742
8931
  }
8743
8932
  return (_ctx, _cache) => {
8744
- return openBlock(), createBlock(_sfc_main$c, { class: "mce-editor" }, {
8933
+ return openBlock(), createBlock(_sfc_main$e, { class: "mce-editor" }, {
8745
8934
  default: withCtx(() => [
8746
- createVNode(_sfc_main$d),
8747
- createVNode(_sfc_main$a, null, {
8935
+ createVNode(_sfc_main$f),
8936
+ createVNode(_sfc_main$c, null, {
8748
8937
  default: withCtx(() => [
8749
8938
  createElementVNode("div", {
8750
8939
  ref_key: "drawboardDom",
@@ -8757,12 +8946,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8757
8946
  }, ["prevent"]))
8758
8947
  }, [
8759
8948
  createElementVNode("canvas", _hoisted_2, null, 512),
8760
- createVNode(_sfc_main$7, { ref: "textEditorTpl" }, null, 512),
8761
- createVNode(_sfc_main$v),
8762
- createVNode(_sfc_main$l),
8949
+ createVNode(_sfc_main$9, { ref: "textEditorTpl" }, null, 512),
8950
+ createVNode(_sfc_main$x),
8763
8951
  createVNode(_sfc_main$n),
8764
- createVNode(_sfc_main$q),
8765
- createVNode(_sfc_main$e, {
8952
+ createVNode(_sfc_main$p),
8953
+ createVNode(_sfc_main$s),
8954
+ createVNode(_sfc_main$g, {
8766
8955
  ref: "selectorTpl",
8767
8956
  "selected-area": selectedArea.value,
8768
8957
  "resize-strategy": unref(selection)[0] ? props.resizeStrategy(unref(selection)[0]) : void 0
@@ -8775,8 +8964,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8775
8964
  ]),
8776
8965
  _: 3
8777
8966
  }, 8, ["selected-area", "resize-strategy"]),
8778
- unref(config).scrollbar ? (openBlock(), createBlock(_sfc_main$g, { key: 0 })) : createCommentVNode("", true),
8779
- _ctx.$slots.floatbar ? (openBlock(), createBlock(_sfc_main$p, {
8967
+ unref(config).scrollbar ? (openBlock(), createBlock(_sfc_main$i, { key: 0 })) : createCommentVNode("", true),
8968
+ _ctx.$slots.floatbar ? (openBlock(), createBlock(_sfc_main$r, {
8780
8969
  key: 1,
8781
8970
  target: unref(state) === "typing" ? textEditor.value?.textEditor : selector.value?.transformable?.$el
8782
8971
  }, {
@@ -8785,16 +8974,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8785
8974
  ]),
8786
8975
  _: 3
8787
8976
  }, 8, ["target"])) : createCommentVNode("", true),
8788
- createVNode(_sfc_main$r),
8789
- createVNode(_sfc_main$m),
8790
- unref(config).ruler ? (openBlock(), createBlock(_sfc_main$i, { key: 2 })) : createCommentVNode("", true),
8977
+ createVNode(_sfc_main$t),
8978
+ createVNode(_sfc_main$o),
8979
+ unref(config).ruler ? (openBlock(), createBlock(_sfc_main$k, { key: 2 })) : createCommentVNode("", true),
8980
+ createVNode(Toolbelt),
8791
8981
  renderSlot(_ctx.$slots, "drawboard")
8792
8982
  ], 40, _hoisted_1)
8793
8983
  ]),
8794
8984
  _: 3
8795
8985
  }),
8796
8986
  renderSlot(_ctx.$slots, "default"),
8797
- createVNode(_sfc_main$b, {
8987
+ createVNode(_sfc_main$d, {
8798
8988
  modelValue: unref(config).statusbar,
8799
8989
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(config).statusbar = $event),
8800
8990
  position: "bottom",
@@ -8805,14 +8995,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8805
8995
  ]),
8806
8996
  _: 1
8807
8997
  }, 8, ["modelValue"]),
8808
- createVNode(_sfc_main$b, {
8998
+ createVNode(_sfc_main$d, {
8809
8999
  modelValue: unref(config).timeline,
8810
9000
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(config).timeline = $event),
8811
9001
  position: "bottom",
8812
9002
  size: 160
8813
9003
  }, {
8814
9004
  default: withCtx(() => [
8815
- createVNode(_sfc_main$2)
9005
+ createVNode(_sfc_main$4)
8816
9006
  ]),
8817
9007
  _: 1
8818
9008
  }, 8, ["modelValue"]),
@@ -8823,6 +9013,209 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8823
9013
  };
8824
9014
  }
8825
9015
  });
9016
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9017
+ __name: "Layers",
9018
+ setup(__props) {
9019
+ const {
9020
+ root,
9021
+ selection,
9022
+ exec,
9023
+ zoomTo
9024
+ } = useEditor();
9025
+ const rootRef = ref();
9026
+ const hover = ref();
9027
+ const current = ref();
9028
+ watch(hover, (hover2) => {
9029
+ const rootBox = rootRef.value?.getBoundingClientRect();
9030
+ const hoverBox = hover2?.dom.getBoundingClientRect();
9031
+ if (rootBox && hoverBox && hover2.node instanceof Element2D) {
9032
+ current.value = {
9033
+ x: -rootRef.value.scrollLeft,
9034
+ y: rootRef.value.scrollTop + hoverBox.y - rootBox.y,
9035
+ node: hover2.node
9036
+ };
9037
+ } else {
9038
+ current.value = void 0;
9039
+ }
9040
+ });
9041
+ function onMouseleave() {
9042
+ hover.value = void 0;
9043
+ }
9044
+ const Layer = defineComponent({
9045
+ name: "MceLayer",
9046
+ inheritAttrs: false,
9047
+ props: {
9048
+ node: {
9049
+ type: Object,
9050
+ required: true
9051
+ },
9052
+ indent: {
9053
+ type: Number,
9054
+ default: 0
9055
+ }
9056
+ },
9057
+ setup(props, { attrs }) {
9058
+ const opened = ref(false);
9059
+ const isActive = computed(() => selection.value.some((v) => v.equal(props.node)));
9060
+ const children = computed(() => props.node?.children ?? []);
9061
+ const itemRef = ref();
9062
+ const editing = ref(false);
9063
+ const editValue = ref();
9064
+ function onClickExpand() {
9065
+ opened.value = !opened.value;
9066
+ }
9067
+ function onClickContent() {
9068
+ if (props.node instanceof Element2D) {
9069
+ selection.value = [props.node];
9070
+ }
9071
+ }
9072
+ function onDblclickThumbnail(e) {
9073
+ e.stopPropagation();
9074
+ if (props.node instanceof Element2D) {
9075
+ zoomTo("selection", {
9076
+ behavior: "smooth"
9077
+ });
9078
+ }
9079
+ }
9080
+ function onDblclickContent() {
9081
+ editing.value = true;
9082
+ }
9083
+ function onMouseenter() {
9084
+ hover.value = {
9085
+ node: props.node,
9086
+ dom: itemRef.value
9087
+ };
9088
+ }
9089
+ return () => {
9090
+ function thumbnail() {
9091
+ const node = props.node;
9092
+ if (node.meta.inEditorIs === "Frame") {
9093
+ return createVNode(_sfc_main$w, { icon: "$frame" });
9094
+ }
9095
+ if (node.children.length > 0) {
9096
+ return createVNode(_sfc_main$w, { icon: "$group" });
9097
+ }
9098
+ if (node instanceof Element2D) {
9099
+ if (node.foreground.isValid() && node.foreground.image) {
9100
+ return createVNode(_sfc_main$w, { icon: "$image" });
9101
+ }
9102
+ if (node.text.isValid()) {
9103
+ return createVNode(_sfc_main$w, { icon: "$text" });
9104
+ }
9105
+ }
9106
+ return createVNode(_sfc_main$w, { icon: "$shape" });
9107
+ }
9108
+ return createElementVNode(
9109
+ "div",
9110
+ mergeProps(attrs, {
9111
+ class: [
9112
+ "mce-layer",
9113
+ isActive.value && "mce-layer--active",
9114
+ opened.value && "mce-layer--opened"
9115
+ ]
9116
+ }),
9117
+ [
9118
+ createElementVNode("div", {
9119
+ class: "mce-layer-item",
9120
+ style: {
9121
+ "--indent-padding": `${props.indent * 16}px`
9122
+ },
9123
+ ref: itemRef,
9124
+ onMouseenter,
9125
+ onContextmenu: (e) => {
9126
+ if (props.node instanceof Element2D) {
9127
+ selection.value = [props.node];
9128
+ exec("openContextMenu", e);
9129
+ }
9130
+ }
9131
+ }, [
9132
+ createElementVNode("div", {
9133
+ class: "mce-layer-item__expand",
9134
+ onClick: onClickExpand
9135
+ }, [
9136
+ children.value.length ? createVNode(_sfc_main$w, { icon: "$arrowRight" }) : void 0
9137
+ ]),
9138
+ createElementVNode("div", {
9139
+ class: "mce-layer-item__content",
9140
+ onClick: onClickContent,
9141
+ onDblclick: onDblclickContent
9142
+ }, [
9143
+ createElementVNode("div", {
9144
+ class: "mce-layer-item__thumbnail",
9145
+ onDblclick: onDblclickThumbnail
9146
+ }, [
9147
+ thumbnail()
9148
+ ]),
9149
+ createElementVNode("div", {
9150
+ class: "mce-layer-item__name"
9151
+ }, [
9152
+ editing.value ? createElementVNode("input", {
9153
+ class: "mce-layer-item__name-input",
9154
+ autofocus: true,
9155
+ value: props.node.name,
9156
+ onBlur: () => {
9157
+ editing.value = false;
9158
+ if (editValue.value) {
9159
+ props.node.name = editValue.value;
9160
+ editValue.value = void 0;
9161
+ }
9162
+ },
9163
+ onInput: (e) => editValue.value = e.target.value
9164
+ }) : props.node.name || props.node.id
9165
+ ])
9166
+ ])
9167
+ ]),
9168
+ ...opened.value ? children.value.map((child) => createVNode(Layer, {
9169
+ node: child,
9170
+ indent: props.indent + 1
9171
+ })) : []
9172
+ ]
9173
+ );
9174
+ };
9175
+ }
9176
+ });
9177
+ return (_ctx, _cache) => {
9178
+ return openBlock(), createElementBlock("div", {
9179
+ ref_key: "rootRef",
9180
+ ref: rootRef,
9181
+ class: "mce-layers",
9182
+ onMouseleave
9183
+ }, [
9184
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(root).children, (child, index) => {
9185
+ return openBlock(), createBlock(unref(Layer), {
9186
+ key: index,
9187
+ node: child
9188
+ }, null, 8, ["node"]);
9189
+ }), 128)),
9190
+ current.value !== void 0 ? (openBlock(), createElementBlock("div", {
9191
+ key: 0,
9192
+ class: "mce-layers__action",
9193
+ style: normalizeStyle({
9194
+ right: `${current.value.x}px`,
9195
+ top: `${current.value.y}px`
9196
+ })
9197
+ }, [
9198
+ createElementVNode("div", {
9199
+ class: "mce-btn",
9200
+ onClick: _cache[0] || (_cache[0] = ($event) => current.value.node.meta.lock = !current.value.node.meta.lock)
9201
+ }, [
9202
+ createVNode(_sfc_main$w, {
9203
+ icon: current.value.node.meta.lock ? "$lock" : "$unlock"
9204
+ }, null, 8, ["icon"])
9205
+ ]),
9206
+ createElementVNode("div", {
9207
+ class: "mce-btn",
9208
+ onClick: _cache[1] || (_cache[1] = ($event) => current.value.node.style.visibility = current.value.node.style.visibility === "visible" ? "hidden" : "visible")
9209
+ }, [
9210
+ createVNode(_sfc_main$w, {
9211
+ icon: current.value.node.style.visibility === "visible" ? "$visible" : "$unvisible"
9212
+ }, null, 8, ["icon"])
9213
+ ])
9214
+ ], 4)) : createCommentVNode("", true)
9215
+ ], 544);
9216
+ };
9217
+ }
9218
+ });
8826
9219
  const _sfc_main = /* @__PURE__ */ defineComponent({
8827
9220
  __name: "Dialog",
8828
9221
  props: /* @__PURE__ */ mergeModels({
@@ -8850,7 +9243,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8850
9243
  updateLocation
8851
9244
  });
8852
9245
  return (_ctx, _cache) => {
8853
- return openBlock(), createBlock(_sfc_main$t, {
9246
+ return openBlock(), createBlock(_sfc_main$v, {
8854
9247
  ref: "overlayTpl",
8855
9248
  modelValue: isActive.value,
8856
9249
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
@@ -8877,8 +9270,10 @@ export {
8877
9270
  _sfc_main as Dialog,
8878
9271
  Doc,
8879
9272
  Editor,
8880
- _sfc_main$1 as EditorLayout,
8881
- _sfc_main$b as EditorLayoutItem,
9273
+ _sfc_main$1 as EditorLayers,
9274
+ _sfc_main$2 as EditorLayout,
9275
+ _sfc_main$d as EditorLayoutItem,
9276
+ Toolbelt as EditorToolbelt,
8882
9277
  IconsSymbol,
8883
9278
  MceComponentIcon,
8884
9279
  MceLayoutItemKey,
@@ -8886,12 +9281,12 @@ export {
8886
9281
  MceMenuSymbol,
8887
9282
  MceOverlaySymbol,
8888
9283
  MceSvgIcon,
8889
- _sfc_main$s as Menu,
9284
+ _sfc_main$u as Menu,
8890
9285
  Model,
8891
- _sfc_main$j as Ruler,
9286
+ _sfc_main$l as Ruler,
8892
9287
  SUPPORTS_CLIPBOARD,
8893
- _sfc_main$h as Scrollbar,
8894
- _sfc_main$f as Transformable,
9288
+ _sfc_main$j as Scrollbar,
9289
+ _sfc_main$h as Transformable,
8895
9290
  USER_AGENT,
8896
9291
  boundingBoxToStyle,
8897
9292
  consoleError,