mce 0.1.1 → 0.1.2

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.
@@ -39,7 +39,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
39
39
  readonly handles?: ("move" | "rotate-top-left" | "rotate-top-right" | "rotate-bottom-left" | "rotate-bottom-right" | "resize-top" | "resize-right" | "resize-bottom" | "resize-left" | "resize-top-left" | "resize-top-right" | "resize-bottom-left" | "resize-bottom-right")[] | undefined;
40
40
  readonly initialSize?: boolean | undefined;
41
41
  readonly borderStyle?: "solid" | "dashed" | undefined;
42
- readonly tip?: ((type: "size") => string) | undefined;
42
+ readonly tipFormat?: ((type: "size") => string) | undefined;
43
43
  readonly onMove?: ((args_0: OrientedBoundingBox, args_1: OrientedBoundingBox) => any) | undefined;
44
44
  readonly onEnd?: ((args_0: OrientedBoundingBox) => any) | undefined;
45
45
  readonly onStart?: ((args_0: OrientedBoundingBox) => any) | undefined;
@@ -75,7 +75,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
75
75
  handles?: ("move" | "rotate-top-left" | "rotate-top-right" | "rotate-bottom-left" | "rotate-bottom-right" | "resize-top" | "resize-right" | "resize-bottom" | "resize-left" | "resize-top-left" | "resize-top-right" | "resize-bottom-left" | "resize-bottom-right")[];
76
76
  initialSize?: boolean;
77
77
  borderStyle?: "solid" | "dashed";
