✨ feat(core): 实现详情面板动画逻辑并完善相关测试

* 新增 detailMotion 工具类以支持更精细的动画控制
* 优化 FileManageView 面板渲染逻辑,改用 v-show 提升交互性能
* 调整 Transition 组件为手动控制模式以适配自定义动画
* 在 package.json 中配置自动化测试脚本
* 补充 detailMotion 相关的单元测试与测试说明文档
This commit is contained in:
orion committed 2026-09-15 11:25:43 +08:00
1 parent 9bac0c0040
commit af009cf3c5
6 files changed
+307 -138

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
/** Own only detail animations; release filled effects before returning to auto layout. */
export function createDetailMotion(reducedMotion: () => boolean) {
const active = new Map<HTMLElement, () => void>()
const cancel = (element: HTMLElement) => active.get(element)?.()
const play = (
element: HTMLElement,
keyframes: Keyframe[],
options: KeyframeAnimationOptions,
done: () => void
) => {
cancel(element)
if (reducedMotion()) {
done()
return
}
const animation = element.animate(keyframes, { fill: 'both', ...options })
const settle = () => {
animation.removeEventListener('finish', settle)
animation.removeEventListener('cancel', settle)
active.delete(element)
animation.cancel()
done()
}
active.set(element, settle)
animation.addEventListener('finish', settle, { once: true })
animation.addEventListener('cancel', settle, { once: true })
}
const dispose = () => [...active.values()].forEach(settle => settle())
return { play, cancel, dispose }
}