@archireport/react-native-svg-draw 3.1.0 → 3.2.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 +1 -1
- package/README.md +9 -2
- package/lib/commonjs/components/DrawCore/CurrentAnimatedItem.js +159 -148
- package/lib/commonjs/components/DrawCore/CurrentAnimatedItem.js.map +1 -1
- package/lib/commonjs/components/DrawCore/CurrentAnimatedText.js +18 -17
- package/lib/commonjs/components/DrawCore/CurrentAnimatedText.js.map +1 -1
- package/lib/commonjs/components/DrawCore/DrawPad.js +2 -2
- package/lib/commonjs/components/DrawCore/DrawPad.js.map +1 -1
- package/lib/commonjs/components/DrawCore/index.js +71 -19
- package/lib/commonjs/components/DrawCore/index.js.map +1 -1
- package/lib/commonjs/components/DrawCore/useDrawHook.js +7 -5
- package/lib/commonjs/components/DrawCore/useDrawHook.js.map +1 -1
- package/lib/commonjs/components/DrawWithOptions/index.js +6 -2
- package/lib/commonjs/components/DrawWithOptions/index.js.map +1 -1
- package/lib/commonjs/components/Slider/ColorSlider.js +18 -30
- package/lib/commonjs/components/Slider/ColorSlider.js.map +1 -1
- package/lib/commonjs/components/Slider/Sliders.js +1 -1
- package/lib/commonjs/components/Slider/Sliders.js.map +1 -1
- package/lib/commonjs/components/Slider/StrokeSlider.js +11 -23
- package/lib/commonjs/components/Slider/StrokeSlider.js.map +1 -1
- package/lib/module/components/DrawCore/CurrentAnimatedItem.js +158 -148
- package/lib/module/components/DrawCore/CurrentAnimatedItem.js.map +1 -1
- package/lib/module/components/DrawCore/CurrentAnimatedText.js +19 -18
- package/lib/module/components/DrawCore/CurrentAnimatedText.js.map +1 -1
- package/lib/module/components/DrawCore/DrawPad.js +2 -2
- package/lib/module/components/DrawCore/DrawPad.js.map +1 -1
- package/lib/module/components/DrawCore/index.js +71 -19
- package/lib/module/components/DrawCore/index.js.map +1 -1
- package/lib/module/components/DrawCore/useDrawHook.js +7 -5
- package/lib/module/components/DrawCore/useDrawHook.js.map +1 -1
- package/lib/module/components/DrawWithOptions/index.js +6 -2
- package/lib/module/components/DrawWithOptions/index.js.map +1 -1
- package/lib/module/components/Slider/ColorSlider.js +20 -32
- package/lib/module/components/Slider/ColorSlider.js.map +1 -1
- package/lib/module/components/Slider/Sliders.js +1 -1
- package/lib/module/components/Slider/Sliders.js.map +1 -1
- package/lib/module/components/Slider/StrokeSlider.js +13 -25
- package/lib/module/components/Slider/StrokeSlider.js.map +1 -1
- package/lib/typescript/components/DrawCore/CurrentAnimatedItem.d.ts +1 -0
- package/lib/typescript/components/DrawCore/CurrentAnimatedItem.d.ts.map +1 -1
- package/lib/typescript/components/DrawCore/CurrentAnimatedText.d.ts.map +1 -1
- package/lib/typescript/components/DrawCore/DrawPad.d.ts.map +1 -1
- package/lib/typescript/components/DrawCore/index.d.ts.map +1 -1
- package/lib/typescript/components/DrawCore/useDrawHook.d.ts.map +1 -1
- package/lib/typescript/components/DrawWithOptions/index.d.ts +3 -4
- package/lib/typescript/components/DrawWithOptions/index.d.ts.map +1 -1
- package/lib/typescript/components/Slider/ColorSlider.d.ts +2 -3
- package/lib/typescript/components/Slider/ColorSlider.d.ts.map +1 -1
- package/lib/typescript/components/Slider/Sliders.d.ts +2 -3
- package/lib/typescript/components/Slider/Sliders.d.ts.map +1 -1
- package/lib/typescript/components/Slider/StrokeSlider.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/DrawCore/CurrentAnimatedItem.tsx +285 -333
- package/src/components/DrawCore/CurrentAnimatedText.tsx +14 -11
- package/src/components/DrawCore/DrawPad.tsx +4 -1
- package/src/components/DrawCore/index.tsx +96 -29
- package/src/components/DrawCore/useDrawHook.tsx +6 -3
- package/src/components/DrawWithOptions/index.tsx +12 -4
- package/src/components/Slider/ColorSlider.tsx +42 -50
- package/src/components/Slider/Sliders.tsx +4 -4
- package/src/components/Slider/StrokeSlider.tsx +24 -33
- package/src/types.d.ts +5 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { sliderStyle, TRACK_R } from './sliderStyle';
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
|
-
import {
|
|
5
|
-
import Animated, { runOnJS,
|
|
4
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
5
|
+
import Animated, { runOnJS, useAnimatedStyle, useDerivedValue, useSharedValue } from 'react-native-reanimated';
|
|
6
6
|
import useDrawHook from '../DrawCore/useDrawHook';
|
|
7
7
|
const gradientColors = ['hsl(0, 100%, 100%) 00%', 'hsl(0, 100%, 50%) 10%', 'hsl(45, 100%, 50%) 20%', 'hsl(90, 100%, 50%) 30%', 'hsl(135, 100%, 50%) 40%', 'hsl(180, 100%, 50%) 50%', 'hsl(225, 100%, 50%) 60%', 'hsl(270, 100%, 50%) 70%', 'hsl(315, 100%, 50%) 80%', 'hsl(360, 100%, 50%) 90%', 'hsl(0, 100%, 0%) 100% '];
|
|
8
8
|
const gradientStart = {
|
|
@@ -22,6 +22,7 @@ const ColorSlider = _ref => {
|
|
|
22
22
|
color
|
|
23
23
|
} = useDrawHook();
|
|
24
24
|
const sliderWidth = useSharedValue(0);
|
|
25
|
+
const gestureStartX = useSharedValue(0);
|
|
25
26
|
const position = useDerivedValue(() => {
|
|
26
27
|
const hslRegExp = new RegExp(/hsl\(([\d.]+),\s*(\d+)%,\s*([\d.]+)%\)/);
|
|
27
28
|
const res = hslRegExp.exec(color.value);
|
|
@@ -34,51 +35,38 @@ const ColorSlider = _ref => {
|
|
|
34
35
|
return sliderWidth.value - sliderWidth.value * 0.1 / 50 * lum;
|
|
35
36
|
}
|
|
36
37
|
return Math.min(sliderWidth.value, Math.max(0, sliderWidth.value * 0.1 + tint * ((sliderWidth.value - sliderWidth.value * 0.2) / 360)));
|
|
37
|
-
}
|
|
38
|
+
});
|
|
38
39
|
const wrapperOnColorChange = () => {
|
|
39
40
|
onColorStrokeChange();
|
|
40
41
|
};
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} = _ref3;
|
|
52
|
-
let {
|
|
53
|
-
startX
|
|
54
|
-
} = _ref4;
|
|
55
|
-
const slidePos = Math.min(sliderWidth.value, startX + translationX);
|
|
56
|
-
if (slidePos < 0.1 * sliderWidth.value) {
|
|
57
|
-
color.value = `hsl(0, 100%, ${Math.min(100, 100 - slidePos / (0.1 * sliderWidth.value) * 50).toFixed(10)}%)`;
|
|
58
|
-
} else if (slidePos > 0.9 * sliderWidth.value) {
|
|
59
|
-
color.value = `hsl(0, 100%, ${Math.max(50 - (slidePos - 0.9 * sliderWidth.value) / (0.1 * sliderWidth.value) * 50, 0).toFixed(10)}%)`;
|
|
60
|
-
} else {
|
|
61
|
-
color.value = `hsl(${(slidePos - sliderWidth.value * 0.1) / (sliderWidth.value - sliderWidth.value * 0.2) * 360}, 100%, 50%)`;
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
onEnd: () => {
|
|
65
|
-
runOnJS(wrapperOnColorChange)();
|
|
42
|
+
const panGesture = Gesture.Pan().onStart(event => {
|
|
43
|
+
gestureStartX.value = event.x;
|
|
44
|
+
}).onUpdate(event => {
|
|
45
|
+
const slidePos = Math.min(sliderWidth.value, gestureStartX.value + event.translationX);
|
|
46
|
+
if (slidePos < 0.1 * sliderWidth.value) {
|
|
47
|
+
color.value = `hsl(0, 100%, ${Math.min(100, 100 - slidePos / (0.1 * sliderWidth.value) * 50).toFixed(10)}%)`;
|
|
48
|
+
} else if (slidePos > 0.9 * sliderWidth.value) {
|
|
49
|
+
color.value = `hsl(0, 100%, ${Math.max(50 - (slidePos - 0.9 * sliderWidth.value) / (0.1 * sliderWidth.value) * 50, 0).toFixed(10)}%)`;
|
|
50
|
+
} else {
|
|
51
|
+
color.value = `hsl(${(slidePos - sliderWidth.value * 0.1) / (sliderWidth.value - sliderWidth.value * 0.2) * 360}, 100%, 50%)`;
|
|
66
52
|
}
|
|
67
|
-
}
|
|
53
|
+
}).onEnd(() => {
|
|
54
|
+
runOnJS(wrapperOnColorChange)();
|
|
55
|
+
});
|
|
68
56
|
const style = useAnimatedStyle(() => {
|
|
69
57
|
return {
|
|
70
58
|
transform: [{
|
|
71
59
|
translateX: position.value - TRACK_R
|
|
72
60
|
}]
|
|
73
61
|
};
|
|
74
|
-
}
|
|
62
|
+
});
|
|
75
63
|
const onLayout = useCallback(event => {
|
|
76
64
|
sliderWidth.value = event.nativeEvent.layout.width;
|
|
77
65
|
}, [sliderWidth]);
|
|
78
66
|
return /*#__PURE__*/React.createElement(View, {
|
|
79
67
|
style: sliderStyle.container
|
|
80
|
-
}, /*#__PURE__*/React.createElement(
|
|
81
|
-
|
|
68
|
+
}, /*#__PURE__*/React.createElement(GestureDetector, {
|
|
69
|
+
gesture: panGesture
|
|
82
70
|
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
83
71
|
style: sliderStyle.container
|
|
84
72
|
}, /*#__PURE__*/React.createElement(LinearGradient, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sliderStyle","TRACK_R","React","useCallback","View","
|
|
1
|
+
{"version":3,"names":["sliderStyle","TRACK_R","React","useCallback","View","Gesture","GestureDetector","Animated","runOnJS","useAnimatedStyle","useDerivedValue","useSharedValue","useDrawHook","gradientColors","gradientStart","x","y","gradientEnd","ColorSlider","linearGradient","LinearGradient","onColorStrokeChange","color","sliderWidth","gestureStartX","position","hslRegExp","RegExp","res","exec","value","lum","parseFloat","tint","Math","min","max","wrapperOnColorChange","panGesture","Pan","onStart","event","onUpdate","slidePos","translationX","toFixed","onEnd","style","transform","translateX","onLayout","nativeEvent","layout","width","container","track","thumb"],"sourceRoot":"../../../../src","sources":["components/Slider/ColorSlider.tsx"],"mappings":"AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,eAAe;AACpD,OAAOC,KAAK,IAAIC,WAAW,QAAQ,OAAO;AA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F,oBAAC,QAAQ,CAAC,IAAI;IAAC,KAAK,EAAE,CAACvD,WAAW,CAACwD,KAAK,EAAET,KAAK;EAAE,EAAG,CACtC,CACA,CACb;AAEX,CAAC;AAED,eAAe7B,WAAW"}
|
|
@@ -57,7 +57,7 @@ const Sliders = _ref => {
|
|
|
57
57
|
borderWidth: strokeWidth.value,
|
|
58
58
|
borderColor: color.value
|
|
59
59
|
};
|
|
60
|
-
}
|
|
60
|
+
});
|
|
61
61
|
return /*#__PURE__*/React.createElement(View, {
|
|
62
62
|
style: styles.strokeContainer
|
|
63
63
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Animated","useAnimatedStyle","StrokeSlider","ColorSlider","useDrawHook","StyleSheet","styles","create","strokeContainer","flexDirection","marginTop","borderColor","borderRadius","height","borderWidth","marginHorizontal","maxWidth","alignSelf","strokeWrapper","flex","justifyContent","currentColorContainer","alignContent","padding","currentColor","width","colorContainer","Sliders","linearGradient","strokeWidth","color","styleStrokeColor","value"],"sourceRoot":"../../../../src","sources":["components/Slider/Sliders.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,
|
|
1
|
+
{"version":3,"names":["React","View","Animated","useAnimatedStyle","StrokeSlider","ColorSlider","useDrawHook","StyleSheet","styles","create","strokeContainer","flexDirection","marginTop","borderColor","borderRadius","height","borderWidth","marginHorizontal","maxWidth","alignSelf","strokeWrapper","flex","justifyContent","currentColorContainer","alignContent","padding","currentColor","width","colorContainer","Sliders","linearGradient","strokeWidth","color","styleStrokeColor","value"],"sourceRoot":"../../../../src","sources":["components/Slider/Sliders.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,QAAQ,IAAIC,gBAAgB,QAAQ,yBAAyB;AACpE,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,WAAW,MAAM,eA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EAEF,oBACE,oBAAC,IAAI;IAAC,KAAK,EAAE1B,MAAM,CAACE;EAAgB,gBAClC,oBAAC,IAAI;IAAC,KAAK,EAAEF,MAAM,CAACY;EAAc,gBAChC,oBAAC,YAAY;IAAC,QAAQ,EAAE,CAAE;IAAC,QAAQ,EAAE;EAAG,EAAG,CACtC,eACP,oBAAC,IAAI;IAAC,KAAK,EAAEZ,MAAM,CAACe;EAAsB,gBACxC,oBAAC,QAAQ,CAAC,IAAI;IAAC,KAAK,EAAE,CAACf,MAAM,CAACkB,YAAY,EAAEO,gBAAgB;EAAE,EAAG,CAC5D,eACP,oBAAC,IAAI;IAAC,KAAK,EAAEzB,MAAM,CAACoB;EAAe,gBACjC,oBAAC,WAAW;IAAC,cAAc,EAAEE;EAAe,EAAG,CAC1C,CACF;AAEX,CAAC;AAED,eAAeD,OAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import Animated, { runOnJS,
|
|
2
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
3
|
+
import Animated, { runOnJS, useAnimatedStyle, useDerivedValue, useSharedValue } from 'react-native-reanimated';
|
|
4
4
|
import { View } from 'react-native';
|
|
5
5
|
import { sliderStyle, TRACK_R } from './sliderStyle';
|
|
6
6
|
import useDrawHook from '../DrawCore/useDrawHook';
|
|
@@ -26,43 +26,31 @@ const StrokeSlider = _ref => {
|
|
|
26
26
|
strokeWidth
|
|
27
27
|
} = useDrawHook();
|
|
28
28
|
const sliderWidth = useSharedValue(0);
|
|
29
|
+
const gestureStartX = useSharedValue(0);
|
|
29
30
|
const position = useDerivedValue(() => {
|
|
30
31
|
return sliderWidth.value / (maxValue - minValue) * (strokeWidth.value - minValue);
|
|
31
32
|
});
|
|
32
33
|
const wrapperOnColorStrokeChange = () => {
|
|
33
34
|
onColorStrokeChange();
|
|
34
35
|
};
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
onActive: (_ref3, _ref4) => {
|
|
43
|
-
let {
|
|
44
|
-
translationX
|
|
45
|
-
} = _ref3;
|
|
46
|
-
let {
|
|
47
|
-
startX
|
|
48
|
-
} = _ref4;
|
|
49
|
-
strokeWidth.value = Math.min(maxValue, Math.max(minValue, (startX + translationX) / sliderWidth.value * (maxValue - minValue) + minValue));
|
|
50
|
-
},
|
|
51
|
-
onEnd: () => {
|
|
52
|
-
runOnJS(wrapperOnColorStrokeChange)();
|
|
53
|
-
}
|
|
54
|
-
}, []);
|
|
36
|
+
const panGesture = Gesture.Pan().onStart(event => {
|
|
37
|
+
gestureStartX.value = event.x;
|
|
38
|
+
}).onUpdate(event => {
|
|
39
|
+
strokeWidth.value = Math.min(maxValue, Math.max(minValue, (gestureStartX.value + event.translationX) / sliderWidth.value * (maxValue - minValue) + minValue));
|
|
40
|
+
}).onEnd(() => {
|
|
41
|
+
runOnJS(wrapperOnColorStrokeChange)();
|
|
42
|
+
});
|
|
55
43
|
const style = useAnimatedStyle(() => {
|
|
56
44
|
return {
|
|
57
45
|
transform: [{
|
|
58
46
|
translateX: position.value - TRACK_R
|
|
59
47
|
}]
|
|
60
48
|
};
|
|
61
|
-
}
|
|
49
|
+
});
|
|
62
50
|
return /*#__PURE__*/React.createElement(View, {
|
|
63
51
|
style: sliderStyle.container
|
|
64
|
-
}, /*#__PURE__*/React.createElement(
|
|
65
|
-
|
|
52
|
+
}, /*#__PURE__*/React.createElement(GestureDetector, {
|
|
53
|
+
gesture: panGesture
|
|
66
54
|
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
67
55
|
style: sliderStyle.container
|
|
68
56
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","Gesture","GestureDetector","Animated","runOnJS","useAnimatedStyle","useDerivedValue","useSharedValue","View","sliderStyle","TRACK_R","useDrawHook","SliderSvg","StyleSheet","styles","create","container","height","width","justifyContent","sliderBackground","maxHeight","StrokeSlider","minValue","maxValue","onColorStrokeChange","strokeWidth","sliderWidth","gestureStartX","position","value","wrapperOnColorStrokeChange","panGesture","Pan","onStart","event","x","onUpdate","Math","min","max","translationX","onEnd","style","transform","translateX","nativeEvent","layout","thumb"],"sourceRoot":"../../../../src","sources":["components/Slider/StrokeSlider.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,OAAO,EACPC,gBAAgB,EAChBC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAChC,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,WAAW,EAAEC,OAAO,QAAQ,eAAe;AACpD,OAAOC,WAAW,MAAM,yBAAyB;AACjD,OAAOC,SAAS,MAAM,8BAA8B;AACpD,SAASC,UAAU,QAAQ,cAAc;AAEzC,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAM,CAAC;EAC/BC,SAAS,EAAE;IACTC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE,MAAM;IACbC,cAAc,EAAE;EAClB,CAAC;EACDC,gBAAgB,EAAE;IAChBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC;AAEF,MAAMC,YAAY,GAAG,QAMf;EAAA,IANgB;IACpBC,QAAQ;IACRC;EAIF,CAAC;EACC,MAAM;IAAEC,mBAAmB;IAAEC;EAAY,CAAC,GAAGf,WAAW,EAAE;EAE1D,MAAMgB,WAAW,GAAGpB,cAAc,CAAC,CAAC,CAAC;EACrC,MAAMqB,aAAa,GAAGrB,cAAc,CAAC,CAAC,CAAC;EAEvC,MAAMsB,QAAQ,GAAGvB,eAAe,CAAC,MAAM;IACrC,OACGqB,WAAW,CAACG,KAAK,IAAIN,QAAQ,GAAGD,QAAQ,CAAC,IACzCG,WAAW,CAAEI,KAAK,GAAGP,QAAQ,CA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AM;IAC1B,KAAK,EAAEF,MAAM,CAACM;EAAiB,EAC/B,CACG,eACP,oBAAC,QAAQ,CAAC,IAAI;IAAC,KAAK,EAAE,CAACX,WAAW,CAACuC,KAAK,EAAEL,KAAK;EAAE,EAAG,CACtC,CACA,CACb;AAEX,CAAC;AACD,eAAerB,YAAY"}
|
|
@@ -2,4 +2,5 @@ import type { hslColor, Point } from '../../types';
|
|
|
2
2
|
export declare const pointsToPath: (points: Point[]) => string;
|
|
3
3
|
export declare function hslToRgb(col: hslColor): string;
|
|
4
4
|
export default function CurrentAnimatedItem(): JSX.Element;
|
|
5
|
+
export declare function DoubleArrowsTextInput(): JSX.Element;
|
|
5
6
|
//# sourceMappingURL=CurrentAnimatedItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentAnimatedItem.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/CurrentAnimatedItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CurrentAnimatedItem.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/CurrentAnimatedItem.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA4EnD,eAAO,MAAM,YAAY,WAAY,KAAK,EAAE,WAsB3C,CAAC;AAuBF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,QAAQ,UAwBrC;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,gBAwS1C;AAED,wBAAgB,qBAAqB,gBAuHpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentAnimatedText.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/CurrentAnimatedText.tsx"],"names":[],"mappings":"AAEA,OAAO,QAIN,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAiC5C;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,WAAW,EACX,cAAc,GACf,EAAE;IACD,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACnD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,
|
|
1
|
+
{"version":3,"file":"CurrentAnimatedText.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/CurrentAnimatedText.tsx"],"names":[],"mappings":"AAEA,OAAO,QAIN,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAiC5C;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,WAAW,EACX,cAAc,GACf,EAAE;IACD,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACnD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,eA+EA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawPad.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/DrawPad.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"DrawPad.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/DrawPad.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAOpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,QAAA,MAAM,OAAO;iBAQE,SAAS,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC;eACvC,MAAM,QAAQ,CAAC;wBACN,QAAQ,SAAS,MAAM,KAAK,MAAM,IAAI;iCAC7B,MAAM,KAAK,IAAI;;;iBA4F7C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,kBAAkB,EAClB,cAAc,EAEf,MAAM,cAAc,CAAC;AAkNtB,QAAA,MAAM,QAAQ;;;mCAOkB,MAAM,KAAK,QAAQ,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,kBAAkB,EAClB,cAAc,EAEf,MAAM,cAAc,CAAC;AAkNtB,QAAA,MAAM,QAAQ;;;mCAOkB,MAAM,KAAK,QAAQ,IAAI,CAAC;iBA2rCvD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawHook.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/useDrawHook.tsx"],"names":[],"mappings":";;AAGA,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useDrawHook.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawCore/useDrawHook.tsx"],"names":[],"mappings":";;AAGA,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;CA0EhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ImageRequireSource, ImageURISource } from 'react-native';
|
|
3
|
+
import type { LinearGradientComponentProps } from '../../types';
|
|
3
4
|
type DrawWithOptionsProps = {
|
|
4
|
-
linearGradient: React.ComponentType<
|
|
5
|
-
colors: any[];
|
|
6
|
-
} & ViewProps>;
|
|
5
|
+
linearGradient: React.ComponentType<LinearGradientComponentProps>;
|
|
7
6
|
image?: ImageRequireSource | ImageURISource;
|
|
8
7
|
close?: () => void;
|
|
9
8
|
actionWithSnapShotUri?: (uri: string) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAIL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAIL,kBAAkB,EAClB,cAAc,EAEf,MAAM,cAAc,CAAC;AAgBtB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAmDhE,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;IAClE,KAAK,CAAC,EAAE,kBAAkB,GAAG,cAAc,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAwPF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAMlE"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import type { LinearGradientType } from '../../types';
|
|
2
|
+
import type { LinearGradientComponentProps } from '../../types';
|
|
4
3
|
declare const ColorSlider: ({ linearGradient: LinearGradient, }: {
|
|
5
|
-
linearGradient: React.ComponentType<
|
|
4
|
+
linearGradient: React.ComponentType<LinearGradientComponentProps>;
|
|
6
5
|
}) => JSX.Element;
|
|
7
6
|
export default ColorSlider;
|
|
8
7
|
//# sourceMappingURL=ColorSlider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSlider.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/ColorSlider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorSlider.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/ColorSlider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAU3C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAoBhE,QAAA,MAAM,WAAW,wCAEd;IACD,cAAc,EAAE,MAAM,aAAa,CAAC,4BAA4B,CAAC,CAAC;CACnE,gBAkGA,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import type { LinearGradientType } from '../../types';
|
|
2
|
+
import type { LinearGradientComponentProps } from '../../types';
|
|
4
3
|
declare const Sliders: ({ linearGradient, }: {
|
|
5
|
-
linearGradient: React.ComponentType<
|
|
4
|
+
linearGradient: React.ComponentType<LinearGradientComponentProps>;
|
|
6
5
|
}) => JSX.Element;
|
|
7
6
|
export default Sliders;
|
|
8
7
|
//# sourceMappingURL=Sliders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sliders.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/Sliders.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Sliders.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/Sliders.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAwChE,QAAA,MAAM,OAAO;oBAGK,MAAM,aAAa,CAAC,4BAA4B,CAAC;iBAwBlE,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StrokeSlider.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/StrokeSlider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StrokeSlider.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/StrokeSlider.tsx"],"names":[],"mappings":"AAyBA,QAAA,MAAM,YAAY;cAIN,MAAM;cACN,MAAM;iBA+DjB,CAAC;AACF,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED