@admin-core/design 0.2.0 → 0.2.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/README.en.md +698 -0
- package/README.md +574 -181
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1142 -877
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/theme/constants.d.ts +5 -0
- package/dist/theme/constants.d.ts.map +1 -1
- package/dist/theme/i18n/en-US.d.ts +3 -0
- package/dist/theme/i18n/en-US.d.ts.map +1 -0
- package/dist/theme/i18n/index.d.ts +34 -0
- package/dist/theme/i18n/index.d.ts.map +1 -0
- package/dist/theme/i18n/zh-CN.d.ts +69 -0
- package/dist/theme/i18n/zh-CN.d.ts.map +1 -0
- package/dist/theme/index.d.ts +4 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/integration.d.ts +124 -0
- package/dist/theme/integration.d.ts.map +1 -0
- package/dist/theme/utils.d.ts +1 -1
- package/dist/theme/utils.d.ts.map +1 -1
- package/package.json +18 -11
- package/src/css/base.css +145 -0
- package/src/css/components.css +96 -0
- package/src/css/index.css +21 -0
- package/src/css/integrations/ant-design-vue.css +64 -0
- package/src/css/integrations/arco-design.css +62 -0
- package/src/css/integrations/element-plus.css +157 -0
- package/src/css/integrations/index.css +17 -0
- package/src/css/integrations/naive-ui.css +60 -0
- package/src/css/nprogress.css +74 -0
- package/src/css/transition.css +256 -0
- package/src/css/ui.css +117 -0
- package/src/css/utilities.css +138 -0
- package/src/tokens/dark.css +406 -0
- package/src/tokens/index.ts +6 -0
- package/src/tokens/light.css +297 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
# @admin-core/design
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**Modern Vue 3 Design System**
|
|
6
|
+
|
|
7
|
+
A complete design system based on Tailwind CSS v4, providing theme management, design tokens, and third-party component library integration
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@admin-core/design)
|
|
10
|
+
[](https://github.com/jackBoVip/admin-kit/blob/main/LICENSE)
|
|
11
|
+
|
|
12
|
+
English | [简体中文](./README.md)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ✨ Features
|
|
19
|
+
|
|
20
|
+
- 🎨 **15+ Preset Themes** - 2026 trending color series with light/dark mode support
|
|
21
|
+
- 🔧 **Tailwind CSS v4** - Built with the latest Tailwind CSS v4 features
|
|
22
|
+
- 🎯 **Design Tokens** - CSS variable-based design token system
|
|
23
|
+
- 🔌 **Third-party Integration** - Out-of-the-box theme integration for Element Plus, Ant Design Vue, and more
|
|
24
|
+
- 🌍 **Internationalization** - Support for Chinese and English theme names and descriptions
|
|
25
|
+
- 🎭 **Custom Themes** - Smart color generation algorithm - just pick a primary color
|
|
26
|
+
- 📦 **TypeScript** - Full TypeScript type support
|
|
27
|
+
- 🚀 **Zero Config** - Import and use, no complex configuration needed
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 📦 Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Using pnpm
|
|
35
|
+
pnpm add @admin-core/design
|
|
36
|
+
|
|
37
|
+
# Using npm
|
|
38
|
+
npm install @admin-core/design
|
|
39
|
+
|
|
40
|
+
# Using yarn
|
|
41
|
+
yarn add @admin-core/design
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick Start
|
|
47
|
+
|
|
48
|
+
### Basic Usage
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// main.ts
|
|
52
|
+
import { createApp } from 'vue'
|
|
53
|
+
import App from './App.vue'
|
|
54
|
+
|
|
55
|
+
// Import design system
|
|
56
|
+
import '@admin-core/design/css'
|
|
57
|
+
|
|
58
|
+
const app = createApp(App)
|
|
59
|
+
app.mount('#app')
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Using in Components
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<template>
|
|
66
|
+
<div class="min-h-screen bg-background text-foreground">
|
|
67
|
+
<div class="card-box p-6 rounded-lg">
|
|
68
|
+
<h1 class="text-2xl font-bold text-primary">Welcome to Admin Core</h1>
|
|
69
|
+
<p class="text-muted-foreground mt-2">Modern Design System</p>
|
|
70
|
+
|
|
71
|
+
<button class="mt-4 bg-primary text-primary-foreground px-4 py-2 rounded-md hover:bg-primary/90">
|
|
72
|
+
Get Started
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🎨 Theme System
|
|
82
|
+
|
|
83
|
+
### Toggle Dark Mode
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Toggle dark mode
|
|
87
|
+
document.documentElement.classList.toggle('dark')
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<!-- Light mode (default) -->
|
|
92
|
+
<html>
|
|
93
|
+
<body>...</body>
|
|
94
|
+
</html>
|
|
95
|
+
|
|
96
|
+
<!-- Dark mode -->
|
|
97
|
+
<html class="dark">
|
|
98
|
+
<body>...</body>
|
|
99
|
+
</html>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Switch Theme Variant
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// Set theme
|
|
106
|
+
document.documentElement.setAttribute('data-theme', 'deep-teal')
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<!-- Deep Teal theme -->
|
|
111
|
+
<html data-theme="deep-teal">
|
|
112
|
+
<body>...</body>
|
|
113
|
+
</html>
|
|
114
|
+
|
|
115
|
+
<!-- Dark + Deep Teal theme -->
|
|
116
|
+
<html class="dark" data-theme="deep-teal">
|
|
117
|
+
<body>...</body>
|
|
118
|
+
</html>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Available Themes (15 x 2026 Trending Colors)
|
|
122
|
+
|
|
123
|
+
| Theme ID | Name | Description |
|
|
124
|
+
|---------|------|-------------|
|
|
125
|
+
| `default` | Classic Blue | Classic blue theme suitable for most scenarios |
|
|
126
|
+
| `slate` | Slate Gray | Professional and stable neutral gray tone |
|
|
127
|
+
| `burnished-lilac` | Burnished Lilac | Elegant and mysterious purple-gray tone |
|
|
128
|
+
| `teaberry` | Teaberry | Vibrant rose-red tone |
|
|
129
|
+
| `amaranth` | Amaranth | Noble and elegant deep purple tone |
|
|
130
|
+
| `pulse-blue` | Pulse Blue | Energetic bright blue |
|
|
131
|
+
| `deep-teal` | Deep Teal | Calm and atmospheric teal tone |
|
|
132
|
+
| `mermaid-aqua` | Mermaid Aqua | Fresh and dreamy aqua blue |
|
|
133
|
+
| `pearl-purple` | Pearl Purple | Soft and elegant light purple |
|
|
134
|
+
| `burgundy` | Burgundy | Mature and stable wine red |
|
|
135
|
+
| `burnt-sienna` | Burnt Sienna | Warm and retro orange-brown |
|
|
136
|
+
| `olive-sage` | Olive Sage | Natural and fresh olive green |
|
|
137
|
+
| `champagne-gold` | Champagne Gold | Luxurious and elegant gold tone |
|
|
138
|
+
| `dusty-rose` | Dusty Rose | Gentle and romantic pink-gray |
|
|
139
|
+
| `citrus-green` | Citrus Green | Fresh and energetic lemon green |
|
|
140
|
+
|
|
141
|
+
### Using Vue Composable
|
|
142
|
+
|
|
143
|
+
```vue
|
|
144
|
+
<script setup lang="ts">
|
|
145
|
+
import { useTheme } from '@admin-core/design'
|
|
146
|
+
|
|
147
|
+
const {
|
|
148
|
+
mode, // Current mode: 'light' | 'dark'
|
|
149
|
+
variant, // Current theme variant
|
|
150
|
+
isDark, // Is dark mode
|
|
151
|
+
setMode, // Set mode
|
|
152
|
+
setVariant, // Set theme variant
|
|
153
|
+
toggleDarkMode, // Toggle dark mode
|
|
154
|
+
} = useTheme()
|
|
155
|
+
|
|
156
|
+
// Toggle dark mode
|
|
157
|
+
const handleToggle = () => {
|
|
158
|
+
toggleDarkMode()
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Switch theme
|
|
162
|
+
const handleThemeChange = (theme: string) => {
|
|
163
|
+
setVariant(theme)
|
|
164
|
+
}
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<template>
|
|
168
|
+
<div>
|
|
169
|
+
<button @click="handleToggle">
|
|
170
|
+
{{ isDark ? 'Switch to Light' : 'Switch to Dark' }}
|
|
171
|
+
</button>
|
|
172
|
+
|
|
173
|
+
<select @change="handleThemeChange($event.target.value)">
|
|
174
|
+
<option value="default">Classic Blue</option>
|
|
175
|
+
<option value="deep-teal">Deep Teal</option>
|
|
176
|
+
<option value="teaberry">Teaberry</option>
|
|
177
|
+
</select>
|
|
178
|
+
</div>
|
|
179
|
+
</template>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 🎯 Custom Themes
|
|
185
|
+
|
|
186
|
+
### Smart Color Generation
|
|
187
|
+
|
|
188
|
+
Just pick a primary color, and the system will automatically generate a complete color scheme:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { applyThemeFromPrimary } from '@admin-core/design'
|
|
192
|
+
|
|
193
|
+
// Using HEX color
|
|
194
|
+
applyThemeFromPrimary('#8B5CF6')
|
|
195
|
+
|
|
196
|
+
// Using HSL color
|
|
197
|
+
applyThemeFromPrimary('280 60% 50%')
|
|
198
|
+
|
|
199
|
+
// Specify mode and persist
|
|
200
|
+
applyThemeFromPrimary('#8B5CF6', 'dark', true)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Full Customization
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { applyCustomTheme } from '@admin-core/design'
|
|
207
|
+
|
|
208
|
+
applyCustomTheme({
|
|
209
|
+
primary: '280 60% 50%',
|
|
210
|
+
secondary: '280 30% 90%',
|
|
211
|
+
accent: '280 55% 85%',
|
|
212
|
+
// ... more colors
|
|
213
|
+
}, true) // true means persist to localStorage
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 🔌 Third-party Component Library Integration
|
|
219
|
+
|
|
220
|
+
### One-line Integration
|
|
221
|
+
|
|
222
|
+
We provide out-of-the-box theme integration files for popular component libraries:
|
|
223
|
+
|
|
224
|
+
#### Element Plus
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
// main.ts
|
|
228
|
+
import ElementPlus from 'element-plus'
|
|
229
|
+
import 'element-plus/dist/index.css'
|
|
230
|
+
import '@admin-core/design/css'
|
|
231
|
+
|
|
232
|
+
// One line integration!
|
|
233
|
+
import '@admin-core/design/css/integrations/element-plus.css'
|
|
234
|
+
|
|
235
|
+
app.use(ElementPlus)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Ant Design Vue
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import Antd from 'ant-design-vue'
|
|
242
|
+
import 'ant-design-vue/dist/reset.css'
|
|
243
|
+
import '@admin-core/design/css'
|
|
244
|
+
import '@admin-core/design/css/integrations/ant-design-vue.css'
|
|
245
|
+
|
|
246
|
+
app.use(Antd)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### Naive UI
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
import naive from 'naive-ui'
|
|
253
|
+
import '@admin-core/design/css'
|
|
254
|
+
import '@admin-core/design/css/integrations/naive-ui.css'
|
|
255
|
+
|
|
256
|
+
app.use(naive)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Arco Design
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import ArcoVue from '@arco-design/web-vue'
|
|
263
|
+
import '@arco-design/web-vue/dist/arco.css'
|
|
264
|
+
import '@admin-core/design/css'
|
|
265
|
+
import '@admin-core/design/css/integrations/arco-design.css'
|
|
266
|
+
|
|
267
|
+
app.use(ArcoVue)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Integration Benefits
|
|
271
|
+
|
|
272
|
+
✅ **Auto Theme Sync** - Switch themes, component colors update instantly
|
|
273
|
+
✅ **Dark Mode Support** - Toggle dark mode, components adapt automatically
|
|
274
|
+
✅ **Custom Themes** - Use custom themes, components sync automatically
|
|
275
|
+
✅ **Zero Config** - No additional configuration needed
|
|
276
|
+
✅ **High Performance** - Based on CSS variables, excellent performance
|
|
277
|
+
|
|
278
|
+
### Advanced Usage: Using ConfigProvider
|
|
279
|
+
|
|
280
|
+
```vue
|
|
281
|
+
<template>
|
|
282
|
+
<a-config-provider :theme="antdTheme">
|
|
283
|
+
<router-view />
|
|
284
|
+
</a-config-provider>
|
|
285
|
+
</template>
|
|
286
|
+
|
|
287
|
+
<script setup lang="ts">
|
|
288
|
+
import { computed } from 'vue'
|
|
289
|
+
import { theme } from 'ant-design-vue'
|
|
290
|
+
import { useTheme, getRGBColor } from '@admin-core/design'
|
|
291
|
+
|
|
292
|
+
const { isDark } = useTheme()
|
|
293
|
+
|
|
294
|
+
const antdTheme = computed(() => ({
|
|
295
|
+
algorithm: isDark.value ? theme.darkAlgorithm : theme.defaultAlgorithm,
|
|
296
|
+
token: {
|
|
297
|
+
colorPrimary: getRGBColor('primary'),
|
|
298
|
+
colorSuccess: getRGBColor('success'),
|
|
299
|
+
colorWarning: getRGBColor('warning'),
|
|
300
|
+
colorError: getRGBColor('destructive'),
|
|
301
|
+
},
|
|
302
|
+
}))
|
|
303
|
+
</script>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Integration Utility Functions
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
import {
|
|
310
|
+
getHSLColor, // Get HSL format color
|
|
311
|
+
getRGBColor, // Get RGB format color
|
|
312
|
+
getHexColor, // Get HEX format color
|
|
313
|
+
getThemeColors, // Get all colors in batch (HSL)
|
|
314
|
+
getThemeColorsRGB,// Get all colors in batch (RGB)
|
|
315
|
+
getThemeColorsHex,// Get all colors in batch (HEX)
|
|
316
|
+
} from '@admin-core/design'
|
|
317
|
+
|
|
318
|
+
// Get single color
|
|
319
|
+
const primaryHSL = getHSLColor('primary') // 'hsl(212, 100%, 48%)'
|
|
320
|
+
const primaryRGB = getRGBColor('primary') // 'rgb(0, 102, 245)'
|
|
321
|
+
const primaryHex = getHexColor('primary') // '#0066F5'
|
|
322
|
+
|
|
323
|
+
// Get all colors in batch
|
|
324
|
+
const allColors = getThemeColors()
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## 🌍 Internationalization
|
|
330
|
+
|
|
331
|
+
### Set Language
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { setLocale, getLocale } from '@admin-core/design'
|
|
335
|
+
|
|
336
|
+
// Set to English
|
|
337
|
+
setLocale('en-US')
|
|
338
|
+
|
|
339
|
+
// Set to Chinese
|
|
340
|
+
setLocale('zh-CN')
|
|
341
|
+
|
|
342
|
+
// Get current language
|
|
343
|
+
const currentLocale = getLocale() // 'zh-CN' | 'en-US'
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Get Internationalized Theme Information
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
import { getThemeName, getThemeDescription, getThemeMetadata } from '@admin-core/design'
|
|
350
|
+
|
|
351
|
+
// Get theme name (based on current language)
|
|
352
|
+
const name = getThemeName('deep-teal')
|
|
353
|
+
// Chinese: '深邃青'
|
|
354
|
+
// English: 'Deep Teal'
|
|
355
|
+
|
|
356
|
+
// Get theme description
|
|
357
|
+
const description = getThemeDescription('deep-teal')
|
|
358
|
+
// Chinese: '2026流行色 - 深邃的青色,沉稳大气'
|
|
359
|
+
// English: '2026 Trending Color - Deep teal, calm and atmospheric'
|
|
360
|
+
|
|
361
|
+
// Get all themes (auto internationalized)
|
|
362
|
+
const themes = getThemeMetadata()
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Using in Vue Components
|
|
366
|
+
|
|
367
|
+
```vue
|
|
368
|
+
<script setup lang="ts">
|
|
369
|
+
import { ref, computed } from 'vue'
|
|
370
|
+
import { setLocale, getLocale, getThemeMetadata, type Locale } from '@admin-core/design'
|
|
371
|
+
|
|
372
|
+
const currentLocale = ref<Locale>(getLocale())
|
|
373
|
+
const themes = ref(getThemeMetadata())
|
|
374
|
+
|
|
375
|
+
const changeLanguage = (locale: Locale) => {
|
|
376
|
+
setLocale(locale)
|
|
377
|
+
currentLocale.value = locale
|
|
378
|
+
themes.value = getThemeMetadata() // Re-fetch to update language
|
|
379
|
+
}
|
|
380
|
+
</script>
|
|
381
|
+
|
|
382
|
+
<template>
|
|
383
|
+
<div>
|
|
384
|
+
<select v-model="currentLocale" @change="changeLanguage(currentLocale)">
|
|
385
|
+
<option value="zh-CN">🇨🇳 中文</option>
|
|
386
|
+
<option value="en-US">🇺🇸 English</option>
|
|
387
|
+
</select>
|
|
388
|
+
|
|
389
|
+
<select>
|
|
390
|
+
<option v-for="theme in themes" :key="theme.id" :value="theme.id">
|
|
391
|
+
{{ theme.icon }} {{ theme.name }}
|
|
392
|
+
</option>
|
|
393
|
+
</select>
|
|
394
|
+
</div>
|
|
395
|
+
</template>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## 🎨 Design Tokens
|
|
401
|
+
|
|
402
|
+
All colors are defined using HSL format CSS variables, supporting opacity modifiers:
|
|
403
|
+
|
|
404
|
+
### Base Colors
|
|
405
|
+
|
|
406
|
+
```html
|
|
407
|
+
<!-- Background and foreground -->
|
|
408
|
+
<div class="bg-background text-foreground">Content</div>
|
|
409
|
+
|
|
410
|
+
<!-- Card -->
|
|
411
|
+
<div class="bg-card text-card-foreground">Card content</div>
|
|
412
|
+
|
|
413
|
+
<!-- Popover -->
|
|
414
|
+
<div class="bg-popover text-popover-foreground">Popover content</div>
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Semantic Colors
|
|
418
|
+
|
|
419
|
+
```html
|
|
420
|
+
<!-- Primary -->
|
|
421
|
+
<button class="bg-primary text-primary-foreground">Primary Button</button>
|
|
422
|
+
|
|
423
|
+
<!-- Secondary -->
|
|
424
|
+
<button class="bg-secondary text-secondary-foreground">Secondary Button</button>
|
|
425
|
+
|
|
426
|
+
<!-- Accent -->
|
|
427
|
+
<div class="bg-accent text-accent-foreground">Accent content</div>
|
|
428
|
+
|
|
429
|
+
<!-- Muted -->
|
|
430
|
+
<div class="bg-muted text-muted-foreground">Muted content</div>
|
|
431
|
+
|
|
432
|
+
<!-- Destructive -->
|
|
433
|
+
<button class="bg-destructive text-destructive-foreground">Delete</button>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Status Colors
|
|
437
|
+
|
|
438
|
+
```html
|
|
439
|
+
<!-- Success -->
|
|
440
|
+
<div class="bg-success text-success-foreground">Success message</div>
|
|
441
|
+
|
|
442
|
+
<!-- Warning -->
|
|
443
|
+
<div class="bg-warning text-warning-foreground">Warning message</div>
|
|
444
|
+
|
|
445
|
+
<!-- Info -->
|
|
446
|
+
<div class="bg-info text-info-foreground">Info message</div>
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Opacity Modifiers
|
|
450
|
+
|
|
451
|
+
```html
|
|
452
|
+
<div class="bg-primary/10">10% opacity</div>
|
|
453
|
+
<div class="bg-primary/50">50% opacity</div>
|
|
454
|
+
<div class="bg-primary/90">90% opacity</div>
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Using in CSS
|
|
458
|
+
|
|
459
|
+
```css
|
|
460
|
+
.my-component {
|
|
461
|
+
background-color: hsl(var(--primary));
|
|
462
|
+
color: hsl(var(--primary-foreground));
|
|
463
|
+
border: 1px solid hsl(var(--border));
|
|
464
|
+
border-radius: var(--radius);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/* Using opacity */
|
|
468
|
+
.my-overlay {
|
|
469
|
+
background-color: hsl(var(--primary) / 0.5);
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
## 🛠️ Utility Classes
|
|
476
|
+
|
|
477
|
+
### Layout Utilities
|
|
478
|
+
|
|
479
|
+
```html
|
|
480
|
+
<!-- Horizontal center -->
|
|
481
|
+
<div class="flex-center">
|
|
482
|
+
<div>Centered content</div>
|
|
483
|
+
</div>
|
|
484
|
+
|
|
485
|
+
<!-- Vertical center -->
|
|
486
|
+
<div class="flex-col-center">
|
|
487
|
+
<div>Vertically centered</div>
|
|
488
|
+
</div>
|
|
489
|
+
|
|
490
|
+
<!-- Card container -->
|
|
491
|
+
<div class="card-box p-6">
|
|
492
|
+
<h3>Card title</h3>
|
|
493
|
+
<p>Card content</p>
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
<!-- Outline box -->
|
|
497
|
+
<div class="outline-box">
|
|
498
|
+
Clickable box
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
<div class="outline-box outline-box-active">
|
|
502
|
+
Active state box
|
|
503
|
+
</div>
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### Link Styles
|
|
507
|
+
|
|
508
|
+
```html
|
|
509
|
+
<a href="#" class="admin-link">Link text</a>
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## 📱 Responsive Design
|
|
515
|
+
|
|
516
|
+
```html
|
|
517
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
518
|
+
<div class="card-box p-4">Card 1</div>
|
|
519
|
+
<div class="card-box p-4">Card 2</div>
|
|
520
|
+
<div class="card-box p-4">Card 3</div>
|
|
521
|
+
</div>
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## 🎭 Special Modes
|
|
527
|
+
|
|
528
|
+
### Invert Mode
|
|
529
|
+
|
|
530
|
+
```html
|
|
531
|
+
<html class="invert-mode">
|
|
532
|
+
<body>All colors inverted</body>
|
|
533
|
+
</html>
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Grayscale Mode
|
|
537
|
+
|
|
538
|
+
```html
|
|
539
|
+
<html class="grayscale-mode">
|
|
540
|
+
<body>All colors in grayscale</body>
|
|
541
|
+
</html>
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
## ⚙️ Tailwind CSS Configuration
|
|
547
|
+
|
|
548
|
+
If your project needs to extend Tailwind configuration:
|
|
549
|
+
|
|
550
|
+
```typescript
|
|
551
|
+
// tailwind.config.ts
|
|
552
|
+
import designConfig from '@admin-core/design/tailwind.config'
|
|
553
|
+
import type { Config } from 'tailwindcss'
|
|
554
|
+
|
|
555
|
+
export default {
|
|
556
|
+
...designConfig,
|
|
557
|
+
content: [
|
|
558
|
+
...designConfig.content,
|
|
559
|
+
'./src/**/*.{vue,js,ts,jsx,tsx}',
|
|
560
|
+
],
|
|
561
|
+
theme: {
|
|
562
|
+
...designConfig.theme,
|
|
563
|
+
extend: {
|
|
564
|
+
...designConfig.theme.extend,
|
|
565
|
+
// Your custom extensions
|
|
566
|
+
colors: {
|
|
567
|
+
brand: '#FF6B6B',
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
} satisfies Config
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## 📚 API Reference
|
|
577
|
+
|
|
578
|
+
### Theme Management
|
|
579
|
+
|
|
580
|
+
```typescript
|
|
581
|
+
// Composable
|
|
582
|
+
const {
|
|
583
|
+
mode, // Current mode
|
|
584
|
+
variant, // Current theme variant
|
|
585
|
+
isDark, // Is dark mode
|
|
586
|
+
setMode, // Set mode
|
|
587
|
+
setVariant, // Set theme variant
|
|
588
|
+
toggleDarkMode, // Toggle dark mode
|
|
589
|
+
getCurrentThemeMetadata, // Get current theme metadata
|
|
590
|
+
} = useTheme()
|
|
591
|
+
|
|
592
|
+
// Utility functions
|
|
593
|
+
initTheme() // Initialize theme
|
|
594
|
+
applyTheme(config, options) // Apply theme configuration
|
|
595
|
+
detectSystemTheme() // Detect system theme
|
|
596
|
+
watchSystemTheme(callback) // Watch system theme changes
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### Custom Themes
|
|
600
|
+
|
|
601
|
+
```typescript
|
|
602
|
+
// Smart color generation
|
|
603
|
+
applyThemeFromPrimary(color, mode?, persist?)
|
|
604
|
+
|
|
605
|
+
// Full customization
|
|
606
|
+
applyCustomTheme(colors, persist?)
|
|
607
|
+
|
|
608
|
+
// Clear custom theme
|
|
609
|
+
clearCustomTheme()
|
|
610
|
+
|
|
611
|
+
// Restore custom theme
|
|
612
|
+
restoreCustomTheme()
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
### Color Utilities
|
|
616
|
+
|
|
617
|
+
```typescript
|
|
618
|
+
// Get colors
|
|
619
|
+
getHSLColor(token) // Get HSL format
|
|
620
|
+
getRGBColor(token) // Get RGB format
|
|
621
|
+
getHexColor(token) // Get HEX format
|
|
622
|
+
|
|
623
|
+
// Batch get
|
|
624
|
+
getThemeColors() // All colors (HSL)
|
|
625
|
+
getThemeColorsRGB() // All colors (RGB)
|
|
626
|
+
getThemeColorsHex() // All colors (HEX)
|
|
627
|
+
|
|
628
|
+
// Color conversion
|
|
629
|
+
hexToHSL(hex) // HEX to HSL
|
|
630
|
+
rgbToHSL(r, g, b) // RGB to HSL
|
|
631
|
+
hslToRgb(hsl) // HSL to RGB
|
|
632
|
+
hslToHex(hsl) // HSL to HEX
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
### Internationalization
|
|
636
|
+
|
|
637
|
+
```typescript
|
|
638
|
+
setLocale(locale) // Set language
|
|
639
|
+
getLocale() // Get current language
|
|
640
|
+
getThemeName(themeId) // Get theme name
|
|
641
|
+
getThemeDescription(themeId) // Get theme description
|
|
642
|
+
getThemeMetadata() // Get all theme metadata
|
|
643
|
+
getTranslations() // Get current language translations
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
## 🌐 Browser Compatibility
|
|
649
|
+
|
|
650
|
+
- Chrome >= 90
|
|
651
|
+
- Firefox >= 88
|
|
652
|
+
- Safari >= 14
|
|
653
|
+
- Edge >= 90
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
657
|
+
## 📦 Exports
|
|
658
|
+
|
|
659
|
+
```typescript
|
|
660
|
+
// Main entry
|
|
661
|
+
import '@admin-core/design'
|
|
662
|
+
|
|
663
|
+
// CSS only
|
|
664
|
+
import '@admin-core/design/css'
|
|
665
|
+
|
|
666
|
+
// Import theme system
|
|
667
|
+
import { useTheme, setLocale } from '@admin-core/design'
|
|
668
|
+
|
|
669
|
+
// Import integration files
|
|
670
|
+
import '@admin-core/design/css/integrations/element-plus.css'
|
|
671
|
+
import '@admin-core/design/css/integrations/ant-design-vue.css'
|
|
672
|
+
import '@admin-core/design/css/integrations/naive-ui.css'
|
|
673
|
+
import '@admin-core/design/css/integrations/arco-design.css'
|
|
674
|
+
|
|
675
|
+
// Import Tailwind config
|
|
676
|
+
import designConfig from '@admin-core/design/tailwind.config'
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
## 🤝 Contributing
|
|
682
|
+
|
|
683
|
+
Contributions, issues, and feature requests are welcome!
|
|
684
|
+
|
|
685
|
+
---
|
|
686
|
+
|
|
687
|
+
## 📄 License
|
|
688
|
+
|
|
689
|
+
MIT License © 2024 [Admin Kit Team](https://github.com/jackBoVip/admin-kit)
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## 🔗 Links
|
|
694
|
+
|
|
695
|
+
- [GitHub Repository](https://github.com/jackBoVip/admin-kit)
|
|
696
|
+
- [Issue Tracker](https://github.com/jackBoVip/admin-kit/issues)
|
|
697
|
+
- [Changelog](./CHANGELOG.md)
|
|
698
|
+
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
|