@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/main.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import {createNavigator, GlobalTheme, NavigationRoute} from 'tuya-panel-kit'
|
|
|
2
2
|
import composeLayout from './composeLayout'
|
|
3
3
|
|
|
4
4
|
export function Navigation(router: NavigationRoute[]) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
return composeLayout(createNavigator<{ theme: GlobalTheme }>({
|
|
6
|
+
router: router,
|
|
7
|
+
screenOptions: {},
|
|
8
|
+
}))
|
|
9
9
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
interface DpSchemaProperty extends Record<string, any> {
|
|
2
|
-
|
|
2
|
+
type: string
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
export interface DpSchema {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
name: string
|
|
7
|
+
dp: number
|
|
8
|
+
type: string
|
|
9
|
+
mode: string
|
|
10
|
+
property: DpSchemaProperty
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export class GlobalParams {
|
|
14
|
-
|
|
14
|
+
static dpSchemaMap: Record<string, DpSchema> = {}
|
|
15
15
|
}
|
package/src/models/TuyaApi.d.ts
CHANGED
|
@@ -20,10 +20,10 @@ export interface DpResultByMonthResData {
|
|
|
20
20
|
thisDay: string;
|
|
21
21
|
sum: string;
|
|
22
22
|
}
|
|
23
|
-
export declare function getDpResultByMonth(devId: string, dpId: string, type:
|
|
23
|
+
export declare function getDpResultByMonth(devId: string, dpId: string, type: 'sum' | 'minux' | 'mac'): Promise<DpResultByMonthResData>;
|
|
24
24
|
export interface DpResultByDataWithSpecifiedResData {
|
|
25
25
|
result: object;
|
|
26
26
|
min: string;
|
|
27
27
|
}
|
|
28
|
-
export declare function getDataWithSpecified(devId: string, dpId: string, startDay: string, endDay: string, type:
|
|
29
|
-
export declare function getDpResultByHour(devId: string, dpId: string, date: string, type:
|
|
28
|
+
export declare function getDataWithSpecified(devId: string, dpId: string, startDay: string, endDay: string, type: 'sum' | 'minux' | 'avg'): Promise<DpResultByDataWithSpecifiedResData>;
|
|
29
|
+
export declare function getDpResultByHour(devId: string, dpId: string, date: string, type: 'sum' | 'minux' | 'avg'): Promise<DpResultByDataWithSpecifiedResData>;
|
package/src/models/TuyaApi.ts
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
1
|
import {commonApi} from '@tuya/tuya-panel-api'
|
|
2
2
|
|
|
3
3
|
export interface PagingResult<T> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
data: T
|
|
5
|
+
hasNext: boolean
|
|
6
|
+
currentOffset: number
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface DpReportSataResData {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
dps: DpReportSataData[]
|
|
11
|
+
hasNext: boolean
|
|
12
|
+
total: number
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface DpReportSataData {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
timeStamp: number
|
|
17
|
+
dpId: number
|
|
18
|
+
timeStr: string
|
|
19
|
+
value: string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export async function getDpReportSataData(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
deviceId: string,
|
|
24
|
+
dpIds: string[],
|
|
25
|
+
offset: number,
|
|
26
|
+
limit: number,
|
|
27
|
+
sortType?: 'ASC' | 'DESC',
|
|
28
28
|
): Promise<DpReportSataResData> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const params = {
|
|
30
|
+
devId: deviceId,
|
|
31
|
+
dpIds: dpIds.join(','),
|
|
32
|
+
offset: offset,
|
|
33
|
+
limit: limit,
|
|
34
|
+
sortType: sortType || 'DESC',
|
|
35
|
+
}
|
|
36
|
+
return commonApi.statApi.getDpReportLog(params)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export interface DpResultByMonthResData {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
years: object;
|
|
41
|
+
thisDay: string;
|
|
42
|
+
sum: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export async function getDpResultByMonth(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
devId: string,
|
|
47
|
+
dpId: string,
|
|
48
|
+
type: 'sum' | 'minux' | 'mac',
|
|
49
49
|
): Promise<DpResultByMonthResData> {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const params = {
|
|
51
|
+
devId,
|
|
52
|
+
dpId,
|
|
53
|
+
type,
|
|
54
|
+
}
|
|
55
|
+
return commonApi.statApi.getDpResultByMonth(params) as any
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export interface DpResultByDataWithSpecifiedResData {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
result: object;
|
|
60
|
+
min: string;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export async function getDataWithSpecified(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
devId: string,
|
|
65
|
+
dpId: string,
|
|
66
|
+
startDay: string,
|
|
67
|
+
endDay: string,
|
|
68
|
+
type: 'sum' | 'minux' | 'avg',
|
|
69
69
|
): Promise<DpResultByDataWithSpecifiedResData> {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
const params = {
|
|
71
|
+
devId,
|
|
72
|
+
dpId,
|
|
73
|
+
startDay,
|
|
74
|
+
endDay,
|
|
75
|
+
type,
|
|
76
|
+
}
|
|
77
|
+
return commonApi.statApi.getDataWithSpecified(params) as any
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export async function getDpResultByHour(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
devId: string,
|
|
82
|
+
dpId: string,
|
|
83
|
+
date: string,
|
|
84
|
+
type: 'sum' | 'minux' | 'avg',
|
|
85
85
|
): Promise<DpResultByDataWithSpecifiedResData> {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
const params = {
|
|
87
|
+
devId,
|
|
88
|
+
dpId,
|
|
89
|
+
date,
|
|
90
|
+
type,
|
|
91
|
+
}
|
|
92
|
+
return commonApi.statApi.getDpResultByHour(params) as any
|
|
93
93
|
}
|
package/src/models/combine.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {combineReducers} from 'redux'
|
|
2
|
+
import {combineEpics} from 'redux-observable'
|
|
3
|
+
import {epics as commonEpics, reducers as commonReducers} from './modules/common'
|
|
4
4
|
|
|
5
5
|
export const reducers = {
|
|
6
6
|
...commonReducers,
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
type Reducers = typeof reducers;
|
|
10
10
|
|
|
11
11
|
export type ReduxState = { [K in keyof Reducers]: ReturnType<Reducers[K]> };
|
|
12
12
|
|
|
13
|
-
export const rootReducers = combineReducers(reducers)
|
|
13
|
+
export const rootReducers = combineReducers(reducers)
|
|
14
14
|
|
|
15
|
-
const allEpics = [...commonEpics]
|
|
15
|
+
const allEpics = [...commonEpics]
|
|
16
16
|
|
|
17
|
-
export const rootEpics = combineEpics(...allEpics)
|
|
17
|
+
export const rootEpics = combineEpics(...allEpics)
|
|
@@ -9,25 +9,25 @@ const mWindow: any = window
|
|
|
9
9
|
|
|
10
10
|
const isDebuggingInChrome = __DEV__ && !!mWindow.navigator.userAgent
|
|
11
11
|
const logger = createLogger({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
predicate: () => isDebuggingInChrome,
|
|
13
|
+
collapsed: true,
|
|
14
|
+
duration: true,
|
|
15
15
|
})
|
|
16
16
|
|
|
17
17
|
const middleware = isDebuggingInChrome ? [epicMiddleware, logger] : [epicMiddleware]
|
|
18
18
|
|
|
19
19
|
export default function configureStore(initialState?: Partial<ReduxState>) {
|
|
20
|
-
|
|
20
|
+
const appliedMiddleware = applyMiddleware(...middleware)
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
const store = createStore(
|
|
23
|
+
rootReducers,
|
|
24
|
+
initialState,
|
|
25
|
+
compose(
|
|
26
|
+
appliedMiddleware,
|
|
27
|
+
isDebuggingInChrome && mWindow.devToolsExtension ? mWindow.devToolsExtension() : (f: any) => f,
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
epicMiddleware.run(rootEpics)
|
|
32
|
+
return store
|
|
33
33
|
}
|
package/src/models/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './combine'
|
|
|
7
7
|
export * from './configureStore'
|
|
8
8
|
|
|
9
9
|
const actions = {
|
|
10
|
-
|
|
10
|
+
common: CommonActions,
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export {actions}
|
|
@@ -15,8 +15,8 @@ export {actions}
|
|
|
15
15
|
export const store = configureStore()
|
|
16
16
|
|
|
17
17
|
export function useSelector<TSelected>(
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
selector: (state: ReduxState) => TSelected,
|
|
19
|
+
equalityFn?: (left: TSelected, right: TSelected) => boolean,
|
|
20
20
|
) {
|
|
21
|
-
|
|
21
|
+
return useSelectorBase<ReduxState, TSelected>(selector, equalityFn || shallowEqual)
|
|
22
22
|
}
|