nubos-pilot 0.7.2 → 0.8.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 (241) hide show
  1. package/agents/np-executor.md +1 -0
  2. package/bin/install.js +2 -0
  3. package/bin/np-tools/_commands.cjs +98 -64
  4. package/bin/np-tools/dashboard.cjs +11 -5
  5. package/bin/np-tools/dashboard.test.cjs +80 -0
  6. package/bin/np-tools/help.cjs +16 -7
  7. package/bin/np-tools/help.test.cjs +63 -0
  8. package/bin/np-tools/stats.cjs +99 -3
  9. package/bin/np-tools/stats.test.cjs +65 -0
  10. package/lib/dashboard.cjs +41 -10
  11. package/lib/dashboard.test.cjs +83 -0
  12. package/lib/install/runtime-assets.cjs +50 -1
  13. package/lib/install/runtime-assets.test.cjs +190 -0
  14. package/lib/install/runtimes-registry.cjs +1 -0
  15. package/lib/runtime/_readline.cjs +49 -11
  16. package/lib/runtime/_readline.test.cjs +59 -0
  17. package/lib/runtime/claude.cjs +8 -1
  18. package/package.json +2 -1
  19. package/skills/np-composition-patterns/AGENTS.md +946 -0
  20. package/skills/np-composition-patterns/README.md +60 -0
  21. package/skills/np-composition-patterns/SKILL.md +89 -0
  22. package/skills/np-composition-patterns/metadata.json +11 -0
  23. package/skills/np-composition-patterns/rules/_sections.md +29 -0
  24. package/skills/np-composition-patterns/rules/_template.md +24 -0
  25. package/skills/np-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
  26. package/skills/np-composition-patterns/rules/architecture-compound-components.md +112 -0
  27. package/skills/np-composition-patterns/rules/patterns-children-over-render-props.md +87 -0
  28. package/skills/np-composition-patterns/rules/patterns-explicit-variants.md +100 -0
  29. package/skills/np-composition-patterns/rules/react19-no-forwardref.md +42 -0
  30. package/skills/np-composition-patterns/rules/state-context-interface.md +191 -0
  31. package/skills/np-composition-patterns/rules/state-decouple-implementation.md +113 -0
  32. package/skills/np-composition-patterns/rules/state-lift-state.md +125 -0
  33. package/skills/np-council/SKILL.md +300 -0
  34. package/skills/np-design/SKILL.md +679 -0
  35. package/skills/np-frontend-design/LICENSE.txt +177 -0
  36. package/skills/np-frontend-design/SKILL.md +42 -0
  37. package/skills/np-high-end-visual-design/SKILL.md +98 -0
  38. package/skills/np-impeccable/SKILL.md +152 -0
  39. package/skills/np-impeccable/agents/openai.yaml +4 -0
  40. package/skills/np-impeccable/reference/adapt.md +190 -0
  41. package/skills/np-impeccable/reference/animate.md +173 -0
  42. package/skills/np-impeccable/reference/audit.md +134 -0
  43. package/skills/np-impeccable/reference/bolder.md +113 -0
  44. package/skills/np-impeccable/reference/brand.md +104 -0
  45. package/skills/np-impeccable/reference/clarify.md +174 -0
  46. package/skills/np-impeccable/reference/cognitive-load.md +106 -0
  47. package/skills/np-impeccable/reference/color-and-contrast.md +105 -0
  48. package/skills/np-impeccable/reference/colorize.md +154 -0
  49. package/skills/np-impeccable/reference/craft.md +138 -0
  50. package/skills/np-impeccable/reference/critique.md +213 -0
  51. package/skills/np-impeccable/reference/delight.md +302 -0
  52. package/skills/np-impeccable/reference/distill.md +111 -0
  53. package/skills/np-impeccable/reference/document.md +427 -0
  54. package/skills/np-impeccable/reference/extract.md +70 -0
  55. package/skills/np-impeccable/reference/harden.md +347 -0
  56. package/skills/np-impeccable/reference/heuristics-scoring.md +234 -0
  57. package/skills/np-impeccable/reference/interaction-design.md +195 -0
  58. package/skills/np-impeccable/reference/layout.md +141 -0
  59. package/skills/np-impeccable/reference/live.md +513 -0
  60. package/skills/np-impeccable/reference/motion-design.md +99 -0
  61. package/skills/np-impeccable/reference/onboard.md +234 -0
  62. package/skills/np-impeccable/reference/optimize.md +258 -0
  63. package/skills/np-impeccable/reference/overdrive.md +130 -0
  64. package/skills/np-impeccable/reference/personas.md +178 -0
  65. package/skills/np-impeccable/reference/polish.md +232 -0
  66. package/skills/np-impeccable/reference/product.md +62 -0
  67. package/skills/np-impeccable/reference/quieter.md +99 -0
  68. package/skills/np-impeccable/reference/responsive-design.md +114 -0
  69. package/skills/np-impeccable/reference/shape.md +136 -0
  70. package/skills/np-impeccable/reference/spatial-design.md +100 -0
  71. package/skills/np-impeccable/reference/teach.md +137 -0
  72. package/skills/np-impeccable/reference/typeset.md +124 -0
  73. package/skills/np-impeccable/reference/typography.md +159 -0
  74. package/skills/np-impeccable/reference/ux-writing.md +107 -0
  75. package/skills/np-impeccable/scripts/cleanup-deprecated.mjs +284 -0
  76. package/skills/np-impeccable/scripts/command-metadata.json +94 -0
  77. package/skills/np-impeccable/scripts/design-parser.mjs +820 -0
  78. package/skills/np-impeccable/scripts/detect-csp.mjs +198 -0
  79. package/skills/np-impeccable/scripts/is-generated.mjs +69 -0
  80. package/skills/np-impeccable/scripts/live-accept.mjs +465 -0
  81. package/skills/np-impeccable/scripts/live-browser.js +4684 -0
  82. package/skills/np-impeccable/scripts/live-inject.mjs +436 -0
  83. package/skills/np-impeccable/scripts/live-poll.mjs +187 -0
  84. package/skills/np-impeccable/scripts/live-server.mjs +679 -0
  85. package/skills/np-impeccable/scripts/live-wrap.mjs +395 -0
  86. package/skills/np-impeccable/scripts/live.mjs +247 -0
  87. package/skills/np-impeccable/scripts/load-context.mjs +93 -0
  88. package/skills/np-impeccable/scripts/modern-screenshot.umd.js +14 -0
  89. package/skills/np-impeccable/scripts/pin.mjs +214 -0
  90. package/skills/np-industrial-brutalist-ui/SKILL.md +92 -0
  91. package/skills/np-minimalist-ui/SKILL.md +85 -0
  92. package/skills/np-react-best-practices/AGENTS.md +3810 -0
  93. package/skills/np-react-best-practices/README.md +123 -0
  94. package/skills/np-react-best-practices/SKILL.md +149 -0
  95. package/skills/np-react-best-practices/metadata.json +15 -0
  96. package/skills/np-react-best-practices/rules/_sections.md +46 -0
  97. package/skills/np-react-best-practices/rules/_template.md +28 -0
  98. package/skills/np-react-best-practices/rules/advanced-effect-event-deps.md +56 -0
  99. package/skills/np-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  100. package/skills/np-react-best-practices/rules/advanced-init-once.md +42 -0
  101. package/skills/np-react-best-practices/rules/advanced-use-latest.md +39 -0
  102. package/skills/np-react-best-practices/rules/async-api-routes.md +38 -0
  103. package/skills/np-react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
  104. package/skills/np-react-best-practices/rules/async-defer-await.md +82 -0
  105. package/skills/np-react-best-practices/rules/async-dependencies.md +51 -0
  106. package/skills/np-react-best-practices/rules/async-parallel.md +28 -0
  107. package/skills/np-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  108. package/skills/np-react-best-practices/rules/bundle-analyzable-paths.md +63 -0
  109. package/skills/np-react-best-practices/rules/bundle-barrel-imports.md +60 -0
  110. package/skills/np-react-best-practices/rules/bundle-conditional.md +31 -0
  111. package/skills/np-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  112. package/skills/np-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  113. package/skills/np-react-best-practices/rules/bundle-preload.md +50 -0
  114. package/skills/np-react-best-practices/rules/client-event-listeners.md +74 -0
  115. package/skills/np-react-best-practices/rules/client-localstorage-schema.md +71 -0
  116. package/skills/np-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  117. package/skills/np-react-best-practices/rules/client-swr-dedup.md +56 -0
  118. package/skills/np-react-best-practices/rules/js-batch-dom-css.md +107 -0
  119. package/skills/np-react-best-practices/rules/js-cache-function-results.md +80 -0
  120. package/skills/np-react-best-practices/rules/js-cache-property-access.md +28 -0
  121. package/skills/np-react-best-practices/rules/js-cache-storage.md +70 -0
  122. package/skills/np-react-best-practices/rules/js-combine-iterations.md +32 -0
  123. package/skills/np-react-best-practices/rules/js-early-exit.md +50 -0
  124. package/skills/np-react-best-practices/rules/js-flatmap-filter.md +60 -0
  125. package/skills/np-react-best-practices/rules/js-hoist-regexp.md +45 -0
  126. package/skills/np-react-best-practices/rules/js-index-maps.md +37 -0
  127. package/skills/np-react-best-practices/rules/js-length-check-first.md +49 -0
  128. package/skills/np-react-best-practices/rules/js-min-max-loop.md +82 -0
  129. package/skills/np-react-best-practices/rules/js-request-idle-callback.md +105 -0
  130. package/skills/np-react-best-practices/rules/js-set-map-lookups.md +24 -0
  131. package/skills/np-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  132. package/skills/np-react-best-practices/rules/rendering-activity.md +26 -0
  133. package/skills/np-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  134. package/skills/np-react-best-practices/rules/rendering-conditional-render.md +40 -0
  135. package/skills/np-react-best-practices/rules/rendering-content-visibility.md +38 -0
  136. package/skills/np-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  137. package/skills/np-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  138. package/skills/np-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  139. package/skills/np-react-best-practices/rules/rendering-resource-hints.md +85 -0
  140. package/skills/np-react-best-practices/rules/rendering-script-defer-async.md +68 -0
  141. package/skills/np-react-best-practices/rules/rendering-svg-precision.md +28 -0
  142. package/skills/np-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  143. package/skills/np-react-best-practices/rules/rerender-defer-reads.md +39 -0
  144. package/skills/np-react-best-practices/rules/rerender-dependencies.md +45 -0
  145. package/skills/np-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  146. package/skills/np-react-best-practices/rules/rerender-derived-state.md +29 -0
  147. package/skills/np-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  148. package/skills/np-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  149. package/skills/np-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  150. package/skills/np-react-best-practices/rules/rerender-memo.md +44 -0
  151. package/skills/np-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  152. package/skills/np-react-best-practices/rules/rerender-no-inline-components.md +82 -0
  153. package/skills/np-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  154. package/skills/np-react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
  155. package/skills/np-react-best-practices/rules/rerender-transitions.md +40 -0
  156. package/skills/np-react-best-practices/rules/rerender-use-deferred-value.md +59 -0
  157. package/skills/np-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  158. package/skills/np-react-best-practices/rules/server-after-nonblocking.md +73 -0
  159. package/skills/np-react-best-practices/rules/server-auth-actions.md +96 -0
  160. package/skills/np-react-best-practices/rules/server-cache-lru.md +41 -0
  161. package/skills/np-react-best-practices/rules/server-cache-react.md +76 -0
  162. package/skills/np-react-best-practices/rules/server-dedup-props.md +65 -0
  163. package/skills/np-react-best-practices/rules/server-hoist-static-io.md +149 -0
  164. package/skills/np-react-best-practices/rules/server-no-shared-module-state.md +50 -0
  165. package/skills/np-react-best-practices/rules/server-parallel-fetching.md +83 -0
  166. package/skills/np-react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
  167. package/skills/np-react-best-practices/rules/server-serialization.md +38 -0
  168. package/skills/np-react-native-skills/AGENTS.md +2897 -0
  169. package/skills/np-react-native-skills/README.md +165 -0
  170. package/skills/np-react-native-skills/SKILL.md +121 -0
  171. package/skills/np-react-native-skills/metadata.json +16 -0
  172. package/skills/np-react-native-skills/rules/_sections.md +86 -0
  173. package/skills/np-react-native-skills/rules/_template.md +28 -0
  174. package/skills/np-react-native-skills/rules/animation-derived-value.md +53 -0
  175. package/skills/np-react-native-skills/rules/animation-gesture-detector-press.md +95 -0
  176. package/skills/np-react-native-skills/rules/animation-gpu-properties.md +65 -0
  177. package/skills/np-react-native-skills/rules/design-system-compound-components.md +66 -0
  178. package/skills/np-react-native-skills/rules/fonts-config-plugin.md +71 -0
  179. package/skills/np-react-native-skills/rules/imports-design-system-folder.md +68 -0
  180. package/skills/np-react-native-skills/rules/js-hoist-intl.md +61 -0
  181. package/skills/np-react-native-skills/rules/list-performance-callbacks.md +44 -0
  182. package/skills/np-react-native-skills/rules/list-performance-function-references.md +132 -0
  183. package/skills/np-react-native-skills/rules/list-performance-images.md +53 -0
  184. package/skills/np-react-native-skills/rules/list-performance-inline-objects.md +97 -0
  185. package/skills/np-react-native-skills/rules/list-performance-item-expensive.md +94 -0
  186. package/skills/np-react-native-skills/rules/list-performance-item-memo.md +82 -0
  187. package/skills/np-react-native-skills/rules/list-performance-item-types.md +104 -0
  188. package/skills/np-react-native-skills/rules/list-performance-virtualize.md +67 -0
  189. package/skills/np-react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
  190. package/skills/np-react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
  191. package/skills/np-react-native-skills/rules/navigation-native-navigators.md +188 -0
  192. package/skills/np-react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
  193. package/skills/np-react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
  194. package/skills/np-react-native-skills/rules/react-state-dispatcher.md +91 -0
  195. package/skills/np-react-native-skills/rules/react-state-fallback.md +56 -0
  196. package/skills/np-react-native-skills/rules/react-state-minimize.md +65 -0
  197. package/skills/np-react-native-skills/rules/rendering-no-falsy-and.md +74 -0
  198. package/skills/np-react-native-skills/rules/rendering-text-in-text-component.md +36 -0
  199. package/skills/np-react-native-skills/rules/scroll-position-no-state.md +82 -0
  200. package/skills/np-react-native-skills/rules/state-ground-truth.md +80 -0
  201. package/skills/np-react-native-skills/rules/ui-expo-image.md +66 -0
  202. package/skills/np-react-native-skills/rules/ui-image-gallery.md +104 -0
  203. package/skills/np-react-native-skills/rules/ui-measure-views.md +78 -0
  204. package/skills/np-react-native-skills/rules/ui-menus.md +174 -0
  205. package/skills/np-react-native-skills/rules/ui-native-modals.md +77 -0
  206. package/skills/np-react-native-skills/rules/ui-pressable.md +61 -0
  207. package/skills/np-react-native-skills/rules/ui-safe-area-scroll.md +65 -0
  208. package/skills/np-react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
  209. package/skills/np-react-native-skills/rules/ui-styling.md +87 -0
  210. package/skills/np-react-view-transitions/AGENTS.md +955 -0
  211. package/skills/np-react-view-transitions/README.md +42 -0
  212. package/skills/np-react-view-transitions/SKILL.md +320 -0
  213. package/skills/np-react-view-transitions/metadata.json +12 -0
  214. package/skills/np-react-view-transitions/references/css-recipes.md +242 -0
  215. package/skills/np-react-view-transitions/references/implementation.md +182 -0
  216. package/skills/np-react-view-transitions/references/nextjs.md +176 -0
  217. package/skills/np-react-view-transitions/references/patterns.md +262 -0
  218. package/skills/np-redesign-existing-projects/SKILL.md +178 -0
  219. package/skills/np-shadcn/SKILL.md +250 -0
  220. package/skills/np-shadcn/agents/openai.yml +5 -0
  221. package/skills/np-shadcn/assets/shadcn-small.png +0 -0
  222. package/skills/np-shadcn/assets/shadcn.png +0 -0
  223. package/skills/np-shadcn/cli.md +276 -0
  224. package/skills/np-shadcn/customization.md +209 -0
  225. package/skills/np-shadcn/evals/evals.json +47 -0
  226. package/skills/np-shadcn/mcp.md +94 -0
  227. package/skills/np-shadcn/rules/base-vs-radix.md +306 -0
  228. package/skills/np-shadcn/rules/composition.md +195 -0
  229. package/skills/np-shadcn/rules/forms.md +192 -0
  230. package/skills/np-shadcn/rules/icons.md +101 -0
  231. package/skills/np-shadcn/rules/styling.md +162 -0
  232. package/skills/np-stitch-design-taste/DESIGN.md +121 -0
  233. package/skills/np-stitch-design-taste/SKILL.md +184 -0
  234. package/skills/np-web-design-guidelines/SKILL.md +39 -0
  235. package/workflows/add-todo.md +5 -0
  236. package/workflows/discuss-phase.md +2 -0
  237. package/workflows/execute-phase.md +27 -0
  238. package/workflows/note.md +5 -0
  239. package/workflows/plan-phase.md +12 -0
  240. package/workflows/stats.md +27 -90
  241. package/workflows/verify-work.md +12 -0
