@minhduydev/mdpi 0.4.1 → 0.6.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.
Files changed (41) hide show
  1. package/dist/index.js +4 -2
  2. package/dist/template/.pi/AGENTS.md +1 -1
  3. package/dist/template/.pi/README.md +2 -3
  4. package/dist/template/.pi/VERSION +1 -1
  5. package/dist/template/.pi/agents/explore.md +1 -1
  6. package/dist/template/.pi/agents/scout.md +1 -1
  7. package/dist/template/.pi/extensions/templates-injector.ts +35 -7
  8. package/dist/template/.pi/prompts/INDEX.md +3 -9
  9. package/dist/template/.pi/prompts/gc.md +2 -1
  10. package/dist/template/.pi/prompts/verify.md +24 -0
  11. package/dist/template/.pi/skills/INDEX.md +40 -8
  12. package/dist/template/.pi/skills/dcp-hygiene/SKILL.md +1 -1
  13. package/dist/template/.pi/skills/frontend-design/SKILL.md +1 -1
  14. package/dist/template/.pi/skills/frontend-design/references/animation/motion-advanced.md +88 -15
  15. package/dist/template/.pi/skills/frontend-design/references/animation/motion-core.md +148 -13
  16. package/dist/template/.pi/skills/frontend-design/references/shadcn/setup.md +127 -20
  17. package/dist/template/.pi/skills/nextjs-app-router/SKILL.md +334 -0
  18. package/dist/template/.pi/skills/nextjs-cache/SKILL.md +262 -0
  19. package/dist/template/.pi/skills/react-best-practices/SKILL.md +79 -1
  20. package/dist/template/.pi/skills/react-compiler/SKILL.md +237 -0
  21. package/dist/template/.pi/skills/react-hook-form/SKILL.md +374 -0
  22. package/dist/template/.pi/skills/react-server-actions/SKILL.md +299 -0
  23. package/dist/template/.pi/skills/shadcn-ui/SKILL.md +404 -0
  24. package/dist/template/.pi/skills/tanstack-query/SKILL.md +330 -0
  25. package/dist/template/.pi/skills/v0/SKILL.md +264 -0
  26. package/dist/template/.pi/skills/zustand/SKILL.md +333 -0
  27. package/package.json +1 -1
  28. package/dist/template/.pi/context/fallow.md +0 -137
  29. package/dist/template/.pi/prompts/loop-check.md +0 -87
  30. package/dist/template/.pi/prompts/loop-init.md +0 -157
  31. package/dist/template/.pi/prompts/loop-review.md +0 -90
  32. package/dist/template/.pi/skills/loop-audit/SKILL.md +0 -141
  33. package/dist/template/.pi/skills/loop-cost/SKILL.md +0 -130
  34. package/dist/template/.pi/skills/loop-engineering/SKILL.md +0 -175
  35. package/dist/template/.pi/templates/loop-github-action.yml +0 -162
  36. package/dist/template/.pi/templates/loop-orchestrator.sh +0 -514
  37. package/dist/template/.pi/templates/loop-orchestrator.test.ts +0 -332
  38. package/dist/template/.pi/templates/loop-orchestrator.ts +0 -936
  39. package/dist/template/.pi/templates/loop-state.json +0 -24
  40. package/dist/template/.pi/templates/loop-state.md +0 -98
  41. package/dist/template/.pi/templates/loop-vision.md +0 -110
@@ -1,6 +1,9 @@
1
1
  # Motion Core (motion/react)
2
2
 
3
- **Import**: `import { motion, AnimatePresence } from 'motion/react'`
3
+ **Package**: `motion` (v12.40.0). Formerly "framer-motion".
4
+ **Import**: `import { motion, AnimatePresence, useScroll, useTransform } from 'motion/react'`
5
+
6
+ Framer Motion rebranded to **Motion** in November 2024. Both `motion` and `framer-motion` packages published in lockstep. New projects use `motion`. No breaking changes in v12 for React.
4
7
 
5
8
  ## Motion Principles
6
9
 
@@ -8,6 +11,8 @@
8
11
  - Use motion to explain state change and hierarchy
9
12
  - Prefer subtle distance (`8-16px`) and opacity shifts
10
13
  - Use consistent timing/easing system across the app
14
+ - Let Tailwind handle static styles; Motion handles behavior
15
+ - **Remove `transition-*` Tailwind classes from motion elements** — they conflict
11
16
 
