paint_box_react_native 0.1.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.
Files changed (82) hide show
  1. package/LICENSE +20 -0
  2. package/PaintBoxReactNative.podspec +20 -0
  3. package/README.md +161 -0
  4. package/android/build.gradle +70 -0
  5. package/android/gradle.properties +45 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/paintboxreactnative/NativeViewHandler.kt +26 -0
  8. package/android/src/main/java/com/paintboxreactnative/PaintBoxNativeView.kt +61 -0
  9. package/android/src/main/java/com/paintboxreactnative/PaintBoxNativeViewManager.kt +105 -0
  10. package/android/src/main/java/com/paintboxreactnative/PaintBoxReactNativeModule.kt +74 -0
  11. package/android/src/main/java/com/paintboxreactnative/PaintBoxReactNativePackage.kt +41 -0
  12. package/android/src/main/java/com/paintboxreactnative/dto/ColorDTO.kt +37 -0
  13. package/ios/PaintBoxReactNative.h +5 -0
  14. package/ios/PaintBoxReactNative.mm +21 -0
  15. package/lib/module/IPaintEditor.js +7 -0
  16. package/lib/module/IPaintEditor.js.map +1 -0
  17. package/lib/module/NativePaintBoxReactNative.js +5 -0
  18. package/lib/module/NativePaintBoxReactNative.js.map +1 -0
  19. package/lib/module/PaintBoxContext.js +50 -0
  20. package/lib/module/PaintBoxContext.js.map +1 -0
  21. package/lib/module/PaintBoxRNView.js +90 -0
  22. package/lib/module/PaintBoxRNView.js.map +1 -0
  23. package/lib/module/PaintBoxViewNativeComponent.ts +63 -0
  24. package/lib/module/PaintEditor.js +121 -0
  25. package/lib/module/PaintEditor.js.map +1 -0
  26. package/lib/module/dto/BaseDTO.js +8 -0
  27. package/lib/module/dto/BaseDTO.js.map +1 -0
  28. package/lib/module/dto/ColorDTO.js +33 -0
  29. package/lib/module/dto/ColorDTO.js.map +1 -0
  30. package/lib/module/index.js +6 -0
  31. package/lib/module/index.js.map +2 -0
  32. package/lib/module/model/Color.js +12 -0
  33. package/lib/module/model/Color.js.map +1 -0
  34. package/lib/module/model/MimeType.js +12 -0
  35. package/lib/module/model/MimeType.js.map +1 -0
  36. package/lib/module/model/PaintMode.js +11 -0
  37. package/lib/module/model/PaintMode.js.map +1 -0
  38. package/lib/module/model/index.js +6 -0
  39. package/lib/module/model/index.js.map +1 -0
  40. package/lib/module/package.json +1 -0
  41. package/lib/typescript/package.json +1 -0
  42. package/lib/typescript/src/IPaintEditor.d.ts +18 -0
  43. package/lib/typescript/src/IPaintEditor.d.ts.map +1 -0
  44. package/lib/typescript/src/NativePaintBoxReactNative.d.ts +11 -0
  45. package/lib/typescript/src/NativePaintBoxReactNative.d.ts.map +1 -0
  46. package/lib/typescript/src/PaintBoxContext.d.ts +18 -0
  47. package/lib/typescript/src/PaintBoxContext.d.ts.map +1 -0
  48. package/lib/typescript/src/PaintBoxRNView.d.ts +11 -0
  49. package/lib/typescript/src/PaintBoxRNView.d.ts.map +1 -0
  50. package/lib/typescript/src/PaintBoxViewNativeComponent.d.ts +24 -0
  51. package/lib/typescript/src/PaintBoxViewNativeComponent.d.ts.map +1 -0
  52. package/lib/typescript/src/PaintEditor.d.ts +22 -0
  53. package/lib/typescript/src/PaintEditor.d.ts.map +1 -0
  54. package/lib/typescript/src/dto/BaseDTO.d.ts +5 -0
  55. package/lib/typescript/src/dto/BaseDTO.d.ts.map +1 -0
  56. package/lib/typescript/src/dto/ColorDTO.d.ts +19 -0
  57. package/lib/typescript/src/dto/ColorDTO.d.ts.map +1 -0
  58. package/lib/typescript/src/index.d.ts +5 -0
  59. package/lib/typescript/src/index.d.ts.map +1 -0
  60. package/lib/typescript/src/model/Color.d.ts +8 -0
  61. package/lib/typescript/src/model/Color.d.ts.map +1 -0
  62. package/lib/typescript/src/model/MimeType.d.ts +9 -0
  63. package/lib/typescript/src/model/MimeType.d.ts.map +1 -0
  64. package/lib/typescript/src/model/PaintMode.d.ts +8 -0
  65. package/lib/typescript/src/model/PaintMode.d.ts.map +1 -0
  66. package/lib/typescript/src/model/index.d.ts +4 -0
  67. package/lib/typescript/src/model/index.d.ts.map +1 -0
  68. package/package.json +175 -0
  69. package/src/IPaintEditor.ts +32 -0
  70. package/src/NativePaintBoxReactNative.ts +20 -0
  71. package/src/PaintBoxContext.ts +67 -0
  72. package/src/PaintBoxRNView.tsx +98 -0
  73. package/src/PaintBoxViewNativeComponent.ts +63 -0
  74. package/src/PaintEditor.ts +152 -0
  75. package/src/dto/BaseDTO.ts +7 -0
  76. package/src/dto/ColorDTO.ts +44 -0
  77. package/src/index.ts +5 -0
  78. package/src/index.tsx +3 -0
  79. package/src/model/Color.ts +13 -0
  80. package/src/model/MimeType.ts +8 -0
  81. package/src/model/PaintMode.ts +7 -0
  82. package/src/model/index.ts +3 -0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ import uuid from 'react-native-uuid';
