mce 0.16.7 → 0.17.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.
- package/dist/components/EditorLayout.vue.d.ts +2 -9
- package/dist/components/Frame.vue.d.ts +6 -2
- package/dist/components/Rulers.vue.d.ts +17 -4
- package/dist/components/Selection.vue.d.ts +97 -79
- package/dist/components/shared/{TransformControls.vue.d.ts → Transform.vue.d.ts} +21 -25
- package/dist/composables/strategy.d.ts +1 -2
- package/dist/editor.d.ts +10 -8
- package/dist/index.css +131 -91
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6474 -6196
- package/dist/locale/en.d.ts +12 -14
- package/dist/locale/zh-Hans.d.ts +12 -14
- package/dist/mixins/0.config/base.d.ts +41 -26
- package/dist/mixins/0.config.d.ts +3 -3
- package/dist/mixins/0.context.d.ts +2 -2
- package/dist/mixins/0.font.d.ts +0 -3
- package/dist/mixins/1.screen.d.ts +11 -2
- package/dist/mixins/snap.d.ts +27 -0
- package/dist/mixins/snapshot.d.ts +0 -3
- package/dist/mixins/tool.d.ts +25 -0
- package/dist/nodes/Doc.d.ts +2 -2
- package/dist/plugin.d.ts +3 -3
- package/dist/plugins/frame.d.ts +13 -1
- package/dist/plugins/image.d.ts +1 -1
- package/dist/plugins/layers.d.ts +2 -2
- package/dist/plugins/madeWith.d.ts +5 -2
- package/dist/plugins/menu.d.ts +3 -0
- package/dist/plugins/node.d.ts +6 -3
- package/dist/plugins/pen.d.ts +1 -1
- package/dist/plugins/ruler.d.ts +6 -9
- package/dist/plugins/scroll.d.ts +6 -3
- package/dist/plugins/selection.d.ts +4 -10
- package/dist/plugins/shape.d.ts +1 -1
- package/dist/plugins/smartGuides.d.ts +0 -7
- package/dist/plugins/state.d.ts +1 -1
- package/dist/plugins/statusbar.d.ts +4 -4
- package/dist/plugins/timeline.d.ts +4 -4
- package/dist/plugins/{drawingTool.d.ts → tool.d.ts} +1 -1
- package/dist/plugins/toolbelt.d.ts +5 -2
- package/dist/plugins/transform.d.ts +36 -4
- package/dist/plugins/typography.d.ts +41 -0
- package/dist/plugins/view.d.ts +16 -10
- package/dist/plugins/zoom.d.ts +10 -7
- package/dist/typed-global.d.ts +4 -1
- package/dist/typed-plugins.d.ts +4 -8
- package/dist/types/helper.d.ts +3 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/dnd.d.ts +28 -7
- package/dist/utils/helper.d.ts +2 -0
- package/package.json +6 -6
- package/dist/mixins/4.1.text.d.ts +0 -21
- package/dist/mixins/drawingTool.d.ts +0 -25
- package/dist/plugins/move.d.ts +0 -20
- package/dist/plugins/panels.d.ts +0 -13
- package/dist/plugins/rotate.d.ts +0 -10
- package/dist/plugins/text.d.ts +0 -17
- package/dist/plugins/ui.d.ts +0 -20
- /package/dist/components/{NodeCreator.vue.d.ts → Creator.vue.d.ts} +0 -0
package/dist/locale/en.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
cancel: string;
|
|
3
3
|
create: string;
|
|
4
|
-
|
|
4
|
+
constrainMovement: string;
|
|
5
5
|
loading: string;
|
|
6
6
|
drawing: string;
|
|
7
7
|
exporting: string;
|
|
@@ -21,6 +21,7 @@ declare const _default: {
|
|
|
21
21
|
slice: string;
|
|
22
22
|
group: string;
|
|
23
23
|
text: string;
|
|
24
|
+
shape: string;
|
|
24
25
|
doubleClickEditText: string;
|
|
25
26
|
rectangle: string;
|
|
26
27
|
line: string;
|
|
@@ -68,20 +69,17 @@ declare const _default: {
|
|
|
68
69
|
selectPreviousSibling: string;
|
|
69
70
|
selectNextSibling: string;
|
|
70
71
|
view: string;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'
|
|
77
|
-
'
|
|
72
|
+
checkerboard: string;
|
|
73
|
+
pixelGrid: string;
|
|
74
|
+
ruler: string;
|
|
75
|
+
scrollbar: string;
|
|
76
|
+
frameOutline: string;
|
|
77
|
+
'checkerboard:grid': string;
|
|
78
|
+
'checkerboard:dot': string;
|
|
78
79
|
panels: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'panels:nodeCreator': string;
|
|
83
|
-
'panels:memoryManager': string;
|
|
84
|
-
nodeCreator: string;
|
|
80
|
+
timeline: string;
|
|
81
|
+
statusbar: string;
|
|
82
|
+
creator: string;
|
|
85
83
|
memoryManager: string;
|
|
86
84
|
toolbelt: string;
|
|
87
85
|
msaa: string;
|
package/dist/locale/zh-Hans.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
cancel: string;
|
|
3
3
|
create: string;
|
|
4
|
-
|
|
4
|
+
constrainMovement: string;
|
|
5
5
|
loading: string;
|
|
6
6
|
drawing: string;
|
|
7
7
|
exporting: string;
|
|
@@ -21,6 +21,7 @@ declare const _default: {
|
|
|
21
21
|
slice: string;
|
|
22
22
|
group: string;
|
|
23
23
|
text: string;
|
|
24
|
+
shape: string;
|
|
24
25
|
doubleClickEditText: string;
|
|
25
26
|
rectangle: string;
|
|
26
27
|
line: string;
|
|
@@ -68,20 +69,17 @@ declare const _default: {
|
|
|
68
69
|
selectPreviousSibling: string;
|
|
69
70
|
selectNextSibling: string;
|
|
70
71
|
view: string;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'
|
|
77
|
-
'
|
|
72
|
+
checkerboard: string;
|
|
73
|
+
pixelGrid: string;
|
|
74
|
+
ruler: string;
|
|
75
|
+
scrollbar: string;
|
|
76
|
+
frameOutline: string;
|
|
77
|
+
'checkerboard:grid': string;
|
|
78
|
+
'checkerboard:dot': string;
|
|
78
79
|
panels: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'panels:nodeCreator': string;
|
|
83
|
-
'panels:memoryManager': string;
|
|
84
|
-
nodeCreator: string;
|
|
80
|
+
statusbar: string;
|
|
81
|
+
timeline: string;
|
|
82
|
+
creator: string;
|
|
85
83
|
memoryManager: string;
|
|
86
84
|
toolbelt: string;
|
|
87
85
|
msaa: string;
|
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
import type { CheckerboardStyle } from 'modern-canvas';
|
|
2
2
|
declare global {
|
|
3
3
|
namespace Mce {
|
|
4
|
-
interface
|
|
4
|
+
interface CameraConfig {
|
|
5
|
+
enabled: boolean;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
left?: number;
|
|
10
|
-
top?: number;
|
|
11
|
-
right?: number;
|
|
12
|
-
bottom?: number;
|
|
7
|
+
interface CheckerboardConfig {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
style: CheckerboardStyle;
|
|
13
10
|
}
|
|
14
|
-
interface
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
interface PixelGridConfig {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface PixelateConfig {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface MsaaConfig {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface WatermarkConfig {
|
|
21
|
+
url?: string;
|
|
22
|
+
width: number;
|
|
23
|
+
alpha: number;
|
|
24
|
+
rotation: number;
|
|
25
|
+
}
|
|
26
|
+
interface ViewportConfig {
|
|
27
|
+
camera: CameraConfig;
|
|
28
|
+
}
|
|
29
|
+
interface CanvasConfig {
|
|
30
|
+
checkerboard: CheckerboardConfig;
|
|
31
|
+
pixelGrid: PixelGridConfig;
|
|
32
|
+
pixelate: PixelateConfig;
|
|
33
|
+
msaa: MsaaConfig;
|
|
34
|
+
watermark: WatermarkConfig;
|
|
35
|
+
}
|
|
36
|
+
interface UIConfig {
|
|
37
|
+
}
|
|
38
|
+
interface InteractionConfig {
|
|
39
|
+
}
|
|
40
|
+
interface DBConfig {
|
|
41
|
+
local: boolean;
|
|
18
42
|
}
|
|
19
43
|
interface Config {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
pixelGrid: boolean;
|
|
26
|
-
pixelate: boolean;
|
|
27
|
-
camera: boolean;
|
|
28
|
-
frameOutline: boolean;
|
|
29
|
-
frameGap: number;
|
|
30
|
-
typographyStrategy: TypographyStrategy;
|
|
31
|
-
transformControls: TransformControlsConfig;
|
|
32
|
-
localDb: boolean;
|
|
33
|
-
screenCenterOffset: ScreenOffset;
|
|
44
|
+
db: DBConfig;
|
|
45
|
+
ui: UIConfig;
|
|
46
|
+
canvas: CanvasConfig;
|
|
47
|
+
viewport: ViewportConfig;
|
|
48
|
+
interaction: InteractionConfig;
|
|
34
49
|
}
|
|
35
50
|
}
|
|
36
51
|
}
|
|
@@ -7,9 +7,9 @@ declare global {
|
|
|
7
7
|
setter?: (val: any) => any;
|
|
8
8
|
}
|
|
9
9
|
interface Editor {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
getConfig: (path: keyof Config | string, defaultValue?: any) => any;
|
|
11
|
+
setConfig: (path: keyof Config | string, value: any) => void;
|
|
12
|
+
getConfigRef: <T = any>(path: string) => WritableComputedRef<T>;
|
|
13
13
|
registerConfig: <T>(path: keyof Config | string, declaration?: ConfigDeclaration<T>) => WritableComputedRef<T>;
|
|
14
14
|
importConfig: () => Promise<void>;
|
|
15
15
|
exportConfig: () => Blob;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Assets, Cursor,
|
|
1
|
+
import type { Assets, Cursor, Vector2Like } from 'modern-canvas';
|
|
2
2
|
import type { IndexCharacter as _IndexCharacter } from 'modern-text/web-components';
|
|
3
3
|
import type { Ref } from 'vue';
|
|
4
|
-
import { Aabb2D, Camera2D, DrawboardEffect, Element2D, Engine, Node, Timeline } from 'modern-canvas';
|
|
4
|
+
import { Aabb2D, Camera2D, DrawboardEffect, Element2D, Engine, Node, Timeline, Vector2 } from 'modern-canvas';
|
|
5
5
|
import { Fonts } from 'modern-font';
|
|
6
6
|
import { Doc } from '../nodes';
|
|
7
7
|
declare global {
|
package/dist/mixins/0.font.d.ts
CHANGED
|
@@ -6,9 +6,6 @@ declare global {
|
|
|
6
6
|
setDefaultFont: (source: FontSource, options?: FontLoadOptions) => Promise<void>;
|
|
7
7
|
waitUntilFontLoad: () => Promise<void>;
|
|
8
8
|
}
|
|
9
|
-
interface Options {
|
|
10
|
-
defaultFont?: FontSource;
|
|
11
|
-
}
|
|
12
9
|
interface Events {
|
|
13
10
|
loadFont: [font: FontLoadedResult];
|
|
14
11
|
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import type { ComputedRef } from 'vue';
|
|
2
2
|
declare global {
|
|
3
3
|
namespace Mce {
|
|
4
|
+
interface ViewportConfig {
|
|
5
|
+
screenPadding: ScreenPadding;
|
|
6
|
+
}
|
|
7
|
+
interface ScreenPadding {
|
|
8
|
+
left: number;
|
|
9
|
+
top: number;
|
|
10
|
+
right: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
}
|
|
4
13
|
interface Editor {
|
|
5
|
-
screenControlsOffset: ComputedRef<Required<
|
|
6
|
-
screenCenterOffset: ComputedRef<Required<
|
|
14
|
+
screenControlsOffset: ComputedRef<Required<ScreenPadding>>;
|
|
15
|
+
screenCenterOffset: ComputedRef<Required<ScreenPadding>>;
|
|
7
16
|
screenCenter: ComputedRef<{
|
|
8
17
|
x: number;
|
|
9
18
|
y: number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Vector2Like } from 'modern-canvas';
|
|
2
|
+
import type { Reactive } from 'vue';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Mce {
|
|
5
|
+
interface SnapperData {
|
|
6
|
+
xLines?: number[];
|
|
7
|
+
yLines?: number[];
|
|
8
|
+
points?: Vector2Like[];
|
|
9
|
+
}
|
|
10
|
+
interface Snapper {
|
|
11
|
+
get: () => SnapperData;
|
|
12
|
+
}
|
|
13
|
+
interface Editor {
|
|
14
|
+
snappers: Reactive<Map<string, Snapper>>;
|
|
15
|
+
registerSnapper: (key: string, snapper: Snapper) => void;
|
|
16
|
+
unregisterSnapper: (key: string) => void;
|
|
17
|
+
snap: (box: {
|
|
18
|
+
left: number;
|
|
19
|
+
top: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
declare const _default: import("..").Mixin;
|
|
27
|
+
export default _default;
|
|
@@ -2,9 +2,6 @@ import type { Element2D } from 'modern-canvas';
|
|
|
2
2
|
import type { Element } from 'modern-idoc';
|
|
3
3
|
declare global {
|
|
4
4
|
namespace Mce {
|
|
5
|
-
interface Config {
|
|
6
|
-
frameScreenshot: boolean;
|
|
7
|
-
}
|
|
8
5
|
interface Editor {
|
|
9
6
|
snapshot: () => void;
|
|
10
7
|
captureElementScreenshot: (element: Element | Element2D) => Promise<HTMLCanvasElement>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Vector2Like } from 'modern-canvas';
|
|
2
|
+
import type { Reactive, Ref } from 'vue';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Mce {
|
|
5
|
+
interface Tools {
|
|
6
|
+
}
|
|
7
|
+
type ToolHandle = (position: Vector2Like) => {
|
|
8
|
+
move?: (position: Vector2Like) => void;
|
|
9
|
+
end?: (position: Vector2Like) => void;
|
|
10
|
+
} | void;
|
|
11
|
+
interface Tool {
|
|
12
|
+
name: string;
|
|
13
|
+
handle?: ToolHandle;
|
|
14
|
+
}
|
|
15
|
+
interface Editor {
|
|
16
|
+
tools: Reactive<Map<string, Tool>>;
|
|
17
|
+
activeTool: Ref<Tool>;
|
|
18
|
+
registerTool: (tool: Tool | Tool[]) => void;
|
|
19
|
+
unregisterTool: (tool: string) => void;
|
|
20
|
+
activateTool: (tool: string | keyof Tools | undefined) => void;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
declare const _default: import("..").Mixin;
|
|
25
|
+
export default _default;
|
package/dist/nodes/Doc.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ export interface Doc {
|
|
|
14
14
|
emit: <K extends keyof DocEvents & string>(event: K, ...args: DocEvents[K]) => this;
|
|
15
15
|
}
|
|
16
16
|
export declare class Doc extends Node {
|
|
17
|
-
protected readonly
|
|
17
|
+
protected readonly _local: boolean;
|
|
18
18
|
_yDoc: YDoc;
|
|
19
19
|
protected _source: any;
|
|
20
|
-
constructor(source?: Mce.DocumentSource,
|
|
20
|
+
constructor(source?: Mce.DocumentSource, _local?: boolean);
|
|
21
21
|
transact: <T>(fn: () => T, should?: boolean) => T;
|
|
22
22
|
undo: () => void;
|
|
23
23
|
redo: () => void;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Component } from 'vue';
|
|
1
|
+
import type { Component, Ref } from 'vue';
|
|
2
2
|
import type { Editor, Events, Options } from './editor';
|
|
3
3
|
export interface PluginBaseComponent {
|
|
4
4
|
component: Component;
|
|
5
|
-
|
|
5
|
+
visible?: Ref<boolean>;
|
|
6
6
|
order?: 'before' | number | 'after';
|
|
7
7
|
slot?: string;
|
|
8
8
|
}
|
|
@@ -29,7 +29,7 @@ export interface PluginObject {
|
|
|
29
29
|
hotkeys?: Mce.Hotkey[];
|
|
30
30
|
loaders?: Mce.Loader[];
|
|
31
31
|
exporters?: Mce.Exporter[];
|
|
32
|
-
|
|
32
|
+
tools?: Mce.Tool[];
|
|
33
33
|
components?: PluginComponent[];
|
|
34
34
|
setup?: () => void | Promise<void>;
|
|
35
35
|
}
|
package/dist/plugins/frame.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
declare
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Mce {
|
|
3
|
+
interface CanvasConfig {
|
|
4
|
+
frame: FrameConfig;
|
|
5
|
+
}
|
|
6
|
+
interface FrameConfig {
|
|
7
|
+
gap: number;
|
|
8
|
+
outline: boolean;
|
|
9
|
+
thumbnail: boolean;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const _default: import("..").Plugin;
|
|
2
14
|
export default _default;
|
package/dist/plugins/image.d.ts
CHANGED
package/dist/plugins/layers.d.ts
CHANGED
package/dist/plugins/menu.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ declare global {
|
|
|
12
12
|
mainMenu: ComputedRef<MenuItem[]>;
|
|
13
13
|
contextMenu: ComputedRef<MenuItem[]>;
|
|
14
14
|
}
|
|
15
|
+
interface Commands {
|
|
16
|
+
openContextMenu: (event?: MouseEvent) => boolean;
|
|
17
|
+
}
|
|
15
18
|
interface Options {
|
|
16
19
|
customContextMenu?: (defaultMenu: MenuItem[], editor: Editor) => MenuItem[];
|
|
17
20
|
}
|
package/dist/plugins/node.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
namespace Mce {
|
|
3
|
+
interface UIConfig {
|
|
4
|
+
creator: CreatorConfig;
|
|
5
|
+
}
|
|
6
|
+
interface CreatorConfig {
|
|
7
|
+
visible: boolean;
|
|
8
|
+
}
|
|
3
9
|
interface Commands {
|
|
4
10
|
addSubNode: () => void;
|
|
5
11
|
}
|
|
6
|
-
interface Config {
|
|
7
|
-
nodeCreator: boolean;
|
|
8
|
-
}
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
declare const _default: import("../plugin").Plugin;
|
package/dist/plugins/pen.d.ts
CHANGED
package/dist/plugins/ruler.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
namespace Mce {
|
|
3
|
-
interface
|
|
4
|
-
visible?: boolean;
|
|
5
|
-
adsorbed?: boolean;
|
|
6
|
-
lineColor?: string;
|
|
7
|
-
locked?: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface Config {
|
|
3
|
+
interface UIConfig {
|
|
10
4
|
ruler: RulerConfig;
|
|
11
5
|
}
|
|
12
|
-
interface
|
|
13
|
-
|
|
6
|
+
interface RulerConfig {
|
|
7
|
+
visible: boolean;
|
|
8
|
+
adsorbed: boolean;
|
|
9
|
+
lineColor?: string;
|
|
10
|
+
locked: boolean;
|
|
14
11
|
}
|
|
15
12
|
interface Commands {
|
|
16
13
|
clearRulerLines: () => void;
|
package/dist/plugins/scroll.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { Element2D } from 'modern-canvas';
|
|
2
2
|
declare global {
|
|
3
3
|
namespace Mce {
|
|
4
|
+
interface UIConfig {
|
|
5
|
+
scrollbar: ScrollbarConfig;
|
|
6
|
+
}
|
|
7
|
+
interface ScrollbarConfig {
|
|
8
|
+
visible: boolean;
|
|
9
|
+
}
|
|
4
10
|
type ScrollTarget = 'root' | 'selection' | {
|
|
5
11
|
x: number;
|
|
6
12
|
} | {
|
|
@@ -18,9 +24,6 @@ declare global {
|
|
|
18
24
|
scrollTo: (target: ScrollTarget, options?: ScrollToOptions) => Promise<void>;
|
|
19
25
|
scrollToSelection: (options?: ScrollToOptions) => void;
|
|
20
26
|
}
|
|
21
|
-
interface Config {
|
|
22
|
-
scrollbar: boolean;
|
|
23
|
-
}
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
declare const _default: import("../plugin").Plugin;
|
|
@@ -3,6 +3,7 @@ declare global {
|
|
|
3
3
|
namespace Mce {
|
|
4
4
|
type SelectTarget = 'none' | 'all' | 'inverse' | 'children' | 'parent' | 'previousSibling' | 'nextSibling' | Node[];
|
|
5
5
|
interface Commands {
|
|
6
|
+
startTransform: (event?: MouseEvent) => boolean;
|
|
6
7
|
select: (target: SelectTarget) => void;
|
|
7
8
|
marqueeSelect: (marquee?: Aabb2D) => void;
|
|
8
9
|
selectAll: () => void;
|
|
@@ -43,17 +44,10 @@ declare global {
|
|
|
43
44
|
cancel: () => void;
|
|
44
45
|
}) => void;
|
|
45
46
|
}
|
|
46
|
-
interface BaseSelectionTransformContext {
|
|
47
|
-
startEvent: MouseEvent | PointerEvent;
|
|
48
|
-
handle: TransformHandle;
|
|
49
|
-
}
|
|
50
|
-
interface SelectionTransformContext extends BaseSelectionTransformContext {
|
|
51
|
-
value: TransformValue;
|
|
52
|
-
}
|
|
53
47
|
interface Events {
|
|
54
|
-
selectionTransformStart: [context:
|
|
55
|
-
selectionTransform: [context:
|
|
56
|
-
selectionTransformEnd: [context:
|
|
48
|
+
selectionTransformStart: [context: TransformContext];
|
|
49
|
+
selectionTransform: [context: TransformContext];
|
|
50
|
+
selectionTransformEnd: [context: TransformContext];
|
|
57
51
|
}
|
|
58
52
|
}
|
|
59
53
|
}
|
package/dist/plugins/shape.d.ts
CHANGED
package/dist/plugins/state.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import type { DragContext } from '../utils';
|
|
1
2
|
declare global {
|
|
2
3
|
namespace Mce {
|
|
4
|
+
interface InteractionConfig {
|
|
5
|
+
transform: TransformConfig;
|
|
6
|
+
}
|
|
7
|
+
interface TransformConfig {
|
|
8
|
+
handleShape: 'rect' | 'circle';
|
|
9
|
+
handleStyle: '8-points' | '4-points';
|
|
10
|
+
lockAspectRatioStrategy: 'all' | 'diagonal';
|
|
11
|
+
rotator: boolean;
|
|
12
|
+
}
|
|
3
13
|
interface TransformValue {
|
|
4
14
|
left: number;
|
|
5
15
|
top: number;
|
|
@@ -11,17 +21,39 @@ declare global {
|
|
|
11
21
|
type TransformHandleDirection = 't' | 'l' | 'r' | 'b';
|
|
12
22
|
type TransformHandleCorner = 'tl' | 'tr' | 'bl' | 'br';
|
|
13
23
|
type TransformHandle = 'move' | `resize-${TransformHandleDirection | TransformHandleCorner}` | `rotate-${TransformHandleCorner}` | `round-${TransformHandleCorner}`;
|
|
14
|
-
|
|
24
|
+
interface TransformContext extends DragContext {
|
|
25
|
+
handle: TransformHandle;
|
|
26
|
+
value: TransformValue;
|
|
27
|
+
oldValue: TransformValue;
|
|
28
|
+
}
|
|
29
|
+
type MoveDirection = 'left' | 'top' | 'right' | 'bottom';
|
|
30
|
+
type FlipDirection = 'horizontal' | 'vertical';
|
|
31
|
+
type TransformType = 'move' | 'resize' | 'rotate' | 'round';
|
|
32
|
+
interface TransformOptions {
|
|
33
|
+
event?: MouseEvent;
|
|
34
|
+
isCorner?: boolean;
|
|
35
|
+
}
|
|
15
36
|
interface Commands {
|
|
16
37
|
enter: () => void;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
38
|
+
getTransform: () => TransformValue;
|
|
39
|
+
setTransform: (type: TransformType, value: Partial<TransformValue>, options?: TransformOptions) => void;
|
|
40
|
+
move: (direction: MoveDirection, distance?: number) => void;
|
|
41
|
+
moveLeft: (distance?: number) => void;
|
|
42
|
+
moveTop: (distance?: number) => void;
|
|
43
|
+
moveRight: (distance?: number) => void;
|
|
44
|
+
moveBottom: (distance?: number) => void;
|
|
45
|
+
rotate: (deg: number) => void;
|
|
46
|
+
rotate90: () => void;
|
|
47
|
+
flip: (direction: FlipDirection) => void;
|
|
20
48
|
flipHorizontal: () => void;
|
|
21
49
|
flipVertical: () => void;
|
|
22
50
|
}
|
|
23
51
|
interface Hotkeys {
|
|
24
52
|
enter: [event: KeyboardEvent];
|
|
53
|
+
moveLeft: [event: KeyboardEvent];
|
|
54
|
+
moveTop: [event: KeyboardEvent];
|
|
55
|
+
moveRight: [event: KeyboardEvent];
|
|
56
|
+
moveBottom: [event: KeyboardEvent];
|
|
25
57
|
flipHorizontal: [event: KeyboardEvent];
|
|
26
58
|
flipVertical: [event: KeyboardEvent];
|
|
27
59
|
}
|