12
17
  ## Timing System
13
18
 
@@ -19,6 +24,7 @@
19
24
  | Large entrances | 500-800ms |
20
25
 
21
26
  **Rule**: exit duration = ~75% of enter duration.
27
+ **Never exceed 600ms for UI responsiveness.**
22
28
 
23
29
  ## Easing System
24
30
 
@@ -29,20 +35,20 @@ const EASING_ENTER = [0.16, 1, 0.3, 1];
29
35
  const EASING_EXIT = [0.4, 0, 1, 1];
30
36
  ```
31
37
 
32
- Avoid bounce/elastic easings for product UI.
38
+ Avoid bounce/elastic easings for product UI. Motion's hybrid engine runs animations natively via Web Animations API (WAAPI) and ScrollTimeline for 120fps GPU performance, falling back to JS only for spring physics and gestures.
33
39
 
34
40
  ## Performance Rules
35
41
 
36
42
  Animate only compositor-friendly properties:
37
43
 
38
- - `transform`
44
+ - `transform` (x, y, scale, rotate, skew)
39
45
  - `opacity`
40
46
 
41
47
  Avoid animating:
42
48
 
43
- - `width`, `height`
44
- - `top`, `left`
45
- - `margin`, `padding`
49
+ - `width`, `height` — triggers layout recalculation
50
+ - `top`, `left` — use `x`/`y` instead
51
+ - `margin`, `padding`, `border`
46
52
 
47
53
  ## Basic Pattern
48
54
 
@@ -54,6 +60,101 @@ Avoid animating:
54
60
  />
55
61
  ```
56
62
 
63
+ ## React 19 + Next.js 15/16
64
+
65
+ ### Page Transitions (App Router)
66
+
67
+ **Critical**: Use `template.tsx`, NOT `layout.tsx`. Layout persists across routes and never remounts.
68
+
69
+ ```tsx
70
+ // app/template.tsx
71
+ 'use client'
72
+
73
+ import { AnimatePresence, motion } from 'motion/react'
74
+ import { usePathname } from 'next/navigation'
75
+
76
+ export default function Template({ children }: { children: React.ReactNode }) {
77
+ const pathname = usePathname()
78
+ return (
79
+ <AnimatePresence mode="wait" initial={false}>
80
+ <motion.div
81
+ key={pathname}
82
+ initial={{ opacity: 0, y: 8 }}
83
+ animate={{ opacity: 1, y: 0 }}
84
+ exit={{ opacity: 0, y: -8 }}
85
+ transition={{ duration: 0.18, ease: 'easeInOut' }}
86
+ style={{ minHeight: 'var(--page-min-height, 100dvh)' }}
87
+ >
88
+ {children}
89
+ </motion.div>
90
+ </AnimatePresence>
91
+ )
92
+ }
93
+ ```
94
+
95
+ ### Dynamic Import (Performance)
96
+
97
+ ```tsx
98
+ import dynamic from 'next/dynamic'
99
+
100
+ const AnimatedWrapper = dynamic(() => import('@/components/animated-wrapper'), {
101
+ ssr: false,
102
+ loading: ({ children }) => <>{children}</>,
103
+ })
104
+ ```
105
+
106
+ ### React 19.2 View Transitions
107
+
108
+ Next.js 16 + React 19.2 support native View Transitions via `experimental.viewTransition: true`. Motion's `AnimateView` (premium) builds on this.
109
+
110
+ ## Integration with shadcn/ui
111
+
112
+ **Architecture**: shadcn/ui = structure + accessibility. Motion = behavior + animation. Wrap/extend shadcn components — don't replace.
113
+
114
+ ```
115
+ src/
116
+ ├── components/
117
+ │ ├── ui/ # shadcn generated (untouched)
118
+ │ └── animated/ # Motion-wrapped shadcn components
119
+ │ ├── AnimatedButton.tsx
120
+ │ ├── AnimatedDialog.tsx
121
+ │ └── ...
122
+ └── lib/
123
+ └── animations.ts # Shared variants & transition configs
124
+ ```
125
+
126
+ ### Shared Variants Pattern
127
+
128
+ ```ts
129
+ // lib/animations.ts
130
+ import type { Variants, Transition } from 'motion/react'
131
+
132
+ export const fadeIn: Variants = {
133
+ initial: { opacity: 0 },
134
+ animate: { opacity: 1 },
135
+ exit: { opacity: 0 },
136
+ }
137
+
138
+ export const slideUp: Variants = {
139
+ initial: { opacity: 0, y: 20 },
140
+ animate: { opacity: 1, y: 0 },
141
+ exit: { opacity: 0, y: 20 },
142
+ }
143
+
144
+ export const spring: Transition = {
145
+ type: 'spring',
146
+ stiffness: 300,
147
+ damping: 25,
148
+ }
149
+ ```
150
+
151
+ ### Installation Order
152
+
153
+ 1. `npx shadcn init` + add components
154
+ 2. `npm install motion`
155
+ 3. Create `lib/animations.ts` for shared variants
156
+ 4. Create `components/animated/` directory for wrapped components
157
+
57
158
  ## Variants Pattern (Recommended)
