react-grab 0.0.54 → 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 +0 -2
- package/dist/{chunk-QMP2IZ3H.cjs → chunk-EAIY6I5Y.cjs} +1776 -528
- package/dist/{chunk-D6EGQYIX.js → chunk-GQ7Z2X35.js} +1775 -527
- package/dist/{core-HkBjqOQQ.d.cts → core-DeAAaVyA.d.cts} +82 -19
- package/dist/{core-HkBjqOQQ.d.ts → core-DeAAaVyA.d.ts} +82 -19
- 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,60 @@ 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
235
|
copyFileOnly?: boolean;
|
|
190
|
-
log?: boolean;
|
|
191
236
|
theme?: Theme;
|
|
237
|
+
activationShortcut?: (event: KeyboardEvent) => boolean;
|
|
238
|
+
activationKey?: ActivationKey;
|
|
192
239
|
onActivate?: () => void;
|
|
193
240
|
onDeactivate?: () => void;
|
|
194
241
|
onElementHover?: (element: Element) => void;
|
|
@@ -208,6 +255,8 @@ interface Options {
|
|
|
208
255
|
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
209
256
|
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
210
257
|
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
258
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
259
|
+
agent?: AgentOptions;
|
|
211
260
|
}
|
|
212
261
|
interface ReactGrabAPI {
|
|
213
262
|
activate: () => void;
|
|
@@ -228,9 +277,24 @@ interface OverlayBounds {
|
|
|
228
277
|
x: number;
|
|
229
278
|
y: number;
|
|
230
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
|
+
}
|
|
231
289
|
interface ReactGrabRendererProps {
|
|
232
290
|
selectionVisible?: boolean;
|
|
233
291
|
selectionBounds?: OverlayBounds;
|
|
292
|
+
selectionFilePath?: string;
|
|
293
|
+
selectionLineNumber?: number;
|
|
294
|
+
selectionTagName?: string;
|
|
295
|
+
selectionLabelVisible?: boolean;
|
|
296
|
+
selectionLabelStatus?: SelectionLabelStatus;
|
|
297
|
+
labelInstances?: SelectionLabelInstance[];
|
|
234
298
|
dragVisible?: boolean;
|
|
235
299
|
dragBounds?: OverlayBounds;
|
|
236
300
|
grabbedBoxes?: Array<{
|
|
@@ -238,29 +302,27 @@ interface ReactGrabRendererProps {
|
|
|
238
302
|
bounds: OverlayBounds;
|
|
239
303
|
createdAt: number;
|
|
240
304
|
}>;
|
|
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
305
|
labelZIndex?: number;
|
|
251
|
-
labelShowHint?: boolean;
|
|
252
|
-
progressVisible?: boolean;
|
|
253
|
-
progress?: number;
|
|
254
306
|
mouseX?: number;
|
|
255
307
|
mouseY?: number;
|
|
256
308
|
crosshairVisible?: boolean;
|
|
257
|
-
inputVisible?: boolean;
|
|
258
|
-
inputX?: number;
|
|
259
|
-
inputY?: number;
|
|
260
309
|
inputValue?: string;
|
|
310
|
+
isInputExpanded?: boolean;
|
|
311
|
+
hasAgent?: boolean;
|
|
312
|
+
agentSessions?: Map<string, AgentSession>;
|
|
313
|
+
onAbortSession?: (sessionId: string) => void;
|
|
261
314
|
onInputChange?: (value: string) => void;
|
|
262
315
|
onInputSubmit?: () => void;
|
|
263
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;
|
|
264
326
|
theme?: Required<Theme>;
|
|
265
327
|
}
|
|
266
328
|
interface GrabbedBox {
|
|
@@ -292,12 +354,13 @@ interface StackFrame {
|
|
|
292
354
|
source: FiberSource | null;
|
|
293
355
|
}
|
|
294
356
|
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
295
|
-
declare const
|
|
357
|
+
declare const formatElementInfo: (element: Element) => Promise<string>;
|
|
296
358
|
declare const getFileName: (stack: Array<StackFrame>) => string | null;
|
|
297
|
-
declare const getHTMLPreview: (element: Element) => string;
|
|
298
359
|
|
|
299
360
|
declare const DEFAULT_THEME: Required<Theme>;
|
|
300
361
|
|
|
362
|
+
declare const generateSnippet: (elements: Element[]) => Promise<string>;
|
|
363
|
+
|
|
301
364
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
302
365
|
|
|
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,
|
|
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 };
|
|
@@ -182,13 +182,60 @@ 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
235
|
copyFileOnly?: boolean;
|
|
190
|
-
log?: boolean;
|
|
191
236
|
theme?: Theme;
|
|
237
|
+
activationShortcut?: (event: KeyboardEvent) => boolean;
|
|
238
|
+
activationKey?: ActivationKey;
|
|
192
239
|
onActivate?: () => void;
|
|
193
240
|
onDeactivate?: () => void;
|
|
194
241
|
onElementHover?: (element: Element) => void;
|
|
@@ -208,6 +255,8 @@ interface Options {
|
|
|
208
255
|
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void;
|
|
209
256
|
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void;
|
|
210
257
|
onCrosshair?: (visible: boolean, context: CrosshairContext) => void;
|
|
258
|
+
onOpenFile?: (filePath: string, lineNumber?: number) => void;
|
|
259
|
+
agent?: AgentOptions;
|
|
211
260
|
}
|
|
212
261
|
interface ReactGrabAPI {
|
|
213
262
|
activate: () => void;
|
|
@@ -228,9 +277,24 @@ interface OverlayBounds {
|
|
|
228
277
|
x: number;
|
|
229
278
|
y: number;
|
|
230
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
|
+
}
|
|
231
289
|
interface ReactGrabRendererProps {
|
|
232
290
|
selectionVisible?: boolean;
|
|
233
291
|
selectionBounds?: OverlayBounds;
|
|
292
|
+
selectionFilePath?: string;
|
|
293
|
+
selectionLineNumber?: number;
|
|
294
|
+
selectionTagName?: string;
|
|
295
|
+
selectionLabelVisible?: boolean;
|
|
296
|
+
selectionLabelStatus?: SelectionLabelStatus;
|
|
297
|
+
labelInstances?: SelectionLabelInstance[];
|
|
234
298
|
dragVisible?: boolean;
|
|
235
299
|
dragBounds?: OverlayBounds;
|
|
236
300
|
grabbedBoxes?: Array<{
|
|
@@ -238,29 +302,27 @@ interface ReactGrabRendererProps {
|
|
|
238
302
|
bounds: OverlayBounds;
|
|
239
303
|
createdAt: number;
|
|
240
304
|
}>;
|
|
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
305
|
labelZIndex?: number;
|
|
251
|
-
labelShowHint?: boolean;
|
|
252
|
-
progressVisible?: boolean;
|
|
253
|
-
progress?: number;
|
|
254
306
|
mouseX?: number;
|
|
255
307
|
mouseY?: number;
|
|
256
308
|
crosshairVisible?: boolean;
|
|
257
|
-
inputVisible?: boolean;
|
|
258
|
-
inputX?: number;
|
|
259
|
-
inputY?: number;
|
|
260
309
|
inputValue?: string;
|
|
310
|
+
isInputExpanded?: boolean;
|
|
311
|
+
hasAgent?: boolean;
|
|
312
|
+
agentSessions?: Map<string, AgentSession>;
|
|
313
|
+
onAbortSession?: (sessionId: string) => void;
|
|
261
314
|
onInputChange?: (value: string) => void;
|
|
262
315
|
onInputSubmit?: () => void;
|
|
263
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;
|
|
264
326
|
theme?: Required<Theme>;
|
|
265
327
|
}
|
|
266
328
|
interface GrabbedBox {
|
|
@@ -292,12 +354,13 @@ interface StackFrame {
|
|
|
292
354
|
source: FiberSource | null;
|
|
293
355
|
}
|
|
294
356
|
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
295
|
-
declare const
|
|
357
|
+
declare const formatElementInfo: (element: Element) => Promise<string>;
|
|
296
358
|
declare const getFileName: (stack: Array<StackFrame>) => string | null;
|
|
297
|
-
declare const getHTMLPreview: (element: Element) => string;
|
|
298
359
|
|
|
299
360
|
declare const DEFAULT_THEME: Required<Theme>;
|
|
300
361
|
|
|
362
|
+
declare const generateSnippet: (elements: Element[]) => Promise<string>;
|
|
363
|
+
|
|
301
364
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
302
365
|
|
|
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,
|
|
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,38 +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
18
|
});
|
|
19
|
-
Object.defineProperty(exports, "
|
|
19
|
+
Object.defineProperty(exports, "getFileName", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkEAIY6I5Y_cjs.getFileName; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkEAIY6I5Y_cjs.getNearestComponentName; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getStack", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkEAIY6I5Y_cjs.getStack; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "init", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkEAIY6I5Y_cjs.init; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkEAIY6I5Y_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-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,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 = chunkEAIY6I5Y_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 chunkEAIY6I5Y_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 chunkEAIY6I5Y_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 chunkEAIY6I5Y_cjs.generateSnippet; }
|
|
42
52
|
});
|
|
43
53
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
44
54
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkEAIY6I5Y_cjs.getNearestComponentName; }
|
|
46
56
|
});
|
|
47
57
|
Object.defineProperty(exports, "getStack", {
|
|
48
58
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkEAIY6I5Y_cjs.getStack; }
|
|
50
60
|
});
|
|
51
61
|
Object.defineProperty(exports, "init", {
|
|
52
62
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkEAIY6I5Y_cjs.init; }
|
|
54
64
|
});
|
|
55
65
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
56
66
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkEAIY6I5Y_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-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
|
|
|
@@ -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-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
|
|
|
@@ -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 };
|