@ledvance/base 1.1.14 → 1.1.16
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 +1 -1
- package/src/api/native.d.ts +13 -0
- package/src/api/native.ts +197 -179
- 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 +34 -34
- 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 +23 -23
- 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.d.ts +5 -2
- 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 +73 -73
- package/src/utils/cctUtils.d.ts +1 -0
- package/src/utils/cctUtils.ts +106 -106
- package/src/utils/common.ts +186 -174
- package/src/utils/index.ts +123 -123
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const isPlug: (dpCodes: Record<string, string>) => boolean;
|
|
2
|
+
export declare const isGlassRGBWLamp: (dpCodes: Record<string, string>) => boolean;
|
|
3
|
+
export declare const isMixRGBWLamp: (dpCodes: Record<string, string>) => boolean;
|
|
4
|
+
export declare const isRGBWLamp: (dpCodes: Record<string, string>) => boolean;
|
|
5
|
+
export declare const isRGBLamp: (dpCodes: Record<string, string>) => boolean;
|
|
6
|
+
export declare const isOnlyRGBLamp: (dpCodes: Record<string, string>) => boolean;
|
|
7
|
+
export declare const isTWLamp: (dpCodes: Record<string, string>) => boolean;
|
|
8
|
+
export declare const isDIMLamp: (dpCodes: Record<string, string>) => boolean;
|
|
9
|
+
export declare const isGARDOT: (dpCodes: Record<string, string>) => boolean;
|
package/src/utils/Support.ts
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
// 判断是否是plug
|
|
2
|
-
export const isPlug = (dpCodes: Record<string,string>) =>{
|
|
3
|
-
|
|
2
|
+
export const isPlug = (dpCodes: Record<string, string>) => {
|
|
3
|
+
return !!dpCodes.switch_1
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
// 玻璃灯:支持颜色和色温灯同时调节
|
|
7
|
-
export const isGlassRGBWLamp = (dpCodes: Record<string,string>) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
7
|
+
export const isGlassRGBWLamp = (dpCodes: Record<string, string>) => {
|
|
8
|
+
return !!(
|
|
9
|
+
!dpCodes.mix_rgbcw &&
|
|
10
|
+
!dpCodes.temp_value &&
|
|
11
|
+
dpCodes.colour_data &&
|
|
12
|
+
dpCodes.bright_value
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
// 双灯泡吸顶灯:支持颜色和色温灯同时调节
|
|
16
|
+
export const isMixRGBWLamp = (dpCodes: Record<string, string>) => {
|
|
17
|
+
return !!(
|
|
18
|
+
dpCodes.mix_rgbcw &&
|
|
19
|
+
dpCodes.colour_data &&
|
|
20
|
+
dpCodes.temp_value &&
|
|
21
|
+
dpCodes.bright_value
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 支持调节:颜色/色温+亮度
|
|
26
|
+
export const isRGBWLamp = (dpCodes: Record<string, string>) => {
|
|
27
|
+
return !!(
|
|
28
|
+
!dpCodes.mix_rgbcw &&
|
|
29
|
+
dpCodes.colour_data &&
|
|
30
|
+
dpCodes.temp_value &&
|
|
31
|
+
dpCodes.bright_value
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 支持调节:颜色/单一色温亮度
|
|
36
|
+
export const isRGBLamp = (dpCodes: Record<string, string>) => {
|
|
37
|
+
return !!(
|
|
38
|
+
!dpCodes.mix_rgbcw &&
|
|
39
|
+
!dpCodes.temp_value &&
|
|
40
|
+
dpCodes.colour_data &&
|
|
41
|
+
dpCodes.bright_value
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 支持调节:颜色
|
|
46
|
+
export const isOnlyRGBLamp = (dpCodes: Record<string, string>) => {
|
|
47
|
+
return !!(
|
|
48
|
+
!dpCodes.mix_rgbcw &&
|
|
49
|
+
!dpCodes.temp_value &&
|
|
50
|
+
!dpCodes.bright_value &&
|
|
51
|
+
dpCodes.colour_data
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 支持调节:色温+亮度
|
|
56
|
+
export const isTWLamp = (dpCodes: Record<string, string>) => {
|
|
57
|
+
return !!(
|
|
58
|
+
!dpCodes.mix_rgbcw &&
|
|
59
|
+
!dpCodes.colour_data &&
|
|
60
|
+
dpCodes.temp_value &&
|
|
61
|
+
dpCodes.bright_value
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 支持调节:单一色温亮度
|
|
66
|
+
export const isDIMLamp = (dpCodes: Record<string, string>) => {
|
|
67
|
+
return !!(
|
|
68
|
+
!dpCodes.mix_rgbcw &&
|
|
69
|
+
!dpCodes.colour_data &&
|
|
70
|
+
!dpCodes.temp_value &&
|
|
71
|
+
dpCodes.bright_value
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
export const isGARDOT = (dpCodes: Record<string,string>) => {
|
|
75
|
+
// GARDOT灯具
|
|
76
|
+
export const isGARDOT = (dpCodes: Record<string, string>) => {
|
|
77
77
|
return !!(
|
|
78
78
|
dpCodes.switch_led &&
|
|
79
79
|
dpCodes.work_mode &&
|
|
@@ -81,5 +81,5 @@ export const isGARDOT = (dpCodes: Record<string,string>) => {
|
|
|
81
81
|
dpCodes.scene_data &&
|
|
82
82
|
dpCodes.countdown &&
|
|
83
83
|
dpCodes.control_data
|
|
84
|
-
)
|
|
85
|
-
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cctToColor: (key: string | number, brightness?: string | number | undefined) => any;
|
package/src/utils/cctUtils.ts
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
1
|
const ccts = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
2
|
+
'0': 'rgb(254, 172, 91)',
|
|
3
|
+
'1': 'rgb(254, 174, 94)',
|
|
4
|
+
'2': 'rgb(253, 176, 97)',
|
|
5
|
+
'3': 'rgb(253, 178, 101)',
|
|
6
|
+
'4': 'rgb(253, 180, 105)',
|
|
7
|
+
'5': 'rgb(253, 181, 109)',
|
|
8
|
+
'6': 'rgb(252, 183, 112)',
|
|
9
|
+
'7': 'rgb(252, 185, 116)',
|
|
10
|
+
'8': 'rgb(252, 187, 120)',
|
|
11
|
+
'9': 'rgb(252, 189, 123)',
|
|
12
|
+
'10': 'rgb(251, 191, 127)',
|
|
13
|
+
'11': 'rgb(251, 193, 131)',
|
|
14
|
+
'12': 'rgb(251, 194, 134)',
|
|
15
|
+
'13': 'rgb(251, 196, 138)',
|
|
16
|
+
'14': 'rgb(250, 198, 142)',
|
|
17
|
+
'15': 'rgb(250, 200, 146)',
|
|
18
|
+
'16': 'rgb(250, 202, 149)',
|
|
19
|
+
'17': 'rgb(250, 204, 153)',
|
|
20
|
+
'18': 'rgb(249, 206, 157)',
|
|
21
|
+
'19': 'rgb(249, 207, 160)',
|
|
22
|
+
'20': 'rgb(249, 209, 164)',
|
|
23
|
+
'21': 'rgb(249, 211, 167)',
|
|
24
|
+
'22': 'rgb(250, 213, 170)',
|
|
25
|
+
'23': 'rgb(250, 214, 173)',
|
|
26
|
+
'24': 'rgb(250, 216, 176)',
|
|
27
|
+
'25': 'rgb(250, 218, 179)',
|
|
28
|
+
'26': 'rgb(251, 220, 182)',
|
|
29
|
+
'27': 'rgb(251, 221, 185)',
|
|
30
|
+
'28': 'rgb(251, 223, 188)',
|
|
31
|
+
'29': 'rgb(251, 225, 191)',
|
|
32
|
+
'30': 'rgb(252, 227, 194)',
|
|
33
|
+
'31': 'rgb(252, 228, 197)',
|
|
34
|
+
'32': 'rgb(252, 230, 199)',
|
|
35
|
+
'33': 'rgb(252, 232, 203)',
|
|
36
|
+
'34': 'rgb(253, 234, 206)',
|
|
37
|
+
'35': 'rgb(253, 235, 209)',
|
|
38
|
+
'36': 'rgb(253, 237, 211)',
|
|
39
|
+
'37': 'rgb(253, 239, 214)',
|
|
40
|
+
'38': 'rgb(254, 241, 217)',
|
|
41
|
+
'39': 'rgb(254, 242, 220)',
|
|
42
|
+
'40': 'rgb(254, 244, 223)',
|
|
43
|
+
'41': 'rgb(254, 244, 224)',
|
|
44
|
+
'42': 'rgb(254, 245, 225)',
|
|
45
|
+
'43': 'rgb(254, 245, 226)',
|
|
46
|
+
'44': 'rgb(254, 245, 227)',
|
|
47
|
+
'45': 'rgb(253, 246, 228)',
|
|
48
|
+
'46': 'rgb(253, 246, 229)',
|
|
49
|
+
'47': 'rgb(253, 246, 230)',
|
|
50
|
+
'48': 'rgb(253, 246, 231)',
|
|
51
|
+
'49': 'rgb(253, 247, 232)',
|
|
52
|
+
'50': 'rgb(253, 247, 233)',
|
|
53
|
+
'51': 'rgb(253, 247, 234)',
|
|
54
|
+
'52': 'rgb(253, 248, 234)',
|
|
55
|
+
'53': 'rgb(253, 248, 235)',
|
|
56
|
+
'54': 'rgb(253, 248, 236)',
|
|
57
|
+
'55': 'rgb(252, 249, 237)',
|
|
58
|
+
'56': 'rgb(252, 249, 238)',
|
|
59
|
+
'57': 'rgb(252, 249, 239)',
|
|
60
|
+
'58': 'rgb(252, 249, 240)',
|
|
61
|
+
'59': 'rgb(252, 250, 241)',
|
|
62
|
+
'60': 'rgb(252, 250, 242)',
|
|
63
|
+
'61': 'rgb(251, 249, 242)',
|
|
64
|
+
'62': 'rgb(249, 248, 243)',
|
|
65
|
+
'63': 'rgb(248, 248, 243)',
|
|
66
|
+
'64': 'rgb(247, 247, 243)',
|
|
67
|
+
'65': 'rgb(246, 246, 243)',
|
|
68
|
+
'66': 'rgb(244, 245, 244)',
|
|
69
|
+
'67': 'rgb(243, 245, 244)',
|
|
70
|
+
'68': 'rgb(241, 244, 244)',
|
|
71
|
+
'69': 'rgb(240, 243, 245)',
|
|
72
|
+
'70': 'rgb(239, 242, 245)',
|
|
73
|
+
'71': 'rgb(238, 242, 245)',
|
|
74
|
+
'72': 'rgb(236, 241, 246)',
|
|
75
|
+
'73': 'rgb(235, 240, 246)',
|
|
76
|
+
'74': 'rgb(234, 239, 246)',
|
|
77
|
+
'75': 'rgb(232, 239, 247)',
|
|
78
|
+
'76': 'rgb(231, 238, 247)',
|
|
79
|
+
'77': 'rgb(230, 237, 247)',
|
|
80
|
+
'78': 'rgb(228, 236, 247)',
|
|
81
|
+
'79': 'rgb(227, 236, 248)',
|
|
82
|
+
'80': 'rgb(226, 235, 248)',
|
|
83
|
+
'81': 'rgb(224, 234, 248)',
|
|
84
|
+
'82': 'rgb(223, 233, 249)',
|
|
85
|
+
'83': 'rgb(221, 232, 249)',
|
|
86
|
+
'84': 'rgb(219, 231, 249)',
|
|
87
|
+
'85': 'rgb(218, 230, 250)',
|
|
88
|
+
'86': 'rgb(216, 230, 250)',
|
|
89
|
+
'87': 'rgb(215, 229, 250)',
|
|
90
|
+
'88': 'rgb(213, 228, 250)',
|
|
91
|
+
'89': 'rgb(212, 227, 251)',
|
|
92
|
+
'90': 'rgb(210, 226, 251)',
|
|
93
|
+
'91': 'rgb(208, 225, 251)',
|
|
94
|
+
'92': 'rgb(207, 224, 252)',
|
|
95
|
+
'93': 'rgb(205, 223, 252)',
|
|
96
|
+
'94': 'rgb(203, 222, 252)',
|
|
97
|
+
'95': 'rgb(202, 221, 253)',
|
|
98
|
+
'96': 'rgb(200, 221, 253)',
|
|
99
|
+
'97': 'rgb(199, 220, 253)',
|
|
100
|
+
'98': 'rgb(197, 219, 253)',
|
|
101
|
+
'99': 'rgb(196, 218, 254)',
|
|
102
|
+
'100': 'rgb(194, 217, 254)',
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export const cctToColor = (key: string | number, brightness?: string | number) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
let color = ccts[String(key)]
|
|
107
|
+
if (color && (brightness || brightness === 0)) {
|
|
108
|
+
color = Number(brightness) === 0 ? 'rgb(0,0,0)' : `rgba(${color.slice(4, -1)}, ${Number(brightness) / 100 < 0.1 ? 0.1 : Number(brightness) / 100})`
|
|
109
|
+
}
|
|
110
|
+
return color
|
|
111
111
|
}
|