@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.
Files changed (65) hide show
  1. package/.prettierrc.js +0 -0
  2. package/package.json +1 -1
  3. package/src/api/native.d.ts +5 -0
  4. package/src/api/native.ts +193 -160
  5. package/src/api/nativeEventEmitter.ts +54 -54
  6. package/src/components/Card.tsx +25 -25
  7. package/src/components/Cell.tsx +32 -32
  8. package/src/components/ColorAdjustView.tsx +44 -44
  9. package/src/components/ColorTempAdjustView.tsx +37 -37
  10. package/src/components/ColorsLine.d.ts +7 -0
  11. package/src/components/ColorsLine.tsx +48 -0
  12. package/src/components/DeleteButton.d.ts +1 -1
  13. package/src/components/DeleteButton.tsx +27 -27
  14. package/src/components/Dialog.tsx +28 -28
  15. package/src/components/FanAdjustView.tsx +115 -105
  16. package/src/components/InfoText.tsx +29 -29
  17. package/src/components/LampAdjustView.tsx +52 -52
  18. package/src/components/LinearGradientLine.tsx +53 -53
  19. package/src/components/MoodColorsLine.d.ts +9 -0
  20. package/src/components/MoodColorsLine.tsx +38 -0
  21. package/src/components/Page.tsx +34 -34
  22. package/src/components/Popup.tsx +17 -17
  23. package/src/components/Segmented.d.ts +2 -2
  24. package/src/components/Segmented.tsx +66 -65
  25. package/src/components/Spacer.tsx +5 -5
  26. package/src/components/Tag.tsx +42 -42
  27. package/src/components/TextButton.d.ts +1 -1
  28. package/src/components/TextButton.tsx +23 -23
  29. package/src/components/TextField.tsx +58 -58
  30. package/src/components/connect.tsx +10 -10
  31. package/src/components/ldvColorBrightness.tsx +12 -12
  32. package/src/components/ldvColorSlider.tsx +109 -109
  33. package/src/components/ldvPickerView.tsx +70 -70
  34. package/src/components/ldvPresetView.tsx +68 -68
  35. package/src/components/ldvSaturation.tsx +14 -14
  36. package/src/components/ldvSlider.d.ts +3 -3
  37. package/src/components/ldvSlider.tsx +93 -93
  38. package/src/components/ldvSwitch.tsx +35 -35
  39. package/src/components/ldvTemperatureSlider.tsx +120 -120
  40. package/src/components/ldvTopBar.tsx +50 -50
  41. package/src/components/ldvTopName.tsx +44 -44
  42. package/src/components/segmentControl.tsx +59 -59
  43. package/src/components/weekSelect.tsx +76 -76
  44. package/src/composeLayout.tsx +165 -165
  45. package/src/i18n/index.ts +12 -12
  46. package/src/i18n/strings.ts +11004 -11004
  47. package/src/main.tsx +4 -4
  48. package/src/models/GlobalParams.ts +7 -7
  49. package/src/models/TuyaApi.d.ts +3 -3
  50. package/src/models/TuyaApi.ts +61 -61
  51. package/src/models/combine.ts +7 -7
  52. package/src/models/configureStore.ts +14 -14
  53. package/src/models/index.ts +4 -4
  54. package/src/models/modules/NativePropsSlice.tsx +170 -169
  55. package/src/models/modules/Result.ts +8 -8
  56. package/src/models/modules/common.ts +90 -90
  57. package/src/res/index.ts +35 -35
  58. package/src/utils/ColorParser.ts +150 -150
  59. package/src/utils/ColorUtils.tsx +414 -414
  60. package/src/utils/Support.d.ts +9 -0
  61. package/src/utils/Support.ts +85 -0
  62. package/src/utils/cctUtils.d.ts +1 -0
  63. package/src/utils/cctUtils.ts +111 -0
  64. package/src/utils/common.ts +186 -174
  65. package/src/utils/index.ts +123 -123
@@ -1,59 +1,59 @@
1
1
  import React from 'react'
2
- import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
3
- import { Utils } from 'tuya-panel-kit'
2
+ import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
3
+ import {Utils} from 'tuya-panel-kit'
4
4
 
5
5
  const cx = Utils.RatioUtils.convertX
6
6
 
7
7
  interface LdvTopNameProps {
8
- title: string,
9
- rightIcon?: string | undefined | number,
10
- rightIconClick?: () => void
11
- showGreenery?: boolean
12
- greeneryIcon?: string | undefined | number
8
+ title: string,
9
+ rightIcon?: string | undefined | number,
10
+ rightIconClick?: () => void
11
+ showGreenery?: boolean
12
+ greeneryIcon?: string | undefined | number
13
13
  }
