@@ -4,34 +4,34 @@ import { HostElement } from '../renderer/host-element';
44 * Checks if the given element is a host element.
55 * @param element The element to check.
66 */
7- export function isHostElement ( element ?: HostElement | null ) : element is HostElement {
7+ export function isValidElement ( element ?: HostElement | null ) : element is HostElement {
88 return typeof element ?. type === 'string' && element . type !== 'CONTAINER' ;
99}
1010
11- /**
12- * Returns host siblings for given element.
13- * @param element The element start traversing from.
14- */
15- export function getHostSiblings ( element : HostElement | null ) : HostElement [ ] {
16- const hostParent = element ?. parent ?? null ;
17- return (
18- hostParent ?. children . filter (
19- ( sibling ) : sibling is HostElement => typeof sibling === 'object' && sibling !== element ,
20- ) ?? [ ]
21- ) ;
22- }
23-
2411/**
2512 * Returns the unsafe root element of the tree (probably composite).
2613 *
2714 * @param element The element start traversing from.
2815 * @returns The root element of the tree (host or composite).
2916 */
30- export function getUnsafeRootElement ( element : HostElement ) {
17+ export function getRootElement ( element : HostElement ) {
3118 let current : HostElement | null = element ;
3219 while ( current ?. parent ) {
3320 current = current . parent ;
3421 }
3522
3623 return current ;
3724}
25+
26+ /**
27+ * Returns host siblings for given element.
28+ * @param element The element start traversing from.
29+ */
30+ export function getHostSiblings ( element : HostElement | null ) : HostElement [ ] {
31+ const hostParent = element ?. parent ?? null ;
32+ return (
33+ hostParent ?. children . filter (
34+ ( sibling ) : sibling is HostElement => typeof sibling === 'object' && sibling !== element ,
35+ ) ?? [ ]
36+ ) ;
37+ }
0 commit comments