58
159
 
59
160
  ```tsx
@@ -69,8 +170,6 @@ const card = {
69
170
  <motion.div variants={card} initial="hidden" animate="visible" />
70
171
  ```
71
172
 
72
- Use variants for shared timing and maintainability.
73
-
74
173
  ## Exit Animations (AnimatePresence)
75
174
 
76
175
  ```tsx
@@ -87,7 +186,7 @@ Use variants for shared timing and maintainability.
87
186
  </AnimatePresence>
88
187
  ```
89
188
 
90
- Always provide stable `key` values for exiting elements.
189
+ Always provide stable `key` values. Use `mode="wait"` to prevent overlapping DOM elements.
91
190
 
92
191
  ## Stagger Patterns
93
192
 
@@ -123,6 +222,9 @@ Use `layout` for reordering and size changes. Add spring only when needed:
123
222
  <motion.div layout transition={{ type: 'spring', stiffness: 320, damping: 28 }} />
124
223
  ```
125
224
 
225
+ **New (v12.35+)**: Axis-locked layout: `layout="x"` or `layout="y"`.
226
+ **New (v12.38+)**: Custom anchor: `layoutAnchor={{ x: 0.5, y: 0.5 }}`.
227
+
126
228
  ## Gestures
127
229
 
128
230
  ```tsx
@@ -133,7 +235,7 @@ Use `layout` for reordering and size changes. Add spring only when needed:
133
235
  />
134
236
  ```
135
237
 
136
- Keep gesture amplitudes subtle (`0.98-1.03`).
238
+ Keep gesture amplitudes subtle (`0.98-1.03`). Available: `whileHover`, `whileTap`, `whileFocus`, `whileDrag`, `whileInView`.
137
239
 
138
240
  ## Height Expand/Collapse (No height animation)
139
241
 
@@ -168,14 +270,47 @@ Use CSS grid technique:
168
270
  }
169
271
  ```
170
272
 
171
- For motion/react, switch spatial movement to opacity-only when reduced motion is enabled.
273
+ For motion/react, use `useReducedMotion()`:
274
+
275
+ ```tsx
276
+ import { useReducedMotion } from 'motion/react'
277
+
278
+ const prefersReduced = useReducedMotion()
279
+
280
+ <motion.div
281
+ animate={prefersReduced ? {} : { scale: 1.1 }}
282
+ />
283
+ ```
284
+
285
+ ## Motion AI Kit
286
+
287
+ Official Motion AI tools (premium, Motion+ required):
288
+ ```bash
289
+ npx motion-ai # Install MCP server + skills for Claude Code, Cursor, Windsurf, etc.
290
+ ```
291
+
292
+ Provides: 400+ premium examples, MotionScore runtime profiling, CSS spring generation, transition editing.
293
+
294
+ ## Common Pitfalls
295
+
296
+ | Pitfall | Fix |
297
+ |---------|-----|
298
+ | `layout.tsx` for AnimatePresence (CLS) | Use `template.tsx` with `mode="wait"` |
299
+ | `transition-*` classes on motion elements | Remove Tailwind transition classes |
300
+ | Animating `width`/`height` | Use `scaleX`/`scaleY` or grid technique |
301
+ | Missing `use client` in Next.js | Extract animation to client component |
302
+ | `mode="sync"` with page transitions | Use `mode="wait"` to prevent overlap |
303
+ | Duration > 600ms for UI | Cap at 600ms; reserve long durations for storytelling |
172
304
 
173
305
  ## Quick Checklist
174
306
 
175
- - [ ] Uses `motion/react` import
307
+ - [ ] Uses `motion/react` import (not `framer-motion`)
176
308
  - [ ] Timing follows 100/300/500ms system