14
14
 
15
15
  const LdvTopName = (props: LdvTopNameProps) => {
16
- const rightIcon = typeof props.rightIcon === 'number' ? props.rightIcon : {uri : props.rightIcon}
17
- const greeneryIcon = typeof props.greeneryIcon === 'number' ? props.greeneryIcon : {uri : props.greeneryIcon}
18
- return (
19
- <View style={styles.container}>
20
- <View
21
- style={{
22
- flexDirection: 'row',
23
- justifyContent: 'space-between',
24
- alignItems: 'center',
25
- marginTop: cx(38),
26
- }}>
27
- <View style={{ flexDirection: 'row', flex: 1 }}>
28
- <Text style={styles.title}>
29
- {props.title}
30
- </Text>
31
- {props.showGreenery && <Image
32
- source={greeneryIcon}
33
- resizeMode="contain"
34
- style={{ height: cx(16), width: cx(16), left: 0 }}
35
- /> || null}
36
- </View>
37
- {props.rightIcon && <TouchableOpacity
38
- onPress={props.rightIconClick}>
39
- <Image
40
- style={{ width: cx(24), height: cx(24), tintColor: '#ff6600' }}
41
- source={rightIcon} />
42
- </TouchableOpacity>}
43
- </View>
16
+ const rightIcon = typeof props.rightIcon === 'number' ? props.rightIcon : {uri: props.rightIcon}
17
+ const greeneryIcon = typeof props.greeneryIcon === 'number' ? props.greeneryIcon : {uri: props.greeneryIcon}
18
+ return (
19
+ <View style={styles.container}>
20
+ <View
21
+ style={{
22
+ flexDirection: 'row',
23
+ justifyContent: 'space-between',
24
+ alignItems: 'center',
25
+ marginTop: cx(38),
26
+ }}>
27
+ <View style={{flexDirection: 'row', flex: 1}}>
28
+ <Text style={styles.title}>
29
+ {props.title}
30
+ </Text>
31
+ {props.showGreenery && <Image
32
+ source={greeneryIcon}
33
+ resizeMode="contain"
34
+ style={{height: cx(16), width: cx(16), left: 0}}
35
+ /> || null}
44
36
  </View>
45
- )
37
+ {props.rightIcon && <TouchableOpacity
38
+ onPress={props.rightIconClick}>
39
+ <Image
40
+ style={{width: cx(24), height: cx(24), tintColor: '#ff6600'}}
41
+ source={rightIcon}/>
42
+ </TouchableOpacity>}
43
+ </View>
44
+ </View>
45
+ )
46
46
  }
47
47
 
48
48
  const styles = StyleSheet.create({
49
- container: {
50
- marginHorizontal: cx(24),
51
- marginBottom: cx(12),
52
- },
53
- title: {
54
- color: '#f60',
55
- fontSize: cx(24),
56
- },
49
+ container: {
50
+ marginHorizontal: cx(24),
51
+ marginBottom: cx(12),
52
+ },
53
+ title: {
54
+ color: '#f60',
55
+ fontSize: cx(24),
56
+ },
57
57
  })
58
58
 
59
59
  export default LdvTopName
@@ -1,66 +1,66 @@
1
- import { Text, TouchableOpacity, View } from 'react-native'
1
+ import {Text, TouchableOpacity, View} from 'react-native'
2
2
  import React from 'react'
3
- import { Utils } from 'tuya-panel-kit'
3
+ import {Utils} from 'tuya-panel-kit'
4
4
 
5
- const { convertX } = Utils.RatioUtils
5
+ const {convertX} = Utils.RatioUtils
6
6
 