@@ -0,0 +1,42 @@
1
+ # React View Transitions Skill
2
+
3
+ An agent skill for implementing smooth, native-feeling animations using React's View Transition API.
4
+
5
+ ## What This Skill Covers
6
+
7
+ - **`<ViewTransition>` component** — animation triggers (enter, exit, update, share), placement rules, View Transition Classes
8
+ - **`addTransitionType`** — tagging transitions for directional or context-specific animations
9
+ - **Shared element transitions** — morphing elements across different views
10
+ - **View Transition Events** — imperative JavaScript animations via the Web Animations API
11
+ - **CSS pseudo-elements** — `::view-transition-old`, `::view-transition-new`, `::view-transition-group`
12
+ - **Next.js integration** — `experimental.viewTransition`, the `transitionTypes` prop on `next/link`, App Router patterns
13
+ - **Accessibility** — `prefers-reduced-motion` handling
14
+ - **Ready-to-use CSS recipes** — fade, slide, scale, directional navigation
15
+
16
+ ## Skill Structure
17
+
18
+ ```
19
+ react-view-transitions/
20
+ ├── SKILL.md # Core skill (always loaded)
21
+ ├── AGENTS.md # Full compiled document (all references expanded)
22
+ └── references/
23
+ ├── implementation.md # Step-by-step implementation workflow
24
+ ├── patterns.md # Real-world patterns, events API, troubleshooting
25
+ ├── nextjs.md # Next.js-specific patterns
26
+ └── css-recipes.md # Copy-paste CSS animations
27
+ ```
28
+
29
+ ## Installation
30
+
31
+ Install via [skills.sh](https://skills.sh):
32
+
33
+ ```bash
34
+ npx skills install https://github.com/vercel-labs/react-view-transitions-skill
35
+ ```
36
+
37
+ ## Resources
38
+
39
+ - [React `<ViewTransition>` docs](https://react.dev/reference/react/ViewTransition)
40
+ - [React `addTransitionType` docs](https://react.dev/reference/react/addTransitionType)
41
+ - [Next.js `viewTransition` config](https://nextjs.org/docs/app/api-reference/config/next-config-js/viewTransition)
42
+ - [Next.js App Router Playground (view transitions)](https://github.com/vercel/next-app-router-playground/tree/main/app/view-transitions) — Vercel's reference implementation
@@ -0,0 +1,320 @@
1
+ ---
2
+ name: np-react-view-transitions
3
+ description: Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.
4
+ license: MIT
5
+ metadata:
6
+ author: vercel
7
+ version: "1.0.0"
8
+ ---
9
+
10
+ # React View Transitions
11
+
12
+ Animate between UI states using the browser's native `document.startViewTransition`. Declare *what* with `<ViewTransition>`, trigger *when* with `startTransition` / `useDeferredValue` / `Suspense`, control *how* with CSS classes. Unsupported browsers skip animations gracefully.
13
+
14
+ ## When to Animate
15
+
16
+ Every `<ViewTransition>` should communicate a spatial relationship or continuity. If you can't articulate what it communicates, don't add it.
17
+
18
+ Implement **all** applicable patterns from this list, in this order:
19
+
20
+ | Priority | Pattern | What it communicates |
21
+ |----------|---------|---------------------|
22
+ | 1 | **Shared element** (`name`) | "Same thing — going deeper" |
23
+ | 2 | **Suspense reveal** | "Data loaded" |
24
+ | 3 | **List identity** (per-item `key`) | "Same items, new arrangement" |
25
+ | 4 | **State change** (`enter`/`exit`) | "Something appeared/disappeared" |
26
+ | 5 | **Route change** (layout-level) | "Going to a new place" |
27
+
28
+ This is an implementation order, not a "pick one" list. Implement every pattern that fits the app. Only skip a pattern if the app has no use case for it.
29
+
30
+ ### Choosing Animation Style
31
+
32
+ | Context | Animation | Why |
33
+ |---------|-----------|-----|
34
+ | Hierarchical navigation (list → detail) | Type-keyed `nav-forward` / `nav-back` | Communicates spatial depth |
35
+ | Lateral navigation (tab-to-tab) | Bare `<ViewTransition>` (fade) or `default="none"` | No depth to communicate |
36
+ | Suspense reveal | `enter`/`exit` string props | Content arriving |
37
+ | Revalidation / background refresh | `default="none"` | Silent — no animation needed |
38
+
39
+ Reserve directional slides for hierarchical navigation (list → detail) and ordered sequences (prev/next photo, carousel, paginated results). For ordered sequences, the direction communicates position: "next" slides from right, "previous" from left. Lateral/unordered navigation (tab-to-tab) should not use directional slides — it falsely implies spatial depth.
40
+
41
+ ---
42
+
43
+ ## Availability
44
+
45
+ - **Next.js:** Do **not** install `react@canary` — the App Router already bundles React canary internally. `ViewTransition` works out of the box. `npm ls react` may show a stable-looking version; this is expected.
46
+ - **Without Next.js:** Install `react@canary react-dom@canary` (`ViewTransition` is not in stable React).
47
+ - Browser support: Chromium 111+, Firefox 144+, Safari 18.2+. Graceful degradation on unsupported browsers.
48
+
49
+ ---
50
+
51
+ ## Implementation Workflow
52
+
53
+ When adding view transitions to an existing app, **follow `references/implementation.md` step by step.** Start with the audit — do not skip it. Copy the CSS recipes from `references/css-recipes.md` into the global stylesheet — do not write your own animation CSS.
54
+
55
+ ---
56
+
57
+ ## Core Concepts
58
+
59
+ ### The `<ViewTransition>` Component
60
+
61
+ ```jsx
62
+ import { ViewTransition } from 'react';
63
+
64
+ <ViewTransition>
65
+ <Component />
66
+ </ViewTransition>
67
+ ```
68
+
69
+ React auto-assigns a unique `view-transition-name` and calls `document.startViewTransition` behind the scenes. Never call `startViewTransition` yourself.
70
+
71
+ ### Animation Triggers
72
+
73
+ | Trigger | When it fires |
74
+ |---------|--------------|
75
+ | **enter** | `<ViewTransition>` first inserted during a Transition |
76
+ | **exit** | `<ViewTransition>` first removed during a Transition |
77
+ | **update** | DOM mutations inside a `<ViewTransition>`. With nested VTs, mutation applies to the innermost one |
78
+ | **share** | Named VT unmounts and another with same `name` mounts in the same Transition |
79
+
80
+ Only `startTransition`, `useDeferredValue`, or `Suspense` activate VTs. Regular `setState` does not animate.
81
+
82
+ ### Critical Placement Rule
83
+
84
+ `<ViewTransition>` only activates enter/exit if it appears **before any DOM nodes**:
85
+
86
+ ```jsx
87
+ // Works
88
+ <ViewTransition enter="auto" exit="auto">
89
+ <div>Content</div>
90
+ </ViewTransition>
91
+
92
+ // Broken — div wraps the VT, suppressing enter/exit
93
+ <div>
94
+ <ViewTransition enter="auto" exit="auto">
95
+ <div>Content</div>
96
+ </ViewTransition>
97
+ </div>
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Styling with View Transition Classes
103
+
104
+ ### Props
105
+
106
+ Values: `"auto"` (browser cross-fade), `"none"` (disabled), `"class-name"` (custom CSS), or `{ [type]: value }` for type-specific animations.
107
+
108
+ ```jsx
109
+ <ViewTransition default="none" enter="slide-in" exit="slide-out" share="morph" />
110
+ ```
111
+
112
+ If `default` is `"none"`, all triggers are off unless explicitly listed.
113
+
114
+ ### CSS Pseudo-Elements
115
+
116
+ - `::view-transition-old(.class)` — outgoing snapshot
117
+ - `::view-transition-new(.class)` — incoming snapshot
118
+ - `::view-transition-group(.class)` — container
119
+ - `::view-transition-image-pair(.class)` — old + new pair
120
+
121
+ See `references/css-recipes.md` for ready-to-use animation recipes.
122
+
123
+ ---
124
+
125
+ ## Transition Types
126
+
127
+ Tag transitions with `addTransitionType` so VTs can pick different animations based on context. Call it multiple times to stack types — different VTs in the tree react to different types:
128
+
129
+ ```jsx
130
+ startTransition(() => {
131
+ addTransitionType('nav-forward');
132
+ addTransitionType('select-item');
133
+ router.push('/detail/1');
134
+ });
135
+ ```
136
+
137
+ Pass an object to map types to CSS classes. Works on `enter`, `exit`, **and** `share`:
138
+
139
+ ```jsx
140
+ <ViewTransition
141
+ enter={{ 'nav-forward': 'slide-from-right', 'nav-back': 'slide-from-left', default: 'none' }}
142
+ exit={{ 'nav-forward': 'slide-to-left', 'nav-back': 'slide-to-right', default: 'none' }}
143
+ share={{ 'nav-forward': 'morph-forward', 'nav-back': 'morph-back', default: 'morph' }}
144
+ default="none"
145
+ >
146
+ <Page />
147
+ </ViewTransition>
148
+ ```
149
+
150
+ `enter` and `exit` don't have to be symmetric. For example, fade in but slide out directionally:
151
+
152
+ ```jsx
153
+ <ViewTransition
154
+ enter={{ 'nav-forward': 'fade-in', 'nav-back': 'fade-in', default: 'none' }}
155
+ exit={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
156
+ default="none"
157
+ >
158
+ ```
159
+
160
+ **TypeScript:** `ViewTransitionClassPerType` requires a `default` key in the object.
161
+
162
+ For apps with multiple pages, extract the type-keyed VT into a reusable wrapper:
163
+
164
+ ```jsx
165
+ export function DirectionalTransition({ children }: { children: React.ReactNode }) {
166
+ return (
167
+ <ViewTransition
168
+ enter={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
169
+ exit={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
170
+ default="none"
171
+ >
172
+ {children}
173
+ </ViewTransition>
174
+ );
175
+ }
176
+ ```
177
+
178
+ ### `router.back()` and Browser Back Button
179
+
180
+ `router.back()` and the browser's back/forward buttons do **not** trigger view transitions (`popstate` is synchronous, incompatible with `startViewTransition`). Use `router.push()` with an explicit URL instead.
181
+
182
+ ### Types and Suspense
183
+
184
+ Types are available during navigation but **not** during subsequent Suspense reveals (separate transitions, no type). Use type maps for page-level enter/exit; use simple string props for Suspense reveals.
185
+
186
+ ---
187
+
188
+ ## Shared Element Transitions
189
+
190
+ Same `name` on two VTs — one unmounting, one mounting — creates a shared element morph:
191
+
192
+ ```jsx
193
+ <ViewTransition name="hero-image">
194
+ <img src="/thumb.jpg" onClick={() => startTransition(() => onSelect())} />
195
+ </ViewTransition>
196
+
197
+ // On the other view — same name
198
+ <ViewTransition name="hero-image">
199
+ <img src="/full.jpg" />
200
+ </ViewTransition>
201
+ ```
202
+
203
+ - Only one VT with a given `name` can be mounted at a time — use unique names (`photo-${id}`). Watch for reusable components: if a component with a named VT is rendered in both a modal/popover *and* a page, both mount simultaneously and break the morph. Either make the name conditional (via a prop) or move the named VT out of the shared component into the specific consumer.
204
+ - `share` takes precedence over `enter`/`exit`. Think through each navigation path: when no matching pair forms (e.g., the target page doesn't have the same name), `enter`/`exit` fires instead. Consider whether the element needs a fallback animation for those paths.
205
+ - Never use a fade-out exit on pages with shared morphs — use a directional slide instead.
206
+
207
+ ---
208
+
209
+ ## Common Patterns
210
+
211
+ ### Enter/Exit
212
+
213
+ ```jsx
214
+ {show && (
215
+ <ViewTransition enter="fade-in" exit="fade-out"><Panel /></ViewTransition>
216
+ )}
217
+ ```
218
+
219
+ ### List Reorder
220
+
221
+ ```jsx
222
+ {items.map(item => (
223
+ <ViewTransition key={item.id}><ItemCard item={item} /></ViewTransition>
224
+ ))}
225
+ ```
226
+
227
+ Trigger inside `startTransition`. Avoid wrapper `<div>`s between list and VT.
228
+
229
+ ### Composing Shared Elements with List Identity
230
+
231
+ Shared elements and list identity are independent concerns — don't confuse one for the other. When a list item contains a shared element (e.g., an image that morphs into a detail view), use two nested `<ViewTransition>` boundaries:
232
+
233
+ ```jsx
234
+ {items.map(item => (
235
+ <ViewTransition key={item.id}> {/* list identity */}
236
+ <Link href={`/items/${item.id}`}>
237
+ <ViewTransition name={`item-image-${item.id}`} share="morph"> {/* shared element */}
238
+ <Image src={item.image} />
239
+ </ViewTransition>
240
+ <p>{item.name}</p>
241
+ </Link>
242
+ </ViewTransition>
243
+ ))}
244
+ ```
245
+
246
+ The outer VT handles list reorder/enter animations. The inner VT handles the cross-route shared element morph. Missing either layer means that animation silently doesn't happen.
247
+
248
+ ### Force Re-Enter with `key`
249
+
250
+ ```jsx
251
+ <ViewTransition key={searchParams.toString()} enter="slide-up" default="none">
252
+ <ResultsGrid />
253
+ </ViewTransition>
254
+ ```
255
+
256
+ **Caution:** If wrapping `<Suspense>`, changing `key` remounts the boundary and refetches.
257
+
258
+ ### Suspense Fallback to Content
259
+
260
+ Simple cross-fade:
261
+ ```jsx
262
+ <ViewTransition>
263
+ <Suspense fallback={<Skeleton />}><Content /></Suspense>
264
+ </ViewTransition>
265
+ ```
266
+
267
+ Directional reveal:
268
+ ```jsx
269
+ <Suspense fallback={<ViewTransition exit="slide-down"><Skeleton /></ViewTransition>}>
270
+ <ViewTransition enter="slide-up" default="none"><Content /></ViewTransition>
271
+ </Suspense>
272
+ ```
273
+
274
+ For more patterns, see `references/patterns.md`.
275
+
276
+ ---
277
+
278
+ ## How Multiple VTs Interact
279
+
280
+ Every VT matching the trigger fires simultaneously in a single `document.startViewTransition`. VTs in **different** transitions (navigation vs later Suspense resolve) don't compete.
281
+
282
+ ### Use `default="none"` Liberally
283
+
284
+ Without it, every VT fires the browser cross-fade on **every** transition — Suspense resolves, `useDeferredValue` updates, background revalidations. Always use `default="none"` and explicitly enable only desired triggers.
285
+
286
+ ### Two Patterns Coexist
287
+
288
+ **Pattern A — Directional slides:** Type-keyed VT on each page, fires during navigation.
289
+ **Pattern B — Suspense reveals:** Simple string props, fires when data loads (no type).
290
+
291
+ They coexist because they fire at different moments. `default="none"` on both prevents cross-interference. Always pair `enter` with `exit`. Place directional VTs in page components, not layouts.
292
+
293
+ ### Nested VT Limitation
294
+
295
+ When a parent VT exits, nested VTs inside it do **not** fire their own enter/exit — only the outermost VT animates. Per-item staggered animations during page navigation are not possible today. See [react#36135](https://github.com/facebook/react/pull/36135) for an experimental opt-in fix.
296
+
297
+ ---
298
+
299
+ ## Next.js Integration
300
+
301
+ For Next.js setup (`experimental.viewTransition` flag, `transitionTypes` prop on `next/link`, App Router patterns, Server Components), see `references/nextjs.md`.
302
+
303
+ ---
304
+
305
+ ## Accessibility
306
+
307
+ Always add the reduced motion CSS from `references/css-recipes.md` to your global stylesheet.
308
+
309
+ ---
310
+
311
+ ## Reference Files
312
+
313
+ - **`references/implementation.md`** — Step-by-step implementation workflow.
314
+ - **`references/patterns.md`** — Patterns, animation timing, events API, troubleshooting.
315
+ - **`references/css-recipes.md`** — Ready-to-use CSS animation recipes.
316
+ - **`references/nextjs.md`** — Next.js App Router patterns and Server Component details.
317
+
318
+ ## Full Compiled Document
319
+
320
+ For the complete guide with all reference files expanded: `AGENTS.md`
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "organization": "Vercel Engineering",
4
+ "date": "March 2026",
5
+ "abstract": "Guide for implementing smooth, native-feeling animations using React's View Transition API. Covers the <ViewTransition> component, addTransitionType, CSS view transition pseudo-elements, shared element transitions, JavaScript animations via Web Animations API, and Next.js integration including the transitionTypes prop on next/link. Includes ready-to-use CSS animation recipes and real-world patterns from production Next.js apps.",
6
+ "references": [
7
+ "https://react.dev/reference/react/ViewTransition",
8
+ "https://react.dev/reference/react/addTransitionType",
9
+ "https://nextjs.org/docs/app/api-reference/config/next-config-js/viewTransition",
10
+ "https://github.com/vercel/next-app-router-playground/tree/main/app/view-transitions"
11
+ ]
12
+ }
@@ -0,0 +1,242 @@
1
+ # CSS Animation Recipes
2
+
3
+ Ready-to-use CSS for `<ViewTransition>` props. Copy into your global stylesheet.
4
+
5
+ ---
6
+
7
+ ## Timing Variables
8
+
9
+ ```css
10
+ :root {
11
+ --duration-exit: 150ms;
12
+ --duration-enter: 210ms;
13
+ --duration-move: 400ms;
14
+ }
15
+ ```
16
+
17
+ ### Shared Keyframes
18
+
19
+ ```css
20
+ @keyframes fade {
21
+ from { filter: blur(3px); opacity: 0; }
22
+ to { filter: blur(0); opacity: 1; }
23
+ }
24
+
25
+ @keyframes slide {
26
+ from { translate: var(--slide-offset); }
27
+ to { translate: 0; }
28
+ }
29
+
30
+ @keyframes slide-y {
31
+ from { transform: translateY(var(--slide-y-offset, 10px)); }
32
+ to { transform: translateY(0); }
33
+ }
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Fade
39
+
40
+ ```css
41
+ ::view-transition-old(.fade-out) {
42
+ animation: var(--duration-exit) ease-in fade reverse;
43
+ }
44
+ ::view-transition-new(.fade-in) {
45
+ animation: var(--duration-enter) ease-out var(--duration-exit) both fade;
46
+ }
47
+ ```
48
+
49
+ Usage: `<ViewTransition enter="fade-in" exit="fade-out" />`
50
+
51
+ ---
52
+
53
+ ## Slide (Vertical)
54
+
55
+ ```css
56
+ ::view-transition-old(.slide-down) {
57
+ animation:
58
+ var(--duration-exit) ease-out both fade reverse,
59
+ var(--duration-exit) ease-out both slide-y reverse;
60
+ }
61
+ ::view-transition-new(.slide-up) {
62
+ animation:
63
+ var(--duration-enter) ease-in var(--duration-exit) both fade,
64
+ var(--duration-move) ease-in both slide-y;
65
+ }
66
+ ```
67
+
68
+ Usage:
69
+ ```jsx
70
+ <Suspense fallback={<ViewTransition exit="slide-down"><Skeleton /></ViewTransition>}>
71
+ <ViewTransition default="none" enter="slide-up"><Content /></ViewTransition>
72
+ </Suspense>
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Directional Navigation
78
+
79
+ ### Separate Enter/Exit Classes
80
+
81
+ ```css
82
+ ::view-transition-new(.slide-from-right) {
83
+ --slide-offset: 60px;
84
+ animation:
85
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
86
+ var(--duration-move) ease-in-out both slide;
87
+ }
88
+ ::view-transition-old(.slide-to-left) {
89
+ --slide-offset: -60px;
90
+ animation:
91
+ var(--duration-exit) ease-in both fade reverse,
92
+ var(--duration-move) ease-in-out both slide reverse;
93
+ }
94
+
95
+ ::view-transition-new(.slide-from-left) {
96
+ --slide-offset: -60px;
97
+ animation:
98
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
99
+ var(--duration-move) ease-in-out both slide;
100
+ }
101
+ ::view-transition-old(.slide-to-right) {
102
+ --slide-offset: 60px;
103
+ animation:
104
+ var(--duration-exit) ease-in both fade reverse,
105
+ var(--duration-move) ease-in-out both slide reverse;
106
+ }
107
+ ```
108
+
109
+ ### Single-Class Approach
110
+
111
+ ```css
112
+ ::view-transition-old(.nav-forward) {
113
+ --slide-offset: -60px;
114
+ animation:
115
+ var(--duration-exit) ease-in both fade reverse,
116
+ var(--duration-move) ease-in-out both slide reverse;
117
+ }
118
+ ::view-transition-new(.nav-forward) {
119
+ --slide-offset: 60px;
120
+ animation:
121
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
122
+ var(--duration-move) ease-in-out both slide;
123
+ }
124
+
125
+ ::view-transition-old(.nav-back) {
126
+ --slide-offset: 60px;
127
+ animation:
128
+ var(--duration-exit) ease-in both fade reverse,
129
+ var(--duration-move) ease-in-out both slide reverse;
130
+ }
131
+ ::view-transition-new(.nav-back) {
132
+ --slide-offset: -60px;
133
+ animation:
134
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
135
+ var(--duration-move) ease-in-out both slide;
136
+ }
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Shared Element Morph
142
+
143
+ ```css
144
+ ::view-transition-group(.morph) {
145
+ animation-duration: var(--duration-move);
146
+ }
147
+
148
+ ::view-transition-image-pair(.morph) {
149
+ animation-name: via-blur;
150
+ }
151
+
152
+ @keyframes via-blur {
153
+ 30% { filter: blur(3px); }
154
+ }
155
+ ```
156
+
157
+ Usage: `<ViewTransition name={`product-${id}`} share="morph" />`
158
+
159
+ **Note:** Shared element transitions take raster snapshots. For text with significant size differences (e.g., `<h3>` → `<h1>`), the old snapshot gets scaled up, producing a visible ghost artifact. Use `text-morph` for text shared elements.
160
+
161
+ ## Text Morph
162
+
163
+ Avoids raster scaling artifacts on text by hiding the old snapshot and showing the new text at full resolution:
164
+
165
+ ```css
166
+ ::view-transition-group(.text-morph) {
167
+ animation-duration: var(--duration-move);
168
+ }
169
+ ::view-transition-old(.text-morph) {
170
+ display: none;
171
+ }
172
+ ::view-transition-new(.text-morph) {
173
+ animation: none;
174
+ object-fit: none;
175
+ object-position: left top;
176
+ }
177
+ ```
178
+
179
+ Usage: `<ViewTransition name={`title-${id}`} share="text-morph" />`
180
+
181
+ ---
182
+
183
+ ## Scale
184
+
185
+ ```css
186
+ ::view-transition-old(.scale-out) {
187
+ animation: var(--duration-exit) ease-in scale-down;
188
+ }
189
+ ::view-transition-new(.scale-in) {
190
+ animation: var(--duration-enter) ease-out var(--duration-exit) both scale-up;
191
+ }
192
+
193
+ @keyframes scale-down {
194
+ from { transform: scale(1); opacity: 1; }
195
+ to { transform: scale(0.85); opacity: 0; }
196
+ }
197
+ @keyframes scale-up {
198
+ from { transform: scale(0.85); opacity: 0; }
199
+ to { transform: scale(1); opacity: 1; }
200
+ }
201
+ ```
202
+
203
+ Usage: `<ViewTransition enter="scale-in" exit="scale-out" />`
204
+
205
+ ---
206
+
207
+ ## Persistent Element Isolation
208
+
209
+ ```css
210
+ ::view-transition-group(persistent-nav) {
211
+ animation: none;
212
+ z-index: 100;
213
+ }
214
+ ```
215
+
216
+ ### Backdrop-Blur Workaround
217
+
218
+ For elements with `backdrop-filter`, hide the old snapshot to avoid flash:
219
+
220
+ ```css
221
+ ::view-transition-old(persistent-nav) {
222
+ display: none;
223
+ }
224
+ ::view-transition-new(persistent-nav) {
225
+ animation: none;
226
+ }
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Reduced Motion
232
+
233
+ ```css
234
+ @media (prefers-reduced-motion: reduce) {
235
+ ::view-transition-old(*),
236
+ ::view-transition-new(*),
237
+ ::view-transition-group(*) {
238
+ animation-duration: 0s !important;
239
+ animation-delay: 0s !important;
240
+ }
241
+ }
242
+ ```