mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 15:10:06 +00:00
## Summary - Enable `verbatimModuleSyntax` compiler option in TypeScript configuration - Update all type imports to use explicit `import type` syntax - This change will Improve tree-shaking and bundler compatibility ## Motivation The `verbatimModuleSyntax` option ensures that type-only imports are explicitly marked with the `type` keyword. This: - Makes import/export intentions clearer - Improves tree-shaking by helping bundlers identify what can be safely removed - Ensures better compatibility with modern bundlers - Follows TypeScript best practices for module syntax ## Changes - Added `"verbatimModuleSyntax": true` to `tsconfig.json` - Updated another 48+ files to use explicit `import type` syntax for type-only imports - No functional changes, only import/export syntax improvements ## Test Plan - [x] TypeScript compilation passes - [x] Build completes successfully - [x] Tests pass - [ ] No runtime behavior changes 🤖 Generated with [Claude Code](https://claude.ai/code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5533-feat-enable-verbatimModuleSyntax-in-TypeScript-config-26d6d73d36508190b424ef9b379b5130) by [Unito](https://www.unito.io)
132 lines
2.9 KiB
TypeScript
132 lines
2.9 KiB
TypeScript
import * as THREE from 'three'
|
|
|
|
import { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
|
|
|
import { AnimationManager } from './AnimationManager'
|
|
import Load3d from './Load3d'
|
|
import { type Load3DOptions } from './interfaces'
|
|
|
|
class Load3dAnimation extends Load3d {
|
|
private animationManager: AnimationManager
|
|
|
|
constructor(
|
|
container: Element | HTMLElement,
|
|
options: Load3DOptions = {
|
|
node: {} as LGraphNode
|
|
}
|
|
) {
|
|
super(container, options)
|
|
|
|
this.animationManager = new AnimationManager(
|
|
this.eventManager,
|
|
this.getCurrentModel.bind(this)
|
|
)
|
|
|
|
this.animationManager.init()
|
|
|
|
this.overrideAnimationLoop()
|
|
}
|
|
|
|
private overrideAnimationLoop(): void {
|
|
if (this.animationFrameId !== null) {
|
|
cancelAnimationFrame(this.animationFrameId)
|
|
}
|
|
|
|
const animate = () => {
|
|
this.animationFrameId = requestAnimationFrame(animate)
|
|
|
|
if (!this.isActive()) {
|
|
return
|
|
}
|
|
|
|
const delta = this.clock.getDelta()
|
|
|
|
this.animationManager.update(delta)
|
|
|
|
this.viewHelperManager.update(delta)
|
|
|
|
this.controlsManager.update()
|
|
|
|
this.renderMainScene()
|
|
|
|
if (this.previewManager.showPreview) {
|
|
this.previewManager.renderPreview()
|
|
}
|
|
|
|
this.resetViewport()
|
|
|
|
if (this.viewHelperManager.viewHelper.render) {
|
|
this.viewHelperManager.viewHelper.render(this.renderer)
|
|
}
|
|
}
|
|
|
|
animate()
|
|
}
|
|
|
|
override async loadModel(
|
|
url: string,
|
|
originalFileName?: string
|
|
): Promise<void> {
|
|
await super.loadModel(url, originalFileName)
|
|
|
|
if (this.modelManager.currentModel) {
|
|
this.animationManager.setupModelAnimations(
|
|
this.modelManager.currentModel,
|
|
this.modelManager.originalModel
|
|
)
|
|
}
|
|
}
|
|
|
|
override clearModel(): void {
|
|
this.animationManager.dispose()
|
|
super.clearModel()
|
|
}
|
|
|
|
updateAnimationList(): void {
|
|
this.animationManager.updateAnimationList()
|
|
}
|
|
|
|
setAnimationSpeed(speed: number): void {
|
|
this.animationManager.setAnimationSpeed(speed)
|
|
}
|
|
|
|
updateSelectedAnimation(index: number): void {
|
|
this.animationManager.updateSelectedAnimation(index)
|
|
}
|
|
|
|
toggleAnimation(play?: boolean): void {
|
|
this.animationManager.toggleAnimation(play)
|
|
}
|
|
|
|
get isAnimationPlaying(): boolean {
|
|
return this.animationManager.isAnimationPlaying
|
|
}
|
|
|
|
get animationSpeed(): number {
|
|
return this.animationManager.animationSpeed
|
|
}
|
|
|
|
get selectedAnimationIndex(): number {
|
|
return this.animationManager.selectedAnimationIndex
|
|
}
|
|
|
|
get animationClips(): THREE.AnimationClip[] {
|
|
return this.animationManager.animationClips
|
|
}
|
|
|
|
get animationActions(): THREE.AnimationAction[] {
|
|
return this.animationManager.animationActions
|
|
}
|
|
|
|
get currentAnimation(): THREE.AnimationMixer | null {
|
|
return this.animationManager.currentAnimation
|
|
}
|
|
|
|
override remove(): void {
|
|
this.animationManager.dispose()
|
|
super.remove()
|
|
}
|
|
}
|
|
|
|
export default Load3dAnimation
|