//#region src/utils/elements-chain.d.ts /** * PostHog-style `elements_chain` format — the single owner of both halves of the * contract. The event tracker {@link buildElementsChain serializes} a clicked * element (and its ancestors) into a string; the clickmap overlay * {@link parseElementsChain parses} that string back into structured segments so * it can re-locate the element in a live DOM. * * Encode and decode MUST round-trip exactly, which is why they live together: * the escaping applied here on the write side is reversed by the parser below, * and a single round-trip test in `elements-chain.test.tsx` guards the pair. * * Segment shape (leaf-first, joined by `;`): * tag.class1.class2:nth-child="2":nth-of-type="1":text="Save":attr__id="x":href="..." */ type ElementsChainSegment = { tag: string; classes: string[]; attrs: Record; text: string | null; nthChild: number | null; nthOfType: number | null; href: string | null; }; declare const ELEMENTS_CHAIN_MAX_DEPTH = 8; declare const ELEMENTS_CHAIN_TEXT_MAX = 80; declare const ELEMENTS_CHAIN_ATTR_MAX = 200; declare const ELEMENTS_CHAIN_ATTRS: readonly ["id", "data-testid", "data-test-id", "data-hexclave-id", "name", "type", "role", "aria-label", "placeholder", "title"]; /** * Serialise a clicked element and up to {@link ELEMENTS_CHAIN_MAX_DEPTH} * ancestors (leaf-first) into an `elements_chain` string. */ declare function buildElementsChain(element: Element): string; /** Parse an `elements_chain` string into structured, leaf-first segments. */ declare function parseElementsChain(chain: string): ElementsChainSegment[]; //#endregion export { ELEMENTS_CHAIN_ATTRS, ELEMENTS_CHAIN_ATTR_MAX, ELEMENTS_CHAIN_MAX_DEPTH, ELEMENTS_CHAIN_TEXT_MAX, ElementsChainSegment, buildElementsChain, parseElementsChain }; //# sourceMappingURL=elements-chain.d.ts.map