@luanpdd/kit-mcp 1.32.0 → 1.33.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/README.md +1 -1
- package/kit/agents/designer-ui.md +216 -0
- package/kit/file-manifest.json +10 -2
- package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -0
- package/kit/skills/ui-contexto-produto/SKILL.md +248 -0
- package/kit/skills/ui-cor-estrategia/SKILL.md +213 -0
- package/kit/skills/ui-critica-auditoria/SKILL.md +260 -0
- package/kit/skills/ui-motion-funcional/SKILL.md +264 -0
- package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -0
- package/kit/skills/ui-tipografia/SKILL.md +211 -0
- package/package.json +1 -1
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-critica-auditoria
|
|
3
|
+
description: Use ao revisar UI implementada — combina crítica (Nielsen 10 heurísticas 0-4 + carga cognitiva /8 + verdict de tells-IA pass/fail) e auditoria (5 dimensões a11y/perf/theming/responsive/anti-patterns com P0-P3 severity). Produz REVISAO-UI.md scored, routes findings para endurecer/polir/otimizar. Não roda em incomplete work — só em finished pages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# UI — Crítica & Auditoria
|
|
7
|
+
|
|
8
|
+
## Quando usar
|
|
9
|
+
|
|
10
|
+
LLM carrega esta skill quando:
|
|
11
|
+
|
|
12
|
+
- "Audite design / revise UI / está bom?"
|
|
13
|
+
- "Está pronto para ship?"
|
|
14
|
+
- "Score this design / quão ruim é o tell de IA?"
|
|
15
|
+
- Antes de release de feature visível
|
|
16
|
+
- Em PR de mudança visual significativa
|
|
17
|
+
|
|
18
|
+
**NÃO use em:**
|
|
19
|
+
- Work-in-progress (vai pontuar mal porque incompleto, não porque ruim)
|
|
20
|
+
- Componente isolado fora de página real
|
|
21
|
+
- Code-only review (precisa ver rendered)
|
|
22
|
+
|
|
23
|
+
## Regras absolutas
|
|
24
|
+
|
|
25
|
+
**REGRA #1 (duas passadas independentes):** Rode **crítica** (LLM + heurísticas, subjetivo) E **auditoria** (5 dimensões, determinístico) **separadamente**. Não bias um pelo outro. Findings convergentes têm peso 2×.
|
|
26
|
+
|
|
27
|
+
**REGRA #2 (P0-P3 severity definida):**
|
|
28
|
+
- **P0** — Bloqueia release (a11y crítica, tell-IA deal-breaker, UX quebrado)
|
|
29
|
+
- **P1** — Resolver neste sprint (gaps notáveis, tell parcial)
|
|
30
|
+
- **P2** — Próximo ciclo (refinamento)
|
|
31
|
+
- **P3** — Polimento (nice-to-have)
|
|
32
|
+
|
|
33
|
+
**REGRA #3 (score antes da opinião):** Heuristic scores são numéricos (0-4), prioridade de fixes é opinião. Cliente pode discordar de prioridade, não de score.
|
|
34
|
+
|
|
35
|
+
**REGRA #4 (route, don't fix):** Auditoria documenta, não corrige. Findings vão para:
|
|
36
|
+
- a11y, contrast → `ui-cor-estrategia` + endurecer phase
|
|
37
|
+
- tells de IA → `ui-anti-padroes-ia` patches
|
|
38
|
+
- Performance → otimizar phase
|
|
39
|
+
- Typography → `ui-tipografia` refactor
|
|
40
|
+
|
|
41
|
+
## Passada Crítica — Nielsen 10 (0-4 cada)
|
|
42
|
+
|
|
43
|
+
| # | Heurística | Como medir |
|
|
44
|
+
|---|-----------|------------|
|
|
45
|
+
| 1 | Visibility of system status | Loading states? Optimistic UI? Toast feedback? |
|
|
46
|
+
| 2 | Match with real world | Vocabulário do domínio? Ícones reconhecíveis? Locale-aware? |
|
|
47
|
+
| 3 | User control & freedom | Undo? Cancel em modais? Botão back claro? Confirm em destrutivo? |
|
|
48
|
+
| 4 | Consistency & standards | Mesmo padrão de botão em todas telas? CTAs consistentes? |
|
|
49
|
+
| 5 | Error prevention | Validation inline? Confirm em destrutivo? Disable em estado inválido? |
|
|
50
|
+
| 6 | Recognition over recall | Labels visíveis vs precisar lembrar? Recent items? Autocomplete? |
|
|
51
|
+
| 7 | Flexibility & efficiency | Keyboard shortcuts? Power-user paths? Bulk actions? |
|
|
52
|
+
| 8 | Aesthetic & minimalist | Algo na tela não é essencial? Card aninhado? Decoração gratuita? |
|
|
53
|
+
| 9 | Help users recognize errors | Mensagem específica + recovery action? Não "Something went wrong" genérico? |
|
|
54
|
+
| 10 | Help & documentation | Inline help em fields complexos? Empty state ensina? Onboarding presente? |
|
|
55
|
+
|
|
56
|
+
**Scoring:**
|
|
57
|
+
- 4 — Excelente, supera expectativa
|
|
58
|
+
- 3 — Bom, alguns gaps menores
|
|
59
|
+
- 2 — Cumprido parcialmente, gaps notáveis
|
|
60
|
+
- 1 — Falha na maioria dos cenários
|
|
61
|
+
- 0 — Ausente / quebrado
|
|
62
|
+
|
|
63
|
+
## Passada Crítica — Carga cognitiva (/8)
|
|
64
|
+
|
|
65
|
+
Conte falhas. Para cada uma, +1 ao counter:
|
|
66
|
+
|
|
67
|
+
1. Mais de 7±2 elementos competindo por atenção em viewport inicial?
|
|
68
|
+
2. Hierarquia visual ambígua (qual é a ação primária)?
|
|
69
|
+
3. Vocabulary mismatch (jargão técnico em UI consumer)?
|
|
70
|
+
4. Decisões prematuras pedidas (escolha de plano antes de ver valor)?
|
|
71
|
+
5. Estado escondido (qual aba está ativa? qual filtro aplicado?)?
|
|
72
|
+
6. Confirmação ausente em destrutivo, ou excessiva em trivial?
|
|
73
|
+
7. Loading sem progress signal em > 1s waits?
|
|
74
|
+
8. Layout shift visível durante load (CLS > 0.1)?
|
|
75
|
+
|
|
76
|
+
Score: 0-2 falhas = bom, 3-4 = preocupante, 5+ = redesign.
|
|
77
|
+
|
|
78
|
+
## Passada Crítica — Verdict de Tells-IA (pass/fail)
|
|
79
|
+
|
|
80
|
+
Rode o detector da skill [ui-anti-padroes-ia](../ui-anti-padroes-ia/SKILL.md). Verdict:
|
|
81
|
+
|
|
82
|
+
- **PASS** — zero P0, ≤ 2 P1 com justificativa em DESIGN.md
|
|
83
|
+
- **MARGINAL** — 1 P0 OU > 2 P1
|
|
84
|
+
- **FAIL** — ≥ 2 P0 OU padrão sistêmico de tells
|
|
85
|
+
|
|
86
|
+
Liste os tells específicos: `verdict: FAIL · gradiente-roxo · italic-serif-hero · card-aninhado`.
|
|
87
|
+
|
|
88
|
+
## Passada Auditoria — 5 dimensões (0-4 cada)
|
|
89
|
+
|
|
90
|
+
### D1 Accessibility (0-4)
|
|
91
|
+
|
|
92
|
+
Check:
|
|
93
|
+
- [ ] WCAG AA contrast pass para foreground/background pairs (`npx pa11y`)
|
|
94
|
+
- [ ] Todo input tem `<label>` ou `aria-label`
|
|
95
|
+
- [ ] Botão de ícone sem texto tem `aria-label`
|
|
96
|
+
- [ ] Keyboard nav: Tab order lógico, focus visible
|
|
97
|
+
- [ ] Semantic HTML (`<button>` não `<div onClick>`)
|
|
98
|
+
- [ ] Skip-to-content em layouts longos
|
|
99
|
+
|
|
100
|
+
### D2 Performance (0-4)
|
|
101
|
+
|
|
102
|
+
Check:
|
|
103
|
+
- [ ] LCP < 2.5s (Lighthouse mobile)
|
|
104
|
+
- [ ] CLS < 0.1
|
|
105
|
+
- [ ] Bundle JS first-load < 200KB gzipped
|
|
106
|
+
- [ ] Imagens com `loading="lazy"` e dimensions
|
|
107
|
+
- [ ] Sem layout-thrashing animations (height/width transitions)
|
|
108
|
+
- [ ] Lighthouse Perf score ≥ 90
|
|
109
|
+
|
|
110
|
+
### D3 Theming (0-4)
|
|
111
|
+
|
|
112
|
+
Check:
|
|
113
|
+
- [ ] Zero HEX/RGB hard-coded em components (use tokens)
|
|
114
|
+
- [ ] Dark mode covered (se declarado em MARCA.md)
|
|
115
|
+
- [ ] Tokens semânticos não nomes de cor (`--primary`, não `--blue-500`)
|
|
116
|
+
- [ ] Sem `!important` em styles
|
|
117
|
+
- [ ] CSS custom properties consistentes entre `:root` e `.dark`
|
|
118
|
+
|
|
119
|
+
### D4 Responsive (0-4)
|
|
120
|
+
|
|
121
|
+
Check:
|
|
122
|
+
- [ ] Breakpoints: mobile (375), tablet (768), desktop (1024+) todos testados
|
|
123
|
+
- [ ] Touch targets ≥ 44×44 em mobile
|
|
124
|
+
- [ ] Horizontal scroll só em data tables (nunca em layout)
|
|
125
|
+
- [ ] Texto reflow em narrow (não cortado, não overflow)
|
|
126
|
+
- [ ] Hover-only interactions têm equivalente touch
|
|
127
|
+
|
|
128
|
+
### D5 Anti-patterns (0-4)
|
|
129
|
+
|
|
130
|
+
Rode o detector da [ui-anti-padroes-ia](../ui-anti-padroes-ia/SKILL.md). Score:
|
|
131
|
+
- 4 = zero P0/P1
|
|
132
|
+
- 3 = 1 P1 documentado
|
|
133
|
+
- 2 = 2-3 P1 OU 1 P0 documentado
|
|
134
|
+
- 1 = ≥ 2 P0
|
|
135
|
+
- 0 = sistêmico
|
|
136
|
+
|
|
137
|
+
## Output — REVISAO-UI.md
|
|
138
|
+
|
|
139
|
+
```markdown
|
|
140
|
+
# Revisão de UI — {nome da feature/página}
|
|
141
|
+
|
|
142
|
+
**Revisado:** {data}
|
|
143
|
+
**Revisor:** designer-ui (kit)
|
|
144
|
+
**Registro:** {marca | produto}
|
|
145
|
+
**Baseline:** {DESIGN.md path | abstract defaults}
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## TL;DR
|
|
150
|
+
|
|
151
|
+
**Verdict tells-IA:** {PASS | MARGINAL | FAIL} — {tells}
|
|
152
|
+
**Crítica total:** {soma dos 10 Nielsen}/40
|
|
153
|
+
**Carga cognitiva:** {N}/8 falhas
|
|
154
|
+
**Auditoria total:** {soma das 5 dimensões}/20
|
|
155
|
+
|
|
156
|
+
**Recomendação:** {SHIP | FIX-P0-PRIMEIRO | REWORK}
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Passada Crítica
|
|
161
|
+
|
|
162
|
+
### Nielsen Heuristics
|
|
163
|
+
|
|
164
|
+
| # | Heurística | Score | Key issue |
|
|
165
|
+
|---|-----------|-------|-----------|
|
|
166
|
+
| 1 | Visibility of status | {0-4} | {linha resumo} |
|
|
167
|
+
| 2 | Match with real world | {0-4} | … |
|
|
168
|
+
| 3 | User control | {0-4} | … |
|
|
169
|
+
| … | … | … | … |
|
|
170
|
+
|
|
171
|
+
**Subtotal:** {N}/40
|
|
172
|
+
|
|
173
|
+
### Falhas de Carga Cognitiva: {N}/8
|
|
174
|
+
|
|
175
|
+
{lista de falhas com referência arquivo:linha}
|
|
176
|
+
|
|
177
|
+
### Tells-IA detectados
|
|
178
|
+
|
|
179
|
+
{cole output do detector se houver hits}
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Passada Auditoria
|
|
184
|
+
|
|
185
|
+
| Dimensão | Score | P0 | P1 | P2 | P3 |
|
|
186
|
+
|-----------|-------|----|----|----|----|
|
|
187
|
+
| Accessibility | {0-4} | … | … | … | … |
|
|
188
|
+
| Performance | {0-4} | … | … | … | … |
|
|
189
|
+
| Theming | {0-4} | … | … | … | … |
|
|
190
|
+
| Responsive | {0-4} | … | … | … | … |
|
|
191
|
+
| Anti-patterns | {0-4} | … | … | … | … |
|
|
192
|
+
|
|
193
|
+
**Subtotal:** {N}/20
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Top 5 Priority Issues
|
|
198
|
+
|
|
199
|
+
1. **[P0]** {issue} — `{file:line}` — {fix opinion (route para qual skill)}
|
|
200
|
+
2. **[P0]** … — … — …
|
|
201
|
+
3. **[P1]** … — … — …
|
|
202
|
+
4. **[P1]** … — … — …
|
|
203
|
+
5. **[P2]** … — … — …
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Perguntas Provocativas
|
|
208
|
+
|
|
209
|
+
(Questões "vale responder antes de shippar")
|
|
210
|
+
|
|
211
|
+
1. {ex: "Esta tela funciona em mobile com 1 mão? Você testou?"}
|
|
212
|
+
2. {ex: "O empty state ensina o usuário ou só diz 'No data'?"}
|
|
213
|
+
3. {ex: "Qual é a UMA ação que esta página existe para promover?"}
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Routing
|
|
218
|
+
|
|
219
|
+
- P0/P1 a11y → `ui-cor-estrategia` + endurecer phase
|
|
220
|
+
- P0/P1 tells → `ui-anti-padroes-ia` patches inline
|
|
221
|
+
- Performance → otimizar phase
|
|
222
|
+
- Typography → `ui-tipografia` audit
|
|
223
|
+
- Layout → `ui-ritmo-espacial` audit
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Anti-patterns DESTA skill
|
|
227
|
+
|
|
228
|
+
### Anti-pattern 1: review em WIP
|
|
229
|
+
|
|
230
|
+
**Errado:** rodar audit em página com placeholders, lorem ipsum, estados não implementados.
|
|
231
|
+
|
|
232
|
+
**Por quê:** "incomplete work scores badly because it is not done, not because it is bad". Cliente acha que tem problema de design quando é só falta acabar.
|
|
233
|
+
|
|
234
|
+
**Certo:** audit apenas em features completas. Para WIP use `ui-anti-padroes-ia` detector preventivo + checklist visual sem score.
|
|
235
|
+
|
|
236
|
+
### Anti-pattern 2: misturar crítica e auditoria
|
|
237
|
+
|
|
238
|
+
**Errado:** rodar Nielsen + dimensões juntos, score combinado.
|
|
239
|
+
|
|
240
|
+
**Por quê:** REGRA #1 — bias mútuo. LLM sabendo que tem tell-IA ajusta Nielsen down. Detector sabendo que Nielsen está alto sub-conta.
|
|
241
|
+
|
|
242
|
+
**Certo:** dois reviews separados, mesclar findings no REVISAO-UI.md no fim.
|
|
243
|
+
|
|
244
|
+
### Anti-pattern 3: prioridade sem evidência
|
|
245
|
+
|
|
246
|
+
**Errado:** "Priority 1: fix the gradient" sem citar arquivo, sem dizer por quê P0.
|
|
247
|
+
|
|
248
|
+
**Por quê:** Não acionável. Outro dev não sabe onde fixar nem se realmente é P0.
|
|
249
|
+
|
|
250
|
+
**Certo:** "**[P0]** Hero gradiente roxo (`Hero.tsx:42-48`) — T01 tell-IA, ship blocker. Fix: replace `bg-gradient-to-br from-purple-500 to-pink-500` with `bg-primary` per DESIGN.md > Cores > Destaque."
|
|
251
|
+
|
|
252
|
+
## Ver também
|
|
253
|
+
|
|
254
|
+
- [ui-anti-padroes-ia](../ui-anti-padroes-ia/SKILL.md) — feeds verdict de tells-IA + D5
|
|
255
|
+
- [ui-contexto-produto](../ui-contexto-produto/SKILL.md) — baseline para audit
|
|
256
|
+
- [ui-cor-estrategia](../ui-cor-estrategia/SKILL.md) — fixes para D1/D3
|
|
257
|
+
- [ui-tipografia](../ui-tipografia/SKILL.md) — fixes para typography findings
|
|
258
|
+
- [ui-ritmo-espacial](../ui-ritmo-espacial/SKILL.md) — fixes para D4 responsive
|
|
259
|
+
- [ui-motion-funcional](../ui-motion-funcional/SKILL.md) — motion review
|
|
260
|
+
- Nielsen 10 heuristics: https://www.nngroup.com/articles/ten-usability-heuristics/
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-motion-funcional
|
|
3
|
+
description: Use ao adicionar animation, transition ou motion — princípio canônico "motion com propósito que comunica estado, não decoração". Durações 150-200ms interações / 250-400ms layout / 600ms+ celebration justificada. ease-out default, nunca ease-in para entrance, evita bounce em produto. Respeitar prefers-reduced-motion sempre. Sem auto-play, sem parallax gratuito, sem confetti exceto onboarding.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# UI — Motion Funcional
|
|
7
|
+
|
|
8
|
+
## Quando usar
|
|
9
|
+
|
|
10
|
+
LLM carrega esta skill quando:
|
|
11
|
+
|
|
12
|
+
- "Adicionar animation / transition / motion"
|
|
13
|
+
- "Algo parece estático / sem vida"
|
|
14
|
+
- "Confetti / celebration / delight moment"
|
|
15
|
+
- "Page transition / route change"
|
|
16
|
+
- Preenchendo Componentes/Regras com motion rules
|
|
17
|
+
|
|
18
|
+
## Regras absolutas
|
|
19
|
+
|
|
20
|
+
**REGRA #1 (com propósito, não decorativo):** Motion existe para comunicar **mudança de estado** (loading → done, hidden → visible, focus, error). Decoração pura (parallax, auto-scrolling text, ambient bg motion) é proibida em produto, raramente justificada em marca.
|
|
21
|
+
|
|
22
|
+
**REGRA #2 (duração por contexto):**
|
|
23
|
+
- **Micro-interação** (hover, focus, button press): **100-150ms**
|
|
24
|
+
- **Mudança de estado** (toggle, dropdown, popover open): **150-200ms**
|
|
25
|
+
- **Layout shift** (modal open, drawer slide): **250-400ms**
|
|
26
|
+
- **Page transition**: **300-400ms** max
|
|
27
|
+
- **Celebration** (confetti, hero entrance): **600-800ms** com justificativa, 1 vez
|
|
28
|
+
|
|
29
|
+
Duração > 500ms em interação = lento. < 100ms = imperceptível, sem valor.
|
|
30
|
+
|
|
31
|
+
**REGRA #3 (easing canônico):**
|
|
32
|
+
- **Padrão**: `ease-out` ou `cubic-bezier(0.2, 0.8, 0.2, 1)` (entry rápido, settle suave)
|
|
33
|
+
- **Exit/dismiss**: `ease-in` aceitável para "remover do palco"
|
|
34
|
+
- **Layout shifts**: `cubic-bezier(0.4, 0, 0.2, 1)` (Material standard)
|
|
35
|
+
- **PROIBIDO em produto**: `bounce`, `elastic`, `back` easings — playful demais para uso funcional
|
|
36
|
+
|
|
37
|
+
**REGRA #4 (prefers-reduced-motion sempre):** Toda animation tem fallback estático.
|
|
38
|
+
|
|
39
|
+
**REGRA #5 (no layout thrash):** Anime apenas `transform` + `opacity`. Nunca anime `width`, `height`, `top`, `left`, `padding` em hot path. Use `transform: translate3d()` + `scale()`.
|
|
40
|
+
|
|
41
|
+
## Patterns canônicos
|
|
42
|
+
|
|
43
|
+
### Micro-interação (button hover)
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
.button {
|
|
47
|
+
transition: background-color 150ms ease-out, transform 150ms ease-out;
|
|
48
|
+
}
|
|
49
|
+
.button:hover {
|
|
50
|
+
background-color: var(--primary-hover);
|
|
51
|
+
}
|
|
52
|
+
.button:active {
|
|
53
|
+
transform: translateY(1px); /* sutil press-down */
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (prefers-reduced-motion: reduce) {
|
|
57
|
+
.button { transition: none; }
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Dropdown / Popover open
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
// Framer Motion
|
|
65
|
+
<motion.div
|
|
66
|
+
initial={{ opacity: 0, y: -8 }}
|
|
67
|
+
animate={{ opacity: 1, y: 0 }}
|
|
68
|
+
exit={{ opacity: 0, y: -8 }}
|
|
69
|
+
transition={{ duration: 0.18, ease: [0.2, 0.8, 0.2, 1] }}
|
|
70
|
+
>
|
|
71
|
+
{/* content */}
|
|
72
|
+
</motion.div>
|
|
73
|
+
|
|
74
|
+
// Tailwind / CSS only
|
|
75
|
+
className="data-[state=open]:animate-in data-[state=open]:fade-in-0
|
|
76
|
+
data-[state=open]:slide-in-from-top-1
|
|
77
|
+
data-[state=closed]:animate-out data-[state=closed]:fade-out-0
|
|
78
|
+
data-[state=closed]:slide-out-to-top-1
|
|
79
|
+
duration-200 ease-out"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Modal / Dialog
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
// Mobile: slide-from-bottom (sheet)
|
|
86
|
+
// Desktop: scale central + fade
|
|
87
|
+
|
|
88
|
+
className="
|
|
89
|
+
/* mobile */
|
|
90
|
+
data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom
|
|
91
|
+
data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom
|
|
92
|
+
/* desktop */
|
|
93
|
+
sm:data-[state=open]:zoom-in-95 sm:data-[state=closed]:zoom-out-95
|
|
94
|
+
sm:data-[state=open]:fade-in-0 sm:data-[state=closed]:fade-out-0
|
|
95
|
+
/* timing */
|
|
96
|
+
duration-300 ease-out
|
|
97
|
+
"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Layout state transitions
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
// Lista que filtra: AnimatePresence + layout
|
|
104
|
+
<AnimatePresence mode="popLayout">
|
|
105
|
+
{items.map(item => (
|
|
106
|
+
<motion.div
|
|
107
|
+
key={item.id}
|
|
108
|
+
layout
|
|
109
|
+
initial={{ opacity: 0, scale: 0.95 }}
|
|
110
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
111
|
+
exit={{ opacity: 0, scale: 0.95 }}
|
|
112
|
+
transition={{ duration: 0.2, ease: 'easeOut' }}
|
|
113
|
+
>
|
|
114
|
+
{item.label}
|
|
115
|
+
</motion.div>
|
|
116
|
+
))}
|
|
117
|
+
</AnimatePresence>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Loading state (skeleton + transition)
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
{loading ? (
|
|
124
|
+
<Skeleton className="h-24 animate-pulse" />
|
|
125
|
+
) : (
|
|
126
|
+
<motion.div
|
|
127
|
+
initial={{ opacity: 0 }}
|
|
128
|
+
animate={{ opacity: 1 }}
|
|
129
|
+
transition={{ duration: 0.15 }}
|
|
130
|
+
>
|
|
131
|
+
{data}
|
|
132
|
+
</motion.div>
|
|
133
|
+
)}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Celebration (use 1× por flow, justificado)
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// Onboarding: primeiro check-in completado
|
|
140
|
+
import confetti from 'canvas-confetti'
|
|
141
|
+
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (justCompleted) {
|
|
144
|
+
confetti({
|
|
145
|
+
particleCount: 80,
|
|
146
|
+
spread: 60,
|
|
147
|
+
origin: { y: 0.4 },
|
|
148
|
+
colors: [primaryColor, foregroundColor], // brand-tinted, não rainbow
|
|
149
|
+
disableForReducedMotion: true,
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
}, [justCompleted])
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Critérios para usar confetti:
|
|
156
|
+
1. Evento raro (não toast comum)
|
|
157
|
+
2. Sucesso significativo (não "saved successfully" trivial)
|
|
158
|
+
3. Cores da marca (não default rainbow)
|
|
159
|
+
4. `disableForReducedMotion: true`
|
|
160
|
+
5. Não bloqueia interação subsequente
|
|
161
|
+
|
|
162
|
+
## Anti-patterns
|
|
163
|
+
|
|
164
|
+
### Anti-pattern 1: bounce easing em produto
|
|
165
|
+
|
|
166
|
+
**Errado:**
|
|
167
|
+
```css
|
|
168
|
+
.dropdown {
|
|
169
|
+
transition: transform 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55); /* bounce */
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Por quê:** Q08 — bounce em interação comum = playful demais, perde profissionalismo em context dashboard.
|
|
174
|
+
|
|
175
|
+
**Certo:** `ease-out` ou `cubic-bezier(0.2, 0.8, 0.2, 1)`.
|
|
176
|
+
|
|
177
|
+
### Anti-pattern 2: motion em decoração de bg
|
|
178
|
+
|
|
179
|
+
**Errado:** SVG floating shapes orbitando hero em background, animação infinita.
|
|
180
|
+
|
|
181
|
+
**Por quê:** REGRA #1 — decoração sem propósito + drena GPU + viewport battery + distrai do conteúdo.
|
|
182
|
+
|
|
183
|
+
**Certo:** static. Ou movimento triggerado por scroll JÁ engajado (parallax leve, max -10% translate), nunca infinito.
|
|
184
|
+
|
|
185
|
+
### Anti-pattern 3: animar `height` ou `width` em accordion
|
|
186
|
+
|
|
187
|
+
**Errado:**
|
|
188
|
+
```css
|
|
189
|
+
.accordion-content {
|
|
190
|
+
transition: height 300ms;
|
|
191
|
+
}
|
|
192
|
+
.accordion-content.open { height: auto; } /* além de quebrar transition, layout thrash */
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Por quê:** REGRA #5 — height/width disparam reflow + paint, queda de fps em mobile.
|
|
196
|
+
|
|
197
|
+
**Certo:** anime `transform: scaleY` ou `max-height` + `clip-path`. Ou use lib (Radix Accordion) que faz right.
|
|
198
|
+
|
|
199
|
+
### Anti-pattern 4: page transition longa
|
|
200
|
+
|
|
201
|
+
**Errado:** route change com fade out 600ms + fade in 600ms = 1.2s de tela vazia.
|
|
202
|
+
|
|
203
|
+
**Por quê:** REGRA #2 — user percebe app lento. App nativo bom = transição instantânea ou < 300ms.
|
|
204
|
+
|
|
205
|
+
**Certo:** 200ms fade out + 200ms fade in, OU cross-fade overlap 250ms total.
|
|
206
|
+
|
|
207
|
+
### Anti-pattern 5: ignorar prefers-reduced-motion
|
|
208
|
+
|
|
209
|
+
**Errado:**
|
|
210
|
+
```tsx
|
|
211
|
+
<motion.div animate={{ x: [0, 100, 0] }} transition={{ repeat: Infinity }} />
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Por quê:** REGRA #4 — users com vestibular disorder ou enxaqueca + usuários com bateria fraca + corporate machines.
|
|
215
|
+
|
|
216
|
+
**Certo:**
|
|
217
|
+
```tsx
|
|
218
|
+
const shouldReduceMotion = useReducedMotion()
|
|
219
|
+
<motion.div
|
|
220
|
+
animate={shouldReduceMotion ? {} : { x: [0, 100, 0] }}
|
|
221
|
+
transition={{ repeat: shouldReduceMotion ? 0 : Infinity }}
|
|
222
|
+
/>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Anti-pattern 6: auto-play hero video sem controle
|
|
226
|
+
|
|
227
|
+
**Errado:** `<video autoPlay loop muted playsInline>` em hero, 5MB+, sem botão pausar.
|
|
228
|
+
|
|
229
|
+
**Por quê:** Acessibilidade + bateria + bandwidth. Tem que existir pause/control visível e respeitar prefers-reduced-motion (pausa default).
|
|
230
|
+
|
|
231
|
+
**Certo:**
|
|
232
|
+
```tsx
|
|
233
|
+
<video
|
|
234
|
+
ref={videoRef}
|
|
235
|
+
autoPlay={!prefersReducedMotion}
|
|
236
|
+
loop muted playsInline
|
|
237
|
+
poster="/hero-static.jpg"
|
|
238
|
+
/>
|
|
239
|
+
<button onClick={togglePlay} aria-label="Toggle video">…</button>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Detecção
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Bounce/elastic easing
|
|
246
|
+
grep -rnE "bounce|cubic-bezier\(0\.68|elastic" src --include="*.css" --include="*.tsx" 2>/dev/null
|
|
247
|
+
|
|
248
|
+
# Animação > 500ms em interação
|
|
249
|
+
grep -rnE "duration-(700|1000|1500|2000)\b|duration:\s*(700|800|1000|1500)" src --include="*.tsx" --include="*.css" 2>/dev/null
|
|
250
|
+
|
|
251
|
+
# Layout-thrashing animations
|
|
252
|
+
grep -rnE "transition.*width|transition.*height|transition.*top|transition.*left|transition.*padding|transition.*margin" src --include="*.css" 2>/dev/null
|
|
253
|
+
|
|
254
|
+
# Falta de prefers-reduced-motion handler
|
|
255
|
+
grep -rln "framer-motion\|animate=" src --include="*.tsx" 2>/dev/null | while read f; do
|
|
256
|
+
grep -q "useReducedMotion\|prefers-reduced-motion" "$f" || echo "$f: motion sem reduce handler"
|
|
257
|
+
done
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Ver também
|
|
261
|
+
|
|
262
|
+
- [ui-anti-padroes-ia](../ui-anti-padroes-ia/SKILL.md) — Q08 (bounce easing)
|
|
263
|
+
- [ui-contexto-produto](../ui-contexto-produto/SKILL.md) — sensibilidade a motion em MARCA.md
|
|
264
|
+
- WCAG SC 2.3.3 Animation from Interactions: https://www.w3.org/WAI/WCAG21/Understanding/animation-from-interactions
|