react-grab 0.1.14 → 0.1.16

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 chunkHH5Y6LBC_cjs=require('../chunk-HH5Y6LBC.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.j}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.d}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.a}});
1
+ 'use strict';var chunkQF65DY25_cjs=require('../chunk-QF65DY25.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkQF65DY25_cjs.j}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunkQF65DY25_cjs.d}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkQF65DY25_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkQF65DY25_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkQF65DY25_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkQF65DY25_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkQF65DY25_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-KT3jIAik.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-DYEETXtH.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-KT3jIAik.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-DYEETXtH.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-WMLJ3P7X.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-RILHLGIL.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
  }
@@ -342,6 +349,7 @@ interface SelectionLabelInstance {
342
349
  boundsMultiple?: OverlayBounds[];
343
350
  tagName: string;
344
351
  componentName?: string;
352
+ elementsCount?: number;
345
353
  status: SelectionLabelStatus;
346
354
  statusText?: string;
347
355
  isPromptMode?: boolean;
@@ -355,12 +363,14 @@ interface SelectionLabelInstance {
355
363
  errorMessage?: string;
356
364
  hideArrow?: boolean;
357
365
  }
358
- interface RecentItem {
366
+ interface HistoryItem {
359
367
  id: string;
360
368
  content: string;
361
369
  elementName: string;
362
370
  tagName: string;
363
371
  componentName?: string;
372
+ elementsCount?: number;
373
+ previewBounds?: OverlayBounds[];
364
374
  isComment: boolean;
365
375
  commentText?: string;
366
376
  timestamp: number;
@@ -443,26 +453,29 @@ interface ReactGrabRendererProps {
443
453
  actionContext?: ActionContext;
444
454
  onContextMenuDismiss?: () => void;
445
455
  onContextMenuHide?: () => void;
446
- recentItems?: RecentItem[];
447
- recentItemCount?: number;
448
- hasUnreadRecentItems?: boolean;
449
- recentDropdownPosition?: DropdownAnchor | null;
450
- onToggleRecent?: () => void;
451
- onRecentButtonHover?: (isHovered: boolean) => void;
452
- onRecentItemSelect?: (item: RecentItem) => void;
453
- onRecentItemRemove?: (item: RecentItem) => void;
454
- onRecentItemCopy?: (item: RecentItem) => void;
455
- onRecentItemHover?: (recentItemId: string | null) => void;
456
- onRecentCopyAll?: () => void;
457
- onRecentCopyAllHover?: (isHovered: boolean) => void;
458
- onRecentClear?: () => void;
459
- onRecentDismiss?: () => void;
456
+ historyItems?: HistoryItem[];
457
+ historyDisconnectedItemIds?: Set<string>;
458
+ historyItemCount?: number;
459
+ hasUnreadHistoryItems?: boolean;
460
+ historyDropdownPosition?: DropdownAnchor | null;
461
+ isHistoryPinned?: boolean;
462
+ onToggleHistory?: () => void;
463
+ onHistoryButtonHover?: (isHovered: boolean) => void;
464
+ onHistoryItemSelect?: (item: HistoryItem) => void;
465
+ onHistoryItemRemove?: (item: HistoryItem) => void;
466
+ onHistoryItemCopy?: (item: HistoryItem) => void;
467
+ onHistoryItemHover?: (historyItemId: string | null) => void;
468
+ onHistoryCopyAll?: () => void;
469
+ onHistoryCopyAllHover?: (isHovered: boolean) => void;
470
+ onHistoryClear?: () => void;
471
+ onHistoryDismiss?: () => void;
472
+ onHistoryDropdownHover?: (isHovered: boolean) => void;
460
473
  }
461
474
  interface GrabbedBox {
462
475
  id: string;
463
476
  bounds: OverlayBounds;
464
477
  createdAt: number;
465
- element: Element;
478
+ element?: Element;
466
479
  }
467
480
  interface Rect {
468
481
  left: number;
@@ -490,9 +503,18 @@ interface GenerateSnippetOptions {
490
503
  }
491
504
  declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOptions) => Promise<string[]>;
492
505
 
506
+ interface ReactGrabEntry {
507
+ tagName?: string;
508
+ componentName?: string;
509
+ content: string;
510
+ commentText?: string;
511
+ }
493
512
  interface CopyContentOptions {
494
513
  onSuccess?: () => void;
495
- name?: string;
514
+ componentName?: string;
515
+ tagName?: string;
516
+ commentText?: string;
517
+ entries?: ReactGrabEntry[];
496
518
  }
497
519
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
498
520
 
@@ -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
  }
@@ -342,6 +349,7 @@ interface SelectionLabelInstance {
342
349
  boundsMultiple?: OverlayBounds[];
343
350
  tagName: string;
344
351
  componentName?: string;
352
+ elementsCount?: number;
345
353
  status: SelectionLabelStatus;
346
354
  statusText?: string;
347
355
  isPromptMode?: boolean;
@@ -355,12 +363,14 @@ interface SelectionLabelInstance {
355
363
  errorMessage?: string;
356
364
  hideArrow?: boolean;
357
365
  }
358
- interface RecentItem {
366
+ interface HistoryItem {
359
367
  id: string;
360
368
  content: string;
361
369
  elementName: string;
362
370
  tagName: string;
363
371
  componentName?: string;
372
+ elementsCount?: number;
373
+ previewBounds?: OverlayBounds[];
364
374
  isComment: boolean;
365
375
  commentText?: string;
366
376
  timestamp: number;
@@ -443,26 +453,29 @@ interface ReactGrabRendererProps {
443
453
  actionContext?: ActionContext;
444
454
  onContextMenuDismiss?: () => void;
445
455
  onContextMenuHide?: () => void;
446
- recentItems?: RecentItem[];
447
- recentItemCount?: number;
448
- hasUnreadRecentItems?: boolean;
449
- recentDropdownPosition?: DropdownAnchor | null;
450
- onToggleRecent?: () => void;
451
- onRecentButtonHover?: (isHovered: boolean) => void;
452
- onRecentItemSelect?: (item: RecentItem) => void;
453
- onRecentItemRemove?: (item: RecentItem) => void;
454
- onRecentItemCopy?: (item: RecentItem) => void;
455
- onRecentItemHover?: (recentItemId: string | null) => void;
456
- onRecentCopyAll?: () => void;
457
- onRecentCopyAllHover?: (isHovered: boolean) => void;
458
- onRecentClear?: () => void;
459
- onRecentDismiss?: () => void;
456
+ historyItems?: HistoryItem[];
457
+ historyDisconnectedItemIds?: Set<string>;
458
+ historyItemCount?: number;
459
+ hasUnreadHistoryItems?: boolean;
460
+ historyDropdownPosition?: DropdownAnchor | null;
461
+ isHistoryPinned?: boolean;
462
+ onToggleHistory?: () => void;
463
+ onHistoryButtonHover?: (isHovered: boolean) => void;
464
+ onHistoryItemSelect?: (item: HistoryItem) => void;
465
+ onHistoryItemRemove?: (item: HistoryItem) => void;
466
+ onHistoryItemCopy?: (item: HistoryItem) => void;
467
+ onHistoryItemHover?: (historyItemId: string | null) => void;
468
+ onHistoryCopyAll?: () => void;
469
+ onHistoryCopyAllHover?: (isHovered: boolean) => void;
470
+ onHistoryClear?: () => void;
471
+ onHistoryDismiss?: () => void;
472
+ onHistoryDropdownHover?: (isHovered: boolean) => void;
460
473
  }
461
474
  interface GrabbedBox {
462
475
  id: string;
463
476
  bounds: OverlayBounds;
464
477
  createdAt: number;
465
- element: Element;
478
+ element?: Element;
466
479
  }
467
480
  interface Rect {
468
481
  left: number;
@@ -490,9 +503,18 @@ interface GenerateSnippetOptions {
490
503
  }
491
504
  declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOptions) => Promise<string[]>;
492
505
 
506
+ interface ReactGrabEntry {
507
+ tagName?: string;
508
+ componentName?: string;
509
+ content: string;
510
+ commentText?: string;
511
+ }
493
512
  interface CopyContentOptions {
494
513
  onSuccess?: () => void;
495
- name?: string;
514
+ componentName?: string;
515
+ tagName?: string;
516
+ commentText?: string;
517
+ entries?: ReactGrabEntry[];
496
518
  }
497
519
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
498
520
 
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkHH5Y6LBC_cjs=require('./chunk-HH5Y6LBC.cjs');/**
1
+ 'use strict';var chunkQF65DY25_cjs=require('./chunk-QF65DY25.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=chunkHH5Y6LBC_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 chunkHH5Y6LBC_cjs.j}});Object.defineProperty(exports,"captureElementScreenshot",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.g}});Object.defineProperty(exports,"combineBounds",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.f}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.n}});Object.defineProperty(exports,"copyHtmlPlugin",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.l}});Object.defineProperty(exports,"copyImageToClipboard",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.h}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.a}});Object.defineProperty(exports,"isScreenshotSupported",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.i}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunkHH5Y6LBC_cjs.m}});Object.defineProperty(exports,"screenshotPlugin",{enumerable:true,get:function(){return chunkHH5Y6LBC_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=chunkQF65DY25_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 chunkQF65DY25_cjs.j}});Object.defineProperty(exports,"captureElementScreenshot",{enumerable:true,get:function(){return chunkQF65DY25_cjs.g}});Object.defineProperty(exports,"combineBounds",{enumerable:true,get:function(){return chunkQF65DY25_cjs.f}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunkQF65DY25_cjs.n}});Object.defineProperty(exports,"copyHtmlPlugin",{enumerable:true,get:function(){return chunkQF65DY25_cjs.l}});Object.defineProperty(exports,"copyImageToClipboard",{enumerable:true,get:function(){return chunkQF65DY25_cjs.h}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkQF65DY25_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkQF65DY25_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkQF65DY25_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkQF65DY25_cjs.o}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkQF65DY25_cjs.a}});Object.defineProperty(exports,"isScreenshotSupported",{enumerable:true,get:function(){return chunkQF65DY25_cjs.i}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunkQF65DY25_cjs.m}});Object.defineProperty(exports,"screenshotPlugin",{enumerable:true,get:function(){return chunkQF65DY25_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-KT3jIAik.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-KT3jIAik.cjs';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-DYEETXtH.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-DYEETXtH.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-KT3jIAik.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-KT3jIAik.js';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-DYEETXtH.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-DYEETXtH.js';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5