react-grab 0.0.70 → 0.0.72

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.
@@ -55,16 +55,6 @@ interface Theme {
55
55
  */
56
56
  enabled?: boolean;
57
57
  };
58
- /**
59
- * Text labels that appear after successful operations (like "Copied!" messages)
60
- */
61
- successLabels?: {
62
- /**
63
- * Whether to show success feedback labels
64
- * @default true
65
- */
66
- enabled?: boolean;
67
- };
68
58
  /**
69
59
  * The crosshair cursor overlay that helps with precise element targeting
70
60
  */
@@ -84,17 +74,12 @@ interface ReactGrabState {
84
74
  targetElement: Element | null;
85
75
  dragBounds: DragRect | null;
86
76
  }
87
- type SuccessLabelType = "copy" | "input-submit";
88
77
  type ElementLabelVariant = "hover" | "processing" | "success";
89
78
  interface InputModeContext {
90
79
  x: number;
91
80
  y: number;
92
81
  targetElement: Element | null;
93
82
  }
94
- interface SuccessLabelContext {
95
- x: number;
96
- y: number;
97
- }
98
83
  interface CrosshairContext {
99
84
  x: number;
100
85
  y: number;
@@ -134,6 +119,7 @@ interface AgentProvider<T = any> {
134
119
  send: (context: AgentContext<T>, signal: AbortSignal) => AsyncIterable<string>;
135
120
  resume?: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncIterable<string>;
136
121
  supportsResume?: boolean;
122
+ checkConnection?: () => Promise<boolean>;
137
123
  }
138
124
  interface AgentSessionStorage {
139
125
  getItem(key: string): string | null;
@@ -144,9 +130,9 @@ interface AgentOptions<T = any> {
144
130
  provider?: AgentProvider<T>;
145
131
  storage?: AgentSessionStorage | null;
146
132
  getOptions?: () => T;
147
- onStart?: (session: AgentSession) => void;
133
+ onStart?: (session: AgentSession, element: Element | undefined) => void;
148
134
  onStatus?: (status: string, session: AgentSession) => void;
149
- onComplete?: (session: AgentSession) => void;
135
+ onComplete?: (session: AgentSession, element: Element | undefined) => void;
150
136
  onError?: (error: Error, session: AgentSession) => void;
151
137
  onResume?: (session: AgentSession) => void;
152
138
  onAbort?: (session: AgentSession, element: Element | undefined) => void;
@@ -171,7 +157,6 @@ interface Options {
171
157
  onCopyError?: (error: Error) => void;
172
158
  onStateChange?: (state: ReactGrabState) => void;
173
159
  onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
174
- onSuccessLabel?: (text: string, type: SuccessLabelType, context: SuccessLabelContext) => void;
175
160
  onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
176
161
  onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
177
162
  onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
@@ -235,12 +220,16 @@ interface ReactGrabRendererProps {
235
220
  inputValue?: string;
236
221
  isInputExpanded?: boolean;
237
222
  hasAgent?: boolean;
223
+ isAgentConnected?: boolean;
238
224
  agentSessions?: Map<string, AgentSession>;
239
225
  onAbortSession?: (sessionId: string) => void;
240
226
  onInputChange?: (value: string) => void;
241
227
  onInputSubmit?: () => void;
242
228
  onInputCancel?: () => void;
243
229
  onToggleExpand?: () => void;
230
+ isPendingDismiss?: boolean;
231
+ onConfirmDismiss?: () => void;
232
+ onCancelDismiss?: () => void;
244
233
  nativeSelectionCursorVisible?: boolean;
245
234
  nativeSelectionCursorX?: number;
246
235
  nativeSelectionCursorY?: number;
@@ -285,4 +274,4 @@ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOp
285
274
 
286
275
  declare const init: (rawOptions?: Options) => ReactGrabAPI;
287
276
 
288
- 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 ReactGrabAPI as R, type SuccessLabelType as S, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type SuccessLabelContext as j, type ElementLabelContext as k, type AgentSession as l, type AgentProvider as m, type AgentSessionStorage as n, type AgentOptions as o, type ReactGrabRendererProps as p };
277
+ 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 ReactGrabAPI as R, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type ElementLabelContext as j, type AgentSession as k, type AgentProvider as l, type AgentSessionStorage as m, type AgentOptions as n, type ReactGrabRendererProps as o };
@@ -55,16 +55,6 @@ interface Theme {
55
55
  */
56
56
  enabled?: boolean;
57
57
  };
58
- /**
59
- * Text labels that appear after successful operations (like "Copied!" messages)
60
- */
61
- successLabels?: {
62
- /**
63
- * Whether to show success feedback labels
64
- * @default true
65
- */
66
- enabled?: boolean;
67
- };
68
58
  /**
69
59
  * The crosshair cursor overlay that helps with precise element targeting
70
60
  */
@@ -84,17 +74,12 @@ interface ReactGrabState {
84
74
  targetElement: Element | null;
85
75
  dragBounds: DragRect | null;
86
76
  }
87
- type SuccessLabelType = "copy" | "input-submit";
88
77
  type ElementLabelVariant = "hover" | "processing" | "success";
89
78
  interface InputModeContext {
90
79
  x: number;
91
80
  y: number;
92
81
  targetElement: Element | null;
93
82
  }
94
- interface SuccessLabelContext {
95
- x: number;
96
- y: number;
97
- }
98
83
  interface CrosshairContext {
99
84
  x: number;
100
85
  y: number;
@@ -134,6 +119,7 @@ interface AgentProvider<T = any> {
134
119
  send: (context: AgentContext<T>, signal: AbortSignal) => AsyncIterable<string>;
135
120
  resume?: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncIterable<string>;
136
121
  supportsResume?: boolean;
122
+ checkConnection?: () => Promise<boolean>;
137
123
  }
138
124
  interface AgentSessionStorage {
139
125
  getItem(key: string): string | null;
@@ -144,9 +130,9 @@ interface AgentOptions<T = any> {
144
130
  provider?: AgentProvider<T>;
145
131
  storage?: AgentSessionStorage | null;
146
132
  getOptions?: () => T;
147
- onStart?: (session: AgentSession) => void;
133
+ onStart?: (session: AgentSession, element: Element | undefined) => void;
148
134
  onStatus?: (status: string, session: AgentSession) => void;
149
- onComplete?: (session: AgentSession) => void;
135
+ onComplete?: (session: AgentSession, element: Element | undefined) => void;
150
136
  onError?: (error: Error, session: AgentSession) => void;
151
137
  onResume?: (session: AgentSession) => void;
152
138
  onAbort?: (session: AgentSession, element: Element | undefined) => void;
@@ -171,7 +157,6 @@ interface Options {
171
157
  onCopyError?: (error: Error) => void;
172
158
  onStateChange?: (state: ReactGrabState) => void;
173
159
  onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
174
- onSuccessLabel?: (text: string, type: SuccessLabelType, context: SuccessLabelContext) => void;
175
160
  onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
176
161
  onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
177
162
  onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
@@ -235,12 +220,16 @@ interface ReactGrabRendererProps {
235
220
  inputValue?: string;
236
221
  isInputExpanded?: boolean;
237
222
  hasAgent?: boolean;
223
+ isAgentConnected?: boolean;
238
224
  agentSessions?: Map<string, AgentSession>;
239
225
  onAbortSession?: (sessionId: string) => void;
240
226
  onInputChange?: (value: string) => void;
241
227
  onInputSubmit?: () => void;
242
228
  onInputCancel?: () => void;
243
229
  onToggleExpand?: () => void;
230
+ isPendingDismiss?: boolean;
231
+ onConfirmDismiss?: () => void;
232
+ onCancelDismiss?: () => void;
244
233
  nativeSelectionCursorVisible?: boolean;
245
234
  nativeSelectionCursorX?: number;
246
235
  nativeSelectionCursorY?: number;
@@ -285,4 +274,4 @@ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOp
285
274
 
286
275
  declare const init: (rawOptions?: Options) => ReactGrabAPI;
287
276
 
288
- 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 ReactGrabAPI as R, type SuccessLabelType as S, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type SuccessLabelContext as j, type ElementLabelContext as k, type AgentSession as l, type AgentProvider as m, type AgentSessionStorage as n, type AgentOptions as o, type ReactGrabRendererProps as p };
277
+ 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 ReactGrabAPI as R, type Theme as T, getElementContext as a, generateSnippet as b, type ReactGrabState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getStack as g, type DeepPartial as h, init as i, type ElementLabelContext as j, type AgentSession as k, type AgentProvider as l, type AgentSessionStorage as m, type AgentOptions as n, type ReactGrabRendererProps as o };
package/dist/core.cjs CHANGED
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunk3OWWYY5I_cjs = require('./chunk-3OWWYY5I.cjs');
3
+ var chunkGFBDYRPI_cjs = require('./chunk-GFBDYRPI.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "DEFAULT_THEME", {
8
8
  enumerable: true,
9
- get: function () { return chunk3OWWYY5I_cjs.DEFAULT_THEME; }
9
+ get: function () { return chunkGFBDYRPI_cjs.DEFAULT_THEME; }
10
10
  });
11
11
  Object.defineProperty(exports, "formatElementInfo", {
12
12
  enumerable: true,
13
- get: function () { return chunk3OWWYY5I_cjs.getElementContext; }
13
+ get: function () { return chunkGFBDYRPI_cjs.getElementContext; }
14
14
  });
15
15
  Object.defineProperty(exports, "generateSnippet", {
16
16
  enumerable: true,
17
- get: function () { return chunk3OWWYY5I_cjs.generateSnippet; }
17
+ get: function () { return chunkGFBDYRPI_cjs.generateSnippet; }
18
18
  });
19
19
  Object.defineProperty(exports, "getStack", {
20
20
  enumerable: true,
21
- get: function () { return chunk3OWWYY5I_cjs.getStack; }
21
+ get: function () { return chunkGFBDYRPI_cjs.getStack; }
22
22
  });
23
23
  Object.defineProperty(exports, "init", {
24
24
  enumerable: true,
25
- get: function () { return chunk3OWWYY5I_cjs.init; }
25
+ get: function () { return chunkGFBDYRPI_cjs.init; }
26
26
  });
27
27
  Object.defineProperty(exports, "isInstrumentationActive", {
28
28
  enumerable: true,
29
- get: function () { return chunk3OWWYY5I_cjs.Ee; }
29
+ get: function () { return chunkGFBDYRPI_cjs.Ee; }
30
30
  });
package/dist/core.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AgentContext, m as AgentProvider, l as AgentSession, n as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, p as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CnnkNbYQ.cjs';
1
+ export { A as AgentContext, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, o as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-HtZR37lF.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, m as AgentProvider, l as AgentSession, n as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, p as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CnnkNbYQ.js';
1
+ export { A as AgentContext, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, D as DEFAULT_THEME, O as Options, d as OverlayBounds, R as ReactGrabAPI, o as ReactGrabRendererProps, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-HtZR37lF.js';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- export { DEFAULT_THEME, getElementContext as formatElementInfo, generateSnippet, getStack, init, Ee as isInstrumentationActive } from './chunk-UIOO5VVO.js';
1
+ export { DEFAULT_THEME, getElementContext as formatElementInfo, generateSnippet, getStack, init, Ee as isInstrumentationActive } from './chunk-DZ2VZRJA.js';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk3OWWYY5I_cjs = require('./chunk-3OWWYY5I.cjs');
3
+ var chunkGFBDYRPI_cjs = require('./chunk-GFBDYRPI.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 = chunk3OWWYY5I_cjs.init();
34
+ globalApi = chunkGFBDYRPI_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 chunk3OWWYY5I_cjs.DEFAULT_THEME; }
44
+ get: function () { return chunkGFBDYRPI_cjs.DEFAULT_THEME; }
45
45
  });
46
46
  Object.defineProperty(exports, "formatElementInfo", {
47
47
  enumerable: true,
48
- get: function () { return chunk3OWWYY5I_cjs.getElementContext; }
48
+ get: function () { return chunkGFBDYRPI_cjs.getElementContext; }
49
49
  });
50
50
  Object.defineProperty(exports, "generateSnippet", {
51
51
  enumerable: true,
52
- get: function () { return chunk3OWWYY5I_cjs.generateSnippet; }
52
+ get: function () { return chunkGFBDYRPI_cjs.generateSnippet; }
53
53
  });
54
54
  Object.defineProperty(exports, "getStack", {
55
55
  enumerable: true,
56
- get: function () { return chunk3OWWYY5I_cjs.getStack; }
56
+ get: function () { return chunkGFBDYRPI_cjs.getStack; }
57
57
  });
58
58
  Object.defineProperty(exports, "init", {
59
59
  enumerable: true,
60
- get: function () { return chunk3OWWYY5I_cjs.init; }
60
+ get: function () { return chunkGFBDYRPI_cjs.init; }
61
61
  });
62
62
  Object.defineProperty(exports, "isInstrumentationActive", {
63
63
  enumerable: true,
64
- get: function () { return chunk3OWWYY5I_cjs.Ee; }
64
+ get: function () { return chunkGFBDYRPI_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-CnnkNbYQ.cjs';
2
- export { A as AgentContext, o as AgentOptions, m as AgentProvider, l as AgentSession, n as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, k as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, j as SuccessLabelContext, S as SuccessLabelType, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CnnkNbYQ.cjs';
1
+ import { R as ReactGrabAPI } from './core-HtZR37lF.cjs';
2
+ export { A as AgentContext, n as AgentOptions, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, j as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-HtZR37lF.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-CnnkNbYQ.js';
2
- export { A as AgentContext, o as AgentOptions, m as AgentProvider, l as AgentSession, n as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, k as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, j as SuccessLabelContext, S as SuccessLabelType, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CnnkNbYQ.js';
1
+ import { R as ReactGrabAPI } from './core-HtZR37lF.js';
2
+ export { A as AgentContext, n as AgentOptions, l as AgentProvider, k as AgentSession, m as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, h as DeepPartial, e as DragRect, j as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, d as OverlayBounds, c as ReactGrabState, f as Rect, T as Theme, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-HtZR37lF.js';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5