@tuya-sat/sdf-main-sdk 0.0.1-beta.1
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/.vscode/settings.json +5 -0
- package/README.md +1 -0
- package/antd.less.overwrite.js +56 -0
- package/color.js +140 -0
- package/dark-variable.less +1449 -0
- package/package.json +74 -0
- package/scripts/gen-localize-file.mjs +56 -0
- package/src/App.less +156 -0
- package/src/App.tsx +87 -0
- package/src/api/index.ts +52 -0
- package/src/api/req.ts +23 -0
- package/src/api/res.ts +29 -0
- package/src/api/urls.ts +30 -0
- package/src/api/utils.ts +41 -0
- package/src/assets/imgs/404.svg +194 -0
- package/src/assets/imgs/reLogin.png +0 -0
- package/src/components/404/index.tsx +44 -0
- package/src/components/500/index.tsx +49 -0
- package/src/components/BCustomNav/index.module.less +17 -0
- package/src/components/BCustomNav/index.tsx +108 -0
- package/src/components/BForgot/index.module.less +5 -0
- package/src/components/BForgot/index.tsx +96 -0
- package/src/components/BHeaderUser/account.png +0 -0
- package/src/components/BHeaderUser/app-scan-en.png +0 -0
- package/src/components/BHeaderUser/app-scan-zh.png +0 -0
- package/src/components/BHeaderUser/app-scan.png +0 -0
- package/src/components/BHeaderUser/components/BSwitchLang/index.module.less +6 -0
- package/src/components/BHeaderUser/components/BSwitchLang/index.tsx +56 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/Content.tsx +199 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/index.module.less +11 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/Drawer/index.tsx +27 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/hooks.ts +104 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/index.module.less +70 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/index.tsx +184 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/table/index.tsx +184 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/table/read.tsx +67 -0
- package/src/components/BHeaderUser/components/Badge/components/Notice/tools/index.tsx +116 -0
- package/src/components/BHeaderUser/components/Badge/index.module.less +99 -0
- package/src/components/BHeaderUser/components/Badge/index.tsx +179 -0
- package/src/components/BHeaderUser/index.module.less +105 -0
- package/src/components/BHeaderUser/index.tsx +261 -0
- package/src/components/BHeaderUser/logout.tsx +26 -0
- package/src/components/BLayout/components/Header/index.module.less +27 -0
- package/src/components/BLayout/components/Header/index.tsx +36 -0
- package/src/components/BLayout/components/Layout/empty.tsx +35 -0
- package/src/components/BLayout/components/Layout/emptyPage.png +0 -0
- package/src/components/BLayout/components/Layout/index.tsx +72 -0
- package/src/components/BLayout/components/Logo.tsx +6 -0
- package/src/components/BLayout/components/Menu/collapse.tsx +41 -0
- package/src/components/BLayout/components/Menu/image/close.tsx +26 -0
- package/src/components/BLayout/components/Menu/image/closedefault.tsx +26 -0
- package/src/components/BLayout/components/Menu/image/open.tsx +38 -0
- package/src/components/BLayout/components/Menu/image/opendefault.tsx +38 -0
- package/src/components/BLayout/components/Menu/index.module.less +125 -0
- package/src/components/BLayout/components/Menu/index.tsx +244 -0
- package/src/components/BLayout/components/MenuIcon.module.less +5 -0
- package/src/components/BLayout/components/MenuIcon.tsx +46 -0
- package/src/components/BLayout/components/MultiSider/index.module.less +104 -0
- package/src/components/BLayout/components/MultiSider/index.tsx +172 -0
- package/src/components/BLayout/components/Sider/index.less +64 -0
- package/src/components/BLayout/components/Sider/index.module.less +17 -0
- package/src/components/BLayout/components/Sider/index.tsx +34 -0
- package/src/components/BLayout/index.tsx +78 -0
- package/src/components/BLayoutLogin/index.module.less +65 -0
- package/src/components/BLayoutLogin/index.tsx +68 -0
- package/src/components/BLayoutLogin/login.jpg +0 -0
- package/src/components/BLogin/component/Clause/index.module.less +25 -0
- package/src/components/BLogin/component/Clause/index.tsx +58 -0
- package/src/components/BLogin/component/ForgotBtn/index.module.less +9 -0
- package/src/components/BLogin/component/ForgotBtn/index.tsx +18 -0
- package/src/components/BLogin/component/Password/index.tsx +39 -0
- package/src/components/BLogin/component/SubmitBtn/index.tsx +30 -0
- package/src/components/BLogin/component/TenanSpace/index.tsx +28 -0
- package/src/components/BLogin/component/Title/index.module.less +6 -0
- package/src/components/BLogin/component/Title/index.tsx +12 -0
- package/src/components/BLogin/component/UserName/index.tsx +48 -0
- package/src/components/BLogin/component/VerifyCode/index.module.less +11 -0
- package/src/components/BLogin/component/VerifyCode/index.tsx +165 -0
- package/src/components/BLogin/index.module.less +31 -0
- package/src/components/BLogin/index.tsx +210 -0
- package/src/components/BRegister/components/TenantName/index.tsx +26 -0
- package/src/components/BRegister/index.module.less +5 -0
- package/src/components/BRegister/index.tsx +71 -0
- package/src/components/Back/index.tsx +25 -0
- package/src/components/IconFont/font.js +66 -0
- package/src/components/IconFont/index.tsx +18 -0
- package/src/components/MicroComponent/Header/index.module.less +7 -0
- package/src/components/MicroComponent/Header/index.tsx +220 -0
- package/src/components/PForgot/index.tsx +10 -0
- package/src/components/PLogin/index.tsx +12 -0
- package/src/components/PRegister/index.tsx +10 -0
- package/src/components/PSetting/index.module.less +53 -0
- package/src/components/PSetting/index.tsx +420 -0
- package/src/constant/chargeStatus.ts +6 -0
- package/src/constant/imgs.ts +6 -0
- package/src/constant/index.ts +293 -0
- package/src/dark-variable.less +1449 -0
- package/src/global.d.ts +54 -0
- package/src/hooks/index.ts +133 -0
- package/src/index.css +1493 -0
- package/src/index.tsx +105 -0
- package/src/lang/en.json +266 -0
- package/src/lang/index.ts +44 -0
- package/src/lang/utils.ts +285 -0
- package/src/lang/zh.json +270 -0
- package/src/micro-script/theme/index.ts +29 -0
- package/src/micro-script/theme/theme-css/static.js +73 -0
- package/src/micro-script/theme/theme-css/subscriber.ts +201 -0
- package/src/micro-script/theme/util/index.ts +58 -0
- package/src/mqtt/index.ts +121 -0
- package/src/pages/403.tsx +18 -0
- package/src/pages/404.tsx +17 -0
- package/src/pages/expiration.tsx +23 -0
- package/src/pages/forgot.tsx +9 -0
- package/src/pages/home/index.tsx +172 -0
- package/src/pages/home/setting/index.tsx +7 -0
- package/src/pages/index.ts +50 -0
- package/src/pages/login.tsx +46 -0
- package/src/pages/register.tsx +9 -0
- package/src/pages/relogin/index.module.less +0 -0
- package/src/pages/relogin/index.tsx +54 -0
- package/src/plugins/index.ts +11 -0
- package/src/public-path.js +8 -0
- package/src/qiankun/globalState.ts +6 -0
- package/src/qiankun/index.ts +174 -0
- package/src/qiankun/utils/index.ts +69 -0
- package/src/qiankun/xhook/index.ts +193 -0
- package/src/reportWebVitals.ts +15 -0
- package/src/sentry/index.ts +33 -0
- package/src/sky/index.ts +57 -0
- package/src/theme/custom-dark.less +64 -0
- package/src/theme/custom-light.less +48 -0
- package/src/theme/index.less +327 -0
- package/src/theme/variable.less +13 -0
- package/src/utils/checkPass.ts +21 -0
- package/src/utils/common.ts +195 -0
- package/src/utils/eventBus.ts +112 -0
- package/src/utils/gt.js +293 -0
- package/src/utils/index.ts +89 -0
- package/src/utils/theme/base.ts +110 -0
- package/src/utils/theme/changeCssVariable.ts +157 -0
- package/src/utils/theme/changeMenuCssVariable.ts +176 -0
- package/src/utils/theme/index.ts +85 -0
- package/src/utils/theme/store.ts +37 -0
- package/tsconfig.json +28 -0
- package/typings.d.ts +10 -0
- package/webpack.config.js +103 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sdf-main-sdk
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
light: {
|
|
3
|
+
'@main-menu-item-selected-color': '@text-color',
|
|
4
|
+
'@main-menu-item-selected-color-hover': '@menu-highlight-color',
|
|
5
|
+
'@main-menu-background-color': '@component-background',
|
|
6
|
+
'@main-layout-background-color': '@item-hover-bg',
|
|
7
|
+
'@mani-menu-collapsed-background': '@component-background',
|
|
8
|
+
// 分组下 标题背景
|
|
9
|
+
'@main-menu-collapsed-title-background': '@component-background',
|
|
10
|
+
// 分组下 hover背景
|
|
11
|
+
'@mani-menu-collapsed-item': '@item-hover-bg',
|
|
12
|
+
'@main-app-setting-top': '#eef0f3',
|
|
13
|
+
'@main-app-layout-header-bottom': '@item-hover-bg',
|
|
14
|
+
'@layout-header-background': '#fff',
|
|
15
|
+
},
|
|
16
|
+
dark: {
|
|
17
|
+
'@pageBgc': '#1e273e',
|
|
18
|
+
'@cardBgc': '#2c364f',
|
|
19
|
+
'@navBgc': '#303b53',
|
|
20
|
+
'@splitBgc': 'rgba(255, 255, 255, 0.12)',
|
|
21
|
+
'@borderBgc': 'rgba(255, 255, 255, 0.06)',
|
|
22
|
+
'@selectBgc': 'rgba(24, 144, 255, 0.2); // select选择框边框',
|
|
23
|
+
'@select-border-color': 'rgba(255, 255, 255, 0.2)',
|
|
24
|
+
'@table-bg': '@navBgc',
|
|
25
|
+
'@table-header-bg': '#2c364f',
|
|
26
|
+
// @table-border-color:rgba (255, 255, 255, 0.06);
|
|
27
|
+
// 表格边框色
|
|
28
|
+
'@border-color-split': 'rgba(255, 255, 255, 0.06)',
|
|
29
|
+
'@checkbox-color': 'rgba(255, 255, 255, 0.06)',
|
|
30
|
+
// checkbox 边框色
|
|
31
|
+
'@border-color-base': 'rgba(255, 255, 255, 0.2)',
|
|
32
|
+
// 表格hover色
|
|
33
|
+
'@table-row-hover-bg': '#232e48',
|
|
34
|
+
'@component-background': '#232e48',
|
|
35
|
+
'@main-menu-item-selected-color': 'rgba(255, 255, 255, 0.65)',
|
|
36
|
+
'@main-menu-item-selected-color-hover': 'rgb(255, 255, 255)',
|
|
37
|
+
'@main-menu-background-color': '@navBgc',
|
|
38
|
+
// 分组下 标题背景
|
|
39
|
+
'@main-menu-collapsed-title-background': '@navBgc',
|
|
40
|
+
// 分组下 hover背景
|
|
41
|
+
'@mani-menu-collapsed-item': '@selectBgc',
|
|
42
|
+
'@main-app-setting-top': '@splitBgc',
|
|
43
|
+
'@main-app-layout-header-bottom': 'rgba(0, 0, 0, 0)',
|
|
44
|
+
'@popover-bg': '@navBgc',
|
|
45
|
+
'@layout-header-background': '@cardBgc',
|
|
46
|
+
'@menu-item-active-bg': '@primary-color',
|
|
47
|
+
// 菜单栏
|
|
48
|
+
'@layout-sider-background': '@navBgc',
|
|
49
|
+
// 分组下 菜单背景
|
|
50
|
+
'@mani-menu-collapsed-background': '@navBgc',
|
|
51
|
+
'@layout-header-background': '@cardBgc',
|
|
52
|
+
'@select-dropdown-bg': '@navBgc',
|
|
53
|
+
'@select-item-selected-bg': '@primary-color',
|
|
54
|
+
'@body-background': '@pageBgc',
|
|
55
|
+
},
|
|
56
|
+
};
|
package/color.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const less = require('less');
|
|
4
|
+
const postcss = require('postcss');
|
|
5
|
+
const extractor = require('css-color-extractor');
|
|
6
|
+
|
|
7
|
+
const colorAndCssVariableOnly = postcss.plugin(
|
|
8
|
+
'extract css variable and color',
|
|
9
|
+
function (options) {
|
|
10
|
+
function transformProperty(decl, colors) {
|
|
11
|
+
var propertyTransformers = {
|
|
12
|
+
background: 'background-color',
|
|
13
|
+
border: 'border-color',
|
|
14
|
+
'border-top': 'border-top-color',
|
|
15
|
+
'border-right': 'border-right-color',
|
|
16
|
+
'border-bottom': 'border-bottom-color',
|
|
17
|
+
'border-left': 'border-left-color',
|
|
18
|
+
outline: 'outline-color',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (typeof propertyTransformers[decl.prop] === 'undefined') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (colors.length === 1) {
|
|
26
|
+
decl.prop = propertyTransformers[decl.prop];
|
|
27
|
+
decl.value = colors[0];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function processDecl(decl) {
|
|
32
|
+
const propsContainVariable = /var\([^)]+?\)/;
|
|
33
|
+
const VARIABLE_REGEX = /^--/;
|
|
34
|
+
if (VARIABLE_REGEX.test(decl.prop) && decl.parent.selector !== 'html') {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (propsContainVariable.test(decl.value)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
var colors = extractor.fromDecl(decl, options);
|
|
41
|
+
if (colors.length === 0) {
|
|
42
|
+
decl.remove();
|
|
43
|
+
} else {
|
|
44
|
+
transformProperty(decl, colors);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function processRule(rule) {
|
|
49
|
+
rule.each(processDecl);
|
|
50
|
+
|
|
51
|
+
if (rule.nodes.length === 0) {
|
|
52
|
+
rule.remove();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function processAtrule(atrule) {
|
|
57
|
+
switch (atrule.name) {
|
|
58
|
+
case 'media':
|
|
59
|
+
atrule.each(processNode);
|
|
60
|
+
|
|
61
|
+
if (atrule.nodes.length === 0) {
|
|
62
|
+
atrule.remove();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
break;
|
|
66
|
+
// @TODO deal with other types of atrules
|
|
67
|
+
default:
|
|
68
|
+
atrule.remove();
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function processNode(node) {
|
|
74
|
+
switch (node.type) {
|
|
75
|
+
case 'atrule':
|
|
76
|
+
processAtrule(node);
|
|
77
|
+
break;
|
|
78
|
+
case 'rule':
|
|
79
|
+
processRule(node);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
node.remove();
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return function (css) {
|
|
88
|
+
css.each(processNode);
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
class HandleImport extends less.FileManager {
|
|
94
|
+
async loadFile(filename, currentDirectory, options, environment) {
|
|
95
|
+
if (filename.startsWith('~')) {
|
|
96
|
+
return super.loadFile(
|
|
97
|
+
filename.replace('~', ''),
|
|
98
|
+
currentDirectory,
|
|
99
|
+
options,
|
|
100
|
+
environment,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return super.loadFile(filename, currentDirectory, options, environment);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function createHandleImportPlugin() {
|
|
108
|
+
return {
|
|
109
|
+
install(lessInstance, pluginManager) {
|
|
110
|
+
pluginManager.addFileManager(new HandleImport());
|
|
111
|
+
},
|
|
112
|
+
minVersion: [3, 0, 0],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const lessFile = require.resolve('./src/App.less');
|
|
117
|
+
|
|
118
|
+
less
|
|
119
|
+
.render(fs.readFileSync(lessFile, 'utf-8'), {
|
|
120
|
+
filename: lessFile,
|
|
121
|
+
javascriptEnabled: true,
|
|
122
|
+
modifyVars: {
|
|
123
|
+
'ant-prefix': 'main',
|
|
124
|
+
'use-dark-compiler': 'true',
|
|
125
|
+
},
|
|
126
|
+
plugins: [createHandleImportPlugin()],
|
|
127
|
+
})
|
|
128
|
+
.then(({ css }) => {
|
|
129
|
+
return postcss()
|
|
130
|
+
.use(
|
|
131
|
+
colorAndCssVariableOnly({
|
|
132
|
+
withoutGrey: false,
|
|
133
|
+
withoutMonochrome: false,
|
|
134
|
+
}),
|
|
135
|
+
)
|
|
136
|
+
.process(css).css;
|
|
137
|
+
})
|
|
138
|
+
.then((content) => {
|
|
139
|
+
fs.writeFileSync('./public/static/dark.css', content);
|
|
140
|
+
});
|