react-grab 0.1.47 → 0.1.48-dev.169c87b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/{copy-content-CqFXlS9J.d.ts → copy-content-3sDfOP1b.d.ts} +96 -42
  3. package/dist/{copy-content-BoeDJ9l0.d.cts → copy-content-TZDC2S2A.d.cts} +96 -42
  4. package/dist/core/index.cjs +1 -1
  5. package/dist/core/index.d.cts +2 -2
  6. package/dist/core/index.d.ts +2 -2
  7. package/dist/core/index.js +1 -1
  8. package/dist/core-CYc0YR2D.cjs +14 -0
  9. package/dist/core-Dc3PSb_B.js +14 -0
  10. package/dist/errors-BEgowzRA.d.ts +29 -0
  11. package/dist/errors-CTlIFDQs.d.cts +29 -0
  12. package/dist/execute-context-menu-action-BWAgSqbI.cjs +9 -0
  13. package/dist/execute-context-menu-action-Cc2bQerU.js +9 -0
  14. package/dist/freeze-updates-CGN-V7_U.cjs +52 -0
  15. package/dist/freeze-updates-D9dkUnJy.js +52 -0
  16. package/dist/{index-Ci1cIBwN.d.cts → index-DDf5jObx.d.cts} +1 -1
  17. package/dist/{index-ssynL7Na.d.ts → index-DWvC_uKW.d.ts} +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.cts +10 -7
  20. package/dist/index.d.ts +10 -7
  21. package/dist/index.global.js +21 -20
  22. package/dist/index.js +1 -1
  23. package/dist/open-file-B5I3lUSY.js +29 -0
  24. package/dist/open-file-BgHKdekg.cjs +20 -0
  25. package/dist/primitives.cjs +2 -2
  26. package/dist/primitives.d.cts +3 -2
  27. package/dist/primitives.d.ts +3 -2
  28. package/dist/primitives.js +2 -2
  29. package/dist/renderer-BUI1o1zw.cjs +9 -0
  30. package/dist/renderer-Bssq3nyV.js +9 -0
  31. package/dist/styles.css +1 -1
  32. package/package.json +13 -4
  33. package/dist/action-shortcuts-DK7e2eLe.cjs +0 -9
  34. package/dist/action-shortcuts-DN8Q9O9k.js +0 -9
  35. package/dist/copy-content-BG5RrXFG.cjs +0 -10
  36. package/dist/copy-content-Drw2cQ8V.js +0 -10
  37. package/dist/core-CX-oJjgu.js +0 -15
  38. package/dist/core-CvEeB6XL.cjs +0 -15
  39. package/dist/freeze-updates-8grKqOPM.cjs +0 -51
  40. package/dist/freeze-updates-DiPhJRln.js +0 -51
  41. package/dist/renderer-B79Ze5ly.js +0 -9
  42. package/dist/renderer-CjUwZ1og.cjs +0 -9
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Copy any UI element for your agent.
7
7
 
