mce 0.15.19 → 0.15.21

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.
@@ -58,8 +58,8 @@ declare const _default: {
58
58
  selectAll: string;
59
59
  deselectAll: string;
60
60
  selectParent: string;
61
- previousSelection: string;
62
- nextSelection: string;
61
+ selectPreviousSibling: string;
62
+ selectNextSibling: string;
63
63
  view: string;
64
64
  'view:checkerboard': string;
65
65
  'view:pixelGrid': string;
@@ -83,6 +83,8 @@ declare const _default: {
83
83
  zoomTo100: string;
84
84
  zoomToFit: string;
85
85
  zoomToSelection: string;
86
+ zoomToNextFrame: string;
87
+ zoomToPreviousFrame: string;
86
88
  object: string;
87
89
  groupSelection: string;
88
90
  frameSelection: string;
@@ -59,8 +59,8 @@ declare const _default: {
59
59
  selectAll: string;
60
60
  deselectAll: string;
61
61
  selectParent: string;
62
- previousSelection: string;
63
- nextSelection: string;
62
+ selectPreviousSibling: string;
63
+ selectNextSibling: string;
64
64
  view: string;
65
65
  'view:checkerboard': string;
66
66
  'view:pixelGrid': string;
@@ -84,6 +84,8 @@ declare const _default: {
84
84
  zoomTo100: string;
85
85
  zoomToFit: string;
86
86
  zoomToSelection: string;
87
+ zoomToNextFrame: string;
88
+ zoomToPreviousFrame: string;
87
89
  object: string;
88
90
  groupSelection: string;
89
91
  frameSelection: string;
@@ -4,7 +4,6 @@ declare global {
4
4
  interface Options extends Partial<Config> {
5
5
  }
6
6
  type Theme = 'system' | 'light' | 'dark';
7
- type ViewMode = 'frame' | 'edgeless';
8
7
  type TypographyStrategy = 'autoHeight' | 'autoWidth' | 'fixedWidthHeight' | 'autoFontSize';
9
8
  type HandleShape = 'rect' | 'circle';
10
9
  interface ScreenCenterOffset {
@@ -15,7 +14,6 @@ declare global {
15
14
  }
16
15
  interface Config {
17
16
  theme: Theme;
18
- viewMode: ViewMode;
19
17
  watermark?: string;
20
18
  msaa: boolean;
21
19
  checkerboard: boolean;
@@ -47,7 +47,7 @@ declare global {
47
47
  isRoot: (value: any) => value is Node;
48
48
  isElement: (value: any) => value is Element2D;
49
49
  isFrame: (value: any) => value is Element2D;
50
- isTopLevelFrame: (value: any) => value is Element2D;
50
+ isTopFrame: (value: any) => value is Element2D;
51
51
  isVisible: (node: Node) => boolean;
52
52
  setVisible: (node: Node, visible: boolean) => void;
53
53
  isLock: (node: Node) => boolean;
@@ -1,6 +1,5 @@
1
1
  import type { Element2D, Node } from 'modern-canvas';
2
2
  import type { ComputedRef, Ref } from 'vue';
3
- import type { AxisAlignedBoundingBox } from '../types';
4
3
  declare global {
5
4
  namespace Mce {
6
5
  interface FrameThumb {
@@ -12,10 +11,7 @@ declare global {
12
11
  interface Editor {
13
12
  frameThumbs: Ref<FrameThumb[]>;
14
13
  frames: ComputedRef<Element2D[]>;
15
- currentFrameIndex: Ref<number>;
16
- currentFrame: ComputedRef<Element2D | undefined>;
17
- currentFrameAabb: ComputedRef<AxisAlignedBoundingBox>;
18
- getAncestorFrame: (node?: Node) => Element2D | undefined;
14
+ getAncestorFrame: (node?: Node, isTop?: boolean) => Element2D | undefined;
19
15
  }
20
16
  }
21
17
  }
@@ -8,6 +8,7 @@ declare global {
8
8
  getObb: (node: Node | Node[] | undefined, inTarget?: 'drawboard' | 'frame' | 'parent') => Obb2D;
9
9
  getAabb: (node: Node | Node[] | undefined, inTarget?: 'drawboard' | 'frame' | 'parent') => Aabb2D;
10
10
  aabbToDrawboardAabb: (aabb: Aabb2D) => Aabb2D;
11
+ viewportAabb: ComputedRef<Aabb2D>;
11
12
  rootAabb: ComputedRef<Aabb2D>;
12
13
  selectionAabb: ComputedRef<Aabb2D>;
13
14
  selectionAabbInDrawboard: ComputedRef<Aabb2D>;
@@ -1,9 +1,6 @@
1
- import type { ComputedRef } from 'vue';
2
- import type { AxisAlignedBoundingBox } from '../types';
3
1
  declare global {
4
2
  namespace Mce {
5
3
  interface Editor {
6
- viewAabb: ComputedRef<AxisAlignedBoundingBox>;
7
4
  bindRenderCanvas: (canvas: HTMLCanvasElement, setEventTarget?: HTMLElement) => () => void;
8
5
  }
9
6
  }
@@ -9,6 +9,7 @@ declare global {
9
9
  regenId?: boolean;
10
10
  }
11
11
  interface Editor {
12
+ findSibling: (target: 'previous' | 'next') => Node | undefined;
12
13
  addNode: (value: Element, options?: AddNodeOptions) => Node;
13
14
  }
14
15
  }
@@ -1,12 +1,14 @@
1
- import type { Element2D } from 'modern-canvas';
1
+ import type { Element2D, Vector2Like } from 'modern-canvas';
2
2
  declare global {
3
3
  namespace Mce {
4
- interface Editor {
5
- setCurrentFrame: (index?: number) => void;
6
- handleElementInsideFrame: (element: Element2D) => void;
4
+ interface HandleDragOutReparentOptions {
5
+ pointer: Vector2Like;
6
+ parent: Element2D;
7
+ index: number;
7
8
  }
8
- interface Events {
9
- setCurrentFrame: [index: number, oldIndex: number];
9
+ interface Editor {
10
+ findFrame: (target: 'next' | 'previous') => Element2D | undefined;
11
+ handleDragOutReparent: (element: Element2D, context?: HandleDragOutReparentOptions) => void;
10
12
  }
11
13
  }
12
14
  }
@@ -6,6 +6,7 @@ declare global {
6
6
  y: number;
7
7
  } | Element2D[];
8
8
  interface ScrollToOptions {
9
+ intoView?: boolean;
9
10
  duration?: number;
10
11
  behavior?: 'smooth' | 'instant';
11
12
  }
@@ -8,8 +8,7 @@ declare global {
8
8
  interface Editor {
9
9
  snapshot: () => void;
10
10
  captureElementScreenshot: (element: Element | Element2D) => Promise<HTMLCanvasElement>;
11
- captureFrameScreenshot: (pageIndex: number) => void;
12
- renderFrameThumb: (target: HTMLCanvasElement) => void;
11
+ captureFrameScreenshot: (index: number) => void;
13
12
  }
14
13
  }
15
14
  }
@@ -1,9 +1,11 @@
1
1
  import type { Element2D } from 'modern-canvas';
2
2
  declare global {
3
3
  namespace Mce {
4
- type ZoomTarget = 'root' | 'selection' | Element2D[] | number;
4
+ type ZoomTarget = 'root' | 'selection' | Element2D | Element2D[] | number;
5
+ type ZoomToMode = 'contain' | 'cover';
5
6
  interface ZoomToOptions {
6
- mode?: 'contain' | 'cover';
7
+ intoView?: boolean;
8
+ mode?: ZoomToMode;
7
9
  duration?: number;
8
10
  behavior?: 'smooth' | 'instant';
9
11
  }
@@ -4,15 +4,15 @@ declare global {
4
4
  selectAll: [event: KeyboardEvent];
5
5
  deselectAll: [event: KeyboardEvent];
6
6
  selectParent: [event: KeyboardEvent];
7
- previousSelection: [event: KeyboardEvent];
8
- nextSelection: [event: KeyboardEvent];
7
+ selectPreviousSibling: [event: KeyboardEvent];
8
+ selectNextSibling: [event: KeyboardEvent];
9
9
  }
10
10
  interface Commands {
11
11
  selectAll: () => void;
12
12
  deselectAll: () => void;
13
13
  selectParent: () => void;
14
- previousSelection: () => void;
15
- nextSelection: () => void;
14
+ selectPreviousSibling: () => void;
15
+ selectNextSibling: () => void;
16
16
  }
17
17
  }
18
18
  }
@@ -10,6 +10,7 @@ declare global {
10
10
  startTyping: (e?: MouseEvent | PointerEvent) => Promise<boolean>;
11
11
  startTransform: (e?: MouseEvent | PointerEvent) => boolean;
12
12
  openContextMenu: (e?: MouseEvent | PointerEvent) => boolean;
13
+ layerScrollIntoView: () => boolean;
13
14
  }
14
15
  interface Events {
15
16
  setTransform: [value: {
@@ -1,5 +1,8 @@
1
1
  declare global {
2
2
  namespace Mce {
3
+ interface Config {
4
+ zoomToFit: ZoomToMode;
5
+ }
3
6
  interface Commands {
4
7
  zoomIn: () => void;
5
8
  zoomOut: () => void;
@@ -58,7 +58,7 @@ import './plugins/rotate'
58
58
  import './plugins/ruler'
59
59
  import './plugins/saveAs'
60
60
  import './plugins/scroll'
61
- import './plugins/select'
61
+ import './plugins/selection'
62
62
  import './plugins/shape'
63
63
  import './plugins/smartGuides'
64
64
  import './plugins/state'
@@ -1,4 +1,5 @@
1
1
  import type { ComponentInternalInstance, ComponentPublicInstance, InjectionKey, VNodeChild } from 'vue';
2
+ export declare function noop(..._args: any): void;
2
3
  export declare function isClickInsideElement(event: MouseEvent, targetDiv: HTMLElement): boolean;
3
4
  export interface TemplateRef {
4
5
  (target: Element | ComponentPublicInstance | null): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.15.19",
4
+ "version": "0.15.21",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -58,10 +58,10 @@
58
58
  "@floating-ui/vue": "^1.1.9",
59
59
  "@vueuse/components": "^14.1.0",
60
60
  "@vueuse/core": "^14.1.0",
61
- "diff": "^8.0.2",
61
+ "diff": "^8.0.3",
62
62
  "file-saver": "^2.0.5",
63
63
  "lodash-es": "^4.17.22",
64
- "modern-canvas": "^0.14.35",
64
+ "modern-canvas": "^0.14.36",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.9",
67
67
  "modern-text": "^1.10.15",