react-grab 0.0.54 → 0.0.56
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 +0 -2
- package/dist/{chunk-QMP2IZ3H.cjs → chunk-FXFNCH4T.cjs} +1750 -653
- package/dist/{chunk-D6EGQYIX.js → chunk-YLB7TBSB.js} +1749 -652
- package/dist/{core-HkBjqOQQ.d.cts → core-B9k7XYK9.d.cts} +82 -20
- package/dist/{core-HkBjqOQQ.d.ts → core-B9k7XYK9.d.ts} +82 -20
- package/dist/core.cjs +12 -12
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +23 -12
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.global.js +26 -32
- package/dist/index.js +14 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -182,13 +182,59 @@ interface RenderData {
|
|
|
182
182
|
ref: HTMLElement | undefined;
|
|
183
183
|
props: Record<string, unknown>;
|
|
184
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
|
+
}
|
|
185
231
|
interface Options {
|
|
186
232
|
enabled?: boolean;
|
|
187
233
|
keyHoldDuration?: number;
|
|
188
234
|
allowActivationInsideInput?: boolean;
|
|
189
|
-
copyFileOnly?: boolean;
|
|
190
|
-
log?: boolean;
|
|
191
235
|
theme?: Theme;
|
|
236
|
+
activationShortcut?: (event: KeyboardEvent) => boolean;
|
|
237
|
+
activationKey?: ActivationKey;
|
|
192
238
|
onActivate?: () => void;
|
|
193
239
|
onDeactivate?: () => void;
|
|
194
240
|
onElementHover?: (element: Element) => void;
|
|
@@ -208,6 +254,8 @@ interface Options {
|
|
|
208
254
|
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
209
255
|
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
210
256
|
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
257
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
258
|
+
agent?: AgentOptions;
|
|
211
259
|
}
|
|
212
260
|
interface ReactGrabAPI {
|
|
213
261
|
activate: () => void;
|
|
@@ -228,9 +276,24 @@ interface OverlayBounds {
|
|
|
228
276
|
x: number;
|
|
229
277
|
y: number;
|
|
230
278
|
}
|
|
279
|
+
type SelectionLabelStatus = "idle" | "copying" | "copied" | "fading";
|
|
280
|
+
interface SelectionLabelInstance {
|
|
281
|
+
id: string;
|
|
282
|
+
bounds: OverlayBounds;
|
|
283
|
+
tagName: string;
|
|
284
|
+
status: SelectionLabelStatus;
|
|
285
|
+
createdAt: number;
|
|
286
|
+
element?: Element;
|
|
287
|
+
}
|
|
231
288
|
interface ReactGrabRendererProps {
|
|
232
289
|
selectionVisible?: boolean;
|
|
233
290
|
selectionBounds?: OverlayBounds;
|
|
291
|
+
selectionFilePath?: string;
|
|
292
|
+
selectionLineNumber?: number;
|
|
293
|
+
selectionTagName?: string;
|
|
294
|
+
selectionLabelVisible?: boolean;
|
|
295
|
+
selectionLabelStatus?: SelectionLabelStatus;
|
|
296
|
+
labelInstances?: SelectionLabelInstance[];
|
|
234
297
|
dragVisible?: boolean;
|
|
235
298
|
dragBounds?: OverlayBounds;
|
|
236
299
|
grabbedBoxes?: Array<{
|
|
@@ -238,29 +301,27 @@ interface ReactGrabRendererProps {
|
|
|
238
301
|
bounds: OverlayBounds;
|
|
239
302
|
createdAt: number;
|
|
240
303
|
}>;
|
|
241
|
-
successLabels?: Array<{
|
|
242
|
-
id: string;
|
|
243
|
-
text: string;
|
|
244
|
-
}>;
|
|
245
|
-
labelVariant?: "hover" | "processing" | "success";
|
|
246
|
-
labelContent?: unknown;
|
|
247
|
-
labelX?: number;
|
|
248
|
-
labelY?: number;
|
|
249
|
-
labelVisible?: boolean;
|
|
250
304
|
labelZIndex?: number;
|
|
251
|
-
labelShowHint?: boolean;
|
|
252
|
-
progressVisible?: boolean;
|
|
253
|
-
progress?: number;
|
|
254
305
|
mouseX?: number;
|
|
255
306
|
mouseY?: number;
|
|
256
307
|
crosshairVisible?: boolean;
|
|
257
|
-
inputVisible?: boolean;
|
|
258
|
-
inputX?: number;
|
|
259
|
-
inputY?: number;
|
|
260
308
|
inputValue?: string;
|
|
309
|
+
isInputExpanded?: boolean;
|
|
310
|
+
hasAgent?: boolean;
|
|
311
|
+
agentSessions?: Map<string, AgentSession>;
|
|
312
|
+
onAbortSession?: (sessionId: string) => void;
|
|
261
313
|
onInputChange?: (value: string) => void;
|
|
262
314
|
onInputSubmit?: () => void;
|
|
263
315
|
onInputCancel?: () => void;
|
|
316
|
+
onToggleExpand?: () => void;
|
|
317
|
+
nativeSelectionCursorVisible?: boolean;
|
|
318
|
+
nativeSelectionCursorX?: number;
|
|
319
|
+
nativeSelectionCursorY?: number;
|
|
320
|
+
nativeSelectionTagName?: string;
|
|
321
|
+
nativeSelectionComponentName?: string;
|
|
322
|
+
nativeSelectionBounds?: OverlayBounds;
|
|
323
|
+
onNativeSelectionCopy?: () => void;
|
|
324
|
+
onNativeSelectionEnter?: () => void;
|
|
264
325
|
theme?: Required<Theme>;
|
|
265
326
|
}
|
|
266
327
|
interface GrabbedBox {
|
|
@@ -292,12 +353,13 @@ interface StackFrame {
|
|
|
292
353
|
source: FiberSource | null;
|
|
293
354
|
}
|
|
294
355
|
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
295
|
-
declare const
|
|
356
|
+
declare const formatElementInfo: (element: Element) => Promise<string>;
|
|
296
357
|
declare const getFileName: (stack: Array<StackFrame>) => string | null;
|
|
297
|
-
declare const getHTMLPreview: (element: Element) => string;
|
|
298
358
|
|
|
299
359
|
declare const DEFAULT_THEME: Required<Theme>;
|
|
300
360
|
|
|
361
|
+
declare const generateSnippet: (elements: Element[]) => Promise<string>;
|
|
362
|
+
|
|
301
363
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
302
364
|
|
|
303
|
-
export { 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,
|
|
365
|
+
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 };
|
|
@@ -182,13 +182,59 @@ interface RenderData {
|
|
|
182
182
|
ref: HTMLElement | undefined;
|
|
183
183
|
props: Record<string, unknown>;
|
|
184
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
|
+
}
|
|
185
231
|
interface Options {
|
|
186
232
|
enabled?: boolean;
|
|
187
233
|
keyHoldDuration?: number;
|
|
188
234
|
allowActivationInsideInput?: boolean;
|
|
189
|
-
copyFileOnly?: boolean;
|
|
190
|
-
log?: boolean;
|
|
191
235
|
theme?: Theme;
|
|
236
|
+
activationShortcut?: (event: KeyboardEvent) => boolean;
|
|
237
|
+
activationKey?: ActivationKey;
|
|
192
238
|
onActivate?: () => void;
|
|
193
239
|
onDeactivate?: () => void;
|
|
194
240
|
onElementHover?: (element: Element) => void;
|
|
@@ -208,6 +254,8 @@ interface Options {
|
|
|
208
254
|
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
209
255
|
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
210
256
|
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
257
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
258
|
+
agent?: AgentOptions;
|
|
211
259
|
}
|
|
212
260
|
interface ReactGrabAPI {
|
|
213
261
|
activate: () => void;
|
|
@@ -228,9 +276,24 @@ interface OverlayBounds {
|
|
|
228
276
|
x: number;
|
|
229
277
|
y: number;
|
|
230
278
|
}
|
|
279
|
+
type SelectionLabelStatus = "idle" | "copying" | "copied" | "fading";
|
|
280
|
+
interface SelectionLabelInstance {
|
|
281
|
+
id: string;
|
|
282
|
+
bounds: OverlayBounds;
|
|
283
|
+
tagName: string;
|
|
284
|
+
status: SelectionLabelStatus;
|
|
285
|
+
createdAt: number;
|
|
286
|
+
element?: Element;
|
|
287
|
+
}
|
|
231
288
|
interface ReactGrabRendererProps {
|
|
232
289
|
selectionVisible?: boolean;
|
|
233
290
|
selectionBounds?: OverlayBounds;
|
|
291
|
+
selectionFilePath?: string;
|
|
292
|
+
selectionLineNumber?: number;
|
|
293
|
+
selectionTagName?: string;
|
|
294
|
+
selectionLabelVisible?: boolean;
|
|
295
|
+
selectionLabelStatus?: SelectionLabelStatus;
|
|
296
|
+
labelInstances?: SelectionLabelInstance[];
|
|
234
297
|
dragVisible?: boolean;
|
|
235
298
|
dragBounds?: OverlayBounds;
|
|
236
299
|
grabbedBoxes?: Array<{
|
|
@@ -238,29 +301,27 @@ interface ReactGrabRendererProps {
|
|
|
238
301
|
bounds: OverlayBounds;
|
|
239
302
|
createdAt: number;
|
|
240
303
|
}>;
|
|
241
|
-
successLabels?: Array<{
|
|
242
|
-
id: string;
|
|
243
|
-
text: string;
|
|
244
|
-
}>;
|
|
245
|
-
labelVariant?: "hover" | "processing" | "success";
|
|
246
|
-
labelContent?: unknown;
|
|
247
|
-
labelX?: number;
|
|
248
|
-
labelY?: number;
|
|
249
|
-
labelVisible?: boolean;
|
|
250
304
|
labelZIndex?: number;
|
|
251
|
-
labelShowHint?: boolean;
|
|
252
|
-
progressVisible?: boolean;
|
|
253
|
-
progress?: number;
|
|
254
305
|
mouseX?: number;
|
|
255
306
|
mouseY?: number;
|
|
256
307
|
crosshairVisible?: boolean;
|
|
257
|
-
inputVisible?: boolean;
|
|
258
|
-
inputX?: number;
|
|
259
|
-
inputY?: number;
|
|
260
308
|
inputValue?: string;
|
|
309
|
+
isInputExpanded?: boolean;
|
|
310
|
+
hasAgent?: boolean;
|
|
311
|
+
agentSessions?: Map<string, AgentSession>;
|
|
312
|
+
onAbortSession?: (sessionId: string) => void;
|
|
261
313
|
onInputChange?: (value: string) => void;
|
|
262
314
|
onInputSubmit?: () => void;
|
|
263
315
|
onInputCancel?: () => void;
|
|
316
|
+
onToggleExpand?: () => void;
|
|
317
|
+
nativeSelectionCursorVisible?: boolean;
|
|
318
|
+
nativeSelectionCursorX?: number;
|
|
319
|
+
nativeSelectionCursorY?: number;
|
|
320
|
+
nativeSelectionTagName?: string;
|
|
321
|
+
nativeSelectionComponentName?: string;
|
|
322
|
+
nativeSelectionBounds?: OverlayBounds;
|
|
323
|
+
onNativeSelectionCopy?: () => void;
|
|
324
|
+
onNativeSelectionEnter?: () => void;
|
|
264
325
|
theme?: Required<Theme>;
|
|
265
326
|
}
|
|
266
327
|
interface GrabbedBox {
|
|
@@ -292,12 +353,13 @@ interface StackFrame {
|
|
|
292
353
|
source: FiberSource | null;
|
|
293
354
|
}
|
|
294
355
|
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
295
|
-
declare const
|
|
356
|
+
declare const formatElementInfo: (element: Element) => Promise<string>;
|
|
296
357
|
declare const getFileName: (stack: Array<StackFrame>) => string | null;
|
|
297
|
-
declare const getHTMLPreview: (element: Element) => string;
|
|
298
358
|
|
|
299
359
|
declare const DEFAULT_THEME: Required<Theme>;
|
|
300
360
|
|
|
361
|
+
declare const generateSnippet: (elements: Element[]) => Promise<string>;
|
|
362
|
+
|
|
301
363
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
302
364
|
|
|
303
|
-
export { 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,
|
|
365
|
+
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,38 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFXFNCH4T_cjs = require('./chunk-FXFNCH4T.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 chunkFXFNCH4T_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 chunkFXFNCH4T_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 chunkFXFNCH4T_cjs.generateSnippet; }
|
|
18
18
|
});
|
|
19
|
-
Object.defineProperty(exports, "
|
|
19
|
+
Object.defineProperty(exports, "getFileName", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkFXFNCH4T_cjs.getFileName; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkFXFNCH4T_cjs.getNearestComponentName; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getStack", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkFXFNCH4T_cjs.getStack; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "init", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkFXFNCH4T_cjs.init; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkFXFNCH4T_cjs.Ee; }
|
|
38
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-B9k7XYK9.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-B9k7XYK9.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-YLB7TBSB.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFXFNCH4T_cjs = require('./chunk-FXFNCH4T.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @license MIT
|
|
@@ -14,13 +14,23 @@ var chunkQMP2IZ3H_cjs = require('./chunk-QMP2IZ3H.cjs');
|
|
|
14
14
|
// src/index.ts
|
|
15
15
|
var globalApi = null;
|
|
16
16
|
var getGlobalApi = () => {
|
|
17
|
-
return
|
|
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__) {
|
|
21
31
|
globalApi = window.__REACT_GRAB__;
|
|
22
32
|
} else {
|
|
23
|
-
globalApi =
|
|
33
|
+
globalApi = chunkFXFNCH4T_cjs.init();
|
|
24
34
|
window.__REACT_GRAB__ = globalApi;
|
|
25
35
|
window.dispatchEvent(
|
|
26
36
|
new CustomEvent("react-grab:init", { detail: globalApi })
|
|
@@ -30,30 +40,31 @@ if (typeof window !== "undefined") {
|
|
|
30
40
|
|
|
31
41
|
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
32
42
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkFXFNCH4T_cjs.DEFAULT_THEME; }
|
|
34
44
|
});
|
|
35
|
-
Object.defineProperty(exports, "
|
|
45
|
+
Object.defineProperty(exports, "formatElementInfo", {
|
|
36
46
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkFXFNCH4T_cjs.formatElementInfo; }
|
|
38
48
|
});
|
|
39
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "generateSnippet", {
|
|
40
50
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkFXFNCH4T_cjs.generateSnippet; }
|
|
42
52
|
});
|
|
43
53
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
44
54
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkFXFNCH4T_cjs.getNearestComponentName; }
|
|
46
56
|
});
|
|
47
57
|
Object.defineProperty(exports, "getStack", {
|
|
48
58
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkFXFNCH4T_cjs.getStack; }
|
|
50
60
|
});
|
|
51
61
|
Object.defineProperty(exports, "init", {
|
|
52
62
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkFXFNCH4T_cjs.init; }
|
|
54
64
|
});
|
|
55
65
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
56
66
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkFXFNCH4T_cjs.Ee; }
|
|
58
68
|
});
|
|
59
69
|
exports.getGlobalApi = getGlobalApi;
|
|
70
|
+
exports.setGlobalApi = setGlobalApi;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReactGrabAPI } from './core-
|
|
2
|
-
export { 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
|
|
1
|
+
import { R as ReactGrabAPI } from './core-B9k7XYK9.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-B9k7XYK9.cjs';
|
|
3
3
|
export { isInstrumentationActive } from 'bippy';
|
|
4
4
|
import 'bippy/source';
|
|
5
5
|
|
|
@@ -9,5 +9,6 @@ declare global {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
12
|
+
declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
|
|
12
13
|
|
|
13
|
-
export { ReactGrabAPI, getGlobalApi };
|
|
14
|
+
export { ReactGrabAPI, getGlobalApi, setGlobalApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReactGrabAPI } from './core-
|
|
2
|
-
export { 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
|
|
1
|
+
import { R as ReactGrabAPI } from './core-B9k7XYK9.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-B9k7XYK9.js';
|
|
3
3
|
export { isInstrumentationActive } from 'bippy';
|
|
4
4
|
import 'bippy/source';
|
|
5
5
|
|
|
@@ -9,5 +9,6 @@ declare global {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
12
|
+
declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
|
|
12
13
|
|
|
13
|
-
export { ReactGrabAPI, getGlobalApi };
|
|
14
|
+
export { ReactGrabAPI, getGlobalApi, setGlobalApi };
|