* Determines the position of the element being removed. * @param el - The element being deleted * @returns
( el: Element, )
| 805 | * @returns |
| 806 | */ |
| 807 | function deletePosition( |
| 808 | el: Element, |
| 809 | ): [top: number, left: number, width: number, height: number] { |
| 810 | const oldCoords = coords.get(el)! |
| 811 | const [width, , height] = getTransitionSizes(el, oldCoords, getCoords(el)) |
| 812 | |
| 813 | let offsetParent: Element | null = (el as HTMLElement).parentElement |
| 814 | while ( |
| 815 | offsetParent && |
| 816 | (getComputedStyle(offsetParent).position === "static" || |
| 817 | offsetParent instanceof HTMLBodyElement) |
| 818 | ) { |
| 819 | offsetParent = (offsetParent as HTMLElement).parentElement |
| 820 | } |
| 821 | if (!offsetParent) offsetParent = document.body |
| 822 | const parentStyles = getComputedStyle(offsetParent) |
| 823 | const parentCoords = |
| 824 | !animations.has(el) || animations.get(el)?.playState === "finished" |
| 825 | ? getCoords(offsetParent) |
| 826 | : coords.get(offsetParent)! |
| 827 | |
| 828 | const top = |
| 829 | Math.round(oldCoords.top - parentCoords.top) - |
| 830 | raw(parentStyles.borderTopWidth) |
| 831 | const left = |
| 832 | Math.round(oldCoords.left - parentCoords.left) - |
| 833 | raw(parentStyles.borderLeftWidth) |
| 834 | return [top, left, width, height] |
| 835 | } |
| 836 | |
| 837 | export interface AutoAnimateOptions { |
| 838 | /** |
no test coverage detected
searching dependent graphs…