78
- tip?: (type: "size") => string;
78
+ tipFormat?: (type: "size") => string;
79
79
  }> & Readonly<{
80
80
  onMove?: ((args_0: OrientedBoundingBox, args_1: OrientedBoundingBox) => any) | undefined;
81
81
  onEnd?: ((args_0: OrientedBoundingBox) => any) | undefined;
@@ -150,7 +150,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
150
150
  handles?: ("move" | "rotate-top-left" | "rotate-top-right" | "rotate-bottom-left" | "rotate-bottom-right" | "resize-top" | "resize-right" | "resize-bottom" | "resize-left" | "resize-top-left" | "resize-top-right" | "resize-bottom-left" | "resize-bottom-right")[];
151
151
  initialSize?: boolean;
152
152
  borderStyle?: "solid" | "dashed";
153
- tip?: (type: "size") => string;
153
+ tipFormat?: (type: "size") => string;
154
154
  }> & Readonly<{
155
155
  onMove?: ((args_0: OrientedBoundingBox, args_1: OrientedBoundingBox) => any) | undefined;
156
156
  onEnd?: ((args_0: OrientedBoundingBox) => any) | undefined;
@@ -16,7 +16,7 @@ type __VLS_Props = {
16
16
  handles?: Handle[];
17
17
  initialSize?: boolean;
18
18
  borderStyle?: 'solid' | 'dashed';
19
- tip?: (type: 'size') => string;
19
+ tipFormat?: (type: 'size') => string;
20
20
  };
21
21
  declare function start(event?: MouseEvent, index?: number): boolean;
22
22
  declare var __VLS_7: {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref as V, computed as O, watch as he, markRaw as de, reactive as et, nextTick as Fe, inject as Ve, provide as Le, defineComponent as H, createVNode as W, mergeProps as Ie, createElementVNode as I, toValue as rn, getCurrentInstance as St, onScopeDispose as ln, createElementBlock as R, openBlock as $, Fragment as oe, renderList as pe, unref as M, normalizeStyle as K, normalizeClass as ve, renderSlot as ne, useAttrs as zt, createBlock as te, resolveDynamicComponent as Ot, useTemplateRef as le, onMounted as He, onBeforeUnmount as ge, Teleport as cn, createCommentVNode as Z, mergeModels as Pe, useModel as xe, useId as un, shallowRef as dn, resolveComponent as hn, withCtx as ue, createTextVNode as mn, toDisplayString as G, createSlots as rt, normalizeProps as lt, guardReactiveProps as ct, withDirectives as Ee, vShow as De, vModelText as fn, withModifiers as Xe, onBeforeMount as ut, isRef as pn } from "vue";
1
+ import { ref as V, computed as O, watch as he, markRaw as de, reactive as et, nextTick as Fe, inject as Ve, provide as Le, defineComponent as H, createVNode as W, mergeProps as Ie, createElementVNode as I, toValue as rn, getCurrentInstance as St, onScopeDispose as ln, createElementBlock as R, openBlock as $, Fragment as oe, renderList as pe, unref as M, normalizeStyle as K, normalizeClass as ve, renderSlot as ne, useAttrs as zt, createBlock as te, resolveDynamicComponent as Ot, useTemplateRef as le, onMounted as He, onBeforeUnmount as ge, Teleport as cn, createCommentVNode as J, mergeModels as Pe, useModel as xe, useId as un, shallowRef as dn, resolveComponent as hn, withCtx as ue, createTextVNode as mn, toDisplayString as G, createSlots as rt, normalizeProps as lt, guardReactiveProps as ct, withDirectives as Ee, vShow as De, vModelText as fn, withModifiers as Xe, onBeforeMount as ut, isRef as pn } from "vue";
2
2
  import { useFileDialog as $t, useEventListener as Ft, isClient as vn, useResizeObserver as It, useLocalStorage as gn, onClickOutside as yn, useMouse as bn, useDebounceFn as Pt } from "@vueuse/core";
3
3
  import { Timeline as wn, Engine as xn, Camera2D as _n, DrawboardEffect as kn, Element2D as q, IN_BROWSER as Nt, clamp as Cn, assets as Bt, TimelineNode as Tn, Transform2D as En, DEG_TO_RAD as An, Node as vt, render as Ye, Animation as Mn } from "modern-canvas";
4
4
  import { getObjectValueByPath as Sn, setObjectValueByPath as zn, normalizeTextContent as On, idGenerator as dt, normalizeElement as Rt, Observable as Dt, Reactivable as $n, property as je } from "modern-idoc";
@@ -336,9 +336,9 @@ const Un = (o) => {
336
336
  return Object.assign(o, {
337
337
  frames: n,
338
338
  frameThumbs: i,
339
- activeFrameIndex: s,
340
- activeFrame: a,
341
- activeFrameAabb: r,
339
+ currentFrameIndex: s,
340
+ currentFrame: a,
341
+ currentFrameAabb: r,
342
342
  isFrame: c,
343
343
  getAncestorFrame: l
344
344
  }), () => {
@@ -917,7 +917,7 @@ const ho = (o) => {
917
917
  const {
918
918
  renderEngine: e,
919
919
  rootAabb: t,
920
- activeFrameAabb: n,
920
+ currentFrameAabb: n,
921
921
  config: s
922
922
  } = o, a = O(() => s.value.viewMode === "frame" ? n.value : t.value);
923
923
  function r(i, c) {
@@ -939,7 +939,7 @@ const ho = (o) => {
939
939
  }), () => {
940
940
  const {
941
941
  root: i,
942
- activeFrame: c,
942
+ currentFrame: c,
943
943
  on: l,
944
944
  exec: u
945
945
  } = o;
@@ -958,7 +958,7 @@ const ho = (o) => {
958
958
  }
959
959
  u("zoomToFit");
960
960
  }
961
- he(() => s.value.viewMode, d), l("setActiveFrame", d), l("setDoc", d);
961
+ he(() => s.value.viewMode, d), l("setCurrentFrame", d), l("setDoc", d);
962
962
  };
963
963
  }, yo = (o) => {
964
964
  const {
@@ -1053,7 +1053,7 @@ const ho = (o) => {
1053
1053
  const {
1054
1054
  doc: e,
1055
1055
  rootAabb: t,
1056
- activeFrame: n,
1056
+ currentFrame: n,
1057
1057
  emit: s,
1058
1058
  textFontSizeToFit: a,
1059
1059
  textToFit: r,
@@ -1093,7 +1093,7 @@ const ho = (o) => {
1093
1093
  if (_) {
1094
1094
  const { width: _e, height: ke } = _.style, ye = _e / 2, me = ke / 2;
1095
1095
  if (Y.style.width || (Y.style.width = ye), Y.style.height || (Y.style.height = me), E) {
1096
- const J = Y.style.width / Y.style.height, ce = J > 1 ? ye : me * J, U = J > 1 ? ye / J : me;
1096
+ const Z = Y.style.width / Y.style.height, ce = Z > 1 ? ye : me * Z, U = Z > 1 ? ye / Z : me;
1097
1097
  k(
1098
1098
  Y,
1099
1099
  ce / Y.style.width,
@@ -1170,7 +1170,7 @@ const ho = (o) => {
1170
1170
  doc: e,
1171
1171
  root: t,
1172
1172
  rootAabb: n,
1173
- activeFrameIndex: s,
1173
+ currentFrameIndex: s,
1174
1174
  frameThumbs: a,
1175
1175
  emit: r,
1176
1176
  selection: i,
@@ -1215,14 +1215,14 @@ const ho = (o) => {
1215
1215
  function g(v = s.value) {
1216
1216
  v = Math.max(0, Math.min(c.value.length - 1, v));
1217
1217
  const m = s.value;
1218
- s.value = v, l.value.viewMode === "edgeless" ? i.value = [c.value[v]] : i.value = [], r("setActiveFrame", v, m);
1218
+ s.value = v, l.value.viewMode === "edgeless" ? i.value = [c.value[v]] : i.value = [], r("setCurrentFrame", v, m);
1219
1219
  }
1220
1220
  Object.assign(o, {
1221
1221
  addFrame: u,
1222
1222
  duplicateFrame: d,
1223
1223
  moveFrame: y,
1224
1224
  deleteFrame: h,
1225
- setActiveFrame: g
1225
+ setCurrentFrame: g
1226
1226
  });
1227
1227
  };
1228
1228
  function Me(o) {
@@ -1750,7 +1750,7 @@ const Vo = (o, e) => {
1750
1750
  renderEngine: s,
1751
1751
  emit: a,
1752
1752
  selection: r,
1753
- setActiveFrame: i,
1753
+ setCurrentFrame: i,
1754
1754
  state: c,
1755
1755
  to: l,
1756
1756
  waitUntilFontLoad: u,
@@ -1788,19 +1788,13 @@ const Vo = (o, e) => {
1788
1788
  const {
1789
1789
  doc: f
1790
1790
  } = e;
1791
- v(f || {
1792
- style: {
1793
- width: 1920,
1794
- height: 1080
1795
- },
1796
- children: []
1797
- });
1791
+ f && v(f);
1798
1792
  };
1799
1793
  }, jo = (o) => {
1800
1794
  const {
1801
1795
  renderEngine: e,
1802
1796
  frames: t,
1803
- activeFrameAabb: n,
1797
+ currentFrameAabb: n,
1804
1798
  camera: s,
1805
1799
  frameThumbs: a,
1806
1800
  log: r,
@@ -1880,7 +1874,7 @@ const Vo = (o, e) => {
1880
1874
  }
1881
1875
  }
1882
1876
  v.root.on("appendChild", m);
1883
- }), h("setActiveFrame", (v, m) => {
1877
+ }), h("setCurrentFrame", (v, m) => {
1884
1878
  g.value.frameScreenshot && d(m);
1885
1879
  });
1886
1880
  };
@@ -2642,7 +2636,7 @@ function Qe(o) {
2642
2636
  }
2643
2637
  const qo = (o) => {
2644
2638
  const {
2645
- activeFrame: e,
2639
+ currentFrame: e,
2646
2640
  selection: t,
2647
2641
  state: n,
2648
2642
  getObbInDrawboard: s,
@@ -3326,7 +3320,7 @@ const qo = (o) => {
3326
3320
  };
3327
3321
  }, ss = (o) => {
3328
3322
  const {
3329
- activeFrameAabb: e,
3323
+ currentFrameAabb: e,
3330
3324
  selection: t,
3331
3325
  getAabb: n
3332
3326
  } = o;
@@ -4092,7 +4086,7 @@ const ps = (o) => {
4092
4086
  ],
4093
4087
  events: {
4094
4088
  setDoc: y,
4095
- setActiveFrame: () => {
4089
+ setCurrentFrame: () => {
4096
4090
  i.value.length ? g() : y();
4097
4091
  }
4098
4092
  },
@@ -4220,7 +4214,7 @@ class Ae extends Dt {
4220
4214
  } catch (t) {
4221
4215
  console.error(`Failed to setup ${e.name} plugin`, t);
4222
4216
  }
4223
- }));
4217
+ }), this.emit("ready"));
4224
4218
  };
4225
4219
  install = (e) => {
4226
4220
  e.provide(Ae.injectionKey, this);
@@ -4536,7 +4530,7 @@ const Is = Yt({
4536
4530
  style: g.value
4537
4531
  }, f.$attrs), [
4538
4532
  ne(f.$slots, "default")
4539
- ], 16)) : Z("", !0)
4533
+ ], 16)) : J("", !0)
4540
4534
  ], 8, ["disabled", "to"]))
