react-grab 0.1.17 → 0.1.18

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 chunkILQ5JMGX_cjs=require('../chunk-ILQ5JMGX.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.j}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.d}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.m}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.a}});
1
+ 'use strict';var chunkKEHU35AI_cjs=require('../chunk-KEHU35AI.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.f}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.d}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.i}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.a}});
@@ -1,3 +1,3 @@
1
- export { x 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, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BCkTVQa8.cjs';
1
+ export { x 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, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BgQgrh_y.cjs';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
@@ -1,3 +1,3 @@
1
- export { x 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, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BCkTVQa8.js';
1
+ export { x 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, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BgQgrh_y.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,m as init,a as isInstrumentationActive}from'../chunk-WBYGVXEQ.js';
1
+ export{f as DEFAULT_THEME,d as copyContent,c as formatElementInfo,e as generateSnippet,b as getStack,i as init,a as isInstrumentationActive}from'../chunk-TT33H3TZ.js';
@@ -187,7 +187,6 @@ interface AgentOptions<T = any> {
187
187
  type ActivationMode = "toggle" | "hold";
188
188
  interface ActionContextHooks {
189
189
  transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
190
- transformScreenshot: (blob: Blob, elements: Element[], bounds: ScreenshotBounds) => Promise<Blob>;
191
190
  onOpenFile: (filePath: string, lineNumber?: number) => boolean | void;
192
191
  transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string;
193
192
  }
@@ -202,8 +201,6 @@ interface ActionContext {
202
201
  hooks: ActionContextHooks;
203
202
  performWithFeedback: (action: () => Promise<boolean>) => Promise<void>;
204
203
  hideContextMenu: () => void;
205
- hideOverlay: () => void;
206
- showOverlay: () => void;
207
204
  cleanup: () => void;
208
205
  }
209
206
  interface ContextMenuActionContext extends ActionContext {
@@ -228,12 +225,6 @@ interface ActionCycleState {
228
225
  activeIndex: number | null;
229
226
  isVisible: boolean;
230
227
  }
231
- interface ScreenshotBounds {
232
- x: number;
233
- y: number;
234
- width: number;
235
- height: number;
236
- }
237
228
  interface PluginHooks {
238
229
  onActivate?: () => void;
239
230
  onDeactivate?: () => void;
@@ -260,7 +251,6 @@ interface PluginHooks {
260
251
  }) => void;
261
252
  onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
262
253
  transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
263
- transformScreenshot?: (blob: Blob, elements: Element[], bounds: ScreenshotBounds) => Blob | Promise<Blob>;
264
254
  transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
265
255
  transformActionContext?: (context: ActionContext) => ActionContext;
266
256
  transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string;
@@ -340,6 +330,7 @@ interface ReactGrabAPI {
340
330
  dispose: () => void;
341
331
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
342
332
  getSource: (element: Element) => Promise<SourceInfo | null>;
333
+ getStackContext: (element: Element) => Promise<string>;
343
334
  getState: () => ReactGrabState;
344
335
  setOptions: (options: SettableOptions) => void;
345
336
  registerPlugin: (plugin: Plugin) => void;
@@ -513,10 +504,10 @@ interface DragRect {
513
504
  }
514
505
 
515
506
  declare const getStack: (element: Element) => Promise<StackFrame[] | null>;
516
- interface GetElementContextOptions {
507
+ interface StackContextOptions {
517
508
  maxLines?: number;
518
509
  }
519
- declare const getElementContext: (element: Element, options?: GetElementContextOptions) => Promise<string>;
510
+ declare const getElementContext: (element: Element, options?: StackContextOptions) => Promise<string>;
520
511
 
521
512
  declare const DEFAULT_THEME: Required<Theme>;
522
513
 
@@ -187,7 +187,6 @@ interface AgentOptions<T = any> {
187
187
  type ActivationMode = "toggle" | "hold";
188
188
  interface ActionContextHooks {
189
189
  transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
190
- transformScreenshot: (blob: Blob, elements: Element[], bounds: ScreenshotBounds) => Promise<Blob>;
191
190
  onOpenFile: (filePath: string, lineNumber?: number) => boolean | void;
192
191
  transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string;
193
192
  }
@@ -202,8 +201,6 @@ interface ActionContext {
202
201
  hooks: ActionContextHooks;
203
202
  performWithFeedback: (action: () => Promise<boolean>) => Promise<void>;
204
203
  hideContextMenu: () => void;
205
- hideOverlay: () => void;
206
- showOverlay: () => void;
207
204
  cleanup: () => void;
208
205
  }
209
206
  interface ContextMenuActionContext extends ActionContext {
@@ -228,12 +225,6 @@ interface ActionCycleState {
228
225
  activeIndex: number | null;
229
226
  isVisible: boolean;
230
227
  }
231
- interface ScreenshotBounds {
232
- x: number;
233
- y: number;
234
- width: number;
235
- height: number;
236
- }
237
228
  interface PluginHooks {
238
229
  onActivate?: () => void;
239
230
  onDeactivate?: () => void;
@@ -260,7 +251,6 @@ interface PluginHooks {
260
251
  }) => void;
261
252
  onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
262
253
  transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
263
- transformScreenshot?: (blob: Blob, elements: Element[], bounds: ScreenshotBounds) => Blob | Promise<Blob>;
264
254
  transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
265
255
  transformActionContext?: (context: ActionContext) => ActionContext;
266
256
  transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string;
@@ -340,6 +330,7 @@ interface ReactGrabAPI {
340
330
  dispose: () => void;
341
331
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
342
332
  getSource: (element: Element) => Promise<SourceInfo | null>;
333
+ getStackContext: (element: Element) => Promise<string>;
343
334
  getState: () => ReactGrabState;
344
335
  setOptions: (options: SettableOptions) => void;
345
336
  registerPlugin: (plugin: Plugin) => void;
@@ -513,10 +504,10 @@ interface DragRect {
513
504
  }
514
505
 
515
506
  declare const getStack: (element: Element) => Promise<StackFrame[] | null>;
516
- interface GetElementContextOptions {
507
+ interface StackContextOptions {
517
508
  maxLines?: number;
518
509
  }
519
- declare const getElementContext: (element: Element, options?: GetElementContextOptions) => Promise<string>;
510
+ declare const getElementContext: (element: Element, options?: StackContextOptions) => Promise<string>;
520
511
 
521
512
  declare const DEFAULT_THEME: Required<Theme>;
522
513
 
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkILQ5JMGX_cjs=require('./chunk-ILQ5JMGX.cjs');/**
1
+ 'use strict';var chunkKEHU35AI_cjs=require('./chunk-KEHU35AI.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,m=()=>typeof window>"u"?e:window.__REACT_GRAB__??e??null,f=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=chunkILQ5JMGX_cjs.m(),window.__REACT_GRAB__=e),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:e})));Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.j}});Object.defineProperty(exports,"captureElementScreenshot",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.g}});Object.defineProperty(exports,"combineBounds",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.f}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.k}});Object.defineProperty(exports,"copyImageToClipboard",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.h}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.m}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.a}});Object.defineProperty(exports,"isScreenshotSupported",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.i}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunkILQ5JMGX_cjs.l}});exports.getGlobalApi=m;exports.setGlobalApi=f;
9
+ var e=null,d=()=>typeof window>"u"?e:window.__REACT_GRAB__??e??null,c=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=chunkKEHU35AI_cjs.i(),window.__REACT_GRAB__=e),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:e})));Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.f}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.g}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.c}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.e}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.i}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.a}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunkKEHU35AI_cjs.h}});exports.getGlobalApi=d;exports.setGlobalApi=c;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as Plugin, R as ReactGrabAPI } from './index-BCkTVQa8.cjs';
2
- export { x as ActionContext, y 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, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BCkTVQa8.cjs';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-BgQgrh_y.cjs';
2
+ export { x as ActionContext, y 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, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BgQgrh_y.cjs';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5
 
@@ -7,18 +7,6 @@ declare const commentPlugin: Plugin;
7
7
 
8
8
  declare const openPlugin: Plugin;
9
9
 
10
- interface ElementBounds {
11
- x: number;
12
- y: number;
13
- width: number;
14
- height: number;
15
- }
16
- declare const combineBounds: (boundsList: ElementBounds[]) => ElementBounds;
17
- declare const captureElementScreenshot: (bounds: ElementBounds) => Promise<Blob>;
18
- declare const copyImageToClipboard: (blob: Blob) => Promise<boolean>;
19
-
20
- declare const isScreenshotSupported: () => boolean;
21
-
22
10
  declare global {
23
11
  interface Window {
24
12
  __REACT_GRAB__?: ReactGrabAPI;
@@ -27,4 +15,4 @@ declare global {
27
15
  declare const getGlobalApi: () => ReactGrabAPI | null;
28
16
  declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
29
17
 
30
- export { type ElementBounds, Plugin, ReactGrabAPI, captureElementScreenshot, combineBounds, commentPlugin, copyImageToClipboard, getGlobalApi, isScreenshotSupported, openPlugin, setGlobalApi };
18
+ export { Plugin, ReactGrabAPI, commentPlugin, getGlobalApi, openPlugin, setGlobalApi };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as Plugin, R as ReactGrabAPI } from './index-BCkTVQa8.js';
2
- export { x as ActionContext, y 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, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BCkTVQa8.js';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-BgQgrh_y.js';
2
+ export { x as ActionContext, y 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, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BgQgrh_y.js';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5
 
@@ -7,18 +7,6 @@ declare const commentPlugin: Plugin;
7
7
 
8
8
  declare const openPlugin: Plugin;
9
9
 
10
- interface ElementBounds {
11
- x: number;
12
- y: number;
13
- width: number;
14
- height: number;
15
- }
16
- declare const combineBounds: (boundsList: ElementBounds[]) => ElementBounds;
17
- declare const captureElementScreenshot: (bounds: ElementBounds) => Promise<Blob>;
18
- declare const copyImageToClipboard: (blob: Blob) => Promise<boolean>;
19
-
20
- declare const isScreenshotSupported: () => boolean;
21
-
22
10
  declare global {
23
11
  interface Window {
24
12
  __REACT_GRAB__?: ReactGrabAPI;
@@ -27,4 +15,4 @@ declare global {
27
15
  declare const getGlobalApi: () => ReactGrabAPI | null;
28
16
  declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
29
17
 
30
- export { type ElementBounds, Plugin, ReactGrabAPI, captureElementScreenshot, combineBounds, commentPlugin, copyImageToClipboard, getGlobalApi, isScreenshotSupported, openPlugin, setGlobalApi };
18
+ export { Plugin, ReactGrabAPI, commentPlugin, getGlobalApi, openPlugin, setGlobalApi };