UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

43 lines (42 loc) 3 kB
import type { Predicate } from '../misc/functions'; /** Checks if element matches passed selector or exact predicate function */ export declare const isMatches: (el: Element, matcher?: string | ((el: Element) => boolean)) => boolean; /** Safely checks if the target element is within the container element */ export declare const isSafeContains: (container: Node | null | undefined, element: Node | null | undefined) => boolean; /** Checks that `nodeA` and `nodeB` are from the same tree path */ export declare function isRelativeNode(nodeA: null | undefined, nodeB: Node | null | undefined): false; /** Checks that `nodeA` and `nodeB` are from the same tree path */ export declare function isRelativeNode(nodeA: Node | null | undefined, nodeB: null | undefined): false; /** Checks that `nodeA` and `nodeB` are from the same tree path */ export declare function isRelativeNode(nodeA: Node | null | undefined, nodeB: Node | null | undefined): boolean; type IteratorFn = (el: Element) => Element | null; /** Creates function that finds next dom element, that matches selector, in the sequence declared by `next` function */ export declare const createSequenceFinder: (next: IteratorFn, includeSelf?: boolean) => (base: Element, predicate: string | Predicate<Element>) => Element | null; /** @returns first matching next sibling or null*/ export declare const findNext: (base: Element, predicate: string | Predicate<Element>) => Element | null; /** @returns first matching previous sibling or null*/ export declare const findPrev: (base: Element, predicate: string | Predicate<Element>) => Element | null; /** @returns first matching parent or null*/ export declare const findParent: (base: Element, predicate: string | Predicate<Element>) => Element | null; /** @returns first matching ancestor starting from passed element or null*/ export declare const findClosest: (base: Element, predicate: string | Predicate<Element>) => Element | null; /** @returns first matching host element starting from passed element*/ export declare const findHost: (base: Element, predicate: string | Predicate<Element>) => Element | null; /** @returns Array of all matching elements in subtree or empty array */ export declare const findAll: (base: Element, sel: string) => Element[]; /** @returns Array of all matching children or empty array */ export declare const findChildren: (base: Element, sel: string) => Element[]; /** * Finds closest parent node of `node` by `predicate`. * Optional `skipSelf` to skip initial node */ export declare const findClosestBy: (node: Node | null, predicate: (node: Node) => boolean, skipSelf?: boolean) => Node | null; /** * Finds looped next element within parent circle */ export declare const findNextLooped: (base: Element, predicate: string | Predicate<Element>) => Element | null; /** * Finds looped previous element within parent circle (looped) */ export declare const findPrevLooped: (base: Element, predicate: string | Predicate<Element>) => Element | null; export {};