react-grab 0.0.60 → 0.0.61

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,4 +1,4 @@
1
- import { FiberSource } from 'bippy/source';
1
+ import { StackFrame } from 'bippy/source';
2
2
  import 'bippy';
3
3
 
4
4
  type DeepPartial<T> = {
@@ -233,6 +233,7 @@ interface Options {
233
233
  enabled?: boolean;
234
234
  keyHoldDuration?: number;
235
235
  allowActivationInsideInput?: boolean;
236
+ maxContextLines?: number;
236
237
  theme?: Theme;
237
238
  activationShortcut?: (event: KeyboardEvent) => boolean;
238
239
  activationKey?: ActivationKey;
@@ -287,6 +288,7 @@ interface SelectionLabelInstance {
287
288
  status: SelectionLabelStatus;
288
289
  createdAt: number;
289
290
  element?: Element;
291
+ mouseX?: number;
290
292
  }
291
293
  interface ReactGrabRendererProps {
292
294
  selectionVisible?: boolean;
@@ -351,18 +353,20 @@ interface Position {
351
353
  top: number;
352
354
  }
353
355
 
354
- interface StackFrame {
355
- name: string;
356
- source: FiberSource | null;
356
+ declare const getStack: (element: Element) => Promise<StackFrame[] | null>;
357
+ interface GetElementContextOptions {
358
+ maxLines?: number;
357
359
  }
358
- declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
359
- declare const formatElementInfo: (element: Element) => Promise<string>;
360
+ declare const getElementContext: (element: Element, options?: GetElementContextOptions) => Promise<string>;
360
361
  declare const getFileName: (stack: Array<StackFrame>) => string | null;
361
362
 
362
363
  declare const DEFAULT_THEME: Required<Theme>;
363
364
 
364
- declare const generateSnippet: (elements: Element[]) => Promise<string>;
365
+ interface GenerateSnippetOptions {
366
+ maxLines?: number;
367
+ }
368
+ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOptions) => Promise<string>;
365
369
 
366
370
  declare const init: (rawOptions?: Options) => ReactGrabAPI;
367
371
 
368
- export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type Position as P, type ReactGrabAPI as R, type SuccessLabelType as S, type Theme as T, generateSnippet as a, type ReactGrabState as b, type RenderType as c, type RenderData as d, type OverlayBounds as e, formatElementInfo as f, getStack as g, type DragRect as h, init as i, type Rect as j, type DeepPartial as k, type SuccessLabelContext as l, type ElementLabelContext as m, type AgentSession as n, type AgentProvider as o, type AgentSessionStorage as p, type AgentOptions as q, getFileName as r, type ReactGrabRendererProps as s };
372
+ export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type Position as P, type ReactGrabAPI as R, type SuccessLabelType as S, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type RenderType as d, type RenderData as e, type OverlayBounds as f, getStack as g, type DragRect as h, init as i, type Rect as j, type DeepPartial as k, type SuccessLabelContext as l, type ElementLabelContext as m, type AgentSession as n, type AgentProvider as o, type AgentSessionStorage as p, type AgentOptions as q, getFileName as r, type ReactGrabRendererProps as s };
@@ -1,4 +1,4 @@
1
- import { FiberSource } from 'bippy/source';
1
+ import { StackFrame } from 'bippy/source';
2
2
  import 'bippy';
3
3
 
4
4
  type DeepPartial<T> = {
@@ -233,6 +233,7 @@ interface Options {
233
233
  enabled?: boolean;
234
234
  keyHoldDuration?: number;
235
235
  allowActivationInsideInput?: boolean;
236
+ maxContextLines?: number;
236
237
  theme?: Theme;
237
238
  activationShortcut?: (event: KeyboardEvent) => boolean;
238
239
  activationKey?: ActivationKey;
@@ -287,6 +288,7 @@ interface SelectionLabelInstance {
287
288
  status: SelectionLabelStatus;
288
289
  createdAt: number;
289
290
  element?: Element;
291
+ mouseX?: number;
290
292
  }
291
293
  interface ReactGrabRendererProps {
292
294
  selectionVisible?: boolean;
@@ -351,18 +353,20 @@ interface Position {
351
353
  top: number;
352
354
  }
353
355
 
354
- interface StackFrame {
355
- name: string;
356
- source: FiberSource | null;
356
+ declare const getStack: (element: Element) => Promise<StackFrame[] | null>;
357
+ interface GetElementContextOptions {
358
+ maxLines?: number;
357
359
  }
358
- declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
359
- declare const formatElementInfo: (element: Element) => Promise<string>;
360
+ declare const getElementContext: (element: Element, options?: GetElementContextOptions) => Promise<string>;
360
361
  declare const getFileName: (stack: Array<StackFrame>) => string | null;
361
362
 
362
363
  declare const DEFAULT_THEME: Required<Theme>;
363
364
 
364
- declare const generateSnippet: (elements: Element[]) => Promise<string>;
365
+ interface GenerateSnippetOptions {
366
+ maxLines?: number;
367
+ }
368
+ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOptions) => Promise<string>;
365
369
 
366
370
  declare const init: (rawOptions?: Options) => ReactGrabAPI;
367
371
 
368
- export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type Position as P, type ReactGrabAPI as R, type SuccessLabelType as S, type Theme as T, generateSnippet as a, type ReactGrabState as b, type RenderType as c, type RenderData as d, type OverlayBounds as e, formatElementInfo as f, getStack as g, type DragRect as h, init as i, type Rect as j, type DeepPartial as k, type SuccessLabelContext as l, type ElementLabelContext as m, type AgentSession as n, type AgentProvider as o, type AgentSessionStorage as p, type AgentOptions as q, getFileName as r, type ReactGrabRendererProps as s };
372
+ export { type AgentContext as A, type CrosshairContext as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type InputModeContext as I, type Options as O, type Position as P, type ReactGrabAPI as R, type SuccessLabelType as S, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type RenderType as d, type RenderData as e, type OverlayBounds as f, getStack as g, type DragRect as h, init as i, type Rect as j, type DeepPartial as k, type SuccessLabelContext as l, type ElementLabelContext as m, type AgentSession as n, type AgentProvider as o, type AgentSessionStorage as p, type AgentOptions as q, getFileName as r, type ReactGrabRendererProps as s };
package/dist/core.cjs CHANGED
@@ -1,34 +1,34 @@
1
1
  'use strict';
2
2
 
3
- var chunk66O4TVGR_cjs = require('./chunk-66O4TVGR.cjs');
3
+ var chunk2EGDLG6B_cjs = require('./chunk-2EGDLG6B.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "DEFAULT_THEME", {
8
8
  enumerable: true,
9
- get: function () { return chunk66O4TVGR_cjs.DEFAULT_THEME; }
9
+ get: function () { return chunk2EGDLG6B_cjs.DEFAULT_THEME; }
10
10
  });
11
11
  Object.defineProperty(exports, "formatElementInfo", {
12
12
  enumerable: true,
13
- get: function () { return chunk66O4TVGR_cjs.formatElementInfo; }
13
+ get: function () { return chunk2EGDLG6B_cjs.getElementContext; }
14
14
  });
15
15
  Object.defineProperty(exports, "generateSnippet", {
16
16
  enumerable: true,
17
- get: function () { return chunk66O4TVGR_cjs.generateSnippet; }
17
+ get: function () { return chunk2EGDLG6B_cjs.generateSnippet; }
18
18
  });
19
19
  Object.defineProperty(exports, "getFileName", {
20
20
  enumerable: true,
21
- get: function () { return chunk66O4TVGR_cjs.getFileName; }
21
+ get: function () { return chunk2EGDLG6B_cjs.getFileName; }
22
22
  });
23
23
  Object.defineProperty(exports, "getStack", {
24
24
  enumerable: true,
25
- get: function () { return chunk66O4TVGR_cjs.getStack; }
25
+ get: function () { return chunk2EGDLG6B_cjs.getStack; }
26
26
  });
27
27
  Object.defineProperty(exports, "init", {
28
28
  enumerable: true,
29
- get: function () { return chunk66O4TVGR_cjs.init; }
29
+ get: function () { return chunk2EGDLG6B_cjs.init; }
30
30
  });
31
31
  Object.defineProperty(exports, "isInstrumentationActive", {
32
32
  enumerable: true,
33
- get: function () { return chunk66O4TVGR_cjs.Ee; }
33
+ get: function () { return chunk2EGDLG6B_cjs.Ee; }
34
34
  });
package/dist/core.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AgentContext, o as AgentProvider, n as AgentSession, D as DEFAULT_THEME, O as Options, e as OverlayBounds, R as ReactGrabAPI, s as ReactGrabRendererProps, f as formatElementInfo, a as generateSnippet, r as getFileName, g as getStack, i as init } from './core-DZ65ta1h.cjs';
1
+ export { A as AgentContext, o as AgentProvider, n as AgentSession, D as DEFAULT_THEME, O as Options, f as OverlayBounds, R as ReactGrabAPI, s as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, r as getFileName, g as getStack, i as init } from './core-Dpg0VXHq.cjs';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
package/dist/core.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AgentContext, o as AgentProvider, n as AgentSession, D as DEFAULT_THEME, O as Options, e as OverlayBounds, R as ReactGrabAPI, s as ReactGrabRendererProps, f as formatElementInfo, a as generateSnippet, r as getFileName, g as getStack, i as init } from './core-DZ65ta1h.js';
1
+ export { A as AgentContext, o as AgentProvider, n as AgentSession, D as DEFAULT_THEME, O as Options, f as OverlayBounds, R as ReactGrabAPI, s as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, r as getFileName, g as getStack, i as init } from './core-Dpg0VXHq.js';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- export { DEFAULT_THEME, formatElementInfo, generateSnippet, getFileName, getStack, init, Ee as isInstrumentationActive } from './chunk-Z5JJYMJY.js';
1
+ export { DEFAULT_THEME, getElementContext as formatElementInfo, generateSnippet, getFileName, getStack, init, Ee as isInstrumentationActive } from './chunk-BPIV2CRB.js';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk66O4TVGR_cjs = require('./chunk-66O4TVGR.cjs');
3
+ var chunk2EGDLG6B_cjs = require('./chunk-2EGDLG6B.cjs');
4
4
 
