@ledvance/base 1.1.13 → 1.1.15
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/.prettierrc.js +0 -0
- package/package.json +1 -1
- package/src/api/native.d.ts +5 -0
- package/src/api/native.ts +193 -160
- package/src/api/nativeEventEmitter.ts +54 -54
- package/src/components/Card.tsx +25 -25
- package/src/components/Cell.tsx +32 -32
- package/src/components/ColorAdjustView.tsx +44 -44
- package/src/components/ColorTempAdjustView.tsx +37 -37
- package/src/components/ColorsLine.d.ts +7 -0
- package/src/components/ColorsLine.tsx +48 -0
- package/src/components/DeleteButton.d.ts +1 -1
- package/src/components/DeleteButton.tsx +27 -27
- package/src/components/Dialog.tsx +28 -28
- package/src/components/FanAdjustView.tsx +115 -105
- package/src/components/InfoText.tsx +29 -29
- package/src/components/LampAdjustView.tsx +52 -52
- package/src/components/LinearGradientLine.tsx +53 -53
- package/src/components/MoodColorsLine.d.ts +9 -0
- package/src/components/MoodColorsLine.tsx +38 -0
- package/src/components/Page.tsx +34 -34
- package/src/components/Popup.tsx +17 -17
- package/src/components/Segmented.d.ts +2 -2
- package/src/components/Segmented.tsx +66 -65
- package/src/components/Spacer.tsx +5 -5
- package/src/components/Tag.tsx +42 -42
- package/src/components/TextButton.d.ts +1 -1
- package/src/components/TextButton.tsx +23 -23
- package/src/components/TextField.tsx +58 -58
- package/src/components/connect.tsx +10 -10
- package/src/components/ldvColorBrightness.tsx +12 -12
- package/src/components/ldvColorSlider.tsx +109 -109
- package/src/components/ldvPickerView.tsx +70 -70
- package/src/components/ldvPresetView.tsx +68 -68
- package/src/components/ldvSaturation.tsx +14 -14
- package/src/components/ldvSlider.d.ts +3 -3
- package/src/components/ldvSlider.tsx +93 -93
- package/src/components/ldvSwitch.tsx +35 -35
- package/src/components/ldvTemperatureSlider.tsx +120 -120
- package/src/components/ldvTopBar.tsx +50 -50
- package/src/components/ldvTopName.tsx +44 -44
- package/src/components/segmentControl.tsx +59 -59
- package/src/components/weekSelect.tsx +76 -76
- package/src/composeLayout.tsx +165 -165
- package/src/i18n/index.ts +12 -12
- package/src/i18n/strings.ts +11004 -11004
- package/src/main.tsx +4 -4
- package/src/models/GlobalParams.ts +7 -7
- package/src/models/TuyaApi.d.ts +3 -3
- package/src/models/TuyaApi.ts +61 -61
- package/src/models/combine.ts +7 -7
- package/src/models/configureStore.ts +14 -14
- package/src/models/index.ts +4 -4
- package/src/models/modules/NativePropsSlice.tsx +170 -169
- package/src/models/modules/Result.ts +8 -8
- package/src/models/modules/common.ts +90 -90
- package/src/res/index.ts +35 -35
- package/src/utils/ColorParser.ts +150 -150
- package/src/utils/ColorUtils.tsx +414 -414
- package/src/utils/Support.d.ts +9 -0
- package/src/utils/Support.ts +85 -0
- package/src/utils/cctUtils.d.ts +1 -0
- package/src/utils/cctUtils.ts +111 -0
- package/src/utils/common.ts +186 -174
- package/src/utils/index.ts +123 -123
package/src/components/Cell.tsx
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {IconFont, Utils} from 'tuya-panel-kit'
|
|
2
|
+
import {StyleProp, Text, TouchableOpacity, View, ViewStyle} from 'react-native'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
const cx = Utils.RatioUtils.convertX
|
|
6
6
|
|
|
7
7
|
interface CellProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
title: string,
|
|
9
|
+
value: string,
|
|
10
|
+
onPress: () => void,
|
|
11
|
+
style?: StyleProp<ViewStyle>
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export default function Cell(props: CellProps) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
+
<View style={{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'}}>
|
|
24
|
+
<Text style={{
|
|
25
|
+
fontSize: cx(14),
|
|
26
|
+
color: '#444',
|
|
27
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
28
|
+
}}>{props.title}</Text>
|
|
29
|
+
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
|
30
|
+
<Text style={{
|
|
31
|
+
fontSize: cx(14),
|
|
32
|
+
color: '#444',
|
|
33
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
34
|
+
}}>{props.value}</Text>
|
|
35
|
+
<View style={{width: cx(4)}}/>
|
|
36
|
+
<IconFont color={'#444'} size={cx(11)} name="arrow"/>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
</TouchableOpacity>
|
|
40
|
+
)
|
|
41
41
|
}
|
|
@@ -8,53 +8,53 @@ import LdvColorBrightness from './ldvColorBrightness'
|
|
|
8
8
|
import I18n from '../i18n/index'
|
|
9
9
|
|
|
10
10
|
export interface ColorAdjustViewProps {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
h: number
|
|
12
|
+
s: number
|
|
13
|
+
v: number
|
|
14
|
+
onHSVChange?: (h: number, s: number, v: number) => void
|
|
15
|
+
onHSVChangeComplete: (h: number, s: number, v: number) => void
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const ColorAdjustView = (props: ColorAdjustViewProps) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
19
|
+
return (
|
|
20
|
+
<View>
|
|
21
|
+
<LdvColorSlider
|
|
22
|
+
type={'color'}
|
|
23
|
+
title={I18n.getLang('light_sources_tile_sec_lighting_shade')}
|
|
24
|
+
thumbColor={hsv2Hex(props.h, 100, 100)}
|
|
25
|
+
value={props.h}
|
|
26
|
+
onValueChange={hue => {
|
|
27
|
+
props.onHSVChange && props.onHSVChange(hue, props.s, props.v)
|
|
28
|
+
}}
|
|
29
|
+
onSlidingComplete={hue => {
|
|
30
|
+
props.onHSVChangeComplete(hue, props.s, props.v)
|
|
31
|
+
}}/>
|
|
32
|
+
<LdvPresetView
|
|
33
|
+
type={'color'}
|
|
34
|
+
onPress={(item) => {
|
|
35
|
+
const hsv = hex2Hsv(item.color)
|
|
36
|
+
if (hsv) {
|
|
37
|
+
props.onHSVChangeComplete(hsv.h, hsv.s, hsv.v)
|
|
38
|
+
}
|
|
39
|
+
}}/>
|
|
40
|
+
<LdvSaturation
|
|
41
|
+
value={props.s}
|
|
42
|
+
onValueChange={s => {
|
|
43
|
+
props.onHSVChange && props.onHSVChange(props.h, s, props.v)
|
|
44
|
+
}}
|
|
45
|
+
onSlidingComplete={s => {
|
|
46
|
+
props.onHSVChangeComplete(props.h, s, props.v)
|
|
47
|
+
}}/>
|
|
48
|
+
<LdvColorBrightness
|
|
49
|
+
value={props.v}
|
|
50
|
+
onValueChange={v => {
|
|
51
|
+
props.onHSVChange && props.onHSVChange(props.h, props.s, v)
|
|
52
|
+
}}
|
|
53
|
+
onSlidingComplete={v => {
|
|
54
|
+
props.onHSVChangeComplete(props.h, props.s, v)
|
|
55
|
+
}}/>
|
|
56
|
+
</View>
|
|
57
|
+
)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export default ColorAdjustView
|
|
@@ -10,46 +10,46 @@ import I18n from '../i18n/index'
|
|
|
10
10
|
const {convertX: cx} = Utils.RatioUtils
|
|
11
11
|
|
|
12
12
|
export interface ColorTempAdjustViewProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
colorTemp: number
|
|
14
|
+
brightness: number
|
|
15
|
+
isSupportTemperature: boolean
|
|
16
|
+
isSupportBrightness: boolean
|
|
17
|
+
onCCTChange?: (cct: number) => void
|
|
18
|
+
onCCTChangeComplete: (cct: number) => void
|
|
19
|
+
onBrightnessChange?: (brightness: number) => void
|
|
20
|
+
onBrightnessChangeComplete: (brightness: number) => void
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const ColorTempAdjustView = (props: ColorTempAdjustViewProps) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
24
|
+
return (
|
|
25
|
+
<View>
|
|
26
|
+
{props.isSupportTemperature &&
|
|
27
|
+
<>
|
|
28
|
+
<LdvColorSlider
|
|
29
|
+
type={'temperature'}
|
|
30
|
+
title={I18n.getLang('light_sources_tile_main_lighting_shade')}
|
|
31
|
+
thumbColor={'white'}
|
|
32
|
+
value={props.colorTemp}
|
|
33
|
+
onValueChange={props.onCCTChange}
|
|
34
|
+
onSlidingComplete={props.onCCTChangeComplete}/>
|
|
35
|
+
<Spacer height={cx(10)}/>
|
|
36
|
+
<LdvPresetView
|
|
37
|
+
type={'temperature'}
|
|
38
|
+
style={{height: cx(60)}}
|
|
39
|
+
onPress={item => {
|
|
40
|
+
props.onCCTChangeComplete(item.value)
|
|
41
|
+
}}/>
|
|
42
|
+
<Spacer height={cx(10)}/>
|
|
43
|
+
</>
|
|
44
|
+
}
|
|
45
|
+
{props.isSupportBrightness &&
|
|
46
|
+
<LdvSlider
|
|
47
|
+
title={I18n.getLang('light_sources_tile_rgb_lighting_brightness')}
|
|
48
|
+
value={props.brightness}
|
|
49
|
+
onValueChange={props.onBrightnessChange}
|
|
50
|
+
onSlidingComplete={props.onBrightnessChangeComplete}/>}
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export default ColorTempAdjustView
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
interface ColorsLineProps extends ViewProps {
|
|
3
|
+
colors: string[];
|
|
4
|
+
nodeStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
}
|
|
6
|
+
declare const ColorsLine: (props: ColorsLineProps) => JSX.Element;
|
|
7
|
+
export default ColorsLine;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {StyleProp, StyleSheet, View, ViewProps, ViewStyle} from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import {Utils} from 'tuya-panel-kit'
|
|
4
|
+
|
|
5
|
+
const cx = Utils.RatioUtils.convertX
|
|
6
|
+
|
|
7
|
+
interface ColorsLineProps extends ViewProps {
|
|
8
|
+
colors: string[]
|
|
9
|
+
nodeStyle?: StyleProp<ViewStyle>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ColorsLine = (props: ColorsLineProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<View style={[styles.root, props.style]}>
|
|
15
|
+
{
|
|
16
|
+
props.colors.map((color, index) => {
|
|
17
|
+
return (
|
|
18
|
+
<View
|
|
19
|
+
key={`${index}`}
|
|
20
|
+
style={[
|
|
21
|
+
styles.colorNode,
|
|
22
|
+
{
|
|
23
|
+
backgroundColor: color,
|
|
24
|
+
marginStart: index === 0 ? 0 : cx(5),
|
|
25
|
+
},
|
|
26
|
+
props.nodeStyle,
|
|
27
|
+
]}/>
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
</View>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
root: {
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
width: cx(295),
|
|
39
|
+
height: cx(24),
|
|
40
|
+
},
|
|
41
|
+
colorNode: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
height: cx(24),
|
|
44
|
+
borderRadius: cx(8),
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
export default ColorsLine
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {StyleProp, Text, TextStyle, TouchableOpacity, ViewStyle} from 'react-native'
|
|
3
|
+
import {Utils} from 'tuya-panel-kit'
|
|
4
4
|
|
|
5
5
|
const cx = Utils.RatioUtils.convertX
|
|
6
|
+
|
|
6
7
|
interface DeleteButtonProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
text: string,
|
|
9
|
+
onPress: () => void,
|
|
10
|
+
style?: StyleProp<ViewStyle>,
|
|
11
|
+
textStyle?: StyleProp<TextStyle>
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
const DeleteButton = (props: DeleteButtonProps) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
15
|
+
const {text, onPress, style, textStyle} = props
|
|
16
|
+
return (
|
|
17
|
+
<TouchableOpacity
|
|
18
|
+
onPress={onPress}
|
|
19
|
+
style={[{
|
|
20
|
+
width: '100%',
|
|
21
|
+
height: cx(50),
|
|
22
|
+
backgroundColor: '#666',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
borderRadius: cx(8),
|
|
26
|
+
}, style]}>
|
|
27
|
+
<Text style={[{
|
|
28
|
+
color: '#fff',
|
|
29
|
+
fontSize: cx(16),
|
|
30
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
31
|
+
}, textStyle]}>{text}</Text>
|
|
32
|
+
</TouchableOpacity>
|
|
33
|
+
)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export default DeleteButton
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, {PropsWithChildren} from 'react'
|
|
2
|
+
import {Modal, StyleSheet, TouchableOpacity, ViewProps} from 'react-native'
|
|
3
3
|
|
|
4
4
|
interface DialogProps extends PropsWithChildren<ViewProps> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
show: boolean
|
|
6
|
+
hideMask: boolean
|
|
7
|
+
animationType?: 'none' | 'slide' | 'fade'
|
|
8
|
+
onRequestClose: () => void
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const Dialog = (props: DialogProps) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
return (
|
|
13
|
+
<Modal
|
|
14
|
+
transparent={true}
|
|
15
|
+
visible={props.show}
|
|
16
|
+
animationType={props.animationType || 'fade'}
|
|
17
|
+
onRequestClose={props.onRequestClose}>
|
|
18
|
+
<TouchableOpacity
|
|
19
|
+
style={[
|
|
20
|
+
styles.mask,
|
|
21
|
+
{
|
|
22
|
+
backgroundColor: props.hideMask ? 'rgba(0, 0, 0, 0)' : 'rgba(0, 0, 0, 0.7)',
|
|
23
|
+
},
|
|
24
|
+
]}
|
|
25
|
+
activeOpacity={1}
|
|
26
|
+
onPress={props.onRequestClose}>
|
|
27
|
+
{props.children}
|
|
28
|
+
</TouchableOpacity>
|
|
29
|
+
</Modal>
|
|
30
|
+
)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const styles = StyleSheet.create({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
mask: {
|
|
35
|
+
flex: 1,
|
|
36
|
+
},
|
|
37
37
|
})
|
|
38
38
|
|
|
39
39
|
export default Dialog
|