| 23 | }; |
| 24 | |
| 25 | export class BaseAnimationRenderer implements Renderer2 { |
| 26 | readonly ɵtype = AnimationRendererType.Regular; |
| 27 | |
| 28 | constructor( |
| 29 | protected namespaceId: string, |
| 30 | public delegate: Renderer2, |
| 31 | public engine: AnimationEngine, |
| 32 | private _onDestroy?: () => void, |
| 33 | ) {} |
| 34 | |
| 35 | get data() { |
| 36 | return this.delegate.data; |
| 37 | } |
| 38 | |
| 39 | destroyNode(node: any): void { |
| 40 | this.delegate.destroyNode?.(node); |
| 41 | } |
| 42 | |
| 43 | destroy(): void { |
| 44 | this.engine.destroy(this.namespaceId, this.delegate); |
| 45 | this.engine.afterFlushAnimationsDone(() => { |
| 46 | // Call the renderer destroy method after the animations has finished as otherwise |
| 47 | // styles will be removed too early which will cause an unstyled animation. |
| 48 | queueMicrotask(() => { |
| 49 | this.delegate.destroy(); |
| 50 | }); |
| 51 | }); |
| 52 | |
| 53 | this._onDestroy?.(); |
| 54 | } |
| 55 | |
| 56 | createElement(name: string, namespace?: string | null | undefined) { |
| 57 | return this.delegate.createElement(name, namespace); |
| 58 | } |
| 59 | |
| 60 | createComment(value: string) { |
| 61 | return this.delegate.createComment(value); |
| 62 | } |
| 63 | |
| 64 | createText(value: string) { |
| 65 | return this.delegate.createText(value); |
| 66 | } |
| 67 | |
| 68 | appendChild(parent: any, newChild: any): void { |
| 69 | this.delegate.appendChild(parent, newChild); |
| 70 | this.engine.onInsert(this.namespaceId, newChild, parent, false); |
| 71 | } |
| 72 | |
| 73 | insertBefore(parent: any, newChild: any, refChild: any, isMove: boolean = true): void { |
| 74 | this.delegate.insertBefore(parent, newChild, refChild); |
| 75 | // If `isMove` true than we should animate this insert. |
| 76 | this.engine.onInsert(this.namespaceId, newChild, parent, isMove); |
| 77 | } |
| 78 | |
| 79 | // TODO(thePunderWoman): remove the requireSynchronousElementRemoval flag after the |
| 80 | // animations package has been fully deleted post v23. |
| 81 | removeChild( |
| 82 | parent: any, |
nothing calls this directly
no outgoing calls
no test coverage detected