177
309
  - [ ] Exponential easing, no bounce/elastic
178
310
  - [ ] Animates only `transform` and `opacity`
179
311
  - [ ] Uses `AnimatePresence` for exit states
180
- - [ ] Includes reduced motion support
312
+ - [ ] Includes reduced motion support (CSS + `useReducedMotion()`)
181
313
  - [ ] Stagger windows stay under 500ms
314
+ - [ ] Next.js: uses `template.tsx` not `layout.tsx`
315
+ - [ ] No `transition-*` classes on motion elements
316
+ - [ ] shadcn/ui: animated components in `components/animated/`
@@ -1,56 +1,161 @@
1
1
  # shadcn/ui Setup
2
2
 
3
- CLI v3.6.x (current: v3.6.3) - Copy-paste components, Radix UI + Tailwind v4.
3
+ CLI v4.x (current: shadcn@4.11.0) Copy-paste components, Radix UI / Base UI + Tailwind v4.
4
4
 
5
- ## New Project
5
+ ## Create a New Project
6
6
 
7
7
  ```bash
8
8
  npx shadcn create
9
9
  ```
10
10
 
11
11
  Interactive setup:
12
- - Visual style: Vega, Nova, Maia, Lyra, Mira
13
- - Component library: Radix UI or Base UI
14
- - Icon library (including Phosphor)
15
- - Next.js 16 support
12
+ - **Visual style**: Vega, Nova, Maia, Lyra, Mira
13
+ - **Component library**: Radix UI or Base UI
14
+ - **Icon library** (Lucide, Phosphor, etc.)
15
+ - **Next.js 16**, Vite, Laravel, React Router, Astro, TanStack Start support
16
+ - **Template scaffolding** via `npx shadcn init --template`
16
17
 
17
18
  ## Existing Project
18
19
 
19
20
  ```bash
20
- npx shadcn@latest init
21
+ npx shadcn@latest init --preset <code>
21
22
  npx shadcn@latest add button card dialog
22
23
  npx shadcn@latest add --all
24
+ npx shadcn@latest add <username>/<repo>/<item> # GitHub Registry
23
25
  ```
24
26
 
25
27
  Components install to `components/ui/`.
26
28
 
29
+ ## Key CLI v4 Commands
30
+
31
+ ```bash
32
+ # Inspection
33
+ npx shadcn info # Full project config (for agent context)
34
+ npx shadcn info --json # JSON output for programmatic use
35
+ npx shadcn docs <component> # Docs, code, examples from CLI
36
+
37
+ # Preview changes before writing
38
+ npx shadcn add button --dry-run # Show what will be installed
39
+ npx shadcn add button --diff # Show diff against current
40
+ npx shadcn add button --view # Open component in browser
41
+
42
+ # Project setup flags
43
+ npx shadcn init --preset a1Dg5eFl # Pack entire design system into short code
44
+ npx shadcn init --template # Scaffold project templates
45
+ npx shadcn init --monorepo # Monorepo setup
46
+ npx shadcn init --base radix # Choose primitives (radix | base)
47
+
48
+ # Skills (AI Agent)
49
+ npx skills add shadcn/ui # Install agent prompt file
50
+ npx shadcn skills generate # Regenerate after adding components
51
+ npx shadcn skills update # Update monthly
52
+ ```
53
+
27
54
  ## Visual Styles
28
55
 
29
- | Style | Description |
30
- |-------|-------------|
31
- | **Vega** | Classic shadcn look |
32
- | **Nova** | Reduced padding, compact |
33
- | **Maia** | Soft, rounded, generous |
34
- | **Lyra** | Boxy, sharp, mono fonts |
35
- | **Mira** | Compact, dense interfaces |
56
+ | Style | Characteristics |
57
+ |-------|----------------|
58
+ | **Vega** | Classic shadcn look — balanced, versatile |
59
+ | **Nova** | Reduced padding, compact, space-efficient |
60
+ | **Maia** | Soft, rounded corners, generous spacing |
61
+ | **Lyra** | Boxy, sharp corners, monospace fonts |
62
+ | **Mira** | Compact, dense, data-heavy interfaces |
63
+
64
+ Styles rewrite component code, not just CSS — fonts, spacing, structure, primitives all adapt.
65
+
66
+ ## Presets
67
+
68
+ Presets pack the entire design system into a reproducible short code:
69
+
70
+ ```bash
71
+ # Export your preset
72
+ npx shadcn preset export
73
+
74
+ # Init a project with a preset
75
+ npx shadcn init --preset a1Dg5eFl
76
+ ```
77
+
78
+ A preset includes: colors, theme, icons, fonts, radius, spacing — everything in one code.
36
79
 
