/** * @license MIT * * Copyright (c) 2025 Aiden Bai * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import { i as Fiber, m as ElementBounds, p as ElementAtPointOptions, r as StackFrame, t as copyContent } from "./copy-content-Dxdqj7pl.cjs"; import { n as OpenFileError, t as FreezeError } from "./errors-CTlIFDQs.cjs"; //#region src/utils/extract-element-css.d.ts declare const disposeBaselineStyles: () => void; //#endregion //#region src/core/three-selection.d.ts interface ThreeSceneRegistration { camera: object; pointer: object; raycaster: object; renderer: object; scene: object; } declare const registerThreeScene: (registration: ThreeSceneRegistration) => (() => void); //#endregion //#region src/primitives.d.ts interface ReactGrabElementContext { element: Element; snippet: string; htmlPreview: string; stackString: string; stack: StackFrame[]; componentName: string | null; filePath: string | null; lineNumber: number | null; columnNumber: number | null; fiber: Fiber | null; selector: string | null; styles: string; } /** * Returns whether an element is a useful selection target. Invisible elements, * document roots, React Grab UI, ignored subtrees, and transparent page-covering * overlays are excluded. */ declare const isElementGrabbable: (element: Element) => boolean; /** * Returns viewport bounds in the top-level window, including elements inside * transformed same-origin iframes. */ declare const getElementBounds: (element: Element) => ElementBounds; /** * Returns a stable selector, crossing open shadow roots and same-origin iframes * with `>>>` and `>>iframe>>` boundary markers. */ declare const getElementSelector: (element: Element) => string; /** * Gathers comprehensive context for a DOM element — the same context * React Grab copies to the clipboard, plus structured source location * and computed styles. * * @example * const ctx = await getElementContext(document.querySelector('.my-button')!); * ctx.snippet; // formatted text identical to React Grab's clipboard output * ctx.componentName; // "SubmitButton" * ctx.filePath; // "/src/components/Button.tsx" * ctx.lineNumber; // 12 */ declare const getElementContext: (element: Element) => Promise; /** * Returns the topmost selectable element at viewport coordinates. Hit testing * traverses open shadow roots and same-origin iframes and continues past * non-grabbable overlays. Pass a filter to replace the default grabbability * predicate or a container to confine selection to its composed subtree. * * @example * const element = getElementAtPoint(event.clientX, event.clientY, { * container: canvas, * filter: (candidate) => isElementGrabbable(candidate) && !toolbar.contains(candidate), * }); */ declare const getElementAtPoint: (clientX: number, clientY: number, options?: ElementAtPointOptions) => Element | null; /** * Returns every selectable element at viewport coordinates in paint order, * from topmost to bottommost. Uses the same shadow-root, iframe, filter, and * container behavior as `getElementAtPoint`. */ declare const getElementsAtPoint: (clientX: number, clientY: number, options?: ElementAtPointOptions) => Element[]; /** * Returns all elements at the given viewport coordinates, temporarily * suspending the pointer-events freeze so `elementsFromPoint` can * reach real elements underneath. * * @example * freeze(); * const elements = getElementsAtPosition(e.clientX, e.clientY); * // elements[0] is the topmost element under the cursor * * @deprecated Use `getElementsAtPoint` for selectable elements. Pass * `{ filter: () => true }` to preserve this function's raw-stack behavior. */ declare const getElementsAtPosition: (clientX: number, clientY: number) => Element[]; /** * Freezes the page by halting React updates, pausing CSS/JS animations, * and preserving pseudo-states (e.g. :hover, :focus) on the given elements. * * @example * freeze(); // freezes the entire page * freeze([document.querySelector('.modal')!]); // freezes only the modal subtree */ declare const freeze: (elements?: Element[]) => void; /** * Restores normal page behavior by re-enabling React updates, resuming * animations, and releasing preserved pseudo-states. * * @example * freeze(); * // ... capture a snapshot ... * unfreeze(); // page resumes normal behavior */ declare const unfreeze: () => void; /** * Returns whether the page is currently in a frozen state. * * @example * if (isFreezeActive()) { * console.log('Page is frozen, skipping update'); * } */ declare const isFreezeActive: () => boolean; /** * Opens the source file at the given path in the user's editor. * Tries the dev-server endpoint first (Vite / Next.js), then falls back * to a protocol URL (e.g. vscode://file/…). * * @example * openFile("/src/components/Button.tsx"); * openFile("/src/components/Button.tsx", 42); */ declare const openFile: (filePath: string, lineNumber?: number) => Promise; //#endregion export { type ElementAtPointOptions, type ElementBounds, FreezeError, OpenFileError, ReactGrabElementContext, type StackFrame, type ThreeSceneRegistration, copyContent, disposeBaselineStyles, freeze, getElementAtPoint, getElementBounds, getElementContext, getElementSelector, getElementsAtPoint, getElementsAtPosition, isElementGrabbable, isFreezeActive, openFile, registerThreeScene, unfreeze };