@ledvance/base 1.2.81 → 1.2.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/.babelrc +31 -31
  2. package/.eslintignore +5 -5
  3. package/.eslintrc.js +27 -27
  4. package/.prettierrc.js +1 -1
  5. package/.versionrc +5 -5
  6. package/localazy.json +848 -848
  7. package/localazy.keys.json +4 -4
  8. package/package.json +74 -74
  9. package/rn-cli.config.js +8 -8
  10. package/src/api/native.d.ts +71 -71
  11. package/src/api/native.ts +423 -423
  12. package/src/api/nativeEventEmitter.d.ts +3 -3
  13. package/src/api/nativeEventEmitter.ts +125 -125
  14. package/src/components/AdvanceCard.d.ts +25 -25
  15. package/src/components/AdvanceCard.tsx +117 -117
  16. package/src/components/AdvanceList.d.ts +9 -9
  17. package/src/components/AdvanceList.tsx +69 -69
  18. package/src/components/ApplyForDeviceItem.d.ts +6 -6
  19. package/src/components/ApplyForDeviceItem.tsx +83 -83
  20. package/src/components/ApplyForDeviceList.d.ts +7 -7
  21. package/src/components/ApplyForDeviceList.tsx +61 -61
  22. package/src/components/ApplyForText.d.ts +6 -6
  23. package/src/components/ApplyForText.tsx +52 -52
  24. package/src/components/Card.d.ts +10 -10
  25. package/src/components/Card.tsx +40 -40
  26. package/src/components/Cell.d.ts +21 -21
  27. package/src/components/Cell.tsx +69 -69
  28. package/src/components/CircularProgress.d.ts +8 -8
  29. package/src/components/CircularProgress.tsx +42 -42
  30. package/src/components/ColorAdjustView.d.ts +12 -12
  31. package/src/components/ColorAdjustView.tsx +64 -64
  32. package/src/components/ColorExtractor.d.ts +73 -73
  33. package/src/components/ColorExtractor.tsx +374 -374
  34. package/src/components/ColorTempAdjustView.d.ts +13 -13
  35. package/src/components/ColorTempAdjustView.tsx +57 -57
  36. package/src/components/ColorsLine.d.ts +7 -7
  37. package/src/components/ColorsLine.tsx +47 -47
  38. package/src/components/CustomListDialog.d.ts +15 -15
  39. package/src/components/CustomListDialog.tsx +66 -65
  40. package/src/components/DeleteButton.d.ts +10 -10
  41. package/src/components/DeleteButton.tsx +40 -40
  42. package/src/components/Dialog.d.ts +10 -10
  43. package/src/components/Dialog.tsx +38 -38
  44. package/src/components/DrawToolView.d.ts +46 -46
  45. package/src/components/DrawToolView.tsx +262 -262
  46. package/src/components/FanAdjustView.d.ts +23 -23
  47. package/src/components/FanAdjustView.tsx +141 -141
  48. package/src/components/InfoText.d.ts +11 -11
  49. package/src/components/InfoText.tsx +45 -45
  50. package/src/components/LampAdjustView.d.ts +10 -10
  51. package/src/components/LampAdjustView.tsx +75 -75
  52. package/src/components/LampAdjustView2.d.ts +24 -24
  53. package/src/components/LampAdjustView2.tsx +104 -104
  54. package/src/components/LinearGradientLine.d.ts +9 -9
  55. package/src/components/LinearGradientLine.tsx +63 -63
  56. package/src/components/LoadingView.tsx +39 -39
  57. package/src/components/MoodColorsLine.d.ts +9 -9
  58. package/src/components/MoodColorsLine.tsx +38 -38
  59. package/src/components/Page.d.ts +21 -21
  60. package/src/components/Page.tsx +104 -104
  61. package/src/components/Popup.d.ts +7 -7
  62. package/src/components/Popup.tsx +71 -71
  63. package/src/components/Segmented.d.ts +14 -14
  64. package/src/components/Segmented.tsx +76 -76
  65. package/src/components/ShowSelect.d.ts +1 -1
  66. package/src/components/ShowSelect.tsx +158 -158
  67. package/src/components/SocketItem.d.ts +13 -13
  68. package/src/components/SocketItem.tsx +87 -87
  69. package/src/components/Spacer.d.ts +7 -7
  70. package/src/components/Spacer.tsx +13 -13
  71. package/src/components/Stepper.d.ts +19 -19
  72. package/src/components/Stepper.tsx +130 -130
  73. package/src/components/StripAdjustView.d.ts +16 -16
  74. package/src/components/StripAdjustView.tsx +129 -129
  75. package/src/components/StripLightView.d.ts +14 -14
  76. package/src/components/StripLightView.tsx +24 -24
  77. package/src/components/Summary.tsx +116 -124
  78. package/src/components/Tag.d.ts +8 -8
  79. package/src/components/Tag.tsx +56 -56
  80. package/src/components/TextButton.d.ts +9 -9
  81. package/src/components/TextButton.tsx +31 -31
  82. package/src/components/TextField.d.ts +9 -9
  83. package/src/components/TextField.tsx +92 -92
  84. package/src/components/TextFieldStyleButton.d.ts +8 -8
  85. package/src/components/TextFieldStyleButton.tsx +85 -85
  86. package/src/components/UATabTitle.d.ts +6 -6
  87. package/src/components/UATabTitle.tsx +31 -31
  88. package/src/components/UATabs.d.ts +12 -12
  89. package/src/components/UATabs.tsx +77 -77
  90. package/src/components/connect.d.ts +10 -10
  91. package/src/components/connect.tsx +20 -20
  92. package/src/components/ldvColorBrightness.d.ts +1 -1
  93. package/src/components/ldvColorBrightness.tsx +18 -18
  94. package/src/components/ldvColorSlider.d.ts +14 -14
  95. package/src/components/ldvColorSlider.tsx +131 -131
  96. package/src/components/ldvItemView.d.ts +12 -12
  97. package/src/components/ldvItemView.tsx +43 -43
  98. package/src/components/ldvPickerView.d.ts +13 -13
  99. package/src/components/ldvPickerView.tsx +97 -97
  100. package/src/components/ldvPresetView.d.ts +2 -2
  101. package/src/components/ldvPresetView.tsx +86 -86
  102. package/src/components/ldvSaturation.d.ts +2 -2
  103. package/src/components/ldvSaturation.tsx +22 -22
  104. package/src/components/ldvSlider.d.ts +15 -15
  105. package/src/components/ldvSlider.tsx +103 -103
  106. package/src/components/ldvSwitch.d.ts +10 -10
  107. package/src/components/ldvSwitch.tsx +52 -52
  108. package/src/components/ldvTemperatureSlider.d.ts +13 -13
  109. package/src/components/ldvTemperatureSlider.tsx +139 -139
  110. package/src/components/ldvTopBar.d.ts +10 -10
  111. package/src/components/ldvTopBar.tsx +76 -76
  112. package/src/components/ldvTopName.d.ts +9 -9
  113. package/src/components/ldvTopName.tsx +63 -63
  114. package/src/components/segmentControl.d.ts +1 -1
  115. package/src/components/segmentControl.tsx +65 -65
  116. package/src/components/weekSelect.d.ts +7 -7
  117. package/src/components/weekSelect.tsx +98 -98
  118. package/src/composeLayout.d.ts +30 -30
  119. package/src/composeLayout.tsx +261 -261
  120. package/src/config/dark-theme.ts +61 -61
  121. package/src/config/light-theme.ts +61 -61
  122. package/src/hooks/Hooks.d.ts +2 -2
  123. package/src/hooks/Hooks.ts +8 -8
  124. package/src/i18n/index.d.ts +16 -16
  125. package/src/i18n/index.ts +37 -37
  126. package/src/i18n/strings.d.ts +15953 -15953
  127. package/src/i18n/strings.ts +23723 -23723
  128. package/src/main.tsx +9 -9
  129. package/src/models/GlobalParams.d.ts +14 -14
  130. package/src/models/GlobalParams.ts +14 -14
  131. package/src/models/TuyaApi.d.ts +29 -29
  132. package/src/models/TuyaApi.ts +92 -92
  133. package/src/models/combine.d.ts +26 -26
  134. package/src/models/combine.ts +17 -17
  135. package/src/models/configureStore.d.ts +9 -9
  136. package/src/models/configureStore.ts +33 -33
  137. package/src/models/index.d.ts +31 -31
  138. package/src/models/index.ts +22 -22
  139. package/src/models/modules/NativePropsSlice.d.ts +61 -61
  140. package/src/models/modules/NativePropsSlice.tsx +467 -467
  141. package/src/models/modules/Result.d.ts +14 -14
  142. package/src/models/modules/Result.ts +15 -15
  143. package/src/models/modules/common.d.ts +44 -44
  144. package/src/models/modules/common.ts +161 -161
  145. package/src/res/index.d.ts +70 -70
  146. package/src/res/index.ts +73 -73
  147. package/src/utils/ColorParser.d.ts +66 -66
  148. package/src/utils/ColorParser.ts +189 -189
  149. package/src/utils/ColorUtils.d.ts +71 -71
  150. package/src/utils/ColorUtils.tsx +448 -448
  151. package/src/utils/Support.d.ts +13 -13
  152. package/src/utils/Support.ts +108 -108
  153. package/src/utils/TypeUtils.d.ts +3 -3
  154. package/src/utils/cctUtils.d.ts +1 -1
  155. package/src/utils/cctUtils.ts +110 -110
  156. package/src/utils/common.d.ts +35 -35
  157. package/src/utils/common.ts +379 -379
  158. package/src/utils/index.d.ts +26 -26
  159. package/src/utils/index.ts +191 -191
  160. package/src/utils/interface.d.ts +6 -6
  161. package/src/utils/interface.ts +50 -11
  162. package/src/utils/loopsCompare.d.ts +1 -1
  163. package/src/utils/loopsCompare.ts +62 -62
  164. package/tsconfig.json +50 -50
  165. package/update-localazy.py +52 -52
