@zhama/a2ui 0.10.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.
@@ -0,0 +1,326 @@
1
+ /**
2
+ * A2UI Tailwind CSS Preset
3
+ *
4
+ * 提供 A2UI 组件所需的完整 Tailwind 配置
5
+ *
6
+ * 使用方式:
7
+ * // tailwind.config.js
8
+ * import a2uiPreset from '@zhama/a2ui/tailwind.preset'
9
+ *
10
+ * export default {
11
+ * presets: [a2uiPreset],
12
+ * content: [
13
+ * './src/**\/*.{js,ts,jsx,tsx}',
14
+ * './node_modules/@zhama/a2ui/**\/*.{js,ts,jsx,tsx}',
15
+ * ],
16
+ * }
17
+ */
18
+
19
+ /** @type {import('tailwindcss').Config} */
20
+ module.exports = {
21
+ darkMode: ['class'],
22
+ theme: {
23
+ container: {
24
+ center: true,
25
+ padding: '2rem',
26
+ screens: {
27
+ '2xl': '1400px',
28
+ },
29
+ },
30
+ extend: {
31
+ // shadcn 颜色系统 - 基于 CSS 变量
32
+ colors: {
33
+ border: 'hsl(var(--border))',
34
+ input: 'hsl(var(--input))',
35
+ ring: 'hsl(var(--ring))',
36
+ background: 'hsl(var(--background))',
37
+ foreground: 'hsl(var(--foreground))',
38
+ primary: {
39
+ DEFAULT: 'hsl(var(--primary))',
40
+ foreground: 'hsl(var(--primary-foreground))',
41
+ },
42
+ secondary: {
43
+ DEFAULT: 'hsl(var(--secondary))',
44
+ foreground: 'hsl(var(--secondary-foreground))',
45
+ },
46
+ destructive: {
47
+ DEFAULT: 'hsl(var(--destructive))',
48
+ foreground: 'hsl(var(--destructive-foreground))',
49
+ },
50
+ muted: {
51
+ DEFAULT: 'hsl(var(--muted))',
52
+ foreground: 'hsl(var(--muted-foreground))',
53
+ },
54
+ accent: {
55
+ DEFAULT: 'hsl(var(--accent))',
56
+ foreground: 'hsl(var(--accent-foreground))',
57
+ },
58
+ popover: {
59
+ DEFAULT: 'hsl(var(--popover))',
60
+ foreground: 'hsl(var(--popover-foreground))',
61
+ },
62
+ card: {
63
+ DEFAULT: 'hsl(var(--card))',
64
+ foreground: 'hsl(var(--card-foreground))',
65
+ },
66
+ },
67
+ borderRadius: {
68
+ lg: 'var(--radius)',
69
+ md: 'calc(var(--radius) - 2px)',
70
+ sm: 'calc(var(--radius) - 4px)',
71
+ },
72
+ fontFamily: {
73
+ sans: [
74
+ 'var(--font-sans)',
75
+ 'Inter',
76
+ '-apple-system',
77
+ 'BlinkMacSystemFont',
78
+ 'Segoe UI',
79
+ 'Roboto',
80
+ 'sans-serif',
81
+ ],
82
+ mono: ['var(--font-mono)', 'Fira Code', 'Monaco', 'Consolas', 'monospace'],
83
+ },
84
+ keyframes: {
85
+ 'accordion-down': {
86
+ from: { height: '0' },
87
+ to: { height: 'var(--radix-accordion-content-height)' },
88
+ },
89
+ 'accordion-up': {
90
+ from: { height: 'var(--radix-accordion-content-height)' },
91
+ to: { height: '0' },
92
+ },
93
+ fadeIn: {
94
+ '0%': { opacity: '0' },
95
+ '100%': { opacity: '1' },
96
+ },
97
+ slideUp: {
98
+ '0%': { opacity: '0', transform: 'translateY(10px)' },
99
+ '100%': { opacity: '1', transform: 'translateY(0)' },
100
+ },
101
+ },
102
+ animation: {
103
+ 'accordion-down': 'accordion-down 0.2s ease-out',
104
+ 'accordion-up': 'accordion-up 0.2s ease-out',
105
+ 'fade-in': 'fadeIn 0.3s ease-out',
106
+ 'slide-up': 'slideUp 0.3s ease-out',
107
+ },
108
+ },
109
+ },
110
+
111
+ // 安全列表:强制生成 A2UI 主题中使用的所有样式类
112
+ safelist: [
113
+ // ============ 布局 ============
114
+ 'flex',
115
+ 'inline-flex',
116
+ 'grid',
117
+ 'block',
118
+ 'hidden',
119
+ 'items-center',
120
+ 'items-start',
121
+ 'items-end',
122
+ 'items-stretch',
123
+ 'justify-center',
124
+ 'justify-between',
125
+ 'justify-start',
126
+ 'justify-end',
127
+ 'justify-around',
128
+ 'justify-evenly',
129
+ 'flex-col',
130
+ 'flex-row',
131
+ 'flex-wrap',
132
+ 'space-y-1',
133
+ 'space-y-2',
134
+ 'space-y-3',
135
+ 'space-y-4',
136
+ 'space-x-1',
137
+ 'space-x-2',
138
+ 'space-x-3',
139
+ 'space-x-4',
140
+ 'gap-1',
141
+ 'gap-1.5',
142
+ 'gap-2',
143
+ 'gap-3',
144
+ 'gap-4',
145
+ 'gap-6',
146
+ 'w-full',
147
+ 'w-4',
148
+ 'w-5',
149
+ 'w-6',
150
+ 'w-10',
151
+ 'w-24',
152
+ 'w-48',
153
+ 'h-10',
154
+ 'h-4',
155
+ 'h-5',
156
+ 'h-6',
157
+ 'h-auto',
158
+ 'h-32',
159
+ 'max-w-full',
160
+ 'max-w-lg',
161
+ 'max-h-96',
162
+ 'relative',
163
+ 'absolute',
164
+ 'fixed',
165
+ 'inset-0',
166
+ 'group',
167
+
168
+ // ============ 响应式网格 ============
169
+ 'grid-cols-1',
170
+ 'md:grid-cols-2',
171
+ 'lg:grid-cols-3',
172
+
173
+ // ============ 边框 ============
174
+ 'border',
175
+ 'border-0',
176
+ 'border-2',
177
+ 'border-t',
178
+ 'border-b',
179
+ 'border-l-4',
180
+ 'border-border',
181
+ 'border-input',
182
+ 'border-primary',
183
+ 'rounded-sm',
184
+ 'rounded-md',
185
+ 'rounded-lg',
186
+ 'rounded-xl',
187
+ 'rounded-full',
188
+ 'rounded-t-md',
189
+
190
+ // ============ 背景颜色 ============
191
+ 'bg-card',
192
+ 'bg-background',
193
+ 'bg-primary',
194
+ 'bg-muted',
195
+ 'bg-secondary',
196
+ 'bg-accent',
197
+ 'bg-black/50',
198
+ 'bg-transparent',
199
+
200
+ // ============ 文字颜色 ============
201
+ 'text-card-foreground',
202
+ 'text-foreground',
203
+ 'text-primary-foreground',
204
+ 'text-muted-foreground',
205
+ 'text-primary',
206
+ 'text-secondary-foreground',
207
+ 'text-destructive-foreground',
208
+ 'text-accent-foreground',
209
+ 'text-primary-foreground/70',
210
+ 'text-white',
211
+
212
+ // ============ 文字大小和样式 ============
213
+ 'text-xs',
214
+ 'text-sm',
215
+ 'text-base',
216
+ 'text-lg',
217
+ 'text-xl',
218
+ 'text-2xl',
219
+ 'font-medium',
220
+ 'font-semibold',
221
+ 'font-bold',
222
+ 'font-mono',
223
+ 'tracking-tight',
224
+ 'leading-none',
225
+ 'leading-tight',
226
+ 'leading-snug',
227
+ 'leading-normal',
228
+ 'leading-relaxed',
229
+ 'whitespace-nowrap',
230
+ 'italic',
231
+
232
+ // ============ 间距 ============
233
+ 'p-1',
234
+ 'p-2',
235
+ 'p-3',
236
+ 'p-4',
237
+ 'p-5',
238
+ 'p-6',
239
+ 'p-8',
240
+ 'px-1',
241
+ 'px-1.5',
242
+ 'px-2',
243
+ 'px-3',
244
+ 'px-4',
245
+ 'px-5',
246
+ 'px-6',
247
+ 'py-0.5',
248
+ 'py-1',
249
+ 'py-2',
250
+ 'py-2.5',
251
+ 'py-3',
252
+ 'py-4',
253
+ 'mx-4',
254
+ 'my-4',
255
+ 'mb-2',
256
+ 'mb-3',
257
+ 'mb-4',
258
+ 'mt-2',
259
+ 'pl-4',
260
+ '-mb-px',
261
+
262
+ // ============ 阴影 ============
263
+ 'shadow-sm',
264
+ 'shadow-md',
265
+ 'shadow-lg',
266
+ 'shadow-xl',
267
+
268
+ // ============ 过渡和动画 ============
269
+ 'transition-all',
270
+ 'transition-colors',
271
+ 'transition-shadow',
272
+ 'transition-transform',
273
+ 'duration-150',
274
+ 'duration-200',
275
+ 'duration-300',
276
+ 'backdrop-blur-sm',
277
+
278
+ // ============ 悬停效果 ============
279
+ 'hover:bg-primary/90',
280
+ 'hover:bg-muted/80',
281
+ 'hover:bg-secondary/80',
282
+ 'hover:shadow-md',
283
+ 'hover:shadow-lg',
284
+ 'hover:shadow-xl',
285
+ 'hover:-translate-y-0.5',
286
+ 'hover:underline',
287
+ 'hover:border-primary',
288
+ 'hover:scale-105',
289
+
290
+ // ============ 焦点效果 ============
291
+ 'focus-visible:outline-none',
292
+ 'focus-visible:ring-2',
293
+ 'focus-visible:ring-ring',
294
+ 'focus-visible:ring-offset-2',
295
+ 'ring-offset-background',
296
+
297
+ // ============ 激活/禁用状态 ============
298
+ 'active:scale-95',
299
+ 'active:scale-[0.98]',
300
+ 'disabled:pointer-events-none',
301
+ 'disabled:opacity-50',
302
+ 'disabled:cursor-not-allowed',
303
+ 'cursor-pointer',
304
+ 'cursor-default',
305
+ 'cursor-wait',
306
+
307
+ // ============ 占位符 ============
308
+ 'placeholder:text-muted-foreground',
309
+
310
+ // ============ 列表和文本 ============
311
+ 'list-disc',
312
+ 'list-decimal',
313
+ 'list-inside',
314
+ 'overflow-x-auto',
315
+ 'overflow-hidden',
316
+ 'underline-offset-4',
317
+
318
+ // ============ 定位 ============
319
+ 'z-50',
320
+
321
+ // ============ 图片 ============
322
+ 'object-cover',
323
+ ],
324
+
325
+ plugins: [],
326
+ };