UNPKG

app-walkthrough

Version:

An intuitive guided walkthrough library with UI highlighting and voice narration for web apps.

21 lines (20 loc) 1.09 kB
import { TSelector } from "../dataTypes"; /** * 在给定的 scope 范围内,按照 selectors 链式查找目标元素 */ export declare function findElement(selectors: TSelector[], scope: ParentNode): HTMLElement | HTMLInputElement | undefined; /** * 根据 selector 和作用域 scope 查找元素,支持根据文本内容过滤和索引选择 * * 逻辑说明: * 1. 通过 convertToCss 将 TSelector 转换为 CSS 选择器字符串 * 2. 在 scope 中查找所有匹配该选择器的元素 * 3. 如果 selector 中提供了 text,则先筛选出包含该文本内容的元素(默认忽略大小写) * 4. 使用 selector.index(默认0)选取筛选结果中的第几个元素 * 5. 返回该元素,如果找不到则返回 undefined */ export declare function resolveElement(selector: TSelector, scope: ParentNode): HTMLElement | HTMLInputElement | undefined; /** * 判断元素的 textContent 是否包含指定文本,支持忽略大小写 */ export declare function hasTextContent(el: HTMLElement | undefined, text: string, caseSensitive?: boolean): boolean;