4541
4535
  ], 64));
4542
4536
  }
@@ -4634,7 +4628,7 @@ const Is = Yt({
4634
4628
  F.checked ? ($(), te(we, {
4635
4629
  key: 0,
4636
4630
  icon: "$check"
4637
- })) : Z("", !0)
4631
+ })) : J("", !0)
4638
4632
  ]),
4639
4633
  I("div", Xs, [
4640
4634
  ne(f.$slots, "title", { item: F }, () => [
@@ -4643,7 +4637,7 @@ const Is = Yt({
4643
4637
  ]),
4644
4638
  F.children?.length ? ($(), R("div", Hs, [
4645
4639
  W(we, { icon: "$menuRight" })
4646
- ])) : Z("", !0)
4640
+ ])) : J("", !0)
4647
4641
  ], 10, js)
4648
4642
  ], 40, Vs))
4649
4643
  ], 64))), 128)),
@@ -4666,8 +4660,8 @@ const Is = Yt({
4666
4660
  ]),
4667
4661
  key: "0"
4668
4662
  } : void 0
4669
- ]), 1032, ["items", "model-value", "target"])) : Z("", !0)
4670
- ], 32)) : Z("", !0)
4663
+ ]), 1032, ["items", "model-value", "target"])) : J("", !0)
4664
+ ], 32)) : J("", !0)
4671
4665
  ]),