5
5
  /**
6
6
  * @license MIT
@@ -31,7 +31,7 @@ if (typeof window !== "undefined") {
31
31
  if (window.__REACT_GRAB__) {
32
32
  globalApi = window.__REACT_GRAB__;
33
33
  } else {
34
- globalApi = chunk66O4TVGR_cjs.init();
34
+ globalApi = chunk2EGDLG6B_cjs.init();
35
35
  window.__REACT_GRAB__ = globalApi;
36
36
  window.dispatchEvent(
37
37
  new CustomEvent("react-grab:init", { detail: globalApi })
@@ -41,27 +41,27 @@ if (typeof window !== "undefined") {
41
41
 
42
42
  Object.defineProperty(exports, "DEFAULT_THEME", {
43
43
  enumerable: true,
44
- get: function () { return chunk66O4TVGR_cjs.DEFAULT_THEME; }
44
+ get: function () { return chunk2EGDLG6B_cjs.DEFAULT_THEME; }
45
45
  });
46
46
  Object.defineProperty(exports, "formatElementInfo", {
47
47
  enumerable: true,
48
- get: function () { return chunk66O4TVGR_cjs.formatElementInfo; }
48
+ get: function () { return chunk2EGDLG6B_cjs.getElementContext; }
49
49
  });
50
50
  Object.defineProperty(exports, "generateSnippet", {
51
51
  enumerable: true,
52
- get: function () { return chunk66O4TVGR_cjs.generateSnippet; }
52
+ get: function () { return chunk2EGDLG6B_cjs.generateSnippet; }
53
53
  });
54
54
  Object.defineProperty(exports, "getStack", {
55
55
  enumerable: true,
56
- get: function () { return chunk66O4TVGR_cjs.getStack; }
56
+ get: function () { return chunk2EGDLG6B_cjs.getStack; }
57
57
  });
58
58
  Object.defineProperty(exports, "init", {
59
59
  enumerable: true,
60
- get: function () { return chunk66O4TVGR_cjs.init; }
60
+ get: function () { return chunk2EGDLG6B_cjs.init; }
61
61
  });
62
62
  Object.defineProperty(exports, "isInstrumentationActive", {
63
63
  enumerable: true,
64
- get: function () { return chunk66O4TVGR_cjs.Ee; }
64
+ get: function () { return chunk2EGDLG6B_cjs.Ee; }
65
65
  });
66
66
  exports.getGlobalApi = getGlobalApi;
67
67
  exports.setGlobalApi = setGlobalApi;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as ReactGrabAPI } from './core-DZ65ta1h.cjs';
2
- export { A as AgentContext, q as AgentOptions, o as AgentProvider, n as AgentSession, p as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, k as DeepPartial, h as DragRect, m as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, e as OverlayBounds, P as Position, b as ReactGrabState, j as Rect, d as RenderData, c as RenderType, l as SuccessLabelContext, S as SuccessLabelType, T as Theme, f as formatElementInfo, a as generateSnippet, g as getStack, i as init } from './core-DZ65ta1h.cjs';
1
+ import { R as ReactGrabAPI } from './core-Dpg0VXHq.cjs';
2
+ export { A as AgentContext, q as AgentOptions, o as AgentProvider, n as AgentSession, p as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, k as DeepPartial, h as DragRect, m as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, f as OverlayBounds, P as Position, c as ReactGrabState, j as Rect, e as RenderData, d as RenderType, l as SuccessLabelContext, S as SuccessLabelType, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-Dpg0VXHq.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 { R as ReactGrabAPI } from './core-DZ65ta1h.js';
2
- export { A as AgentContext, q as AgentOptions, o as AgentProvider, n as AgentSession, p as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, k as DeepPartial, h as DragRect, m as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, e as OverlayBounds, P as Position, b as ReactGrabState, j as Rect, d as RenderData, c as RenderType, l as SuccessLabelContext, S as SuccessLabelType, T as Theme, f as formatElementInfo, a as generateSnippet, g as getStack, i as init } from './core-DZ65ta1h.js';
1
+ import { R as ReactGrabAPI } from './core-Dpg0VXHq.js';
2
+ export { A as AgentContext, q as AgentOptions, o as AgentProvider, n as AgentSession, p as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, k as DeepPartial, h as DragRect, m as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, f as OverlayBounds, P as Position, c as ReactGrabState, j as Rect, e as RenderData, d as RenderType, l as SuccessLabelContext, S as SuccessLabelType, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-Dpg0VXHq.js';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5