/** * @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. */ //#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/reactive/observable.d.ts declare global { interface SymbolConstructor { readonly observable: symbol; } } //#endregion //#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/index.d.ts declare global { var Solid$$: boolean; } //#endregion //#region src/types.d.ts interface Position { x: number; y: number; } type DeepPartial = { [P in keyof T]?: T[P] extends object ? T[P] extends ((...args: unknown[]) => unknown) ? T[P] : DeepPartial : T[P] }; interface Theme { /** * Globally toggle the entire overlay * @default true */ enabled?: boolean; /** * Base hue (0-360) used to generate colors throughout the interface using HSL color space * @default 0 */ hue?: number; /** * The highlight box that appears when hovering over an element before selecting it */ selectionBox?: { /** * Whether to show the selection highlight * @default true */ enabled?: boolean; }; /** * The rectangular selection area that appears when clicking and dragging to select multiple elements */ dragBox?: { /** * Whether to show the drag selection box * @default true */ enabled?: boolean; }; /** * Brief flash/highlight boxes that appear on elements immediately after they're successfully grabbed/copied */ grabbedBoxes?: { /** * Whether to show these success flash effects * @default true */ enabled?: boolean; }; /** * The floating label that follows the cursor showing information about the currently hovered element */ elementLabel?: { /** * Whether to show the label * @default true */ enabled?: boolean; }; /** * The floating toolbar that allows toggling React Grab activation */ toolbar?: { /** * Whether to show the toolbar * @default true */ enabled?: boolean; }; } interface ReactGrabState { isActive: boolean; isDragging: boolean; isCopying: boolean; isPromptMode: boolean; isSelectionBoxVisible: boolean; isDragBoxVisible: boolean; targetElement: Element | null; dragBounds: DragRect | null; /** * Currently visible grabbed boxes (success flash effects). * These are temporary visual indicators shown after elements are grabbed/copied. */ grabbedBoxes: Array<{ id: string; bounds: OverlayBounds; createdAt: number; }>; labelInstances: Array<{ id: string; status: SelectionLabelStatus; tagName: string; componentName?: string; createdAt: number; }>; selectionFilePath: string | null; toolbarState: ToolbarState | null; } type ElementLabelVariant = "hover" | "processing" | "success"; interface PromptModeContext { x: number; y: number; targetElement: Element | null; } interface ElementLabelContext { x: number; y: number; content: string; element?: Element; tagName?: string; componentName?: string; filePath?: string; lineNumber?: number; } type ActivationKey = string | ((event: KeyboardEvent) => boolean); interface AgentContext { content: string[]; prompt: string; options?: T; sessionId?: string; } type ActivationMode = "toggle" | "hold"; interface ActionContextHooks { transformHtmlContent: (html: string, elements: Element[]) => Promise; onOpenFile: (filePath: string, lineNumber?: number) => boolean | void; transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string; } interface ActionContext { element: Element; elements: Element[]; filePath?: string; lineNumber?: number; componentName?: string; tagName?: string; enterPromptMode?: () => void; hooks: ActionContextHooks; performWithFeedback: (action: () => Promise) => Promise; hideContextMenu: () => void; cleanup: () => void; } interface ContextMenuActionContext extends ActionContext { copy?: () => void; enterEditMode?: () => void; } interface EditablePropertyBase { key: string; label: string; cssProperties: readonly string[]; tailwindAliases: string[]; isPrioritized: boolean; isDefault: boolean; isCanonical: boolean; } interface NumericEditableProperty extends EditablePropertyBase { kind: "numeric"; min: number; max: number; value: number; original: number; unit: string; } interface ColorEditableProperty extends EditablePropertyBase { kind: "color"; value: string; original: string; } interface EnumEditableOption { value: string; label: string; } interface EnumEditableProperty extends EditablePropertyBase { kind: "enum"; value: string; original: string; options: ReadonlyArray; } type EditableProperty = NumericEditableProperty | ColorEditableProperty | EnumEditableProperty; interface NumericPendingEdit { kind: "numeric"; key: string; cssProperties: readonly string[]; value: number; unit: string; } interface ColorPendingEdit { kind: "color"; key: string; cssProperties: readonly string[]; value: string; } interface EnumPendingEdit { kind: "enum"; key: string; cssProperties: readonly string[]; value: string; } type PendingEdit = NumericPendingEdit | ColorPendingEdit | EnumPendingEdit; type PendingEdits = PendingEdit[]; interface PreviewStyles { apply: (cssProperties: readonly string[], cssValue: string) => void; restore: () => void; hasAppliedStyles: () => boolean; } interface EditPanelState { element: Element; position: Position; selectionBounds: OverlayBounds; properties: EditableProperty[]; preview: PreviewStyles; filePath?: string; lineNumber?: number; componentName?: string; tagName?: string; htmlPreview?: string; initialSearchQuery?: string; hasSessionEdits?: boolean; } interface ContextMenuAction { id: string; label: string; shortcut?: string; shortcutModifier?: boolean; showInToolbarMenu?: boolean; enabled?: boolean | ((context: ActionContext) => boolean); onAction: (context: ContextMenuActionContext) => void | Promise; } interface ArrowNavigationItem { tagName: string; componentName?: string; } interface ArrowNavigationState { items: ArrowNavigationItem[]; activeIndex: number; isVisible: boolean; } interface PluginHooks { onActivate?: () => void; onDeactivate?: () => void; onElementHover?: (element: Element) => void; onElementSelect?: (element: Element) => boolean | void | Promise; onDragStart?: (startX: number, startY: number) => void; onDragEnd?: (elements: Element[], bounds: DragRect) => void; onBeforeCopy?: (elements: Element[]) => void | Promise; transformCopyContent?: (content: string, elements: Element[]) => string | Promise; onAfterCopy?: (elements: Element[], success: boolean) => void; onCopySuccess?: (elements: Element[], content: string) => void; onCopyError?: (error: Error) => void; onStateChange?: (state: ReactGrabState) => void; onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void; onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void; onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void; onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void; onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void; onContextMenu?: (element: Element, position: Position) => void; onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void; transformHtmlContent?: (html: string, elements: Element[]) => string | Promise; transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise; transformActionContext?: (context: ActionContext) => ActionContext; transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string; } interface PluginConfig { theme?: DeepPartial; options?: SettableOptions; actions?: ContextMenuAction[]; hooks?: PluginHooks; cleanup?: () => void; } interface Plugin { name: string; theme?: DeepPartial; options?: SettableOptions; actions?: ContextMenuAction[]; hooks?: PluginHooks; setup?: (api: ReactGrabAPI, hooks: ActionContextHooks) => PluginConfig | void; } interface Options { enabled?: boolean; activationMode?: ActivationMode; keyHoldDuration?: number; allowActivationInsideInput?: boolean; activationKey?: ActivationKey; getContent?: (elements: Element[]) => Promise | string; /** * Maximum number of source-location lines included in the copied / prompted * context for a grabbed element. Larger apps often render a target through * several wrapper components, so the compact default can point an agent at a * wrapper instead of the meaningful surface. Raise this to opt into a deeper, * more detailed trace. Low-signal library frames are always surfaced for free * and never count against this budget. * @default 3 */ maxContextLines?: number; /** * Whether to freeze React state updates while React Grab is active. * This prevents UI changes from interfering with element selection. * @default true */ freezeReactUpdates?: boolean; /** * Whether to send the anonymous version check to react-grab.com on init. * Set to false to skip the version-check request. * @default true */ telemetry?: boolean; } interface SettableOptions extends Options { enabled?: never; telemetry?: never; } interface SourceInfo { filePath: string; lineNumber: number | null; componentName: string | null; } interface ToolbarState { edge: "top" | "bottom" | "left" | "right"; ratio: number; collapsed: boolean; enabled: boolean; defaultAction?: string; } interface DropdownAnchor { x: number; y: number; edge: ToolbarState["edge"]; } interface ReactGrabAPI { activate: () => void; deactivate: () => void; toggle: () => void; comment: () => void; isActive: () => boolean; isEnabled: () => boolean; setEnabled: (enabled: boolean) => void; getToolbarState: () => ToolbarState | null; setToolbarState: (state: Partial) => void; onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void; dispose: () => void; copyElement: (elements: Element | Element[]) => Promise; getSource: (element: Element) => Promise; getStackContext: (element: Element) => Promise; getState: () => ReactGrabState; setOptions: (options: SettableOptions) => void; registerPlugin: (plugin: Plugin) => void; unregisterPlugin: (name: string) => void; getPlugins: () => string[]; getDisplayName: (element: Element) => string | null; } interface OverlayBounds { borderRadius: string; height: number; width: number; x: number; y: number; } type SelectionLabelStatus = "idle" | "copying" | "copied" | "fading" | "error"; interface SelectionLabelInstance { id: string; bounds: OverlayBounds; boundsMultiple?: OverlayBounds[]; tagName: string; componentName?: string; elementsCount?: number; status: SelectionLabelStatus; statusText?: string; isPromptMode?: boolean; inputValue?: string; createdAt: number; element?: Element; elements?: Element[]; mouseX?: number; mouseXOffsetFromCenter?: number; mouseXOffsetRatio?: number; errorMessage?: string; hideArrow?: boolean; } interface FrozenLabelEntry { tagName: string; componentName?: string; bounds: OverlayBounds; mouseX?: number; } interface ReactGrabRendererProps { selectionVisible?: boolean; selectionBounds?: OverlayBounds; selectionBoundsMultiple?: OverlayBounds[]; selectionShouldSnap?: boolean; selectionElementsCount?: number; frozenLabelEntries?: FrozenLabelEntry[]; pendingShiftPreviewEntry?: FrozenLabelEntry; selectionFilePath?: string; selectionLineNumber?: number; selectionTagName?: string; selectionComponentName?: string; selectionLabelVisible?: boolean; selectionLabelStatus?: SelectionLabelStatus; selectionArrowNavigationState?: ArrowNavigationState; onArrowNavigationSelect?: (index: number) => void; labelInstances?: SelectionLabelInstance[]; dragVisible?: boolean; dragBounds?: OverlayBounds; grabbedBoxes?: Array<{ id: string; bounds: OverlayBounds; createdAt: number; }>; mouseX?: number; isFrozen?: boolean; inputValue?: string; isPromptMode?: boolean; onShowContextMenuInstance?: (instanceId: string) => void; onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void; onInputChange?: (value: string) => void; onInputSubmit?: () => void; onToggleExpand?: () => void; selectionLabelShakeCount?: number; onConfirmDismiss?: () => void; discardPrompt?: SelectionDiscardPrompt; toolbarVisible?: boolean; isActive?: boolean; onToggleActive?: () => void; onActivateAction?: (actionId: string) => void; activeActionId?: string | null; enabled?: boolean; shakeCount?: number; onToolbarStateChange?: (state: ToolbarState) => void; onSubscribeToToolbarStateChanges?: (callback: (state: ToolbarState) => void) => () => void; onToolbarSelectHoverChange?: (isHovered: boolean) => void; onToolbarRef?: (element: HTMLDivElement) => void; contextMenuPosition?: Position | null; contextMenuBounds?: OverlayBounds | null; contextMenuTagName?: string; contextMenuComponentName?: string; contextMenuHasFilePath?: boolean; actions?: ContextMenuAction[]; actionContext?: ActionContext; onContextMenuDismiss?: () => void; onContextMenuHide?: () => void; toolbarMenuPosition?: DropdownAnchor | null; toolbarMenuActions?: ContextMenuAction[]; defaultActionId?: string; onSetDefaultAction?: (actionId: string) => void; onToggleToolbarMenu?: () => void; onToolbarMenuDismiss?: () => void; editPanelState?: EditPanelState | null; editPanelPosition?: DropdownAnchor | null; onEditPanelDismiss?: () => void; onEditPanelSubmit?: (pendingEdits: PendingEdits) => void; onEditPanelPendingEditsChange?: (pendingEdits: PendingEdits) => void; onEditPanelInteractingChange?: (interacting: boolean) => void; } interface GrabbedBox { id: string; bounds: OverlayBounds; createdAt: number; element?: Element; } interface Rect { left: number; top: number; right: number; bottom: number; } interface DragRect { x: number; y: number; width: number; height: number; } interface SelectionDiscardPrompt { isKeyboardSelection?: boolean; label?: string; cancelOnEscape?: boolean; onConfirm?: () => void; onCancel?: () => void; onCopy?: () => void; } interface SourceLocation extends SourceInfo { columnNumber: number | null; } interface ReactGrabStackFrame { functionName?: string; fileName?: string; lineNumber?: number; columnNumber?: number; isServer?: boolean; isSymbolicated?: boolean; } interface ReactGrabEntry { tagName?: string; componentName?: string; content: string; commentText?: string; source?: SourceLocation | null; stackContext?: string; frames?: ReactGrabStackFrame[]; } //#endregion //#region ../../node_modules/.pnpm/bippy@0.5.41_react@19.2.6/node_modules/bippy/dist/core.d.ts type Flags = number; type Lanes = number; type TypeOfMode = number; type WorkTag = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31; type HookType = "useState" | "useReducer" | "useContext" | "useRef" | "useEffect" | "useLayoutEffect" | "useCallback" | "useMemo" | "useImperativeHandle" | "useDebugValue" | "useDeferredValue" | "useTransition" | "useMutableSource" | "useOpaqueIdentifier" | "useCacheRefresh"; type FiberRoot = any; interface Source { fileName: string; lineNumber: number; } interface RefObject { current: any; } interface ReactContext { $$typeof: symbol | number; Consumer: ReactContext; Provider: ReactProviderType; _calculateChangedBits: ((a: T, b: T) => number) | null; _currentValue: T; _currentValue2: T; _threadCount: number; _currentRenderer?: Record | null; _currentRenderer2?: Record | null; displayName?: string; } interface ReactProviderType { $$typeof: symbol | number; _context: ReactContext; } interface ReactFiber { tag: WorkTag; key: null | string; elementType: any; type: any; stateNode: any; return: ReactFiber | null; child: ReactFiber | null; sibling: ReactFiber | null; index: number; ref: null | (((handle: unknown) => void) & { _stringRef?: string | null; }) | RefObject; pendingProps: any; memoizedProps: any; updateQueue: unknown; memoizedState: any; dependencies: Dependencies | null; mode: TypeOfMode; flags: Flags; subtreeFlags: Flags; deletions: ReactFiber[] | null; nextEffect: ReactFiber | null; firstEffect: ReactFiber | null; lastEffect: ReactFiber | null; lanes: Lanes; childLanes: Lanes; alternate: ReactFiber | null; actualDuration?: number; actualStartTime?: number; selfBaseDuration?: number; treeBaseDuration?: number; _debugID?: number; _debugSource?: Source | null; _debugOwner?: ReactFiber | null; _debugIsCurrentlyTiming?: boolean; _debugNeedsRemount?: boolean; _debugHookTypes?: HookType[] | null; } interface ContextDependency { context: ReactContext; memoizedValue: T; next: ContextDependency | null; observedBits: number; } interface Dependencies { firstContext: ContextDependency | null; lanes: Lanes; } interface Effect { [key: string]: unknown; create: (...args: unknown[]) => unknown; deps: null | unknown[]; destroy: ((...args: unknown[]) => unknown) | null; next: Effect | null; tag: number; } interface Family { current: unknown; } /** * Represents a react-internal Fiber node. */ type Fiber = Omit & { _debugInfo?: Array<{ debugLocation?: unknown; env?: string; name?: string; }>; _debugOwner?: Fiber; _debugSource?: { columnNumber?: number; fileName: string; lineNumber: number; }; _debugStack?: Error & { stack: string; }; alternate: Fiber | null; child: Fiber | null; dependencies: Dependencies | null; memoizedProps: Props; memoizedState: MemoizedState; pendingProps: Props; return: Fiber | null; sibling: Fiber | null; stateNode: T; updateQueue: { [key: string]: unknown; lastEffect: Effect | null; }; }; interface MemoizedState { [key: string]: unknown; memoizedState: unknown; next: MemoizedState | null; } interface Props { [key: string]: unknown; } interface ReactDevToolsGlobalHook { _instrumentationIsActive?: boolean; _instrumentationSource?: string; checkDCE: (fn: unknown) => void; hasUnsupportedRendererAttached: boolean; inject: (renderer: ReactRenderer) => number; on: () => void; onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void; onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void; onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void; renderers: Map; supportsFiber: boolean; supportsFlight: boolean; } interface ReactRenderer { bundleType: 0 | 1; currentDispatcherRef: any; findFiberByHostInstance?: (hostInstance: unknown) => Fiber | null; getCurrentFiber?: (fiber: Fiber) => Fiber | null; overrideContext?: (fiber: Fiber, contextType: unknown, path: string[], value: unknown) => void; overrideHookState?: (fiber: Fiber, id: string, path: string[], value: unknown) => void; overrideHookStateDeletePath?: (fiber: Fiber, id: number, path: Array) => void; overrideHookStateRenamePath?: (fiber: Fiber, id: number, oldPath: Array, newPath: Array) => void; overrideProps?: (fiber: Fiber, path: string[], value: unknown) => void; overridePropsDeletePath?: (fiber: Fiber, path: Array) => void; overridePropsRenamePath?: (fiber: Fiber, oldPath: Array, newPath: Array) => void; reconcilerVersion: string; rendererPackageName: string; scheduleRefresh?: (root: FiberRoot, update: { staleFamilies: Set; updatedFamilies: Set; }) => void; scheduleRoot?: (root: FiberRoot, element: React.ReactNode) => void; scheduleUpdate?: (fiber: Fiber) => void; setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void; setRefreshHandler?: (handler: ((fiber: Fiber) => Family | null) | null) => void; setSuspenseHandler?: (newShouldSuspendImpl: (suspenseInstance: unknown) => void) => void; version: string; } declare global { var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined; } //#endregion //#region src/rdt-hook.d.ts /** * Returns `true` if bippy's instrumentation is active. */ declare const isInstrumentationActive: () => boolean; /** * Returns the latest fiber (since it may be double-buffered). */ //#endregion //#region ../../node_modules/.pnpm/bippy@0.5.41_react@19.2.6/node_modules/bippy/dist/source.d.ts //#region src/source/parse-stack.d.ts interface StackFrame { args?: unknown[]; columnNumber?: number; lineNumber?: number; fileName?: string; functionName?: string; source?: string; isServer?: boolean; isSymbolicated?: boolean; } //#endregion //#region src/utils/copy-content.d.ts interface CopyContentOptions { componentName?: string; tagName?: string; commentText?: string; entries?: ReactGrabEntry[]; } declare const copyContent: (content: string, options?: CopyContentOptions) => boolean; //#endregion export { ToolbarState as A, ReactGrabAPI as C, SettableOptions as D, Rect as E, SourceInfo as O, PromptModeContext as S, ReactGrabState as T, OverlayBounds as _, ActionContext as a, PluginHooks as b, AgentContext as c, DeepPartial as d, DragRect as f, Options as g, GrabbedBox as h, isInstrumentationActive as i, Theme as k, ContextMenuAction as l, ElementLabelVariant as m, StackFrame as n, ActionContextHooks as o, ElementLabelContext as p, Fiber as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, Plugin as v, ReactGrabRendererProps as w, Position as x, PluginConfig as y };