4672
4666
  _: 3
4673
4667
  }, 8, ["modelValue", "location", "offset", "target", "attach"]);
@@ -4732,7 +4726,7 @@ const Is = Yt({
4732
4726
  }, {
4733
4727
  title: ue(({ item: f }) => [
4734
4728
  I("span", qs, G(M(i)(f.key)), 1),
4735
- M(c).has(f.key) ? ($(), R("span", Gs, G(M(r)(f.key)), 1)) : Z("", !0)
4729
+ M(c).has(f.key) ? ($(), R("span", Gs, G(M(r)(f.key)), 1)) : J("", !0)
4736
4730
  ]),
4737
4731
  _: 1
4738
4732
  }, 8, ["modelValue", "target", "items", "style"]));
@@ -4767,8 +4761,8 @@ const Is = Yt({
4767
4761
  }),
4768
4762
  onMousedown: l
4769
4763
  }, [
4770
- M(t)?.content ? ($(), R("div", Ks, G(M(n)(M(t).content)), 1)) : Z("", !0)
4771
- ], 36)) : Z("", !0);
4764
+ M(t)?.content ? ($(), R("div", Ks, G(M(n)(M(t).content)), 1)) : J("", !0)
4765
+ ], 36)) : J("", !0);
4772
4766
  }
4773
4767
  }), Zs = /* @__PURE__ */ H({
4774
4768
  __name: "Floatbar",
@@ -4801,7 +4795,7 @@ const Is = Yt({
4801
4795
  "model-value": !0
4802
4796
  }, {
4803
4797
  default: ue(() => [
4804
- M(s).length > 0 ? ne(c.$slots, "default", { key: 0 }) : Z("", !0)
4798
+ M(s).length > 0 ? ne(c.$slots, "default", { key: 0 }) : J("", !0)
4805
4799
  ]),
4806
4800
  _: 3
4807
4801
  }, 8, ["location", "offset", "target"]));
@@ -4888,7 +4882,7 @@ const Is = Yt({
4888
4882
  }, [
4889
4883
  W(we, { icon: "$gps" }),
4890
4884
  I("span", null, G(M(a)("goBackSelectedArea")), 1)
4891
- ])) : Z("", !0);
4885
+ ])) : J("", !0);
4892
4886
  }
