@caddis/cli 0.0.0 → 0.1.0
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 +150 -1
- package/bundles/antigravity-plugin/agents/code-reviewer.md +47 -0
- package/bundles/antigravity-plugin/agents/preflight.md +53 -0
- package/bundles/antigravity-plugin/guard_agy.py +338 -0
- package/bundles/antigravity-plugin/hooks.json +36 -0
- package/bundles/antigravity-plugin/mcp_config.json +8 -0
- package/bundles/antigravity-plugin/mcp_ping_server.py +55 -0
- package/bundles/antigravity-plugin/plugin.json +5 -0
- package/bundles/antigravity-plugin/session_end_agy.py +57 -0
- package/bundles/antigravity-plugin/skills/_registry.md +115 -0
- package/bundles/antigravity-plugin/skills/add-rules/SKILL.md +45 -0
- package/bundles/antigravity-plugin/skills/api-design/SKILL.md +249 -0
- package/bundles/antigravity-plugin/skills/backend-development/SKILL.md +305 -0
- package/bundles/antigravity-plugin/skills/best-practices/SKILL.md +500 -0
- package/bundles/antigravity-plugin/skills/best-practices/agents/best-practices-referencer.md +263 -0
- package/bundles/antigravity-plugin/skills/best-practices/agents/codebase-context-builder.md +326 -0
- package/bundles/antigravity-plugin/skills/best-practices/agents/task-intent-analyzer.md +245 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/anti-patterns.md +571 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/before-after-examples.md +1114 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/best-practices-guide.md +513 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/common-workflows.md +692 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/prompt-patterns.md +547 -0
- package/bundles/antigravity-plugin/skills/brainstorming/SKILL.md +57 -0
- package/bundles/antigravity-plugin/skills/ci-cd-pipeline/SKILL.md +315 -0
- package/bundles/antigravity-plugin/skills/code-documentation/SKILL.md +271 -0
- package/bundles/antigravity-plugin/skills/code-review/SKILL.md +122 -0
- package/bundles/antigravity-plugin/skills/codebase-audit/SKILL.md +204 -0
- package/bundles/antigravity-plugin/skills/context-curator/SKILL.md +157 -0
- package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +40 -0
- package/bundles/antigravity-plugin/skills/css-architecture/SKILL.md +305 -0
- package/bundles/antigravity-plugin/skills/css-architecture/references/RESPONSIVE-DESIGN.md +604 -0
- package/bundles/antigravity-plugin/skills/database-design/SKILL.md +177 -0
- package/bundles/antigravity-plugin/skills/db-diagram/SKILL.md +148 -0
- package/bundles/antigravity-plugin/skills/db-diagram/scripts/sql_to_graph.py +1212 -0
- package/bundles/antigravity-plugin/skills/digress/SKILL.md +61 -0
- package/bundles/antigravity-plugin/skills/draw-io/SKILL.md +162 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/aws-icons.md +677 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/layout-guidelines.md +142 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/troubleshooting.md +118 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/workflows.md +103 -0
- package/bundles/antigravity-plugin/skills/draw-io/scripts/convert-drawio-to-png.sh +25 -0
- package/bundles/antigravity-plugin/skills/draw-io/scripts/find_aws_icon.py +79 -0
- package/bundles/antigravity-plugin/skills/error-handling/SKILL.md +260 -0
- package/bundles/antigravity-plugin/skills/excalidraw-db/SKILL.md +38 -0
- package/bundles/antigravity-plugin/skills/fastapi-dev/SKILL.md +300 -0
- package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +198 -0
- package/bundles/antigravity-plugin/skills/frontend-design/SKILL.md +193 -0
- package/bundles/antigravity-plugin/skills/frontend-design/references/my-tech-stack.md +127 -0
- package/bundles/antigravity-plugin/skills/gh-cli/SKILL.md +195 -0
- package/bundles/antigravity-plugin/skills/git-commit/SKILL.md +285 -0
- package/bundles/antigravity-plugin/skills/golden-plan/SKILL.md +577 -0
- package/bundles/antigravity-plugin/skills/handoff/SKILL.md +100 -0
- package/bundles/antigravity-plugin/skills/implement/SKILL.md +114 -0
- package/bundles/antigravity-plugin/skills/javascript-typescript/SKILL.md +142 -0
- package/bundles/antigravity-plugin/skills/kb/SKILL.md +60 -0
- package/bundles/antigravity-plugin/skills/mermaid-db/SKILL.md +33 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/SKILL.md +236 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/ENHANCEMENTS.md +264 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/MERMAID-SUMMARY.md +137 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/advanced-features.md +556 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/architecture-diagrams.md +192 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/c4-diagrams.md +410 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/class-diagrams.md +361 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/erd-diagrams.md +510 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/flowcharts.md +450 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/sequence-diagrams.md +394 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/troubleshooting.md +335 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/workflows.md +418 -0
- package/bundles/antigravity-plugin/skills/migrate-dir/SKILL.md +68 -0
- package/bundles/antigravity-plugin/skills/mockup/SKILL.md +242 -0
- package/bundles/antigravity-plugin/skills/particle-art/SKILL.md +243 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/canvas-utils.ts +171 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/dot-field.template.tsx +203 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/flow-field.template.tsx +263 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/node-shape.template.tsx +261 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/shape-sampler.ts +281 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/stipple-morph.template.tsx +167 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/stipple.template.tsx +175 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/trail-ghost.template.tsx +266 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/usage-examples.md +320 -0
- package/bundles/antigravity-plugin/skills/playwright/API_REFERENCE.md +653 -0
- package/bundles/antigravity-plugin/skills/playwright/SKILL.md +454 -0
- package/bundles/antigravity-plugin/skills/playwright/lib/helpers.js +441 -0
- package/bundles/antigravity-plugin/skills/playwright/package.json +26 -0
- package/bundles/antigravity-plugin/skills/playwright/run.js +228 -0
- package/bundles/antigravity-plugin/skills/prd/SKILL.md +107 -0
- package/bundles/antigravity-plugin/skills/preflight/SKILL.md +435 -0
- package/bundles/antigravity-plugin/skills/python/SKILL.md +388 -0
- package/bundles/antigravity-plugin/skills/react-best-practices/SKILL.md +269 -0
- package/bundles/antigravity-plugin/skills/react-dev/README.md +404 -0
- package/bundles/antigravity-plugin/skills/react-dev/SKILL.md +459 -0
- package/bundles/antigravity-plugin/skills/react-dev/examples/generic-components.md +579 -0
- package/bundles/antigravity-plugin/skills/react-dev/examples/server-components.md +579 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/event-handlers.md +574 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/hooks.md +456 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/react-19-patterns.md +638 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/react-router.md +1002 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/tanstack-router.md +587 -0
- package/bundles/antigravity-plugin/skills/refactoring/SKILL.md +486 -0
- package/bundles/antigravity-plugin/skills/resume/SKILL.md +36 -0
- package/bundles/antigravity-plugin/skills/security-review/SKILL.md +196 -0
- package/bundles/antigravity-plugin/skills/setup-project-ai/SKILL.md +61 -0
- package/bundles/antigravity-plugin/skills/ship/SKILL.md +107 -0
- package/bundles/antigravity-plugin/skills/ship-merge/SKILL.md +103 -0
- package/bundles/antigravity-plugin/skills/ship-pr/SKILL.md +102 -0
- package/bundles/antigravity-plugin/skills/skill-creator/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin/skills/skill-creator/SKILL.md +491 -0
- package/bundles/antigravity-plugin/skills/skill-creator/agents/analyzer.md +274 -0
- package/bundles/antigravity-plugin/skills/skill-creator/agents/comparator.md +202 -0
- package/bundles/antigravity-plugin/skills/skill-creator/agents/grader.md +223 -0
- package/bundles/antigravity-plugin/skills/skill-creator/assets/eval_review.html +146 -0
- package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/bundles/antigravity-plugin/skills/skill-creator/references/schemas.md +430 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/__init__.py +0 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/generate_report.py +326 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/improve_description.py +247 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/package_skill.py +136 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_eval.py +310 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_loop.py +328 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/utils.py +47 -0
- package/bundles/antigravity-plugin/skills/sql/SKILL.md +321 -0
- package/bundles/antigravity-plugin/skills/tdd/SKILL.md +37 -0
- package/bundles/antigravity-plugin/skills/tdd-workflow/SKILL.md +188 -0
- package/bundles/antigravity-plugin/skills/technical-writing/SKILL.md +286 -0
- package/bundles/antigravity-plugin/skills/test-strategy/SKILL.md +155 -0
- package/bundles/antigravity-plugin/skills/ui-brief/SKILL.md +84 -0
- package/bundles/antigravity-plugin/skills/ui-review/SKILL.md +176 -0
- package/bundles/antigravity-plugin/skills/ui-review/references/framework-fixes.md +471 -0
- package/bundles/antigravity-plugin/skills/ui-review/references/visual-checklist.md +236 -0
- package/bundles/antigravity-plugin/skills/usage-review/SKILL.md +77 -0
- package/bundles/antigravity-plugin/skills/use-model/SKILL.md +64 -0
- package/bundles/antigravity-plugin/skills/using-git-worktrees/SKILL.md +217 -0
- package/bundles/antigravity-plugin/skills/version/SKILL.md +18 -0
- package/bundles/antigravity-plugin/skills/warm-editorial-ui/DESIGN_TOKENS.md +487 -0
- package/bundles/antigravity-plugin/skills/warm-editorial-ui/IMPLEMENTATION_GUIDE.md +177 -0
- package/bundles/antigravity-plugin/skills/warm-editorial-ui/SKILL.md +732 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/SKILL.md +97 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/examples/console_logging.py +35 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/scripts/with_server.py +106 -0
- package/bundles/antigravity-plugin/skills/windows-deployment/SKILL.md +880 -0
- package/bundles/antigravity-plugin/skills/writing-plans/SKILL.md +384 -0
- package/bundles/antigravity-plugin/statusline-command-agy.sh +91 -0
- package/bundles/antigravity-plugin/warm_start_agy.py +149 -0
- package/bundles/manifest.json +6 -0
- package/dist/cli.js +5363 -0
- package/package.json +61 -4
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: css-architecture
|
|
3
|
+
description: CSS architecture, design token strategy, Tailwind conventions, CSS Modules, container queries, dark mode, responsive patterns, and animation architecture. Use for design token naming, CSS custom properties, Tailwind config, container queries, dark mode implementation, fluid typography, or CSS animation decisions. Complements frontend-design (what to achieve) with how to implement it.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CSS Architecture Skill
|
|
7
|
+
|
|
8
|
+
How to implement what `frontend-design` specifies. Covers design token strategy, Tailwind conventions, responsive patterns, dark mode, and animation architecture.
|
|
9
|
+
|
|
10
|
+
## 1. Design Token Strategy — CSS Custom Properties
|
|
11
|
+
|
|
12
|
+
### Hierarchy (global → component)
|
|
13
|
+
```css
|
|
14
|
+
/* Layer 1: Primitive tokens (raw values) */
|
|
15
|
+
:root {
|
|
16
|
+
--color-slate-900: #0f172a;
|
|
17
|
+
--color-slate-100: #f1f5f9;
|
|
18
|
+
--color-amber-500: #f59e0b;
|
|
19
|
+
--space-4: 1rem;
|
|
20
|
+
--space-8: 2rem;
|
|
21
|
+
--radius-md: 0.5rem;
|
|
22
|
+
--font-sans: 'Inter Variable', system-ui, sans-serif;
|
|
23
|
+
|
|
24
|
+
/* Layer 2: Semantic tokens (intent) */
|
|
25
|
+
--color-bg: var(--color-slate-900);
|
|
26
|
+
--color-surface: hsl(220 15% 12%);
|
|
27
|
+
--color-text: var(--color-slate-100);
|
|
28
|
+
--color-accent: var(--color-amber-500);
|
|
29
|
+
--color-border: hsl(220 15% 20%);
|
|
30
|
+
|
|
31
|
+
/* Layer 3: Component tokens */
|
|
32
|
+
--button-bg: var(--color-accent);
|
|
33
|
+
--button-text: var(--color-slate-900);
|
|
34
|
+
--card-padding: var(--space-8);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Naming Conventions
|
|
39
|
+
- Primitive: `--color-{hue}-{shade}`, `--space-{n}`, `--radius-{size}`
|
|
40
|
+
- Semantic: `--color-{role}` (bg, surface, text, accent, border, error, success)
|
|
41
|
+
- Component: `--{component}-{property}` (button-bg, card-radius)
|
|
42
|
+
- Never skip semantic layer — primitives must not be used directly in components.
|
|
43
|
+
|
|
44
|
+
## 2. Tailwind Conventions
|
|
45
|
+
|
|
46
|
+
### v3 Config (`tailwind.config.ts`)
|
|
47
|
+
```ts
|
|
48
|
+
import type { Config } from 'tailwindcss'
|
|
49
|
+
import { fontFamily } from 'tailwindcss/defaultTheme'
|
|
50
|
+
|
|
51
|
+
const config: Config = {
|
|
52
|
+
content: ['./src/**/*.{ts,tsx,mdx}'],
|
|
53
|
+
darkMode: 'class', // or 'media'
|
|
54
|
+
theme: {
|
|
55
|
+
extend: {
|
|
56
|
+
colors: {
|
|
57
|
+
// Map to CSS custom properties so tokens work everywhere
|
|
58
|
+
bg: 'hsl(var(--color-bg) / <alpha-value>)',
|
|
59
|
+
surface: 'hsl(var(--color-surface) / <alpha-value>)',
|
|
60
|
+
accent: 'hsl(var(--color-accent) / <alpha-value>)',
|
|
61
|
+
border: 'hsl(var(--color-border) / <alpha-value>)',
|
|
62
|
+
},
|
|
63
|
+
fontFamily: {
|
|
64
|
+
sans: ['var(--font-sans)', ...fontFamily.sans],
|
|
65
|
+
display: ['var(--font-display)', ...fontFamily.serif],
|
|
66
|
+
},
|
|
67
|
+
borderRadius: { DEFAULT: 'var(--radius-md)' },
|
|
68
|
+
animation: {
|
|
69
|
+
'fade-up': 'fadeUp 0.4s ease-out',
|
|
70
|
+
'fade-in': 'fadeIn 0.3s ease-out',
|
|
71
|
+
},
|
|
72
|
+
keyframes: {
|
|
73
|
+
fadeUp: { from: { opacity: '0', transform: 'translateY(12px)' }, to: { opacity: '1', transform: 'none' } },
|
|
74
|
+
fadeIn: { from: { opacity: '0' }, to: { opacity: '1' } },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
plugins: [
|
|
79
|
+
require('@tailwindcss/typography'),
|
|
80
|
+
require('@tailwindcss/container-queries'),
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
export default config
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### v4 Config (CSS-first)
|
|
87
|
+
```css
|
|
88
|
+
/* globals.css — Tailwind v4 uses @theme, no tailwind.config.ts */
|
|
89
|
+
@import "tailwindcss";
|
|
90
|
+
|
|
91
|
+
@theme {
|
|
92
|
+
--color-accent: oklch(75% 0.18 85);
|
|
93
|
+
--font-sans: 'Inter Variable', system-ui, sans-serif;
|
|
94
|
+
--radius-default: 0.5rem;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `@apply` Rules
|
|
99
|
+
- Use `@apply` sparingly — only for repeated utility combos in shared components (`btn`, `card`).
|
|
100
|
+
- Prefer component classes over `@apply` in large components — Tailwind utility classes in JSX are more readable.
|
|
101
|
+
- Never `@apply` responsive or state variants (`hover:`, `md:`) — those are JSX-only.
|
|
102
|
+
|
|
103
|
+
## 3. CSS Modules vs Tailwind — Decision Criteria
|
|
104
|
+
|
|
105
|
+
| Use Tailwind | Use CSS Modules |
|
|
106
|
+
|---|---|
|
|
107
|
+
| UI components, layouts, spacing | Complex animations with `@keyframes` that need JS access |
|
|
108
|
+
| Responsive design | Component styles that conflict with Tailwind's reset |
|
|
109
|
+
| Dark mode | Styles requiring CSS `calc()` with token math |
|
|
110
|
+
| One-off utility combos | Legacy codebases with existing `.module.css` patterns |
|
|
111
|
+
| New projects | Server-rendered styles that must avoid className hydration |
|
|
112
|
+
|
|
113
|
+
**Hybrid**: Tailwind for layout/spacing/color, CSS Modules for complex animation or context-dependent logic.
|
|
114
|
+
|
|
115
|
+
## 4. Container Queries
|
|
116
|
+
|
|
117
|
+
Responsive based on parent container width, not viewport.
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
// tailwind.config.ts: add @tailwindcss/container-queries plugin
|
|
121
|
+
// Install: pnpm add -D @tailwindcss/container-queries
|
|
122
|
+
|
|
123
|
+
export function Card({ children }: { children: React.ReactNode }) {
|
|
124
|
+
return (
|
|
125
|
+
// Mark the container
|
|
126
|
+
<div className="@container rounded-lg bg-surface p-6">
|
|
127
|
+
<div className="grid @sm:grid-cols-2 @lg:grid-cols-3 gap-4">
|
|
128
|
+
{children}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```css
|
|
136
|
+
/* Pure CSS container queries */
|
|
137
|
+
.card { container-type: inline-size; }
|
|
138
|
+
|
|
139
|
+
@container (min-width: 400px) {
|
|
140
|
+
.card-body { display: grid; grid-template-columns: 1fr 1fr; }
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Use container queries when**: a component is used in multiple layout contexts (sidebar vs main vs modal) and needs different layouts in each.
|
|
145
|
+
|
|
146
|
+
## 5. Dark Mode
|
|
147
|
+
|
|
148
|
+
### Class Toggle (recommended for app control)
|
|
149
|
+
```tsx
|
|
150
|
+
// Toggle on <html> element
|
|
151
|
+
document.documentElement.classList.toggle('dark')
|
|
152
|
+
|
|
153
|
+
// Tailwind: darkMode: 'class' in config
|
|
154
|
+
// CSS: dark: prefix on utilities
|
|
155
|
+
<div className="bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-100">
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### CSS Custom Property Token Switching
|
|
159
|
+
```css
|
|
160
|
+
:root {
|
|
161
|
+
--color-bg: hsl(0 0% 100%);
|
|
162
|
+
--color-text: hsl(220 15% 10%);
|
|
163
|
+
--color-accent: hsl(220 90% 55%);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.dark {
|
|
167
|
+
--color-bg: hsl(220 15% 8%);
|
|
168
|
+
--color-text: hsl(220 10% 90%);
|
|
169
|
+
--color-accent: hsl(220 90% 65%);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* With prefers-color-scheme fallback */
|
|
173
|
+
@media (prefers-color-scheme: dark) {
|
|
174
|
+
:root:not(.light) {
|
|
175
|
+
--color-bg: hsl(220 15% 8%);
|
|
176
|
+
--color-text: hsl(220 10% 90%);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 6. Responsive Patterns — Mobile-First
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
// Mobile-first: base = mobile, md: = tablet, lg+ = desktop
|
|
185
|
+
<div className="
|
|
186
|
+
flex flex-col gap-4 /* mobile */
|
|
187
|
+
md:flex-row md:gap-6 /* tablet */
|
|
188
|
+
lg:gap-8 /* desktop */
|
|
189
|
+
">
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Fluid Typography with `clamp()`
|
|
193
|
+
```css
|
|
194
|
+
/* Min, preferred (viewport-relative), max */
|
|
195
|
+
.hero-heading {
|
|
196
|
+
font-size: clamp(2rem, 5vw + 1rem, 5rem);
|
|
197
|
+
line-height: clamp(1.1, 1.2, 1.3);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* In Tailwind (custom utility) */
|
|
201
|
+
/* tailwind.config.ts > theme.extend.fontSize */
|
|
202
|
+
'fluid-xl': 'clamp(1.5rem, 3vw + 0.5rem, 2.5rem)',
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Breakpoint Tokens
|
|
206
|
+
```ts
|
|
207
|
+
// Consistent with Tailwind defaults
|
|
208
|
+
const breakpoints = { sm: '640px', md: '768px', lg: '1024px', xl: '1280px', '2xl': '1536px' }
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## 7. Animation Architecture
|
|
212
|
+
|
|
213
|
+
### Decision Matrix
|
|
214
|
+
| Use Case | Solution |
|
|
215
|
+
|---|---|
|
|
216
|
+
| Simple enter/exit | CSS `@keyframes` + `transition` |
|
|
217
|
+
| Complex sequences / orchestrated | Framer Motion |
|
|
218
|
+
| Physics-based spring | Framer Motion `spring` |
|
|
219
|
+
| Hover/focus micro-interactions | CSS `transition` (no JS cost) |
|
|
220
|
+
| Scroll-driven | CSS `@scroll-timeline` or Framer `useInView` |
|
|
221
|
+
| Page transitions | Framer `AnimatePresence` |
|
|
222
|
+
|
|
223
|
+
### CSS Transitions
|
|
224
|
+
```css
|
|
225
|
+
/* ✅ GPU-accelerated properties only */
|
|
226
|
+
.card {
|
|
227
|
+
transition: transform 200ms ease-out, opacity 200ms ease-out,
|
|
228
|
+
box-shadow 200ms ease-out;
|
|
229
|
+
}
|
|
230
|
+
.card:hover {
|
|
231
|
+
transform: translateY(-2px);
|
|
232
|
+
box-shadow: 0 8px 32px hsl(0 0% 0% / 0.15);
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `@keyframes` Structure
|
|
237
|
+
```css
|
|
238
|
+
@keyframes slideIn {
|
|
239
|
+
from { opacity: 0; transform: translateX(-16px); }
|
|
240
|
+
to { opacity: 1; transform: none; }
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* Apply with animation shorthand */
|
|
244
|
+
.panel { animation: slideIn 300ms ease-out both; }
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### `prefers-reduced-motion` — Non-Negotiable
|
|
248
|
+
```css
|
|
249
|
+
/* Global reset for reduced motion */
|
|
250
|
+
@media (prefers-reduced-motion: reduce) {
|
|
251
|
+
*, *::before, *::after {
|
|
252
|
+
animation-duration: 0.01ms !important;
|
|
253
|
+
animation-iteration-count: 1 !important;
|
|
254
|
+
transition-duration: 0.01ms !important;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## 8. Anti-Patterns
|
|
260
|
+
|
|
261
|
+
| Anti-Pattern | Problem | Fix |
|
|
262
|
+
|---|---|---|
|
|
263
|
+
| `!important` | Specificity wars, hard to override | Refactor selector or use CSS layers (`@layer`) |
|
|
264
|
+
| Specificity wars | `.sidebar .card .button {}` | BEM naming or CSS Modules scoping |
|
|
265
|
+
| Magic numbers z-index (`z-[9999]`) | Unpredictable stacking | Named z-index tokens in config |
|
|
266
|
+
| Inline style overrides | Bypasses design system | Add utility class or extend Tailwind theme |
|
|
267
|
+
| Animating layout properties | Reflow on every frame | Animate `transform` + `opacity` only |
|
|
268
|
+
| `@apply` for large blocks | Reduces readability benefit of Tailwind | Component extraction instead |
|
|
269
|
+
| Global selector bleed in CSS Modules | `.module.css` affects non-module elements | Scope all selectors with `:local()` or class names |
|
|
270
|
+
|
|
271
|
+
## 9. Z-Index Layer System
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
// tailwind.config.ts
|
|
275
|
+
extend: {
|
|
276
|
+
zIndex: {
|
|
277
|
+
base: '0',
|
|
278
|
+
above: '10',
|
|
279
|
+
dropdown: '100',
|
|
280
|
+
sticky: '200',
|
|
281
|
+
overlay: '300',
|
|
282
|
+
modal: '400',
|
|
283
|
+
toast: '500',
|
|
284
|
+
tooltip: '600',
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
// Use named z-index in JSX
|
|
291
|
+
<div className="z-modal">…</div>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## 10. Checklist
|
|
295
|
+
|
|
296
|
+
- [ ] CSS custom properties defined at 3 layers (primitive → semantic → component)
|
|
297
|
+
- [ ] No primitive tokens used directly in component styles
|
|
298
|
+
- [ ] Tailwind version confirmed before writing config
|
|
299
|
+
- [ ] `@apply` used only for repeated utility combos, not state variants
|
|
300
|
+
- [ ] Container queries used for multi-context components
|
|
301
|
+
- [ ] Dark mode uses token switching (not duplicated utility classes)
|
|
302
|
+
- [ ] All animations respect `prefers-reduced-motion`
|
|
303
|
+
- [ ] Fluid typography with `clamp()` for hero/heading text
|
|
304
|
+
- [ ] Z-index uses named tokens, not inline integers
|
|
305
|
+
- [ ] No `!important` in component styles
|