@leafer-in/interface 1.0.0-beta.15
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/LICENSE +21 -0
- package/README.md +1 -0
- package/package.json +30 -0
- package/src/index.ts +3 -0
- package/types/index.d.ts +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present, Chao (Leafer) Wan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @leafer-in/interface
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leafer-in/interface",
|
|
3
|
+
"version": "1.0.0-beta.15",
|
|
4
|
+
"description": "@leafer-in/interface",
|
|
5
|
+
"author": "Chao (Leafer) Wan",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "src/index.ts",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"types",
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/leaferjs/in.git"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/leaferjs/in/tree/main/packages/interface",
|
|
18
|
+
"bugs": "https://github.com/leaferjs/in/issues",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"leafer-in interface",
|
|
21
|
+
"leafer-in",
|
|
22
|
+
"editor",
|
|
23
|
+
"leafer-ui",
|
|
24
|
+
"leaferjs"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@leafer-ui/interface": "1.0.0-beta.15",
|
|
28
|
+
"@leafer/interface": "1.0.0-beta.15"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/index.ts
ADDED
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { IGroup, IUI, IPolygon, IPointData, IResizeType, IAround, IRectInputData, ICursorType, IEvent, IDragEvent, IBoundsData } from '@leafer-ui/interface';
|
|
2
|
+
export * from '@leafer-ui/interface';
|
|
3
|
+
|
|
4
|
+
interface IEditor extends IGroup {
|
|
5
|
+
config: IEditorConfig;
|
|
6
|
+
resizePoints: IUI[];
|
|
7
|
+
rotatePoints: IUI[];
|
|
8
|
+
resizeLines: IUI[];
|
|
9
|
+
circle: IUI;
|
|
10
|
+
targetRect: IUI;
|
|
11
|
+
rect: IPolygon;
|
|
12
|
+
target: IUI;
|
|
13
|
+
tool: IEditorTool;
|
|
14
|
+
enterPoint: IUI;
|
|
15
|
+
getTool(value: IUI): IEditorTool;
|
|
16
|
+
update(): void;
|
|
17
|
+
}
|
|
18
|
+
interface IEditorTool {
|
|
19
|
+
name: string;
|
|
20
|
+
getMirrorData(editor: IEditor): IPointData;
|
|
21
|
+
resize(e: IEditorResizeEvent): void;
|
|
22
|
+
rotate(e: IEditorRotateEvent): void;
|
|
23
|
+
update(editor: IEditor): void;
|
|
24
|
+
}
|
|
25
|
+
interface IEditorConfig {
|
|
26
|
+
type?: 'pc' | 'mobile';
|
|
27
|
+
resizeType?: 'auto' | IResizeType;
|
|
28
|
+
around?: IAround;
|
|
29
|
+
lockRatio?: boolean;
|
|
30
|
+
rotateGap?: number;
|
|
31
|
+
stroke?: string;
|
|
32
|
+
pointFill?: string;
|
|
33
|
+
pointSize?: number;
|
|
34
|
+
pointRadius?: number;
|
|
35
|
+
point?: IRectInputData | IRectInputData[];
|
|
36
|
+
rotatePoint?: IRectInputData;
|
|
37
|
+
rect?: IRectInputData;
|
|
38
|
+
hideOnMove?: boolean;
|
|
39
|
+
moveCursor?: ICursorType;
|
|
40
|
+
resizeCursor?: ICursorType[];
|
|
41
|
+
rotateCursor?: ICursorType[];
|
|
42
|
+
rotateable?: boolean;
|
|
43
|
+
resizeable?: boolean;
|
|
44
|
+
}
|
|
45
|
+
declare enum IDirection8 {
|
|
46
|
+
topLeft = 0,
|
|
47
|
+
top = 1,
|
|
48
|
+
topRight = 2,
|
|
49
|
+
right = 3,
|
|
50
|
+
bottomRight = 4,
|
|
51
|
+
bottom = 5,
|
|
52
|
+
bottomLeft = 6,
|
|
53
|
+
left = 7
|
|
54
|
+
}
|
|
55
|
+
interface IEditorResizeEvent extends IEvent {
|
|
56
|
+
readonly target?: IUI;
|
|
57
|
+
readonly editor?: IEditor;
|
|
58
|
+
readonly resizeType?: IResizeType;
|
|
59
|
+
readonly lockRatio?: boolean;
|
|
60
|
+
readonly around?: IAround;
|
|
61
|
+
readonly dragEvent?: IDragEvent;
|
|
62
|
+
readonly direction?: IDirection8;
|
|
63
|
+
readonly bounds?: IBoundsData;
|
|
64
|
+
readonly old?: IBoundsData;
|
|
65
|
+
readonly origin?: IPointData;
|
|
66
|
+
readonly scaleX?: number;
|
|
67
|
+
readonly scaleY?: number;
|
|
68
|
+
}
|
|
69
|
+
interface IEditorRotateEvent extends IEvent {
|
|
70
|
+
readonly target?: IUI;
|
|
71
|
+
readonly editor?: IEditor;
|
|
72
|
+
readonly origin?: IPointData;
|
|
73
|
+
readonly rotation?: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { IDirection8, type IEditor, type IEditorConfig, type IEditorResizeEvent, type IEditorRotateEvent, type IEditorTool };
|