4893
4887
  }), na = ["data-name"], oa = /* @__PURE__ */ H({
4894
4888
  __name: "Hover",
@@ -4906,7 +4900,7 @@ const Is = Yt({
4906
4900
  borderColor: "currentcolor",
4907
4901
  ...M(Te)(s.value)
4908
4902
  })
4909
- }, null, 12, na)) : Z("", !0);
4903
+ }, null, 12, na)) : J("", !0);
4910
4904
  }
4911
4905
  }), sa = /* @__PURE__ */ H({
4912
4906
  __name: "Tooltip",
@@ -4938,7 +4932,7 @@ const Is = Yt({
4938
4932
  attach: t.attach
4939
4933
  }, rt({
4940
4934
  default: ue(() => [
4941
- n.value ? ne(r.$slots, "default", { key: 0 }) : Z("", !0)
4935
+ n.value ? ne(r.$slots, "default", { key: 0 }) : J("", !0)
4942
4936
  ]),
4943
4937
  _: 2
4944
4938
  }, [
@@ -5296,7 +5290,10 @@ const Is = Yt({
5296
5290
  }), null, 16, ["modelValue", "zoom", "length"])
5297
5291
  ], 64));
5298
5292
  }
5299
- }), ma = { class: "mce-transformable__svg" }, fa = { "pointer-events": "all" }, pa = ["x", "y", "width", "height", "aria-label", "fill"], va = ["cx", "cy", "r", "aria-label", "fill"], ga = ["x", "y", "width", "height", "aria-label", "cursor", "onPointerdown"], ya = { class: "mce-transformable__tip" }, ba = /* @__PURE__ */ H({
5293
+ }), ma = { class: "mce-transformable__svg" }, fa = { "pointer-events": "all" }, pa = ["x", "y", "width", "height", "aria-label", "fill"], va = ["cx", "cy", "r", "aria-label", "fill"], ga = ["x", "y", "width", "height", "aria-label", "cursor", "onPointerdown"], ya = {
5294
+ key: 0,
5295
+ class: "mce-transformable__tip"
5296
+ }, ba = /* @__PURE__ */ H({
5300
5297
  __name: "Transformable",
5301
5298
  props: {
5302
5299
  tag: { default: "div" },
@@ -5328,7 +5325,7 @@ const Is = Yt({
5328
5325
  ] },
5329
5326
  initialSize: { type: Boolean },
5330
5327
  borderStyle: {},
5331
- tip: {}
5328
+ tipFormat: {}
5332
5329
  },
5333
5330
  emits: ["update:modelValue", "start", "move", "end"],
5334
5331
  setup(o, { expose: e, emit: t }) {
@@ -5403,7 +5400,7 @@ const Is = Yt({
5403
5400
  ...y.value,
5404
5401
  transform: `matrix(${x}, ${E}, ${-E}, ${x}, ${p}, ${b})`
5405
5402
  };
5406
- }), g = O(() => n.visibility === "auto" && c.value), v = O(() => n.tip?.("size") ?? `${Math.floor(i.value.width)} × ${Math.floor(i.value.height)}`);
5403
+ }), g = O(() => n.visibility === "auto" && c.value), v = O(() => n.tipFormat?.("size"));
5407
5404
  function m(p, b) {
5408
5405
  if (p && p.button !== void 0 && p.button !== 0)
5409
5406
  return !1;
@@ -5435,7 +5432,7 @@ const Is = Yt({
5435
5432
  }
5436
5433
  !n.threshold && !c.value && _e();
5437
5434
  function ke(me) {
5438
- const J = {};
5435
+ const Z = {};
5439
5436
  Y || (Y = { x: me.clientX, y: me.clientY });
5440
5437
  const ce = {
5441
5438
  x: me.clientX - Y.x,
@@ -5453,13 +5450,13 @@ const Is = Yt({
5453
5450
  if (C) {
5454
5451
  if (!n.moveable)
5455
5452
  return;
5456
- J.left = U.x, J.top = U.y;
5453
+ Z.left = U.x, Z.top = U.y;
5457
5454
  } else if (N) {
5458
5455
  const Ce = Math.atan2(
5459
5456
  U.y - D.y,
5460
5457
  U.x - D.x
5461
5458
  ) / (Math.PI / 180);
5462
- J.rotate = (S + Ce - fe + 360) % 360;
5459
+ Z.rotate = (S + Ce - fe + 360) % 360;
5463
5460
  } else if (j) {
5464
5461
  const Ce = F(U, Q, -S), se = F(
5465
5462
  L ? { x: Ce.x, y: Q.y } : { x: Q.x, y: Ce.y },
@@ -5469,7 +5466,7 @@ const Is = Yt({
5469
5466
  x: se.x - (se.x - ee.x) / 2,
5470
5467
  y: se.y + (ee.y - se.y) / 2
5471
5468
  }, be = A(se, ee);
5472
- L ? (J.width = be, P && n.resizeStrategy === "aspectRatio" && (J.height = be / P)) : (J.height = be, P && n.resizeStrategy === "aspectRatio" && (J.width = be * P)), J.left = Be.x - (L ? be : x) / 2, J.top = Be.y - (L ? E : be) / 2;
5469
+ L ? (Z.width = be, P && n.resizeStrategy === "aspectRatio" && (Z.height = be / P)) : (Z.height = be, P && n.resizeStrategy === "aspectRatio" && (Z.width = be * P)), Z.left = Be.x - (L ? be : x) / 2, Z.top = Be.y - (L ? E : be) / 2;
5473
5470
  } else {
5474
5471
  if (P && (n.resizeStrategy === "aspectRatio" || n.resizeStrategy === "diagonalAspectRatio")) {
5475
5472
  let Ke = 1;
@@ -5485,11 +5482,11 @@ const Is = Yt({
5485
5482
  F(U, Ce, -S),
5486
5483
  F(ee, Ce, -S)
5487
5484
  ], [Be, be] = se[0].x > se[1].x ? [se[1].x, se[0].x] : [se[0].x, se[1].x], [pt, an] = se[0].y > se[1].y ? [se[1].y, se[0].y] : [se[0].y, se[1].y];
5488
- J.width = be - Be, J.height = an - pt, J.left = Be, J.top = pt;
5485
+ Z.width = be - Be, Z.height = an - pt, Z.left = Be, Z.top = pt;
5489
5486
  }
5490
- if ("width" in J && J.width <= 0 || "height" in J && J.height <= 0)
5487
+ if ("width" in Z && Z.width <= 0 || "height" in Z && Z.height <= 0)
5491
5488
  return;
5492
- const ie = { ...i.value }, Se = { ...i.value, ...J };
5489
+ const ie = { ...i.value }, Se = { ...i.value, ...Z };
5493
5490
  i.value = Se, s("move", Se, ie);
5494
5491
  }
5495
5492
  function ye() {
@@ -5600,7 +5597,7 @@ const Is = Yt({
5600
5597
  opacity: o.visibility === "none" || c.value && o.visibility !== "visible" ? 0 : void 0
5601
5598
  })
5602
5599
  }, null, 12, va))
5603
- ], 64)) : Z("", !0),
5600
+ ], 64)) : J("", !0),
5604
5601
  I("rect", {
5605
5602
  ref_for: !0,
5606
5603
  ref_key: "handlesRef",
@@ -5626,7 +5623,7 @@ const Is = Yt({
5626
5623
  ne(p.$slots, "svg", { box: i.value })
5627
5624
  ], 4)
5628
5625
  ])),
