react-grab 0.0.72 → 0.0.74

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.
@@ -120,6 +120,8 @@ interface AgentProvider<T = any> {
120
120
  resume?: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncIterable<string>;
121
121
  supportsResume?: boolean;
122
122
  checkConnection?: () => Promise<boolean>;
123
+ getCompletionMessage?: () => string | undefined;
124
+ undo?: () => Promise<void>;
123
125
  }
124
126
  interface AgentSessionStorage {
125
127
  getItem(key: string): string | null;
@@ -136,6 +138,7 @@ interface AgentOptions<T = any> {
136
138
  onError?: (error: Error, session: AgentSession) => void;
137
139
  onResume?: (session: AgentSession) => void;
138
140
  onAbort?: (session: AgentSession, element: Element | undefined) => void;
141
+ onUndo?: (session: AgentSession, element: Element | undefined) => void;
139
142
  }
140
143
  interface Options {
141
144
  enabled?: boolean;
@@ -165,6 +168,26 @@ interface Options {
165
168
  onOpenFile?: (filePath: string, lineNumber?: number) => void;
166
169
  agent?: AgentOptions;
167
170
  }
171
+ interface UpdatableOptions {
172
+ onActivate?: () => void;
173
+ onDeactivate?: () => void;
174
+ onElementHover?: (element: Element) => void;
175
+ onElementSelect?: (element: Element) => void;
176
+ onDragStart?: (startX: number, startY: number) => void;
177
+ onDragEnd?: (elements: Element[], bounds: DragRect) => void;
178
+ onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
179
+ onAfterCopy?: (elements: Element[], success: boolean) => void;
180
+ onCopySuccess?: (elements: Element[], content: string) => void;
181
+ onCopyError?: (error: Error) => void;
182
+ onStateChange?: (state: ReactGrabState) => void;
183
+ onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
184
+ onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
185
+ onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
186
+ onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
187
+ onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
188
+ onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
189
+ onOpenFile?: (filePath: string, lineNumber?: number) => void;
190
+ }
168
191
  interface ReactGrabAPI {
169
192
  activate: () => void;
170
193
  deactivate: () => void;
@@ -176,6 +199,7 @@ interface ReactGrabAPI {
176
199
  updateTheme: (theme: DeepPartial<Theme>) => void;
177
200
  getTheme: () => Required<Theme>;
178
201
  setAgent: (options: AgentOptions) => void;
202
+ updateOptions: (options: UpdatableOptions) => void;
179
203
  }
180
204
  interface OverlayBounds {
181
205
  borderRadius: string;
@@ -223,6 +247,8 @@ interface ReactGrabRendererProps {
223
247
  isAgentConnected?: boolean;
224
248
  agentSessions?: Map<string, AgentSession>;
225
249
  onAbortSession?: (sessionId: string) => void;
250
+ onDismissSession?: (sessionId: string) => void;
251
+ onUndoSession?: (sessionId: string) => void;
226
252
  onInputChange?: (value: string) => void;
227
253
  onInputSubmit?: () => void;
228
254
  onInputCancel?: () => void;
@@ -274,4 +300,4 @@ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOp
274
300
 
275
301
  declare const init: (rawOptions?: Options) => ReactGrabAPI;
276
302
 
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 };
303
+ 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, type UpdatableOptions as U, 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 };
@@ -120,6 +120,8 @@ interface AgentProvider<T = any> {
120
120
  resume?: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncIterable<string>;
121
121
  supportsResume?: boolean;
122
122
  checkConnection?: () => Promise<boolean>;
123
+ getCompletionMessage?: () => string | undefined;
124
+ undo?: () => Promise<void>;
123
125
  }
124
126
  interface AgentSessionStorage {
125
127
  getItem(key: string): string | null;
@@ -136,6 +138,7 @@ interface AgentOptions<T = any> {
136
138
  onError?: (error: Error, session: AgentSession) => void;
137
139
  onResume?: (session: AgentSession) => void;
138
140
  onAbort?: (session: AgentSession, element: Element | undefined) => void;
141
+ onUndo?: (session: AgentSession, element: Element | undefined) => void;
139
142
  }
140
143
  interface Options {
141
144
  enabled?: boolean;
@@ -165,6 +168,26 @@ interface Options {
165
168
  onOpenFile?: (filePath: string, lineNumber?: number) => void;
166
169
  agent?: AgentOptions;
167
170
  }
171
+ interface UpdatableOptions {
172
+ onActivate?: () => void;
173
+ onDeactivate?: () => void;
174
+ onElementHover?: (element: Element) => void;
175
+ onElementSelect?: (element: Element) => void;
176
+ onDragStart?: (startX: number, startY: number) => void;
177
+ onDragEnd?: (elements: Element[], bounds: DragRect) => void;
178
+ onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
179
+ onAfterCopy?: (elements: Element[], success: boolean) => void;
180
+ onCopySuccess?: (elements: Element[], content: string) => void;
181
+ onCopyError?: (error: Error) => void;
182
+ onStateChange?: (state: ReactGrabState) => void;
183
+ onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
184
+ onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
185
+ onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
186
+ onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
187
+ onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
188
+ onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
189
+ onOpenFile?: (filePath: string, lineNumber?: number) => void;
190
+ }
168
191
  interface ReactGrabAPI {
169
192
  activate: () => void;
170
193
  deactivate: () => void;
@@ -176,6 +199,7 @@ interface ReactGrabAPI {
176
199
  updateTheme: (theme: DeepPartial<Theme>) => void;
177
200
  getTheme: () => Required<Theme>;
178
201
  setAgent: (options: AgentOptions) => void;
202
+ updateOptions: (options: UpdatableOptions) => void;
179
203
  }
180
204
  interface OverlayBounds {
181
205
  borderRadius: string;
@@ -223,6 +247,8 @@ interface ReactGrabRendererProps {
223
247
  isAgentConnected?: boolean;
224
248
  agentSessions?: Map<string, AgentSession>;
225
249
  onAbortSession?: (sessionId: string) => void;
250
+ onDismissSession?: (sessionId: string) => void;
251
+ onUndoSession?: (sessionId: string) => void;
226
252
  onInputChange?: (value: string) => void;
227
253
  onInputSubmit?: () => void;
228
254
  onInputCancel?: () => void;
@@ -274,4 +300,4 @@ declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOp
274
300
 
275
301
  declare const init: (rawOptions?: Options) => ReactGrabAPI;
276
302
 
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 };
303
+ 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, type UpdatableOptions as U, 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 chunkGFBDYRPI_cjs = require('./chunk-GFBDYRPI.cjs');
3
+ var chunkDV467MQN_cjs = require('./chunk-DV467MQN.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "DEFAULT_THEME", {
8
8
  enumerable: true,
9
- get: function () { return chunkGFBDYRPI_cjs.DEFAULT_THEME; }
9
+ get: function () { return chunkDV467MQN_cjs.DEFAULT_THEME; }
10
10
  });
11
11
  Object.defineProperty(exports, "formatElementInfo", {
12
12
  enumerable: true,
13
- get: function () { return chunkGFBDYRPI_cjs.getElementContext; }
13
+ get: function () { return chunkDV467MQN_cjs.getElementContext; }
14
14
  });
15
15
  Object.defineProperty(exports, "generateSnippet", {
16
16
  enumerable: true,
17
- get: function () { return chunkGFBDYRPI_cjs.generateSnippet; }
17
+ get: function () { return chunkDV467MQN_cjs.generateSnippet; }
18
18
  });
19
19
  Object.defineProperty(exports, "getStack", {
20
20
  enumerable: true,
21
- get: function () { return chunkGFBDYRPI_cjs.getStack; }
21
+ get: function () { return chunkDV467MQN_cjs.getStack; }
22
22
  });
23
23
  Object.defineProperty(exports, "init", {
24
24
  enumerable: true,
25
- get: function () { return chunkGFBDYRPI_cjs.init; }
25
+ get: function () { return chunkDV467MQN_cjs.init; }
26
26
  });
27
27
  Object.defineProperty(exports, "isInstrumentationActive", {
28
28
  enumerable: true,
29
- get: function () { return chunkGFBDYRPI_cjs.Ee; }
29
+ get: function () { return chunkDV467MQN_cjs.Ee; }
30
30
  });
package/dist/core.d.cts CHANGED
@@ -1,3 +1,3 @@
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';
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, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.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, 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';
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, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.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-DZ2VZRJA.js';
1
+ export { DEFAULT_THEME, getElementContext as formatElementInfo, generateSnippet, getStack, init, Ee as isInstrumentationActive } from './chunk-ZK4APTZS.js';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkGFBDYRPI_cjs = require('./chunk-GFBDYRPI.cjs');
3
+ var chunkDV467MQN_cjs = require('./chunk-DV467MQN.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 = chunkGFBDYRPI_cjs.init();
34
+ globalApi = chunkDV467MQN_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 chunkGFBDYRPI_cjs.DEFAULT_THEME; }
44
+ get: function () { return chunkDV467MQN_cjs.DEFAULT_THEME; }
45
45
  });
46
46
  Object.defineProperty(exports, "formatElementInfo", {
47
47
  enumerable: true,
48
- get: function () { return chunkGFBDYRPI_cjs.getElementContext; }
48
+ get: function () { return chunkDV467MQN_cjs.getElementContext; }
49
49
  });
50
50
  Object.defineProperty(exports, "generateSnippet", {
51
51
  enumerable: true,
52
- get: function () { return chunkGFBDYRPI_cjs.generateSnippet; }
52
+ get: function () { return chunkDV467MQN_cjs.generateSnippet; }
53
53
  });
54
54
  Object.defineProperty(exports, "getStack", {
55
55
  enumerable: true,
56
- get: function () { return chunkGFBDYRPI_cjs.getStack; }
56
+ get: function () { return chunkDV467MQN_cjs.getStack; }
57
57
  });
58
58
  Object.defineProperty(exports, "init", {
59
59
  enumerable: true,
60
- get: function () { return chunkGFBDYRPI_cjs.init; }
60
+ get: function () { return chunkDV467MQN_cjs.init; }
61
61
  });
62
62
  Object.defineProperty(exports, "isInstrumentationActive", {
63
63
  enumerable: true,
64
- get: function () { return chunkGFBDYRPI_cjs.Ee; }
64
+ get: function () { return chunkDV467MQN_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-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';
1
+ import { R as ReactGrabAPI } from './core-CzaOp9UL.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, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.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-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';
1
+ import { R as ReactGrabAPI } from './core-CzaOp9UL.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, U as UpdatableOptions, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './core-CzaOp9UL.js';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5