Skip to content

Commit 8f73247

Browse files
committed
feat: integrate @ant-design-vue/tailwind-config and update styles for UI components
1 parent 36a6ed5 commit 8f73247

File tree

15 files changed

+195
-20
lines changed

15 files changed

+195
-20
lines changed

apps/playground/assets/tailwind.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'tailwindcss' source(none);
1+
@import '@ant-design-vue/tailwind-config';
22
@source '../index.html';
33
@source '../src/**/*.{vue,ts}';
44
* {

apps/playground/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@ant-design-vue/prettier-config": "*",
3030
"@ant-design-vue/typescript-config": "*",
3131
"@ant-design-vue/vite-config": "*",
32+
"@ant-design-vue/tailwind-config": "*",
3233
"@tailwindcss/vite": "^4.1.3",
3334
"@types/cookies": "^0.9.0",
3435
"@types/node": "^20.0.0",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "@ant-design-vue/tailwind-config",
3+
"version": "0.0.0",
4+
"private": true,
5+
"exports": {
6+
".": {
7+
"default": "./tailwind.css"
8+
},
9+
"./themes/*": {
10+
"default": "./themes/*.css"
11+
}
12+
},
13+
"devDependencies": {
14+
"tailwindcss": "^4.0.9",
15+
"@tailwindcss/typography": "^0.5.16"
16+
},
17+
"peerDependencies": {
18+
"tailwindcss": "^4",
19+
"@tailwindcss/typography": "^0.5.16"
20+
}
21+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@import 'tailwindcss' source(none);
2+
@plugin '@tailwindcss/typography';
3+
4+
@utility text-tint-* {
5+
color: color-mix(in srgb, --value(--color-*, [*]), white calc(--modifier(integer) * 1%));
6+
}
7+
8+
@utility text-shade-* {
9+
color: color-mix(in srgb, --value(--color-*, [*]), black calc(--modifier(integer) * 1%));
10+
}
11+
12+
@utility bg-tint-* {
13+
background-color: color-mix(
14+
in srgb,
15+
--value(--color-*, [*]),
16+
white calc(--modifier(integer) * 1%)
17+
);
18+
}
19+
20+
@utility bg-shade-* {
21+
background-color: color-mix(
22+
in srgb,
23+
--value(--color-*, [*]),
24+
black calc(--modifier(integer) * 1%)
25+
);
26+
}
27+
28+
@utility border-tint-* {
29+
border-color: color-mix(in srgb, --value(--color-*, [*]), white calc(--modifier(integer) * 1%));
30+
}
31+
32+
@utility border-shade-* {
33+
border-color: color-mix(in srgb, --value(--color-*, [*]), black calc(--modifier(integer) * 1%));
34+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@theme {
2+
--color-base-100: #ffffff;
3+
--color-base-200: #f7f7f7;
4+
--color-base-300: #ededed;
5+
--color-base-content: #222222;
6+
--color-primary: #151415;
7+
--color-primary-content: #ffffff;
8+
--color-secondary: #0d58fc;
9+
--color-secondary-content: #ffffff;
10+
--color-accent: #0289ff;
11+
--color-accent-content: #ffffff;
12+
--color-neutral: #666666;
13+
--color-neutral-content: #ffffff;
14+
--color-info: #0d58fc;
15+
--color-info-content: #ffffff;
16+
--color-success: #00c573;
17+
--color-success-content: #ffffff;
18+
--color-warning: #ff9900;
19+
--color-warning-content: #ffffff;
20+
--color-error: #ff3333;
21+
--color-error-content: #ffffff;
22+
}

packages-config/vite-config/index.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { UserConfig, UserConfigFnObject } from 'vite'
22

3-
export type GetUserConfig = (dirname: string) => UserConfig | UserConfigFnObject
3+
export type GetUserConfig = (
4+
dirname: string,
5+
overwriteLib?: boolean,
6+
) => UserConfig | UserConfigFnObject
47

58
export declare function extendsConfig(
69
base: UserConfig | UserConfigFnObject,

packages-config/vite-config/vite.config.lib.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import dts from 'vite-plugin-dts'
88
/**
99
* @type {import('./index.d.ts').GetUserConfig}
1010
*/
11-
export default dirname =>
11+
export default (dirname, overwriteLib) =>
1212
defineConfig(({ mode }) => {
1313
const pkg = JSON.parse(readFileSync(resolve(dirname, './package.json'), 'utf-8'))
1414
const isDev = mode === 'development'
@@ -23,20 +23,22 @@ export default dirname =>
2323
}),
2424
],
2525
build: {
26-
lib: {
27-
entry: {
28-
lib: resolve(dirname, 'src/index.ts'),
29-
},
30-
formats: ['es', 'cjs'],
31-
fileName: (format, entryName) => `${entryName}.${format === 'es' ? 'mjs' : 'cjs'}`,
32-
},
26+
lib: overwriteLib
27+
? undefined
28+
: {
29+
entry: {
30+
lib: resolve(dirname, 'src/index.ts'),
31+
},
32+
formats: ['es', 'cjs'],
33+
fileName: (format, entryName) => `${entryName}.${format === 'es' ? 'mjs' : 'cjs'}`,
34+
},
3335
rollupOptions: {
3436
external: isDev
3537
? id => {
3638
if (pkg.peerDependencies && id in pkg.peerDependencies) {
3739
return true
3840
}
39-
if (/^@(ant-design-vue)\//.test(id) || id === 'ant-design-vue') {
41+
if (/^@(ant-design-vue)\//.test(id)) {
4042
return true
4143
}
4244
return false

packages-config/vite-config/vite.config.vue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import lib from './vite.config.lib.js'
66
/**
77
* @type {import('./index.d.ts').GetUserConfig}
88
*/
9-
export default dirname =>
9+
export default (dirname, overwriteLib) =>
1010
extendsConfig(
11-
lib(dirname),
11+
lib(dirname, overwriteLib),
1212
defineConfig(({ mode }) => {
1313
return {
1414
plugins: [vue()],

packages/ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"@ant-design-vue/prettier-config": "*",
8080
"@ant-design-vue/typescript-config": "*",
8181
"@ant-design-vue/vite-config": "*",
82+
"@ant-design-vue/tailwind-config": "*",
8283
"@tailwindcss/vite": "^4.1.3",
8384
"@vitejs/plugin-vue": "^5.1.3",
8485
"@vueuse/core": "^12.0.0",

packages/ui/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import './style/index.css'
1+
import './style/tailwind.css'
22
import { App } from 'vue'
33

44
import * as components from './components'

0 commit comments

Comments
 (0)