5629
- I("div", ya, G(v.value), 1)
5626
+ v.value ? ($(), R("div", ya, G(v.value), 1)) : J("", !0)
5630
5627
  ]),
5631
5628
  _: 3
5632
5629
  }, 8, ["style"]));
@@ -5715,7 +5712,7 @@ const Is = Yt({
5715
5712
  borderColor: "currentcolor",
5716
5713
  ...M(Te)(t.selectedArea)
5717
5714
  })
5718
- }, null, 4)) : Z("", !0),
5715
+ }, null, 4)) : J("", !0),
5719
5716
  ($(!0), R(oe, null, pe(f.value, (p, b) => ($(), R("div", {
5720
5717
  key: b,
5721
5718
  class: "mce-element-obb",
@@ -5735,7 +5732,7 @@ const Is = Yt({
5735
5732
  "handle-shape": M(g).handleShape,
5736
5733
  class: "mce-selection-obb",
5737
5734
  "border-style": M(a).length > 1 ? "dashed" : "solid",
5738
- tip: F,
5735
+ "tip-format": F,
5739
5736
  onMove: A[1] || (A[1] = () => !M(n) && (n.value = "transforming")),
5740
5737
  onEnd: A[2] || (A[2] = () => M(n) === "transforming" && (n.value = void 0))
5741
5738
  }, rt({ _: 2 }, [
@@ -5746,13 +5743,13 @@ const Is = Yt({
5746
5743
  ]),
5747
5744
  key: "0"
5748
5745
  } : void 0
5749
- ]), 1032, ["modelValue", "visibility", "moveable", "resize-strategy", "handle-shape", "border-style"])) : Z("", !0),
5746
+ ]), 1032, ["modelValue", "visibility", "moveable", "resize-strategy", "handle-shape", "border-style"])) : J("", !0),
5750
5747
  z.value.width && z.value.height && k.$slots.default ? ($(), R("div", {
5751
5748
  key: 2,
5752
5749
  style: K([{ position: "absolute" }, M(Te)(z.value)])
5753
5750
  }, [
5754
5751
  ne(k.$slots, "default", { box: z.value })
5755
- ], 4)) : Z("", !0)
5752
+ ], 4)) : J("", !0)
5756
5753
  ], 64));
5757
5754
  }
5758
5755
  }), xa = /* @__PURE__ */ H({
@@ -5779,7 +5776,7 @@ const Is = Yt({
5779
5776
  setup(o) {
5780
5777
  const e = xe(o, "modelValue");
5781
5778
  return (t, n) => ($(), R("div", _a, [
5782
- o.label ? ($(), R("span", ka, G(o.label), 1)) : Z("", !0),
5779
+ o.label ? ($(), R("span", ka, G(o.label), 1)) : J("", !0),
5783
5780
  I("div", Ca, [
5784
5781
  o.indeterminate ? ($(), R("div", Ta)) : ($(), R("div", {
5785
5782
  key: 0,
@@ -5863,7 +5860,7 @@ const Is = Yt({
5863
5860
  modelValue: M(a),
5864
5861
  "onUpdate:modelValue": i[0] || (i[0] = (c) => pn(a) ? a.value = c : null),
5865
5862
  label: M(t)("exporting")
5866
- }, null, 8, ["modelValue", "label"])) : Z("", !0)
5863
+ }, null, 8, ["modelValue", "label"])) : J("", !0)
5867
5864
  ])
5868
5865
  ]));
5869
5866
  }
@@ -5975,9 +5972,9 @@ const Is = Yt({
5975
5972
  ]]),
5976
5973
  style: K(t.value)
5977
5974
  }, [
5978
- o.active ? ($(), R("div", ei)) : Z("", !0),
5975
+ o.active ? ($(), R("div", ei)) : J("", !0),
5979
5976
  I("span", ti, G(e.node.name), 1),
5980
- o.active ? ($(), R("div", ni)) : Z("", !0)
5977
+ o.active ? ($(), R("div", ni)) : J("", !0)
5981
5978
  ], 6));
5982
5979
  }
5983
5980
  }), si = { class: "mce-track" }, ai = /* @__PURE__ */ H({
@@ -6258,7 +6255,7 @@ const Is = Yt({
6258
6255
  function me() {
6259
6256
  return !X && (Math.abs(D.x - j.x) >= 3 || Math.abs(D.y - j.y) >= 3);
6260
6257
  }
6261
- function J(U) {
6258
+ function Z(U) {
6262
6259
  D = { x: U.clientX, y: U.clientY }, Y ? me() && (X = !0, v("startTransform")) : L && !h(L) ? me() && (X = !0, _e(U), Fe(() => {
6263
6260
  Q || v("startTransform");
6264
6261
  })) : ke();
@@ -6274,9 +6271,9 @@ const Is = Yt({
6274
6271
  }
6275
6272
  x(C);
6276
6273
  }
6277
- i.value.off("pointermove", J), document.removeEventListener("pointerup", ce), Q = !0;
6274
+ i.value.off("pointermove", Z), document.removeEventListener("pointerup", ce), Q = !0;
6278
6275
  }
6279
- i.value.on("pointermove", J), document.addEventListener("pointerup", ce);
6276
+ i.value.on("pointermove", Z), document.addEventListener("pointerup", ce);
6280
6277
  }
6281
6278
  function S(C) {
6282
6279
  C.srcElement === r.value && (F.value = { x: C.clientX, y: C.clientY }, !(c.value.grabbing || C.button === 1 || d.value && d.value !== "typing") && x(C));
@@ -6320,7 +6317,7 @@ const Is = Yt({
6320
6317
  ]),
6321
6318
  _: 3
6322
6319
  }, 8, ["selected-area", "resize-strategy"]),
6323
- M(a).scrollbar ? ($(), te(ha, { key: 0 })) : Z("", !0),
6320
+ M(a).scrollbar ? ($(), te(ha, { key: 0 })) : J("", !0),
6324
6321
  C.$slots.floatbar ? ($(), te(Zs, {
6325
6322
  key: 1,
6326
6323
  target: M(d) === "typing" ? b.value?.textEditor : p.value?.transformable?.$el
@@ -6329,20 +6326,20 @@ const Is = Yt({
6329
6326
  ne(C.$slots, "floatbar")
6330
6327
  ]),
6331
6328
  _: 3
6332
- }, 8, ["target"])) : Z("", !0),
6329
+ }, 8, ["target"])) : J("", !0),
6333
6330
  W(Ws),
