react-grab 0.1.28 → 0.1.29
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.
- package/README.md +6 -133
- package/dist/chunk-2VXWII4G.cjs +12 -0
- package/dist/chunk-3HCPVIMZ.cjs +83 -0
- package/dist/chunk-CAZ3NLYA.cjs +10 -0
- package/dist/chunk-IWIPTBFC.js +21 -0
- package/dist/chunk-KH7JPDWT.js +83 -0
- package/dist/chunk-MIM6UREC.cjs +21 -0
- package/dist/chunk-RYNNLFJT.js +10 -0
- package/dist/chunk-VCA74BQS.js +12 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/{index-CN8HkCli.d.cts → index-bB0QMlHm.d.cts} +35 -75
- package/dist/{index-CN8HkCli.d.ts → index-bB0QMlHm.d.ts} +35 -75
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.global.js +41 -45
- package/dist/index.js +2 -2
- package/dist/primitives.cjs +2 -2
- package/dist/primitives.js +2 -2
- package/dist/renderer-DEPHVNHK.cjs +10 -0
- package/dist/renderer-WYB2HHU6.js +10 -0
- package/dist/styles.css +1 -1
- package/package.json +5 -5
- package/dist/chunk-5RMV2HA7.js +0 -101
- package/dist/chunk-QEVSATMF.cjs +0 -101
- package/dist/chunk-XWCIDYJD.cjs +0 -26
- package/dist/chunk-XYTXUEOE.js +0 -26
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { StackFrame } from 'bippy/source';
|
|
2
1
|
import 'bippy';
|
|
2
|
+
import 'element-source';
|
|
3
3
|
|
|
4
|
+
interface Position {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
4
8
|
type DeepPartial<T> = {
|
|
5
9
|
[P in keyof T]?: T[P] extends object ? T[P] extends (...args: unknown[]) => unknown ? T[P] : DeepPartial<T[P]> : T[P];
|
|
6
10
|
};
|
|
@@ -55,16 +59,6 @@ interface Theme {
|
|
|
55
59
|
*/
|
|
56
60
|
enabled?: boolean;
|
|
57
61
|
};
|
|
58
|
-
/**
|
|
59
|
-
* The crosshair cursor overlay that helps with precise element targeting
|
|
60
|
-
*/
|
|
61
|
-
crosshair?: {
|
|
62
|
-
/**
|
|
63
|
-
* Whether to show the crosshair
|
|
64
|
-
* @default true
|
|
65
|
-
*/
|
|
66
|
-
enabled?: boolean;
|
|
67
|
-
};
|
|
68
62
|
/**
|
|
69
63
|
* The floating toolbar that allows toggling React Grab activation
|
|
70
64
|
*/
|
|
@@ -81,7 +75,6 @@ interface ReactGrabState {
|
|
|
81
75
|
isDragging: boolean;
|
|
82
76
|
isCopying: boolean;
|
|
83
77
|
isPromptMode: boolean;
|
|
84
|
-
isCrosshairVisible: boolean;
|
|
85
78
|
isSelectionBoxVisible: boolean;
|
|
86
79
|
isDragBoxVisible: boolean;
|
|
87
80
|
targetElement: Element | null;
|
|
@@ -111,10 +104,6 @@ interface PromptModeContext {
|
|
|
111
104
|
y: number;
|
|
112
105
|
targetElement: Element | null;
|
|
113
106
|
}
|
|
114
|
-
interface CrosshairContext {
|
|
115
|
-
x: number;
|
|
116
|
-
y: number;
|
|
117
|
-
}
|
|
118
107
|
interface ElementLabelContext {
|
|
119
108
|
x: number;
|
|
120
109
|
y: number;
|
|
@@ -140,10 +129,7 @@ interface AgentSession {
|
|
|
140
129
|
isFading?: boolean;
|
|
141
130
|
createdAt: number;
|
|
142
131
|
lastUpdatedAt: number;
|
|
143
|
-
position:
|
|
144
|
-
x: number;
|
|
145
|
-
y: number;
|
|
146
|
-
};
|
|
132
|
+
position: Position;
|
|
147
133
|
selectionBounds: OverlayBounds[];
|
|
148
134
|
tagName?: string;
|
|
149
135
|
componentName?: string;
|
|
@@ -209,8 +195,8 @@ interface ContextMenuActionContext extends ActionContext {
|
|
|
209
195
|
interface ContextMenuAction {
|
|
210
196
|
id: string;
|
|
211
197
|
label: string;
|
|
212
|
-
target?: "context-menu";
|
|
213
198
|
shortcut?: string;
|
|
199
|
+
showInToolbarMenu?: boolean;
|
|
214
200
|
enabled?: boolean | ((context: ActionContext) => boolean);
|
|
215
201
|
onAction: (context: ContextMenuActionContext) => void | Promise<void>;
|
|
216
202
|
agent?: AgentOptions;
|
|
@@ -237,7 +223,6 @@ interface ArrowNavigationState {
|
|
|
237
223
|
interface PluginHooks {
|
|
238
224
|
onActivate?: () => void;
|
|
239
225
|
onDeactivate?: () => void;
|
|
240
|
-
cancelPendingToolbarActions?: () => void;
|
|
241
226
|
onElementHover?: (element: Element) => void;
|
|
242
227
|
onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
|
|
243
228
|
onDragStart?: (startX: number, startY: number) => void;
|
|
@@ -253,11 +238,7 @@ interface PluginHooks {
|
|
|
253
238
|
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
|
|
254
239
|
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
255
240
|
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
256
|
-
|
|
257
|
-
onContextMenu?: (element: Element, position: {
|
|
258
|
-
x: number;
|
|
259
|
-
y: number;
|
|
260
|
-
}) => void;
|
|
241
|
+
onContextMenu?: (element: Element, position: Position) => void;
|
|
261
242
|
onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
|
|
262
243
|
transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
|
|
263
244
|
transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
|
|
@@ -265,20 +246,10 @@ interface PluginHooks {
|
|
|
265
246
|
transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string;
|
|
266
247
|
transformSnippet?: (snippet: string, element: Element) => string | Promise<string>;
|
|
267
248
|
}
|
|
268
|
-
interface ToolbarMenuAction {
|
|
269
|
-
id: string;
|
|
270
|
-
label: string;
|
|
271
|
-
shortcut?: string;
|
|
272
|
-
target: "toolbar";
|
|
273
|
-
enabled?: boolean | (() => boolean);
|
|
274
|
-
isActive?: () => boolean;
|
|
275
|
-
onAction: () => void | Promise<void>;
|
|
276
|
-
}
|
|
277
|
-
type PluginAction = ContextMenuAction | ToolbarMenuAction;
|
|
278
249
|
interface PluginConfig {
|
|
279
250
|
theme?: DeepPartial<Theme>;
|
|
280
251
|
options?: SettableOptions;
|
|
281
|
-
actions?:
|
|
252
|
+
actions?: ContextMenuAction[];
|
|
282
253
|
hooks?: PluginHooks;
|
|
283
254
|
cleanup?: () => void;
|
|
284
255
|
}
|
|
@@ -286,7 +257,7 @@ interface Plugin {
|
|
|
286
257
|
name: string;
|
|
287
258
|
theme?: DeepPartial<Theme>;
|
|
288
259
|
options?: SettableOptions;
|
|
289
|
-
actions?:
|
|
260
|
+
actions?: ContextMenuAction[];
|
|
290
261
|
hooks?: PluginHooks;
|
|
291
262
|
setup?: (api: ReactGrabAPI, hooks: ActionContextHooks) => PluginConfig | void;
|
|
292
263
|
}
|
|
@@ -318,6 +289,7 @@ interface ToolbarState {
|
|
|
318
289
|
ratio: number;
|
|
319
290
|
collapsed: boolean;
|
|
320
291
|
enabled: boolean;
|
|
292
|
+
defaultAction?: string;
|
|
321
293
|
}
|
|
322
294
|
interface DropdownAnchor {
|
|
323
295
|
x: number;
|
|
@@ -376,7 +348,7 @@ interface SelectionLabelInstance {
|
|
|
376
348
|
errorMessage?: string;
|
|
377
349
|
hideArrow?: boolean;
|
|
378
350
|
}
|
|
379
|
-
interface
|
|
351
|
+
interface CommentItem {
|
|
380
352
|
id: string;
|
|
381
353
|
content: string;
|
|
382
354
|
elementName: string;
|
|
@@ -385,7 +357,6 @@ interface HistoryItem {
|
|
|
385
357
|
elementsCount?: number;
|
|
386
358
|
previewBounds?: OverlayBounds[];
|
|
387
359
|
elementSelectors?: string[];
|
|
388
|
-
isComment: boolean;
|
|
389
360
|
commentText?: string;
|
|
390
361
|
timestamp: number;
|
|
391
362
|
}
|
|
@@ -412,16 +383,12 @@ interface ReactGrabRendererProps {
|
|
|
412
383
|
bounds: OverlayBounds;
|
|
413
384
|
createdAt: number;
|
|
414
385
|
}>;
|
|
415
|
-
labelZIndex?: number;
|
|
416
386
|
mouseX?: number;
|
|
417
|
-
mouseY?: number;
|
|
418
|
-
crosshairVisible?: boolean;
|
|
419
387
|
isFrozen?: boolean;
|
|
420
388
|
inputValue?: string;
|
|
421
389
|
isPromptMode?: boolean;
|
|
422
390
|
replyToPrompt?: string;
|
|
423
391
|
hasAgent?: boolean;
|
|
424
|
-
isAgentConnected?: boolean;
|
|
425
392
|
agentSessions?: Map<string, AgentSession>;
|
|
426
393
|
supportsUndo?: boolean;
|
|
427
394
|
supportsFollowUp?: boolean;
|
|
@@ -433,18 +400,16 @@ interface ReactGrabRendererProps {
|
|
|
433
400
|
onFollowUpSubmitSession?: (sessionId: string, prompt: string) => void;
|
|
434
401
|
onAcknowledgeSessionError?: (sessionId: string) => void;
|
|
435
402
|
onRetrySession?: (sessionId: string) => void;
|
|
436
|
-
onShowContextMenuSession?: (sessionId: string) => void;
|
|
437
403
|
onShowContextMenuInstance?: (instanceId: string) => void;
|
|
438
404
|
onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
|
|
439
405
|
onInputChange?: (value: string) => void;
|
|
440
406
|
onInputSubmit?: () => void;
|
|
441
|
-
onInputCancel?: () => void;
|
|
442
407
|
onToggleExpand?: () => void;
|
|
443
408
|
isPendingDismiss?: boolean;
|
|
409
|
+
selectionLabelShakeCount?: number;
|
|
444
410
|
onConfirmDismiss?: () => void;
|
|
445
411
|
onCancelDismiss?: () => void;
|
|
446
412
|
pendingAbortSessionId?: string | null;
|
|
447
|
-
theme?: Required<Theme>;
|
|
448
413
|
toolbarVisible?: boolean;
|
|
449
414
|
isActive?: boolean;
|
|
450
415
|
onToggleActive?: () => void;
|
|
@@ -455,45 +420,41 @@ interface ReactGrabRendererProps {
|
|
|
455
420
|
onSubscribeToToolbarStateChanges?: (callback: (state: ToolbarState) => void) => () => void;
|
|
456
421
|
onToolbarSelectHoverChange?: (isHovered: boolean) => void;
|
|
457
422
|
onToolbarRef?: (element: HTMLDivElement) => void;
|
|
458
|
-
contextMenuPosition?:
|
|
459
|
-
x: number;
|
|
460
|
-
y: number;
|
|
461
|
-
} | null;
|
|
423
|
+
contextMenuPosition?: Position | null;
|
|
462
424
|
contextMenuBounds?: OverlayBounds | null;
|
|
463
425
|
contextMenuTagName?: string;
|
|
464
426
|
contextMenuComponentName?: string;
|
|
465
427
|
contextMenuHasFilePath?: boolean;
|
|
466
428
|
actions?: ContextMenuAction[];
|
|
467
|
-
toolbarActions?: ToolbarMenuAction[];
|
|
468
429
|
actionContext?: ActionContext;
|
|
469
430
|
onContextMenuDismiss?: () => void;
|
|
470
431
|
onContextMenuHide?: () => void;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
432
|
+
commentItems?: CommentItem[];
|
|
433
|
+
commentsDisconnectedItemIds?: Set<string>;
|
|
434
|
+
commentItemCount?: number;
|
|
474
435
|
clockFlashTrigger?: number;
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
onToggleHistory?: () => void;
|
|
436
|
+
commentsDropdownPosition?: DropdownAnchor | null;
|
|
437
|
+
isCommentsPinned?: boolean;
|
|
438
|
+
onToggleComments?: () => void;
|
|
479
439
|
onCopyAll?: () => void;
|
|
480
440
|
onCopyAllHover?: (isHovered: boolean) => void;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
onHistoryDismiss?: () => void;
|
|
490
|
-
onHistoryDropdownHover?: (isHovered: boolean) => void;
|
|
441
|
+
onCommentsButtonHover?: (isHovered: boolean) => void;
|
|
442
|
+
onCommentItemSelect?: (item: CommentItem) => void;
|
|
443
|
+
onCommentItemHover?: (commentItemId: string | null) => void;
|
|
444
|
+
onCommentsCopyAll?: () => void;
|
|
445
|
+
onCommentsCopyAllHover?: (isHovered: boolean) => void;
|
|
446
|
+
onCommentsClear?: () => void;
|
|
447
|
+
onCommentsDismiss?: () => void;
|
|
448
|
+
onCommentsDropdownHover?: (isHovered: boolean) => void;
|
|
491
449
|
toolbarMenuPosition?: DropdownAnchor | null;
|
|
492
|
-
|
|
450
|
+
toolbarMenuActions?: ContextMenuAction[];
|
|
451
|
+
defaultActionId?: string;
|
|
452
|
+
onSetDefaultAction?: (actionId: string) => void;
|
|
453
|
+
onToggleToolbarMenu?: () => void;
|
|
493
454
|
onToolbarMenuDismiss?: () => void;
|
|
494
455
|
clearPromptPosition?: DropdownAnchor | null;
|
|
495
|
-
|
|
496
|
-
|
|
456
|
+
onClearCommentsConfirm?: () => void;
|
|
457
|
+
onClearCommentsCancel?: () => void;
|
|
497
458
|
}
|
|
498
459
|
interface GrabbedBox {
|
|
499
460
|
id: string;
|
|
@@ -514,7 +475,6 @@ interface DragRect {
|
|
|
514
475
|
height: number;
|
|
515
476
|
}
|
|
516
477
|
|
|
517
|
-
declare const getStack: (element: Element) => Promise<StackFrame[] | null>;
|
|
518
478
|
interface StackContextOptions {
|
|
519
479
|
maxLines?: number;
|
|
520
480
|
}
|
|
@@ -544,4 +504,4 @@ declare const copyContent: (content: string, options?: CopyContentOptions) => bo
|
|
|
544
504
|
|
|
545
505
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
546
506
|
|
|
547
|
-
export { type AgentContext as A, type
|
|
507
|
+
export { type AgentContext as A, type ContextMenuAction as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type Options as O, type Plugin as P, type ReactGrabAPI as R, type SourceInfo as S, type Theme as T, generateSnippet as a, type ReactGrabState as b, type ToolbarState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getElementContext as g, type Position as h, init as i, type DeepPartial as j, type PromptModeContext as k, type ElementLabelContext as l, type AgentSession as m, type AgentProvider as n, type AgentSessionStorage as o, type AgentOptions as p, type AgentCompleteResult as q, type SettableOptions as r, type ActivationMode as s, type ContextMenuActionContext as t, type ActionContext as u, type ActionContextHooks as v, type PluginConfig as w, type PluginHooks as x, type ReactGrabRendererProps as y, copyContent as z };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { StackFrame } from 'bippy/source';
|
|
2
1
|
import 'bippy';
|
|
2
|
+
import 'element-source';
|
|
3
3
|
|
|
4
|
+
interface Position {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
4
8
|
type DeepPartial<T> = {
|
|
5
9
|
[P in keyof T]?: T[P] extends object ? T[P] extends (...args: unknown[]) => unknown ? T[P] : DeepPartial<T[P]> : T[P];
|
|
6
10
|
};
|
|
@@ -55,16 +59,6 @@ interface Theme {
|
|
|
55
59
|
*/
|
|
56
60
|
enabled?: boolean;
|
|
57
61
|
};
|
|
58
|
-
/**
|
|
59
|
-
* The crosshair cursor overlay that helps with precise element targeting
|
|
60
|
-
*/
|
|
61
|
-
crosshair?: {
|
|
62
|
-
/**
|
|
63
|
-
* Whether to show the crosshair
|
|
64
|
-
* @default true
|
|
65
|
-
*/
|
|
66
|
-
enabled?: boolean;
|
|
67
|
-
};
|
|
68
62
|
/**
|
|
69
63
|
* The floating toolbar that allows toggling React Grab activation
|
|
70
64
|
*/
|
|
@@ -81,7 +75,6 @@ interface ReactGrabState {
|
|
|
81
75
|
isDragging: boolean;
|
|
82
76
|
isCopying: boolean;
|
|
83
77
|
isPromptMode: boolean;
|
|
84
|
-
isCrosshairVisible: boolean;
|
|
85
78
|
isSelectionBoxVisible: boolean;
|
|
86
79
|
isDragBoxVisible: boolean;
|
|
87
80
|
targetElement: Element | null;
|
|
@@ -111,10 +104,6 @@ interface PromptModeContext {
|
|
|
111
104
|
y: number;
|
|
112
105
|
targetElement: Element | null;
|
|
113
106
|
}
|
|
114
|
-
interface CrosshairContext {
|
|
115
|
-
x: number;
|
|
116
|
-
y: number;
|
|
117
|
-
}
|
|
118
107
|
interface ElementLabelContext {
|
|
119
108
|
x: number;
|
|
120
109
|
y: number;
|
|
@@ -140,10 +129,7 @@ interface AgentSession {
|
|
|
140
129
|
isFading?: boolean;
|
|
141
130
|
createdAt: number;
|
|
142
131
|
lastUpdatedAt: number;
|
|
143
|
-
position:
|
|
144
|
-
x: number;
|
|
145
|
-
y: number;
|
|
146
|
-
};
|
|
132
|
+
position: Position;
|
|
147
133
|
selectionBounds: OverlayBounds[];
|
|
148
134
|
tagName?: string;
|
|
149
135
|
componentName?: string;
|
|
@@ -209,8 +195,8 @@ interface ContextMenuActionContext extends ActionContext {
|
|
|
209
195
|
interface ContextMenuAction {
|
|
210
196
|
id: string;
|
|
211
197
|
label: string;
|
|
212
|
-
target?: "context-menu";
|
|
213
198
|
shortcut?: string;
|
|
199
|
+
showInToolbarMenu?: boolean;
|
|
214
200
|
enabled?: boolean | ((context: ActionContext) => boolean);
|
|
215
201
|
onAction: (context: ContextMenuActionContext) => void | Promise<void>;
|
|
216
202
|
agent?: AgentOptions;
|
|
@@ -237,7 +223,6 @@ interface ArrowNavigationState {
|
|
|
237
223
|
interface PluginHooks {
|
|
238
224
|
onActivate?: () => void;
|
|
239
225
|
onDeactivate?: () => void;
|
|
240
|
-
cancelPendingToolbarActions?: () => void;
|
|
241
226
|
onElementHover?: (element: Element) => void;
|
|
242
227
|
onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
|
|
243
228
|
onDragStart?: (startX: number, startY: number) => void;
|
|
@@ -253,11 +238,7 @@ interface PluginHooks {
|
|
|
253
238
|
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
|
|
254
239
|
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
255
240
|
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
256
|
-
|
|
257
|
-
onContextMenu?: (element: Element, position: {
|
|
258
|
-
x: number;
|
|
259
|
-
y: number;
|
|
260
|
-
}) => void;
|
|
241
|
+
onContextMenu?: (element: Element, position: Position) => void;
|
|
261
242
|
onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
|
|
262
243
|
transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
|
|
263
244
|
transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
|
|
@@ -265,20 +246,10 @@ interface PluginHooks {
|
|
|
265
246
|
transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string;
|
|
266
247
|
transformSnippet?: (snippet: string, element: Element) => string | Promise<string>;
|
|
267
248
|
}
|
|
268
|
-
interface ToolbarMenuAction {
|
|
269
|
-
id: string;
|
|
270
|
-
label: string;
|
|
271
|
-
shortcut?: string;
|
|
272
|
-
target: "toolbar";
|
|
273
|
-
enabled?: boolean | (() => boolean);
|
|
274
|
-
isActive?: () => boolean;
|
|
275
|
-
onAction: () => void | Promise<void>;
|
|
276
|
-
}
|
|
277
|
-
type PluginAction = ContextMenuAction | ToolbarMenuAction;
|
|
278
249
|
interface PluginConfig {
|
|
279
250
|
theme?: DeepPartial<Theme>;
|
|
280
251
|
options?: SettableOptions;
|
|
281
|
-
actions?:
|
|
252
|
+
actions?: ContextMenuAction[];
|
|
282
253
|
hooks?: PluginHooks;
|
|
283
254
|
cleanup?: () => void;
|
|
284
255
|
}
|
|
@@ -286,7 +257,7 @@ interface Plugin {
|
|
|
286
257
|
name: string;
|
|
287
258
|
theme?: DeepPartial<Theme>;
|
|
288
259
|
options?: SettableOptions;
|
|
289
|
-
actions?:
|
|
260
|
+
actions?: ContextMenuAction[];
|
|
290
261
|
hooks?: PluginHooks;
|
|
291
262
|
setup?: (api: ReactGrabAPI, hooks: ActionContextHooks) => PluginConfig | void;
|
|
292
263
|
}
|
|
@@ -318,6 +289,7 @@ interface ToolbarState {
|
|
|
318
289
|
ratio: number;
|
|
319
290
|
collapsed: boolean;
|
|
320
291
|
enabled: boolean;
|
|
292
|
+
defaultAction?: string;
|
|
321
293
|
}
|
|
322
294
|
interface DropdownAnchor {
|
|
323
295
|
x: number;
|
|
@@ -376,7 +348,7 @@ interface SelectionLabelInstance {
|
|
|
376
348
|
errorMessage?: string;
|
|
377
349
|
hideArrow?: boolean;
|
|
378
350
|
}
|
|
379
|
-
interface
|
|
351
|
+
interface CommentItem {
|
|
380
352
|
id: string;
|
|
381
353
|
content: string;
|
|
382
354
|
elementName: string;
|
|
@@ -385,7 +357,6 @@ interface HistoryItem {
|
|
|
385
357
|
elementsCount?: number;
|
|
386
358
|
previewBounds?: OverlayBounds[];
|
|
387
359
|
elementSelectors?: string[];
|
|
388
|
-
isComment: boolean;
|
|
389
360
|
commentText?: string;
|
|
390
361
|
timestamp: number;
|
|
391
362
|
}
|
|
@@ -412,16 +383,12 @@ interface ReactGrabRendererProps {
|
|
|
412
383
|
bounds: OverlayBounds;
|
|
413
384
|
createdAt: number;
|
|
414
385
|
}>;
|
|
415
|
-
labelZIndex?: number;
|
|
416
386
|
mouseX?: number;
|
|
417
|
-
mouseY?: number;
|
|
418
|
-
crosshairVisible?: boolean;
|
|
419
387
|
isFrozen?: boolean;
|
|
420
388
|
inputValue?: string;
|
|
421
389
|
isPromptMode?: boolean;
|
|
422
390
|
replyToPrompt?: string;
|
|
423
391
|
hasAgent?: boolean;
|
|
424
|
-
isAgentConnected?: boolean;
|
|
425
392
|
agentSessions?: Map<string, AgentSession>;
|
|
426
393
|
supportsUndo?: boolean;
|
|
427
394
|
supportsFollowUp?: boolean;
|
|
@@ -433,18 +400,16 @@ interface ReactGrabRendererProps {
|
|
|
433
400
|
onFollowUpSubmitSession?: (sessionId: string, prompt: string) => void;
|
|
434
401
|
onAcknowledgeSessionError?: (sessionId: string) => void;
|
|
435
402
|
onRetrySession?: (sessionId: string) => void;
|
|
436
|
-
onShowContextMenuSession?: (sessionId: string) => void;
|
|
437
403
|
onShowContextMenuInstance?: (instanceId: string) => void;
|
|
438
404
|
onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
|
|
439
405
|
onInputChange?: (value: string) => void;
|
|
440
406
|
onInputSubmit?: () => void;
|
|
441
|
-
onInputCancel?: () => void;
|
|
442
407
|
onToggleExpand?: () => void;
|
|
443
408
|
isPendingDismiss?: boolean;
|
|
409
|
+
selectionLabelShakeCount?: number;
|
|
444
410
|
onConfirmDismiss?: () => void;
|
|
445
411
|
onCancelDismiss?: () => void;
|
|
446
412
|
pendingAbortSessionId?: string | null;
|
|
447
|
-
theme?: Required<Theme>;
|
|
448
413
|
toolbarVisible?: boolean;
|
|
449
414
|
isActive?: boolean;
|
|
450
415
|
onToggleActive?: () => void;
|
|
@@ -455,45 +420,41 @@ interface ReactGrabRendererProps {
|
|
|
455
420
|
onSubscribeToToolbarStateChanges?: (callback: (state: ToolbarState) => void) => () => void;
|
|
456
421
|
onToolbarSelectHoverChange?: (isHovered: boolean) => void;
|
|
457
422
|
onToolbarRef?: (element: HTMLDivElement) => void;
|
|
458
|
-
contextMenuPosition?:
|
|
459
|
-
x: number;
|
|
460
|
-
y: number;
|
|
461
|
-
} | null;
|
|
423
|
+
contextMenuPosition?: Position | null;
|
|
462
424
|
contextMenuBounds?: OverlayBounds | null;
|
|
463
425
|
contextMenuTagName?: string;
|
|
464
426
|
contextMenuComponentName?: string;
|
|
465
427
|
contextMenuHasFilePath?: boolean;
|
|
466
428
|
actions?: ContextMenuAction[];
|
|
467
|
-
toolbarActions?: ToolbarMenuAction[];
|
|
468
429
|
actionContext?: ActionContext;
|
|
469
430
|
onContextMenuDismiss?: () => void;
|
|
470
431
|
onContextMenuHide?: () => void;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
432
|
+
commentItems?: CommentItem[];
|
|
433
|
+
commentsDisconnectedItemIds?: Set<string>;
|
|
434
|
+
commentItemCount?: number;
|
|
474
435
|
clockFlashTrigger?: number;
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
onToggleHistory?: () => void;
|
|
436
|
+
commentsDropdownPosition?: DropdownAnchor | null;
|
|
437
|
+
isCommentsPinned?: boolean;
|
|
438
|
+
onToggleComments?: () => void;
|
|
479
439
|
onCopyAll?: () => void;
|
|
480
440
|
onCopyAllHover?: (isHovered: boolean) => void;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
onHistoryDismiss?: () => void;
|
|
490
|
-
onHistoryDropdownHover?: (isHovered: boolean) => void;
|
|
441
|
+
onCommentsButtonHover?: (isHovered: boolean) => void;
|
|
442
|
+
onCommentItemSelect?: (item: CommentItem) => void;
|
|
443
|
+
onCommentItemHover?: (commentItemId: string | null) => void;
|
|
444
|
+
onCommentsCopyAll?: () => void;
|
|
445
|
+
onCommentsCopyAllHover?: (isHovered: boolean) => void;
|
|
446
|
+
onCommentsClear?: () => void;
|
|
447
|
+
onCommentsDismiss?: () => void;
|
|
448
|
+
onCommentsDropdownHover?: (isHovered: boolean) => void;
|
|
491
449
|
toolbarMenuPosition?: DropdownAnchor | null;
|
|
492
|
-
|
|
450
|
+
toolbarMenuActions?: ContextMenuAction[];
|
|
451
|
+
defaultActionId?: string;
|
|
452
|
+
onSetDefaultAction?: (actionId: string) => void;
|
|
453
|
+
onToggleToolbarMenu?: () => void;
|
|
493
454
|
onToolbarMenuDismiss?: () => void;
|
|
494
455
|
clearPromptPosition?: DropdownAnchor | null;
|
|
495
|
-
|
|
496
|
-
|
|
456
|
+
onClearCommentsConfirm?: () => void;
|
|
457
|
+
onClearCommentsCancel?: () => void;
|
|
497
458
|
}
|
|
498
459
|
interface GrabbedBox {
|
|
499
460
|
id: string;
|
|
@@ -514,7 +475,6 @@ interface DragRect {
|
|
|
514
475
|
height: number;
|
|
515
476
|
}
|
|
516
477
|
|
|
517
|
-
declare const getStack: (element: Element) => Promise<StackFrame[] | null>;
|
|
518
478
|
interface StackContextOptions {
|
|
519
479
|
maxLines?: number;
|
|
520
480
|
}
|
|
@@ -544,4 +504,4 @@ declare const copyContent: (content: string, options?: CopyContentOptions) => bo
|
|
|
544
504
|
|
|
545
505
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
546
506
|
|
|
547
|
-
export { type AgentContext as A, type
|
|
507
|
+
export { type AgentContext as A, type ContextMenuAction as C, DEFAULT_THEME as D, type ElementLabelVariant as E, type GrabbedBox as G, type Options as O, type Plugin as P, type ReactGrabAPI as R, type SourceInfo as S, type Theme as T, generateSnippet as a, type ReactGrabState as b, type ToolbarState as c, type OverlayBounds as d, type DragRect as e, type Rect as f, getElementContext as g, type Position as h, init as i, type DeepPartial as j, type PromptModeContext as k, type ElementLabelContext as l, type AgentSession as m, type AgentProvider as n, type AgentSessionStorage as o, type AgentOptions as p, type AgentCompleteResult as q, type SettableOptions as r, type ActivationMode as s, type ContextMenuActionContext as t, type ActionContext as u, type ActionContextHooks as v, type PluginConfig as w, type PluginHooks as x, type ReactGrabRendererProps as y, copyContent as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkMIM6UREC_cjs=require('./chunk-MIM6UREC.cjs');require('./chunk-2VXWII4G.cjs'),require('./chunk-CAZ3NLYA.cjs');var chunk3HCPVIMZ_cjs=require('./chunk-3HCPVIMZ.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 n=null,l=()=>typeof window>"u"?n:window.__REACT_GRAB__??n??null,R=e=>{n=e,typeof window<"u"&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__);},o=[],
|
|
9
|
+
var n=null,l=()=>typeof window>"u"?n:window.__REACT_GRAB__??n??null,R=e=>{n=e,typeof window<"u"&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__);},o=[],c=e=>{for(;o.length>0;){let t=o.shift();t&&e.registerPlugin(t);}},P=e=>{let t=l();if(t){t.registerPlugin(e);return}o.push(e);},w=e=>{let t=l();if(t){t.unregisterPlugin(e);return}let r=o.findIndex(_=>_.name===e);r!==-1&&o.splice(r,1);};typeof window<"u"&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?n=window.__REACT_GRAB__:(n=chunkMIM6UREC_cjs.f(),window.__REACT_GRAB__=n),c(n),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:n})));Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunkMIM6UREC_cjs.c}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunkMIM6UREC_cjs.d}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunkMIM6UREC_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkMIM6UREC_cjs.f}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunkMIM6UREC_cjs.e}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunk3HCPVIMZ_cjs.fb}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunk3HCPVIMZ_cjs.ab}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunk3HCPVIMZ_cjs._a}});exports.getGlobalApi=l;exports.registerPlugin=P;exports.setGlobalApi=R;exports.unregisterPlugin=w;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as Plugin, R as ReactGrabAPI } from './index-
|
|
2
|
-
export {
|
|
1
|
+
import { P as Plugin, R as ReactGrabAPI } from './index-bB0QMlHm.cjs';
|
|
2
|
+
export { u as ActionContext, v as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, C as ContextMenuAction, t as ContextMenuActionContext, D as DEFAULT_THEME, j as DeepPartial, e as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, d as OverlayBounds, w as PluginConfig, x as PluginHooks, h as Position, k as PromptModeContext, b as ReactGrabState, f as Rect, r as SettableOptions, S as SourceInfo, T as Theme, c as ToolbarState, g as formatElementInfo, a as generateSnippet, i as init } from './index-bB0QMlHm.cjs';
|
|
3
|
+
export { getReactStack as getStack } from 'element-source';
|
|
3
4
|
export { isInstrumentationActive } from 'bippy';
|
|
4
|
-
import 'bippy/source';
|
|
5
5
|
|
|
6
6
|
declare const commentPlugin: Plugin;
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as Plugin, R as ReactGrabAPI } from './index-
|
|
2
|
-
export {
|
|
1
|
+
import { P as Plugin, R as ReactGrabAPI } from './index-bB0QMlHm.js';
|
|
2
|
+
export { u as ActionContext, v as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, C as ContextMenuAction, t as ContextMenuActionContext, D as DEFAULT_THEME, j as DeepPartial, e as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, d as OverlayBounds, w as PluginConfig, x as PluginHooks, h as Position, k as PromptModeContext, b as ReactGrabState, f as Rect, r as SettableOptions, S as SourceInfo, T as Theme, c as ToolbarState, g as formatElementInfo, a as generateSnippet, i as init } from './index-bB0QMlHm.js';
|
|
3
|
+
export { getReactStack as getStack } from 'element-source';
|
|
3
4
|
export { isInstrumentationActive } from 'bippy';
|
|
4
|
-
import 'bippy/source';
|
|
5
5
|
|
|
6
6
|
declare const commentPlugin: Plugin;
|
|
7
7
|
|