7
7
  export default function SegmentControl(props) {
8
8
 
9
- const { title1, title2, isFirst, setIsFirst, style } = props
9
+ const {title1, title2, isFirst, setIsFirst, style} = props
10
10
 
11
- return (<View style={{}}>
12
- <View style={[{
13
- backgroundColor: '#eeeeef',
14
- marginHorizontal: convertX(24),
15
- marginVertical: convertX(0),
16
- borderRadius: convertX(8.9),
17
- flexDirection: 'row',
18
- }, style]}>
19
- <TouchableOpacity style={
20
- [{
21
- flex: 1,
22
- justifyContent: 'center',
23
- alignItems: 'center',
24
- margin: convertX(2),
25
- borderRadius: convertX(6.9),
26
- }, isFirst ?
27
- { backgroundColor: '#fff', margin: convertX(2), borderRadius: 6.9 } :
28
- { backgroundColor: '#eeeeef' }]
29
- } onPress={() => setIsFirst(true)}>
30
- <Text
31
- style={{
32
- color: '#000',
33
- fontSize: convertX(12),
34
- fontFamily: isFirst ? 'helvetica_neue_lt_std_bd' : 'helvetica_neue_lt_std_roman',
35
- marginVertical: convertX(10),
36
- }}>
37
- {title1}
38
- </Text>
39
- </TouchableOpacity>
40
- <TouchableOpacity
41
- style={
42
- [{
43
- flex: 1,
44
- justifyContent: 'center',
45
- alignItems: 'center',
46
- margin: convertX(2),
47
- borderRadius: convertX(6.9),
48
- },
49
- !isFirst ?
50
- { backgroundColor: '#fff' } :
51
- { backgroundColor: '#eeeeef' }]
52
- }
53
- onPress={() => setIsFirst(false)}>
54
- <Text
55
- style={{
56
- color: '#000',
57
- fontSize: convertX(12),
58
- fontFamily: isFirst ? 'helvetica_neue_lt_std_roman' : 'helvetica_neue_lt_std_bd',
59
- marginVertical: convertX(10),
60
- }}>
61
- {title2}
62
- </Text>
63
- </TouchableOpacity>
64
- </View>
65
- </View>)
11
+ return (<View style={{}}>
12
+ <View style={[{
13
+ backgroundColor: '#eeeeef',
14
+ marginHorizontal: convertX(24),
15
+ marginVertical: convertX(0),
16
+ borderRadius: convertX(8.9),
17
+ flexDirection: 'row',
18
+ }, style]}>
19
+ <TouchableOpacity style={
20
+ [{
21
+ flex: 1,
22
+ justifyContent: 'center',
23
+ alignItems: 'center',
24
+ margin: convertX(2),
25
+ borderRadius: convertX(6.9),
26
+ }, isFirst ?
27
+ {backgroundColor: '#fff', margin: convertX(2), borderRadius: 6.9} :
28
+ {backgroundColor: '#eeeeef'}]
29
+ } onPress={() => setIsFirst(true)}>
30
+ <Text
31
+ style={{
32
+ color: '#000',
33
+ fontSize: convertX(12),
34
+ fontFamily: isFirst ? 'helvetica_neue_lt_std_bd' : 'helvetica_neue_lt_std_roman',
35
+ marginVertical: convertX(10),
36
+ }}>
37
+ {title1}
38
+ </Text>
39
+ </TouchableOpacity>
40
+ <TouchableOpacity
41
+ style={
42
+ [{
43
+ flex: 1,
44
+ justifyContent: 'center',
45
+ alignItems: 'center',
46
+ margin: convertX(2),
47
+ borderRadius: convertX(6.9),
48
+ },
49
+ !isFirst ?
50
+ {backgroundColor: '#fff'} :
51
+ {backgroundColor: '#eeeeef'}]
52
+ }
53
+ onPress={() => setIsFirst(false)}>
54
+ <Text
55
+ style={{
56
+ color: '#000',
57
+ fontSize: convertX(12),
58
+ fontFamily: isFirst ? 'helvetica_neue_lt_std_roman' : 'helvetica_neue_lt_std_bd',
59
+ marginVertical: convertX(10),
60
+ }}>
61
+ {title2}
62
+ </Text>
63
+ </TouchableOpacity>
64
+ </View>
65
+ </View>)
66
66
  }
@@ -6,90 +6,90 @@ import I18n from '../i18n/index'
6
6
  const cx = Utils.RatioUtils.convertX
7
7
 
