reanimated-color-picker 0.0.21 → 0.0.22

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/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "reanimated-color-picker",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Pure JavaScript color picker for react-native",
5
- "main": "lib/index.js",
6
- "source": "lib/index.js",
7
- "types": "lib/index.d.ts",
5
+ "main": "src/index.js",
6
+ "types": "src/index.d.ts",
8
7
  "scripts": {
9
- "publish": "npm run build && npm publish",
10
- "build": "@powershell if(test-path lib){ rm lib -r } && babel src --out-dir lib --copy-files"
8
+ "build": "@powershell if(test-path src/Web){ rm src/Web -r } && babel src/Native --out-dir src/Web",
9
+ "prepublishOnly": "npm run build"
11
10
  },
12
11
  "keywords": [
13
12
  "react-native",
package/readme.md CHANGED
@@ -42,11 +42,11 @@
42
42
 
43
43
  - Use the links below to follow the installation instructions.
44
44
 
45
- - [react-native-gesture-handler](https://docs.swmansion.com/react-native-gesture-handler/docs/installation).
45
+ - [react-native-gesture-handler](https://docs.swmansion.com/react-native-gesture-handler/docs/installation) version `2.0.0` or higher.
46
46
 
47
- - [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation).
47
+ - [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation) version `2.0.0` or higher.
48
48
 
49
- - For `expo` platform, version `44` or higher is required.
49
+ - For `Expo` manged workflow version `44` or higher is required.
50
50
 
51
51
  # :small_blue_diamond:Installation
52
52
 
@@ -64,7 +64,10 @@ npm i reanimated-color-picker
64
64
  - You can add, remove, rearrange or style the color picker's built-in components.
65
65
  - You can also add your components.
66
66
 
67
- - Check out the working example, for bare workflow [here](https://github.com/alabsi91/reanimated-color-picker/tree/main/Example), for Expo managed workflow [here](https://github.com/alabsi91/reanimated-color-picker/tree/main/ExampleExpo)
67
+ - Check out the working examples:
68
+ - Bare workflow [here](https://github.com/alabsi91/reanimated-color-picker/tree/main/Example)
69
+ - Expo managed workflow [here](https://github.com/alabsi91/reanimated-color-picker/tree/main/ExampleExpo)
70
+ - Expo snack [here](https://snack.expo.dev/@alabsi91/reanimated-color-picker)
68
71
 
69
72
  ```jsx
70
73
  import React, { useState } from 'react';
@@ -276,4 +279,4 @@ export default function App() {
276
279
 
277
280
  # :small_blue_diamond:License
278
281
 
279
- - [**MIT**](https://github.com/alabsi91/reanimated-color-picker/blob/main/LICENSE)
282
+ - Reanimated Color Picker library is licensed under [**The MIT License.**](https://github.com/alabsi91/reanimated-color-picker/blob/main/LICENSE)
package/src/index.js ADDED
@@ -0,0 +1,48 @@
1
+ import { Platform } from 'react-native';
2
+
3
+ const { default: ColorPicker } = Platform.select({
4
+ native: () => require('./Native/ColorPicker.js'),
5
+ default: () => require('./Web/ColorPicker.js'),
6
+ })();
7
+
8
+ export default ColorPicker;
9
+
10
+ export const { Panel1 } = Platform.select({
11
+ native: () => require('./Native/components/Panel1.js'),
12
+ default: () => require('./Web/components/Panel1.js'),
13
+ })();
14
+
15
+ export const { Panel2 } = Platform.select({
16
+ native: () => require('./Native/components/Panel2.js'),
17
+ default: () => require('./Web/components/Panel2.js'),
18
+ })();
19
+
20
+ export const { Preview } = Platform.select({
21
+ native: () => require('./Native/components/Preview.js'),
22
+ default: () => require('./Web/components/Preview.js'),
23
+ })();
24
+
25
+ export const { HueSlider } = Platform.select({
26
+ native: () => require('./Native/components/HueSlider.js'),
27
+ default: () => require('./Web/components/HueSlider.js'),
28
+ })();
29
+
30
+ export const { SaturationSlider } = Platform.select({
31
+ native: () => require('./Native/components/SaturationSlider.js'),
32
+ default: () => require('./Web/components/SaturationSlider.js'),
33
+ })();
34
+
35
+ export const { BrightnessSlider } = Platform.select({
36
+ native: () => require('./Native/components/BrightnessSlider.js'),
37
+ default: () => require('./Web/components/BrightnessSlider.js'),
38
+ })();
39
+
40
+ export const { OpacitySlider } = Platform.select({
41
+ native: () => require('./Native/components/OpacitySlider.js'),
42
+ default: () => require('./Web/components/OpacitySlider.js'),
43
+ })();
44
+
45
+ export const { Swatches } = Platform.select({
46
+ native: () => require('./Native/components/Swatches.js'),
47
+ default: () => require('./Web/components/Swatches.js'),
48
+ })();
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=ColorPicker;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=require("react-native-reanimated");var _ColorsConversionFormulas=require("./ColorsConversionFormulas");var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\ColorPicker.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isRtl=_reactNative.I18nManager.isRTL,CONTRAST_RATIO_MIN=4.5;function ColorPicker(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$tracksHeight=_ref.tracksHeight,tracksHeight=_ref$tracksHeight===void 0?25:_ref$tracksHeight,_ref$thumbsSize=_ref.thumbsSize,thumbsSize=_ref$thumbsSize===void 0?25*1.4:_ref$thumbsSize,_ref$value=_ref.value,value=_ref$value===void 0?'#418181':_ref$value,onChange=_ref.onChange,onComplete=_ref.onComplete,_ref$width=_ref.width,width=_ref$width===void 0?300:_ref$width,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style,_ref$children=_ref.children,children=_ref$children===void 0?_react.default.createElement(_reactNative.Text,{__self:this,__source:{fileName:_jsxFileName,lineNumber:29,columnNumber:14}},"NO CHILDREN"):_ref$children;var isFirstRender=(0,_react.useRef)(true);var initialColor=(0,_react.useRef)((0,_ColorsConversionFormulas.COLOR_HSVA)(value));var previewColorFormat=(0,_react.useRef)('hex');var panel1ThumbeSize=(0,_react.useRef)(thumbsSize);var panel2ThumbeSize=(0,_react.useRef)(thumbsSize);var hueThumbeSize=(0,_react.useRef)(thumbsSize);var brightnessThumbeSize=(0,_react.useRef)(thumbsSize);var saturationThumbeSize=(0,_react.useRef)(thumbsSize);var opacityThumbeSize=(0,_react.useRef)(thumbsSize);var hue=(0,_react.useRef)(initialColor.current.h);var saturation=(0,_react.useRef)(initialColor.current.s);var brightness=(0,_react.useRef)(initialColor.current.b);var alpha=(0,_react.useRef)(initialColor.current.a);var color_hsl=function color_hsl(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current};var _HSV_HSL=(0,_ColorsConversionFormulas.HSV_HSL)(color.h,color.s,color.b),h=_HSV_HSL.h,s=_HSV_HSL.s,l=_HSV_HSL.l;return"hsl("+h+", "+s+"%, "+l+"%)";};var color_hsla=function color_hsla(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current,a:alpha.current};var _HSV_HSL2=(0,_ColorsConversionFormulas.HSV_HSL)(color.h,color.s,color.b),h=_HSV_HSL2.h,s=_HSV_HSL2.s,l=_HSV_HSL2.l;return"hsla("+h+", "+s+"%, "+l+"%, "+color.a/100+")";};var color_hex=function color_hex(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current,a:alpha.current};var _HSV_HSL3=(0,_ColorsConversionFormulas.HSV_HSL)(color.h,color.s,color.b),h=_HSV_HSL3.h,s=_HSV_HSL3.s,l=_HSV_HSL3.l;return(0,_ColorsConversionFormulas.HSL_HEX)(h,s,l)+(color.a===100?'':(0,_ColorsConversionFormulas.ALPHA_HEX)(color.a));};var color_rgb=function color_rgb(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current};var _HSV_HSL4=(0,_ColorsConversionFormulas.HSV_HSL)(color.h,color.s,color.b),h=_HSV_HSL4.h,s=_HSV_HSL4.s,l=_HSV_HSL4.l;var _HSL_RGB=(0,_ColorsConversionFormulas.HSL_RGB)(h,s,l),r=_HSL_RGB.r,g=_HSL_RGB.g,b=_HSL_RGB.b;return"rgb("+r+", "+g+", "+b+")";};var color_rgba=function color_rgba(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current,a:alpha.current};var _HSV_HSL5=(0,_ColorsConversionFormulas.HSV_HSL)(color.h,color.s,color.b),h=_HSV_HSL5.h,s=_HSV_HSL5.s,l=_HSV_HSL5.l;var _HSL_RGB2=(0,_ColorsConversionFormulas.HSL_RGB)(h,s,l),r=_HSL_RGB2.r,g=_HSL_RGB2.g,b=_HSL_RGB2.b;return"rgba("+r+", "+g+", "+b+", "+color.a/100+")";};var color_hsv=function color_hsv(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current};return"hsv("+color.h+", "+color.s+"%, "+color.b+"%)";};var color_hsva=function color_hsva(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current,a:alpha.current};return"hsva("+color.h+", "+color.s+"%, "+color.b+"%, "+color.a/100+")";};var returnedResults=function returnedResults(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{h:hue.current,s:saturation.current,b:brightness.current,a:alpha.current};return{hex:color_hex(color),rgb:color_rgb(color),rgba:color_rgba(color),hsl:color_hsl(color),hsla:color_hsla(color),hsv:color_hsv(color),hsva:color_hsva(color)};};var previewColor=(0,_reactNativeReanimated.useSharedValue)(color_hex());var previewColorStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{backgroundColor:previewColor.value};};_f._closure={previewColor:previewColor};_f.asString="function _f(){const{previewColor}=jsThis._closure;{return{backgroundColor:previewColor.value};}}";_f.__workletHash=9056204683932;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\ColorPicker.js (130:45)";_f.__optimalization=3;return _f;}());var previewColorWithoutOpacity=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{backgroundColor:previewColor.value.length>7?previewColor.value.substring(0,7):previewColor.value};};_f._closure={previewColor:previewColor};_f.asString="function _f(){const{previewColor}=jsThis._closure;{return{backgroundColor:previewColor.value.length>7?previewColor.value.substring(0,7):previewColor.value};}}";_f.__workletHash=14945317885047;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\ColorPicker.js (133:54)";_f.__optimalization=2;return _f;}());var activeHue=(0,_reactNativeReanimated.useSharedValue)((0,_ColorsConversionFormulas.HSL_HEX)(hue.current,100,50));var activeHueStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{backgroundColor:activeHue.value};};_f._closure={activeHue:activeHue};_f.asString="function _f(){const{activeHue}=jsThis._closure;{return{backgroundColor:activeHue.value};}}";_f.__workletHash=650278191484;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\ColorPicker.js (140:42)";_f.__optimalization=3;return _f;}());var saturationPanel1_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var brightnessPanel1_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var huePanel2_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var saturationPanel2_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var hue_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var saturationSlider_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var brightnessSlider_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var opacity_handlePos=(0,_reactNativeReanimated.useSharedValue)(0);var previewTextColor=(0,_reactNativeReanimated.useSharedValue)('#ffffff');var previewText=(0,_reactNativeReanimated.useSharedValue)(returnedResults()[previewColorFormat.current]);var previewTextColorStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{color:previewTextColor.value};};_f._closure={previewTextColor:previewTextColor};_f.asString="function _f(){const{previewTextColor}=jsThis._closure;{return{color:previewTextColor.value};}}";_f.__workletHash=12175148497234;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\ColorPicker.js (159:49)";_f.__optimalization=3;return _f;}());var onGestureEventFinish=function onGestureEventFinish(){onComplete==null?void 0:onComplete(returnedResults());};var updateBrightness=function updateBrightness(brightnessChannel){brightness.current=brightnessChannel;previewColor.value=color_hex();previewText.value=returnedResults()[previewColorFormat.current];var contrast=(0,_ColorsConversionFormulas.CONTRAST_RATIO)(hue.current,saturation.current,brightness.current,previewTextColor.value);previewTextColor.value=contrast<CONTRAST_RATIO_MIN?previewTextColor.value==='#ffffff'?'#000000':'#ffffff':previewTextColor.value;onChange==null?void 0:onChange(returnedResults());};var updateSaturation=function updateSaturation(saturationChannel){saturation.current=saturationChannel;previewColor.value=color_hex();previewText.value=returnedResults()[previewColorFormat.current];var contrast=(0,_ColorsConversionFormulas.CONTRAST_RATIO)(hue.current,saturation.current,brightness.current,previewTextColor.value);previewTextColor.value=contrast<CONTRAST_RATIO_MIN?previewTextColor.value==='#ffffff'?'#000000':'#ffffff':previewTextColor.value;onChange==null?void 0:onChange(returnedResults());};var updateSB=function updateSB(saturationChannel,brightnessChannel){saturation.current=saturationChannel;brightness.current=brightnessChannel;previewColor.value=color_hex();previewText.value=returnedResults()[previewColorFormat.current];var contrast=(0,_ColorsConversionFormulas.CONTRAST_RATIO)(hue.current,saturation.current,brightness.current,previewTextColor.value);previewTextColor.value=contrast<CONTRAST_RATIO_MIN?previewTextColor.value==='#ffffff'?'#000000':'#ffffff':previewTextColor.value;onChange==null?void 0:onChange(returnedResults());};var updateHS=function updateHS(hueChannel,saturationChannel){saturation.current=saturationChannel;hue.current=hueChannel;previewColor.value=color_hex();previewText.value=returnedResults()[previewColorFormat.current];var contrast=(0,_ColorsConversionFormulas.CONTRAST_RATIO)(hue.current,saturation.current,brightness.current,previewTextColor.value);previewTextColor.value=contrast<CONTRAST_RATIO_MIN?previewTextColor.value==='#ffffff'?'#000000':'#ffffff':previewTextColor.value;activeHue.value=(0,_ColorsConversionFormulas.HSL_HEX)(hueChannel,100,50);onChange==null?void 0:onChange(returnedResults());};var updateHue=function updateHue(hueChannel){hue.current=hueChannel;previewColor.value=color_hex();previewText.value=returnedResults()[previewColorFormat.current];var contrast=(0,_ColorsConversionFormulas.CONTRAST_RATIO)(hue.current,saturation.current,brightness.current,previewTextColor.value);previewTextColor.value=contrast<CONTRAST_RATIO_MIN?previewTextColor.value==='#ffffff'?'#000000':'#ffffff':previewTextColor.value;activeHue.value=(0,_ColorsConversionFormulas.HSL_HEX)(hueChannel,100,50);onChange==null?void 0:onChange(returnedResults());};var updateOpacity=function updateOpacity(alphaChannel){alpha.current=alphaChannel;previewColor.value=color_hex();previewText.value=returnedResults()[previewColorFormat.current];onChange==null?void 0:onChange(returnedResults());};var setHandlesPos=function setHandlesPos(){var duration=100;var _initialColor$current=initialColor.current,h=_initialColor$current.h,s=_initialColor$current.s,b=_initialColor$current.b,a=_initialColor$current.a;hue.current=h;saturation.current=s;brightness.current=b;alpha.current=a;previewColor.value=color_hex();previewText.value=returnedResults()[previewColorFormat.current];activeHue.value=(0,_ColorsConversionFormulas.HSL_HEX)(h,100,50);var contrast=(0,_ColorsConversionFormulas.CONTRAST_RATIO)(hue.current,saturation.current,brightness.current,previewTextColor.value);previewTextColor.value=contrast<CONTRAST_RATIO_MIN?previewTextColor.value==='#ffffff'?'#000000':'#ffffff':previewTextColor.value;saturationPanel1_handlePos.value=(0,_reactNativeReanimated.withTiming)(isRtl?s/100*width-width+panel1ThumbeSize.current/2:s/100*width-panel1ThumbeSize.current/2,duration);saturationPanel2_handlePos.value=(0,_reactNativeReanimated.withTiming)(width-s/100*width-panel2ThumbeSize.current/2,duration);saturationSlider_handlePos.value=(0,_reactNativeReanimated.withTiming)(isRtl?s/100*width-width+saturationThumbeSize.current/2:s/100*width-saturationThumbeSize.current/2,duration);brightnessPanel1_handlePos.value=(0,_reactNativeReanimated.withTiming)(width-b/100*width-panel1ThumbeSize.current/2,duration);brightnessSlider_handlePos.value=(0,_reactNativeReanimated.withTiming)(isRtl?b/100*width-width+brightnessThumbeSize.current/2:b/100*width-brightnessThumbeSize.current/2,duration);hue_handlePos.value=(0,_reactNativeReanimated.withTiming)(isRtl?width-h/360*width-width+hueThumbeSize.current/2:width-h/360*width-hueThumbeSize.current/2,100);huePanel2_handlePos.value=(0,_reactNativeReanimated.withTiming)(isRtl?h/360*width-width+panel2ThumbeSize.current/2:h/360*width-panel2ThumbeSize.current/2,duration);opacity_handlePos.value=(0,_reactNativeReanimated.withTiming)(isRtl?a/100*width-width+opacityThumbeSize.current/2:a/100*width-opacityThumbeSize.current/2,duration);};(0,_react.useEffect)(function(){if(isFirstRender.current){isFirstRender.current=false;setHandlesPos();return;}initialColor.current=(0,_ColorsConversionFormulas.COLOR_HSVA)(value);setHandlesPos();},[value,width]);var RenderChildren=function RenderChildren(){return _react.default.Children.map(children,function(child){return _react.default.isValidElement(child)?_react.default.cloneElement(child,(0,_extends2.default)({activeHueStyle:activeHueStyle,previewText:previewText,previewTextColor:previewTextColor,previewTextColorStyle:previewTextColorStyle,previewColorStyle:previewColorStyle,previewColorWithoutOpacity:previewColorWithoutOpacity,previewColorFormat:previewColorFormat,setHandlesPos:setHandlesPos,saturationPanel1_handlePos:saturationPanel1_handlePos,brightnessPanel1_handlePos:brightnessPanel1_handlePos,saturationPanel2_handlePos:saturationPanel2_handlePos,huePanel2_handlePos:huePanel2_handlePos,saturationSlider_handlePos:saturationSlider_handlePos,brightnessSlider_handlePos:brightnessSlider_handlePos,hue_handlePos:hue_handlePos,opacity_handlePos:opacity_handlePos,updateSaturation:updateSaturation,updateBrightness:updateBrightness,updateSB:updateSB,updateHS:updateHS,updateOpacity:updateOpacity,updateHue:updateHue,tracksHeight:tracksHeight,thumbsSize:thumbsSize,panel1ThumbeSize:panel1ThumbeSize,panel2ThumbeSize:panel2ThumbeSize,saturationThumbeSize:saturationThumbeSize,brightnessThumbeSize:brightnessThumbeSize,hueThumbeSize:hueThumbeSize,opacityThumbeSize:opacityThumbeSize,value:value,width:width,initialColor:initialColor,returnedResults:returnedResults,onGestureEventFinish:onGestureEventFinish,onChange:onChange,onComplete:onComplete},child.props)):null;});};var ColorPickerModules=(0,_react.useMemo)(function(){return RenderChildren();},[]);return _react.default.createElement(_reactNativeGestureHandler.GestureHandlerRootView,{style:[styles.wrapper,style],__self:this,__source:{fileName:_jsxFileName,lineNumber:426,columnNumber:5}},ColorPickerModules);}var styles=_reactNative.StyleSheet.create({wrapper:{flexDirection:'column',justifyContent:'space-evenly',alignSelf:'center',flex:1}});
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.RGB_HSV=exports.HSV_HSL=exports.HSL_RGB=exports.HSL_HSV=exports.HSL_HEX=exports.HEX_RGB=exports.HEX_HSV=exports.CONTRAST_RATIO=exports.COLOR_HSVA=exports.ALPHA_HEX=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _NamedColors=_interopRequireDefault(require("./NamedColors"));var HSL_RGB=function HSL_RGB(h,s,l){s/=100;l/=100;var k=function k(n){return(n+h/30)%12;};var a=s*Math.min(l,1-l);var f=function f(n){return l-a*Math.max(-1,Math.min(k(n)-3,Math.min(9-k(n),1)));};return{r:Math.round(255*f(0)),g:Math.round(255*f(8)),b:Math.round(255*f(4))};};exports.HSL_RGB=HSL_RGB;var ALPHA_HEX=function ALPHA_HEX(number){var op=Math.floor(number/100*255);var hex=op.toString(16);return op<16?'0'+hex:hex;};exports.ALPHA_HEX=ALPHA_HEX;var HSL_HEX=function HSL_HEX(h,s,l){l/=100;var a=s*Math.min(l,1-l)/100;var f=function f(n){var k=(n+h/30)%12;var color=l-a*Math.max(Math.min(k-3,9-k,1),-1);return Math.round(255*color).toString(16).padStart(2,'0');};return"#"+f(0)+f(8)+f(4);};exports.HSL_HEX=HSL_HEX;var HSV_HSL=function HSV_HSL(h,s,b){s/=100;b/=100;var l=(2-s)*b/2;if(l!==0)s=Math.round((l===1?0:l<0.5?s*b/(l*2):s*b/(2-l*2))*100);l=Math.round(l*100);return{h:h,s:s,l:l};};exports.HSV_HSL=HSV_HSL;var RGB_HSV=function RGB_HSV(r,g,b){var rabs,gabs,babs,rr,gg,bb,h,s,v,diff,diffc,percentRoundFn;rabs=r/255;gabs=g/255;babs=b/255;v=Math.max(rabs,gabs,babs),diff=v-Math.min(rabs,gabs,babs);diffc=function diffc(c){return(v-c)/6/diff+1/2;};percentRoundFn=function percentRoundFn(num){return Math.round(num*100)/100;};if(diff===0){h=s=0;}else{s=diff/v;rr=diffc(rabs);gg=diffc(gabs);bb=diffc(babs);if(rabs===v){h=bb-gg;}else if(gabs===v){h=1/3+rr-bb;}else if(babs===v){h=2/3+gg-rr;}if(h<0){h+=1;}else if(h>1){h-=1;}}return{h:Math.round(h*360),s:percentRoundFn(s*100),b:percentRoundFn(v*100)};};exports.RGB_HSV=RGB_HSV;var HEX_RGB=function HEX_RGB(hex){var isValidHex=function isValidHex(h){return /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(h);};var getChunksFromString=function getChunksFromString(st,chunkSize){return st.match(new RegExp(".{"+chunkSize+"}",'g'));};var convertHexUnitTo256=function convertHexUnitTo256(hexStr){return parseInt(hexStr.repeat(2/hexStr.length),16);};if(!isValidHex(hex))throw new Error('Invalid HEX');var chunkSize=Math.floor((hex.length-1)/3);var hexArr=getChunksFromString(hex.slice(1),chunkSize);var _hexArr$map=hexArr.map(convertHexUnitTo256),_hexArr$map2=(0,_slicedToArray2.default)(_hexArr$map,4),r=_hexArr$map2[0],g=_hexArr$map2[1],b=_hexArr$map2[2],a=_hexArr$map2[3];var alpha=Math.round(a/255*100);return{r:r,g:g,b:b,a:!isNaN(alpha)?alpha:100};};exports.HEX_RGB=HEX_RGB;var HEX_HSV=function HEX_HSV(hex){var _HEX_RGB=HEX_RGB(hex),r=_HEX_RGB.r,g=_HEX_RGB.g,b=_HEX_RGB.b,a=_HEX_RGB.a;return(0,_extends2.default)({},RGB_HSV(r,g,b),{a:a});};exports.HEX_HSV=HEX_HSV;var HSL_HSV=function HSL_HSV(h,s,l){var _HSL_RGB=HSL_RGB(h,s,l),r=_HSL_RGB.r,g=_HSL_RGB.g,b=_HSL_RGB.b;return RGB_HSV(r,g,b);};exports.HSL_HSV=HSL_HSV;var COLOR_HSVA=function COLOR_HSVA(colorStr){colorStr=colorStr.trim();var isRgba=colorStr.startsWith('rgba');var isRgb=colorStr.startsWith('rgb');var isHex=colorStr.startsWith('#');var isNamedColor=_NamedColors.default.hasOwnProperty(colorStr);var isHsla=colorStr.startsWith('hsla');var isHsl=colorStr.startsWith('hsl');var isHsva=colorStr.startsWith('hsva');var isHsv=colorStr.startsWith('hsv');var regex=/\(([^)]+)/;if(isRgba){var _colorStr$match;var match=(_colorStr$match=colorStr.match(regex))==null?void 0:_colorStr$match[1];if(!match)throw new Error('Invalid RGBA value');var colorValues=match.split(',');if(colorValues.length!==4)throw new Error('Invalid RGBA value');var _colorValues$map=colorValues.map(function(v){return+v;}),_colorValues$map2=(0,_slicedToArray2.default)(_colorValues$map,4),r=_colorValues$map2[0],g=_colorValues$map2[1],b=_colorValues$map2[2],a=_colorValues$map2[3];if(isNaN(r)||isNaN(g)||isNaN(b)||isNaN(a))throw new Error('Invalid RGBA value');return(0,_extends2.default)({},RGB_HSV(r,g,b),{a:Math.round(a*100)});}if(isRgb){var _colorStr$match2;var _match=(_colorStr$match2=colorStr.match(regex))==null?void 0:_colorStr$match2[1];if(!_match)throw new Error('Invalid RGB value');var _colorValues=_match.split(',');if(_colorValues.length!==3)throw new Error('Invalid RGB value');var _colorValues$map3=_colorValues.map(function(v){return+v;}),_colorValues$map4=(0,_slicedToArray2.default)(_colorValues$map3,3),_r=_colorValues$map4[0],_g=_colorValues$map4[1],_b=_colorValues$map4[2];if(isNaN(_r)||isNaN(_g)||isNaN(_b))throw new Error('Invalid RGB value');return(0,_extends2.default)({},RGB_HSV(_r,_g,_b),{a:100});}if(isHex)return HEX_HSV(colorStr);if(isNamedColor)return HEX_HSV(_NamedColors.default[colorStr]);if(isHsla){var _colorStr$match3;var _match2=(_colorStr$match3=colorStr.match(regex))==null?void 0:_colorStr$match3[1];if(!_match2)throw new Error('Invalid HSLA value');var _colorValues2=_match2.split(',');if(_colorValues2.length!==4)throw new Error('Invalid HSLA value');var _colorValues2$map=_colorValues2.map(function(v){return+v.replace('%','').replace('deg','');}),_colorValues2$map2=(0,_slicedToArray2.default)(_colorValues2$map,4),h=_colorValues2$map2[0],s=_colorValues2$map2[1],l=_colorValues2$map2[2],_a=_colorValues2$map2[3];if(isNaN(h)||isNaN(s)||isNaN(l)||isNaN(_a))throw new Error('Invalid HSLA value');return(0,_extends2.default)({},HSL_HSV(h,s,l),{a:Math.round(_a*100)});}if(isHsl){var _colorStr$match4;var _match3=(_colorStr$match4=colorStr.match(regex))==null?void 0:_colorStr$match4[1];if(!_match3)throw new Error('Invalid HSL value');var _colorValues3=_match3.split(',');if(_colorValues3.length!==3)throw new Error('Invalid HSL value');var _colorValues3$map=_colorValues3.map(function(v){return+v.replace('%','').replace('deg','');}),_colorValues3$map2=(0,_slicedToArray2.default)(_colorValues3$map,3),_h=_colorValues3$map2[0],_s=_colorValues3$map2[1],_l=_colorValues3$map2[2];if(isNaN(_h)||isNaN(_s)||isNaN(_l))throw new Error('Invalid HSL value');return(0,_extends2.default)({},HSL_HSV(_h,_s,_l),{a:100});}if(isHsva){var _colorStr$match5;var _match4=(_colorStr$match5=colorStr.match(regex))==null?void 0:_colorStr$match5[1];if(!_match4)throw new Error('Invalid HSVA value');var _colorValues4=_match4.split(',');if(_colorValues4.length!==4)throw new Error('Invalid HSVA value');var _colorValues4$map=_colorValues4.map(function(n){return+n.replace('%','').replace('deg','');}),_colorValues4$map2=(0,_slicedToArray2.default)(_colorValues4$map,4),_h2=_colorValues4$map2[0],_s2=_colorValues4$map2[1],_b2=_colorValues4$map2[2],_a2=_colorValues4$map2[3];if(isNaN(_h2)||isNaN(_s2)||isNaN(_b2)||isNaN(_a2))throw new Error('Invalid HSVA value');return{h:_h2,s:_s2,b:_b2,a:Math.round(_a2*100)};}if(isHsv){var _colorStr$match6;var _match5=(_colorStr$match6=colorStr.match(regex))==null?void 0:_colorStr$match6[1];if(!_match5)throw new Error('Invalid HSV value');var _colorValues5=_match5.split(',');if(_colorValues5.length!==3)throw new Error('Invalid HSV value');var _colorValues5$map=_colorValues5.map(function(n){return+n.replace('%','').replace('deg','');}),_colorValues5$map2=(0,_slicedToArray2.default)(_colorValues5$map,3),_h3=_colorValues5$map2[0],_s3=_colorValues5$map2[1],_b3=_colorValues5$map2[2];if(isNaN(_h3)||isNaN(_s3)||isNaN(_b3))throw new Error('Invalid HSV value');return{h:_h3,s:_s3,b:_b3,a:100};}throw new Error('Invalid color');};exports.COLOR_HSVA=COLOR_HSVA;var luminanceRGB=function luminanceRGB(r,g,b){var a=[r,g,b].map(function(v){v/=255;return v<=0.03928?v/12.92:Math.pow((v+0.055)/1.055,2.4);});return a[0]*0.2126+a[1]*0.7152+a[2]*0.0722;};var luminanceHEX=function luminanceHEX(hex){var _HEX_RGB2=HEX_RGB(hex),r=_HEX_RGB2.r,g=_HEX_RGB2.g,b=_HEX_RGB2.b;var a=[r,g,b].map(function(v){v/=255;return v<=0.03928?v/12.92:Math.pow((v+0.055)/1.055,2.4);});return a[0]*0.2126+a[1]*0.7152+a[2]*0.0722;};var CONTRAST_RATIO=function CONTRAST_RATIO(h,s,v,hex){var hsl=HSV_HSL(h,s,v),_HSL_RGB2=HSL_RGB(hsl.h,hsl.s,hsl.l),r=_HSL_RGB2.r,g=_HSL_RGB2.g,b=_HSL_RGB2.b,lum1=luminanceRGB(r,g,b),lum2=luminanceHEX(hex),brightest=Math.max(lum1,lum2),darkest=Math.min(lum1,lum2);return+((brightest+0.05)/(darkest+0.05)).toFixed(1);};exports.CONTRAST_RATIO=CONTRAST_RATIO;
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var _default=_reactNative.StyleSheet.create({panel_container:{position:'relative',alignItems:'center',borderRadius:5,backgroundColor:'red',shadowColor:'#000',shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84,elevation:5},handle:{position:'absolute',left:0,top:0,borderWidth:1,justifyContent:'center',alignItems:'center'},handleInner:{width:'75%',height:'75%',shadowColor:'#000',shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84,elevation:5},sliderImageContainer:{width:'100%',height:'100%',borderRadius:5,overflow:'hidden',shadowColor:'#000',shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84,elevation:5},sliderImage:{width:'100%',height:80},override:{padding:0,borderWidth:0}});exports.default=_default;
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _default={aliceblue:'#f0f8ff',antiquewhite:'#faebd7',aqua:'#00ffff',aquamarine:'#7fffd4',azure:'#f0ffff',beige:'#f5f5dc',bisque:'#ffe4c4',black:'#000000',blanchedalmond:'#ffebcd',blue:'#0000ff',blueviolet:'#8a2be2',brown:'#a52a2a',burlywood:'#deb887',cadetblue:'#5f9ea0',chartreuse:'#7fff00',chocolate:'#d2691e',coral:'#ff7f50',cornflowerblue:'#6495ed',cornsilk:'#fff8dc',crimson:'#dc143c',cyan:'#00ffff',darkblue:'#00008b',darkcyan:'#008b8b',darkgoldenrod:'#b8860b',darkgray:'#a9a9a9',darkgreen:'#006400',darkgrey:'#a9a9a9',darkkhaki:'#bdb76b',darkmagenta:'#8b008b',darkolivegreen:'#556b2f',darkorange:'#ff8c00',darkorchid:'#9932cc',darkred:'#8b0000',darksalmon:'#e9967a',darkseagreen:'#8fbc8f',darkslateblue:'#483d8b',darkslategrey:'#2f4f4f',darkturquoise:'#00ced1',darkviolet:'#9400d3',deeppink:'#ff1493',deepskyblue:'#00bfff',dimgray:'#696969',dimgrey:'#696969',dodgerblue:'#1e90ff',firebrick:'#b22222',floralwhite:'#fffaf0',forestgreen:'#228b22',fuchsia:'#ff00ff',gainsboro:'#dcdcdc',ghostwhite:'#f8f8ff',gold:'#ffd700',goldenrod:'#daa520',gray:'#808080',green:'#008000',greenyellow:'#adff2f',grey:'#808080',honeydew:'#f0fff0',hotpink:'#ff69b4',indianred:'#cd5c5c',indigo:'#4b0082',ivory:'#fffff0',khaki:'#f0e68c',lavender:'#e6e6fa',lavenderblush:'#fff0f5',lawngreen:'#7cfc00',lemonchiffon:'#fffacd',lightblue:'#add8e6',lightcoral:'#f08080',lightcyan:'#e0ffff',lightgoldenrodyellow:'#fafad2',lightgray:'#d3d3d3',lightgreen:'#90ee90',lightgrey:'#d3d3d3',lightpink:'#ffb6c1',lightsalmon:'#ffa07a',lightseagreen:'#20b2aa',lightskyblue:'#87cefa',lightslategrey:'#778899',lightsteelblue:'#b0c4de',lightyellow:'#ffffe0',lime:'#00ff00',limegreen:'#32cd32',linen:'#faf0e6',magenta:'#ff00ff',maroon:'#800000',mediumaquamarine:'#66cdaa',mediumblue:'#0000cd',mediumorchid:'#ba55d3',mediumpurple:'#9370db',mediumseagreen:'#3cb371',mediumslateblue:'#7b68ee',mediumspringgreen:'#00fa9a',mediumturquoise:'#48d1cc',mediumvioletred:'#c71585',midnightblue:'#191970',mintcream:'#f5fffa',mistyrose:'#ffe4e1',moccasin:'#ffe4b5',navajowhite:'#ffdead',navy:'#000080',oldlace:'#fdf5e6',olive:'#808000',olivedrab:'#6b8e23',orange:'#ffa500',orangered:'#ff4500',orchid:'#da70d6',palegoldenrod:'#eee8aa',palegreen:'#98fb98',paleturquoise:'#afeeee',palevioletred:'#db7093',papayawhip:'#ffefd5',peachpuff:'#ffdab9',peru:'#cd853f',pink:'#ffc0cb',plum:'#dda0dd',powderblue:'#b0e0e6',purple:'#800080',rebeccapurple:'#663399',red:'#ff0000',rosybrown:'#bc8f8f',royalblue:'#4169e1',saddlebrown:'#8b4513',salmon:'#fa8072',sandybrown:'#f4a460',seagreen:'#2e8b57',seashell:'#fff5ee',sienna:'#a0522d',silver:'#c0c0c0',skyblue:'#87ceeb',slateblue:'#6a5acd',slategray:'#708090',snow:'#fffafa',springgreen:'#00ff7f',steelblue:'#4682b4',tan:'#d2b48c',teal:'#008080',thistle:'#d8bfd8',tomato:'#ff6347',turquoise:'#40e0d0',violet:'#ee82ee',wheat:'#f5deb3',white:'#ffffff',whitesmoke:'#f5f5f5',yellow:'#ffff00',yellowgreen:'#9acd32'};exports.default=_default;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.BrightnessSlider=BrightnessSlider;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ColorsConversionFormulas=require("../ColorsConversionFormulas");var _GlobalStyles=_interopRequireDefault(require("../GlobalStyles"));var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\BrightnessSlider.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isRtl=_reactNative.I18nManager.isRTL;function BrightnessSlider(_ref){var _style$height,_style$borderRadius;var width=_ref.width,brightnessThumbeSize=_ref.brightnessThumbeSize,panel1ThumbeSize=_ref.panel1ThumbeSize,setHandlesPos=_ref.setHandlesPos,updateBrightness=_ref.updateBrightness,onGestureEventFinish=_ref.onGestureEventFinish,brightnessPanel1_handlePos=_ref.brightnessPanel1_handlePos,brightnessSlider_handlePos=_ref.brightnessSlider_handlePos,previewColorWithoutOpacity=_ref.previewColorWithoutOpacity,tracksHeight=_ref.tracksHeight,activeHueStyle=_ref.activeHueStyle,thumbsSize=_ref.thumbsSize,_ref$thumbSize=_ref.thumbSize,thumbSize=_ref$thumbSize===void 0?thumbsSize:_ref$thumbSize,_ref$ringColor=_ref.ringColor,ringColor=_ref$ringColor===void 0?'#ffffff':_ref$ringColor,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style;var trackHeight=(_style$height=style.height)!=null?_style$height:tracksHeight;brightnessThumbeSize.current=thumbSize;ringColor=(0,_ColorsConversionFormulas.COLOR_HSVA)(ringColor);ringColor=(0,_ColorsConversionFormulas.HSV_HSL)(ringColor.h,ringColor.s,ringColor.b);ringColor=(0,_ColorsConversionFormulas.HSL_HEX)(ringColor.h,ringColor.s,ringColor.l);(0,_react.useEffect)(function(){setHandlesPos();},[]);var scale_brightnessHandle=(0,_reactNativeReanimated.useSharedValue)(1);var brightness_handleStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{transform:[{translateX:brightnessSlider_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_brightnessHandle.value}]};};_f._closure={brightnessSlider_handlePos:brightnessSlider_handlePos,thumbSize:thumbSize,trackHeight:trackHeight,scale_brightnessHandle:scale_brightnessHandle};_f.asString="function _f(){const{brightnessSlider_handlePos,thumbSize,trackHeight,scale_brightnessHandle}=jsThis._closure;{return{transform:[{translateX:brightnessSlider_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_brightnessHandle.value}]};}}";_f.__workletHash=16441817396437;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\BrightnessSlider.js (46:50)";_f.__optimalization=3;return _f;}());var BrightnessGestureEvent=(0,_reactNativeReanimated.useAnimatedGestureHandler)({onStart:function(){var _f=function _f(event,ctx){ctx.x=event.x;scale_brightnessHandle.value=(0,_reactNativeReanimated.withTiming)(1.2,{duration:100});};_f._closure={scale_brightnessHandle:scale_brightnessHandle,withTiming:_reactNativeReanimated.withTiming};_f.asString="function _f(event,ctx){const{scale_brightnessHandle,withTiming}=jsThis._closure;{ctx.x=event.x;scale_brightnessHandle.value=withTiming(1.2,{duration:100});}}";_f.__workletHash=5148625239249;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\BrightnessSlider.js (56:15)";return _f;}(),onActive:function(){var _f=function _f(event,ctx){var clamp=function clamp(v,max){return Math.min(Math.max(v,0),max);};var x=event.translationX;var pos=clamp(x+ctx.x,width);var percent=pos/width;var brightnessX=Math.round(percent*100);brightnessSlider_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;brightnessPanel1_handlePos.value=width-brightnessX/100*width-panel1ThumbeSize.current/2;(0,_reactNativeReanimated.runOnJS)(updateBrightness)(brightnessX);};_f._closure={width:width,brightnessSlider_handlePos:brightnessSlider_handlePos,isRtl:isRtl,thumbSize:thumbSize,brightnessPanel1_handlePos:brightnessPanel1_handlePos,panel1ThumbeSize:{current:panel1ThumbeSize.current},runOnJS:_reactNativeReanimated.runOnJS,updateBrightness:updateBrightness};_f.asString="function _f(event,ctx){const{width,brightnessSlider_handlePos,isRtl,thumbSize,brightnessPanel1_handlePos,panel1ThumbeSize,runOnJS,updateBrightness}=jsThis._closure;{const clamp=function(v,max){return Math.min(Math.max(v,0),max);};const x=event.translationX;const pos=clamp(x+ctx.x,width);const percent=pos/width;const brightnessX=Math.round(percent*100);brightnessSlider_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;brightnessPanel1_handlePos.value=width-brightnessX/100*width-panel1ThumbeSize.current/2;runOnJS(updateBrightness)(brightnessX);}}";_f.__workletHash=15600411197855;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\BrightnessSlider.js (62:16)";return _f;}(),onFinish:function(){var _f=function _f(){scale_brightnessHandle.value=(0,_reactNativeReanimated.withTiming)(1,{duration:100});(0,_reactNativeReanimated.runOnJS)(onGestureEventFinish)();};_f._closure={scale_brightnessHandle:scale_brightnessHandle,withTiming:_reactNativeReanimated.withTiming,runOnJS:_reactNativeReanimated.runOnJS,onGestureEventFinish:onGestureEventFinish};_f.asString="function _f(){const{scale_brightnessHandle,withTiming,runOnJS,onGestureEventFinish}=jsThis._closure;{scale_brightnessHandle.value=withTiming(1,{duration:100});runOnJS(onGestureEventFinish)();}}";_f.__workletHash=9937001655676;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\BrightnessSlider.js (79:16)";return _f;}()},[width]);return _react.default.createElement(_reactNativeGestureHandler.PanGestureHandler,{onGestureEvent:BrightnessGestureEvent,minDist:0,__self:this,__source:{fileName:_jsxFileName,lineNumber:88,columnNumber:5}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[{position:'relative',height:tracksHeight},style,{width:width},_GlobalStyles.default.override],__self:this,__source:{fileName:_jsxFileName,lineNumber:89,columnNumber:7}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.sliderImageContainer,{borderRadius:(_style$borderRadius=style.borderRadius)!=null?_style$borderRadius:5},activeHueStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:96,columnNumber:9}},_react.default.createElement(_reactNative.Image,{source:require('../assets/Brightness.png'),style:_GlobalStyles.default.sliderImage,__self:this,__source:{fileName:_jsxFileName,lineNumber:102,columnNumber:11}})),_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handle,{width:thumbSize,height:thumbSize,borderRadius:thumbSize/2,backgroundColor:ringColor+50,borderColor:ringColor},brightness_handleStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:107,columnNumber:9}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handleInner,{borderRadius:thumbSize/2},previewColorWithoutOpacity],__self:this,__source:{fileName:_jsxFileName,lineNumber:119,columnNumber:11}}))));}
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.HueSlider=HueSlider;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ColorsConversionFormulas=require("../ColorsConversionFormulas");var _GlobalStyles=_interopRequireDefault(require("../GlobalStyles"));var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\HueSlider.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isRtl=_reactNative.I18nManager.isRTL;function HueSlider(_ref){var _style$height,_style$borderRadius;var width=_ref.width,hueThumbeSize=_ref.hueThumbeSize,setHandlesPos=_ref.setHandlesPos,updateHue=_ref.updateHue,onGestureEventFinish=_ref.onGestureEventFinish,hue_handlePos=_ref.hue_handlePos,huePanel2_handlePos=_ref.huePanel2_handlePos,previewColorWithoutOpacity=_ref.previewColorWithoutOpacity,tracksHeight=_ref.tracksHeight,panel2ThumbeSize=_ref.panel2ThumbeSize,thumbsSize=_ref.thumbsSize,_ref$thumbSize=_ref.thumbSize,thumbSize=_ref$thumbSize===void 0?thumbsSize:_ref$thumbSize,_ref$ringColor=_ref.ringColor,ringColor=_ref$ringColor===void 0?'#ffffff':_ref$ringColor,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style;var trackHeight=(_style$height=style.height)!=null?_style$height:tracksHeight;hueThumbeSize.current=thumbSize;ringColor=(0,_ColorsConversionFormulas.COLOR_HSVA)(ringColor);ringColor=(0,_ColorsConversionFormulas.HSV_HSL)(ringColor.h,ringColor.s,ringColor.b);ringColor=(0,_ColorsConversionFormulas.HSL_HEX)(ringColor.h,ringColor.s,ringColor.l);(0,_react.useEffect)(function(){setHandlesPos();},[]);var scale_hueHandle=(0,_reactNativeReanimated.useSharedValue)(1);var hue_handleStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{transform:[{translateX:hue_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_hueHandle.value}]};};_f._closure={hue_handlePos:hue_handlePos,thumbSize:thumbSize,trackHeight:trackHeight,scale_hueHandle:scale_hueHandle};_f.asString="function _f(){const{hue_handlePos,thumbSize,trackHeight,scale_hueHandle}=jsThis._closure;{return{transform:[{translateX:hue_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_hueHandle.value}]};}}";_f.__workletHash=6347868136085;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\HueSlider.js (45:43)";_f.__optimalization=3;return _f;}());var HueGestureEvent=(0,_reactNativeReanimated.useAnimatedGestureHandler)({onStart:function(){var _f=function _f(event,ctx){ctx.x=event.x;scale_hueHandle.value=(0,_reactNativeReanimated.withTiming)(1.2,{duration:100});};_f._closure={scale_hueHandle:scale_hueHandle,withTiming:_reactNativeReanimated.withTiming};_f.asString="function _f(event,ctx){const{scale_hueHandle,withTiming}=jsThis._closure;{ctx.x=event.x;scale_hueHandle.value=withTiming(1.2,{duration:100});}}";_f.__workletHash=7474775057329;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\HueSlider.js (55:15)";return _f;}(),onActive:function(){var _f=function _f(event,ctx){var clamp=function clamp(v,max){return Math.min(Math.max(v,0),max);};var x=event.translationX;var pos=clamp(x+ctx.x,width);var percent=pos/width;var hueX=360-Math.round(percent*360);hue_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;huePanel2_handlePos.value=isRtl?hueX/360*width-width+panel2ThumbeSize.current/2:hueX/360*width-panel2ThumbeSize.current/2;(0,_reactNativeReanimated.runOnJS)(updateHue)(hueX);};_f._closure={width:width,hue_handlePos:hue_handlePos,isRtl:isRtl,thumbSize:thumbSize,huePanel2_handlePos:huePanel2_handlePos,panel2ThumbeSize:{current:panel2ThumbeSize.current},runOnJS:_reactNativeReanimated.runOnJS,updateHue:updateHue};_f.asString="function _f(event,ctx){const{width,hue_handlePos,isRtl,thumbSize,huePanel2_handlePos,panel2ThumbeSize,runOnJS,updateHue}=jsThis._closure;{const clamp=function(v,max){return Math.min(Math.max(v,0),max);};const x=event.translationX;const pos=clamp(x+ctx.x,width);const percent=pos/width;const hueX=360-Math.round(percent*360);hue_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;huePanel2_handlePos.value=isRtl?hueX/360*width-width+panel2ThumbeSize.current/2:hueX/360*width-panel2ThumbeSize.current/2;runOnJS(updateHue)(hueX);}}";_f.__workletHash=12935272781190;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\HueSlider.js (59:16)";return _f;}(),onFinish:function(){var _f=function _f(){scale_hueHandle.value=(0,_reactNativeReanimated.withTiming)(1,{duration:100});(0,_reactNativeReanimated.runOnJS)(onGestureEventFinish)();};_f._closure={scale_hueHandle:scale_hueHandle,withTiming:_reactNativeReanimated.withTiming,runOnJS:_reactNativeReanimated.runOnJS,onGestureEventFinish:onGestureEventFinish};_f.asString="function _f(){const{scale_hueHandle,withTiming,runOnJS,onGestureEventFinish}=jsThis._closure;{scale_hueHandle.value=withTiming(1,{duration:100});runOnJS(onGestureEventFinish)();}}";_f.__workletHash=10393889620252;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\HueSlider.js (79:16)";return _f;}()},[width]);return _react.default.createElement(_reactNativeGestureHandler.PanGestureHandler,{onGestureEvent:HueGestureEvent,minDist:0,__self:this,__source:{fileName:_jsxFileName,lineNumber:88,columnNumber:5}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[{position:'relative',height:tracksHeight},style,{width:width},_GlobalStyles.default.override],__self:this,__source:{fileName:_jsxFileName,lineNumber:89,columnNumber:7}},_react.default.createElement(_reactNative.View,{style:[_GlobalStyles.default.sliderImageContainer,{borderRadius:(_style$borderRadius=style.borderRadius)!=null?_style$borderRadius:5}],__self:this,__source:{fileName:_jsxFileName,lineNumber:96,columnNumber:9}},_react.default.createElement(_reactNative.Image,{source:require('../assets/Hue.png'),style:_GlobalStyles.default.sliderImage,__self:this,__source:{fileName:_jsxFileName,lineNumber:101,columnNumber:11}})),_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handle,{width:thumbSize,height:thumbSize,borderRadius:thumbSize/2,backgroundColor:ringColor+50,borderColor:ringColor},hue_handleStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:106,columnNumber:9}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handleInner,{borderRadius:thumbSize/2},previewColorWithoutOpacity],__self:this,__source:{fileName:_jsxFileName,lineNumber:118,columnNumber:11}}))));}
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.OpacitySlider=OpacitySlider;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ColorsConversionFormulas=require("../ColorsConversionFormulas");var _GlobalStyles=_interopRequireDefault(require("../GlobalStyles"));var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\OpacitySlider.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isRtl=_reactNative.I18nManager.isRTL;function OpacitySlider(_ref){var _style$height,_style$borderRadius;var width=_ref.width,opacityThumbeSize=_ref.opacityThumbeSize,setHandlesPos=_ref.setHandlesPos,activeHueStyle=_ref.activeHueStyle,opacity_handlePos=_ref.opacity_handlePos,updateOpacity=_ref.updateOpacity,onGestureEventFinish=_ref.onGestureEventFinish,previewColorWithoutOpacity=_ref.previewColorWithoutOpacity,tracksHeight=_ref.tracksHeight,thumbsSize=_ref.thumbsSize,_ref$thumbSize=_ref.thumbSize,thumbSize=_ref$thumbSize===void 0?thumbsSize:_ref$thumbSize,_ref$ringColor=_ref.ringColor,ringColor=_ref$ringColor===void 0?'#ffffff':_ref$ringColor,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style;var trackHeight=(_style$height=style.height)!=null?_style$height:tracksHeight;opacityThumbeSize.current=thumbSize;ringColor=(0,_ColorsConversionFormulas.COLOR_HSVA)(ringColor);ringColor=(0,_ColorsConversionFormulas.HSV_HSL)(ringColor.h,ringColor.s,ringColor.b);ringColor=(0,_ColorsConversionFormulas.HSL_HEX)(ringColor.h,ringColor.s,ringColor.l);(0,_react.useEffect)(function(){setHandlesPos();},[]);var scale_opacityHandle=(0,_reactNativeReanimated.useSharedValue)(1);var opacity_handleStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{transform:[{translateX:opacity_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_opacityHandle.value}]};};_f._closure={opacity_handlePos:opacity_handlePos,thumbSize:thumbSize,trackHeight:trackHeight,scale_opacityHandle:scale_opacityHandle};_f.asString="function _f(){const{opacity_handlePos,thumbSize,trackHeight,scale_opacityHandle}=jsThis._closure;{return{transform:[{translateX:opacity_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_opacityHandle.value}]};}}";_f.__workletHash=9880797045525;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\OpacitySlider.js (44:47)";_f.__optimalization=3;return _f;}());var opacityGestureEvent=(0,_reactNativeReanimated.useAnimatedGestureHandler)({onStart:function(){var _f=function _f(event,ctx){ctx.x=event.x;scale_opacityHandle.value=(0,_reactNativeReanimated.withTiming)(1.2,{duration:100});};_f._closure={scale_opacityHandle:scale_opacityHandle,withTiming:_reactNativeReanimated.withTiming};_f.asString="function _f(event,ctx){const{scale_opacityHandle,withTiming}=jsThis._closure;{ctx.x=event.x;scale_opacityHandle.value=withTiming(1.2,{duration:100});}}";_f.__workletHash=6541090922897;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\OpacitySlider.js (53:13)";return _f;}(),onActive:function(){var _f=function _f(event,ctx){var clamp=function clamp(v,max){return Math.min(Math.max(v,0),max);};var x=event.translationX;var pos=clamp(x+ctx.x,width);var percent=pos/width;var opacityX=Math.round(percent*100);opacity_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;(0,_reactNativeReanimated.runOnJS)(updateOpacity)(opacityX);};_f._closure={width:width,opacity_handlePos:opacity_handlePos,isRtl:isRtl,thumbSize:thumbSize,runOnJS:_reactNativeReanimated.runOnJS,updateOpacity:updateOpacity};_f.asString="function _f(event,ctx){const{width,opacity_handlePos,isRtl,thumbSize,runOnJS,updateOpacity}=jsThis._closure;{const clamp=function(v,max){return Math.min(Math.max(v,0),max);};const x=event.translationX;const pos=clamp(x+ctx.x,width);const percent=pos/width;const opacityX=Math.round(percent*100);opacity_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;runOnJS(updateOpacity)(opacityX);}}";_f.__workletHash=10999151943043;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\OpacitySlider.js (57:14)";return _f;}(),onFinish:function(){var _f=function _f(){scale_opacityHandle.value=(0,_reactNativeReanimated.withTiming)(1,{duration:100});(0,_reactNativeReanimated.runOnJS)(onGestureEventFinish)();};_f._closure={scale_opacityHandle:scale_opacityHandle,withTiming:_reactNativeReanimated.withTiming,runOnJS:_reactNativeReanimated.runOnJS,onGestureEventFinish:onGestureEventFinish};_f.asString="function _f(){const{scale_opacityHandle,withTiming,runOnJS,onGestureEventFinish}=jsThis._closure;{scale_opacityHandle.value=withTiming(1,{duration:100});runOnJS(onGestureEventFinish)();}}";_f.__workletHash=15439168908508;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\OpacitySlider.js (72:14)";return _f;}()});return _react.default.createElement(_reactNativeGestureHandler.PanGestureHandler,{onGestureEvent:opacityGestureEvent,minDist:0,__self:this,__source:{fileName:_jsxFileName,lineNumber:79,columnNumber:5}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[{position:'relative',height:tracksHeight},style,{width:width},_GlobalStyles.default.override],__self:this,__source:{fileName:_jsxFileName,lineNumber:80,columnNumber:7}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.sliderImageContainer,{borderRadius:(_style$borderRadius=style.borderRadius)!=null?_style$borderRadius:5},activeHueStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:87,columnNumber:9}},_react.default.createElement(_reactNative.Image,{source:require('../assets/Opacity.png'),style:_GlobalStyles.default.sliderImage,__self:this,__source:{fileName:_jsxFileName,lineNumber:93,columnNumber:11}})),_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handle,{width:thumbSize,height:thumbSize,borderRadius:thumbSize/2,backgroundColor:ringColor+50,borderColor:ringColor},opacity_handleStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:98,columnNumber:9}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handleInner,{borderRadius:thumbSize/2},previewColorWithoutOpacity],__self:this,__source:{fileName:_jsxFileName,lineNumber:110,columnNumber:11}}))));}
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Panel1=Panel1;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _GlobalStyles=_interopRequireDefault(require("../GlobalStyles"));var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel1.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isRtl=_reactNative.I18nManager.isRTL;function Panel1(_ref){var _style$borderRadius;var activeHueStyle=_ref.activeHueStyle,previewTextColor=_ref.previewTextColor,previewColorWithoutOpacity=_ref.previewColorWithoutOpacity,saturationPanel1_handlePos=_ref.saturationPanel1_handlePos,brightnessPanel1_handlePos=_ref.brightnessPanel1_handlePos,saturationPanel2_handlePos=_ref.saturationPanel2_handlePos,saturationSlider_handlePos=_ref.saturationSlider_handlePos,brightnessSlider_handlePos=_ref.brightnessSlider_handlePos,updateSB=_ref.updateSB,onGestureEventFinish=_ref.onGestureEventFinish,setHandlesPos=_ref.setHandlesPos,panel1ThumbeSize=_ref.panel1ThumbeSize,panel2ThumbeSize=_ref.panel2ThumbeSize,brightnessThumbeSize=_ref.brightnessThumbeSize,saturationThumbeSize=_ref.saturationThumbeSize,width=_ref.width,thumbsSize=_ref.thumbsSize,_ref$thumbSize=_ref.thumbSize,thumbSize=_ref$thumbSize===void 0?thumbsSize:_ref$thumbSize,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style;panel1ThumbeSize.current=thumbSize;(0,_react.useEffect)(function(){setHandlesPos();},[]);var scale_panelHandle=(0,_reactNativeReanimated.useSharedValue)(1);var panel_handleStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{backgroundColor:previewTextColor.value==='#ffffff'?'#ffffff50':'#00000050',borderColor:previewTextColor.value,transform:[{translateX:saturationPanel1_handlePos.value},{translateY:brightnessPanel1_handlePos.value},{scale:scale_panelHandle.value}]};};_f._closure={previewTextColor:previewTextColor,saturationPanel1_handlePos:saturationPanel1_handlePos,brightnessPanel1_handlePos:brightnessPanel1_handlePos,scale_panelHandle:scale_panelHandle};_f.asString="function _f(){const{previewTextColor,saturationPanel1_handlePos,brightnessPanel1_handlePos,scale_panelHandle}=jsThis._closure;{return{backgroundColor:previewTextColor.value==='#ffffff'?'#ffffff50':'#00000050',borderColor:previewTextColor.value,transform:[{translateX:saturationPanel1_handlePos.value},{translateY:brightnessPanel1_handlePos.value},{scale:scale_panelHandle.value}]};}}";_f.__workletHash=1063553944479;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel1.js (44:45)";_f.__optimalization=3;return _f;}());var panel_GestureEvent=(0,_reactNativeReanimated.useAnimatedGestureHandler)({onStart:function(){var _f=function _f(event,ctx){ctx.x=event.x;ctx.y=event.y;scale_panelHandle.value=(0,_reactNativeReanimated.withTiming)(1.2,{duration:100});};_f._closure={scale_panelHandle:scale_panelHandle,withTiming:_reactNativeReanimated.withTiming};_f.asString="function _f(event,ctx){const{scale_panelHandle,withTiming}=jsThis._closure;{ctx.x=event.x;ctx.y=event.y;scale_panelHandle.value=withTiming(1.2,{duration:100});}}";_f.__workletHash=16724930565684;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel1.js (56:13)";return _f;}(),onActive:function(){var _f=function _f(event,ctx){var clamp=function clamp(v,max){return Math.min(Math.max(v,0),max);};var x=event.translationX;var y=event.translationY;var posX=clamp(x+ctx.x,width);var posY=clamp(y+ctx.y,width);var percentX=posX/width;var percentY=posY/width;var saturationX=Math.round(percentX*100);var brightnessY=Math.round(100-percentY*100);saturationPanel1_handlePos.value=isRtl?percentX*width-width+thumbSize/2:percentX*width-thumbSize/2;brightnessPanel1_handlePos.value=percentY*width-thumbSize/2;brightnessSlider_handlePos.value=isRtl?brightnessY/100*width-width+brightnessThumbeSize.current/2:brightnessY/100*width-brightnessThumbeSize.current/2;saturationSlider_handlePos.value=isRtl?saturationX/100*width-width+saturationThumbeSize.current/2:saturationX/100*width-saturationThumbeSize.current/2;saturationPanel2_handlePos.value=width-saturationX/100*width-panel2ThumbeSize.current/2;(0,_reactNativeReanimated.runOnJS)(updateSB)(saturationX,brightnessY);};_f._closure={width:width,saturationPanel1_handlePos:saturationPanel1_handlePos,isRtl:isRtl,thumbSize:thumbSize,brightnessPanel1_handlePos:brightnessPanel1_handlePos,brightnessSlider_handlePos:brightnessSlider_handlePos,brightnessThumbeSize:{current:brightnessThumbeSize.current},saturationSlider_handlePos:saturationSlider_handlePos,saturationThumbeSize:{current:saturationThumbeSize.current},saturationPanel2_handlePos:saturationPanel2_handlePos,panel2ThumbeSize:{current:panel2ThumbeSize.current},runOnJS:_reactNativeReanimated.runOnJS,updateSB:updateSB};_f.asString="function _f(event,ctx){const{width,saturationPanel1_handlePos,isRtl,thumbSize,brightnessPanel1_handlePos,brightnessSlider_handlePos,brightnessThumbeSize,saturationSlider_handlePos,saturationThumbeSize,saturationPanel2_handlePos,panel2ThumbeSize,runOnJS,updateSB}=jsThis._closure;{const clamp=function(v,max){return Math.min(Math.max(v,0),max);};const x=event.translationX;const y=event.translationY;const posX=clamp(x+ctx.x,width);const posY=clamp(y+ctx.y,width);const percentX=posX/width;const percentY=posY/width;const saturationX=Math.round(percentX*100);const brightnessY=Math.round(100-percentY*100);saturationPanel1_handlePos.value=isRtl?percentX*width-width+thumbSize/2:percentX*width-thumbSize/2;brightnessPanel1_handlePos.value=percentY*width-thumbSize/2;brightnessSlider_handlePos.value=isRtl?brightnessY/100*width-width+brightnessThumbeSize.current/2:brightnessY/100*width-brightnessThumbeSize.current/2;saturationSlider_handlePos.value=isRtl?saturationX/100*width-width+saturationThumbeSize.current/2:saturationX/100*width-saturationThumbeSize.current/2;saturationPanel2_handlePos.value=width-saturationX/100*width-panel2ThumbeSize.current/2;runOnJS(updateSB)(saturationX,brightnessY);}}";_f.__workletHash=4536319164041;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel1.js (61:14)";return _f;}(),onFinish:function(){var _f=function _f(){scale_panelHandle.value=(0,_reactNativeReanimated.withTiming)(1,{duration:100});(0,_reactNativeReanimated.runOnJS)(onGestureEventFinish)();};_f._closure={scale_panelHandle:scale_panelHandle,withTiming:_reactNativeReanimated.withTiming,runOnJS:_reactNativeReanimated.runOnJS,onGestureEventFinish:onGestureEventFinish};_f.asString="function _f(){const{scale_panelHandle,withTiming,runOnJS,onGestureEventFinish}=jsThis._closure;{scale_panelHandle.value=withTiming(1,{duration:100});runOnJS(onGestureEventFinish)();}}";_f.__workletHash=291465260572;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel1.js (93:14)";return _f;}()});return _react.default.createElement(_reactNativeGestureHandler.PanGestureHandler,{onGestureEvent:panel_GestureEvent,minDist:0,__self:this,__source:{fileName:_jsxFileName,lineNumber:100,columnNumber:5}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.panel_container,style,{width:width,height:width},_GlobalStyles.default.override,activeHueStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:101,columnNumber:7}},_react.default.createElement(_reactNative.Image,{source:require('../assets/Background1.png'),style:{borderRadius:(_style$borderRadius=style.borderRadius)!=null?_style$borderRadius:5,width:width,height:width},__self:this,__source:{fileName:_jsxFileName,lineNumber:109,columnNumber:9}}),_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handle,{width:thumbSize,height:thumbSize,borderRadius:thumbSize/2},panel_handleStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:117,columnNumber:9}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handleInner,{borderRadius:thumbSize/2},previewColorWithoutOpacity],__self:this,__source:{fileName:_jsxFileName,lineNumber:127,columnNumber:11}}))));}
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Panel2=Panel2;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _GlobalStyles=_interopRequireDefault(require("../GlobalStyles"));var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel2.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isRtl=_reactNative.I18nManager.isRTL;function Panel2(_ref){var _style$borderRadius;var previewTextColor=_ref.previewTextColor,previewColorWithoutOpacity=_ref.previewColorWithoutOpacity,saturationPanel1_handlePos=_ref.saturationPanel1_handlePos,saturationPanel2_handlePos=_ref.saturationPanel2_handlePos,huePanel2_handlePos=_ref.huePanel2_handlePos,hue_handlePos=_ref.hue_handlePos,saturationSlider_handlePos=_ref.saturationSlider_handlePos,onGestureEventFinish=_ref.onGestureEventFinish,setHandlesPos=_ref.setHandlesPos,panel1ThumbeSize=_ref.panel1ThumbeSize,panel2ThumbeSize=_ref.panel2ThumbeSize,hueThumbeSize=_ref.hueThumbeSize,saturationThumbeSize=_ref.saturationThumbeSize,updateHS=_ref.updateHS,width=_ref.width,thumbsSize=_ref.thumbsSize,_ref$thumbSize=_ref.thumbSize,thumbSize=_ref$thumbSize===void 0?thumbsSize:_ref$thumbSize,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style;panel2ThumbeSize.current=thumbSize;(0,_react.useEffect)(function(){setHandlesPos();},[]);var scale_panelHandle=(0,_reactNativeReanimated.useSharedValue)(1);var panel_handleStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{backgroundColor:previewTextColor.value==='#ffffff'?'#ffffff50':'#00000050',borderColor:previewTextColor.value,transform:[{translateX:huePanel2_handlePos.value},{translateY:saturationPanel2_handlePos.value},{scale:scale_panelHandle.value}]};};_f._closure={previewTextColor:previewTextColor,huePanel2_handlePos:huePanel2_handlePos,saturationPanel2_handlePos:saturationPanel2_handlePos,scale_panelHandle:scale_panelHandle};_f.asString="function _f(){const{previewTextColor,huePanel2_handlePos,saturationPanel2_handlePos,scale_panelHandle}=jsThis._closure;{return{backgroundColor:previewTextColor.value==='#ffffff'?'#ffffff50':'#00000050',borderColor:previewTextColor.value,transform:[{translateX:huePanel2_handlePos.value},{translateY:saturationPanel2_handlePos.value},{scale:scale_panelHandle.value}]};}}";_f.__workletHash=9183687379615;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel2.js (43:45)";_f.__optimalization=3;return _f;}());var panel_GestureEvent=(0,_reactNativeReanimated.useAnimatedGestureHandler)({onStart:function(){var _f=function _f(event,ctx){ctx.x=event.x;ctx.y=event.y;scale_panelHandle.value=(0,_reactNativeReanimated.withTiming)(1.2,{duration:100});};_f._closure={scale_panelHandle:scale_panelHandle,withTiming:_reactNativeReanimated.withTiming};_f.asString="function _f(event,ctx){const{scale_panelHandle,withTiming}=jsThis._closure;{ctx.x=event.x;ctx.y=event.y;scale_panelHandle.value=withTiming(1.2,{duration:100});}}";_f.__workletHash=16724930565684;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel2.js (55:13)";return _f;}(),onActive:function(){var _f=function _f(event,ctx){var clamp=function clamp(v,max){return Math.min(Math.max(v,0),max);};var x=event.translationX;var y=event.translationY;var posX=clamp(x+ctx.x,width);var posY=clamp(y+ctx.y,width);var percentX=posX/width;var percentY=posY/width;var hueX=Math.round(percentX*360);var saturationY=Math.round(100-percentY*100);huePanel2_handlePos.value=isRtl?percentX*width-width+thumbSize/2:percentX*width-thumbSize/2;saturationPanel2_handlePos.value=percentY*width-thumbSize/2;hue_handlePos.value=isRtl?width-hueX/360*width-width+hueThumbeSize.current/2:width-hueX/360*width-hueThumbeSize.current/2;saturationSlider_handlePos.value=isRtl?saturationY/100*width-width+saturationThumbeSize.current/2:saturationY/100*width-saturationThumbeSize.current/2;saturationPanel1_handlePos.value=isRtl?saturationY/100*width-width+panel1ThumbeSize.current/2:saturationY/100*width-panel1ThumbeSize.current/2;(0,_reactNativeReanimated.runOnJS)(updateHS)(hueX,saturationY);};_f._closure={width:width,huePanel2_handlePos:huePanel2_handlePos,isRtl:isRtl,thumbSize:thumbSize,saturationPanel2_handlePos:saturationPanel2_handlePos,hue_handlePos:hue_handlePos,hueThumbeSize:{current:hueThumbeSize.current},saturationSlider_handlePos:saturationSlider_handlePos,saturationThumbeSize:{current:saturationThumbeSize.current},saturationPanel1_handlePos:saturationPanel1_handlePos,panel1ThumbeSize:{current:panel1ThumbeSize.current},runOnJS:_reactNativeReanimated.runOnJS,updateHS:updateHS};_f.asString="function _f(event,ctx){const{width,huePanel2_handlePos,isRtl,thumbSize,saturationPanel2_handlePos,hue_handlePos,hueThumbeSize,saturationSlider_handlePos,saturationThumbeSize,saturationPanel1_handlePos,panel1ThumbeSize,runOnJS,updateHS}=jsThis._closure;{const clamp=function(v,max){return Math.min(Math.max(v,0),max);};const x=event.translationX;const y=event.translationY;const posX=clamp(x+ctx.x,width);const posY=clamp(y+ctx.y,width);const percentX=posX/width;const percentY=posY/width;const hueX=Math.round(percentX*360);const saturationY=Math.round(100-percentY*100);huePanel2_handlePos.value=isRtl?percentX*width-width+thumbSize/2:percentX*width-thumbSize/2;saturationPanel2_handlePos.value=percentY*width-thumbSize/2;hue_handlePos.value=isRtl?width-hueX/360*width-width+hueThumbeSize.current/2:width-hueX/360*width-hueThumbeSize.current/2;saturationSlider_handlePos.value=isRtl?saturationY/100*width-width+saturationThumbeSize.current/2:saturationY/100*width-saturationThumbeSize.current/2;saturationPanel1_handlePos.value=isRtl?saturationY/100*width-width+panel1ThumbeSize.current/2:saturationY/100*width-panel1ThumbeSize.current/2;runOnJS(updateHS)(hueX,saturationY);}}";_f.__workletHash=11116510440399;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel2.js (60:14)";return _f;}(),onFinish:function(){var _f=function _f(){scale_panelHandle.value=(0,_reactNativeReanimated.withTiming)(1,{duration:100});(0,_reactNativeReanimated.runOnJS)(onGestureEventFinish)();};_f._closure={scale_panelHandle:scale_panelHandle,withTiming:_reactNativeReanimated.withTiming,runOnJS:_reactNativeReanimated.runOnJS,onGestureEventFinish:onGestureEventFinish};_f.asString="function _f(){const{scale_panelHandle,withTiming,runOnJS,onGestureEventFinish}=jsThis._closure;{scale_panelHandle.value=withTiming(1,{duration:100});runOnJS(onGestureEventFinish)();}}";_f.__workletHash=291465260572;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Panel2.js (94:14)";return _f;}()});return _react.default.createElement(_reactNativeGestureHandler.PanGestureHandler,{onGestureEvent:panel_GestureEvent,minDist:0,__self:this,__source:{fileName:_jsxFileName,lineNumber:101,columnNumber:5}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.panel_container,style,{width:width,height:width},_GlobalStyles.default.override],__self:this,__source:{fileName:_jsxFileName,lineNumber:102,columnNumber:7}},_react.default.createElement(_reactNative.Image,{source:require('../assets/Background2.png'),style:{borderRadius:(_style$borderRadius=style.borderRadius)!=null?_style$borderRadius:5,width:width,height:width},__self:this,__source:{fileName:_jsxFileName,lineNumber:109,columnNumber:9}}),_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handle,{width:thumbSize,height:thumbSize,borderRadius:thumbSize/2},panel_handleStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:117,columnNumber:9}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handleInner,{borderRadius:thumbSize/2},previewColorWithoutOpacity],__self:this,__source:{fileName:_jsxFileName,lineNumber:127,columnNumber:11}}))));}
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Preview=Preview;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ColorsConversionFormulas=require("../ColorsConversionFormulas");var _this=this,_jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Preview.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CONTRAST_RATIO_MIN=4.5;var ReText=function ReText(_ref){var text=_ref.text,style=_ref.style;var _useState=(0,_react.useState)(text.value),_useState2=(0,_slicedToArray2.default)(_useState,2),color=_useState2[0],setColor=_useState2[1];(0,_reactNativeReanimated.useDerivedValue)(function(){var _f=function _f(){(0,_reactNativeReanimated.runOnJS)(setColor)(text.value);};_f._closure={runOnJS:_reactNativeReanimated.runOnJS,setColor:setColor,text:text};_f.asString="function _f(){const{runOnJS,setColor,text}=jsThis._closure;{runOnJS(setColor)(text.value);}}";_f.__workletHash=11531055256057;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Preview.js (11:18)";return _f;}(),[text.value]);return _react.default.createElement(_reactNativeReanimated.default.Text,{style:[styles.previewText].concat((0,_toConsumableArray2.default)(style)),__self:_this,__source:{fileName:_jsxFileName,lineNumber:16,columnNumber:5}},color);};function Preview(_ref2){var _style$justifyContent,_style$justifyContent2;var width=_ref2.width,initialColor=_ref2.initialColor,returnedResults=_ref2.returnedResults,value=_ref2.value,previewColorStyle=_ref2.previewColorStyle,previewText=_ref2.previewText,previewTextColorStyle=_ref2.previewTextColorStyle,previewColorFormat=_ref2.previewColorFormat,_ref2$style=_ref2.style,style=_ref2$style===void 0?{}:_ref2$style,_ref2$textStyle=_ref2.textStyle,textStyle=_ref2$textStyle===void 0?{}:_ref2$textStyle,_ref2$colorFormat=_ref2.colorFormat,colorFormat=_ref2$colorFormat===void 0?'hex':_ref2$colorFormat,_ref2$hideInitialColo=_ref2.hideInitialColor,hideInitialColor=_ref2$hideInitialColo===void 0?false:_ref2$hideInitialColo,_ref2$hideText=_ref2.hideText,hideText=_ref2$hideText===void 0?false:_ref2$hideText;previewColorFormat.current=colorFormat;var initialColorText=(0,_react.useMemo)(function(){var _initialColor$current=initialColor.current,h=_initialColor$current.h,s=_initialColor$current.s,b=_initialColor$current.b;var formated=returnedResults(initialColor.current)[previewColorFormat.current];var contrast=(0,_ColorsConversionFormulas.CONTRAST_RATIO)(h,s,b,'#fff');var color=contrast<CONTRAST_RATIO_MIN?'#000':'#fff';return{formated:formated,color:color};},[value,colorFormat]);return _react.default.createElement(_reactNative.View,{style:[styles.previewWrapper,{width:width},style],__self:this,__source:{fileName:_jsxFileName,lineNumber:50,columnNumber:5}},!hideInitialColor&&_react.default.createElement(_reactNative.View,{style:[styles.previewContainer,{backgroundColor:value,justifyContent:(_style$justifyContent=style.justifyContent)!=null?_style$justifyContent:'center'}],__self:this,__source:{fileName:_jsxFileName,lineNumber:52,columnNumber:9}},!hideText&&_react.default.createElement(_reactNative.Text,{style:[{color:initialColorText.color},styles.previewText,textStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:61,columnNumber:13}},initialColorText.formated)),_react.default.createElement(_reactNativeReanimated.default.View,{style:[styles.previewContainer,{justifyContent:(_style$justifyContent2=style.justifyContent)!=null?_style$justifyContent2:'center'},previewColorStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:72,columnNumber:7}},!hideText&&_react.default.createElement(ReText,{text:previewText,style:[textStyle,previewTextColorStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:79,columnNumber:11}})));}var styles=_reactNative.StyleSheet.create({previewWrapper:{flexDirection:'row',height:25,borderRadius:5,overflow:'hidden'},previewContainer:{flex:1,justifyContent:'center'},previewText:{fontWeight:'bold',textAlign:'center'}});
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SaturationSlider=SaturationSlider;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ColorsConversionFormulas=require("../ColorsConversionFormulas");var _GlobalStyles=_interopRequireDefault(require("../GlobalStyles"));var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\SaturationSlider.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isRtl=_reactNative.I18nManager.isRTL;function SaturationSlider(_ref){var _style$height,_style$borderRadius;var width=_ref.width,saturationThumbeSize=_ref.saturationThumbeSize,panel2ThumbeSize=_ref.panel2ThumbeSize,panel1ThumbeSize=_ref.panel1ThumbeSize,setHandlesPos=_ref.setHandlesPos,updateSaturation=_ref.updateSaturation,onGestureEventFinish=_ref.onGestureEventFinish,saturationPanel1_handlePos=_ref.saturationPanel1_handlePos,saturationPanel2_handlePos=_ref.saturationPanel2_handlePos,saturationSlider_handlePos=_ref.saturationSlider_handlePos,previewColorWithoutOpacity=_ref.previewColorWithoutOpacity,tracksHeight=_ref.tracksHeight,activeHueStyle=_ref.activeHueStyle,thumbsSize=_ref.thumbsSize,_ref$thumbSize=_ref.thumbSize,thumbSize=_ref$thumbSize===void 0?thumbsSize:_ref$thumbSize,_ref$ringColor=_ref.ringColor,ringColor=_ref$ringColor===void 0?'#ffffff':_ref$ringColor,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style;var trackHeight=(_style$height=style.height)!=null?_style$height:tracksHeight;saturationThumbeSize.current=thumbSize;ringColor=(0,_ColorsConversionFormulas.COLOR_HSVA)(ringColor);ringColor=(0,_ColorsConversionFormulas.HSV_HSL)(ringColor.h,ringColor.s,ringColor.b);ringColor=(0,_ColorsConversionFormulas.HSL_HEX)(ringColor.h,ringColor.s,ringColor.l);(0,_react.useEffect)(function(){setHandlesPos();},[]);var scale_saturationHandle=(0,_reactNativeReanimated.useSharedValue)(1);var saturation_handleStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{transform:[{translateX:saturationSlider_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_saturationHandle.value}]};};_f._closure={saturationSlider_handlePos:saturationSlider_handlePos,thumbSize:thumbSize,trackHeight:trackHeight,scale_saturationHandle:scale_saturationHandle};_f.asString="function _f(){const{saturationSlider_handlePos,thumbSize,trackHeight,scale_saturationHandle}=jsThis._closure;{return{transform:[{translateX:saturationSlider_handlePos.value},{translateY:-(thumbSize-trackHeight)/2},{scale:scale_saturationHandle.value}]};}}";_f.__workletHash=8409144042901;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\SaturationSlider.js (48:50)";_f.__optimalization=3;return _f;}());var SaturationGestureEvent=(0,_reactNativeReanimated.useAnimatedGestureHandler)({onStart:function(){var _f=function _f(event,ctx){ctx.x=event.x;scale_saturationHandle.value=(0,_reactNativeReanimated.withTiming)(1.2,{duration:100});};_f._closure={scale_saturationHandle:scale_saturationHandle,withTiming:_reactNativeReanimated.withTiming};_f.asString="function _f(event,ctx){const{scale_saturationHandle,withTiming}=jsThis._closure;{ctx.x=event.x;scale_saturationHandle.value=withTiming(1.2,{duration:100});}}";_f.__workletHash=8200568779217;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\SaturationSlider.js (58:15)";return _f;}(),onActive:function(){var _f=function _f(event,ctx){var clamp=function clamp(v,max){return Math.min(Math.max(v,0),max);};var x=event.translationX;var pos=clamp(x+ctx.x,width);var percent=pos/width;var saturationX=Math.round(percent*100);saturationSlider_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;saturationPanel1_handlePos.value=isRtl?saturationX/100*width-width+panel1ThumbeSize.current/2:saturationX/100*width-panel1ThumbeSize.current/2;saturationPanel2_handlePos.value=width-saturationX/100*width-panel2ThumbeSize.current/2;(0,_reactNativeReanimated.runOnJS)(updateSaturation)(saturationX);};_f._closure={width:width,saturationSlider_handlePos:saturationSlider_handlePos,isRtl:isRtl,thumbSize:thumbSize,saturationPanel1_handlePos:saturationPanel1_handlePos,panel1ThumbeSize:{current:panel1ThumbeSize.current},saturationPanel2_handlePos:saturationPanel2_handlePos,panel2ThumbeSize:{current:panel2ThumbeSize.current},runOnJS:_reactNativeReanimated.runOnJS,updateSaturation:updateSaturation};_f.asString="function _f(event,ctx){const{width,saturationSlider_handlePos,isRtl,thumbSize,saturationPanel1_handlePos,panel1ThumbeSize,saturationPanel2_handlePos,panel2ThumbeSize,runOnJS,updateSaturation}=jsThis._closure;{const clamp=function(v,max){return Math.min(Math.max(v,0),max);};const x=event.translationX;const pos=clamp(x+ctx.x,width);const percent=pos/width;const saturationX=Math.round(percent*100);saturationSlider_handlePos.value=isRtl?percent*width-width+thumbSize/2:percent*width-thumbSize/2;saturationPanel1_handlePos.value=isRtl?saturationX/100*width-width+panel1ThumbeSize.current/2:saturationX/100*width-panel1ThumbeSize.current/2;saturationPanel2_handlePos.value=width-saturationX/100*width-panel2ThumbeSize.current/2;runOnJS(updateSaturation)(saturationX);}}";_f.__workletHash=11798252180528;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\SaturationSlider.js (64:16)";return _f;}(),onFinish:function(){var _f=function _f(){scale_saturationHandle.value=(0,_reactNativeReanimated.withTiming)(1,{duration:100});(0,_reactNativeReanimated.runOnJS)(onGestureEventFinish)();};_f._closure={scale_saturationHandle:scale_saturationHandle,withTiming:_reactNativeReanimated.withTiming,runOnJS:_reactNativeReanimated.runOnJS,onGestureEventFinish:onGestureEventFinish};_f.asString="function _f(){const{scale_saturationHandle,withTiming,runOnJS,onGestureEventFinish}=jsThis._closure;{scale_saturationHandle.value=withTiming(1,{duration:100});runOnJS(onGestureEventFinish)();}}";_f.__workletHash=1049670520732;_f.__location="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\SaturationSlider.js (86:16)";return _f;}()},[width]);return _react.default.createElement(_reactNativeGestureHandler.PanGestureHandler,{onGestureEvent:SaturationGestureEvent,minDist:0,__self:this,__source:{fileName:_jsxFileName,lineNumber:95,columnNumber:5}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[{position:'relative',height:tracksHeight},style,{width:width},_GlobalStyles.default.override],__self:this,__source:{fileName:_jsxFileName,lineNumber:96,columnNumber:7}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.sliderImageContainer,{borderRadius:(_style$borderRadius=style.borderRadius)!=null?_style$borderRadius:5},activeHueStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:103,columnNumber:9}},_react.default.createElement(_reactNative.Image,{source:require('../assets/Saturation.png'),style:_GlobalStyles.default.sliderImage,__self:this,__source:{fileName:_jsxFileName,lineNumber:109,columnNumber:11}})),_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handle,{width:thumbSize,height:thumbSize,borderRadius:thumbSize/2,backgroundColor:ringColor+50,borderColor:ringColor},saturation_handleStyle],__self:this,__source:{fileName:_jsxFileName,lineNumber:114,columnNumber:9}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[_GlobalStyles.default.handleInner,{borderRadius:thumbSize/2},previewColorWithoutOpacity],__self:this,__source:{fileName:_jsxFileName,lineNumber:126,columnNumber:11}}))));}
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Swatches=Swatches;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _ColorsConversionFormulas=require("../ColorsConversionFormulas");var _jsxFileName="D:\\WebDevelopment\\ReactNative\\reanimated-color-picker\\src\\components\\Swatches.js";var SWATCHES_COLORS=['#f44336','#E91E63','#9C27B0','#673AB7','#3F51B5','#2196F3','#03A9F4','#00BCD4','#009688','#4CAF50','#8BC34A','#CDDC39','#FFEB3B','#FFC107','#FF9800','#FF5722','#795548','#9E9E9E','#607D8B'];function Swatches(_ref){var _this=this;var width=_ref.width,initialColor=_ref.initialColor,setHandlesPos=_ref.setHandlesPos,onChange=_ref.onChange,onComplete=_ref.onComplete,returnedResults=_ref.returnedResults,_ref$colors=_ref.colors,colors=_ref$colors===void 0?SWATCHES_COLORS:_ref$colors,_ref$style=_ref.style,style=_ref$style===void 0?{}:_ref$style,_ref$swatchStyle=_ref.swatchStyle,swatchStyle=_ref$swatchStyle===void 0?{}:_ref$swatchStyle;var _onPress=function onPress(swatch){initialColor.current=(0,_ColorsConversionFormulas.COLOR_HSVA)(swatch);setHandlesPos();onChange==null?void 0:onChange(returnedResults());onComplete==null?void 0:onComplete(returnedResults());};return _react.default.createElement(_reactNative.View,{style:[styles.swatcheContainer,{width:width},style],__self:this,__source:{fileName:_jsxFileName,lineNumber:47,columnNumber:5}},colors.map(function(swatch,i){return _react.default.createElement(_reactNative.Pressable,{key:swatch+i,onPress:function onPress(){return _onPress(swatch);},style:[styles.swatch,swatchStyle,{backgroundColor:swatch}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:49,columnNumber:9}});}));}var styles=_reactNative.StyleSheet.create({swatcheContainer:{flexDirection:'row',flexWrap:'wrap',justifyContent:'space-between'},swatch:{width:30,height:30,borderRadius:15,marginHorizontal:5,marginBottom:15,shadowColor:'#000',shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84,elevation:5}});
package/lib/index.d.ts DELETED
@@ -1,158 +0,0 @@
1
- import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
-
3
- interface returnedResults {
4
- hex: string;
5
- rgb: string;
6
- rgba: string;
7
- hsl: string;
8
- hsla: string;
9
- hsv: string;
10
- hsva: string;
11
- }
12
-
13
- interface ColorPickerProps {
14
- /** - hue and opacity sliders track height. */
15
- tracksHeight?: number;
16
-
17
- /** - sliders handles (thumbs) size (height*width). */
18
- thumbsSize?: number;
19
-
20
- /** - color picker component width. */
21
- width?: number;
22
-
23
- /**
24
- * - color picker wrapper style.
25
- * - if you want to change the width use the width prop.
26
- */
27
- style?: StyleProp<ViewStyle>;
28
-
29
- /**
30
- * - initial color.
31
- * - Accepts `hex`, `rgb`, `rgba`, `hsl`, `hsla`, and `named color` formats.
32
- */
33
- value?: string;
34
-
35
- /** - called when the user moves the sliders. */
36
- onChange?: (colors: returnedResults) => void;
37
-
38
- /** - called when the user lifts his finger off the sliders. */
39
- onComplete?: (colors: returnedResults) => void;
40
-
41
- children?: React.ReactNode;
42
- }
43
-
44
- interface SwatchesPorps {
45
- /**
46
- * - swatch style.
47
- * - **Note** some of the style properties will be overwritten.
48
- */
49
- swatchStyle?: StyleProp<ViewStyle>;
50
-
51
- /** - swatches container style. */
52
- style?: StyleProp<ViewStyle>;
53
-
54
- /** - provide your own swatches colors. */
55
- colors?: string[];
56
- }
57
-
58
- interface PreviewPorps {
59
- /** - show color preview in specific format. */
60
- colorFormat?: 'hex' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hsv' | 'hsva';
61
-
62
- /** - hide initial color preview and show the picked color preview only. */
63
- hideInitialColor?: boolean;
64
-
65
- /** - hide color preview text. */
66
- hideText?: boolean;
67
-
68
- /**
69
- * - preview container style.
70
- * - **Note** some of the style properties will be overwritten.
71
- */
72
- style?: StyleProp<ViewStyle>;
73
-
74
- /**
75
- * - preview text style.
76
- * - **Note** `color` is immutable.
77
- */
78
- textStyle?: StyleProp<TextStyle>;
79
- }
80
-
81
- interface PanelProps {
82
- /** - panel handle (thumb) size (height*width). */
83
- thumbSize?: number;
84
-
85
- /**
86
- * - panle container style.
87
- * - **Note** some of the style properties will be overwritten.
88
- */
89
- style?: StyleProp<ViewStyle>;
90
- }
91
-
92
- interface HueProps {
93
- /** - hue slider handle (thumb) size (height*width). */
94
- thumbSize?: number;
95
-
96
- /** - hue slider handle (thumb) ring color. */
97
- ringColor?: string;
98
-
99
- /**
100
- * - hue slider container style.
101
- * - **Note** some of the style properties will be overwritten.
102
- */
103
- style?: StyleProp<ViewStyle>;
104
- }
105
-
106
- interface BrightnessProps {
107
- /** - brightness slider handle (thumb) size (height*width). */
108
- thumbSize?: number;
109
-
110
- /** - brightness slider handle (thumb) ring color. */
111
- ringColor?: string;
112
-
113
- /**
114
- * - brightness slider container style.
115
- * - **Note** some of the style properties will be overwritten.
116
- */
117
- style?: StyleProp<ViewStyle>;
118
- }
119
-
120
- interface SaturationProps {
121
- /** - saturation slider handle (thumb) size (height*width). */
122
- thumbSize?: number;
123
-
124
- /** - saturation slider handle (thumb) ring color. */
125
- ringColor?: string;
126
-
127
- /**
128
- * - saturation slider container style.
129
- * - **Note** some of the style properties will be overwritten.
130
- */
131
- style?: StyleProp<ViewStyle>;
132
- }
133
-
134
- interface OpacityProps {
135
- /** - opacity slider handle (thumb) size (height*width). */
136
- thumbSize?: number;
137
-
138
- /** - opacity slider handle (thumb) ring color. */
139
- ringColor?: string;
140
-
141
- /**
142
- * - opacity slider container style.
143
- * - **Note** some of the style properties will be overwritten.
144
- */
145
- style?: StyleProp<ViewStyle>;
146
- }
147
-
148
- declare const ColorPicker: React.FunctionComponent<ColorPickerProps>;
149
- export declare const Preview: React.FunctionComponent<PreviewPorps>;
150
- export declare const Panel1: React.FunctionComponent<PanelProps>;
151
- export declare const Panel2: React.FunctionComponent<PanelProps>;
152
- export declare const HueSlider: React.FunctionComponent<HueProps>;
153
- export declare const BrightnessSlider: React.FunctionComponent<BrightnessProps>;
154
- export declare const SaturationSlider: React.FunctionComponent<SaturationProps>;
155
- export declare const OpacitySlider: React.FunctionComponent<OpacityProps>;
156
- export declare const Swatches: React.FunctionComponent<SwatchesPorps>;
157
-
158
- export default ColorPicker;
package/lib/index.js DELETED
@@ -1 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BrightnessSlider",{enumerable:true,get:function get(){return _BrightnessSlider.BrightnessSlider;}});Object.defineProperty(exports,"HueSlider",{enumerable:true,get:function get(){return _HueSlider.HueSlider;}});Object.defineProperty(exports,"OpacitySlider",{enumerable:true,get:function get(){return _OpacitySlider.OpacitySlider;}});Object.defineProperty(exports,"Panel1",{enumerable:true,get:function get(){return _Panel.Panel1;}});Object.defineProperty(exports,"Panel2",{enumerable:true,get:function get(){return _Panel2.Panel2;}});Object.defineProperty(exports,"Preview",{enumerable:true,get:function get(){return _Preview.Preview;}});Object.defineProperty(exports,"SaturationSlider",{enumerable:true,get:function get(){return _SaturationSlider.SaturationSlider;}});Object.defineProperty(exports,"Swatches",{enumerable:true,get:function get(){return _Swatches.Swatches;}});exports.default=void 0;var _ColorPicker=_interopRequireDefault(require("./ColorPicker.js"));var _Panel=require("./components/Panel1.js");var _Panel2=require("./components/Panel2.js");var _Preview=require("./components/Preview.js");var _HueSlider=require("./components/HueSlider.js");var _SaturationSlider=require("./components/SaturationSlider.js");var _BrightnessSlider=require("./components/BrightnessSlider.js");var _OpacitySlider=require("./components/OpacitySlider.js");var _Swatches=require("./components/Swatches.js");var _default=_ColorPicker.default;exports.default=_default;