mce 0.13.0 → 0.13.1

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/README.md CHANGED
@@ -46,14 +46,15 @@ npm i mce
46
46
  ],
47
47
  theme: 'system',
48
48
  viewMode: 'edgeless',
49
- clipboard: true,
49
+ watermark: '/example.jpg',
50
50
  checkerboard: true,
51
+ checkerboardStyle: 'grid',
51
52
  pixelGrid: true,
53
+ pixelate: true,
52
54
  camera: true,
53
55
  ruler: true,
54
56
  scrollbar: true,
55
57
  statusbar: true,
56
- wheelZoom: false,
57
58
  frameGap: 48,
58
59
  typographyStrategy: 'autoHeight',
59
60
  handleShape: 'rect',
@@ -12,6 +12,13 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
12
12
  type: import("vue").PropType<number>;
13
13
  default: number;
14
14
  };
15
+ middlewares: Omit<{
16
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
17
+ default: () => string[];
18
+ }, "type" | "default"> & {
19
+ type: import("vue").PropType<any[] | ("shift" | "offset" | "flip")[]>;
20
+ default: any[] | ("shift" | "offset" | "flip")[];
21
+ };
15
22
  target: import("vue").PropType<{
16
23
  x: number;
17
24
  y: number;
@@ -31,6 +38,13 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
31
38
  type: import("vue").PropType<number>;
32
39
  default: number;
33
40
  };
