create-antd-skin 1.2.3 → 1.2.5
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/LICENSE +21 -0
- package/README.md +30 -0
- package/bin/index.js +2 -2
- package/bin/layout.js +0 -5
- package/bin/skin.js +26 -17
- package/package.json +1 -1
- package/skins/blue-sky-dark/images/app-logo-dark.webp +0 -0
- package/skins/blue-sky-dark/images/app-logo-light.webp +0 -0
- package/skins/blue-sky-dark/images/bg-top-left-dark.webp +0 -0
- package/skins/blue-sky-dark/images/bg-top-right-dark.webp +0 -0
- package/skins/blue-sky-dark/images/skin-icon-dark.webp +0 -0
- package/skins/blue-sky-dark/images/skin-login-dark.webp +0 -0
- package/skins/blue-sky-dark/index.tsx +50 -0
- package/skins/blue-sky-light/images/app-logo-light.webp +0 -0
- package/skins/blue-sky-light/images/bg-bottom-left.webp +0 -0
- package/skins/blue-sky-light/images/bg-top-left.webp +0 -0
- package/skins/blue-sky-light/images/bg-top-right.webp +0 -0
- package/skins/blue-sky-light/images/skin-icon-light.webp +0 -0
- package/skins/blue-sky-light/images/skin-login-light.webp +0 -0
- package/skins/blue-sky-light/index.tsx +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zhouwenqi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# create-antd-skin
|
|
2
|
+
|
|
3
|
+
`create-antd-skin` is a CLI tool for creating skins for projects that use [`@adminui-dev/antd-layout`](https://www.npmjs.com/package/@adminui-dev/antd-layout).
|
|
4
|
+
|
|
5
|
+
> This tool is designed to work with `@adminui-dev/antd-layout`. It requires the use of the corresponding components within your project and also serves as an example of how to implement custom skins.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd ./your-app
|
|
11
|
+
npx create-antd-skin@latest parkWavesDark
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Available Skins
|
|
15
|
+
- `parkWavesLight`: Light theme, featuring a purple color palette and a background with flowing, ribbon-like waves.
|
|
16
|
+
- `parkWavesDark`: Dark theme, featuring a purple color palette and a background with flowing, ribbon-like waves.
|
|
17
|
+
- `parkWavesNone`: Dark theme, featuring a black color palette and a sidebar layout inspired by shadcn/ui.
|
|
18
|
+
- `parkWavesSider`: Dark theme, featuring a purple color palette, a background with flowing, ribbon-like waves, and a sidebar layout inspired by shadcn/ui.
|
|
19
|
+
- `blueSkyDark`: Dark theme, featuring a blue color palette and a sky-and-clouds background.
|
|
20
|
+
- `blueSkyLight`: Light theme, featuring a blue color palette and a sky-and-clouds background.
|
|
21
|
+
|
|
22
|
+
## Related Links
|
|
23
|
+
|
|
24
|
+
* [AdminUI Official Website](https://adminui.dev)
|
|
25
|
+
* [@adminui-dev/antd-layout](https://www.npmjs.com/package/@adminui-dev/antd-layout)
|
|
26
|
+
* [adminui-cli (npm)](https://www.npmjs.com/package/adminui-cli)
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
Please refer to the LICENSE file included in this repository.
|
package/bin/index.js
CHANGED
|
@@ -7,8 +7,8 @@ const layout_1 = require("./layout");
|
|
|
7
7
|
const program = new commander_1.Command();
|
|
8
8
|
program
|
|
9
9
|
.name('create-antd-skin')
|
|
10
|
-
.description("Add a
|
|
11
|
-
.version("1.
|
|
10
|
+
.description("Add a system skin to your project for @adminui-dev/admin-layout")
|
|
11
|
+
.version("1.2.5")
|
|
12
12
|
.argument("[skin-name]", 'Skin name')
|
|
13
13
|
.action(async (skinName) => {
|
|
14
14
|
await (0, skin_1.installSkin)(skinName);
|
package/bin/layout.js
CHANGED
|
@@ -115,11 +115,6 @@ async function patchLayoutFile(filePath) {
|
|
|
115
115
|
await fs_extra_1.default.writeFile(filePath, output.code);
|
|
116
116
|
console.log(chalk_1.default.greenBright("✓") + " Updated:", path_1.default.relative(process.cwd(), filePath));
|
|
117
117
|
}
|
|
118
|
-
function hasThemeSkinsProp(node) {
|
|
119
|
-
return node.attributes.some(attr => t.isJSXAttribute(attr) &&
|
|
120
|
-
t.isJSXIdentifier(attr.name) &&
|
|
121
|
-
attr.name.name === "themeSkins");
|
|
122
|
-
}
|
|
123
118
|
async function getLayoutFiles(dir) {
|
|
124
119
|
const result = [];
|
|
125
120
|
const items = await fs_extra_1.default.readdir(dir);
|
package/bin/skin.js
CHANGED
|
@@ -9,22 +9,31 @@ 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
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
12
|
+
/** 按 tsx > ts 优先级返回目录中已存在的入口文件;都不存在返回 null */
|
|
13
|
+
async function findExistingEntry(dir) {
|
|
14
|
+
const candidates = ["tsx", "ts"];
|
|
15
|
+
for (const ext of candidates) {
|
|
16
|
+
const file = path_1.default.join(dir, `index.${ext}`);
|
|
17
|
+
if (await fs_extra_1.default.pathExists(file)) {
|
|
18
|
+
return { source: file, ext };
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
/** 源皮肤目录必须有入口,缺失时抛错 */
|
|
24
|
+
async function findSkinEntry(skinDir) {
|
|
25
|
+
const entry = await findExistingEntry(skinDir);
|
|
26
|
+
if (!entry) {
|
|
27
|
+
throw new Error(`No skin entry found in ${skinDir}. Expected index.ts or index.tsx`);
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
return entry;
|
|
30
|
+
}
|
|
31
|
+
/** 目标项目入口:已有则沿用,没有则默认 index.ts */
|
|
32
|
+
async function resolveTargetIndexFile(skinRoot) {
|
|
33
|
+
const existing = await findExistingEntry(skinRoot);
|
|
34
|
+
return existing
|
|
35
|
+
? existing.source
|
|
36
|
+
: path_1.default.join(skinRoot, "index.ts");
|
|
28
37
|
}
|
|
29
38
|
async function getSkinList() {
|
|
30
39
|
const skinsDir = path_1.default.join(__dirname, "../skins");
|
|
@@ -54,10 +63,10 @@ async function copySkinFiles(skinName, skinDir, projectRoot) {
|
|
|
54
63
|
}
|
|
55
64
|
async function updateSkinIndex(skinName, projectRoot) {
|
|
56
65
|
const skinRoot = path_1.default.join(projectRoot, "src/components/warden-skins");
|
|
57
|
-
const indexFile = path_1.default.join(skinRoot, "index.ts");
|
|
58
66
|
await fs_extra_1.default.ensureDir(skinRoot);
|
|
67
|
+
const indexFile = await resolveTargetIndexFile(skinRoot);
|
|
59
68
|
const dirs = (await fs_extra_1.default.readdir(skinRoot))
|
|
60
|
-
.filter(item => item !== "index.ts")
|
|
69
|
+
.filter(item => item !== "index.ts" && item !== "index.tsx")
|
|
61
70
|
.filter(item => fs_extra_1.default.statSync(path_1.default.join(skinRoot, item)).isDirectory());
|
|
62
71
|
const skinNames = Array.from(new Set([...dirs, skinName]));
|
|
63
72
|
const imports = skinNames
|
|
@@ -109,7 +118,7 @@ async function installSkin(skinName) {
|
|
|
109
118
|
}
|
|
110
119
|
const skin = skins.find(item => item.name === selectedSkin);
|
|
111
120
|
if (!skin) {
|
|
112
|
-
console.error(chalk_1.default.red(`× Skin "${selectedSkin}" not found
|
|
121
|
+
console.error(chalk_1.default.red(`× Skin "${selectedSkin}" not found. can only be [${skins.join(",")}]`));
|
|
113
122
|
process.exit(1);
|
|
114
123
|
}
|
|
115
124
|
const spinner = (0, ora_1.default)(`Installing skin "${selectedSkin}"...`).start();
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
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:"#090a0b",
|
|
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/blue-sky/bg-top-left-dark.webp" alt="bg-top-left.webp" />
|
|
22
|
+
<LazyImage style={{...imgStyles,top:"0px",right:"0px"}} src="/images/skins/blue-sky/bg-top-right-dark.webp" alt="bg-bottom-right.webp" />
|
|
23
|
+
<LazyImage style={{...imgStyles,bottom:"0px",left:"0px"}} src="/images/skins/blue-sky/bg-bottom-left.webp" alt="bg-bottom-left.webp" />
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
const skin:ThemeSkin = {
|
|
28
|
+
"name":"blueSkyDark",
|
|
29
|
+
"skinType":"system",
|
|
30
|
+
"backgroundColor":"#090a0b",
|
|
31
|
+
"layoutConfig":{
|
|
32
|
+
"theme":"dark",
|
|
33
|
+
"primaryColor":"#32a7da",
|
|
34
|
+
"noneHeader":false,
|
|
35
|
+
"hideBorder":false,
|
|
36
|
+
"asideBlur":true,
|
|
37
|
+
"headerBlur":true,
|
|
38
|
+
"largeBrand":true,
|
|
39
|
+
"containerBlur":true,
|
|
40
|
+
"menuItemSelectColor":"primary",
|
|
41
|
+
},
|
|
42
|
+
"antdToken":{
|
|
43
|
+
"colorBgBase": "#0b0c0c",
|
|
44
|
+
"colorTextBase": "#f4fafd"
|
|
45
|
+
},
|
|
46
|
+
"logo":"/images/skins/blue-sky/app-logo-dark.webp",
|
|
47
|
+
"icon":"/images/skins/blue-sky/skin-icon-dark.webp",
|
|
48
|
+
"backgroundContent":<ImageBackground />
|
|
49
|
+
}
|
|
50
|
+
export default skin
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
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:"#fbfbfb",
|
|
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/blue-sky/bg-top-left.webp" alt="bg-top-left.webp" />
|
|
22
|
+
<LazyImage style={{...imgStyles,top:"0px",right:"0px"}} src="/images/skins/blue-sky/bg-top-right.webp" alt="bg-bottom-right.webp" />
|
|
23
|
+
<LazyImage style={{...imgStyles,bottom:"0px",left:"0px"}} src="/images/skins/blue-sky/bg-bottom-left.webp" alt="bg-bottom-left.webp" />
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
const skin:ThemeSkin = {
|
|
28
|
+
"name":"blueSkyLight",
|
|
29
|
+
"skinType":"system",
|
|
30
|
+
"backgroundColor":"#fbfbfb",
|
|
31
|
+
"layoutConfig":{
|
|
32
|
+
"theme":"light",
|
|
33
|
+
"primaryColor":"#4dbae9",
|
|
34
|
+
"noneHeader":false,
|
|
35
|
+
"hideBorder":false,
|
|
36
|
+
"asideBlur":true,
|
|
37
|
+
"headerBlur":true,
|
|
38
|
+
"largeBrand":true,
|
|
39
|
+
"containerBlur":true,
|
|
40
|
+
"menuItemSelectColor":"primary",
|
|
41
|
+
},
|
|
42
|
+
"antdToken":{
|
|
43
|
+
"colorBgBase": "#f4fafd",
|
|
44
|
+
"colorTextBase": "#010d13"
|
|
45
|
+
},
|
|
46
|
+
"logo":"/images/skins/blue-sky/app-logo-light.webp",
|
|
47
|
+
"icon":"/images/skins/blue-sky/skin-icon-light.webp",
|
|
48
|
+
"backgroundContent":<ImageBackground />
|
|
49
|
+
}
|
|
50
|
+
export default skin
|