8
- React Grab points agents to the actual source behind each selection. Agents are [**2× faster**](https://benchmark.react-grab.com/) and more accurate when using React Grab.
8
+ React Grab points agents to the actual source behind each selection. Agents are [**2× faster**](https://react-grab.com/benchmarks) and more accurate when using React Grab.
9
9
 
10
10
  [**Website →**](https://react-grab.com)
11
11
 
@@ -6,6 +6,8 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
+ import { ReactNode } from "react";
10
+
9
11
  //#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/reactive/observable.d.ts
10
12
  declare global {
11
13
  interface SymbolConstructor {
@@ -138,11 +140,13 @@ interface AgentContext<T = unknown> {
138
140
  sessionId?: string;
139
141
  }
140
142
  type ActivationMode = "toggle" | "hold";
141
- interface ActionContextHooks {
142
- transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
143
+ interface OpenFileActionHooks {
143
144
  onOpenFile: (filePath: string, lineNumber?: number) => boolean | void;
144
145
  transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string;
145
146
  }
147
+ interface ActionContextHooks extends OpenFileActionHooks {
148
+ transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
149
+ }
146
150
  interface ActionContext {
147
151
  element: Element;
148
152
  elements: Element[];
@@ -214,6 +218,12 @@ interface EnumPendingEdit {
214
218
  }
215
219
  type PendingEdit = NumericPendingEdit | ColorPendingEdit | EnumPendingEdit;
216
220
  type PendingEdits = PendingEdit[];
221
+ interface DesignTokenResolver {
222
+ readonly hasTokens: boolean;
223
+ matchColor: (hex: string) => string | null;
224
+ matchLength: (px: number, cssProperty: string) => string | null;
225
+ stepLength: (px: number, direction: 1 | -1, cssProperty: string) => number | null;
226
+ }
217
227
  interface PreviewStyles {
218
228
  apply: (cssProperties: readonly string[], cssValue: string) => void;
219
229
  restore: () => void;
@@ -222,16 +232,15 @@ interface PreviewStyles {
222
232
  interface EditPanelState {
223
233
  element: Element;
224
234
  position: Position;
225
- selectionBounds: OverlayBounds;
226
235
  properties: EditableProperty[];
227
236
  preview: PreviewStyles;
228
237
  filePath?: string;
229
238
  lineNumber?: number;
230
239
  componentName?: string;
231
240
  tagName?: string;
232
- htmlPreview?: string;
233
241
  initialSearchQuery?: string;
234
242
  hasSessionEdits?: boolean;
243
+ designTokens?: DesignTokenResolver;
235
244
  }
236
245
  interface ContextMenuAction {
237
246
  id: string;
@@ -242,34 +251,35 @@ interface ContextMenuAction {
242
251
  enabled?: boolean | ((context: ActionContext) => boolean);
243
252
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
244
253
  }
245
- interface ArrowNavigationItem {
254
+ interface HierarchyItem {
246
255
  tagName: string;
247
256
  componentName?: string;
257
+ depth: number;
258
+ isLast: boolean;
248
259
  }
249
- interface ArrowNavigationState {
250
- items: ArrowNavigationItem[];
260
+ interface HierarchyState {
261
+ items: HierarchyItem[];
251
262
  activeIndex: number;
252
- isVisible: boolean;
253
263
  }
254
264
  interface PluginHooks {
255
- onActivate?: () => void;
256
- onDeactivate?: () => void;
257
- onElementHover?: (element: Element) => void;
265
+ onActivate?: () => void | Promise<void>;
266
+ onDeactivate?: () => void | Promise<void>;
267
+ onElementHover?: (element: Element) => void | Promise<void>;
258
268
  onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
259
- onDragStart?: (startX: number, startY: number) => void;
260
- onDragEnd?: (elements: Element[], bounds: DragRect) => void;
269
+ onDragStart?: (startX: number, startY: number) => void | Promise<void>;
270
+ onDragEnd?: (elements: Element[], bounds: DragRect) => void | Promise<void>;
261
271
  onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
262
272
  transformCopyContent?: (content: string, elements: Element[]) => string | Promise<string>;
263
- onAfterCopy?: (elements: Element[], success: boolean) => void;
264
- onCopySuccess?: (elements: Element[], content: string) => void;
265
- onCopyError?: (error: Error) => void;
266
- onStateChange?: (state: ReactGrabState) => void;
267
- onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void;
268
- onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
269
- onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
270
- onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
271
- onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
272
- onContextMenu?: (element: Element, position: Position) => void;
273
+ onAfterCopy?: (elements: Element[], success: boolean) => void | Promise<void>;
274
+ onCopySuccess?: (elements: Element[], content: string) => void | Promise<void>;
275
+ onCopyError?: (error: Error) => void | Promise<void>;
276
+ onStateChange?: (state: ReactGrabState) => void | Promise<void>;
277
+ onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void | Promise<void>;
278
+ onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void | Promise<void>;
279
+ onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void | Promise<void>;
280
+ onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void | Promise<void>;
281
+ onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void | Promise<void>;
282
+ onContextMenu?: (element: Element, position: Position) => void | Promise<void>;
273
283
  onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
274
284
  transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
275
285
  transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
@@ -281,7 +291,7 @@ interface PluginConfig {
281
291
  options?: SettableOptions;
282
292
  actions?: ContextMenuAction[];
283
293
  hooks?: PluginHooks;
284
- cleanup?: () => void;
294
+ cleanup?: () => undefined;
285
295
  }
286
296
  interface Plugin {
287
297
  name: string;
@@ -293,6 +303,12 @@ interface Plugin {
293
303
  }
294
304
  interface Options {
295
305
  enabled?: boolean;
306
+ /**
307
+ * Confine React Grab to a single container element instead of the whole page.
308
+ * Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
309
+ * Used by the demo build to scope the showcase to its card.
310
+ */
311
+ container?: HTMLElement;
296
312
  activationMode?: ActivationMode;
297
313
  keyHoldDuration?: number;
298
314
  allowActivationInsideInput?: boolean;
@@ -324,12 +340,31 @@ interface Options {
324
340
  interface SettableOptions extends Options {
325
341
  enabled?: never;
326
342
  telemetry?: never;
343
+ container?: never;
327
344
  }
328
345
  interface SourceInfo {
329
346
  filePath: string;
330
347
  lineNumber: number | null;
331
348
  componentName: string | null;
332
349
  }
350
+ interface SelectedElementPayload {
351
+ tagName: string;
352
+ id?: string;
353
+ className?: string;
354
+ textContent?: string;
355
+ componentName?: string;
356
+ filePath?: string;
357
+ lineNumber?: number;
358
+ columnNumber?: number;
359
+ }
360
+ interface ElementSelectedEventDetail {
361
+ elements: SelectedElementPayload[];
362
+ }
363
+ declare global {
364
+ interface WindowEventMap {
365
+ "react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
366
+ }
367
+ }
333
368
  interface ToolbarState {
334
369
  edge: "top" | "bottom" | "left" | "right";
335
370
  ratio: number;
@@ -353,6 +388,7 @@ interface ReactGrabAPI {
353
388
  getToolbarState: () => ToolbarState | null;
354
389
  setToolbarState: (state: Partial<ToolbarState>) => void;
355
390
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
391
+ reset: () => void;
356
392
  dispose: () => void;
357
393
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
358
394
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -398,13 +434,19 @@ interface FrozenLabelEntry {
398
434
  bounds: OverlayBounds;
399
435
  mouseX?: number;
400
436
  }
437
+ interface FrozenLabelEntryAccessor {
438
+ read: () => FrozenLabelEntry | null;
439
+ }
440
+ interface SelectionLabelInstanceAccessor {
441
+ read: () => SelectionLabelInstance | null;
442
+ }
401
443
  interface ReactGrabRendererProps {
402
444
  selectionVisible?: boolean;
403
445
  selectionBounds?: OverlayBounds;
404
446
  selectionBoundsMultiple?: OverlayBounds[];
405
447
  selectionShouldSnap?: boolean;
406
448
  selectionElementsCount?: number;
407
- frozenLabelEntries?: FrozenLabelEntry[];
449
+ frozenLabelEntryAccessors?: FrozenLabelEntryAccessor[];
408
450
  pendingShiftPreviewEntry?: FrozenLabelEntry;
409
451
  selectionFilePath?: string;
410
452
  selectionLineNumber?: number;
@@ -412,9 +454,10 @@ interface ReactGrabRendererProps {
412
454
  selectionComponentName?: string;
413
455
  selectionLabelVisible?: boolean;
414
456
  selectionLabelStatus?: SelectionLabelStatus;
415
- selectionArrowNavigationState?: ArrowNavigationState;
416
- onArrowNavigationSelect?: (index: number) => void;
457
+ hierarchyState?: HierarchyState;
458
+ hierarchyMenuPosition?: DropdownAnchor | null;
417
459
  labelInstances?: SelectionLabelInstance[];
460
+ labelInstanceAccessors?: SelectionLabelInstanceAccessor[];
418
461
  dragVisible?: boolean;
419
462
  dragBounds?: OverlayBounds;
420
463
  grabbedBoxes?: Array<{
@@ -427,12 +470,15 @@ interface ReactGrabRendererProps {
427
470
  inputValue?: string;
428
471
  isPromptMode?: boolean;
429
472
  onShowContextMenuInstance?: (instanceId: string) => void;
473
+ onRetryInstance?: (instanceId: string) => void;
474
+ onAcknowledgeErrorInstance?: (instanceId: string) => void;
430
475
  onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
431
476
  onInputChange?: (value: string) => void;
432
477
  onInputSubmit?: () => void;
433
478
  onToggleExpand?: () => void;
434
479
  selectionLabelShakeCount?: number;
435
480
  onConfirmDismiss?: () => void;
481
+ onOpenSelectionFile?: () => void;
436
482
  discardPrompt?: SelectionDiscardPrompt;
437
483
  toolbarVisible?: boolean;
438
484
  isActive?: boolean;
@@ -514,7 +560,7 @@ interface ReactGrabEntry {
514
560
  frames?: ReactGrabStackFrame[];
515
561
  }
516
562
  //#endregion
517
- //#region ../../node_modules/.pnpm/bippy@0.5.41_react@19.2.6/node_modules/bippy/dist/core.d.ts
563
+ //#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/unsubscribe.d.ts
518
564
  type Flags = number;
519
565
  type Lanes = number;
520
566
  type TypeOfMode = number;
@@ -604,6 +650,14 @@ interface Effect {
604
650
  interface Family {
605
651
  current: unknown;
606
652
  }
653
+ /**
654
+ * React 19 flight metadata for a server component owner (ReactComponentInfo).
655
+ * Unlike client owners it has no `tag`; the owner chain continues via `owner`.
656
+ */
657
+ interface RendererRefreshUpdate {
658
+ staleFamilies: Set<Family>;
659
+ updatedFamilies: Set<Family>;
660
+ }
607
661
  /**
608
662
  * Represents a react-internal Fiber node.
609
663
  */
@@ -654,6 +708,7 @@ interface ReactDevToolsGlobalHook {
654
708
  onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void;
655
709
  onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
656
710
  onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
711
+ onScheduleFiberRoot?: (rendererID: number, root: FiberRoot, children: ReactNode) => void;
657
712
  renderers: Map<number, ReactRenderer>;
658
713
  supportsFiber: boolean;
659
714
  supportsFlight: boolean;
@@ -672,10 +727,7 @@ interface ReactRenderer {
672
727
  overridePropsRenamePath?: (fiber: Fiber, oldPath: Array<number | string>, newPath: Array<number | string>) => void;
673
728
  reconcilerVersion: string;
674
729
  rendererPackageName: string;
675
- scheduleRefresh?: (root: FiberRoot, update: {
676
- staleFamilies: Set<Family>;
677
- updatedFamilies: Set<Family>;
678
- }) => void;
730
+ scheduleRefresh?: (root: FiberRoot, update: RendererRefreshUpdate) => void;
679
731
  scheduleRoot?: (root: FiberRoot, element: React.ReactNode) => void;
680
732
  scheduleUpdate?: (fiber: Fiber) => void;
681
733
  setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void;
@@ -686,28 +738,30 @@ interface ReactRenderer {
686
738
  declare global {
687
739
  var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;
688
740
  } //#endregion
689
- //#region src/rdt-hook.d.ts
690
- /**
691
- * Returns `true` if bippy's instrumentation is active.
692
- */
693
- declare const isInstrumentationActive: () => boolean;
694
- /**
695
- * Returns the latest fiber (since it may be double-buffered).
696
- */
741
+ //#region src/unsubscribe.d.ts
697
742
  //#endregion
698
- //#region ../../node_modules/.pnpm/bippy@0.5.41_react@19.2.6/node_modules/bippy/dist/source.d.ts
743
+ //#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/source.d.ts
699
744
  //#region src/source/parse-stack.d.ts
700
745
  interface StackFrame {
701
746
  args?: unknown[];
702
747
  columnNumber?: number;
703
748
  lineNumber?: number;
749
+ enclosingLineNumber?: number;
750
+ enclosingColumnNumber?: number;
704
751
  fileName?: string;
705
752
  functionName?: string;
706
753
  source?: string;
707
754
  isServer?: boolean;
708
755
  isSymbolicated?: boolean;
756
+ isIgnoreListed?: boolean;
709
757
  }
710
758
  //#endregion
759
+ //#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/core.d.ts
760
+ /**
761
+ * Returns `true` if bippy's instrumentation is active.
762
+ */
763
+ declare const isInstrumentationActive: () => boolean;
764
+ //#endregion
711
765
  //#region src/utils/copy-content.d.ts
712
766
  interface CopyContentOptions {
713
767
  componentName?: string;
@@ -717,4 +771,4 @@ interface CopyContentOptions {
717
771
  }
718
772
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
719
773
  //#endregion
720
- 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 };
774
+ export { SettableOptions as A, Position as C, ReactGrabState as D, ReactGrabRendererProps as E, Theme as M, ToolbarState as N, Rect as O, PluginHooks as S, ReactGrabAPI as T, OpenFileActionHooks as _, ActionContext as a, Plugin as b, AgentContext as c, DeepPartial as d, DragRect as f, GrabbedBox as g, ElementSelectedEventDetail as h, Fiber as i, SourceInfo as j, SelectedElementPayload as k, ContextMenuAction as l, ElementLabelVariant as m, isInstrumentationActive as n, ActionContextHooks as o, ElementLabelContext as p, StackFrame as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, Options as v, PromptModeContext as w, PluginConfig as x, OverlayBounds as y };
@@ -6,6 +6,8 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
+ import { ReactNode } from "react";
10
+
9
11
  //#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/reactive/observable.d.ts
10
12
  declare global {
11
13
  interface SymbolConstructor {
@@ -138,11 +140,13 @@ interface AgentContext<T = unknown> {
138
140
  sessionId?: string;
139
141
  }
140
142
  type ActivationMode = "toggle" | "hold";
141
- interface ActionContextHooks {
142
- transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
143
+ interface OpenFileActionHooks {
143
144
  onOpenFile: (filePath: string, lineNumber?: number) => boolean | void;
144
145
  transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string;
145
146
  }
147
+ interface ActionContextHooks extends OpenFileActionHooks {
148
+ transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
149
+ }
146
150
  interface ActionContext {
147
151
  element: Element;
148
152
  elements: Element[];
@@ -214,6 +218,12 @@ interface EnumPendingEdit {
214
218
  }
215
219
  type PendingEdit = NumericPendingEdit | ColorPendingEdit | EnumPendingEdit;
216
220
  type PendingEdits = PendingEdit[];
221
+ interface DesignTokenResolver {
222
+ readonly hasTokens: boolean;
223
+ matchColor: (hex: string) => string | null;
224
+ matchLength: (px: number, cssProperty: string) => string | null;
225
+ stepLength: (px: number, direction: 1 | -1, cssProperty: string) => number | null;
226
+ }
217
227
  interface PreviewStyles {
218
228
  apply: (cssProperties: readonly string[], cssValue: string) => void;
219
229
  restore: () => void;
@@ -222,16 +232,15 @@ interface PreviewStyles {
222
232
  interface EditPanelState {
223
233
  element: Element;
224
234
  position: Position;
225
- selectionBounds: OverlayBounds;
226
235
  properties: EditableProperty[];
227
236
  preview: PreviewStyles;
228
237
  filePath?: string;
229
238
  lineNumber?: number;
230
239
  componentName?: string;
231
240
  tagName?: string;
232
- htmlPreview?: string;
233
241
  initialSearchQuery?: string;
234
242
  hasSessionEdits?: boolean;
243
+ designTokens?: DesignTokenResolver;
235
244
  }
236
245
  interface ContextMenuAction {
237
246
  id: string;
@@ -242,34 +251,35 @@ interface ContextMenuAction {
242
251
  enabled?: boolean | ((context: ActionContext) => boolean);
243
252
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
244
253
  }
245
- interface ArrowNavigationItem {
254
+ interface HierarchyItem {
246
255
  tagName: string;
247
256
  componentName?: string;
257
+ depth: number;
258
+ isLast: boolean;
248
259
  }
249
- interface ArrowNavigationState {
250
- items: ArrowNavigationItem[];
260
+ interface HierarchyState {
261
+ items: HierarchyItem[];
251
262
  activeIndex: number;
252
- isVisible: boolean;
253
263
  }
254
264
  interface PluginHooks {
255
- onActivate?: () => void;
256
- onDeactivate?: () => void;
257
- onElementHover?: (element: Element) => void;
265
+ onActivate?: () => void | Promise<void>;
266
+ onDeactivate?: () => void | Promise<void>;
267
+ onElementHover?: (element: Element) => void | Promise<void>;
258
268
  onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
259
- onDragStart?: (startX: number, startY: number) => void;
260
- onDragEnd?: (elements: Element[], bounds: DragRect) => void;
269
+ onDragStart?: (startX: number, startY: number) => void | Promise<void>;
270
+ onDragEnd?: (elements: Element[], bounds: DragRect) => void | Promise<void>;
261
271
  onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
262
272
  transformCopyContent?: (content: string, elements: Element[]) => string | Promise<string>;
263
- onAfterCopy?: (elements: Element[], success: boolean) => void;
264
- onCopySuccess?: (elements: Element[], content: string) => void;
265
- onCopyError?: (error: Error) => void;
266
- onStateChange?: (state: ReactGrabState) => void;
267
- onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void;
268
- onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
269
- onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
270
- onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
271
- onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
272
- onContextMenu?: (element: Element, position: Position) => void;
273
+ onAfterCopy?: (elements: Element[], success: boolean) => void | Promise<void>;
274
+ onCopySuccess?: (elements: Element[], content: string) => void | Promise<void>;
275
+ onCopyError?: (error: Error) => void | Promise<void>;
276
+ onStateChange?: (state: ReactGrabState) => void | Promise<void>;
277
+ onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void | Promise<void>;
278
+ onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void | Promise<void>;
279
+ onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void | Promise<void>;
280
+ onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void | Promise<void>;
281
+ onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void | Promise<void>;
282
+ onContextMenu?: (element: Element, position: Position) => void | Promise<void>;
273
283
  onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
274
284
  transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
275
285
  transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
@@ -281,7 +291,7 @@ interface PluginConfig {
281
291
  options?: SettableOptions;
282
292
  actions?: ContextMenuAction[];
283
293
  hooks?: PluginHooks;
284
- cleanup?: () => void;
294
+ cleanup?: () => undefined;
285
295
  }
286
296
  interface Plugin {
287
297
  name: string;
@@ -293,6 +303,12 @@ interface Plugin {
293
303
  }
294
304
  interface Options {
295
305
  enabled?: boolean;
306
+ /**
307
+ * Confine React Grab to a single container element instead of the whole page.
308
+ * Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
309
+ * Used by the demo build to scope the showcase to its card.
310
+ */
311
+ container?: HTMLElement;
296
312
  activationMode?: ActivationMode;
297
313
  keyHoldDuration?: number;
298
314
  allowActivationInsideInput?: boolean;
@@ -324,12 +340,31 @@ interface Options {
324
340
  interface SettableOptions extends Options {
325
341
  enabled?: never;
326
342
  telemetry?: never;
343
+ container?: never;
327
344
  }
328
345
  interface SourceInfo {
329
346
  filePath: string;
330
347
  lineNumber: number | null;
331
348
  componentName: string | null;
332
349
  }
350
+ interface SelectedElementPayload {
351
+ tagName: string;
352
+ id?: string;
353
+ className?: string;
354
+ textContent?: string;
355
+ componentName?: string;
356
+ filePath?: string;
357
+ lineNumber?: number;
358
+ columnNumber?: number;
359
+ }
360
+ interface ElementSelectedEventDetail {
361
+ elements: SelectedElementPayload[];
362
+ }
363
+ declare global {
364
+ interface WindowEventMap {
365
+ "react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
366
+ }
367
+ }
333
368
  interface ToolbarState {
334
369
  edge: "top" | "bottom" | "left" | "right";
335
370
  ratio: number;
@@ -353,6 +388,7 @@ interface ReactGrabAPI {
353
388
  getToolbarState: () => ToolbarState | null;
354
389
  setToolbarState: (state: Partial<ToolbarState>) => void;
355
390
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
391
+ reset: () => void;
356
392
  dispose: () => void;
357
393
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
358
394
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -398,13 +434,19 @@ interface FrozenLabelEntry {
398
434
  bounds: OverlayBounds;
399
435
  mouseX?: number;
400
436
  }
437
+ interface FrozenLabelEntryAccessor {
438
+ read: () => FrozenLabelEntry | null;
439
+ }
440
+ interface SelectionLabelInstanceAccessor {
441
+ read: () => SelectionLabelInstance | null;
442
+ }
401
443
  interface ReactGrabRendererProps {
402
444
  selectionVisible?: boolean;
403
445
  selectionBounds?: OverlayBounds;
404
446
  selectionBoundsMultiple?: OverlayBounds[];
405
447
  selectionShouldSnap?: boolean;
406
448
  selectionElementsCount?: number;
407
- frozenLabelEntries?: FrozenLabelEntry[];
449
+ frozenLabelEntryAccessors?: FrozenLabelEntryAccessor[];
408
450
  pendingShiftPreviewEntry?: FrozenLabelEntry;
409
451
  selectionFilePath?: string;
410
452
  selectionLineNumber?: number;
@@ -412,9 +454,10 @@ interface ReactGrabRendererProps {
412
454
  selectionComponentName?: string;
413
455
  selectionLabelVisible?: boolean;
414
456
  selectionLabelStatus?: SelectionLabelStatus;
415
- selectionArrowNavigationState?: ArrowNavigationState;
416
- onArrowNavigationSelect?: (index: number) => void;
457
+ hierarchyState?: HierarchyState;
458
+ hierarchyMenuPosition?: DropdownAnchor | null;
417
459
  labelInstances?: SelectionLabelInstance[];
460
+ labelInstanceAccessors?: SelectionLabelInstanceAccessor[];
418
461
  dragVisible?: boolean;
419
462
  dragBounds?: OverlayBounds;
420
463
  grabbedBoxes?: Array<{
@@ -427,12 +470,15 @@ interface ReactGrabRendererProps {
427
470
  inputValue?: string;
428
471
  isPromptMode?: boolean;
429
472
  onShowContextMenuInstance?: (instanceId: string) => void;
473
+ onRetryInstance?: (instanceId: string) => void;
474
+ onAcknowledgeErrorInstance?: (instanceId: string) => void;
430
475
  onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
431
476
  onInputChange?: (value: string) => void;
432
477
  onInputSubmit?: () => void;
433
478
  onToggleExpand?: () => void;
434
479
  selectionLabelShakeCount?: number;
435
480
  onConfirmDismiss?: () => void;
481
+ onOpenSelectionFile?: () => void;
436
482
  discardPrompt?: SelectionDiscardPrompt;
437
483
  toolbarVisible?: boolean;
438
484
  isActive?: boolean;
@@ -514,7 +560,7 @@ interface ReactGrabEntry {
514
560
  frames?: ReactGrabStackFrame[];
515
561
  }
516
562
  //#endregion
517
- //#region ../../node_modules/.pnpm/bippy@0.5.41_react@19.2.6/node_modules/bippy/dist/core.d.ts
563
+ //#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/unsubscribe.d.ts
518
564
  type Flags = number;
519
565
  type Lanes = number;
520
566
  type TypeOfMode = number;
@@ -604,6 +650,14 @@ interface Effect {
604
650
  interface Family {
605
651
  current: unknown;
606
652
  }
653
+ /**
654
+ * React 19 flight metadata for a server component owner (ReactComponentInfo).
655
+ * Unlike client owners it has no `tag`; the owner chain continues via `owner`.
656
+ */
657
+ interface RendererRefreshUpdate {
658
+ staleFamilies: Set<Family>;
659
+ updatedFamilies: Set<Family>;
660
+ }
607
661
  /**
608
662
  * Represents a react-internal Fiber node.
609
663
  */
@@ -654,6 +708,7 @@ interface ReactDevToolsGlobalHook {
654
708
  onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void;
655
709
  onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
656
710
  onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
711
+ onScheduleFiberRoot?: (rendererID: number, root: FiberRoot, children: ReactNode) => void;
657
712
  renderers: Map<number, ReactRenderer>;
658
713
  supportsFiber: boolean;
659
714
  supportsFlight: boolean;
@@ -672,10 +727,7 @@ interface ReactRenderer {
672
727
  overridePropsRenamePath?: (fiber: Fiber, oldPath: Array<number | string>, newPath: Array<number | string>) => void;
673
728
  reconcilerVersion: string;
674
729
  rendererPackageName: string;
675
- scheduleRefresh?: (root: FiberRoot, update: {
676
- staleFamilies: Set<Family>;
677
- updatedFamilies: Set<Family>;
678
- }) => void;
730
+ scheduleRefresh?: (root: FiberRoot, update: RendererRefreshUpdate) => void;
679
731
  scheduleRoot?: (root: FiberRoot, element: React.ReactNode) => void;
680
732
  scheduleUpdate?: (fiber: Fiber) => void;
681
733
  setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void;
@@ -686,28 +738,30 @@ interface ReactRenderer {
686
738
  declare global {
687
739
  var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;
688
740
  } //#endregion
689
- //#region src/rdt-hook.d.ts
690
- /**
691
- * Returns `true` if bippy's instrumentation is active.
692
- */
693
- declare const isInstrumentationActive: () => boolean;
694
- /**
695
- * Returns the latest fiber (since it may be double-buffered).
696
- */
741
+ //#region src/unsubscribe.d.ts
697
742
  //#endregion
698
- //#region ../../node_modules/.pnpm/bippy@0.5.41_react@19.2.6/node_modules/bippy/dist/source.d.ts
743
+ //#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/source.d.ts
699
744
  //#region src/source/parse-stack.d.ts
700
745
  interface StackFrame {
701
746
  args?: unknown[];
702
747
  columnNumber?: number;
703
748
  lineNumber?: number;
749
+ enclosingLineNumber?: number;
750
+ enclosingColumnNumber?: number;
704
751
  fileName?: string;
705
752
  functionName?: string;
706
753
  source?: string;
707
754
  isServer?: boolean;
708
755
  isSymbolicated?: boolean;
756
+ isIgnoreListed?: boolean;
709
757
  }
710
758
  //#endregion
759
+ //#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/core.d.ts
760
+ /**
761
+ * Returns `true` if bippy's instrumentation is active.
762
+ */
763
+ declare const isInstrumentationActive: () => boolean;
764
+ //#endregion
711
765
  //#region src/utils/copy-content.d.ts
712
766
  interface CopyContentOptions {
713
767
  componentName?: string;
@@ -717,4 +771,4 @@ interface CopyContentOptions {
717
771
  }
718
772
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
719
773
  //#endregion
720
- 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 };
774
+ export { SettableOptions as A, Position as C, ReactGrabState as D, ReactGrabRendererProps as E, Theme as M, ToolbarState as N, Rect as O, PluginHooks as S, ReactGrabAPI as T, OpenFileActionHooks as _, ActionContext as a, Plugin as b, AgentContext as c, DeepPartial as d, DragRect as f, GrabbedBox as g, ElementSelectedEventDetail as h, Fiber as i, SourceInfo as j, SelectedElementPayload as k, ContextMenuAction as l, ElementLabelVariant as m, isInstrumentationActive as n, ActionContextHooks as o, ElementLabelContext as p, StackFrame as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, Options as v, PromptModeContext as w, PluginConfig as x, OverlayBounds as y };
@@ -6,4 +6,4 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../core-CvEeB6XL.cjs`),t=require(`../freeze-updates-8grKqOPM.cjs`),n=require(`../copy-content-BG5RrXFG.cjs`);exports.DEFAULT_THEME=e.a,exports.copyContent=n.t,exports.formatElementInfo=n.n,exports.generateSnippet=e.n,exports.getStack=n.o,exports.init=e.t,exports.isInstrumentationActive=t.M;
9
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../core-CYc0YR2D.cjs`),t=require(`../freeze-updates-CGN-V7_U.cjs`),n=require(`../open-file-BgHKdekg.cjs`);exports.DEFAULT_THEME=e.a,exports.copyContent=n.n,exports.formatElementInfo=n.r,exports.generateSnippet=e.n,exports.getStack=n.s,exports.init=e.t,exports.isInstrumentationActive=t.U;
@@ -6,6 +6,6 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import { C as ReactGrabAPI, D as SettableOptions, O as SourceInfo, _ as OverlayBounds, a as ActionContext, b as PluginHooks, c as AgentContext, g as Options, i as isInstrumentationActive, l as ContextMenuAction, t as copyContent, v as Plugin, w as ReactGrabRendererProps, y as PluginConfig } from "../copy-content-BoeDJ9l0.cjs";
10
- import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-Ci1cIBwN.cjs";
9
+ import { A as SettableOptions, E as ReactGrabRendererProps, S as PluginHooks, T as ReactGrabAPI, a as ActionContext, b as Plugin, c as AgentContext, j as SourceInfo, l as ContextMenuAction, n as isInstrumentationActive, t as copyContent, v as Options, x as PluginConfig, y as OverlayBounds } from "../copy-content-TZDC2S2A.cjs";
10
+ import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-DDf5jObx.cjs";
11
11
  export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
@@ -6,6 +6,6 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import { C as ReactGrabAPI, D as SettableOptions, O as SourceInfo, _ as OverlayBounds, a as ActionContext, b as PluginHooks, c as AgentContext, g as Options, i as isInstrumentationActive, l as ContextMenuAction, t as copyContent, v as Plugin, w as ReactGrabRendererProps, y as PluginConfig } from "../copy-content-CqFXlS9J.js";
10
- import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-ssynL7Na.js";
9
+ import { A as SettableOptions, E as ReactGrabRendererProps, S as PluginHooks, T as ReactGrabAPI, a as ActionContext, b as Plugin, c as AgentContext, j as SourceInfo, l as ContextMenuAction, n as isInstrumentationActive, t as copyContent, v as Options, x as PluginConfig, y as OverlayBounds } from "../copy-content-3sDfOP1b.js";
10
+ import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-DWvC_uKW.js";
11
11
  export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
@@ -6,4 +6,4 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import{a as e,n as t,t as n}from"../core-CX-oJjgu.js";import{M as r}from"../freeze-updates-DiPhJRln.js";import{n as i,o as a,t as o}from"../copy-content-Drw2cQ8V.js";export{e as DEFAULT_THEME,o as copyContent,i as formatElementInfo,t as generateSnippet,a as getStack,n as init,r as isInstrumentationActive};
9
+ import{a as e,n as t,t as n}from"../core-Dc3PSb_B.js";import{U as r}from"../freeze-updates-D9dkUnJy.js";import{n as i,r as a,s as o}from"../open-file-B5I3lUSY.js";export{e as DEFAULT_THEME,i as copyContent,a as formatElementInfo,t as generateSnippet,o as getStack,n as init,r as isInstrumentationActive};