41
+ middlewares: Omit<{
42
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
43
+ default: () => string[];
44
+ }, "type" | "default"> & {
45
+ type: import("vue").PropType<any[] | ("shift" | "offset" | "flip")[]>;
46
+ default: any[] | ("shift" | "offset" | "flip")[];
47
+ };
34
48
  target: import("vue").PropType<{
35
49
  x: number;
36
50
  y: number;
@@ -43,6 +57,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
43
57
  offset: number;
44
58
  location: import("@floating-ui/vue").Side | "left-end" | "left-start" | "right-end" | "right-start" | "top-end" | "top-start" | "bottom-end" | "bottom-start";
45
59
  attach: string | boolean | Element | null | undefined;
60
+ middlewares: any[] | ("shift" | "offset" | "flip")[];
46
61
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
47
62
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
48
63
  declare const _default: typeof __VLS_export;
@@ -13,6 +13,10 @@ type __VLS_Slots = {} & {
13
13
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
14
14
  location: import("vue").PropType<import("@floating-ui/vue").Side | import("@floating-ui/vue").AlignedPlacement>;
15
15
  offset: NumberConstructor;
16
+ middlewares: {
17
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
18
+ default: () => string[];
19
+ };
16
20
  target: import("vue").PropType<{
17
21
  x: number;
18
22
  y: number;
@@ -32,6 +36,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
32
36
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
33
37
  location: import("vue").PropType<import("@floating-ui/vue").Side | import("@floating-ui/vue").AlignedPlacement>;
34
38
  offset: NumberConstructor;
39
+ middlewares: {
40
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
41
+ default: () => string[];
42
+ };
35
43
  target: import("vue").PropType<{
36
44
  x: number;
37
45
  y: number;
@@ -47,6 +55,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
47
55
  "onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
48
56
  }>, {
49
57
  attach: string | boolean | Element | null | undefined;
58
+ middlewares: ("shift" | "offset" | "flip")[];
50
59
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
51
60
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
52
61
  declare const _default: typeof __VLS_export;
@@ -20,6 +20,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
20
20
  persistent: BooleanConstructor;
21
21
  location: PropType<import("@floating-ui/vue").Side | import("@floating-ui/vue").AlignedPlacement>;
22
22
  offset: NumberConstructor;
23
+ middlewares: {
24
+ type: PropType<("offset" | "flip" | "shift")[]>;
25
+ default: () => string[];
26
+ };
23
27
  target: PropType<{
24
28
  x: number;
25
29
  y: number;
@@ -43,6 +47,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
43
47
  persistent: BooleanConstructor;
44
48
  location: PropType<import("@floating-ui/vue").Side | import("@floating-ui/vue").AlignedPlacement>;
45
49
  offset: NumberConstructor;
50
+ middlewares: {
51
+ type: PropType<("offset" | "flip" | "shift")[]>;
52
+ default: () => string[];
53
+ };
46
54
  target: PropType<{
47
55
  x: number;
48
56
  y: number;
@@ -59,6 +67,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
59
67
  "onClick:item"?: ((item: MenuItem, event: MouseEvent) => any) | undefined;
60
68
  }>, {
61
69
  attach: string | boolean | Element | null | undefined;
70
+ middlewares: ("shift" | "offset" | "flip")[];
62
71
  openOnHover: boolean;
63
72
  persistent: boolean;
64
73
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -12,6 +12,10 @@ type __VLS_Slots = {} & {
12
12
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
13
13
  location: import("vue").PropType<import("@floating-ui/vue").Side | import("@floating-ui/vue").AlignedPlacement>;
14
14
  offset: NumberConstructor;
15
+ middlewares: {
16
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
17
+ default: () => string[];
18
+ };
15
19
  target: import("vue").PropType<{
16
20
  x: number;
17
21
  y: number;
@@ -35,6 +39,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
35
39
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
36
40
  location: import("vue").PropType<import("@floating-ui/vue").Side | import("@floating-ui/vue").AlignedPlacement>;
37
41
  offset: NumberConstructor;
42
+ middlewares: {
43
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
44
+ default: () => string[];
45
+ };
38
46
  target: import("vue").PropType<{
39
47
  x: number;
40
48
  y: number;
@@ -52,6 +60,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
52
60
  "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
53
61
  }>, {
54
62
  attach: string | boolean | Element | null | undefined;
63
+ middlewares: ("shift" | "offset" | "flip")[];
55
64
  modelValue: boolean;
56
65
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
57
66
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -19,6 +19,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
19
19
  type: import("vue").PropType<number>;
20
20
  default: number;
21
21
  };
22
+ middlewares: {
23
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
24
+ default: () => string[];
25
+ };
22
26
  target: import("vue").PropType<{
23
27
  x: number;
24
28
  y: number;
@@ -43,6 +47,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
43
47
  type: import("vue").PropType<number>;
44
48
  default: number;
45
49
  };
50
+ middlewares: {
51
+ type: import("vue").PropType<("offset" | "flip" | "shift")[]>;
52
+ default: () => string[];
53
+ };
46
54
  target: import("vue").PropType<{
47
55
  x: number;
48
56
  y: number;
@@ -60,6 +68,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
60
68
  offset: number;
61
69
  location: import("@floating-ui/vue").Side | "left-end" | "left-start" | "right-end" | "right-start" | "top-end" | "top-start" | "bottom-end" | "bottom-start";
62
70
  attach: string | boolean | Element | null | undefined;
71
+ middlewares: ("shift" | "offset" | "flip")[];
63
72
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
64
73
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
65
74
  declare const _default: typeof __VLS_export;
@@ -15,6 +15,7 @@ export declare const MceOverlaySymbol: InjectionKey<MceOverlayProvide>;
15
15
  export declare const makeMceOverlayProps: <Defaults extends {
16
16
  location?: unknown;
17
17
  offset?: unknown;
18
+ middlewares?: unknown;
18
19
  target?: unknown;
19
20
  attach?: unknown;
20
21
  } = {}>(defaults?: Defaults | undefined) => {
@@ -26,6 +27,16 @@ export declare const makeMceOverlayProps: <Defaults extends {
26
27
  type: PropType<unknown extends Defaults["offset"] ? number : number | Defaults["offset"]>;
27
28
  default: unknown extends Defaults["offset"] ? number : number | Defaults["offset"];
28
29
  };
30
+ middlewares: unknown extends Defaults["middlewares"] ? {
31
+ type: PropType<("offset" | "flip" | "shift")[]>;
32
+ default: () => string[];
33
+ } : Omit<{
34
+ type: PropType<("offset" | "flip" | "shift")[]>;
35
+ default: () => string[];
36
+ }, "type" | "default"> & {
37
+ type: PropType<unknown extends Defaults["middlewares"] ? ("shift" | "offset" | "flip")[] : ("shift" | "offset" | "flip")[] | Defaults["middlewares"]>;
38
+ default: unknown extends Defaults["middlewares"] ? ("shift" | "offset" | "flip")[] : ("shift" | "offset" | "flip")[] | Defaults["middlewares"];
39
+ };
29
40
  target: unknown extends Defaults["target"] ? PropType<{
30
41
  x: number;
31
42
  y: number;
package/dist/index.js CHANGED
@@ -111,23 +111,26 @@ const _0_config_base = defineMixin((editor, options) => {
111
111
  } = editor;
112
112
  registerConfig("theme", "system");
113
113
  registerConfig("viewMode", "edgeless");
114
+ registerConfig("watermark", void 0);
114
115
  registerConfig("checkerboard", false);
116
+ registerConfig("checkerboardStyle", "grid");
115
117
  registerConfig("pixelGrid", false);
118
+ registerConfig("pixelate", true);
116
119
  registerConfig("camera", false);
117
120
  registerConfig("ruler", false);
118
121
  registerConfig("scrollbar", false);
119
122
  registerConfig("layers", false);
120
123
  registerConfig("timeline", false);
121
124
  registerConfig("statusbar", false);
122
- registerConfig("wheelZoom", false);
123
125
  registerConfig("frameOutline", false);
124
126
  registerConfig("frameGap", 48);
125
127
  registerConfig("typographyStrategy", "autoHeight");
126
128
  registerConfig("handleShape", "rect");
127
- registerConfig("localDb", false);
128
129
  registerConfig("screenCenterOffset", { left: 0, top: 0, bottom: 0, right: 0 });
130
+ registerConfig("localDb", false);
129
131
  return () => {
130
132
  const {
133
+ renderEngine,
131
134
  camera,
132
135
  drawboardEffect
133
136
  } = editor;
@@ -136,6 +139,11 @@ const _0_config_base = defineMixin((editor, options) => {
136
139
  config.value[key] = options[key];
137
140
  }
138
141
  });
142
+ watch(
143
+ () => config.value.pixelate,
144
+ (value) => renderEngine.value.pixelate = value,
145
+ { immediate: true }
146
+ );
139
147
  watch(
140
148
  () => config.value.camera,
141
149
  (enable) => {
@@ -143,14 +151,24 @@ const _0_config_base = defineMixin((editor, options) => {
143
151
  },
144
152
  { immediate: true }
145
153
  );
154
+ watch(
155
+ () => config.value.watermark,
156
+ (value) => drawboardEffect.value.watermark = value,
157
+ { immediate: true }
158
+ );
146
159
  watch(
147
160
  () => config.value.checkerboard,
148
- (enable) => drawboardEffect.value.checkerboard = enable,
161
+ (value) => drawboardEffect.value.checkerboard = value,
162
+ { immediate: true }
163
+ );
164
+ watch(
165
+ () => config.value.checkerboardStyle,
166
+ (value) => drawboardEffect.value.checkerboardStyle = value,
149
167
  { immediate: true }
150
168
  );
151
169
  watch(
152
170
  () => config.value.pixelGrid,
153
- (enable) => drawboardEffect.value.pixelGrid = enable,
171
+ (value) => drawboardEffect.value.pixelGrid = value,
154
172
  { immediate: true }
155
173
  );
156
174
  };
@@ -1118,10 +1136,14 @@ const en = {
1118
1136
  "view:pixelGrid": "Pixel grid",
1119
1137
  "view:ruler": "Ruler",
1120
1138
  "view:scrollbar": "Scrollbar",
1121
- "view:layers": "Layers",
1122
1139
  "view:timeline": "Timeline",
1123
1140
  "view:statusbar": "Statusbar",
1124
1141
  "view:frameOutline": "Frame outlines",
1142
+ "checkerboardStyle:grid": "Grid checkerboard",
1143
+ "checkerboardStyle:dot": "Dot checkerboard",
1144
+ "panels": "Panels",
1145
+ "panels:layers": "Open layers panel",
1146
+ "pixelate": "Pixelate",
1125
1147
  "layers": "Layers",
1126
1148
  "zoomIn": "Zoom in",
1127
1149
  "zoomOut": "Zoom out",
@@ -1198,10 +1220,14 @@ const zhHans = {
1198
1220
  "view:pixelGrid": "像素网格",
1199
1221
  "view:ruler": "标尺",
1200
1222
  "view:scrollbar": "滚动条",
1201
- "view:layers": "图层",
1202
1223
  "view:timeline": "时间线",
1203
1224
  "view:statusbar": "状态栏",
1204
1225
  "view:frameOutline": "框架轮廓",
1226
+ "checkerboardStyle:grid": "网格棋盘",
1227
+ "checkerboardStyle:dot": "点状棋盘",
1228
+ "panels": "面板",
1229
+ "panels:layers": "打开图层面板",
1230
+ "pixelate": "像素化",
1205
1231
  "layers": "图层",
1206
1232
  "zoomIn": "放大",
1207
1233
  "zoomOut": "缩小",
@@ -4865,7 +4891,8 @@ const _image = definePlugin((editor) => {
4865
4891
  addElement,
4866
4892
  to,
4867
4893
  fonts,
4868
- upload
4894
+ upload,
4895
+ drawboardEffect
4869
4896
  } = editor;
4870
4897
  const insertImage = async (url, options) => {
4871
4898
  return addElement(await createImageElement(url), {
@@ -4892,7 +4919,17 @@ const _image = definePlugin((editor) => {
4892
4919
  data: doc,
4893
4920
  fonts,
4894
4921
  width: doc.style.width,
4895
- height: doc.style.height
4922
+ height: doc.style.height,
4923
+ onBefore: (engine) => {
4924
+ engine.root.append(
4925
+ new DrawboardEffect({
4926
+ internalMode: "back",
4927
+ effectMode: "before",
4928
+ ...drawboardEffect.value.getProperties()
4929
+ })
4930
+ );
4931
+ console.log(drawboardEffect.value.getProperties());
4932
+ }
4896
4933
  });
4897
4934
  return await new Promise((resolve) => {
4898
4935
  canvas.toBlob(
@@ -5140,13 +5177,14 @@ const _layerOrder = definePlugin((editor) => {
5140
5177
  });
5141
5178
  const _layerPosition = definePlugin((editor) => {
5142
5179
  const {
5143
- currentFrameAabb,
5180
+ isElement,
5181
+ rootAabb,
5144
5182
  elementSelection,
5145
5183
  getAabb
5146
5184
  } = editor;
5147
5185
  function align(direction) {
5148
- const box = elementSelection.value.length === 1 ? currentFrameAabb.value : getAabb(elementSelection.value);
5149
5186
  elementSelection.value.forEach((el) => {
5187
+ const box = el.parent && isElement(el.parent) ? getAabb(el.parent) : rootAabb.value;
5150
5188
  switch (direction) {
5151
5189
  case "left":
5152
5190
  el.style.left = 0;
@@ -5282,20 +5320,55 @@ const _menu = definePlugin((editor, options) => {
5282
5320
  { key: "zoomToSelection", disabled: !hasSelected.value }
5283
5321
  ]
5284
5322
  }));
5323
+ const panelsMenu = computed(() => ({
5324
+ key: "panels",
5325
+ children: [
5326
+ { key: "panels:layers", checked: config.value.layers }
5327
+ ]
5328
+ }));
5329
+ function setCheckerboard(value) {
5330
+ if (config.value.checkerboard && config.value.checkerboardStyle === value) {
5331
+ config.value.checkerboard = false;
5332
+ } else {
5333
+ config.value.checkerboard = true;
5334
+ config.value.checkerboardStyle = value;
5335
+ }
5336
+ }
5337
+ const checkerboardMenu = computed(() => ({
5338
+ key: "view:checkerboard",
5339
+ children: [
5340
+ {
5341
+ key: "checkerboardStyle:grid",
5342
+ checked: config.value.checkerboard && config.value.checkerboardStyle === "grid",
5343
+ handle: () => setCheckerboard("grid")
5344
+ },
5345
+ {
5346
+ key: "checkerboardStyle:dot",
5347
+ checked: config.value.checkerboard && config.value.checkerboardStyle === "dot",
5348
+ handle: () => setCheckerboard("dot")
5349
+ }
5350
+ ]
5351
+ }));
5285
5352
  const viewMenu = computed(() => ({
5286
5353
  key: "view",
5287
5354
  children: [
5288
- { key: "view:checkerboard", checked: config.value.checkerboard },
5355
+ checkerboardMenu.value,
5289
5356
  { key: "view:pixelGrid", checked: config.value.pixelGrid },
5290
5357
  { key: "view:ruler", checked: config.value.ruler },
5291
5358
  { key: "view:scrollbar", checked: config.value.scrollbar },
5292
- { key: "view:layers", checked: config.value.layers },
5293
5359
  { key: "view:timeline", checked: config.value.timeline },
5294
5360
  { key: "view:statusbar", checked: config.value.statusbar },
5295
5361
  { key: "view:frameOutline", checked: config.value.frameOutline },
5296
5362
  { type: "divider" },
5363
+ {
5364
+ key: "pixelate",
5365
+ checked: config.value.pixelate,
5366
+ handle: () => config.value.pixelate = !config.value.pixelate
5367
+ },
5368
+ panelsMenu.value,
5369
+ { type: "divider" },
5297
5370
  ...zoomViewMenu.value.children
5298
- ]
5371
+ ].filter(Boolean)
5299
5372
  }));
5300
5373
  const objectMenu1 = computed(() => [
5301
5374
  { key: "groupSelection", disabled: !hasSelected.value },
@@ -5479,6 +5552,20 @@ const _open = definePlugin((editor) => {
5479
5552
  ]
5480
5553
  };
5481
5554
  });
5555
+ const _panels = definePlugin((editor) => {
5556
+ const {
5557
+ config
5558
+ } = editor;
5559
+ return {
5560
+ name: "mce:panels",
5561
+ commands: [
5562
+ { command: "panels", handle: (panel) => config.value[panel] = !config.value[panel] }
5563
+ ],
5564
+ hotkeys: [
5565
+ { command: "panels:layers", key: "Alt+¡" }
5566
+ ]
5567
+ };
5568
+ });
5482
5569
  const _saveAs = definePlugin((editor) => {
5483
5570
  const {
5484
5571
  to,
@@ -5790,6 +5877,7 @@ const plugins = [
5790
5877
  _move,
5791
5878
  _new,
5792
5879
  _open,
5880
+ _panels,
5793
5881
  _saveAs,
5794
5882
  _scroll,
5795
5883
  _select,
@@ -6071,6 +6159,10 @@ const MceOverlaySymbol = Symbol.for("MceOverlaySymbol");
6071
6159
  const makeMceOverlayProps = propsFactory({
6072
6160
  location: String,
6073
6161
  offset: Number,
6162
+ middlewares: {
6163
+ type: Object,
6164
+ default: () => ["offset", "flip", "shift"]
6165
+ },
6074
6166
  target: Object,
6075
6167
  attach: {
6076
6168
  type: [String, Boolean, Object],
@@ -6587,14 +6679,15 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
6587
6679
  });
6588
6680
  const contentEl = useTemplateRef("contentElTpl");
6589
6681
  const attach = computed(() => props.attach ?? overlayItem.attach?.value ?? "body");
6682
+ const middlewares = new Set(props.middlewares);
6590
6683
  const { floatingStyles, update } = useFloating(target, contentEl, {
6591
6684
  placement: computed(() => props.location),
6592
6685
  whileElementsMounted: autoUpdate,
6593
6686
  middleware: [
6594
- offset(() => props.offset ?? 0),
6595
- flip(),
6596
- shift({ padding: 20 })
6597
- ]
6687
+ middlewares.has("offset") && offset(() => props.offset ?? 0),
6688
+ middlewares.has("flip") && flip(),
6689
+ middlewares.has("shift") && shift({ padding: 20 })
6690
+ ].filter(Boolean)
6598
6691
  });
6599
6692
  const style = computed(() => {
6600
6693
  return {
@@ -6686,7 +6779,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6686
6779
  const isActive = useModel(__props, "modelValue");
6687
6780
  const opened = ref(-1);
6688
6781
  const overlay = useTemplateRef("overlayTpl");
6689
- const menuItemRefs = useTemplateRef("menuItemTplRefs");
6782
+ const menuItemRefs = ref([]);
6690
6783
  const hasPrepend = computed(() => Boolean(props.items?.some((v) => "checked" in v)));
6691
6784
  const uid = useId();
6692
6785
  const parent = inject(MceMenuSymbol, null);
@@ -6723,10 +6816,16 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6723
6816
  } else {
6724
6817
  isActive.value = false;
6725
6818
  parent?.closeParents(e);
6726
- item.handle?.(e);
6727
- emit("click:item", item, e);
6819
+ if (item.handle) {
6820
+ item.handle?.(e);
6821
+ } else {
6822
+ emit("click:item", item, e);
6823
+ }
6728
6824
  }
6729
6825
  }
6826
+ function onMouseenter(item, index) {
6827
+ opened.value = item.disabled ? -1 : index;
6828
+ }
6730
6829
  function onMouseleave() {
6731
6830
  if (props.items?.[opened.value]?.children?.length === void 0) {
6732
6831
  opened.value = -1;
@@ -6765,14 +6864,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
6765
6864
  item.type === "divider" ? (openBlock(), createElementBlock("div", {
6766
6865
  key: 0,
6767
6866
  ref_for: true,
6768
- ref: "menuItemTplRefs",
6867
+ ref: (el) => menuItemRefs.value[index] = el ?? void 0,
6769
6868
  class: "mce-list__divider"
6770
6869
  }, null, 512)) : (openBlock(), createElementBlock("div", {
6771
6870
  key: 1,
6772
6871
  ref_for: true,
6773
- ref: "menuItemTplRefs",
6872
+ ref: (el) => menuItemRefs.value[index] = el ?? void 0,
6774
6873
  class: "mce-list__item",
6775
- onMouseenter: ($event) => item.disabled ? opened.value = -1 : opened.value = index
6874
+ onMouseenter: ($event) => onMouseenter(item, index)
6776
6875
  }, [
6777
6876
  createElementVNode("div", {
6778
6877
  class: normalizeClass(["mce-list-item", [
@@ -6956,6 +7055,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
6956
7055
  props: {
6957
7056
  ...makeMceOverlayProps({
6958
7057
  location: "top-start",
7058
+ middlewares: ["offset", "shift"],
6959
7059
  offset: 8
6960
7060
  })
6961
7061
  },
@@ -6981,6 +7081,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
6981
7081
  ref: "overlayTpl",
6982
7082
  class: "mce-floatbar",
6983
7083
  location: props.location,
7084
+ middlewares: props.middlewares,
6984
7085
  offset: unref(selection)[0] && unref(isFrame)(unref(selection)[0]) ? 32 : 8,
6985
7086
  target: props.target,
6986
7087
  attach: false,
@@ -6990,7 +7091,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
6990
7091
  unref(selection).length > 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
6991
7092
  ]),
6992
7093
  _: 3
6993
- }, 8, ["location", "offset", "target"]);
7094
+ }, 8, ["location", "middlewares", "offset", "target"]);
6994
7095
  };
6995
7096
  }
6996
7097
  });
@@ -44,10 +44,14 @@ declare const _default: {
44
44
  'view:pixelGrid': string;
45
45
  'view:ruler': string;
46
46
  'view:scrollbar': string;
47
- 'view:layers': string;
48
47
  'view:timeline': string;
49
48
  'view:statusbar': string;
50
49
  'view:frameOutline': string;
50
+ 'checkerboardStyle:grid': string;
51
+ 'checkerboardStyle:dot': string;
52
+ panels: string;
53
+ 'panels:layers': string;
54
+ pixelate: string;
51
55
  layers: string;
52
56
  zoomIn: string;
53
57
  zoomOut: string;
@@ -45,10 +45,14 @@ declare const _default: {
45
45
  'view:pixelGrid': string;
46
46
  'view:ruler': string;
47
47
  'view:scrollbar': string;
48
- 'view:layers': string;
49
48
  'view:timeline': string;
50
49
  'view:statusbar': string;
51
50
  'view:frameOutline': string;
51
+ 'checkerboardStyle:grid': string;
52
+ 'checkerboardStyle:dot': string;
53
+ panels: string;
54
+ 'panels:layers': string;
55
+ pixelate: string;
52
56
  layers: string;
53
57
  zoomIn: string;
54
58
  zoomOut: string;
@@ -1,3 +1,4 @@
1
+ import type { CheckerboardStyle } from 'modern-canvas';
1
2
  declare global {
2
3
  namespace Mce {
3
4
  interface Options extends Partial<Config> {
@@ -15,15 +16,17 @@ declare global {
15
16
  interface Config {
16
17
  theme: Theme;
17
18
  viewMode: ViewMode;
19
+ watermark?: string;
18
20
  checkerboard: boolean;
21
+ checkerboardStyle: CheckerboardStyle;
19
22
  pixelGrid: boolean;
23
+ pixelate: boolean;
20
24
  camera: boolean;
21
25
  ruler: boolean;
22
26
  scrollbar: boolean;
23
27
  layers: boolean;
24
28
  timeline: boolean;
25
29
  statusbar: boolean;
26
- wheelZoom: boolean;
27
30
  frameOutline: boolean;
28
31
  frameGap: number;
29
32
  typographyStrategy: TypographyStrategy;
@@ -5,7 +5,8 @@ declare global {
5
5
  key: string;
6
6
  disabled?: boolean;
7
7
  checked?: boolean;
8
- children: MenuItem[];
8
+ children?: MenuItem[];
9
+ handle?: (event: MouseEvent) => void;
9
10
  }
10
11
  interface Editor {
11
12
  mainMenu: ComputedRef<MenuItem[]>;
@@ -0,0 +1,12 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface Panels {
4
+ layers: [];
5
+ }
6
+ interface Commands {
7
+ panel: <T extends keyof Panels>(panel: T, ...args: Panels[T]) => Promise<boolean>;
8
+ }
9
+ }
10
+ }
11
+ declare const _default: import("..").Plugin;
12
+ export default _default;
@@ -45,6 +45,7 @@ import './plugins/menu'
45
45
  import './plugins/move'
46
46
  import './plugins/new'
47
47
  import './plugins/open'
48
+ import './plugins/panels'
48
49
  import './plugins/saveAs'
49
50
  import './plugins/scroll'
50
51
  import './plugins/select'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.13.0",
4
+ "version": "0.13.1",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "diff": "^8.0.2",
62
62
  "file-saver": "^2.0.5",
63
63
  "lodash-es": "^4.17.21",
64
- "modern-canvas": "^0.13.0",
64
+ "modern-canvas": "^0.13.1",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.5",
67
67
  "modern-text": "^1.10.3",