@@ -1,40 +1,40 @@
1
- import {Platform, StyleProp, TouchableOpacity, View, ViewProps, ViewStyle} from 'react-native'
2
- import React, {PropsWithChildren} from 'react'
3
- import {Utils} from 'tuya-panel-kit'
4
-
5
- const cx = Utils.RatioUtils.convertX
6
- const { withTheme } = Utils.ThemeUtils
7
-
8
- interface CardProps extends PropsWithChildren<ViewProps> {
9
- theme?: any
10
- shadowHeight?: number | undefined
11
- onPress?: () => void
12
- onLongPress?: () => void
13
- containerStyle?: StyleProp<ViewStyle>
14
- }
15
-
16
- const Card = (props: CardProps) => {
17
- const shadowHeight = props.shadowHeight || cx(7)
18
- return (
19
- <View
20
- style={[{
21
- overflow: Platform.OS === 'ios' ? undefined : 'hidden',
22
- backgroundColor: props.theme.card.background,
23
- elevation: shadowHeight,
24
- shadowColor: props.theme.card.shadowColor,
25
- shadowOpacity: 0.2,
26
- shadowRadius: shadowHeight,
27
- shadowOffset: {
28
- width: 0,
29
- height: shadowHeight,
30
- },
31
- borderRadius: cx(10),
32
- }, props.style]}>
33
- <TouchableOpacity disabled={!(!!props.onPress)} onPress={props.onPress} onLongPress={props.onLongPress}>
34
- <View style={props.containerStyle}>{props.children}</View>
35
- </TouchableOpacity>
36
- </View>
37
- )
38
- }
39
-
40
- export default withTheme(Card)
1
+ import {Platform, StyleProp, TouchableOpacity, View, ViewProps, ViewStyle} from 'react-native'
2
+ import React, {PropsWithChildren} from 'react'
3
+ import {Utils} from 'tuya-panel-kit'
4
+
5
+ const cx = Utils.RatioUtils.convertX
6
+ const { withTheme } = Utils.ThemeUtils
7
+
8
+ interface CardProps extends PropsWithChildren<ViewProps> {
9
+ theme?: any
10
+ shadowHeight?: number | undefined
11
+ onPress?: () => void
12
+ onLongPress?: () => void
13
+ containerStyle?: StyleProp<ViewStyle>
14
+ }
15
+
16
+ const Card = (props: CardProps) => {
17
+ const shadowHeight = props.shadowHeight || cx(7)
18
+ return (
19
+ <View
20
+ style={[{
21
+ overflow: Platform.OS === 'ios' ? undefined : 'hidden',
22
+ backgroundColor: props.theme.card.background,
23
+ elevation: shadowHeight,
24
+ shadowColor: props.theme.card.shadowColor,
25
+ shadowOpacity: 0.2,
26
+ shadowRadius: shadowHeight,
27
+ shadowOffset: {
28
+ width: 0,
29
+ height: shadowHeight,
30
+ },
31
+ borderRadius: cx(10),
32
+ }, props.style]}>
33
+ <TouchableOpacity disabled={!(!!props.onPress)} onPress={props.onPress} onLongPress={props.onLongPress}>
34
+ <View style={props.containerStyle}>{props.children}</View>
35
+ </TouchableOpacity>
36
+ </View>
37
+ )
38
+ }
39
+
40
+ export default withTheme(Card)
@@ -1,21 +1,21 @@
1
- import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
- interface CellProps {
3
- title: string;
4
- value: string;
5
- onPress: () => void;
6
- style?: StyleProp<ViewStyle>;
7
- }
8
- export default function Cell(props: CellProps): JSX.Element;
9
- interface CellContentProps {
10
- title: string;
11
- value: string;
12
- style?: StyleProp<ViewStyle>;
13
- titleStyle?: StyleProp<TextStyle>;
14
- valueStyle?: StyleProp<TextStyle>;
15
- iconStyle?: {
16
- color?: any;
17
- size?: number;
18
- };
19
- }
20
- export declare function CellContent(props: CellContentProps): JSX.Element;
21
- export {};
1
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ interface CellProps {
3
+ title: string;
4
+ value: string;
5
+ onPress: () => void;
6
+ style?: StyleProp<ViewStyle>;
7
+ }
8
+ export default function Cell(props: CellProps): JSX.Element;
9
+ interface CellContentProps {
10
+ title: string;
11
+ value: string;
12
+ style?: StyleProp<ViewStyle>;
13
+ titleStyle?: StyleProp<TextStyle>;
14
+ valueStyle?: StyleProp<TextStyle>;
15
+ iconStyle?: {
16
+ color?: any;
17
+ size?: number;
18
+ };
19
+ }
20
+ export declare function CellContent(props: CellContentProps): JSX.Element;
21
+ export {};
@@ -1,70 +1,70 @@
1
- import { IconFont, Utils } from 'tuya-panel-kit'
2
- import { StyleProp, Text, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native'
3
- import React from 'react'
4
-
5
- const cx = Utils.RatioUtils.convertX
6
-
7
- interface CellProps {
8
- title: string,
9
- value: string,
10
- onPress: () => void,
11
- style?: StyleProp<ViewStyle>
12
- }
13
-
14
- export default function Cell(props: CellProps) {
15
- return (
16
- <TouchableOpacity
17
- style={[{
18
- height: cx(50),
19
- paddingHorizontal: cx(24),
20
- justifyContent: 'center',
21
- }, props.style]}
22
- onPress={props.onPress}>
23
- <CellContent title={props.title} value={props.value} />
24
- </TouchableOpacity>
25
- )
26
- }
27
-
28
- interface CellContentProps {
29
- title: string
30
- value: string
31
- style?: StyleProp<ViewStyle>
32
- titleStyle?: StyleProp<TextStyle>
33
- valueStyle?: StyleProp<TextStyle>
34
- iconStyle?: { color?: any, size?: number }
35
- }
36
-
37
- export function CellContent(props: CellContentProps) {
38
- return (
39
- <View
40
- style={[
41
- { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' },
42
- props.style,
43
- ]}>
44
- <Text
45
- style={[
46
- {
47
- fontSize: cx(14),
48
- color: '#444',
49
- fontFamily: 'helvetica_neue_lt_std_roman',
50
- },
51
- props.titleStyle,
52
- ]}>{props.title}</Text>
53
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
54
- <Text style={[
55
- {
56
- fontSize: cx(14),
57
- color: '#444',
58
- fontFamily: 'helvetica_neue_lt_std_roman',
59
- },
60
- props.valueStyle,
61
- ]}>{props.value}</Text>
62
- <View style={{ width: cx(4) }} />
63
- <IconFont
64
- name="arrow"
65
- color={props.iconStyle?.color || '#444'}
66
- size={props.iconStyle?.size || cx(11)} />
67
- </View>
68
- </View>
69
- )
1
+ import { IconFont, Utils } from 'tuya-panel-kit'
2
+ import { StyleProp, Text, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native'
3
+ import React from 'react'
4
+
5
+ const cx = Utils.RatioUtils.convertX
6
+
7
+ interface CellProps {
8
+ title: string,
9
+ value: string,
10
+ onPress: () => void,
11
+ style?: StyleProp<ViewStyle>
12
+ }
13
+
14
+ export default function Cell(props: CellProps) {
15
+ return (
16
+ <TouchableOpacity
17
+ style={[{
18
+ height: cx(50),
19
+ paddingHorizontal: cx(24),
20
+ justifyContent: 'center',
21
+ }, props.style]}
22
+ onPress={props.onPress}>
23
+ <CellContent title={props.title} value={props.value} />
24
+ </TouchableOpacity>
25
+ )
26
+ }
27
+
28
+ interface CellContentProps {
29
+ title: string
30
+ value: string
31
+ style?: StyleProp<ViewStyle>
32
+ titleStyle?: StyleProp<TextStyle>
33
+ valueStyle?: StyleProp<TextStyle>
34
+ iconStyle?: { color?: any, size?: number }
35
+ }
36
+
37
+ export function CellContent(props: CellContentProps) {
38
+ return (
39
+ <View
40
+ style={[
41
+ { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' },
42
+ props.style,
43
+ ]}>
44
+ <Text
45
+ style={[
46
+ {
47
+ fontSize: cx(14),
48
+ color: '#444',
49
+ fontFamily: 'helvetica_neue_lt_std_roman',
50
+ },
51
+ props.titleStyle,
52
+ ]}>{props.title}</Text>
53
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
54
+ <Text style={[
55
+ {
56
+ fontSize: cx(14),
57
+ color: '#444',
58
+ fontFamily: 'helvetica_neue_lt_std_roman',
59
+ },
60
+ props.valueStyle,
61
+ ]}>{props.value}</Text>
62
+ <View style={{ width: cx(4) }} />
63
+ <IconFont
64
+ name="arrow"
65
+ color={props.iconStyle?.color || '#444'}
66
+ size={props.iconStyle?.size || cx(11)} />
67
+ </View>
68
+ </View>
69
+ )
70
70
  }
@@ -1,8 +1,8 @@
1
- import { ViewProps } from 'react-native';
2
- import { PropsWithChildren } from 'react';
3
- export interface CircularProgressProps extends PropsWithChildren<ViewProps> {
4
- progress: number;
5
- size: number;
6
- strokeWidth: number;
7
- }
8
- export declare function CircularProgress(props: CircularProgressProps): JSX.Element;
1
+ import { ViewProps } from 'react-native';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface CircularProgressProps extends PropsWithChildren<ViewProps> {
4
+ progress: number;
5
+ size: number;
6
+ strokeWidth: number;
7
+ }
8
+ export declare function CircularProgress(props: CircularProgressProps): JSX.Element;
@@ -1,43 +1,43 @@
1
- import { View, ViewProps } from 'react-native'
2
- import { Progress } from 'tuya-panel-kit'
3
- import React, { PropsWithChildren } from 'react'
4
-
5
- export interface CircularProgressProps extends PropsWithChildren<ViewProps> {
6
- progress: number
7
- size: number
8
- strokeWidth: number
9
- }
10
-
11
- export function CircularProgress(props: CircularProgressProps) {
12
- return <Progress
13
- foreColor={{
14
- '0%': '#f60',
15
- '100%': '#f60',
16
- }}
17
- style={[{ width: props.size, height: props.size }, props.style]}
18
- disabled={true}
19
- needMaxCircle={true}
20
- thumbRadius={Math.trunc(props.strokeWidth / 2)}
21
- thumbStroke={'#f60'}
22
- thumbFill={'#f60'}
23
- thumbStrokeWidth={0}
24
- scaleHeight={props.strokeWidth}
25
- value={props.progress}
26
- startDegree={270}
27
- andDegree={360}
28
- renderCenterView={
29
- <View
30
- style={{
31
- position: 'absolute',
32
- width: props.size - props.strokeWidth,
33
- height: props.size - props.strokeWidth,
34
- marginStart: props.strokeWidth,
35
- marginTop: props.strokeWidth,
36
- flexDirection: 'row',
37
- justifyContent: 'center',
38
- alignItems: 'center',
39
- }}>
40
- {props.children}
41
- </View>
42
- }/>
1
+ import { View, ViewProps } from 'react-native'
2
+ import { Progress } from 'tuya-panel-kit'
3
+ import React, { PropsWithChildren } from 'react'
4
+
5
+ export interface CircularProgressProps extends PropsWithChildren<ViewProps> {
6
+ progress: number
7
+ size: number
8
+ strokeWidth: number
9
+ }
10
+
11
+ export function CircularProgress(props: CircularProgressProps) {
12
+ return <Progress
13
+ foreColor={{
14
+ '0%': '#f60',
15
+ '100%': '#f60',
16
+ }}
17
+ style={[{ width: props.size, height: props.size }, props.style]}
18
+ disabled={true}
19
+ needMaxCircle={true}
20
+ thumbRadius={Math.trunc(props.strokeWidth / 2)}
21
+ thumbStroke={'#f60'}
22
+ thumbFill={'#f60'}
23
+ thumbStrokeWidth={0}
24
+ scaleHeight={props.strokeWidth}
25
+ value={props.progress}
26
+ startDegree={270}
27
+ andDegree={360}
28
+ renderCenterView={
29
+ <View
30
+ style={{
31
+ position: 'absolute',
32
+ width: props.size - props.strokeWidth,
33
+ height: props.size - props.strokeWidth,
34
+ marginStart: props.strokeWidth,
35
+ marginTop: props.strokeWidth,
36
+ flexDirection: 'row',
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ }}>
40
+ {props.children}
41
+ </View>
42
+ }/>
43
43
  }
@@ -1,12 +1,12 @@
1
- export interface ColorAdjustViewProps {
2
- h: number;
3
- s: number;
4
- v: number;
5
- minBrightness?: number;
6
- minSaturation?: number;
7
- reserveSV?: boolean;
8
- onHSVChange?: (h: number, s: number, v: number) => void;
9
- onHSVChangeComplete: (h: number, s: number, v: number) => void;
10
- }
11
- declare const ColorAdjustView: (props: ColorAdjustViewProps) => JSX.Element;
12
- export default ColorAdjustView;
1
+ export interface ColorAdjustViewProps {
2
+ h: number;
3
+ s: number;
4
+ v: number;
5
+ minBrightness?: number;
6
+ minSaturation?: number;
7
+ reserveSV?: boolean;
8
+ onHSVChange?: (h: number, s: number, v: number) => void;
9
+ onHSVChangeComplete: (h: number, s: number, v: number) => void;
10
+ }
11
+ declare const ColorAdjustView: (props: ColorAdjustViewProps) => JSX.Element;
12
+ export default ColorAdjustView;
@@ -1,65 +1,65 @@
1
- import {View} from 'react-native'
2
- import React from 'react'
3
- import LdvColorSlider from './ldvColorSlider'
4
- import {hex2Hsv, hsv2Hex} from '../utils'
5
- import LdvPresetView from './ldvPresetView'
6
- import LdvSaturation from './ldvSaturation'
7
- import LdvColorBrightness from './ldvColorBrightness'
8
- import I18n from '../i18n/index'
9
-
10
- export interface ColorAdjustViewProps {
11
- h: number
12
- s: number
13
- v: number
14
- minBrightness?: number // 最小亮度
15
- minSaturation?: number // 最小Saturation
16
- reserveSV?: boolean // 保留 s v
17
- onHSVChange?: (h: number, s: number, v: number) => void
18
- onHSVChangeComplete: (h: number, s: number, v: number) => void
19
- }
20
-
21
- const ColorAdjustView = (props: ColorAdjustViewProps) => {
22
- return (
23
- <View>
24
- <LdvColorSlider
25
- type={'color'}
26
- title={I18n.getLang('light_sources_tile_sec_lighting_shade')}
27
- thumbColor={hsv2Hex(props.h, 100, 100)}
28
- value={props.h}
29
- onValueChange={hue => {
30
- props.onHSVChange && props.onHSVChange(hue, props.s, props.v)
31
- }}
32
- onSlidingComplete={hue => {
33
- props.onHSVChangeComplete(hue, props.s, props.v)
34
- }}/>
35
- <LdvPresetView
36
- type={'color'}
37
- onPress={(item) => {
38
- const hsv = hex2Hsv(item.color)
39
- if (hsv) {
40
- props.onHSVChangeComplete(hsv.h, props.reserveSV ? props.s : hsv.s, props.reserveSV ? props.v : hsv.v)
41
- }
42
- }}/>
43
- <LdvSaturation
44
- value={props.s}
45
- minSaturation={props.minSaturation}
46
- onValueChange={s => {
47
- props.onHSVChange && props.onHSVChange(props.h, s, props.v)
48
- }}
49
- onSlidingComplete={s => {
50
- props.onHSVChangeComplete(props.h, s, props.v)
51
- }}/>
52
- <LdvColorBrightness
53
- minBrightness={props.minBrightness}
54
- value={props.v}
55
- onValueChange={v => {
56
- props.onHSVChange && props.onHSVChange(props.h, props.s, v)
57
- }}
58
- onSlidingComplete={v => {
59
- props.onHSVChangeComplete(props.h, props.s, v)
60
- }}/>
61
- </View>
62
- )
63
- }
64
-
1
+ import {View} from 'react-native'
2
+ import React from 'react'
3
+ import LdvColorSlider from './ldvColorSlider'
4
+ import {hex2Hsv, hsv2Hex} from '../utils'
5
+ import LdvPresetView from './ldvPresetView'
6
+ import LdvSaturation from './ldvSaturation'
7
+ import LdvColorBrightness from './ldvColorBrightness'
8
+ import I18n from '../i18n/index'
9
+
10
+ export interface ColorAdjustViewProps {
11
+ h: number
12
+ s: number
13
+ v: number
14
+ minBrightness?: number // 最小亮度
15
+ minSaturation?: number // 最小Saturation
16
+ reserveSV?: boolean // 保留 s v
17
+ onHSVChange?: (h: number, s: number, v: number) => void
18
+ onHSVChangeComplete: (h: number, s: number, v: number) => void
19
+ }
20
+
21
+ const ColorAdjustView = (props: ColorAdjustViewProps) => {
22
+ return (
23
+ <View>
24
+ <LdvColorSlider
25
+ type={'color'}
26
+ title={I18n.getLang('light_sources_tile_sec_lighting_shade')}
27
+ thumbColor={hsv2Hex(props.h, 100, 100)}
28
+ value={props.h}
29
+ onValueChange={hue => {
30
+ props.onHSVChange && props.onHSVChange(hue, props.s, props.v)
31
+ }}
32
+ onSlidingComplete={hue => {
33
+ props.onHSVChangeComplete(hue, props.s, props.v)
34
+ }}/>
35
+ <LdvPresetView
36
+ type={'color'}
37
+ onPress={(item) => {
38
+ const hsv = hex2Hsv(item.color)
39
+ if (hsv) {
40
+ props.onHSVChangeComplete(hsv.h, props.reserveSV ? props.s : hsv.s, props.reserveSV ? props.v : hsv.v)
41
+ }
42
+ }}/>
43
+ <LdvSaturation
44
+ value={props.s}
45
+ minSaturation={props.minSaturation}
46
+ onValueChange={s => {
47
+ props.onHSVChange && props.onHSVChange(props.h, s, props.v)
48
+ }}
49
+ onSlidingComplete={s => {
50
+ props.onHSVChangeComplete(props.h, s, props.v)
51
+ }}/>
52
+ <LdvColorBrightness
53
+ minBrightness={props.minBrightness}
54
+ value={props.v}
55
+ onValueChange={v => {
56
+ props.onHSVChange && props.onHSVChange(props.h, props.s, v)
57
+ }}
58
+ onSlidingComplete={v => {
59
+ props.onHSVChangeComplete(props.h, props.s, v)
60
+ }}/>
61
+ </View>
62
+ )
63
+ }
64
+
65
65
  export default ColorAdjustView
@@ -1,73 +1,73 @@
1
- import { Component } from 'react';
2
- import { PanResponderInstance } from 'react-native';
3
- export default class ColorExtractor extends Component<any> {
4
- state: any;
5
- _panResponder: PanResponderInstance;
6
- onColorChange: any;
7
- lastX: any;
8
- lastY: any;
9
- self: any;
10
- startTouchXY: any;
11
- constructor(props: any);
12
- onLayout(_: any): void;
13
- componentDidMount(): void;
14
- componentWillUnmount(): void;
15
- handleTapData(evt: any): void;
16
- handlerData(_evt: any, ges: any, moving: any): void;
17
- getPointValues(locationX: any, locationY: any): {
18
- angle: number;
19
- maxX: number;
20
- maxY: number;
21
- length: number;
22
- };
23
- getPointAngle(x: any, y: any): number;
24
- updateUIWithColor(color: any, isFirst: any): void;
25
- hypotenuse(long: any, angle: any): {
26
- x: number;
27
- y: number;
28
- };
29
- updateColor(x: any, y: any, moving: any, isFirst?: boolean): void;
30
- render(): JSX.Element;
31
- }
32
- export declare const colorTemperature: {
33
- 2700: string;
34
- 2800: string;
35
- 2900: string;
36
- 3000: string;
37
- 3100: string;
38
- 3200: string;
39
- 3300: string;
40
- 3400: string;
41
- 3500: string;
42
- 3600: string;
43
- 3700: string;
44
- 3800: string;
45
- 3900: string;
46
- 4000: string;
47
- 4100: string;
48
- 4200: string;
49
- 4300: string;
50
- 4400: string;
51
- 4500: string;
52
- 4600: string;
53
- 4700: string;
54
- 4800: string;
55
- 4900: string;
56
- 5000: string;
57
- 5100: string;
58
- 5200: string;
59
- 5300: string;
60
- 5400: string;
61
- 5500: string;
62
- 5600: string;
63
- 5700: string;
64
- 5800: string;
65
- 5900: string;
66
- 6000: string;
67
- 6100: string;
68
- 6200: string;
69
- 6300: string;
70
- 6400: string;
71
- 6500: string;
72
- };
73
- export declare const colorTemperatureToColor: (temperature: any) => any;
1
+ import { Component } from 'react';
2
+ import { PanResponderInstance } from 'react-native';
3
+ export default class ColorExtractor extends Component<any> {
4
+ state: any;
5
+ _panResponder: PanResponderInstance;
6
+ onColorChange: any;
7
+ lastX: any;
8
+ lastY: any;
9
+ self: any;
10
+ startTouchXY: any;
11
+ constructor(props: any);
12
+ onLayout(_: any): void;
13
+ componentDidMount(): void;
14
+ componentWillUnmount(): void;
15
+ handleTapData(evt: any): void;
16
+ handlerData(_evt: any, ges: any, moving: any): void;
17
+ getPointValues(locationX: any, locationY: any): {
18
+ angle: number;
19
+ maxX: number;
20
+ maxY: number;
21
+ length: number;
22
+ };
23
+ getPointAngle(x: any, y: any): number;
24
+ updateUIWithColor(color: any, isFirst: any): void;
25
+ hypotenuse(long: any, angle: any): {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ updateColor(x: any, y: any, moving: any, isFirst?: boolean): void;
30
+ render(): JSX.Element;
31
+ }
32
+ export declare const colorTemperature: {
33
+ 2700: string;
34
+ 2800: string;
35
+ 2900: string;
36
+ 3000: string;
37
+ 3100: string;
38
+ 3200: string;
39
+ 3300: string;
40
+ 3400: string;
41
+ 3500: string;
42
+ 3600: string;
43
+ 3700: string;
44
+ 3800: string;
45
+ 3900: string;
46
+ 4000: string;
47
+ 4100: string;
48
+ 4200: string;
49
+ 4300: string;
50
+ 4400: string;
51
+ 4500: string;
52
+ 4600: string;
53
+ 4700: string;
54
+ 4800: string;
55
+ 4900: string;
56
+ 5000: string;
57
+ 5100: string;
58
+ 5200: string;
59
+ 5300: string;
60
+ 5400: string;
61
+ 5500: string;
62
+ 5600: string;
63
+ 5700: string;
64
+ 5800: string;
65
+ 5900: string;
66
+ 6000: string;
67
+ 6100: string;
68
+ 6200: string;
69
+ 6300: string;
70
+ 6400: string;
71
+ 6500: string;
72
+ };
73
+ export declare const colorTemperatureToColor: (temperature: any) => any;