react-grab 0.1.13 → 0.1.15

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.
@@ -1 +1 @@
1
- 'use strict';var chunk2T22V7DM_cjs=require('../chunk-2T22V7DM.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.j}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.d}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.a}});
1
+ 'use strict';var chunkEFUDUWZJ_cjs=require('../chunk-EFUDUWZJ.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.j}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.d}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.a}});
@@ -1,3 +1,3 @@
1
- export { v as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, x as PluginConfig, y as PluginHooks, R as ReactGrabAPI, z as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, B as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-CNwr6CHX.cjs';
1
+ export { v as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, x as PluginConfig, y as PluginHooks, R as ReactGrabAPI, z as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, B as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BR6gp9du.cjs';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
@@ -1,3 +1,3 @@
1
- export { v as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, x as PluginConfig, y as PluginHooks, R as ReactGrabAPI, z as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, B as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-CNwr6CHX.js';
1
+ export { v as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, x as PluginConfig, y as PluginHooks, R as ReactGrabAPI, z as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, B as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BR6gp9du.js';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
@@ -1 +1 @@
1
- export{j as DEFAULT_THEME,d as copyContent,c as formatElementInfo,e as generateSnippet,b as getStack,o as init,a as isInstrumentationActive}from'../chunk-VR2ILUMN.js';
1
+ export{j as DEFAULT_THEME,d as copyContent,c as formatElementInfo,e as generateSnippet,b as getStack,o as init,a as isInstrumentationActive}from'../chunk-CRY4UGGA.js';
@@ -95,6 +95,13 @@ interface ReactGrabState {
95
95
  bounds: OverlayBounds;
96
96
  createdAt: number;
97
97
  }>;
98
+ labelInstances: Array<{
99
+ id: string;
100
+ status: SelectionLabelStatus;
101
+ tagName: string;
102
+ componentName?: string;
103
+ createdAt: number;
104
+ }>;
98
105
  selectionFilePath: string | null;
99
106
  toolbarState: ToolbarState | null;
100
107
  }
@@ -301,6 +308,12 @@ interface ToolbarState {
301
308
  collapsed: boolean;
302
309
  enabled: boolean;
303
310
  }
311
+ interface DropdownAnchor {
312
+ x: number;
313
+ y: number;
314
+ edge: ToolbarState["edge"];
315
+ toolbarWidth: number;
316
+ }
304
317
  interface ReactGrabAPI {
305
318
  activate: () => void;
306
319
  deactivate: () => void;
@@ -337,6 +350,9 @@ interface SelectionLabelInstance {
337
350
  tagName: string;
338
351
  componentName?: string;
339
352
  status: SelectionLabelStatus;
353
+ statusText?: string;
354
+ isPromptMode?: boolean;
355
+ inputValue?: string;
340
356
  createdAt: number;
341
357
  element?: Element;
342
358
  elements?: Element[];
@@ -344,6 +360,17 @@ interface SelectionLabelInstance {
344
360
  mouseXOffsetFromCenter?: number;
345
361
  mouseXOffsetRatio?: number;
346
362
  errorMessage?: string;
363
+ hideArrow?: boolean;
364
+ }
365
+ interface HistoryItem {
366
+ id: string;
367
+ content: string;
368
+ elementName: string;
369
+ tagName: string;
370
+ componentName?: string;
371
+ isComment: boolean;
372
+ commentText?: string;
373
+ timestamp: number;
347
374
  }
348
375
  interface ReactGrabRendererProps {
349
376
  selectionVisible?: boolean;
@@ -410,6 +437,7 @@ interface ReactGrabRendererProps {
410
437
  onToolbarStateChange?: (state: ToolbarState) => void;
411
438
  onSubscribeToToolbarStateChanges?: (callback: (state: ToolbarState) => void) => () => void;
412
439
  onToolbarSelectHoverChange?: (isHovered: boolean) => void;
440
+ onToolbarRef?: (element: HTMLDivElement) => void;
413
441
  contextMenuPosition?: {
414
442
  x: number;
415
443
  y: number;
@@ -422,6 +450,23 @@ interface ReactGrabRendererProps {
422
450
  actionContext?: ActionContext;
423
451
  onContextMenuDismiss?: () => void;
424
452
  onContextMenuHide?: () => void;
453
+ historyItems?: HistoryItem[];
454
+ historyDisconnectedItemIds?: Set<string>;
455
+ historyItemCount?: number;
456
+ hasUnreadHistoryItems?: boolean;
457
+ historyDropdownPosition?: DropdownAnchor | null;
458
+ isHistoryPinned?: boolean;
459
+ onToggleHistory?: () => void;
460
+ onHistoryButtonHover?: (isHovered: boolean) => void;
461
+ onHistoryItemSelect?: (item: HistoryItem) => void;
462
+ onHistoryItemRemove?: (item: HistoryItem) => void;
463
+ onHistoryItemCopy?: (item: HistoryItem) => void;
464
+ onHistoryItemHover?: (historyItemId: string | null) => void;
465
+ onHistoryCopyAll?: () => void;
466
+ onHistoryCopyAllHover?: (isHovered: boolean) => void;
467
+ onHistoryClear?: () => void;
468
+ onHistoryDismiss?: () => void;
469
+ onHistoryDropdownHover?: (isHovered: boolean) => void;
425
470
  }
426
471
  interface GrabbedBox {
427
472
  id: string;
@@ -455,9 +500,18 @@ interface GenerateSnippetOptions {
455
500
  }
456
501
  declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOptions) => Promise<string[]>;
457
502
 
503
+ interface ReactGrabEntry {
504
+ tagName?: string;
505
+ componentName?: string;
506
+ content: string;
507
+ commentText?: string;
508
+ }
458
509
  interface CopyContentOptions {
459
510
  onSuccess?: () => void;
460
- name?: string;
511
+ componentName?: string;
512
+ tagName?: string;
513
+ commentText?: string;
514
+ entries?: ReactGrabEntry[];
461
515
  }
462
516
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
463
517
 
@@ -95,6 +95,13 @@ interface ReactGrabState {
95
95
  bounds: OverlayBounds;
96
96
  createdAt: number;
97
97
  }>;
98
+ labelInstances: Array<{
99
+ id: string;
100
+ status: SelectionLabelStatus;
101
+ tagName: string;
102
+ componentName?: string;
103
+ createdAt: number;
104
+ }>;
98
105
  selectionFilePath: string | null;
99
106
  toolbarState: ToolbarState | null;
100
107
  }
@@ -301,6 +308,12 @@ interface ToolbarState {
301
308
  collapsed: boolean;
302
309
  enabled: boolean;
303
310
  }
311
+ interface DropdownAnchor {
312
+ x: number;
313
+ y: number;
314
+ edge: ToolbarState["edge"];
315
+ toolbarWidth: number;
316
+ }
304
317
  interface ReactGrabAPI {
305
318
  activate: () => void;
306
319
  deactivate: () => void;
@@ -337,6 +350,9 @@ interface SelectionLabelInstance {
337
350
  tagName: string;
338
351
  componentName?: string;
339
352
  status: SelectionLabelStatus;
353
+ statusText?: string;
354
+ isPromptMode?: boolean;
355
+ inputValue?: string;
340
356
  createdAt: number;
341
357
  element?: Element;
342
358
  elements?: Element[];
@@ -344,6 +360,17 @@ interface SelectionLabelInstance {
344
360
  mouseXOffsetFromCenter?: number;
345
361
  mouseXOffsetRatio?: number;
346
362
  errorMessage?: string;
363
+ hideArrow?: boolean;
364
+ }
365
+ interface HistoryItem {
366
+ id: string;
367
+ content: string;
368
+ elementName: string;
369
+ tagName: string;
370
+ componentName?: string;
371
+ isComment: boolean;
372
+ commentText?: string;
373
+ timestamp: number;
347
374
  }
348
375
  interface ReactGrabRendererProps {
349
376
  selectionVisible?: boolean;
@@ -410,6 +437,7 @@ interface ReactGrabRendererProps {
410
437
  onToolbarStateChange?: (state: ToolbarState) => void;
411
438
  onSubscribeToToolbarStateChanges?: (callback: (state: ToolbarState) => void) => () => void;
412
439
  onToolbarSelectHoverChange?: (isHovered: boolean) => void;
440
+ onToolbarRef?: (element: HTMLDivElement) => void;
413
441
  contextMenuPosition?: {
414
442
  x: number;
415
443
  y: number;
@@ -422,6 +450,23 @@ interface ReactGrabRendererProps {
422
450
  actionContext?: ActionContext;
423
451
  onContextMenuDismiss?: () => void;
424
452
  onContextMenuHide?: () => void;
453
+ historyItems?: HistoryItem[];
454
+ historyDisconnectedItemIds?: Set<string>;
455
+ historyItemCount?: number;
456
+ hasUnreadHistoryItems?: boolean;
457
+ historyDropdownPosition?: DropdownAnchor | null;
458
+ isHistoryPinned?: boolean;
459
+ onToggleHistory?: () => void;
460
+ onHistoryButtonHover?: (isHovered: boolean) => void;
461
+ onHistoryItemSelect?: (item: HistoryItem) => void;
462
+ onHistoryItemRemove?: (item: HistoryItem) => void;
463
+ onHistoryItemCopy?: (item: HistoryItem) => void;
464
+ onHistoryItemHover?: (historyItemId: string | null) => void;
465
+ onHistoryCopyAll?: () => void;
466
+ onHistoryCopyAllHover?: (isHovered: boolean) => void;
467
+ onHistoryClear?: () => void;
468
+ onHistoryDismiss?: () => void;
469
+ onHistoryDropdownHover?: (isHovered: boolean) => void;
425
470
  }
426
471
  interface GrabbedBox {
427
472
  id: string;
@@ -455,9 +500,18 @@ interface GenerateSnippetOptions {
455
500
  }
456
501
  declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOptions) => Promise<string[]>;
457
502
 
503
+ interface ReactGrabEntry {
504
+ tagName?: string;
505
+ componentName?: string;
506
+ content: string;
507
+ commentText?: string;
508
+ }
458
509
  interface CopyContentOptions {
459
510
  onSuccess?: () => void;
460
- name?: string;
511
+ componentName?: string;
512
+ tagName?: string;
513
+ commentText?: string;
514
+ entries?: ReactGrabEntry[];
461
515
  }
462
516
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
463
517
 
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunk2T22V7DM_cjs=require('./chunk-2T22V7DM.cjs');/**
1
+ 'use strict';var chunkEFUDUWZJ_cjs=require('./chunk-EFUDUWZJ.cjs');/**
2
2
  * @license MIT
3
3
  *
4
4
  * Copyright (c) 2025 Aiden Bai
@@ -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
- var e=null,R=()=>typeof window>"u"?e:window.__REACT_GRAB__??e??null,g=t=>{e=t,typeof window<"u"&&(t?window.__REACT_GRAB__=t:delete window.__REACT_GRAB__);};typeof window<"u"&&(window.__REACT_GRAB__?e=window.__REACT_GRAB__:(e=chunk2T22V7DM_cjs.o(),window.__REACT_GRAB__=e),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:e})));Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.j}});Object.defineProperty(exports,"captureElementScreenshot",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.g}});Object.defineProperty(exports,"combineBounds",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.f}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.n}});Object.defineProperty(exports,"copyHtmlPlugin",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.l}});Object.defineProperty(exports,"copyImageToClipboard",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.h}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.a}});Object.defineProperty(exports,"isScreenshotSupported",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.i}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.m}});Object.defineProperty(exports,"screenshotPlugin",{enumerable:true,get:function(){return chunk2T22V7DM_cjs.k}});exports.getGlobalApi=R;exports.setGlobalApi=g;
9
+ var e=null,R=()=>typeof window>"u"?e:window.__REACT_GRAB__??e??null,g=t=>{e=t,typeof window<"u"&&(t?window.__REACT_GRAB__=t:delete window.__REACT_GRAB__);};typeof window<"u"&&(window.__REACT_GRAB__?e=window.__REACT_GRAB__:(e=chunkEFUDUWZJ_cjs.o(),window.__REACT_GRAB__=e),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:e})));Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.j}});Object.defineProperty(exports,"captureElementScreenshot",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.g}});Object.defineProperty(exports,"combineBounds",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.f}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.n}});Object.defineProperty(exports,"copyHtmlPlugin",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.l}});Object.defineProperty(exports,"copyImageToClipboard",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.h}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.a}});Object.defineProperty(exports,"isScreenshotSupported",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.i}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.m}});Object.defineProperty(exports,"screenshotPlugin",{enumerable:true,get:function(){return chunkEFUDUWZJ_cjs.k}});exports.getGlobalApi=R;exports.setGlobalApi=g;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as Plugin, R as ReactGrabAPI } from './index-CNwr6CHX.cjs';
2
- export { v as ActionContext, w as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, x as PluginConfig, y as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-CNwr6CHX.cjs';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-BR6gp9du.cjs';
2
+ export { v as ActionContext, w as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, x as PluginConfig, y as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BR6gp9du.cjs';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as Plugin, R as ReactGrabAPI } from './index-CNwr6CHX.js';
2
- export { v as ActionContext, w as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, x as PluginConfig, y as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-CNwr6CHX.js';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-BR6gp9du.js';
2
+ export { v as ActionContext, w as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, x as PluginConfig, y as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BR6gp9du.js';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5