create-huenei-template 0.2.3 → 0.2.4
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/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/frontend/angular-base/package.json +0 -1
- package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/package.json +1 -1
- package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/templates/frontend/angular-base/package.json +0 -1
- package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/templates/frontend/angular-base/package-lock.json +0 -13321
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Advanced @theme Patterns
|
|
2
|
+
|
|
3
|
+
## Semantic Color Tokens
|
|
4
|
+
|
|
5
|
+
Create a layered token system for maintainable themes:
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
@theme {
|
|
9
|
+
/* Base palette (raw values) */
|
|
10
|
+
--color-blue-500: oklch(0.55 0.2 250);
|
|
11
|
+
--color-blue-600: oklch(0.48 0.2 250);
|
|
12
|
+
--color-slate-100: oklch(0.95 0.01 260);
|
|
13
|
+
--color-slate-900: oklch(0.15 0.01 260);
|
|
14
|
+
|
|
15
|
+
/* Semantic tokens (reference base palette) */
|
|
16
|
+
--color-primary: var(--color-blue-500);
|
|
17
|
+
--color-primary-hover: var(--color-blue-600);
|
|
18
|
+
--color-background: var(--color-slate-100);
|
|
19
|
+
--color-foreground: var(--color-slate-900);
|
|
20
|
+
|
|
21
|
+
/* Component tokens (reference semantic tokens) */
|
|
22
|
+
--color-button-primary-bg: var(--color-primary);
|
|
23
|
+
--color-button-primary-bg-hover: var(--color-primary-hover);
|
|
24
|
+
--color-card-bg: var(--color-background);
|
|
25
|
+
--color-card-text: var(--color-foreground);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Dynamic Theme Switching
|
|
30
|
+
|
|
31
|
+
```css
|
|
32
|
+
@theme {
|
|
33
|
+
/* Light mode defaults */
|
|
34
|
+
--color-surface: oklch(0.99 0 0);
|
|
35
|
+
--color-on-surface: oklch(0.15 0 0);
|
|
36
|
+
--color-border: oklch(0.9 0 0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
40
|
+
|
|
41
|
+
/* Override in dark mode using CSS variables */
|
|
42
|
+
.dark {
|
|
43
|
+
--color-surface: oklch(0.15 0.01 260);
|
|
44
|
+
--color-on-surface: oklch(0.95 0 0);
|
|
45
|
+
--color-border: oklch(0.25 0.01 260);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Responsive Theme Values
|
|
50
|
+
|
|
51
|
+
Use CSS custom properties with media queries for responsive themes:
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
@theme {
|
|
55
|
+
--spacing-container: 1rem;
|
|
56
|
+
--text-hero: 2rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (min-width: 768px) {
|
|
60
|
+
:root {
|
|
61
|
+
--spacing-container: 2rem;
|
|
62
|
+
--text-hero: 3rem;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media (min-width: 1024px) {
|
|
67
|
+
:root {
|
|
68
|
+
--spacing-container: 4rem;
|
|
69
|
+
--text-hero: 4rem;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Composite Tokens
|
|
75
|
+
|
|
76
|
+
Define complex values as theme tokens:
|
|
77
|
+
|
|
78
|
+
```css
|
|
79
|
+
@theme {
|
|
80
|
+
/* Shadows with consistent opacity */
|
|
81
|
+
--shadow-sm: 0 1px 2px oklch(0 0 0 / 0.05);
|
|
82
|
+
--shadow-md: 0 4px 6px oklch(0 0 0 / 0.07), 0 2px 4px oklch(0 0 0 / 0.05);
|
|
83
|
+
--shadow-lg: 0 10px 15px oklch(0 0 0 / 0.1), 0 4px 6px oklch(0 0 0 / 0.05);
|
|
84
|
+
--shadow-xl: 0 20px 25px oklch(0 0 0 / 0.1), 0 8px 10px oklch(0 0 0 / 0.04);
|
|
85
|
+
|
|
86
|
+
/* Elevation shadows that include color */
|
|
87
|
+
--shadow-elevation-1: 0 1px 3px oklch(0.25 0.02 260 / 0.12);
|
|
88
|
+
--shadow-elevation-2: 0 4px 6px oklch(0.25 0.02 260 / 0.15);
|
|
89
|
+
--shadow-elevation-3: 0 10px 20px oklch(0.25 0.02 260 / 0.2);
|
|
90
|
+
|
|
91
|
+
/* Gradients */
|
|
92
|
+
--gradient-primary: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
|
|
93
|
+
--gradient-surface: linear-gradient(180deg, var(--color-surface), var(--color-surface-alt));
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Typography Scale
|
|
98
|
+
|
|
99
|
+
Define a complete type scale with matching line heights:
|
|
100
|
+
|
|
101
|
+
```css
|
|
102
|
+
@theme {
|
|
103
|
+
/* Modular scale (1.25 ratio) */
|
|
104
|
+
--text-xs: 0.64rem; /* 10.24px */
|
|
105
|
+
--text-xs--line-height: 1rem;
|
|
106
|
+
|
|
107
|
+
--text-sm: 0.8rem; /* 12.8px */
|
|
108
|
+
--text-sm--line-height: 1.25rem;
|
|
109
|
+
|
|
110
|
+
--text-base: 1rem; /* 16px */
|
|
111
|
+
--text-base--line-height: 1.5rem;
|
|
112
|
+
|
|
113
|
+
--text-lg: 1.25rem; /* 20px */
|
|
114
|
+
--text-lg--line-height: 1.75rem;
|
|
115
|
+
|
|
116
|
+
--text-xl: 1.563rem; /* 25px */
|
|
117
|
+
--text-xl--line-height: 2rem;
|
|
118
|
+
|
|
119
|
+
--text-2xl: 1.953rem; /* 31.25px */
|
|
120
|
+
--text-2xl--line-height: 2.25rem;
|
|
121
|
+
|
|
122
|
+
--text-3xl: 2.441rem; /* 39px */
|
|
123
|
+
--text-3xl--line-height: 2.5rem;
|
|
124
|
+
|
|
125
|
+
--text-4xl: 3.052rem; /* 48.8px */
|
|
126
|
+
--text-4xl--line-height: 1;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Namespace Isolation
|
|
131
|
+
|
|
132
|
+
Use prefixes to avoid conflicts in multi-tenant systems:
|
|
133
|
+
|
|
134
|
+
```css
|
|
135
|
+
@import "tailwindcss" prefix(app);
|
|
136
|
+
|
|
137
|
+
@theme {
|
|
138
|
+
--color-brand: oklch(0.6 0.2 250);
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<!-- All utilities prefixed -->
|
|
144
|
+
<div class="app:flex app:bg-brand app:p-4">
|
|
145
|
+
Content
|
|
146
|
+
</div>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Theme Inheritance Patterns
|
|
150
|
+
|
|
151
|
+
Create theme variants that extend a base:
|
|
152
|
+
|
|
153
|
+
```css
|
|
154
|
+
/* Base theme */
|
|
155
|
+
@theme {
|
|
156
|
+
--color-primary-50: oklch(0.97 0.02 250);
|
|
157
|
+
--color-primary-500: oklch(0.55 0.2 250);
|
|
158
|
+
--color-primary-900: oklch(0.2 0.1 250);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Brand variant - override in a separate file */
|
|
162
|
+
/* brand-theme.css */
|
|
163
|
+
@layer theme {
|
|
164
|
+
:root[data-brand="acme"] {
|
|
165
|
+
--color-primary-50: oklch(0.97 0.03 150);
|
|
166
|
+
--color-primary-500: oklch(0.55 0.2 150);
|
|
167
|
+
--color-primary-900: oklch(0.2 0.12 150);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
:root[data-brand="beta"] {
|
|
171
|
+
--color-primary-50: oklch(0.97 0.02 30);
|
|
172
|
+
--color-primary-500: oklch(0.6 0.18 30);
|
|
173
|
+
--color-primary-900: oklch(0.25 0.1 30);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Motion & Animation Tokens
|
|
179
|
+
|
|
180
|
+
```css
|
|
181
|
+
@theme {
|
|
182
|
+
/* Durations */
|
|
183
|
+
--duration-instant: 50ms;
|
|
184
|
+
--duration-fast: 150ms;
|
|
185
|
+
--duration-normal: 300ms;
|
|
186
|
+
--duration-slow: 500ms;
|
|
187
|
+
|
|
188
|
+
/* Easings */
|
|
189
|
+
--ease-default: cubic-bezier(0.4, 0, 0.2, 1);
|
|
190
|
+
--ease-in: cubic-bezier(0.4, 0, 1, 1);
|
|
191
|
+
--ease-out: cubic-bezier(0, 0, 0.2, 1);
|
|
192
|
+
--ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
|
193
|
+
--ease-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
|
|
194
|
+
|
|
195
|
+
/* Animations */
|
|
196
|
+
--animate-fade-in: fade-in var(--duration-normal) var(--ease-out);
|
|
197
|
+
--animate-slide-up: slide-up var(--duration-normal) var(--ease-out);
|
|
198
|
+
--animate-scale: scale var(--duration-fast) var(--ease-bounce);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@keyframes fade-in {
|
|
202
|
+
from { opacity: 0; }
|
|
203
|
+
to { opacity: 1; }
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@keyframes slide-up {
|
|
207
|
+
from { transform: translateY(10px); opacity: 0; }
|
|
208
|
+
to { transform: translateY(0); opacity: 1; }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@keyframes scale {
|
|
212
|
+
from { transform: scale(0.95); }
|
|
213
|
+
to { transform: scale(1); }
|
|
214
|
+
}
|
|
215
|
+
```
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Custom Utilities Deep Dive
|
|
2
|
+
|
|
3
|
+
## Static Utilities
|
|
4
|
+
|
|
5
|
+
### Basic Definition
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
@utility scrollbar-hide {
|
|
9
|
+
-ms-overflow-style: none;
|
|
10
|
+
scrollbar-width: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@utility scrollbar-hide::-webkit-scrollbar {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Multi-Property Utilities
|
|
19
|
+
|
|
20
|
+
```css
|
|
21
|
+
@utility skeleton {
|
|
22
|
+
background: linear-gradient(
|
|
23
|
+
90deg,
|
|
24
|
+
var(--color-gray-200) 25%,
|
|
25
|
+
var(--color-gray-300) 50%,
|
|
26
|
+
var(--color-gray-200) 75%
|
|
27
|
+
);
|
|
28
|
+
background-size: 200% 100%;
|
|
29
|
+
animation: skeleton-shimmer 1.5s infinite;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@keyframes skeleton-shimmer {
|
|
33
|
+
0% { background-position: 200% 0; }
|
|
34
|
+
100% { background-position: -200% 0; }
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### State-Aware Utilities
|
|
39
|
+
|
|
40
|
+
```css
|
|
41
|
+
@utility glass {
|
|
42
|
+
background: oklch(1 0 0 / 0.1);
|
|
43
|
+
backdrop-filter: blur(12px);
|
|
44
|
+
border: 1px solid oklch(1 0 0 / 0.2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Dark mode variant applied automatically */
|
|
48
|
+
.dark .glass {
|
|
49
|
+
background: oklch(0 0 0 / 0.2);
|
|
50
|
+
border-color: oklch(1 0 0 / 0.1);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Functional Utilities
|
|
55
|
+
|
|
56
|
+
### With Integer Values
|
|
57
|
+
|
|
58
|
+
```css
|
|
59
|
+
@utility tab-* {
|
|
60
|
+
tab-size: --value(integer);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@utility columns-* {
|
|
64
|
+
columns: --value(integer);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@utility z-* {
|
|
68
|
+
z-index: --value(integer);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Usage:
|
|
73
|
+
```html
|
|
74
|
+
<pre class="tab-4">Code</pre>
|
|
75
|
+
<div class="columns-3">Multi-column text</div>
|
|
76
|
+
<div class="z-50">High z-index</div>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### With Length Values
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
@utility inset-* {
|
|
83
|
+
inset: --value([length]);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@utility blur-* {
|
|
87
|
+
filter: blur(--value([length]));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@utility tracking-* {
|
|
91
|
+
letter-spacing: --value([length]);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Usage:
|
|
96
|
+
```html
|
|
97
|
+
<div class="inset-[10px]">Absolute positioning</div>
|
|
98
|
+
<div class="blur-[4px]">Blurred element</div>
|
|
99
|
+
<span class="tracking-[0.05em]">Tracked text</span>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### With Theme References
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
@utility gap-safe-* {
|
|
106
|
+
gap: max(--value(--spacing-*), env(safe-area-inset-bottom));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@utility text-color-* {
|
|
110
|
+
color: --value(--color-*);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@utility bg-gradient-* {
|
|
114
|
+
background: linear-gradient(to right, --value(--color-*), transparent);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Usage:
|
|
119
|
+
```html
|
|
120
|
+
<div class="gap-safe-4">Safe-area aware gap</div>
|
|
121
|
+
<p class="text-color-primary-500">Themed text</p>
|
|
122
|
+
<div class="bg-gradient-blue-500">Gradient fade</div>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### With Multiple Value Types
|
|
126
|
+
|
|
127
|
+
```css
|
|
128
|
+
@utility shadow-text-* {
|
|
129
|
+
text-shadow: 0 0 --value([length]) --value(--color-*, currentColor);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Alternative: Parse specific formats */
|
|
133
|
+
@utility clamp-* {
|
|
134
|
+
font-size: clamp(--value([length]), --value([percentage]), --value([length]));
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Responsive & Variant-Aware Utilities
|
|
139
|
+
|
|
140
|
+
Custom utilities automatically work with all variants:
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<!-- Responsive -->
|
|
144
|
+
<div class="scrollbar-hide md:scrollbar-visible">
|
|
145
|
+
|
|
146
|
+
<!-- State variants -->
|
|
147
|
+
<div class="hover:glass focus:glass">
|
|
148
|
+
|
|
149
|
+
<!-- Dark mode -->
|
|
150
|
+
<div class="glass dark:glass-dark">
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Complex Utility Patterns
|
|
154
|
+
|
|
155
|
+
### Container Query Utilities
|
|
156
|
+
|
|
157
|
+
```css
|
|
158
|
+
@utility @container-* {
|
|
159
|
+
container-type: --value(size, inline-size, normal);
|
|
160
|
+
container-name: --value(identifier, none);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Aspect Ratio Utilities
|
|
165
|
+
|
|
166
|
+
```css
|
|
167
|
+
@utility aspect-* {
|
|
168
|
+
aspect-ratio: --value(ratio);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Named aspects */
|
|
172
|
+
@utility aspect-video {
|
|
173
|
+
aspect-ratio: 16 / 9;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@utility aspect-square {
|
|
177
|
+
aspect-ratio: 1 / 1;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@utility aspect-portrait {
|
|
181
|
+
aspect-ratio: 3 / 4;
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Line Clamp Utilities
|
|
186
|
+
|
|
187
|
+
```css
|
|
188
|
+
@utility line-clamp-* {
|
|
189
|
+
display: -webkit-box;
|
|
190
|
+
-webkit-line-clamp: --value(integer);
|
|
191
|
+
-webkit-box-orient: vertical;
|
|
192
|
+
overflow: hidden;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@utility line-clamp-none {
|
|
196
|
+
display: block;
|
|
197
|
+
-webkit-line-clamp: unset;
|
|
198
|
+
-webkit-box-orient: unset;
|
|
199
|
+
overflow: visible;
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Scroll Snap Utilities
|
|
204
|
+
|
|
205
|
+
```css
|
|
206
|
+
@utility snap-x {
|
|
207
|
+
scroll-snap-type: x mandatory;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@utility snap-y {
|
|
211
|
+
scroll-snap-type: y mandatory;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@utility snap-start {
|
|
215
|
+
scroll-snap-align: start;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@utility snap-center {
|
|
219
|
+
scroll-snap-align: center;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@utility snap-proximity {
|
|
223
|
+
scroll-snap-type: both proximity;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Performance Considerations
|
|
228
|
+
|
|
229
|
+
### Avoid Overly Complex Utilities
|
|
230
|
+
|
|
231
|
+
```css
|
|
232
|
+
/* BAD - Too many properties */
|
|
233
|
+
@utility card {
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-direction: column;
|
|
236
|
+
padding: 1rem;
|
|
237
|
+
background: white;
|
|
238
|
+
border-radius: 0.5rem;
|
|
239
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* GOOD - Use component or @apply in CSS */
|
|
243
|
+
@layer components {
|
|
244
|
+
.card {
|
|
245
|
+
@apply flex flex-col p-4 bg-white rounded-lg shadow-sm;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Keep Functional Utilities Focused
|
|
251
|
+
|
|
252
|
+
```css
|
|
253
|
+
/* GOOD - Single purpose */
|
|
254
|
+
@utility opacity-* {
|
|
255
|
+
opacity: --value(percentage);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* AVOID - Multiple unrelated properties */
|
|
259
|
+
@utility fancy-* {
|
|
260
|
+
opacity: --value(percentage);
|
|
261
|
+
transform: scale(1.1);
|
|
262
|
+
filter: saturate(1.2);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Debugging Custom Utilities
|
|
267
|
+
|
|
268
|
+
Check if utility is generated:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Search compiled CSS
|
|
272
|
+
grep "scrollbar-hide" dist/output.css
|
|
273
|
+
|
|
274
|
+
# Use browser DevTools
|
|
275
|
+
# Elements > Styles > Search for class name
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
If not working:
|
|
279
|
+
1. Verify `@utility` syntax is correct
|
|
280
|
+
2. Check CSS file is imported after `@import "tailwindcss"`
|
|
281
|
+
3. Ensure class name is used in template (content detection)
|