37
80
  ## Component Libraries
38
81
 
39
- - **Radix UI** (default): Full accessibility, React-only
40
- - **Base UI**: MUI unstyled components
82
+ - **Radix UI** (default): Full accessibility, React-only, battle-tested
83
+ - **Base UI**: MUI unstyled components, headless
84
+
85
+ Select during `npx shadcn create` or with `--base` flag. CLI auto-detects your library when pulling components.
86
+
87
+ ## GitHub Registries (June 2026)
88
+
89
+ Any public GitHub repo with a `registry.json` can be a component registry:
41
90
 
42
- Select during `npx shadcn create` or in `components.json`.
91
+ ```bash
92
+ npx shadcn@latest add <username>/<repo>/<item>
93
+ ```
94
+
95
+ Distribute: components, hooks, utilities, design tokens, feature kits, project conventions, CI workflows, templates. No build step — CLI reads `registry.json` directly.
96
+
97
+ ```json
98
+ // registry.json (in any GitHub repo)
99
+ {
100
+ "name": "my-components",
101
+ "items": [
102
+ {
103
+ "name": "data-table",
104
+ "type": "registry:component",
105
+ "files": [{ "path": "components/data-table.tsx" }]
106
+ }
107
+ ]
108
+ }
109
+ ```
110
+
111
+ ## shadcn/skills — AI Agent Bridge
112
+
113
+ ```bash
114
+ npx skills add shadcn/ui
115
+ ```
116
+
117
+ Creates `.shadcn/skills.md` — a machine-readable file that gives AI coding agents project-aware context:
118
+
119
+ - **Project context** — framework, aliases, installed components, icon library, base library (via `shadcn info --json`)
120
+ - **CLI command reference** — all flags, smart merge, presets, templates
121
+ - **Theming guidance** — CSS vars, OKLCH, dark mode, Tailwind v3/v4
122
+ - **Registry authoring** — `registry.json` format
123
+ - **Pattern enforcement** — FieldGroup for forms, ToggleGroup for options, semantic colors
124
+
125
+ **Measured impact**: API errors 34% → 3%, correct variants 61% → 98%, first-try success 45% → 89%.
126
+
127
+ **Critical workflows**:
128
+ - Re-generate after adding components: `npx shadcn skills generate`
129
+ - Update monthly: `npx shadcn skills update`
130
+ - Reference file path (don't paste into context — 4K cutoff)
43
131
 
44
132
  ## MCP Server Support
45
133
 
46
- - OpenCode MCP (v3.6.3)
47
- - Codex MCP (v3.4.0)
134
+ Connect AI editors to your registry:
135
+
136
+ ```json
137
+ {
138
+ "mcpServers": {
139
+ "shadcn": {
140
+ "command": "npx",
141
+ "args": ["-y", "shadcn@canary", "registry:mcp"],
142
+ "env": {
143
+ "REGISTRY_URL": "https://your-registry.vercel.app/r/registry.json"
144
+ }
145
+ }
146
+ }
147
+ }
148
+ ```
149
+
150
+ Also: OpenCode MCP (v3.6.3), Codex MCP (v3.4.0).
48
151
 
49
152
  ## Registry System
50
153
 
51
154
  - Registry Directory: https://ui.shadcn.com/docs/directory
52
155
  - Custom registries via `components.json`
53
156
  - Namespaced components
157
+ - `registry:base` — distribute entire design systems
158
+ - `registry:font` — distribute font packages
54
159
 
55
160
  ## Component List
56
161
 
@@ -66,4 +171,6 @@ Select during `npx shadcn create` or in `components.json`.
66
171
 
67
172
  **Overlay**: Dropdown Menu, Context Menu, Popover, Collapsible
68
173
 
69
- **Other**: Toggle, Toggle Group, Kbd, Button Group, Item, Empty, Input OTP
174
+ **2026 New**: Spinner, Kbd, KbdGroup, Button Group, Input Group, Field, Item, Empty, Input OTP
175
+
176
+ **Other**: Toggle, Toggle Group