mce 0.11.3 → 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.
@@ -47,7 +47,6 @@ declare const _default: {
47
47
  'view:timeline': string;
48
48
  'view:statusbar': string;
49
49
  'view:frameOutline': string;
50
- zoom: string;
51
50
  zoomIn: string;
52
51
  zoomOut: string;
53
52
  zoomTo100: string;
@@ -6,6 +6,12 @@ declare global {
6
6
  type ViewMode = 'frame' | 'edgeless';
7
7
  type TypographyStrategy = 'autoHeight' | 'autoWidth' | 'fixedWidthHeight' | 'autoFontSize';
8
8
  type HandleShape = 'rect' | 'circle';
9
+ interface ScreenCenterOffset {
10
+ left?: number;
11
+ top?: number;
12
+ right?: number;
13
+ bottom?: number;
14
+ }
9
15
  interface Config {
10
16
  theme: Theme;
11
17
  viewMode: ViewMode;
@@ -22,6 +28,10 @@ declare global {
22
28
  typographyStrategy: TypographyStrategy;
23
29
  handleShape: HandleShape;
24
30
  localDb: boolean;
31
+ screenCenterOffset: ScreenCenterOffset;
32
+ }
33
+ interface Editor {
34
+ getScreenCenterOffset: () => Required<ScreenCenterOffset>;
25
35
  }
26
36
  }
27
37
  }
@@ -12,7 +12,7 @@ declare global {
12
12
  getAabbInDrawboard: (node?: Node | Node[]) => AxisAlignedBoundingBox;
13
13
  aabbToDrawboardAabb: (aabb: AxisAlignedBoundingBox) => AxisAlignedBoundingBox;
14
14
  rootAabb: ComputedRef<AxisAlignedBoundingBox>;
15
- currentAabb: ComputedRef<AxisAlignedBoundingBox>;
15
+ selectionAabb: ComputedRef<AxisAlignedBoundingBox>;
16
16
  }
17
17
  }
18
18
  }
@@ -0,0 +1,18 @@
1
+ import type { Element2D } from 'modern-canvas';
2
+ declare global {
3
+ namespace Mce {
4
+ type ScrollTarget = 'root' | 'selection' | {
5
+ x: number;
6
+ y: number;
7
+ } | Element2D[];
8
+ interface ScrollToOptions {
9
+ duration?: number;
10
+ behavior?: 'smooth' | 'instant';
11
+ }
12
+ interface Editor {
13
+ scrollTo: (target: ScrollTarget, options?: ScrollToOptions) => Promise<void>;
14
+ }
15
+ }
16
+ }
17
+ declare const _default: import("..").Mixin;
18
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import type { Element2D } from 'modern-canvas';
2
+ declare global {
3
+ namespace Mce {
4
+ type ZoomTarget = 'root' | 'selection' | Element2D[] | number;
5
+ interface ZoomToOptions {
6
+ mode?: 'contain' | 'cover';
7
+ duration?: number;
8
+ behavior?: 'smooth' | 'instant';
9
+ }
10
+ interface Editor {
11
+ zoomTo: (target: ZoomTarget, options?: ZoomToOptions) => Promise<void>;
12
+ }
13
+ }
14
+ }
15
+ declare const _default: import("..").Mixin;
16
+ export default _default;
@@ -22,5 +22,5 @@ declare global {
22
22
  }
23
23
  }
24
24
  }
25
- declare const _default: import("../..").Mixin;
25
+ declare const _default: import("..").Plugin;
26
26
  export default _default;
@@ -0,0 +1,11 @@
1
+ declare global {
2
+ namespace Mce {
3
+ interface Commands {
4
+ scrollToSelection: (options?: ScrollToOptions) => void;
5
+ }
6
+ interface Editor {
7
+ }
8
+ }
9
+ }
10
+ declare const _default: import("..").Plugin;
11
+ export default _default;
@@ -4,6 +4,7 @@ declare global {
4
4
  interface Commands {
5
5
  startTyping: (e?: PointerEvent) => Promise<boolean>;
6
6
  startTransform: (e?: PointerEvent) => boolean;
7
+ openContextMenu: (e?: PointerEvent) => boolean;
7
8
  }
8
9
  interface Events {
9
10
  setTransform: [value: {
@@ -6,7 +6,7 @@ declare global {
6
6
  zoomTo100: () => void;
7
7
  zoomToFit: () => void;
8
8
  zoomToCover: () => void;
9
- zoomToSelection: () => void;
9
+ zoomToSelection: (options?: ZoomToOptions) => void;
10
10
  }
11
11
  interface Hotkeys {
12
12
  zoomIn: [event: KeyboardEvent];
@@ -16,14 +16,6 @@ declare global {
16
16
  zoomToCover: [event: KeyboardEvent];
17
17
  zoomToSelection: [event: KeyboardEvent];
18
18
  }
19
- interface Config {
20
- zoomToFitOffset: {
21
- left?: number;
22
- top?: number;
23
- right?: number;
24
- bottom?: number;
25
- };
26
- }
27
19
  interface Editor {
28
20
  }
29
21
  }
@@ -15,16 +15,16 @@ import './mixins/1.timeline'
15
15
  import './mixins/1.upload'
16
16
  import './mixins/2.box'
17
17
  import './mixins/2.export'
18
- import './mixins/2.export/json'
19
18
  import './mixins/2.load'
20
- import './mixins/2.loader/json'
21
19
  import './mixins/3.view'
22
20
  import './mixins/4.0.text'
23
21
  import './mixins/4.1.lock'
24
22
  import './mixins/4.2.element'
25
23
  import './mixins/4.3.frame'
26
24
  import './mixins/4.4.doc'
25
+ import './mixins/scroll'
27
26
  import './mixins/snapshot'
27
+ import './mixins/zoom'
28
28
  import './plugins/auxiliary'
29
29
  import './plugins/clipboard'
30
30
  import './plugins/copyAs'
@@ -37,6 +37,7 @@ import './plugins/history'
37
37
  import './plugins/html'
38
38
  import './plugins/image'
39
39
  import './plugins/import'
40
+ import './plugins/json'
40
41
  import './plugins/layerOrder'
41
42
  import './plugins/layerPosition'
42
43
  import './plugins/lock'
@@ -45,6 +46,7 @@ import './plugins/move'
45
46
  import './plugins/new'
46
47
  import './plugins/open'
47
48
  import './plugins/saveAs'
49
+ import './plugins/scroll'
48
50
  import './plugins/select'
49
51
  import './plugins/text'
50
52
  import './plugins/ui'
@@ -11,7 +11,6 @@ export declare const imageMimeTypeExtMap: {
11
11
  'image/jpeg': string[];
12
12
  'image/png': string[];
13
13
  'image/gif': string[];
14
- 'image/svg+xml': string[];
15
14
  'image/tiff': string[];
16
15
  'image/bmp': string[];
17
16
  'image/x-ms-bmp': string[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.11.3",
4
+ "version": "0.12.0",
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.12.22",
64
+ "modern-canvas": "^0.13.0",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.5",
67
67
  "modern-text": "^1.10.3",
@@ -1,2 +0,0 @@
1
- declare const _default: import("../..").Mixin;
2
- export default _default;