用途:审查 Motion(Framer Motion)代码中 AnimatePresence 及退出动画的写法,适用于检查模态框、条件渲染元素和存在状态(presence)相关动画。
主要能力:按四类规则(退出动画、presence 钩子、mode 选择、嵌套退出)检查指定文件,并以 file:line 格式输出问题,附规则、数量与严重程度汇总表。规则包括:条件渲染的 motion 元素须包在 AnimatePresence 内(exit-requires-wrapper);AnimatePresence 内元素应定义 exit(exit-prop-required);动态列表需唯一 key(exit-key-required);exit 宜与 initial 对称(exit-matches-initial);useIsPresent 须在 AnimatePresence 子组件中调用(presence-hook-in-child);usePresence 异步后应调用 safeToRemove(presence-safe-to-remove);退出元素应禁用交互(presence-disable-interactions);mode="wait" 会使时长近乎翻倍(mode-wait-doubles-duration);mode="sync" 易造成布局冲突,列表重排宜用 popLayout(mode-sync-layout-conflict、mode-pop-layout-for-lists);嵌套 AnimatePresence 需用 propagate(nested-propagate-required);父子退出时长应协调(nested-consistent-timing)。
使用方式:读取指定文件或按用户提供的文件/匹配模式,逐条对照规则检查,输出 findings 与汇总表。
限制:简介未提供安装命令、依赖版本、平台或收费信息;具体运行方式以技能所在页面为准。