react-grab 0.1.47-dev.e56fcc1 → 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-5FzVj_Qo.d.cts → copy-content-3sDfOP1b.d.ts} +89 -42
  3. package/dist/{copy-content-BJATOqZF.d.ts → copy-content-TZDC2S2A.d.cts} +89 -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-jMjUhmbS.d.cts → index-DDf5jObx.d.cts} +1 -1
  17. package/dist/{index-C_bngsx-.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 -19
  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 +7 -3
  33. package/dist/action-shortcuts-BqUYwepS.js +0 -9
  34. package/dist/action-shortcuts-Zws2aUUQ.cjs +0 -9
  35. package/dist/copy-content-BdNGJB1g.js +0 -10
  36. package/dist/copy-content-CE1c2qMK.cjs +0 -10
  37. package/dist/core-BMr2NQZo.cjs +0 -14
  38. package/dist/core-GnLSAWJ2.js +0 -14
  39. package/dist/freeze-updates-B9uIB2_2.js +0 -51
  40. package/dist/freeze-updates-BgilkYa3.cjs +0 -51
  41. package/dist/renderer-Bjgsgc2_.cjs +0 -9
  42. package/dist/renderer-bvmApDqj.js +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[];
@@ -228,14 +232,12 @@ interface PreviewStyles {
228
232
  interface EditPanelState {
229
233
  element: Element;
230
234
  position: Position;
231
- selectionBounds: OverlayBounds;
232
235
  properties: EditableProperty[];
233
236
  preview: PreviewStyles;
234
237
  filePath?: string;
235
238
  lineNumber?: number;
236
239
  componentName?: string;
237
240
  tagName?: string;
238
- htmlPreview?: string;
239
241
  initialSearchQuery?: string;
240
242
  hasSessionEdits?: boolean;
241
243
  designTokens?: DesignTokenResolver;
@@ -249,34 +251,35 @@ interface ContextMenuAction {
249
251
  enabled?: boolean | ((context: ActionContext) => boolean);
250
252
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
251
253
  }
252
- interface ArrowNavigationItem {
254
+ interface HierarchyItem {
253
255
  tagName: string;
254
256
  componentName?: string;
257
+ depth: number;
258
+ isLast: boolean;
255
259
  }
256
- interface ArrowNavigationState {
257
- items: ArrowNavigationItem[];
260
+ interface HierarchyState {
261
+ items: HierarchyItem[];
258
262
  activeIndex: number;
259
- isVisible: boolean;
260
263
  }
261
264
  interface PluginHooks {
262
- onActivate?: () => void;
263
- onDeactivate?: () => void;
264
- onElementHover?: (element: Element) => void;
265
+ onActivate?: () => void | Promise<void>;
266
+ onDeactivate?: () => void | Promise<void>;
267
+ onElementHover?: (element: Element) => void | Promise<void>;
265
268
  onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
266
- onDragStart?: (startX: number, startY: number) => void;
267
- onDragEnd?: (elements: Element[], bounds: DragRect) => void;
269
+ onDragStart?: (startX: number, startY: number) => void | Promise<void>;
270
+ onDragEnd?: (elements: Element[], bounds: DragRect) => void | Promise<void>;
268
271
  onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
269
272
  transformCopyContent?: (content: string, elements: Element[]) => string | Promise<string>;
270
- onAfterCopy?: (elements: Element[], success: boolean) => void;
271
- onCopySuccess?: (elements: Element[], content: string) => void;
272
- onCopyError?: (error: Error) => void;
273
- onStateChange?: (state: ReactGrabState) => void;
274
- onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void;
275
- onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
276
- onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
277
- onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
278
- onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
279
- 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>;
280
283
  onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
281
284
  transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
282
285
  transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
@@ -288,7 +291,7 @@ interface PluginConfig {
288
291
  options?: SettableOptions;
289
292
  actions?: ContextMenuAction[];
290
293
  hooks?: PluginHooks;
291
- cleanup?: () => void;
294
+ cleanup?: () => undefined;
292
295
  }
293
296
  interface Plugin {
294
297
  name: string;
@@ -300,6 +303,12 @@ interface Plugin {
300
303
  }
301
304
  interface Options {
302
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;
303
312
  activationMode?: ActivationMode;
304
313
  keyHoldDuration?: number;
305
314
  allowActivationInsideInput?: boolean;
@@ -331,12 +340,31 @@ interface Options {
331
340
  interface SettableOptions extends Options {
332
341
  enabled?: never;
333
342
  telemetry?: never;
343
+ container?: never;
334
344
  }
335
345
  interface SourceInfo {
336
346
  filePath: string;
337
347
  lineNumber: number | null;
338
348
  componentName: string | null;
339
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
+ }
340
368
  interface ToolbarState {
341
369
  edge: "top" | "bottom" | "left" | "right";
342
370
  ratio: number;
@@ -360,6 +388,7 @@ interface ReactGrabAPI {
360
388
  getToolbarState: () => ToolbarState | null;
361
389
  setToolbarState: (state: Partial<ToolbarState>) => void;
362
390
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
391
+ reset: () => void;
363
392
  dispose: () => void;
364
393
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
365
394
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -405,13 +434,19 @@ interface FrozenLabelEntry {
405
434
  bounds: OverlayBounds;
406
435
  mouseX?: number;
407
436
  }
437
+ interface FrozenLabelEntryAccessor {
438
+ read: () => FrozenLabelEntry | null;
439
+ }
440
+ interface SelectionLabelInstanceAccessor {
441
+ read: () => SelectionLabelInstance | null;
442
+ }
408
443
  interface ReactGrabRendererProps {
409
444
  selectionVisible?: boolean;
410
445
  selectionBounds?: OverlayBounds;
411
446
  selectionBoundsMultiple?: OverlayBounds[];
412
447
  selectionShouldSnap?: boolean;
413
448
  selectionElementsCount?: number;
414
- frozenLabelEntries?: FrozenLabelEntry[];
449
+ frozenLabelEntryAccessors?: FrozenLabelEntryAccessor[];
415
450
  pendingShiftPreviewEntry?: FrozenLabelEntry;
416
451
  selectionFilePath?: string;
417
452
  selectionLineNumber?: number;
@@ -419,9 +454,10 @@ interface ReactGrabRendererProps {
419
454
  selectionComponentName?: string;
420
455
  selectionLabelVisible?: boolean;
421
456
  selectionLabelStatus?: SelectionLabelStatus;
422
- selectionArrowNavigationState?: ArrowNavigationState;
423
- onArrowNavigationSelect?: (index: number) => void;
457
+ hierarchyState?: HierarchyState;
458
+ hierarchyMenuPosition?: DropdownAnchor | null;
424
459
  labelInstances?: SelectionLabelInstance[];
460
+ labelInstanceAccessors?: SelectionLabelInstanceAccessor[];
425
461
  dragVisible?: boolean;
426
462
  dragBounds?: OverlayBounds;
427
463
  grabbedBoxes?: Array<{
@@ -434,12 +470,15 @@ interface ReactGrabRendererProps {
434
470
  inputValue?: string;
435
471
  isPromptMode?: boolean;
436
472
  onShowContextMenuInstance?: (instanceId: string) => void;
473
+ onRetryInstance?: (instanceId: string) => void;
474
+ onAcknowledgeErrorInstance?: (instanceId: string) => void;
437
475
  onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
438
476
  onInputChange?: (value: string) => void;
439
477
  onInputSubmit?: () => void;
440
478
  onToggleExpand?: () => void;
441
479
  selectionLabelShakeCount?: number;
442
480
  onConfirmDismiss?: () => void;
481
+ onOpenSelectionFile?: () => void;
443
482
  discardPrompt?: SelectionDiscardPrompt;
444
483
  toolbarVisible?: boolean;
445
484
  isActive?: boolean;
@@ -521,7 +560,7 @@ interface ReactGrabEntry {
521
560
  frames?: ReactGrabStackFrame[];
522
561
  }
523
562
  //#endregion
524
- //#region ../../node_modules/.pnpm/bippy@0.5.42_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
525
564
  type Flags = number;
526
565
  type Lanes = number;
527
566
  type TypeOfMode = number;
@@ -611,6 +650,14 @@ interface Effect {
611
650
  interface Family {
612
651
  current: unknown;
613
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
+ }
614
661
  /**
615
662
  * Represents a react-internal Fiber node.
616
663
  */
@@ -661,6 +708,7 @@ interface ReactDevToolsGlobalHook {
661
708
  onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void;
662
709
  onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
663
710
  onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
711
+ onScheduleFiberRoot?: (rendererID: number, root: FiberRoot, children: ReactNode) => void;
664
712
  renderers: Map<number, ReactRenderer>;
665
713
  supportsFiber: boolean;
666
714
  supportsFlight: boolean;
@@ -679,10 +727,7 @@ interface ReactRenderer {
679
727
  overridePropsRenamePath?: (fiber: Fiber, oldPath: Array<number | string>, newPath: Array<number | string>) => void;
680
728
  reconcilerVersion: string;
681
729
  rendererPackageName: string;
682
- scheduleRefresh?: (root: FiberRoot, update: {
683
- staleFamilies: Set<Family>;
684
- updatedFamilies: Set<Family>;
685
- }) => void;
730
+ scheduleRefresh?: (root: FiberRoot, update: RendererRefreshUpdate) => void;
686
731
  scheduleRoot?: (root: FiberRoot, element: React.ReactNode) => void;
687
732
  scheduleUpdate?: (fiber: Fiber) => void;
688
733
  setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void;
@@ -693,28 +738,30 @@ interface ReactRenderer {
693
738
  declare global {
694
739
  var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;
695
740
  } //#endregion
696
- //#region src/rdt-hook.d.ts
697
- /**
698
- * Returns `true` if bippy's instrumentation is active.
699
- */
700
- declare const isInstrumentationActive: () => boolean;
701
- /**
702
- * Returns the latest fiber (since it may be double-buffered).
703
- */
741
+ //#region src/unsubscribe.d.ts
704
742
  //#endregion
705
- //#region ../../node_modules/.pnpm/bippy@0.5.42_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
706
744
  //#region src/source/parse-stack.d.ts
707
745
  interface StackFrame {
708
746
  args?: unknown[];
709
747
  columnNumber?: number;
710
748
  lineNumber?: number;
749
+ enclosingLineNumber?: number;
750
+ enclosingColumnNumber?: number;
711
751
  fileName?: string;
712
752
  functionName?: string;
713
753
  source?: string;
714
754
  isServer?: boolean;
715
755
  isSymbolicated?: boolean;
756
+ isIgnoreListed?: boolean;
716
757
  }
717
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
718
765
  //#region src/utils/copy-content.d.ts
719
766
  interface CopyContentOptions {
720
767
  componentName?: string;
@@ -724,4 +771,4 @@ interface CopyContentOptions {
724
771
  }
725
772
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
726
773
  //#endregion
727
- 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[];
@@ -228,14 +232,12 @@ interface PreviewStyles {
228
232
  interface EditPanelState {
229
233
  element: Element;
230
234
  position: Position;
231
- selectionBounds: OverlayBounds;
232
235
  properties: EditableProperty[];
233
236
  preview: PreviewStyles;
234
237
  filePath?: string;
235
238
  lineNumber?: number;
236
239
  componentName?: string;
237
240
  tagName?: string;
238
- htmlPreview?: string;
239
241
  initialSearchQuery?: string;
240
242
  hasSessionEdits?: boolean;
241
243
  designTokens?: DesignTokenResolver;
@@ -249,34 +251,35 @@ interface ContextMenuAction {
249
251
  enabled?: boolean | ((context: ActionContext) => boolean);
250
252
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
251
253
  }
252
- interface ArrowNavigationItem {
254
+ interface HierarchyItem {
253
255
  tagName: string;
254
256
  componentName?: string;
257
+ depth: number;
258
+ isLast: boolean;
255
259
  }
256
- interface ArrowNavigationState {
257
- items: ArrowNavigationItem[];
260
+ interface HierarchyState {
261
+ items: HierarchyItem[];
258
262
  activeIndex: number;
259
- isVisible: boolean;
260
263
  }
261
264
  interface PluginHooks {
262
- onActivate?: () => void;
263
- onDeactivate?: () => void;
264
- onElementHover?: (element: Element) => void;
265
+ onActivate?: () => void | Promise<void>;
266
+ onDeactivate?: () => void | Promise<void>;
267
+ onElementHover?: (element: Element) => void | Promise<void>;
265
268
  onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
266
- onDragStart?: (startX: number, startY: number) => void;
267
- onDragEnd?: (elements: Element[], bounds: DragRect) => void;
269
+ onDragStart?: (startX: number, startY: number) => void | Promise<void>;
270
+ onDragEnd?: (elements: Element[], bounds: DragRect) => void | Promise<void>;
268
271
  onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
269
272
  transformCopyContent?: (content: string, elements: Element[]) => string | Promise<string>;
270
- onAfterCopy?: (elements: Element[], success: boolean) => void;
271
- onCopySuccess?: (elements: Element[], content: string) => void;
272
- onCopyError?: (error: Error) => void;
273
- onStateChange?: (state: ReactGrabState) => void;
274
- onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void;
275
- onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
276
- onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
277
- onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
278
- onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
279
- 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>;
280
283
  onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
281
284
  transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
282
285
  transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
@@ -288,7 +291,7 @@ interface PluginConfig {
288
291
  options?: SettableOptions;
289
292
  actions?: ContextMenuAction[];
290
293
  hooks?: PluginHooks;
291
- cleanup?: () => void;
294
+ cleanup?: () => undefined;
292
295
  }
293
296
  interface Plugin {
294
297
  name: string;
@@ -300,6 +303,12 @@ interface Plugin {
300
303
  }
301
304
  interface Options {
302
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;
303
312
  activationMode?: ActivationMode;
304
313
  keyHoldDuration?: number;
305
314
  allowActivationInsideInput?: boolean;
@@ -331,12 +340,31 @@ interface Options {
331
340
  interface SettableOptions extends Options {
332
341
  enabled?: never;
333
342
  telemetry?: never;
343
+ container?: never;
334
344
  }
335
345
  interface SourceInfo {
336
346
  filePath: string;
337
347
  lineNumber: number | null;
338
348
  componentName: string | null;
339
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
+ }
340
368
  interface ToolbarState {
341
369
  edge: "top" | "bottom" | "left" | "right";
342
370
  ratio: number;
@@ -360,6 +388,7 @@ interface ReactGrabAPI {
360
388
  getToolbarState: () => ToolbarState | null;
361
389
  setToolbarState: (state: Partial<ToolbarState>) => void;
362
390
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
391
+ reset: () => void;
363
392
  dispose: () => void;
364
393
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
365
394
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -405,13 +434,19 @@ interface FrozenLabelEntry {
405
434
  bounds: OverlayBounds;
406
435
  mouseX?: number;
407
436
  }
437
+ interface FrozenLabelEntryAccessor {
438
+ read: () => FrozenLabelEntry | null;
439
+ }
440
+ interface SelectionLabelInstanceAccessor {
441
+ read: () => SelectionLabelInstance | null;
442
+ }
408
443
  interface ReactGrabRendererProps {
409
444
  selectionVisible?: boolean;
410
445
  selectionBounds?: OverlayBounds;
411
446
  selectionBoundsMultiple?: OverlayBounds[];
412
447
  selectionShouldSnap?: boolean;
413
448
  selectionElementsCount?: number;
414
- frozenLabelEntries?: FrozenLabelEntry[];
449
+ frozenLabelEntryAccessors?: FrozenLabelEntryAccessor[];
415
450
  pendingShiftPreviewEntry?: FrozenLabelEntry;
416
451
  selectionFilePath?: string;
417
452
  selectionLineNumber?: number;
@@ -419,9 +454,10 @@ interface ReactGrabRendererProps {
419
454
  selectionComponentName?: string;
420
455
  selectionLabelVisible?: boolean;
421
456
  selectionLabelStatus?: SelectionLabelStatus;
422
- selectionArrowNavigationState?: ArrowNavigationState;
423
- onArrowNavigationSelect?: (index: number) => void;
457
+ hierarchyState?: HierarchyState;
458
+ hierarchyMenuPosition?: DropdownAnchor | null;
424
459
  labelInstances?: SelectionLabelInstance[];
460
+ labelInstanceAccessors?: SelectionLabelInstanceAccessor[];
425
461
  dragVisible?: boolean;
426
462
  dragBounds?: OverlayBounds;
427
463
  grabbedBoxes?: Array<{
@@ -434,12 +470,15 @@ interface ReactGrabRendererProps {
434
470
  inputValue?: string;
435
471
  isPromptMode?: boolean;
436
472
  onShowContextMenuInstance?: (instanceId: string) => void;
473
+ onRetryInstance?: (instanceId: string) => void;
474
+ onAcknowledgeErrorInstance?: (instanceId: string) => void;
437
475
  onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
438
476
  onInputChange?: (value: string) => void;
439
477
  onInputSubmit?: () => void;
440
478
  onToggleExpand?: () => void;
441
479
  selectionLabelShakeCount?: number;
442
480
  onConfirmDismiss?: () => void;
481
+ onOpenSelectionFile?: () => void;
443
482
  discardPrompt?: SelectionDiscardPrompt;
444
483
  toolbarVisible?: boolean;
445
484
  isActive?: boolean;
@@ -521,7 +560,7 @@ interface ReactGrabEntry {
521
560
  frames?: ReactGrabStackFrame[];
522
561
  }
523
562
  //#endregion
524
- //#region ../../node_modules/.pnpm/bippy@0.5.42_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
525
564
  type Flags = number;
526
565
  type Lanes = number;
527
566
  type TypeOfMode = number;
@@ -611,6 +650,14 @@ interface Effect {
611
650
  interface Family {
612
651
  current: unknown;
613
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
+ }
614
661
  /**
615
662
  * Represents a react-internal Fiber node.
616
663
  */
@@ -661,6 +708,7 @@ interface ReactDevToolsGlobalHook {
661
708
  onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void;
662
709
  onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
663
710
  onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
711
+ onScheduleFiberRoot?: (rendererID: number, root: FiberRoot, children: ReactNode) => void;
664
712
  renderers: Map<number, ReactRenderer>;
665
713
  supportsFiber: boolean;
666
714
  supportsFlight: boolean;
@@ -679,10 +727,7 @@ interface ReactRenderer {
679
727
  overridePropsRenamePath?: (fiber: Fiber, oldPath: Array<number | string>, newPath: Array<number | string>) => void;
680
728
  reconcilerVersion: string;
681
729
  rendererPackageName: string;
682
- scheduleRefresh?: (root: FiberRoot, update: {
683
- staleFamilies: Set<Family>;
684
- updatedFamilies: Set<Family>;
685
- }) => void;
730
+ scheduleRefresh?: (root: FiberRoot, update: RendererRefreshUpdate) => void;
686
731
  scheduleRoot?: (root: FiberRoot, element: React.ReactNode) => void;
687
732
  scheduleUpdate?: (fiber: Fiber) => void;
688
733
  setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void;
@@ -693,28 +738,30 @@ interface ReactRenderer {
693
738
  declare global {
694
739
  var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;
695
740
  } //#endregion
696
- //#region src/rdt-hook.d.ts
697
- /**
698
- * Returns `true` if bippy's instrumentation is active.
699
- */
700
- declare const isInstrumentationActive: () => boolean;
701
- /**
702
- * Returns the latest fiber (since it may be double-buffered).
703
- */
741
+ //#region src/unsubscribe.d.ts
704
742
  //#endregion
705
- //#region ../../node_modules/.pnpm/bippy@0.5.42_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
706
744
  //#region src/source/parse-stack.d.ts
707
745
  interface StackFrame {
708
746
  args?: unknown[];
709
747
  columnNumber?: number;
710
748
  lineNumber?: number;
749
+ enclosingLineNumber?: number;
750
+ enclosingColumnNumber?: number;
711
751
  fileName?: string;
712
752
  functionName?: string;
713
753
  source?: string;
714
754
  isServer?: boolean;
715
755
  isSymbolicated?: boolean;
756
+ isIgnoreListed?: boolean;
716
757
  }
717
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
718
765
  //#region src/utils/copy-content.d.ts
719
766
  interface CopyContentOptions {
720
767
  componentName?: string;
@@ -724,4 +771,4 @@ interface CopyContentOptions {
724
771
  }
725
772
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
726
773
  //#endregion
727
- 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-BMr2NQZo.cjs`),t=require(`../freeze-updates-BgilkYa3.cjs`),n=require(`../copy-content-CE1c2qMK.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.I;
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-5FzVj_Qo.cjs";
10
- import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-jMjUhmbS.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-BJATOqZF.js";
10
- import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-C_bngsx-.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-GnLSAWJ2.js";import{I as r}from"../freeze-updates-B9uIB2_2.js";import{n as i,o as a,t as o}from"../copy-content-BdNGJB1g.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};