react-grab 0.0.53 → 0.0.55
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 +1 -6
- package/dist/{chunk-3OMOSCKI.cjs → chunk-EAIY6I5Y.cjs} +2027 -635
- package/dist/{chunk-XLGRJBAL.js → chunk-GQ7Z2X35.js} +2025 -634
- package/dist/{core-CHAbsaHv.d.cts → core-DeAAaVyA.d.cts} +112 -18
- package/dist/{core-CHAbsaHv.d.ts → core-DeAAaVyA.d.ts} +112 -18
- package/dist/core.cjs +14 -10
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +31 -12
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.global.js +26 -32
- package/dist/index.js +23 -5
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -153,19 +153,89 @@ interface ReactGrabState {
|
|
|
153
153
|
isActive: boolean;
|
|
154
154
|
isDragging: boolean;
|
|
155
155
|
isCopying: boolean;
|
|
156
|
+
isInputMode: boolean;
|
|
156
157
|
targetElement: Element | null;
|
|
157
158
|
dragBounds: DragRect | null;
|
|
158
159
|
}
|
|
160
|
+
type SuccessLabelType = "copy" | "input-submit";
|
|
161
|
+
type ElementLabelVariant = "hover" | "processing" | "success";
|
|
162
|
+
interface InputModeContext {
|
|
163
|
+
x: number;
|
|
164
|
+
y: number;
|
|
165
|
+
targetElement: Element | null;
|
|
166
|
+
}
|
|
167
|
+
interface SuccessLabelContext {
|
|
168
|
+
x: number;
|
|
169
|
+
y: number;
|
|
170
|
+
}
|
|
171
|
+
interface CrosshairContext {
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
}
|
|
175
|
+
interface ElementLabelContext {
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
content: string;
|
|
179
|
+
}
|
|
159
180
|
type RenderType = "selectionBox" | "dragBox" | "grabbedBox" | "elementLabel" | "successLabel" | "crosshair" | "inputOverlay";
|
|
160
181
|
interface RenderData {
|
|
161
182
|
ref: HTMLElement | undefined;
|
|
162
183
|
props: Record<string, unknown>;
|
|
163
184
|
}
|
|
185
|
+
interface ActivationKey {
|
|
186
|
+
key?: string;
|
|
187
|
+
metaKey?: boolean;
|
|
188
|
+
ctrlKey?: boolean;
|
|
189
|
+
shiftKey?: boolean;
|
|
190
|
+
altKey?: boolean;
|
|
191
|
+
}
|
|
192
|
+
interface AgentContext<T = unknown> {
|
|
193
|
+
content: string;
|
|
194
|
+
prompt: string;
|
|
195
|
+
options?: T;
|
|
196
|
+
}
|
|
197
|
+
interface AgentSession {
|
|
198
|
+
id: string;
|
|
199
|
+
context: AgentContext;
|
|
200
|
+
lastStatus: string;
|
|
201
|
+
isStreaming: boolean;
|
|
202
|
+
createdAt: number;
|
|
203
|
+
position: {
|
|
204
|
+
x: number;
|
|
205
|
+
y: number;
|
|
206
|
+
};
|
|
207
|
+
selectionBounds?: OverlayBounds;
|
|
208
|
+
tagName?: string;
|
|
209
|
+
}
|
|
210
|
+
interface AgentProvider<T = unknown> {
|
|
211
|
+
send: (context: AgentContext<T>, signal: AbortSignal) => AsyncIterable<string>;
|
|
212
|
+
resume?: (sessionId: string, signal: AbortSignal) => AsyncIterable<string>;
|
|
213
|
+
supportsResume?: boolean;
|
|
214
|
+
}
|
|
215
|
+
interface AgentSessionStorage {
|
|
216
|
+
getItem(key: string): string | null;
|
|
217
|
+
setItem(key: string, value: string): void;
|
|
218
|
+
removeItem(key: string): void;
|
|
219
|
+
}
|
|
220
|
+
interface AgentOptions<T = unknown> {
|
|
221
|
+
provider?: AgentProvider<T>;
|
|
222
|
+
storage?: AgentSessionStorage | null;
|
|
223
|
+
getOptions?: () => T;
|
|
224
|
+
onStart?: (session: AgentSession) => void;
|
|
225
|
+
onStatus?: (status: string, session: AgentSession) => void;
|
|
226
|
+
onComplete?: (session: AgentSession) => void;
|
|
227
|
+
onError?: (error: Error, session: AgentSession) => void;
|
|
228
|
+
onResume?: (session: AgentSession) => void;
|
|
229
|
+
onAbort?: (session: AgentSession, element: Element | undefined) => void;
|
|
230
|
+
}
|
|
164
231
|
interface Options {
|
|
165
232
|
enabled?: boolean;
|
|
166
233
|
keyHoldDuration?: number;
|
|
167
234
|
allowActivationInsideInput?: boolean;
|
|
235
|
+
copyFileOnly?: boolean;
|
|
168
236
|
theme?: Theme;
|
|
237
|
+
activationShortcut?: (event: KeyboardEvent) => boolean;
|
|
238
|
+
activationKey?: ActivationKey;
|
|
169
239
|
onActivate?: () => void;
|
|
170
240
|
onDeactivate?: () => void;
|
|
171
241
|
onElementHover?: (element: Element) => void;
|
|
@@ -178,6 +248,15 @@ interface Options {
|
|
|
178
248
|
onCopyError?: (error: Error) => void;
|
|
179
249
|
onStateChange?: (state: ReactGrabState) => void;
|
|
180
250
|
onRender?: (type: RenderType, data: RenderData) => void;
|
|
251
|
+
onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
|
|
252
|
+
onSuccessLabel?: (text: string, type: SuccessLabelType, context: SuccessLabelContext) => void;
|
|
253
|
+
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
|
|
254
|
+
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
|
|
255
|
+
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
256
|
+
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
257
|
+
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
258
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
259
|
+
agent?: AgentOptions;
|
|
181
260
|
}
|
|
182
261
|
interface ReactGrabAPI {
|
|
183
262
|
activate: () => void;
|
|
@@ -198,9 +277,24 @@ interface OverlayBounds {
|
|
|
198
277
|
x: number;
|
|
199
278
|
y: number;
|
|
200
279
|
}
|
|
280
|
+
type SelectionLabelStatus = "idle" | "copying" | "copied" | "fading";
|
|
281
|
+
interface SelectionLabelInstance {
|
|
282
|
+
id: string;
|
|
283
|
+
bounds: OverlayBounds;
|
|
284
|
+
tagName: string;
|
|
285
|
+
status: SelectionLabelStatus;
|
|
286
|
+
createdAt: number;
|
|
287
|
+
element?: Element;
|
|
288
|
+
}
|
|
201
289
|
interface ReactGrabRendererProps {
|
|
202
290
|
selectionVisible?: boolean;
|
|
203
291
|
selectionBounds?: OverlayBounds;
|
|
292
|
+
selectionFilePath?: string;
|
|
293
|
+
selectionLineNumber?: number;
|
|
294
|
+
selectionTagName?: string;
|
|
295
|
+
selectionLabelVisible?: boolean;
|
|
296
|
+
selectionLabelStatus?: SelectionLabelStatus;
|
|
297
|
+
labelInstances?: SelectionLabelInstance[];
|
|
204
298
|
dragVisible?: boolean;
|
|
205
299
|
dragBounds?: OverlayBounds;
|
|
206
300
|
grabbedBoxes?: Array<{
|
|
@@ -208,29 +302,27 @@ interface ReactGrabRendererProps {
|
|
|
208
302
|
bounds: OverlayBounds;
|
|
209
303
|
createdAt: number;
|
|
210
304
|
}>;
|
|
211
|
-
successLabels?: Array<{
|
|
212
|
-
id: string;
|
|
213
|
-
text: string;
|
|
214
|
-
}>;
|
|
215
|
-
labelVariant?: "hover" | "processing" | "success";
|
|
216
|
-
labelContent?: unknown;
|
|
217
|
-
labelX?: number;
|
|
218
|
-
labelY?: number;
|
|
219
|
-
labelVisible?: boolean;
|
|
220
305
|
labelZIndex?: number;
|
|
221
|
-
labelShowHint?: boolean;
|
|
222
|
-
progressVisible?: boolean;
|
|
223
|
-
progress?: number;
|
|
224
306
|
mouseX?: number;
|
|
225
307
|
mouseY?: number;
|
|
226
308
|
crosshairVisible?: boolean;
|
|
227
|
-
inputVisible?: boolean;
|
|
228
|
-
inputX?: number;
|
|
229
|
-
inputY?: number;
|
|
230
309
|
inputValue?: string;
|
|
310
|
+
isInputExpanded?: boolean;
|
|
311
|
+
hasAgent?: boolean;
|
|
312
|
+
agentSessions?: Map<string, AgentSession>;
|
|
313
|
+
onAbortSession?: (sessionId: string) => void;
|
|
231
314
|
onInputChange?: (value: string) => void;
|
|
232
315
|
onInputSubmit?: () => void;
|
|
233
316
|
onInputCancel?: () => void;
|
|
317
|
+
onToggleExpand?: () => void;
|
|
318
|
+
nativeSelectionCursorVisible?: boolean;
|
|
319
|
+
nativeSelectionCursorX?: number;
|
|
320
|
+
nativeSelectionCursorY?: number;
|
|
321
|
+
nativeSelectionTagName?: string;
|
|
322
|
+
nativeSelectionComponentName?: string;
|
|
323
|
+
nativeSelectionBounds?: OverlayBounds;
|
|
324
|
+
onNativeSelectionCopy?: () => void;
|
|
325
|
+
onNativeSelectionEnter?: () => void;
|
|
234
326
|
theme?: Required<Theme>;
|
|
235
327
|
}
|
|
236
328
|
interface GrabbedBox {
|
|
@@ -262,11 +354,13 @@ interface StackFrame {
|
|
|
262
354
|
source: FiberSource | null;
|
|
263
355
|
}
|
|
264
356
|
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
265
|
-
declare const
|
|
266
|
-
declare const
|
|
357
|
+
declare const formatElementInfo: (element: Element) => Promise<string>;
|
|
358
|
+
declare const getFileName: (stack: Array<StackFrame>) => string | null;
|
|
267
359
|
|
|
268
360
|
declare const DEFAULT_THEME: Required<Theme>;
|
|
269
361
|
|
|
362
|
+
declare const generateSnippet: (elements: Element[]) => Promise<string>;
|
|
363
|
+
|
|
270
364
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
271
365
|
|
|
272
|
-
export { DEFAULT_THEME as D, type GrabbedBox as G, type Options as O, type Position as P, type ReactGrabAPI as R, type Theme as T,
|
|
366
|
+
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, getNearestComponentName as a, generateSnippet as b, type ReactGrabState as c, type RenderType as d, type RenderData as e, formatElementInfo as f, getStack as g, type OverlayBounds as h, init as i, type DragRect as j, type Rect as k, type DeepPartial as l, type SuccessLabelContext as m, type ElementLabelContext as n, type AgentSession as o, type AgentProvider as p, type AgentSessionStorage as q, type AgentOptions as r, getFileName as s, type ReactGrabRendererProps as t };
|
|
@@ -153,19 +153,89 @@ interface ReactGrabState {
|
|
|
153
153
|
isActive: boolean;
|
|
154
154
|
isDragging: boolean;
|
|
155
155
|
isCopying: boolean;
|
|
156
|
+
isInputMode: boolean;
|
|
156
157
|
targetElement: Element | null;
|
|
157
158
|
dragBounds: DragRect | null;
|
|
158
159
|
}
|
|
160
|
+
type SuccessLabelType = "copy" | "input-submit";
|
|
161
|
+
type ElementLabelVariant = "hover" | "processing" | "success";
|
|
162
|
+
interface InputModeContext {
|
|
163
|
+
x: number;
|
|
164
|
+
y: number;
|
|
165
|
+
targetElement: Element | null;
|
|
166
|
+
}
|
|
167
|
+
interface SuccessLabelContext {
|
|
168
|
+
x: number;
|
|
169
|
+
y: number;
|
|
170
|
+
}
|
|
171
|
+
interface CrosshairContext {
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
}
|
|
175
|
+
interface ElementLabelContext {
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
content: string;
|
|
179
|
+
}
|
|
159
180
|
type RenderType = "selectionBox" | "dragBox" | "grabbedBox" | "elementLabel" | "successLabel" | "crosshair" | "inputOverlay";
|
|
160
181
|
interface RenderData {
|
|
161
182
|
ref: HTMLElement | undefined;
|
|
162
183
|
props: Record<string, unknown>;
|
|
163
184
|
}
|
|
185
|
+
interface ActivationKey {
|
|
186
|
+
key?: string;
|
|
187
|
+
metaKey?: boolean;
|
|
188
|
+
ctrlKey?: boolean;
|
|
189
|
+
shiftKey?: boolean;
|
|
190
|
+
altKey?: boolean;
|
|
191
|
+
}
|
|
192
|
+
interface AgentContext<T = unknown> {
|
|
193
|
+
content: string;
|
|
194
|
+
prompt: string;
|
|
195
|
+
options?: T;
|
|
196
|
+
}
|
|
197
|
+
interface AgentSession {
|
|
198
|
+
id: string;
|
|
199
|
+
context: AgentContext;
|
|
200
|
+
lastStatus: string;
|
|
201
|
+
isStreaming: boolean;
|
|
202
|
+
createdAt: number;
|
|
203
|
+
position: {
|
|
204
|
+
x: number;
|
|
205
|
+
y: number;
|
|
206
|
+
};
|
|
207
|
+
selectionBounds?: OverlayBounds;
|
|
208
|
+
tagName?: string;
|
|
209
|
+
}
|
|
210
|
+
interface AgentProvider<T = unknown> {
|
|
211
|
+
send: (context: AgentContext<T>, signal: AbortSignal) => AsyncIterable<string>;
|
|
212
|
+
resume?: (sessionId: string, signal: AbortSignal) => AsyncIterable<string>;
|
|
213
|
+
supportsResume?: boolean;
|
|
214
|
+
}
|
|
215
|
+
interface AgentSessionStorage {
|
|
216
|
+
getItem(key: string): string | null;
|
|
217
|
+
setItem(key: string, value: string): void;
|
|
218
|
+
removeItem(key: string): void;
|
|
219
|
+
}
|
|
220
|
+
interface AgentOptions<T = unknown> {
|
|
221
|
+
provider?: AgentProvider<T>;
|
|
222
|
+
storage?: AgentSessionStorage | null;
|
|
223
|
+
getOptions?: () => T;
|
|
224
|
+
onStart?: (session: AgentSession) => void;
|
|
225
|
+
onStatus?: (status: string, session: AgentSession) => void;
|
|
226
|
+
onComplete?: (session: AgentSession) => void;
|
|
227
|
+
onError?: (error: Error, session: AgentSession) => void;
|
|
228
|
+
onResume?: (session: AgentSession) => void;
|
|
229
|
+
onAbort?: (session: AgentSession, element: Element | undefined) => void;
|
|
230
|
+
}
|
|
164
231
|
interface Options {
|
|
165
232
|
enabled?: boolean;
|
|
166
233
|
keyHoldDuration?: number;
|
|
167
234
|
allowActivationInsideInput?: boolean;
|
|
235
|
+
copyFileOnly?: boolean;
|
|
168
236
|
theme?: Theme;
|
|
237
|
+
activationShortcut?: (event: KeyboardEvent) => boolean;
|
|
238
|
+
activationKey?: ActivationKey;
|
|
169
239
|
onActivate?: () => void;
|
|
170
240
|
onDeactivate?: () => void;
|
|
171
241
|
onElementHover?: (element: Element) => void;
|
|
@@ -178,6 +248,15 @@ interface Options {
|
|
|
178
248
|
onCopyError?: (error: Error) => void;
|
|
179
249
|
onStateChange?: (state: ReactGrabState) => void;
|
|
180
250
|
onRender?: (type: RenderType, data: RenderData) => void;
|
|
251
|
+
onInputModeChange?: (isInputMode: boolean, context: InputModeContext) => void;
|
|
252
|
+
onSuccessLabel?: (text: string, type: SuccessLabelType, context: SuccessLabelContext) => void;
|
|
253
|
+
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void;
|
|
254
|
+
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void;
|
|
255
|
+
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
256
|
+
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
257
|
+
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
258
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
259
|
+
agent?: AgentOptions;
|
|
181
260
|
}
|
|
182
261
|
interface ReactGrabAPI {
|
|
183
262
|
activate: () => void;
|
|
@@ -198,9 +277,24 @@ interface OverlayBounds {
|
|
|
198
277
|
x: number;
|
|
199
278
|
y: number;
|
|
200
279
|
}
|
|
280
|
+
type SelectionLabelStatus = "idle" | "copying" | "copied" | "fading";
|
|
281
|
+
interface SelectionLabelInstance {
|
|
282
|
+
id: string;
|
|
283
|
+
bounds: OverlayBounds;
|
|
284
|
+
tagName: string;
|
|
285
|
+
status: SelectionLabelStatus;
|
|
286
|
+
createdAt: number;
|
|
287
|
+
element?: Element;
|
|
288
|
+
}
|
|
201
289
|
interface ReactGrabRendererProps {
|
|
202
290
|
selectionVisible?: boolean;
|
|
203
291
|
selectionBounds?: OverlayBounds;
|
|
292
|
+
selectionFilePath?: string;
|
|
293
|
+
selectionLineNumber?: number;
|
|
294
|
+
selectionTagName?: string;
|
|
295
|
+
selectionLabelVisible?: boolean;
|
|
296
|
+
selectionLabelStatus?: SelectionLabelStatus;
|
|
297
|
+
labelInstances?: SelectionLabelInstance[];
|
|
204
298
|
dragVisible?: boolean;
|
|
205
299
|
dragBounds?: OverlayBounds;
|
|
206
300
|
grabbedBoxes?: Array<{
|
|
@@ -208,29 +302,27 @@ interface ReactGrabRendererProps {
|
|
|
208
302
|
bounds: OverlayBounds;
|
|
209
303
|
createdAt: number;
|
|
210
304
|
}>;
|
|
211
|
-
successLabels?: Array<{
|
|
212
|
-
id: string;
|
|
213
|
-
text: string;
|
|
214
|
-
}>;
|
|
215
|
-
labelVariant?: "hover" | "processing" | "success";
|
|
216
|
-
labelContent?: unknown;
|
|
217
|
-
labelX?: number;
|
|
218
|
-
labelY?: number;
|
|
219
|
-
labelVisible?: boolean;
|
|
220
305
|
labelZIndex?: number;
|
|
221
|
-
labelShowHint?: boolean;
|
|
222
|
-
progressVisible?: boolean;
|
|
223
|
-
progress?: number;
|
|
224
306
|
mouseX?: number;
|
|
225
307
|
mouseY?: number;
|
|
226
308
|
crosshairVisible?: boolean;
|
|
227
|
-
inputVisible?: boolean;
|
|
228
|
-
inputX?: number;
|
|
229
|
-
inputY?: number;
|
|
230
309
|
inputValue?: string;
|
|
310
|
+
isInputExpanded?: boolean;
|
|
311
|
+
hasAgent?: boolean;
|
|
312
|
+
agentSessions?: Map<string, AgentSession>;
|
|
313
|
+
onAbortSession?: (sessionId: string) => void;
|
|
231
314
|
onInputChange?: (value: string) => void;
|
|
232
315
|
onInputSubmit?: () => void;
|
|
233
316
|
onInputCancel?: () => void;
|
|
317
|
+
onToggleExpand?: () => void;
|
|
318
|
+
nativeSelectionCursorVisible?: boolean;
|
|
319
|
+
nativeSelectionCursorX?: number;
|
|
320
|
+
nativeSelectionCursorY?: number;
|
|
321
|
+
nativeSelectionTagName?: string;
|
|
322
|
+
nativeSelectionComponentName?: string;
|
|
323
|
+
nativeSelectionBounds?: OverlayBounds;
|
|
324
|
+
onNativeSelectionCopy?: () => void;
|
|
325
|
+
onNativeSelectionEnter?: () => void;
|
|
234
326
|
theme?: Required<Theme>;
|
|
235
327
|
}
|
|
236
328
|
interface GrabbedBox {
|
|
@@ -262,11 +354,13 @@ interface StackFrame {
|
|
|
262
354
|
source: FiberSource | null;
|
|
263
355
|
}
|
|
264
356
|
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
265
|
-
declare const
|
|
266
|
-
declare const
|
|
357
|
+
declare const formatElementInfo: (element: Element) => Promise<string>;
|
|
358
|
+
declare const getFileName: (stack: Array<StackFrame>) => string | null;
|
|
267
359
|
|
|
268
360
|
declare const DEFAULT_THEME: Required<Theme>;
|
|
269
361
|
|
|
362
|
+
declare const generateSnippet: (elements: Element[]) => Promise<string>;
|
|
363
|
+
|
|
270
364
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
271
365
|
|
|
272
|
-
export { DEFAULT_THEME as D, type GrabbedBox as G, type Options as O, type Position as P, type ReactGrabAPI as R, type Theme as T,
|
|
366
|
+
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, getNearestComponentName as a, generateSnippet as b, type ReactGrabState as c, type RenderType as d, type RenderData as e, formatElementInfo as f, getStack as g, type OverlayBounds as h, init as i, type DragRect as j, type Rect as k, type DeepPartial as l, type SuccessLabelContext as m, type ElementLabelContext as n, type AgentSession as o, type AgentProvider as p, type AgentSessionStorage as q, type AgentOptions as r, getFileName as s, type ReactGrabRendererProps as t };
|
package/dist/core.cjs
CHANGED
|
@@ -1,34 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEAIY6I5Y_cjs = require('./chunk-EAIY6I5Y.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkEAIY6I5Y_cjs.DEFAULT_THEME; }
|
|
10
10
|
});
|
|
11
|
-
Object.defineProperty(exports, "
|
|
11
|
+
Object.defineProperty(exports, "formatElementInfo", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkEAIY6I5Y_cjs.formatElementInfo; }
|
|
14
14
|
});
|
|
15
|
-
Object.defineProperty(exports, "
|
|
15
|
+
Object.defineProperty(exports, "generateSnippet", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkEAIY6I5Y_cjs.generateSnippet; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "getFileName", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkEAIY6I5Y_cjs.getFileName; }
|
|
18
22
|
});
|
|
19
23
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
20
24
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkEAIY6I5Y_cjs.getNearestComponentName; }
|
|
22
26
|
});
|
|
23
27
|
Object.defineProperty(exports, "getStack", {
|
|
24
28
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkEAIY6I5Y_cjs.getStack; }
|
|
26
30
|
});
|
|
27
31
|
Object.defineProperty(exports, "init", {
|
|
28
32
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkEAIY6I5Y_cjs.init; }
|
|
30
34
|
});
|
|
31
35
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
32
36
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkEAIY6I5Y_cjs.Ee; }
|
|
34
38
|
});
|
package/dist/core.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DEFAULT_THEME, O as Options, h as OverlayBounds, R as ReactGrabAPI,
|
|
1
|
+
export { A as AgentContext, p as AgentProvider, o as AgentSession, D as DEFAULT_THEME, O as Options, h as OverlayBounds, R as ReactGrabAPI, t as ReactGrabRendererProps, f as formatElementInfo, b as generateSnippet, s as getFileName, a as getNearestComponentName, g as getStack, i as init } from './core-DeAAaVyA.cjs';
|
|
2
2
|
export { isInstrumentationActive } from 'bippy';
|
|
3
3
|
import 'bippy/source';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DEFAULT_THEME, O as Options, h as OverlayBounds, R as ReactGrabAPI,
|
|
1
|
+
export { A as AgentContext, p as AgentProvider, o as AgentSession, D as DEFAULT_THEME, O as Options, h as OverlayBounds, R as ReactGrabAPI, t as ReactGrabRendererProps, f as formatElementInfo, b as generateSnippet, s as getFileName, a as getNearestComponentName, g as getStack, i as init } from './core-DeAAaVyA.js';
|
|
2
2
|
export { isInstrumentationActive } from 'bippy';
|
|
3
3
|
import 'bippy/source';
|
package/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DEFAULT_THEME,
|
|
1
|
+
export { DEFAULT_THEME, formatElementInfo, generateSnippet, getFileName, getNearestComponentName, getStack, init, Ee as isInstrumentationActive } from './chunk-GQ7Z2X35.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEAIY6I5Y_cjs = require('./chunk-EAIY6I5Y.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @license MIT
|
|
@@ -14,38 +14,57 @@ var chunk3OMOSCKI_cjs = require('./chunk-3OMOSCKI.cjs');
|
|
|
14
14
|
// src/index.ts
|
|
15
15
|
var globalApi = null;
|
|
16
16
|
var getGlobalApi = () => {
|
|
17
|
-
return globalApi;
|
|
17
|
+
return window.__REACT_GRAB__ ?? globalApi ?? null;
|
|
18
|
+
};
|
|
19
|
+
var setGlobalApi = (api) => {
|
|
20
|
+
globalApi = api;
|
|
21
|
+
if (typeof window !== "undefined") {
|
|
22
|
+
if (api) {
|
|
23
|
+
window.__REACT_GRAB__ = api;
|
|
24
|
+
} else {
|
|
25
|
+
delete window.__REACT_GRAB__;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
18
28
|
};
|
|
19
29
|
if (typeof window !== "undefined") {
|
|
20
|
-
|
|
30
|
+
if (window.__REACT_GRAB__) {
|
|
31
|
+
globalApi = window.__REACT_GRAB__;
|
|
32
|
+
} else {
|
|
33
|
+
globalApi = chunkEAIY6I5Y_cjs.init();
|
|
34
|
+
window.__REACT_GRAB__ = globalApi;
|
|
35
|
+
window.dispatchEvent(
|
|
36
|
+
new CustomEvent("react-grab:init", { detail: globalApi })
|
|
37
|
+
);
|
|
38
|
+
}
|
|
21
39
|
}
|
|
22
40
|
|
|
23
41
|
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
24
42
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkEAIY6I5Y_cjs.DEFAULT_THEME; }
|
|
26
44
|
});
|
|
27
|
-
Object.defineProperty(exports, "
|
|
45
|
+
Object.defineProperty(exports, "formatElementInfo", {
|
|
28
46
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkEAIY6I5Y_cjs.formatElementInfo; }
|
|
30
48
|
});
|
|
31
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "generateSnippet", {
|
|
32
50
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkEAIY6I5Y_cjs.generateSnippet; }
|
|
34
52
|
});
|
|
35
53
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
36
54
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkEAIY6I5Y_cjs.getNearestComponentName; }
|
|
38
56
|
});
|
|
39
57
|
Object.defineProperty(exports, "getStack", {
|
|
40
58
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkEAIY6I5Y_cjs.getStack; }
|
|
42
60
|
});
|
|
43
61
|
Object.defineProperty(exports, "init", {
|
|
44
62
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkEAIY6I5Y_cjs.init; }
|
|
46
64
|
});
|
|
47
65
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
48
66
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkEAIY6I5Y_cjs.Ee; }
|
|
50
68
|
});
|
|
51
69
|
exports.getGlobalApi = getGlobalApi;
|
|
70
|
+
exports.setGlobalApi = setGlobalApi;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { R as ReactGrabAPI } from './core-
|
|
2
|
-
export { D as DEFAULT_THEME, l as DeepPartial, j as DragRect, G as GrabbedBox, O as Options, h as OverlayBounds, P as Position, c as ReactGrabState, k as Rect, e as RenderData, d as RenderType, T as Theme, f as
|
|
1
|
+
import { R as ReactGrabAPI } from './core-DeAAaVyA.cjs';
|
|
2
|
+
export { A as AgentContext, r as AgentOptions, p as AgentProvider, o as AgentSession, q as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, l as DeepPartial, j as DragRect, n as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, h as OverlayBounds, P as Position, c as ReactGrabState, k as Rect, e as RenderData, d as RenderType, m as SuccessLabelContext, S as SuccessLabelType, T as Theme, f as formatElementInfo, b as generateSnippet, a as getNearestComponentName, g as getStack, i as init } from './core-DeAAaVyA.cjs';
|
|
3
3
|
export { isInstrumentationActive } from 'bippy';
|
|
4
4
|
import 'bippy/source';
|
|
5
5
|
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
__REACT_GRAB__?: ReactGrabAPI;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
6
11
|
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
12
|
+
declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
|
|
7
13
|
|
|
8
|
-
export { ReactGrabAPI, getGlobalApi };
|
|
14
|
+
export { ReactGrabAPI, getGlobalApi, setGlobalApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { R as ReactGrabAPI } from './core-
|
|
2
|
-
export { D as DEFAULT_THEME, l as DeepPartial, j as DragRect, G as GrabbedBox, O as Options, h as OverlayBounds, P as Position, c as ReactGrabState, k as Rect, e as RenderData, d as RenderType, T as Theme, f as
|
|
1
|
+
import { R as ReactGrabAPI } from './core-DeAAaVyA.js';
|
|
2
|
+
export { A as AgentContext, r as AgentOptions, p as AgentProvider, o as AgentSession, q as AgentSessionStorage, C as CrosshairContext, D as DEFAULT_THEME, l as DeepPartial, j as DragRect, n as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, I as InputModeContext, O as Options, h as OverlayBounds, P as Position, c as ReactGrabState, k as Rect, e as RenderData, d as RenderType, m as SuccessLabelContext, S as SuccessLabelType, T as Theme, f as formatElementInfo, b as generateSnippet, a as getNearestComponentName, g as getStack, i as init } from './core-DeAAaVyA.js';
|
|
3
3
|
export { isInstrumentationActive } from 'bippy';
|
|
4
4
|
import 'bippy/source';
|
|
5
5
|
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
__REACT_GRAB__?: ReactGrabAPI;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
6
11
|
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
12
|
+
declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
|
|
7
13
|
|
|
8
|
-
export { ReactGrabAPI, getGlobalApi };
|
|
14
|
+
export { ReactGrabAPI, getGlobalApi, setGlobalApi };
|