grab 0.1.35 → 0.1.36
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/dist/copy-content-3pnWacho.d.cts +218 -0
- package/dist/copy-content-DH6fBB50.d.ts +218 -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/core-B9aCRu_r.cjs +4374 -0
- package/dist/core-BNG77P9u.js +20 -0
- package/dist/core-BaM4pWDg.cjs +20 -0
- package/dist/core-BgAHCKe7.js +4492 -0
- package/dist/core-BnZu88Zq.js +20 -0
- package/dist/core-BoXxu65H.js +20 -0
- package/dist/core-Bw1MUegr.cjs +4374 -0
- package/dist/core-C-uBKPnx.js +20 -0
- package/dist/core-CMd2PuB-.cjs +20 -0
- package/dist/core-CN7fVz1T.cjs +4377 -0
- package/dist/core-C_moHA9D.js +20 -0
- package/dist/core-CoEZwalZ.js +4489 -0
- package/dist/core-Cyu0n7SO.js +20 -0
- package/dist/core-DMVlP9g5.js +20 -0
- package/dist/core-XXPjZNnn.cjs +20 -0
- package/dist/core-_t0msYhT.cjs +20 -0
- package/dist/core-eVrmPJ2u.cjs +20 -0
- package/dist/core-epcog0yL.cjs +20 -0
- package/dist/core-foLKkb5_.cjs +20 -0
- package/dist/core-kGODXK-N.js +4489 -0
- package/dist/create-element-selector-B5J9_3Fw.cjs +9 -0
- package/dist/create-element-selector-BEaSanPh.cjs +9 -0
- package/dist/create-element-selector-BR_zDrcL.js +296 -0
- package/dist/create-element-selector-C3VxTCEX.js +9 -0
- package/dist/create-element-selector-CIj_4oMe.js +9 -0
- package/dist/create-element-selector-C_6sG1Bd.js +296 -0
- package/dist/create-element-selector-ChuWL5x4.cjs +9 -0
- package/dist/create-element-selector-CufggNcJ.js +9 -0
- package/dist/create-element-selector-D1FizysC.js +9 -0
- package/dist/create-element-selector-D4_cMOfX.cjs +307 -0
- package/dist/create-element-selector-Dw4Hh5vX.cjs +307 -0
- package/dist/create-element-selector-pHsYuaOR.cjs +9 -0
- package/dist/freeze-updates-1bWq0iRj.cjs +3340 -0
- package/dist/freeze-updates-7yZ9p4Jb.cjs +52 -0
- package/dist/freeze-updates-B2R6sKrS.js +52 -0
- package/dist/freeze-updates-BUIl_I9a.js +52 -0
- package/dist/freeze-updates-D7wc1FFo.js +52 -0
- package/dist/freeze-updates-DC22uWxG.cjs +3347 -0
- package/dist/freeze-updates-DFjQ3htO.js +52 -0
- package/dist/freeze-updates-DIifOZze.js +2921 -0
- package/dist/freeze-updates-D_ae-e4T.js +2920 -0
- package/dist/freeze-updates-DdIqMW8Y.cjs +52 -0
- package/dist/freeze-updates-DvAOKSWG.cjs +52 -0
- package/dist/freeze-updates-F-dFqbvY.cjs +52 -0
- package/dist/index-CkMIwkYj.d.ts +413 -0
- package/dist/index-DR5AjI5S.d.cts +413 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +13 -13
- package/dist/index.js +1 -1
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.d.cts +1 -1
- package/dist/primitives.d.ts +1 -1
- package/dist/primitives.js +1 -1
- package/dist/renderer-B65BudlT.cjs +9 -0
- package/dist/renderer-BRENw6lS.cjs +3205 -0
- package/dist/renderer-Bxc3RS-J.cjs +3205 -0
- package/dist/renderer-CD-Ju8A3.js +3205 -0
- package/dist/renderer-D0a4h1bK.cjs +9 -0
- package/dist/renderer-D3dvNcvm.cjs +9 -0
- package/dist/renderer-DQoIdFmy.js +9 -0
- package/dist/renderer-Dc20mGte.js +9 -0
- package/dist/renderer-DmNPMFh8.js +3205 -0
- package/dist/renderer-Dnyqr-yC.cjs +9 -0
- package/dist/renderer-gEdmDcCb.js +9 -0
- package/dist/renderer-kDb-jNJX.js +9 -0
- package/dist/state-BAZpSiUU.js +9 -0
- package/dist/state-BPvTpQtD.js +9 -0
- package/dist/state-Bn3fhsQ8.cjs +9 -0
- package/dist/state-BwCmdtcN.cjs +1306 -0
- package/dist/state-CFntkBxv.js +1696 -0
- package/dist/state-CR6-uxRM.cjs +9 -0
- package/dist/state-DQNAhhCY.cjs +1306 -0
- package/dist/state-Dgr3LbNH.cjs +9 -0
- package/dist/state-Ds-1VLFt.js +9 -0
- package/dist/state-Dt16Hkud.js +9 -0
- package/dist/state-LuyoMylH.js +1696 -0
- package/dist/state-x2vKMZfm.cjs +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 Aiden Bai
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import { n as StackFrame } from "./copy-content-3pnWacho.cjs";
|
|
10
|
+
|
|
11
|
+
//#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/reactive/observable.d.ts
|
|
12
|
+
declare global {
|
|
13
|
+
interface SymbolConstructor {
|
|
14
|
+
readonly observable: symbol;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/index.d.ts
|
|
19
|
+
declare global {
|
|
20
|
+
var Solid$$: boolean;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/types.d.ts
|
|
24
|
+
interface Position {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}
|
|
28
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? T[P] extends ((...args: unknown[]) => unknown) ? T[P] : DeepPartial<T[P]> : T[P] };
|
|
29
|
+
interface Theme {
|
|
30
|
+
/**
|
|
31
|
+
* Globally toggle the entire overlay
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Base hue (0-360) used to generate colors throughout the interface using HSL color space
|
|
37
|
+
* @default 0
|
|
38
|
+
*/
|
|
39
|
+
hue?: number;
|
|
40
|
+
/**
|
|
41
|
+
* The highlight box that appears when hovering over an element before selecting it
|
|
42
|
+
*/
|
|
43
|
+
selectionBox?: {
|
|
44
|
+
/**
|
|
45
|
+
* Whether to show the selection highlight
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
enabled?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The rectangular selection area that appears when clicking and dragging to select multiple elements
|
|
52
|
+
*/
|
|
53
|
+
dragBox?: {
|
|
54
|
+
/**
|
|
55
|
+
* Whether to show the drag selection box
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Brief flash/highlight boxes that appear on elements immediately after they're successfully grabbed/copied
|
|
62
|
+
*/
|
|
63
|
+
grabbedBoxes?: {
|
|
64
|
+
/**
|
|
65
|
+
* Whether to show these success flash effects
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The floating label that follows the cursor showing information about the currently hovered element
|
|
72
|
+
*/
|
|
73
|
+
elementLabel?: {
|
|
74
|
+
/**
|
|
75
|
+
* Whether to show the label
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The floating toolbar that allows toggling React Grab activation
|
|
82
|
+
*/
|
|
83
|
+
toolbar?: {
|
|
84
|
+
/**
|
|
85
|
+
* Whether to show the toolbar
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
enabled?: boolean;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
interface ReactGrabState {
|
|
92
|
+
isActive: boolean;
|
|
93
|
+
isDragging: boolean;
|
|
94
|
+
isCopying: boolean;
|
|
95
|
+
isPromptMode: boolean;
|
|
96
|
+
isSelectionBoxVisible: boolean;
|
|
97
|
+
isDragBoxVisible: boolean;
|
|
98
|
+
targetElement: Element | null;
|
|
99
|
+
dragBounds: DragRect | null;
|
|
100
|
+
/**
|
|
101
|
+
* Currently visible grabbed boxes (success flash effects).
|
|
102
|
+
* These are temporary visual indicators shown after elements are grabbed/copied.
|
|
103
|
+
*/
|
|
104
|
+
grabbedBoxes: Array<{
|
|
105
|
+
id: string;
|
|
106
|
+
bounds: OverlayBounds;
|
|
107
|
+
createdAt: number;
|
|
108
|
+
}>;
|
|
109
|
+
labelInstances: Array<{
|
|
110
|
+
id: string;
|
|
111
|
+
status: SelectionLabelStatus;
|
|
112
|
+
tagName: string;
|
|
113
|
+
componentName?: string;
|
|
114
|
+
createdAt: number;
|
|
115
|
+
}>;
|
|
116
|
+
selectionFilePath: string | null;
|
|
117
|
+
toolbarState: ToolbarState | null;
|
|
118
|
+
}
|
|
119
|
+
type ElementLabelVariant = "hover" | "processing" | "success";
|
|
120
|
+
interface PromptModeContext {
|
|
121
|
+
x: number;
|
|
122
|
+
y: number;
|
|
123
|
+
targetElement: Element | null;
|
|
124
|
+
}
|
|
125
|
+
interface ElementLabelContext {
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
content: string;
|
|
129
|
+
element?: Element;
|
|
130
|
+
tagName?: string;
|
|
131
|
+
componentName?: string;
|
|
132
|
+
filePath?: string;
|
|
133
|
+
lineNumber?: number;
|
|
134
|
+
}
|
|
135
|
+
type ActivationKey = string | ((event: KeyboardEvent) => boolean);
|
|
136
|
+
interface AgentContext<T = unknown> {
|
|
137
|
+
content: string[];
|
|
138
|
+
prompt: string;
|
|
139
|
+
options?: T;
|
|
140
|
+
sessionId?: string;
|
|
141
|
+
}
|
|
142
|
+
type ActivationMode = "toggle" | "hold";
|
|
143
|
+
interface ActionContextHooks {
|
|
144
|
+
transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
|
|
145
|
+
onOpenFile: (filePath: string, lineNumber?: number) => boolean | void;
|
|
146
|
+
transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string;
|
|
147
|
+
}
|
|
148
|
+
interface ActionContext {
|
|
149
|
+
element: Element;
|
|
150
|
+
elements: Element[];
|
|
151
|
+
filePath?: string;
|
|
152
|
+
lineNumber?: number;
|
|
153
|
+
componentName?: string;
|
|
154
|
+
tagName?: string;
|
|
155
|
+
enterPromptMode?: () => void;
|
|
156
|
+
hooks: ActionContextHooks;
|
|
157
|
+
performWithFeedback: (action: () => Promise<boolean>) => Promise<void>;
|
|
158
|
+
hideContextMenu: () => void;
|
|
159
|
+
cleanup: () => void;
|
|
160
|
+
}
|
|
161
|
+
interface ContextMenuActionContext extends ActionContext {
|
|
162
|
+
copy?: () => void;
|
|
163
|
+
}
|
|
164
|
+
interface ContextMenuAction {
|
|
165
|
+
id: string;
|
|
166
|
+
label: string;
|
|
167
|
+
shortcut?: string;
|
|
168
|
+
showInToolbarMenu?: boolean;
|
|
169
|
+
enabled?: boolean | ((context: ActionContext) => boolean);
|
|
170
|
+
onAction: (context: ContextMenuActionContext) => void | Promise<void>;
|
|
171
|
+
}
|
|
172
|
+
interface ArrowNavigationItem {
|
|
173
|
+
tagName: string;
|
|
174
|
+
componentName?: string;
|
|
175
|
+
}
|
|
176
|
+
interface ArrowNavigationState {
|
|
177
|
+
items: ArrowNavigationItem[];
|
|
178
|
+
activeIndex: number;
|
|
179
|
+
isVisible: boolean;
|
|
180
|
+
}
|
|
181
|
+
interface PluginHooks {
|
|
182
|
+
onActivate?: () => void;
|
|
183
|
+
onDeactivate?: () => void;
|
|
184
|
+
onElementHover?: (element: Element) => void;
|
|
185
|
+
onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
|
|
186
|
+
onDragStart?: (startX: number, startY: number) => void;
|
|
187
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
188
|
+
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
189
|
+
transformCopyContent?: (content: string, elements: Element[]) => string | Promise<string>;
|
|
190
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void;
|
|
191
|
+
onCopySuccess?: (elements: Element[], content: string) => void;
|
|
192
|
+
onCopyError?: (error: Error) => void;
|
|
193
|
+
onStateChange?: (state: ReactGrabState) => void;
|
|
194
|
+
onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void;
|
|
195
|
+
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
|
|
196
|
+
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
|
|
197
|
+
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
198
|
+
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
199
|
+
onContextMenu?: (element: Element, position: Position) => void;
|
|
200
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
|
|
201
|
+
transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
|
|
202
|
+
transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
|
|
203
|
+
transformActionContext?: (context: ActionContext) => ActionContext;
|
|
204
|
+
transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string;
|
|
205
|
+
}
|
|
206
|
+
interface PluginConfig {
|
|
207
|
+
theme?: DeepPartial<Theme>;
|
|
208
|
+
options?: SettableOptions;
|
|
209
|
+
actions?: ContextMenuAction[];
|
|
210
|
+
hooks?: PluginHooks;
|
|
211
|
+
cleanup?: () => void;
|
|
212
|
+
}
|
|
213
|
+
interface Plugin {
|
|
214
|
+
name: string;
|
|
215
|
+
theme?: DeepPartial<Theme>;
|
|
216
|
+
options?: SettableOptions;
|
|
217
|
+
actions?: ContextMenuAction[];
|
|
218
|
+
hooks?: PluginHooks;
|
|
219
|
+
setup?: (api: ReactGrabAPI, hooks: ActionContextHooks) => PluginConfig | void;
|
|
220
|
+
}
|
|
221
|
+
interface Options {
|
|
222
|
+
enabled?: boolean;
|
|
223
|
+
activationMode?: ActivationMode;
|
|
224
|
+
keyHoldDuration?: number;
|
|
225
|
+
allowActivationInsideInput?: boolean;
|
|
226
|
+
activationKey?: ActivationKey;
|
|
227
|
+
getContent?: (elements: Element[]) => Promise<string> | string;
|
|
228
|
+
/**
|
|
229
|
+
* Whether to freeze React state updates while React Grab is active.
|
|
230
|
+
* This prevents UI changes from interfering with element selection.
|
|
231
|
+
* @default true
|
|
232
|
+
*/
|
|
233
|
+
freezeReactUpdates?: boolean;
|
|
234
|
+
}
|
|
235
|
+
interface SettableOptions extends Options {
|
|
236
|
+
enabled?: never;
|
|
237
|
+
}
|
|
238
|
+
interface SourceInfo {
|
|
239
|
+
filePath: string;
|
|
240
|
+
lineNumber: number | null;
|
|
241
|
+
componentName: string | null;
|
|
242
|
+
}
|
|
243
|
+
interface ToolbarState {
|
|
244
|
+
edge: "top" | "bottom" | "left" | "right";
|
|
245
|
+
ratio: number;
|
|
246
|
+
collapsed: boolean;
|
|
247
|
+
enabled: boolean;
|
|
248
|
+
defaultAction?: string;
|
|
249
|
+
}
|
|
250
|
+
interface DropdownAnchor {
|
|
251
|
+
x: number;
|
|
252
|
+
y: number;
|
|
253
|
+
edge: ToolbarState["edge"];
|
|
254
|
+
toolbarWidth: number;
|
|
255
|
+
}
|
|
256
|
+
interface ReactGrabAPI {
|
|
257
|
+
activate: () => void;
|
|
258
|
+
deactivate: () => void;
|
|
259
|
+
toggle: () => void;
|
|
260
|
+
comment: () => void;
|
|
261
|
+
isActive: () => boolean;
|
|
262
|
+
isEnabled: () => boolean;
|
|
263
|
+
setEnabled: (enabled: boolean) => void;
|
|
264
|
+
getToolbarState: () => ToolbarState | null;
|
|
265
|
+
setToolbarState: (state: Partial<ToolbarState>) => void;
|
|
266
|
+
onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
|
|
267
|
+
dispose: () => void;
|
|
268
|
+
copyElement: (elements: Element | Element[]) => Promise<boolean>;
|
|
269
|
+
getSource: (element: Element) => Promise<SourceInfo | null>;
|
|
270
|
+
getStackContext: (element: Element) => Promise<string>;
|
|
271
|
+
getState: () => ReactGrabState;
|
|
272
|
+
setOptions: (options: SettableOptions) => void;
|
|
273
|
+
registerPlugin: (plugin: Plugin) => void;
|
|
274
|
+
unregisterPlugin: (name: string) => void;
|
|
275
|
+
getPlugins: () => string[];
|
|
276
|
+
getDisplayName: (element: Element) => string | null;
|
|
277
|
+
}
|
|
278
|
+
interface OverlayBounds {
|
|
279
|
+
borderRadius: string;
|
|
280
|
+
height: number;
|
|
281
|
+
transform: string;
|
|
282
|
+
width: number;
|
|
283
|
+
x: number;
|
|
284
|
+
y: number;
|
|
285
|
+
}
|
|
286
|
+
type SelectionLabelStatus = "idle" | "copying" | "copied" | "fading" | "error";
|
|
287
|
+
interface SelectionLabelInstance {
|
|
288
|
+
id: string;
|
|
289
|
+
bounds: OverlayBounds;
|
|
290
|
+
boundsMultiple?: OverlayBounds[];
|
|
291
|
+
tagName: string;
|
|
292
|
+
componentName?: string;
|
|
293
|
+
elementsCount?: number;
|
|
294
|
+
status: SelectionLabelStatus;
|
|
295
|
+
statusText?: string;
|
|
296
|
+
isPromptMode?: boolean;
|
|
297
|
+
inputValue?: string;
|
|
298
|
+
createdAt: number;
|
|
299
|
+
element?: Element;
|
|
300
|
+
elements?: Element[];
|
|
301
|
+
mouseX?: number;
|
|
302
|
+
mouseXOffsetFromCenter?: number;
|
|
303
|
+
mouseXOffsetRatio?: number;
|
|
304
|
+
errorMessage?: string;
|
|
305
|
+
hideArrow?: boolean;
|
|
306
|
+
}
|
|
307
|
+
interface FrozenLabelEntry {
|
|
308
|
+
tagName: string;
|
|
309
|
+
componentName?: string;
|
|
310
|
+
bounds: OverlayBounds;
|
|
311
|
+
mouseX?: number;
|
|
312
|
+
}
|
|
313
|
+
interface ReactGrabRendererProps {
|
|
314
|
+
selectionVisible?: boolean;
|
|
315
|
+
selectionBounds?: OverlayBounds;
|
|
316
|
+
selectionBoundsMultiple?: OverlayBounds[];
|
|
317
|
+
selectionShouldSnap?: boolean;
|
|
318
|
+
selectionElementsCount?: number;
|
|
319
|
+
frozenLabelEntries?: FrozenLabelEntry[];
|
|
320
|
+
pendingShiftPreviewEntry?: FrozenLabelEntry;
|
|
321
|
+
selectionFilePath?: string;
|
|
322
|
+
selectionLineNumber?: number;
|
|
323
|
+
selectionTagName?: string;
|
|
324
|
+
selectionComponentName?: string;
|
|
325
|
+
selectionLabelVisible?: boolean;
|
|
326
|
+
selectionLabelStatus?: SelectionLabelStatus;
|
|
327
|
+
selectionArrowNavigationState?: ArrowNavigationState;
|
|
328
|
+
onArrowNavigationSelect?: (index: number) => void;
|
|
329
|
+
labelInstances?: SelectionLabelInstance[];
|
|
330
|
+
dragVisible?: boolean;
|
|
331
|
+
dragBounds?: OverlayBounds;
|
|
332
|
+
grabbedBoxes?: Array<{
|
|
333
|
+
id: string;
|
|
334
|
+
bounds: OverlayBounds;
|
|
335
|
+
createdAt: number;
|
|
336
|
+
}>;
|
|
337
|
+
mouseX?: number;
|
|
338
|
+
isFrozen?: boolean;
|
|
339
|
+
inputValue?: string;
|
|
340
|
+
isPromptMode?: boolean;
|
|
341
|
+
onShowContextMenuInstance?: (instanceId: string) => void;
|
|
342
|
+
onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
|
|
343
|
+
onInputChange?: (value: string) => void;
|
|
344
|
+
onInputSubmit?: () => void;
|
|
345
|
+
onToggleExpand?: () => void;
|
|
346
|
+
isPendingDismiss?: boolean;
|
|
347
|
+
selectionLabelShakeCount?: number;
|
|
348
|
+
onConfirmDismiss?: () => void;
|
|
349
|
+
onCancelDismiss?: () => void;
|
|
350
|
+
toolbarVisible?: boolean;
|
|
351
|
+
isActive?: boolean;
|
|
352
|
+
onToggleActive?: () => void;
|
|
353
|
+
enabled?: boolean;
|
|
354
|
+
shakeCount?: number;
|
|
355
|
+
onToolbarStateChange?: (state: ToolbarState) => void;
|
|
356
|
+
onSubscribeToToolbarStateChanges?: (callback: (state: ToolbarState) => void) => () => void;
|
|
357
|
+
onToolbarSelectHoverChange?: (isHovered: boolean) => void;
|
|
358
|
+
onToolbarRef?: (element: HTMLDivElement) => void;
|
|
359
|
+
contextMenuPosition?: Position | null;
|
|
360
|
+
contextMenuBounds?: OverlayBounds | null;
|
|
361
|
+
contextMenuTagName?: string;
|
|
362
|
+
contextMenuComponentName?: string;
|
|
363
|
+
contextMenuHasFilePath?: boolean;
|
|
364
|
+
actions?: ContextMenuAction[];
|
|
365
|
+
actionContext?: ActionContext;
|
|
366
|
+
onContextMenuDismiss?: () => void;
|
|
367
|
+
onContextMenuHide?: () => void;
|
|
368
|
+
toolbarMenuPosition?: DropdownAnchor | null;
|
|
369
|
+
toolbarMenuActions?: ContextMenuAction[];
|
|
370
|
+
defaultActionId?: string;
|
|
371
|
+
onSetDefaultAction?: (actionId: string) => void;
|
|
372
|
+
onToggleToolbarMenu?: () => void;
|
|
373
|
+
onToolbarMenuDismiss?: () => void;
|
|
374
|
+
}
|
|
375
|
+
interface GrabbedBox {
|
|
376
|
+
id: string;
|
|
377
|
+
bounds: OverlayBounds;
|
|
378
|
+
createdAt: number;
|
|
379
|
+
element?: Element;
|
|
380
|
+
}
|
|
381
|
+
interface Rect {
|
|
382
|
+
left: number;
|
|
383
|
+
top: number;
|
|
384
|
+
right: number;
|
|
385
|
+
bottom: number;
|
|
386
|
+
}
|
|
387
|
+
interface DragRect {
|
|
388
|
+
x: number;
|
|
389
|
+
y: number;
|
|
390
|
+
width: number;
|
|
391
|
+
height: number;
|
|
392
|
+
}
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/core/context.d.ts
|
|
395
|
+
declare const getStack: (element: Element) => Promise<StackFrame[] | null>;
|
|
396
|
+
interface StackContextOptions {
|
|
397
|
+
maxLines?: number;
|
|
398
|
+
}
|
|
399
|
+
declare const getElementContext: (element: Element, options?: StackContextOptions) => Promise<string>;
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/core/theme.d.ts
|
|
402
|
+
declare const DEFAULT_THEME: Required<Theme>;
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/utils/generate-snippet.d.ts
|
|
405
|
+
interface GenerateSnippetOptions {
|
|
406
|
+
maxLines?: number;
|
|
407
|
+
}
|
|
408
|
+
declare const generateSnippet: (elements: Element[], options?: GenerateSnippetOptions) => Promise<string[]>;
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/core/index.d.ts
|
|
411
|
+
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
412
|
+
//#endregion
|
|
413
|
+
export { Theme as A, PromptModeContext as C, Rect as D, ReactGrabState as E, SettableOptions as O, Position as S, ReactGrabRendererProps as T, Options as _, getStack as a, PluginConfig as b, ActivationMode as c, ContextMenuActionContext as d, DeepPartial as f, GrabbedBox as g, ElementLabelVariant as h, getElementContext as i, ToolbarState as j, SourceInfo as k, AgentContext as l, ElementLabelContext as m, generateSnippet as n, ActionContext as o, DragRect as p, DEFAULT_THEME as r, ActionContextHooks as s, init as t, ContextMenuAction as u, OverlayBounds as v, ReactGrabAPI as w, PluginHooks as x, Plugin as y };
|
package/dist/index.cjs
CHANGED
|
@@ -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
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-
|
|
9
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-BaM4pWDg.cjs`),t=require(`./freeze-updates-DdIqMW8Y.cjs`);let n=null;const r=()=>typeof window>`u`?n:window.__REACT_GRAB__??n??null,i=e=>{n=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},a=[],o=e=>{for(;a.length>0;){let t=a.shift();t&&e.registerPlugin(t)}},s=e=>{let t=r();if(t){t.registerPlugin(e);return}a.push(e)},c=e=>{let t=r();if(t){t.unregisterPlugin(e);return}let n=a.findIndex(t=>t.name===e);n!==-1&&a.splice(n,1)};typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?n=window.__REACT_GRAB__:(n=e.t(),window.__REACT_GRAB__=n),o(n),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:n}))),exports.DEFAULT_THEME=e.a,exports.commentPlugin=e.i,exports.formatElementInfo=t.x,exports.generateSnippet=e.n,exports.getGlobalApi=r,exports.getStack=t.T,exports.init=e.t,exports.isInstrumentationActive=t.k,exports.openPlugin=e.r,exports.registerPlugin=s,exports.setGlobalApi=i,exports.unregisterPlugin=c;
|
package/dist/index.d.cts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
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
|
-
import { A as Theme, C as PromptModeContext, D as Rect, E as ReactGrabState, O as SettableOptions, S as Position, _ as Options, a as getStack, b as PluginConfig, c as ActivationMode, d as ContextMenuActionContext, f as DeepPartial, g as GrabbedBox, h as ElementLabelVariant, i as getElementContext, j as ToolbarState, k as SourceInfo, l as AgentContext, m as ElementLabelContext, n as generateSnippet, o as ActionContext, p as DragRect, r as DEFAULT_THEME, s as ActionContextHooks, t as init, u as ContextMenuAction, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "./index-
|
|
10
|
-
import { i as isInstrumentationActive } from "./copy-content-
|
|
9
|
+
import { A as Theme, C as PromptModeContext, D as Rect, E as ReactGrabState, O as SettableOptions, S as Position, _ as Options, a as getStack, b as PluginConfig, c as ActivationMode, d as ContextMenuActionContext, f as DeepPartial, g as GrabbedBox, h as ElementLabelVariant, i as getElementContext, j as ToolbarState, k as SourceInfo, l as AgentContext, m as ElementLabelContext, n as generateSnippet, o as ActionContext, p as DragRect, r as DEFAULT_THEME, s as ActionContextHooks, t as init, u as ContextMenuAction, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "./index-DR5AjI5S.cjs";
|
|
10
|
+
import { i as isInstrumentationActive } from "./copy-content-3pnWacho.cjs";
|
|
11
11
|
|
|
12
12
|
//#region src/core/plugins/comment.d.ts
|
|
13
13
|
declare const commentPlugin: Plugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
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
|
-
import { A as Theme, C as PromptModeContext, D as Rect, E as ReactGrabState, O as SettableOptions, S as Position, _ as Options, a as getStack, b as PluginConfig, c as ActivationMode, d as ContextMenuActionContext, f as DeepPartial, g as GrabbedBox, h as ElementLabelVariant, i as getElementContext, j as ToolbarState, k as SourceInfo, l as AgentContext, m as ElementLabelContext, n as generateSnippet, o as ActionContext, p as DragRect, r as DEFAULT_THEME, s as ActionContextHooks, t as init, u as ContextMenuAction, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "./index-
|
|
10
|
-
import { i as isInstrumentationActive } from "./copy-content-
|
|
9
|
+
import { A as Theme, C as PromptModeContext, D as Rect, E as ReactGrabState, O as SettableOptions, S as Position, _ as Options, a as getStack, b as PluginConfig, c as ActivationMode, d as ContextMenuActionContext, f as DeepPartial, g as GrabbedBox, h as ElementLabelVariant, i as getElementContext, j as ToolbarState, k as SourceInfo, l as AgentContext, m as ElementLabelContext, n as generateSnippet, o as ActionContext, p as DragRect, r as DEFAULT_THEME, s as ActionContextHooks, t as init, u as ContextMenuAction, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "./index-CkMIwkYj.js";
|
|
10
|
+
import { i as isInstrumentationActive } from "./copy-content-DH6fBB50.js";
|
|
11
11
|
|
|
12
12
|
//#region src/core/plugins/comment.d.ts
|
|
13
13
|
declare const commentPlugin: Plugin;
|