8
8
  const repeatPeriod = [
9
- {
10
- index: 1,
11
- title: I18n.getLang('timeschedule_add_schedule_weekday7_text'),
12
- enabled: false,
13
- }, {
14
- index: 2,
15
- title: I18n.getLang('timeschedule_add_schedule_weekday1_text'),
16
- enabled: false,
17
- }, {
18
- index: 3,
19
- title: I18n.getLang('timeschedule_add_schedule_weekday2_text'),
20
- enabled: false,
21
- }, {
22
- index: 4,
23
- title: I18n.getLang('timeschedule_add_schedule_weekday3_text'),
24
- enabled: false,
25
- }, {
26
- index: 5,
27
- title: I18n.getLang('timeschedule_add_schedule_weekday4_text'),
28
- enabled: false,
29
- }, {
30
- index: 6,
31
- title: I18n.getLang('timeschedule_add_schedule_weekday5_text'),
32
- enabled: false,
33
- }, {
34
- index: 7,
35
- title: I18n.getLang('timeschedule_add_schedule_weekday6_text'),
36
- enabled: false,
37
- },
9
+ {
10
+ index: 1,
11
+ title: I18n.getLang('timeschedule_add_schedule_weekday7_text'),
12
+ enabled: false,
13
+ }, {
14
+ index: 2,
15
+ title: I18n.getLang('timeschedule_add_schedule_weekday1_text'),
16
+ enabled: false,
17
+ }, {
18
+ index: 3,
19
+ title: I18n.getLang('timeschedule_add_schedule_weekday2_text'),
20
+ enabled: false,
21
+ }, {
22
+ index: 4,
23
+ title: I18n.getLang('timeschedule_add_schedule_weekday3_text'),
24
+ enabled: false,
25
+ }, {
26
+ index: 5,
27
+ title: I18n.getLang('timeschedule_add_schedule_weekday4_text'),
28
+ enabled: false,
29
+ }, {
30
+ index: 6,
31
+ title: I18n.getLang('timeschedule_add_schedule_weekday5_text'),
32
+ enabled: false,
33
+ }, {
34
+ index: 7,
35
+ title: I18n.getLang('timeschedule_add_schedule_weekday6_text'),
36
+ enabled: false,
37
+ },
38
38
  ]
39
39
 
40
40
  export const setDataSource = (loop) => {
41
- return repeatPeriod.map((item, index) => {
42
- return {
43
- ...item,
44
- enabled: loop[index] === 1,
45
- }
46
- })
41
+ return repeatPeriod.map((item, index) => {
42
+ return {
43
+ ...item,
44
+ enabled: loop[index] === 1,
45
+ }
46
+ })
47
47
  }
48
48
 
49
49
  export default (props) => {
50
50
 
51
- const {value, onSelect, style} = props
52
- const dataSource = setDataSource(value)
51
+ const {value, onSelect, style} = props
52
+ const dataSource = setDataSource(value)
53
53
 
54
- return (<View style={{
55
- height: 40,
56
- }}>
57
- <View
58
- style={[{
59
- flexDirection: 'row',
60
- justifyContent: 'space-between',
61
- marginHorizontal: cx(20),
62
- }, style]}>
63
- {dataSource.map(period => {
64
- return (
65
- <TouchableOpacity
66
- key={period.index}
67
- onPress={() => {
68
- onSelect(period.index)
69
- }}>
70
- <View
71
- style={{
72
- width: cx(40),
73
- height: cx(40),
74
- justifyContent: 'center',
75
- alignItems: 'center',
76
- borderRadius: cx(20),
77
- backgroundColor: period.enabled ? '#ffe0d4' : '#fff',
78
- borderWidth: cx(1),
79
- // borderColor: period.enabled ? "#fff" : 'rgba(120, 120, 128, 0.2)'
80
- borderColor: '#f60',
81
- }}>
54
+ return (<View style={{
55
+ height: 40,
56
+ }}>
57
+ <View
58
+ style={[{
59
+ flexDirection: 'row',
60
+ justifyContent: 'space-between',
61
+ marginHorizontal: cx(20),
62
+ }, style]}>
63
+ {dataSource.map(period => {
64
+ return (
65
+ <TouchableOpacity
66
+ key={period.index}
67
+ onPress={() => {
68
+ onSelect(period.index)
69
+ }}>
70
+ <View
71
+ style={{
72
+ width: cx(40),
73
+ height: cx(40),
74
+ justifyContent: 'center',
75
+ alignItems: 'center',
76
+ borderRadius: cx(20),
77
+ backgroundColor: period.enabled ? '#ffe0d4' : '#fff',
78
+ borderWidth: cx(1),
79
+ // borderColor: period.enabled ? "#fff" : 'rgba(120, 120, 128, 0.2)'
80
+ borderColor: '#f60',
81
+ }}>
82
82
 
83
- <Text
84
- style={{
85
- color: '#f60',
86
- textAlign: 'center',
87
- }}>{period.title}</Text>
88
- </View>
89
- </TouchableOpacity>
90
- )
91
- })}
92
- </View>
83
+ <Text
84
+ style={{
85
+ color: '#f60',
86
+ textAlign: 'center',
87
+ }}>{period.title}</Text>
88
+ </View>
89
+ </TouchableOpacity>
90
+ )
91
+ })}
92
+ </View>
93
93
 
94
- </View>)
94
+ </View>)
95
95
  }