mce 0.13.1 → 0.13.3

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.
@@ -29,8 +29,8 @@ declare const _default: {
29
29
  cut: string;
30
30
  copy: string;
31
31
  copyAs: string;
32
+ 'copyAs:png': string;
32
33
  'copyAs:svg': string;
33
- 'copyAs:json': string;
34
34
  paste: string;
35
35
  duplicate: string;
36
36
  delete: string;
@@ -30,8 +30,8 @@ declare const _default: {
30
30
  cut: string;
31
31
  copy: string;
32
32
  copyAs: string;
33
+ 'copyAs:png': string;
33
34
  'copyAs:svg': string;
34
- 'copyAs:json': string;
35
35
  paste: string;
36
36
  duplicate: string;
37
37
  delete: string;
@@ -1,7 +1,7 @@
1
1
  import type { Cursor, Node, Vector2Data } from 'modern-canvas';
2
2
  import type { ComputedRef, Ref } from 'vue';
3
3
  import type { AxisAlignedBoundingBox } from '../types';
4
- import { Camera2D, DrawboardEffect, Engine, Timeline } from 'modern-canvas';
4
+ import { Camera2D, DrawboardEffect, Element2D, Engine, Timeline } from 'modern-canvas';
5
5
  import { Fonts } from 'modern-font';
6
6
  import { Doc } from '../models';
7
7
  declare global {
@@ -20,6 +20,10 @@ declare global {
20
20
  root: ComputedRef<Node>;
21
21
  nodes: Ref<Node[]>;
22
22
  nodeIndexMap: Map<string, number>;
23
+ selection: Ref<Node[]>;
24
+ elementSelection: Ref<Element2D[]>;
25
+ textSelection: Ref<any[] | undefined>;
26
+ hoverElement: Ref<Element2D | undefined>;
23
27
  state: Ref<State | undefined>;
24
28
  setState: (state: State, context?: StateContext) => void;
25
29
  stateContext: Ref<StateContext | undefined>;
@@ -2,7 +2,7 @@ import { Element2D } from 'modern-canvas';
2
2
  declare global {
3
3
  namespace Mce {
4
4
  interface Editor {
5
- textFontSizeToFit: (element: Element2D) => void;
5
+ textFontSizeToFit: (element: Element2D, scale?: number) => void;
6
6
  textToFit: (element: Element2D, typography?: Mce.TypographyStrategy) => void;
7
7
  }
8
8
  }
@@ -26,7 +26,6 @@ declare global {
26
26
  updateElement: (id: string, properties: Record<string, any>) => void;
27
27
  getElement: (id: string) => Element2D | undefined;
28
28
  resizeElement: (element: Element2D, width: number, height: number, options?: ResizeElementOptions) => void;
29
- pointerActivateElement: (element: Element2D | undefined, event?: MouseEvent | PointerEvent) => void;
30
29
  selectArea: (areaInDrawboard: AxisAlignedBoundingBox) => Element2D[];
31
30
  }
32
31
  interface Events {
@@ -7,9 +7,10 @@ declare global {
7
7
  paste: [event: KeyboardEvent];
8
8
  duplicate: [event: KeyboardEvent];
9
9
  }
10
+ type CopySource = string | Blob | Record<string, any>[];
10
11
  type PasteSource = DataTransfer | ClipboardItem[];
11
12
  interface Commands {
12
- copy: (data?: any) => Promise<void>;
13
+ copy: (source?: CopySource) => Promise<void>;
13
14
  cut: () => Promise<void>;
14
15
  paste: (source?: PasteSource) => Promise<void>;
15
16
  duplicate: () => void;
@@ -1,3 +1,19 @@
1
+ import 'modern-canvas'
2
+
3
+ declare module 'modern-canvas' {
4
+ interface Meta {
5
+ inPptIs?: 'Pptx' | 'Picture' | 'Shape' | 'GroupShape' | 'Animation'
6
+ inEditorIs?: 'Doc' | 'Frame' | 'Element' | 'Node'
7
+ inCanvasIs?: 'Lottie2D' | 'Element2D' | 'Animation'
8
+ lock?: boolean
9
+ lockAspectRatio?: boolean
10
+ movable?: boolean
11
+ rotatable?: boolean
12
+ resizable?: boolean
13
+ transformable?: boolean
14
+ }
15
+ }
16
+
1
17
  declare global {
2
18
  namespace Mce {
3
19
  interface Editor {}
@@ -6,7 +6,6 @@ import './mixins/0.command'
6
6
  import './mixins/0.config'
7
7
  import './mixins/0.config/base'
8
8
  import './mixins/0.context'
9
- import './mixins/0.element'
10
9
  import './mixins/0.font'
11
10
  import './mixins/0.helper'
12
11
  import './mixins/0.locale'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.13.1",
4
+ "version": "0.13.3",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -1,15 +0,0 @@
1
- import type { Node } from 'modern-canvas';
2
- import type { Ref } from 'vue';
3
- import { Element2D } from 'modern-canvas';
4
- declare global {
5
- namespace Mce {
6
- interface Editor {
7
- selection: Ref<Node[]>;
8
- elementSelection: Ref<Element2D[]>;
9
- textSelection: Ref<any[] | undefined>;
10
- hoverElement: Ref<Element2D | undefined>;
11
- }
12
- }
13
- }
14
- declare const _default: import("..").Mixin;
15
- export default _default;