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