6334
6331
  M(a).bottombar ? ($(), te(Ls, { key: 2 }, {
6335
6332
  default: ue(() => [
6336
6333
  ne(C.$slots, "bottombar")
6337
6334
  ]),
6338
6335
  _: 3
6339
- })) : Z("", !0),
6336
+ })) : J("", !0),
6340
6337
  W(ta),
6341
6338
  ne(C.$slots, "default")
6342
6339
  ], 40, vi),
6343
- M(a).ruler ? ($(), te(ca, { key: 0 })) : Z("", !0),
6344
- M(a).timeline ? ($(), te(pi, { key: 1 })) : Z("", !0),
6345
- M(a).statusbar ? ($(), te(Ka, { key: 2 })) : Z("", !0),
6340
+ M(a).ruler ? ($(), te(ca, { key: 0 })) : J("", !0),
6341
+ M(a).timeline ? ($(), te(pi, { key: 1 })) : J("", !0),
6342
+ M(a).statusbar ? ($(), te(Ka, { key: 2 })) : J("", !0),
6346
6343
  I("div", yi, null, 512)
6347
6344
  ], 2));
6348
6345
  }
@@ -12,9 +12,9 @@ declare global {
12
12
  interface Editor {
13
13
  frameThumbs: Ref<FrameThumb[]>;
14
14
  frames: ComputedRef<Element2D[]>;
15
- activeFrameIndex: Ref<number>;
16
- activeFrame: ComputedRef<Element2D | undefined>;
17
- activeFrameAabb: ComputedRef<AxisAlignedBoundingBox>;
15
+ currentFrameIndex: Ref<number>;
16
+ currentFrame: ComputedRef<Element2D | undefined>;
17
+ currentFrameAabb: ComputedRef<AxisAlignedBoundingBox>;
18
18
  isFrame: (node: Node) => node is Element2D;
19
19
  getAncestorFrame: (element?: Element2D) => Element2D | undefined;
20
20
  }
@@ -6,14 +6,14 @@ declare global {
6
6
  duplicateFrame: (index?: number) => void;
7
7
  moveFrame: (fromIndex: number, toIndex: number) => void;
8
8
  deleteFrame: (index?: number) => void;
9
- setActiveFrame: (index?: number) => void;
9
+ setCurrentFrame: (index?: number) => void;
10
10
  }
11
11
  interface Events {
12
12
  addFrame: [index: number];
13
13
  duplicateFrame: [index: number];
14
14
  moveFrame: [fromIndex: number, toIndex: number];
15
15
  deleteFrame: [index: number];
16
- setActiveFrame: [index: number, oldIndex: number];
16
+ setCurrentFrame: [index: number, oldIndex: number];
17
17
  }
18
18
  }
19
19
  }
@@ -2,7 +2,9 @@ declare global {
2
2
  namespace Mce {
3
3
  interface Editor {}
4
4
  interface Options {}
5
- interface Events {}
5
+ interface Events {
6
+ ready: []
7
+ }
6
8
  interface Hotkeys {}
7
9
  interface Commands {}
8
10
  interface Exporters {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",