@sansitech/react-img-editor 0.4.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/LICENSE +21 -0
- package/README.md +65 -0
- package/lib/common/PubSub.d.ts +6 -0
- package/lib/common/constants.d.ts +13 -0
- package/lib/common/type.d.ts +22 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/withContext.d.ts +2 -0
- package/lib/components/EditorContext.d.ts +20 -0
- package/lib/components/Palette.d.ts +9 -0
- package/lib/components/ParamSetting/ColorSetting.d.ts +7 -0
- package/lib/components/ParamSetting/FontSizeSetting.d.ts +7 -0
- package/lib/components/ParamSetting/LineTypeSetting.d.ts +7 -0
- package/lib/components/ParamSetting/StrokeWidthSetting.d.ts +7 -0
- package/lib/components/ParamSetting/index.d.ts +9 -0
- package/lib/components/Toolbar.d.ts +3 -0
- package/lib/index.css +386 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.es.js +19375 -0
- package/lib/index.es.js.map +1 -0
- package/lib/index.js +19395 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/Arrow.d.ts +28 -0
- package/lib/plugins/Circle.d.ts +28 -0
- package/lib/plugins/Crop.d.ts +32 -0
- package/lib/plugins/Download.d.ts +11 -0
- package/lib/plugins/Eraser.d.ts +18 -0
- package/lib/plugins/Mosaic.d.ts +25 -0
- package/lib/plugins/Pen.d.ts +18 -0
- package/lib/plugins/Plugin.d.ts +19 -0
- package/lib/plugins/PluginFactory.d.ts +13 -0
- package/lib/plugins/Rect.d.ts +28 -0
- package/lib/plugins/Repeal.d.ts +11 -0
- package/lib/plugins/Text.d.ts +25 -0
- package/package.json +84 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams, PluginParamName, PluginParamValue } from '../common/type';
|
|
3
|
+
export default class Arrow extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
params: PluginParamName[];
|
|
11
|
+
defaultParamValue: PluginParamValue;
|
|
12
|
+
shapeName: string;
|
|
13
|
+
lastArrow: any;
|
|
14
|
+
transformer: any;
|
|
15
|
+
selectedNode: any;
|
|
16
|
+
isPaint: boolean;
|
|
17
|
+
started: boolean;
|
|
18
|
+
startPoints: number[];
|
|
19
|
+
enableTransform: (drawEventParams: DrawEventParams, node: any) => void;
|
|
20
|
+
disableTransform: (drawEventParams: DrawEventParams, node: any, remove?: boolean) => void;
|
|
21
|
+
onEnter: (drawEventParams: DrawEventParams) => void;
|
|
22
|
+
onClick: (drawEventParams: DrawEventParams) => void;
|
|
23
|
+
onDrawStart: () => void;
|
|
24
|
+
onDraw: (drawEventParams: DrawEventParams) => void;
|
|
25
|
+
onDrawEnd: (drawEventParams: DrawEventParams) => void;
|
|
26
|
+
onLeave: (drawEventParams: DrawEventParams) => void;
|
|
27
|
+
onNodeRecreate: (drawEventParams: DrawEventParams, node: any) => void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams, PluginParamName, PluginParamValue } from '../common/type';
|
|
3
|
+
export default class Circle extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
params: PluginParamName[];
|
|
11
|
+
defaultParamValue: PluginParamValue;
|
|
12
|
+
shapeName: string;
|
|
13
|
+
lastCircle: any;
|
|
14
|
+
transformer: any;
|
|
15
|
+
selectedNode: any;
|
|
16
|
+
isPaint: boolean;
|
|
17
|
+
started: boolean;
|
|
18
|
+
startPoint: number[];
|
|
19
|
+
enableTransform: (drawEventParams: DrawEventParams, node: any) => void;
|
|
20
|
+
disableTransform: (drawEventParams: DrawEventParams, node: any, remove?: boolean) => void;
|
|
21
|
+
onEnter: (drawEventParams: DrawEventParams) => void;
|
|
22
|
+
onClick: (drawEventParams: DrawEventParams) => void;
|
|
23
|
+
onDrawStart: () => void;
|
|
24
|
+
onDraw: (drawEventParams: DrawEventParams) => void;
|
|
25
|
+
onDrawEnd: (drawEventParams: DrawEventParams) => void;
|
|
26
|
+
onLeave: (drawEventParams: DrawEventParams) => void;
|
|
27
|
+
onNodeRecreate: (drawEventParams: DrawEventParams, node: any) => void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams } from '../common/type';
|
|
3
|
+
export default class Crop extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
params: any[];
|
|
11
|
+
isPaint: boolean;
|
|
12
|
+
virtualLayer: any;
|
|
13
|
+
rect: any;
|
|
14
|
+
transformer: any;
|
|
15
|
+
toolbarId: string;
|
|
16
|
+
usage: {
|
|
17
|
+
en: string;
|
|
18
|
+
de: string;
|
|
19
|
+
};
|
|
20
|
+
getRectWidth: () => any;
|
|
21
|
+
getRectHeight: () => any;
|
|
22
|
+
getRectX: () => any;
|
|
23
|
+
getRectY: () => any;
|
|
24
|
+
adjustToolbarPosition: (stage: any) => void;
|
|
25
|
+
createCropToolbar: (stage: any, sureBtnEvent: () => void, cancelBtnEvent: () => void) => void;
|
|
26
|
+
reset: (stage: any) => void;
|
|
27
|
+
onEnter: (drawEventParams: DrawEventParams) => void;
|
|
28
|
+
onDrawStart: (drawEventParams: DrawEventParams) => void;
|
|
29
|
+
onDraw: (drawEventParams: DrawEventParams) => void;
|
|
30
|
+
onDrawEnd: (drawEventParams: DrawEventParams) => void;
|
|
31
|
+
onLeave: (drawEventParams: DrawEventParams) => void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DrawEventParams } from '../common/type';
|
|
2
|
+
import Plugin from './Plugin';
|
|
3
|
+
export default class Download extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
onEnter: (drawEventParams: DrawEventParams) => void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams, PluginParamName, PluginParamValue } from '../common/type';
|
|
3
|
+
export default class Eraser extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
params: PluginParamName[];
|
|
11
|
+
defaultParamValue: PluginParamValue;
|
|
12
|
+
lastLine: any;
|
|
13
|
+
isPaint: boolean;
|
|
14
|
+
onDrawStart: (drawEventParams: DrawEventParams) => void;
|
|
15
|
+
onDraw: (drawEventParams: DrawEventParams) => void;
|
|
16
|
+
onDrawEnd: (drawEventParams: DrawEventParams) => void;
|
|
17
|
+
onLeave: () => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams, PluginParamValue, PluginParamName } from '../common/type';
|
|
3
|
+
export default class Mosaic extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
params: PluginParamName[];
|
|
11
|
+
defaultParamValue: PluginParamValue;
|
|
12
|
+
isPaint: boolean;
|
|
13
|
+
tiles: any;
|
|
14
|
+
tileRowSize: number;
|
|
15
|
+
tileColumnSize: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
rectGroup: any;
|
|
19
|
+
drawTile: (tiles: any, drawLayer: any) => void;
|
|
20
|
+
getTilesByPoint: (x: number, y: number, strokeWidth: number) => any;
|
|
21
|
+
onDrawStart: (drawEventParams: DrawEventParams) => void;
|
|
22
|
+
onDraw: (drawEventParams: DrawEventParams) => void;
|
|
23
|
+
onDrawEnd: (drawEventParams: DrawEventParams) => void;
|
|
24
|
+
onLeave: () => void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams, PluginParamName, PluginParamValue } from '../common/type';
|
|
3
|
+
export default class Pen extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
params: PluginParamName[];
|
|
11
|
+
defaultParamValue: PluginParamValue;
|
|
12
|
+
lastLine: any;
|
|
13
|
+
isPaint: boolean;
|
|
14
|
+
onDrawStart: (drawEventParams: DrawEventParams) => void;
|
|
15
|
+
onDraw: (drawEventParams: DrawEventParams) => void;
|
|
16
|
+
onDrawEnd: (drawEventParams: DrawEventParams) => void;
|
|
17
|
+
onLeave: () => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DrawEventParams, PluginParamName, PluginParamValue } from '../common/type';
|
|
2
|
+
export default abstract class Plugin {
|
|
3
|
+
abstract name: string;
|
|
4
|
+
abstract iconfont: string;
|
|
5
|
+
abstract title: {
|
|
6
|
+
[lang: string]: string;
|
|
7
|
+
};
|
|
8
|
+
language: string;
|
|
9
|
+
params?: PluginParamName[];
|
|
10
|
+
defaultParamValue?: PluginParamValue;
|
|
11
|
+
shapeName?: string;
|
|
12
|
+
onEnter?: (params: DrawEventParams) => void;
|
|
13
|
+
onDrawStart?: (params: DrawEventParams) => void;
|
|
14
|
+
onClick?: (params: DrawEventParams) => void;
|
|
15
|
+
onDraw?: (params: DrawEventParams) => void;
|
|
16
|
+
onDrawEnd?: (params: DrawEventParams) => void;
|
|
17
|
+
onLeave?: (params: DrawEventParams) => void;
|
|
18
|
+
onNodeRecreate?: (params: DrawEventParams, node: any) => void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Arrow from './Arrow';
|
|
2
|
+
import Circle from './Circle';
|
|
3
|
+
import Crop from './Crop';
|
|
4
|
+
import Download from './Download';
|
|
5
|
+
import Eraser from './Eraser';
|
|
6
|
+
import Mosaic from './Mosaic';
|
|
7
|
+
import Pen from './Pen';
|
|
8
|
+
import Rect from './Rect';
|
|
9
|
+
import Repeal from './Repeal';
|
|
10
|
+
import Text from './Text';
|
|
11
|
+
export default class PluginFactory {
|
|
12
|
+
plugins: (Arrow | Circle | Crop | Download | Eraser | Mosaic | Pen | Rect | Repeal | Text)[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams, PluginParamName, PluginParamValue } from '../common/type';
|
|
3
|
+
export default class Rect extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
params: PluginParamName[];
|
|
11
|
+
defaultParamValue: PluginParamValue;
|
|
12
|
+
shapeName: string;
|
|
13
|
+
lastRect: any;
|
|
14
|
+
transformer: any;
|
|
15
|
+
selectedNode: any;
|
|
16
|
+
isPaint: boolean;
|
|
17
|
+
started: boolean;
|
|
18
|
+
startPoint: number[];
|
|
19
|
+
enableTransform: (drawEventParams: DrawEventParams, node: any) => void;
|
|
20
|
+
disableTransform: (drawEventParams: DrawEventParams, node: any, remove?: boolean) => void;
|
|
21
|
+
onEnter: (drawEventParams: DrawEventParams) => void;
|
|
22
|
+
onClick: (drawEventParams: DrawEventParams) => void;
|
|
23
|
+
onDrawStart: () => void;
|
|
24
|
+
onDraw: (drawEventParams: DrawEventParams) => void;
|
|
25
|
+
onDrawEnd: (drawEventParams: DrawEventParams) => void;
|
|
26
|
+
onLeave: (drawEventParams: DrawEventParams) => void;
|
|
27
|
+
onNodeRecreate: (drawEventParams: DrawEventParams, node: any) => void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import { DrawEventParams } from '../common/type';
|
|
3
|
+
export default class Repeal extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
iconfont: string;
|
|
6
|
+
title: {
|
|
7
|
+
en: string;
|
|
8
|
+
de: string;
|
|
9
|
+
};
|
|
10
|
+
onEnter: (drawEventParams: DrawEventParams) => void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Plugin from './Plugin';
|
|
2
|
+
import PubSub from '../common/PubSub';
|
|
3
|
+
import { DrawEventParams, PluginParamValue, PluginParamName } from '../common/type';
|
|
4
|
+
export default class Text extends Plugin {
|
|
5
|
+
name: string;
|
|
6
|
+
iconfont: string;
|
|
7
|
+
title: {
|
|
8
|
+
en: string;
|
|
9
|
+
de: string;
|
|
10
|
+
};
|
|
11
|
+
params: PluginParamName[];
|
|
12
|
+
defaultParamValue: PluginParamValue;
|
|
13
|
+
shapeName: string;
|
|
14
|
+
transformer: any;
|
|
15
|
+
selectedNode: any;
|
|
16
|
+
removeTextareaBlurModal: () => void;
|
|
17
|
+
addTextareaBlurModal: (stage: any) => void;
|
|
18
|
+
createTextarea: (stage: any, drawLayer: any, transformer: any, textNode: any, pubSub: PubSub) => HTMLTextAreaElement;
|
|
19
|
+
enableTransform: (drawEventParams: DrawEventParams, node: any) => void;
|
|
20
|
+
disableTransform: (drawEventParams: DrawEventParams, node: any, remove?: boolean) => void;
|
|
21
|
+
onEnter: (drawEventParams: DrawEventParams) => void;
|
|
22
|
+
onClick: (drawEventParams: DrawEventParams) => void;
|
|
23
|
+
onLeave: (drawEventParams: DrawEventParams) => void;
|
|
24
|
+
onNodeRecreate: (drawEventParams: DrawEventParams, node: any) => void;
|
|
25
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sansitech/react-img-editor",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Simple react image editor",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-img-editor",
|
|
7
|
+
"image-editor"
|
|
8
|
+
],
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"module": "lib/index.es.js",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"develop": "storybook dev -p 6006",
|
|
13
|
+
"build": "rollup -c",
|
|
14
|
+
"lint": "eslint .",
|
|
15
|
+
"prepare": "install-peers",
|
|
16
|
+
"predeploy": "storybook build",
|
|
17
|
+
"deploy": "gh-pages -d storybook-static"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"lib"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/hanyuzhou2006/react-img-editor.git"
|
|
25
|
+
},
|
|
26
|
+
"author": "Sebastian Sdorra <s.sdorra@cloudogu.com>",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/hanyuzhou2006/react-img-editor/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://hanyuzhou2006.github.com/react-img-editor",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/core": "^7.26.0",
|
|
34
|
+
"@babel/preset-env": "^7.26.0",
|
|
35
|
+
"@babel/preset-react": "^7.26.3",
|
|
36
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
37
|
+
"@eslint/js": "^9.39.2",
|
|
38
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
|
39
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
40
|
+
"@storybook/react": "^8.6.15",
|
|
41
|
+
"@storybook/react-webpack5": "^8.6.15",
|
|
42
|
+
"@storybook/addon-essentials": "^8.6.15",
|
|
43
|
+
"@storybook/addon-webpack5-compiler-swc": "^1.0.5",
|
|
44
|
+
"@storybook/blocks": "^8.6.15",
|
|
45
|
+
"@storybook/test": "^8.6.15",
|
|
46
|
+
"storybook": "^8.6.15",
|
|
47
|
+
"@types/pubsub-js": "^1.5.18",
|
|
48
|
+
"@types/react": "^18.3.27",
|
|
49
|
+
"@types/react-dom": "^18.3.7",
|
|
50
|
+
"babel-loader": "^9.2.1",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
52
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
53
|
+
"eslint": "^9.39.2",
|
|
54
|
+
"eslint-plugin-import": "^2.31.0",
|
|
55
|
+
"eslint-plugin-react": "^7.37.3",
|
|
56
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
57
|
+
"gh-pages": "^6.3.0",
|
|
58
|
+
"install": "^0.13.0",
|
|
59
|
+
"install-peers-cli": "^2.2.0",
|
|
60
|
+
"less": "^4.2.1",
|
|
61
|
+
"less-loader": "^12.2.0",
|
|
62
|
+
"postcss": "^8.4.49",
|
|
63
|
+
"prettier": "^3.4.2",
|
|
64
|
+
"rollup": "^4.30.1",
|
|
65
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
66
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
67
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
68
|
+
"tslib": "^2.8.1",
|
|
69
|
+
"typescript": "^5.7.3",
|
|
70
|
+
"typescript-eslint": "^8.25.0"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"konva": "^9.3.18",
|
|
74
|
+
"pubsub-js": "^1.9.4",
|
|
75
|
+
"rc-tooltip": "^6.4.0"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"react": "^18.0.0",
|
|
79
|
+
"react-dom": "^18.0.0"
|
|
80
|
+
},
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "public"
|
|
83
|
+
}
|
|
84
|
+
}
|