create-antd-skin 1.0.5 → 1.0.7
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/bin/skin.js +19 -5
- package/package.json +2 -2
- package/skins/park-waves-dark/images/app-logo-dark.webp +0 -0
- package/skins/park-waves-dark/images/aside-bg-dark.webp +0 -0
- package/skins/park-waves-dark/images/footer-bg-dark.webp +0 -0
- package/skins/park-waves-dark/images/header-bg-dark.webp +0 -0
- package/skins/park-waves-dark/images/skin-icon-dark.webp +0 -0
- package/skins/park-waves-dark/index.tsx +45 -0
- package/skins/park-waves-light/images/app-logo-light.webp +0 -0
- package/skins/park-waves-light/images/aside-bg-light.webp +0 -0
- package/skins/park-waves-light/images/footer-bg-light.webp +0 -0
- package/skins/park-waves-light/images/header-bg-light.webp +0 -0
- package/skins/park-waves-light/images/skin-icon-light.webp +0 -0
- package/skins/park-waves-light/index.tsx +45 -0
package/bin/skin.js
CHANGED
|
@@ -9,6 +9,23 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const ora_1 = __importDefault(require("ora"));
|
|
12
|
+
async function findSkinEntry(skinDir) {
|
|
13
|
+
const tsFile = path_1.default.join(skinDir, "index.ts");
|
|
14
|
+
const tsxFile = path_1.default.join(skinDir, "index.tsx");
|
|
15
|
+
if (await fs_extra_1.default.pathExists(tsxFile)) {
|
|
16
|
+
return {
|
|
17
|
+
source: tsxFile,
|
|
18
|
+
ext: "tsx",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (await fs_extra_1.default.pathExists(tsFile)) {
|
|
22
|
+
return {
|
|
23
|
+
source: tsFile,
|
|
24
|
+
ext: "ts",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`No skin entry found in ${skinDir}. Expected index.ts or index.tsx`);
|
|
28
|
+
}
|
|
12
29
|
async function getSkinList() {
|
|
13
30
|
const skinsDir = path_1.default.join(__dirname, "../skins");
|
|
14
31
|
if (!fs_extra_1.default.existsSync(skinsDir)) {
|
|
@@ -25,15 +42,12 @@ async function getSkinList() {
|
|
|
25
42
|
});
|
|
26
43
|
}
|
|
27
44
|
async function copySkinFiles(skinName, skinDir, projectRoot) {
|
|
28
|
-
const
|
|
45
|
+
const entry = await findSkinEntry(skinDir);
|
|
29
46
|
const skinImagesDir = path_1.default.join(skinDir, "images");
|
|
30
47
|
const targetSkinDir = path_1.default.join(projectRoot, "src/components/warden-skin", skinName);
|
|
31
48
|
const targetImagesDir = path_1.default.join(projectRoot, "public/images", skinName);
|
|
32
49
|
await fs_extra_1.default.ensureDir(targetSkinDir);
|
|
33
|
-
|
|
34
|
-
throw new Error(`${skinName}/index.ts not found`);
|
|
35
|
-
}
|
|
36
|
-
await fs_extra_1.default.copy(skinIndexFile, path_1.default.join(targetSkinDir, "index.ts"));
|
|
50
|
+
await fs_extra_1.default.copy(entry.source, path_1.default.join(targetSkinDir, `index.${entry.ext}`));
|
|
37
51
|
if (fs_extra_1.default.existsSync(skinImagesDir)) {
|
|
38
52
|
await fs_extra_1.default.copy(skinImagesDir, targetImagesDir);
|
|
39
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-antd-skin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "this is skin-cli for @adminui-dev/antd-layout",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "zhouwenqi",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"bin",
|
|
19
|
-
"
|
|
19
|
+
"skins"
|
|
20
20
|
],
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LazyImage } from "@adminui-dev/antd-layout"
|
|
2
|
+
import type { ThemeSkin } from "@adminui-dev/antd-layout"
|
|
3
|
+
import { Grid } from "antd"
|
|
4
|
+
|
|
5
|
+
const { useBreakpoint } = Grid
|
|
6
|
+
|
|
7
|
+
const skinBgStyles:React.CSSProperties = {
|
|
8
|
+
position:"absolute",
|
|
9
|
+
inset:"0",
|
|
10
|
+
backgroundColor:"#000105",
|
|
11
|
+
}
|
|
12
|
+
const imgStyles:React.CSSProperties = {
|
|
13
|
+
position:"absolute",
|
|
14
|
+
transition:"width 0.3s, height 0.3s, opaticy 0.3s"
|
|
15
|
+
}
|
|
16
|
+
const ImageBackground=()=>{
|
|
17
|
+
const { xs } = useBreakpoint()
|
|
18
|
+
const leftStyle = xs ? {"height":"100%"} : {"width:":"260px"}
|
|
19
|
+
return (
|
|
20
|
+
<div style={skinBgStyles}>
|
|
21
|
+
<LazyImage style={{...leftStyle,...imgStyles,top:"0px"}} src="/images/skins/park-waves-dark/aside-bg-dark.webp" alt="aisde-bg.webp" />
|
|
22
|
+
<LazyImage style={{...imgStyles,width:"90%",top:"0px",right:"0px"}} src="/images/skins/park-waves-dark/header-bg-dark.webp" alt="header-bg.webp" />
|
|
23
|
+
<LazyImage style={{...imgStyles,height:"80px",bottom:"0px",right:"0px"}} src="/images/skins/park-waves-dark/footer-bg-dark.webp" alt="header-bg.webp" />
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
const skin:ThemeSkin = {
|
|
28
|
+
"name":"parkWavesDark",
|
|
29
|
+
"skinType":"custom",
|
|
30
|
+
"layoutConfig":{
|
|
31
|
+
"theme":"dark",
|
|
32
|
+
"primaryColor":"#9898ff",
|
|
33
|
+
"noneHeader":false,
|
|
34
|
+
"hideBorder":false,
|
|
35
|
+
"asideBlur":true,
|
|
36
|
+
"headerBlur":true,
|
|
37
|
+
"largeBrand":true,
|
|
38
|
+
"containerBlur":true,
|
|
39
|
+
"menuItemSelectColor":"primary",
|
|
40
|
+
},
|
|
41
|
+
"logo":"/images/skins/park-waves-dark/app-logo-dark.webp",
|
|
42
|
+
"icon":"/images/skins/park-waves-dark/skin-icon-dark.webp",
|
|
43
|
+
"backgroundContent":<ImageBackground />
|
|
44
|
+
}
|
|
45
|
+
export default skin
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LazyImage} from "@adminui-dev/antd-layout"
|
|
2
|
+
import type { ThemeSkin } from "@adminui-dev/antd-layout"
|
|
3
|
+
import { Grid } from "antd"
|
|
4
|
+
|
|
5
|
+
const { useBreakpoint } = Grid
|
|
6
|
+
|
|
7
|
+
const skinBgStyles:React.CSSProperties = {
|
|
8
|
+
position:"absolute",
|
|
9
|
+
inset:"0",
|
|
10
|
+
backgroundColor:"#dae4ea",
|
|
11
|
+
}
|
|
12
|
+
const imgStyles:React.CSSProperties = {
|
|
13
|
+
position:"absolute",
|
|
14
|
+
transition:"width 0.3s, height 0.3s, opaticy 0.3s"
|
|
15
|
+
}
|
|
16
|
+
const ImageBackground=()=>{
|
|
17
|
+
const { xs } = useBreakpoint()
|
|
18
|
+
const leftStyle = xs ? {"height":"100%"} : {"width:":"260px"}
|
|
19
|
+
return (
|
|
20
|
+
<div style={skinBgStyles}>
|
|
21
|
+
<LazyImage style={{...leftStyle,...imgStyles,top:"0px"}} src="/images/skins/park-waves-light/aside-bg-light.webp" alt="aisde-bg.webp" />
|
|
22
|
+
<LazyImage style={{...imgStyles,width:"90%",top:"0px",right:"0px"}} src="/images/skins/park-waves-light/header-bg-light.webp" alt="header-bg.webp" />
|
|
23
|
+
<LazyImage style={{...imgStyles,height:"80px",bottom:"0px",right:"0px"}} src="/images/skins/park-waves-light/footer-bg-light.webp" alt="header-bg.webp" />
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
const skin:ThemeSkin = {
|
|
28
|
+
"name":"parkWavesLight",
|
|
29
|
+
"skinType":"custom",
|
|
30
|
+
"layoutConfig":{
|
|
31
|
+
"theme":"light",
|
|
32
|
+
"primaryColor":"#4a3a88",
|
|
33
|
+
"noneHeader":false,
|
|
34
|
+
"hideBorder":false,
|
|
35
|
+
"asideBlur":true,
|
|
36
|
+
"headerBlur":true,
|
|
37
|
+
"largeBrand":true,
|
|
38
|
+
"containerBlur":true,
|
|
39
|
+
"menuItemSelectColor":"primary",
|
|
40
|
+
},
|
|
41
|
+
"logo":"/images/skins/park-waves-light/app-logo-light.webp",
|
|
42
|
+
"icon":"/images/skins/park-waves-light/skin-icon-light.webp",
|
|
43
|
+
"backgroundContent":<ImageBackground />
|
|
44
|
+
}
|
|
45
|
+
export default skin
|