4
+ export class IPaintEditor {
5
+ id = uuid.v4();
6
+ }
7
+ //# sourceMappingURL=IPaintEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["uuid","IPaintEditor","id","v4"],"sourceRoot":"../../src","sources":["IPaintEditor.ts"],"mappings":";;AACA,OAAOA,IAAI,MAAM,mBAAmB;AAEpC,OAAO,MAAeC,YAAY,CAAC;EACjCC,EAAE,GAAuBF,IAAI,CAACG,EAAE,CAAC,CAAC;AA2BpC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('PaintBoxReactNative');
5
+ //# sourceMappingURL=NativePaintBoxReactNative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativePaintBoxReactNative.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAmBpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,qBAAqB,CAAC","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ export class PaintBoxContext {
4
+ listOfRef = [];
5
+ constructor() {}
6
+ static getInstance() {
7
+ if (!PaintBoxContext.instance) {
8
+ PaintBoxContext.instance = new PaintBoxContext();
9
+ }
10
+ return PaintBoxContext.instance;
11
+ }
12
+ getRef(controller) {
13
+ if (this.listOfRef.length > 1) {
14
+ if (controller) {
15
+ return this.foundedRef(controller);
16
+ } else {
17
+ throw new Error('Ref model must be required!');
18
+ }
19
+ } else {
20
+ if (controller) {
21
+ return this.foundedRef(controller);
22
+ } else {
23
+ return this.listOfRef[0]?.ref;
24
+ }
25
+ }
26
+ }
27
+ addRef(ref) {
28
+ if (ref) {
29
+ this.listOfRef.push(ref);
30
+ }
31
+ }
32
+ async clearRefs() {
33
+ this.listOfRef = [];
34
+ }
35
+ clearRef(ref) {
36
+ const foundedRef = this.foundedRef(ref);
37
+ if (!foundedRef) {
38
+ this.listOfRef = this.listOfRef.filter(model => ref.id === model.controller?.id);
39
+ }
40
+ }
41
+ foundedRef(refModel) {
42
+ const foundedRef = this.listOfRef.find(value => value?.controller === refModel)?.ref;
43
+ if (foundedRef) {
44
+ return foundedRef;
45
+ } else {
46
+ throw new Error('No map found with this id or ref!');
47
+ }
48
+ }
49
+ }
50
+ //# sourceMappingURL=PaintBoxContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PaintBoxContext","listOfRef","constructor","getInstance","instance","getRef","controller","length","foundedRef","Error","ref","addRef","push","clearRefs","clearRef","filter","model","id","refModel","find","value"],"sourceRoot":"../../src","sources":["PaintBoxContext.ts"],"mappings":";;AAQA,OAAO,MAAMA,eAAe,CAAC;EAE3BC,SAAS,GAAgC,EAAE;EAEnCC,WAAWA,CAAA,EAAG,CAAC;EAEvB,OAAcC,WAAWA,CAAA,EAAoB;IAC3C,IAAI,CAACH,eAAe,CAACI,QAAQ,EAAE;MAC7BJ,eAAe,CAACI,QAAQ,GAAG,IAAIJ,eAAe,CAAC,CAAC;IAClD;IACA,OAAOA,eAAe,CAACI,QAAQ;EACjC;EAEAC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xView from './PaintBoxViewNativeComponent';
4
+ import { StatusBar, StyleSheet, View } from 'react-native';
5
+ import { useEffect, useRef } from 'react';
6
+ import { PaintBoxContext } from "./PaintBoxContext.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export const PaintBoxRNView = ({
9
+ children,
10
+ style,
11
+ childrenPosition,
12
+ paintEditor,
13
+ onPaintBoxReady
14
+ }) => {
15
+ const ref = useRef(null);
16
+ const statusBarHeight = StatusBar.currentHeight;
17
+ useEffect(() => {
18
+ PaintBoxContext.getInstance().addRef({
19
+ ref: ref,
20
+ controller: paintEditor
21
+ });
22
+ return () => {
23
+ PaintBoxContext.getInstance().clearRef(paintEditor);
24
+ };
25
+ }, [paintEditor]);
26
+ return /*#__PURE__*/_jsxs(View, {
27
+ style: [styles.root, style],
28
+ children: [/*#__PURE__*/_jsx(View, {
29
+ style: childrenPosition === 'topLeft' ?
30
+ // eslint-disable-next-line react-native/no-inline-styles
31
+ {
32
+ position: 'absolute',
33
+ zIndex: 1,
34
+ top: statusBarHeight,
35
+ left: 12
36
+ } : childrenPosition === 'topRight' ?
37
+ // eslint-disable-next-line react-native/no-inline-styles
38
+ {
39
+ position: 'absolute',
40
+ zIndex: 1,
41
+ top: statusBarHeight,
42
+ right: 12
43
+ } : childrenPosition === 'bottomLeft' ? styles.childrenBottomLeft : styles.childrenBottomRight,
44
+ children: children
45
+ }), /*#__PURE__*/_jsx(PaintBoxView, {
46
+ ref: ref,
47
+ style: {
48
+ flex: 1
49
+ },
50
+ onPaintBoxReady: result => {
51
+ if (result.nativeEvent.result === true) {
52
+ onPaintBoxReady?.();
53
+ }
54
+ }
55
+ })]
56
+ });
57
+ };
58
+ const styles = StyleSheet.create({
59
+ root: {
60
+ position: 'relative',
61
+ flex: 1,
62
+ height: 'auto'
63
+ },
64
+ childrenTopLeft: {
65
+ position: 'absolute',
66
+ zIndex: 1,
67
+ top: 12,
68
+ left: 12
69
+ },
70
+ childrenTopRight: {
71
+ position: 'absolute',
72
+ zIndex: 1,
73
+ right: 6
74
+ },
75
+ childrenBottomRight: {
76
+ position: 'absolute',
77
+ zIndex: 1,
78
+ right: 6
79
+ },
80
+ childrenBottomLeft: {
81
+ position: 'absolute',
82
+ zIndex: 1,
83
+ left: 6
84
+ },
85
+ matchParent: {
86
+ width: '100%',
87
+ height: '100%'
88
+ }
89
+ });
90
+ //# sourceMappingURL=PaintBoxRNView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PaintBoxView","StatusBar","StyleSheet","View","useEffect","useRef","PaintBoxContext","jsx","_jsx","jsxs","_jsxs","PaintBoxRNView","children","style","childrenPosition","paintEditor","onPaintBoxReady","ref","statusBarHeight","currentHeight","getInstance","addRef","controller","clearRef","styles","root","position","zIndex","top","left","right","childrenBottomLeft","childrenBottomRight","flex","result","nativeEvent","create","height","childrenTopLeft","childrenTopRight","matchParent","width"],"sourceRoot":"../../src","sources":["PaintBoxRNView.tsx"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,+BAA+B;AACxD,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAwB,cAAc;AAC1E,SAASC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,eAAe,QAAQ,sBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAWpD,OAAO,MAAMC,cAA2C,GAAGA,CAAC;EAC1DC,QAAQ;EACRC,KAAK;EACLC,gBAAgB;EAChBC,WAAW;EACXC;AACiB,CAAC,KAAK;EACvB,MAAMC,GAAG,GAAGZ,MAAM,CAAwC,IAAI,CAAC;EAC/D,MAAMa,eAAe,GAAGjB,SAAS,CAACkB,aAAa;EAE/Cf,SAAS,CAAC,MAAM;IACdE,eAAe,CAACc,WAAW,CAAC,CAAC,CAACC,MAAM,CAAC;MACnCJ,GAAG,EAAEA,GAAG;MACRK,UAAU,EAAEP;IACd,CAAC,CAAC;IACF,OAAO,MAAM;MACXT,eAAe,CAAC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,gBAAgB,EAAE;IAChBb,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTG,KAAK,EAAE;EACT,CAAC;EACDE,mBAAmB,EAAE;IACnBN,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTG,KAAK,EAAE;EACT,CAAC;EACDC,kBAAkB,EAAE;IAClBL,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTE,IAAI,EAAE;EACR,CAAC;EACDW,WAAW,EAAE;IACXC,KAAK,EAAE,MAAM;IACbJ,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,63 @@
1
+ import {
2
+ type ViewProps,
3
+ codegenNativeCommands,
4
+ type HostComponent,
5
+ } from 'react-native';
6
+ import { codegenNativeComponent } from 'react-native';
7
+ // @ts-ignore
8
+ import type { DirectEventHandler, Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
9
+
10
+ type PaintBoxReadyEvent = {
11
+ result : boolean;
12
+ }
13
+
14
+ export interface NativeProps extends ViewProps {
15
+ onPaintBoxReady?: DirectEventHandler<PaintBoxReadyEvent>;
16
+ }
17
+
18
+ export type PaintBoxHostComponent = HostComponent<NativeProps>;
19
+
20
+ export type PaintBoxRef = React.ElementRef<PaintBoxHostComponent>;
21
+
22
+ interface NativeCommands {
23
+ undo: (viewRef: React.ElementRef<PaintBoxHostComponent>) => void;
24
+ redo: (viewRef: React.ElementRef<PaintBoxHostComponent>) => void;
25
+ reset: (viewRef: React.ElementRef<PaintBoxHostComponent>) => void;
26
+ importImage: (
27
+ viewRef: React.ElementRef<PaintBoxHostComponent>,
28
+ path: string,
29
+ width: Double,
30
+ height: Double
31
+ ) => void;
32
+ setEnable: (
33
+ viewRef: React.ElementRef<PaintBoxHostComponent>,
34
+ enable: boolean
35
+ ) => void;
36
+ setPaintMode: (
37
+ viewRef: React.ElementRef<PaintBoxHostComponent>,
38
+ paintMode: string
39
+ ) => void;
40
+ setStrokeColor: (
41
+ viewRef: React.ElementRef<PaintBoxHostComponent>,
42
+ color: string
43
+ ) => void;
44
+ setStrokeSize: (
45
+ viewRef: React.ElementRef<PaintBoxHostComponent>,
46
+ size: Double
47
+ ) => void;
48
+ }
49
+
50
+ export const Commands = codegenNativeCommands<NativeCommands>({
51
+ supportedCommands: [
52
+ 'undo',
53
+ 'redo',
54
+ 'reset',
55
+ 'importImage',
56
+ 'setEnable',
57
+ 'setPaintMode',
58
+ 'setStrokeColor',
59
+ 'setStrokeSize',
60
+ ],
61
+ });
62
+
63
+ export default codegenNativeComponent<NativeProps>('PaintBoxView');
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ import { PaintBoxContext } from "./PaintBoxContext.js";
4
+ import { Commands } from './PaintBoxViewNativeComponent';
5
+ import { PaintMode } from "./model/index.js";
6
+ import { ColorDTO } from "./dto/ColorDTO.js";
7
+ import NativePaintBoxReactNative from "./NativePaintBoxReactNative.js";
8
+ import { findNodeHandle } from 'react-native';
9
+ export class PaintEditor {
10
+ _ref() {
11
+ return PaintBoxContext.getInstance().getRef(this);
12
+ }
13
+ undo() {
14
+ const refObj = this._ref();
15
+ if (refObj?.current) {
16
+ Commands.undo(refObj.current);
17
+ }
18
+ }
19
+ redo() {
20
+ const refObj = this._ref();
21
+ if (refObj?.current) {
22
+ Commands.redo(refObj.current);
23
+ }
24
+ }
25
+ reset() {
26
+ const refObj = this._ref();
27
+ if (refObj?.current) {
28
+ Commands.reset(refObj.current);
29
+ }
30
+ }
31
+ import(path, width, height) {
32
+ const refObj = this._ref();
33
+ if (refObj?.current) {
34
+ Commands.importImage(refObj?.current, path, width ?? -1, height ?? -1);
35
+ }
36
+ }
37
+ export(path, fileName, mimeType) {
38
+ const refObj = this._ref();
39
+ if (refObj?.current) {
40
+ const viewTag = findNodeHandle(refObj.current);
41
+
42
+ // @ts-ignore
43
+ NativePaintBoxReactNative.export(viewTag, path, fileName, mimeType);
44
+ } else {
45
+ throw new Error('Reference not found! Please ensure that the paint box has been created.');
46
+ }
47
+ }
48
+ isEnable() {
49
+ const refObj = this._ref();
50
+ if (refObj?.current) {
51
+ const viewTag = findNodeHandle(refObj.current);
52
+ // @ts-ignore
53
+ return NativePaintBoxReactNative.isEnable(viewTag);
54
+ } else {
55
+ throw new Error('Reference not found! Please ensure that the paint box has been created.');
56
+ }
57
+ }
58
+ setEnable(value) {
59
+ const refObj = this._ref();
60
+ if (refObj?.current) {
61
+ Commands.setEnable(refObj?.current, value);
62
+ }
63
+ }
64
+ setPaintMode(paintMode) {
65
+ const refObj = this._ref();
66
+ if (refObj?.current) {
67
+ Commands.setPaintMode(refObj?.current, paintMode);
68
+ }
69
+ }
70
+ async getPaintMode() {
71
+ const refObj = this._ref();
72
+ if (refObj?.current) {
73
+ const viewTag = findNodeHandle(refObj.current);
74
+ // @ts-ignore
75
+ const response = await NativePaintBoxReactNative.getPaintMode(viewTag);
76
+ const paintMode = Object.values(PaintMode).find(it => it === response);
77
+ if (paintMode) {
78
+ return Promise.resolve(paintMode);
79
+ } else {
80
+ return Promise.reject(undefined);
81
+ }
82
+ } else {
83
+ throw new Error('Reference not found! Please ensure that the paint box has been created.');
84
+ }
85
+ }
86
+ setStrokeColor(strokeColor) {
87
+ const refObj = this._ref();
88
+ console.log("heree:", JSON.stringify(ColorDTO.fromDataModel(strokeColor).toJSON()));
89
+ if (refObj?.current) {
90
+ Commands.setStrokeColor(refObj?.current, JSON.stringify(ColorDTO.fromDataModel(strokeColor).toJSON()));
91
+ }
92
+ }
93
+ async getStrokeColor() {
94
+ const refObj = this._ref();
95
+ if (refObj?.current) {
96
+ const viewTag = findNodeHandle(refObj.current);
97
+ // @ts-ignore
98
+ const response = await NativePaintBoxReactNative.getStrokeColor(viewTag);
99
+ return Promise.resolve(ColorDTO.fromJSON(response).toDataModel());
100
+ } else {
101
+ throw new Error('Reference not found! Please ensure that the paint box has been created.');
102
+ }
103
+ }
104
+ setStrokeSize(size) {
105
+ const refObj = this._ref();
106
+ if (refObj?.current) {
107
+ Commands.setStrokeSize(refObj?.current, size);
108
+ }
109
+ }
110
+ getStrokeSize() {
111
+ const refObj = this._ref();
112
+ if (refObj?.current) {
113
+ const viewTag = findNodeHandle(refObj.current);
114
+ // @ts-ignore
115
+ return NativePaintBoxReactNative.getStrokeSize(viewTag);
116
+ } else {
117
+ throw new Error('Reference not found! Please ensure that the paint box has been created.');
118
+ }
119
+ }
120
+ }
121
+ //# sourceMappingURL=PaintEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PaintBoxContext","Commands","PaintMode","ColorDTO","NativePaintBoxReactNative","findNodeHandle","PaintEditor","_ref","getInstance","getRef","undo","refObj","current","redo","reset","import","path","width","height","importImage","export","fileName","mimeType","viewTag","Error","isEnable","setEnable","value","setPaintMode","paintMode","getPaintMode","response","Object","values","find","it","Promise","resolve","reject","undefined","setStrokeColor","strokeColor","console","log","JSON","stringify","fromDataModel","toJSON","getStrokeColor","fromJSON","toDataModel","setStrokeSize","size","getStrokeSize"],"sourceRoot":"../../src","sources":["PaintEditor.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,sBAAmB;AACnD,SAASC,QAAQ,QAA0B,+BAA+B;AAC1E,SAA0BC,SAAS,QAAQ,kBAAS;AACpD,SAASC,QAAQ,QAAQ,mBAAgB;AACzC,OAAOC,yBAAyB,MAAM,gCAA6B;AACnE,SAASC,cAAc,QAAQ,cAAc;AAG7C,OAAO,MAAMC,WAAW,CAAyB;EAG/CC,IAAIA,CAAA,EAAoD;IACtD,OAAOP,eAAe,CAACQ,WAAW,CAAC,CAAC,CAACC,MAAM,CAAC,IAAI,CAAC;EAInD;EAEAC,IAAIA,CAAA,EAAG;IACL,MAAMC,MAAM,GAAG,IAAI,CAACJ,IAAI,CAAC,CAAC;IAC1B,IAAII,MAAM,EAAEC,OAAO,EAAE;MACnBX,QAAQ,CAACS,IAAI,CAACC,MAAM,CAACC,OAAO,CAAC;IAC/B;EACF;EAEAC,IAAIA,CAAA,EAAG;IACL,MA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AM,CAACC,OAAO,CAAC;MAC9C;MACA,OAAOR,yBAAyB,CAACiD,aAAa,CAAC9B,OAAO,CAAC;IACzD,CAAC,MAAM;MACL,MAAM,IAAIC,KAAK,CACb,yEACF,CAAC;IACH;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ export class BaseDTO {
4
+ toJSONString() {
5
+ return JSON.stringify(this.toJSON());
6
+ }
7
+ }
8
+ //# sourceMappingURL=BaseDTO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseDTO","toJSONString","JSON","stringify","toJSON"],"sourceRoot":"../../../src","sources":["dto/BaseDTO.ts"],"mappings":";;AAAA,OAAO,MAAeA,OAAO,CAAC;EAG5BC,YAAYA,CAAA,EAAG;IACb,OAAOC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACC,MAAM,CAAC,CAAC,CAAC;EACtC;AACF","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ import { BaseDTO } from "./BaseDTO.js";
4
+ import { Color } from "../model/index.js";
5
+ export class ColorDTO extends BaseDTO {
6
+ alpha = 255.0;
7
+ constructor(red, green, blue, alpha) {
8
+ super();
9
+ this.red = red;
10
+ this.green = green;
11
+ this.blue = blue;
12
+ this.alpha = alpha;
13
+ }
14
+ static fromDataModel(color) {
15
+ return new ColorDTO(color.red, color.green, color.blue, color.alpha);
16
+ }
17
+ static fromJSON(json) {
18
+ const parsedJson = JSON.parse(json);
19
+ return new ColorDTO(parsedJson.red, parsedJson.green, parsedJson.blue, parsedJson.alpha);
20
+ }
21
+ toDataModel() {
22
+ return new Color(this.red, this.green, this.blue, this.alpha);
23
+ }
24
+ toJSON() {
25
+ return {
26
+ red: this.red,
27
+ green: this.green,
28
+ blue: this.blue,
29
+ alpha: this.alpha
30
+ };
31
+ }
32
+ }
33
+ //# sourceMappingURL=ColorDTO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseDTO","Color","ColorDTO","alpha","constructor","red","green","blue","fromDataModel","color","fromJSON","json","parsedJson","JSON","parse","toDataModel","toJSON"],"sourceRoot":"../../../src","sources":["dto/ColorDTO.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,cAAW;AACnC,SAASC,KAAK,QAAQ,mBAAU;AAEhC,OAAO,MAAMC,QAAQ,SAASF,OAAO,CAAC;EAIpCG,KAAK,GAAY,KAAK;EAEtBC,WAAWA,CAACC,GAAW,EAAEC,KAAa,EAAEC,IAAY,EAAEJ,KAAc,EAAE;IACpE,KAAK,CAAC,CAAC;IACP,IAAI,CAACE,GAAG,GAAGA,GAAG;IACd,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACJ,KAAK,GAAGA,KAAK;EACpB;EAEA,OAAOK,aAAaA,CAACC,KAAY,EAAE;IACjC,OAAO,IAAIP,QAAQ,CAACO,KAAK,CAACJ,GAAG,EAAEI,KAAK,CAACH,KAAK,EAAEG,KAAK,CAACF,IAAI,EAAEE,KAAK,CAACN,KAAK,CAAC;EACtE;EAEA,OAAOO,QAAQA,CAACC,IAAY,EAAE;IAC5B,MAAMC,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;IACnC,OAAO,IAAIT,QAAQ,CACjBU,UAAU,CAACP,GAAG,EACdO,UAAU,CAACN,KAAK,EAChBM,UAAU,CAACL,IAAI,EACfK,UAAU,CAACT,KACb,CAAC;EACH;EAEAY,WAAWA,CAAA,EAAU;IACnB,OAAO,IAAId,KAAK,CAAC,IAAI,CAACI,GAAG,EAAE,IAAI,CAACC,KAAK,EAAE,IAAI,CAACC,IAAI,EAAE,IAAI,CAACJ,KAAK,CAAC;EAC/D;EAEAa,MAAMA,CAAA,EAAG;IACP,OAAO;MACLX,GAAG,EAAE,IAAI,CAACA,GAAG;MACbC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,IAAI,EAAE,IAAI,CAACA,IAAI;MACfJ,KAAK,EAAE,IAAI,CAACA;IACd,CAAC;EACH;AACF","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ // export { PaintBoxRNView } from './PaintBoxRNView';
2
+ // export { default as PaintBoxView } from './PaintBoxViewNativeComponent';
3
+ // //
4
+ "use strict";
5
+ //# sourceMappingURL=index.js.map { default as PaintBoxView } from './PaintBoxViewNativeComponent';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA;AACA;AAAA","ignoreList":[]}
2
+ s"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAC3C,SAASC,cAAc,QAAQ,qBAAkB;AACjD;AACA,SAASC,OAAO,IAAIC,YAAY,QAAQ,+BAA+B","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ export class Color {
4
+ alpha = 255.0;
5
+ constructor(red, green, blue, alpha) {
6
+ this.red = red;
7
+ this.green = green;
8
+ this.blue = blue;
9
+ this.alpha = alpha ?? 255.0;
10
+ }
11
+ }
12
+ //# sourceMappingURL=Color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Color","alpha","constructor","red","green","blue"],"sourceRoot":"../../../src","sources":["model/Color.ts"],"mappings":";;AAAA,OAAO,MAAMA,KAAK,CAAC;EAIjBC,KAAK,GAAY,KAAK;EAEtBC,WAAWA,CAACC,GAAW,EAAEC,KAAa,EAAEC,IAAY,EAAEJ,KAAc,EAAE;IACpE,IAAI,CAACE,GAAG,GAAGA,GAAG;IACd,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACJ,KAAK,GAAGA,KAAK,IAAI,KAAK;EAC7B;AACF","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ export let MimeType = /*#__PURE__*/function (MimeType) {
4
+ MimeType["jpeg"] = "jpeg";
5
+ MimeType["png"] = "png";
6
+ MimeType["gif"] = "gif";
7
+ MimeType["tif"] = "tif";
8
+ MimeType["bmp"] = "bmp";
9
+ MimeType["pdf"] = "pdf";
10
+ return MimeType;
11
+ }({});
12
+ //# sourceMappingURL=MimeType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MimeType"],"sourceRoot":"../../../src","sources":["model/MimeType.ts"],"mappings":";;AAAA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ export let PaintMode = /*#__PURE__*/function (PaintMode) {
4
+ PaintMode["PEN"] = "PEN";
5
+ PaintMode["MARKER"] = "MARKER";
6
+ PaintMode["BUCKET"] = "BUCKET";
7
+ PaintMode["BRUSH"] = "BRUSH";
8
+ PaintMode["ERASER"] = "ERASER";
9
+ return PaintMode;
10
+ }({});
11
+ //# sourceMappingURL=PaintMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PaintMode"],"sourceRoot":"../../../src","sources":["model/PaintMode.ts"],"mappings":";;AAAA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ export { Color } from "./Color.js";
4
+ export { PaintMode } from "./PaintMode.js";
5
+ export { MimeType } from "./MimeType.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Color","PaintMode","MimeType"],"sourceRoot":"../../../src","sources":["model/index.ts"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,YAAS;AAC/B,SAASC,SAAS,QAAQ,gBAAa;AACvC,SAASC,QAAQ,QAAQ,eAAY","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,18 @@
1
+ import { Color, PaintMode } from './model';
2
+ export declare abstract class IPaintEditor {
3
+ id: string | undefined;
4
+ abstract undo(): void;
5
+ abstract redo(): void;
6
+ abstract reset(): void;
7
+ abstract import(path: string, width?: number, height?: number): void;
8
+ abstract export(path: string, fileName: string, mimeType: string): void;
9
+ abstract isEnable(): Promise<boolean>;
10
+ abstract setEnable(value: boolean): void;
11
+ abstract setPaintMode(paintMode: PaintMode): void;
12
+ abstract getPaintMode(): Promise<PaintMode>;
13
+ abstract setStrokeColor(strokeColor: Color): void;
14
+ abstract getStrokeColor(): Promise<Color>;
15
+ abstract setStrokeSize(size: number): void;
16
+ abstract getStrokeSize(): Promise<number>;
17
+ }
18
+ //# sourceMappingURL=IPaintEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPaintEditor.d.ts","sourceRoot":"","sources":["../../../src/IPaintEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAG3C,8BAAsB,YAAY;IAChC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAa;IAEnC,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB,QAAQ,CAAC,KAAK,IAAI,IAAI;IAEtB,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAEpE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAEvE,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAErC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAExC,QAAQ,CAAC,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAEjD,QAAQ,CAAC,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAE3C,QAAQ,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,GAAG,IAAI;IAEjD,QAAQ,CAAC,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC;IAEzC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAE1C,QAAQ,CAAC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAC1C"}
@@ -0,0 +1,11 @@
1
+ import { type TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ isEnable(viewTag: number | null): Promise<boolean>;
4
+ getPaintMode(viewTag: number | null): Promise<string>;
5
+ getStrokeColor(viewTag: number | null): Promise<string>;
6
+ getStrokeSize(viewTag: number | null): Promise<number>;
7
+ export: (viewTag: number | null, path: string, fileName: string, mimeType: string) => Promise<string>;
8
+ }
9
+ declare const _default: Spec;
10
+ export default _default;
11
+ //# sourceMappingURL=NativePaintBoxReactNative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativePaintBoxReactNative.d.ts","sourceRoot":"","sources":["../../../src/NativePaintBoxReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtD,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvD,MAAM,EAAE,CACN,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;;AAED,wBAA6E"}
@@ -0,0 +1,18 @@
1
+ import type { IPaintEditor } from './IPaintEditor';
2
+ import type { PaintEditor } from './PaintEditor';
3
+ export type PaintBoxContextModel = {
4
+ ref?: React.RefObject<any> | null;
5
+ controller?: IPaintEditor;
6
+ };
7
+ export declare class PaintBoxContext {
8
+ private static instance;
9
+ listOfRef: Array<PaintBoxContextModel>;
10
+ private constructor();
11
+ static getInstance(): PaintBoxContext;
12
+ getRef(controller?: PaintEditor): import("react").RefObject<any> | null | undefined;
13
+ addRef(ref?: PaintBoxContextModel): void;
14
+ clearRefs(): Promise<void>;
15
+ clearRef(ref: IPaintEditor): void;
16
+ private foundedRef;
17
+ }
18
+ //# sourceMappingURL=PaintBoxContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaintBoxContext.d.ts","sourceRoot":"","sources":["../../../src/PaintBoxContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B,CAAC;AAEF,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAM;IAE5C,OAAO;WAEO,WAAW,IAAI,eAAe;IAO5C,MAAM,CAAC,UAAU,CAAC,EAAE,WAAW;IAgB/B,MAAM,CAAC,GAAG,CAAC,EAAE,oBAAoB;IAM3B,SAAS;IAIf,QAAQ,CAAC,GAAG,EAAE,YAAY;IAS1B,OAAO,CAAC,UAAU;CAUnB"}
@@ -0,0 +1,11 @@
1
+ import { type ViewProps } from 'react-native';
2
+ import type { IPaintEditor } from './IPaintEditor';
3
+ export type PaintBoxViewProps = {
4
+ paintEditor: IPaintEditor;
5
+ style?: ViewProps;
6
+ children?: React.ReactNode;
7
+ onPaintBoxReady?: () => void;
8
+ childrenPosition?: 'topRight' | 'topLeft' | 'bottomRight' | 'bottomLeft';
9
+ };
10
+ export declare const PaintBoxRNView: React.FC<PaintBoxViewProps>;
11
+ //# sourceMappingURL=PaintBoxRNView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaintBoxRNView.d.ts","sourceRoot":"","sources":["../../../src/PaintBoxRNView.tsx"],"names":[],"mappings":"AACA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,YAAY,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,YAAY,CAAC;CAC1E,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuDtD,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type ViewProps, type HostComponent } from 'react-native';
2
+ import type { DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
3
+ type PaintBoxReadyEvent = {
4
+ result: boolean;
5
+ };
6
+ export interface NativeProps extends ViewProps {
7
+ onPaintBoxReady?: DirectEventHandler<PaintBoxReadyEvent>;
8
+ }
9
+ export type PaintBoxHostComponent = HostComponent<NativeProps>;
10
+ export type PaintBoxRef = React.ElementRef<PaintBoxHostComponent>;
11
+ interface NativeCommands {
12
+ undo: (viewRef: React.ElementRef<PaintBoxHostComponent>) => void;
13
+ redo: (viewRef: React.ElementRef<PaintBoxHostComponent>) => void;
14
+ reset: (viewRef: React.ElementRef<PaintBoxHostComponent>) => void;
15
+ importImage: (viewRef: React.ElementRef<PaintBoxHostComponent>, path: string, width: Double, height: Double) => void;
16
+ setEnable: (viewRef: React.ElementRef<PaintBoxHostComponent>, enable: boolean) => void;
17
+ setPaintMode: (viewRef: React.ElementRef<PaintBoxHostComponent>, paintMode: string) => void;
18
+ setStrokeColor: (viewRef: React.ElementRef<PaintBoxHostComponent>, color: string) => void;
19
+ setStrokeSize: (viewRef: React.ElementRef<PaintBoxHostComponent>, size: Double) => void;
20
+ }
21
+ export declare const Commands: NativeCommands;
22
+ declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
23
+ export default _default;
24
+ //# sourceMappingURL=PaintBoxViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaintBoxViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/PaintBoxViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAS,MAAM,2CAA2C,CAAC;AAEnG,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAG,OAAO,CAAC;CAClB,CAAA;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,eAAe,CAAC,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CAC1D;AAED,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAElE,UAAU,cAAc;IACtB,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;IACjE,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;IACjE,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;IAClE,WAAW,EAAE,CACX,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAChD,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,IAAI,CAAC;IACV,SAAS,EAAE,CACT,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAChD,MAAM,EAAE,OAAO,KACZ,IAAI,CAAC;IACV,YAAY,EAAE,CACZ,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAChD,SAAS,EAAE,MAAM,KACd,IAAI,CAAC;IACV,cAAc,EAAE,CACd,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAChD,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;IACV,aAAa,EAAE,CACb,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAChD,IAAI,EAAE,MAAM,KACT,IAAI,CAAC;CACX;AAED,eAAO,MAAM,QAAQ,gBAWnB,CAAC;;AAEH,wBAAmE"}
@@ -0,0 +1,22 @@
1
+ import { IPaintEditor } from './IPaintEditor';
2
+ import { type PaintBoxRef } from './PaintBoxViewNativeComponent';
3
+ import { Color, MimeType, PaintMode } from './model';
4
+ import React from 'react';
5
+ export declare class PaintEditor implements IPaintEditor {
6
+ id: string | undefined;
7
+ _ref(): React.RefObject<PaintBoxRef> | null | undefined;
8
+ undo(): void;
9
+ redo(): void;
10
+ reset(): void;
11
+ import(path: string, width?: number, height?: number): void;
12
+ export(path: string, fileName: string, mimeType: MimeType): void;
13
+ isEnable(): Promise<boolean>;
14
+ setEnable(value: boolean): void;
15
+ setPaintMode(paintMode: PaintMode): void;
16
+ getPaintMode(): Promise<PaintMode>;
17
+ setStrokeColor(strokeColor: Color): void;
18
+ getStrokeColor(): Promise<Color>;
19
+ setStrokeSize(size: number): void;
20
+ getStrokeSize(): Promise<number>;
21
+ }
22
+ //# sourceMappingURL=PaintEditor.d.ts.map