react-grab 0.1.48-dev.a036acc → 0.1.48-dev.a79f03c
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 +16 -59
- package/dist/{copy-content-BPB8MmpL.d.cts → copy-content-BIrPD_Au.d.ts} +66 -34
- package/dist/{copy-content-C7lFyXsY.d.ts → copy-content-CNT7qnjJ.d.cts} +66 -34
- 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-BkdQ4ajU.js +14 -0
- package/dist/core-DBJClC5s.cjs +14 -0
- package/dist/errors-BEgowzRA.d.ts +29 -0
- package/dist/errors-CTlIFDQs.d.cts +29 -0
- package/dist/execute-context-menu-action-VZDp2sg2.js +9 -0
- package/dist/execute-context-menu-action-e5Ce_Vma.cjs +9 -0
- package/dist/freeze-updates-BdM-c_Ko.js +43 -0
- package/dist/freeze-updates-CTawzP3e.cjs +43 -0
- package/dist/{index-DMyJsiaz.d.cts → index-BfkbSQSc.d.cts} +1 -1
- package/dist/{index-VkohC_Hw.d.ts → index-OIK6lIEj.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.global.js +21 -19
- package/dist/index.js +1 -1
- package/dist/open-file-UOXq4lSp.js +29 -0
- package/dist/open-file-nyBpDPAl.cjs +20 -0
- package/dist/primitives.cjs +2 -2
- package/dist/primitives.d.cts +41 -2
- package/dist/primitives.d.ts +41 -2
- package/dist/primitives.js +2 -2
- package/dist/renderer-DjDacx32.js +9 -0
- package/dist/renderer-Nm_-BTEP.cjs +9 -0
- package/dist/styles.css +1 -1
- package/package.json +11 -5
- package/dist/copy-content-HtjEd7D4.js +0 -10
- package/dist/copy-content-i_57jcU1.cjs +0 -10
- package/dist/core-Cs4nKfRj.cjs +0 -14
- package/dist/core-DtDBp7P-.js +0 -14
- package/dist/create-pointer-move-prompt-handoff-D4JZbeiE.cjs +0 -9
- package/dist/create-pointer-move-prompt-handoff-DRZp7pT5.js +0 -9
- package/dist/freeze-updates-2TTw39qB.js +0 -51
- package/dist/freeze-updates-m7dy-Od3.cjs +0 -51
- package/dist/renderer-D07SadMO.cjs +0 -9
- package/dist/renderer-DhsYpO42.js +0 -9
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Copy any UI element for your agent.
|
|
7
7
|
|
|
8
|
-
React Grab points agents to the actual source behind each selection. Agents are [**2× faster**](https://
|
|
8
|
+
React Grab points agents to the actual source behind each selection. Agents are [**2× faster**](https://react-grab.com/benchmarks) and more accurate when using React Grab.
|
|
9
9
|
|
|
10
10
|
[**Website →**](https://react-grab.com)
|
|
11
11
|
|
|
@@ -114,72 +114,29 @@ if (process.env.NODE_ENV === "development") {
|
|
|
114
114
|
}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
##
|
|
117
|
+
## Build your own React Grab
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
Build a custom interface with the selection engine from `react-grab/primitives`. Use its APIs for hit testing, source context, page freezing, clipboard access, and editor navigation.
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
### Customize hit testing
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
import { registerPlugin } from "react-grab";
|
|
123
|
+
Scope hit testing to a container or replace the default element filter with your own rules.
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
hooks: {
|
|
129
|
-
onElementSelect: (element) => {
|
|
130
|
-
console.log("Selected:", element.tagName);
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
If writing in React, register inside a `useEffect`:
|
|
125
|
+
```typescript
|
|
126
|
+
import { getElementAtPoint, isElementGrabbable } from "react-grab/primitives";
|
|
137
127
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
id: "my-action",
|
|
147
|
-
label: "My Action",
|
|
148
|
-
shortcut: "M",
|
|
149
|
-
onAction: (context) => {
|
|
150
|
-
console.log("Action on:", context.element);
|
|
151
|
-
context.hideContextMenu();
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
],
|
|
128
|
+
export const getPickerTarget = (
|
|
129
|
+
event: PointerEvent,
|
|
130
|
+
appElement: Element,
|
|
131
|
+
toolbarElement: Element,
|
|
132
|
+
): Element | null =>
|
|
133
|
+
getElementAtPoint(event.clientX, event.clientY, {
|
|
134
|
+
container: appElement,
|
|
135
|
+
filter: (candidate) => isElementGrabbable(candidate) && !toolbarElement.contains(candidate),
|
|
155
136
|
});
|
|
156
|
-
|
|
157
|
-
return () => unregisterPlugin("my-plugin");
|
|
158
|
-
}, []);
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Actions use a `target` field to control where they appear. Omit `target` (or set `"context-menu"`) for the right-click menu, or set `"toolbar"` for the toolbar dropdown:
|
|
162
|
-
|
|
163
|
-
```js
|
|
164
|
-
actions: [
|
|
165
|
-
{
|
|
166
|
-
id: "inspect",
|
|
167
|
-
label: "Inspect",
|
|
168
|
-
shortcut: "I",
|
|
169
|
-
onAction: (ctx) => console.dir(ctx.element),
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
id: "toggle-freeze",
|
|
173
|
-
label: "Freeze",
|
|
174
|
-
// Only show in the toolbar
|
|
175
|
-
target: "toolbar",
|
|
176
|
-
isActive: () => isFrozen,
|
|
177
|
-
onAction: () => toggleFreeze(),
|
|
178
|
-
},
|
|
179
|
-
];
|
|
180
137
|
```
|
|
181
138
|
|
|
182
|
-
|
|
139
|
+
Add `data-react-grab-ignore` to your picker interface so hit testing skips its subtree.
|
|
183
140
|
|
|
184
141
|
## Resources & Contributing Back
|
|
185
142
|
|
|
@@ -6,6 +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 { ReactNode } from "react";
|
|
10
|
+
|
|
9
11
|
//#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/reactive/observable.d.ts
|
|
10
12
|
declare global {
|
|
11
13
|
interface SymbolConstructor {
|
|
@@ -23,6 +25,17 @@ interface Position {
|
|
|
23
25
|
x: number;
|
|
24
26
|
y: number;
|
|
25
27
|
}
|
|
28
|
+
interface ElementAtPointOptions {
|
|
29
|
+
container?: Element;
|
|
30
|
+
filter?: (element: Element) => boolean;
|
|
31
|
+
}
|
|
32
|
+
interface ElementBounds {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
borderRadius: string;
|
|
38
|
+
}
|
|
26
39
|
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? T[P] extends ((...args: unknown[]) => unknown) ? T[P] : DeepPartial<T[P]> : T[P] };
|
|
27
40
|
interface Theme {
|
|
28
41
|
/**
|
|
@@ -138,11 +151,13 @@ interface AgentContext<T = unknown> {
|
|
|
138
151
|
sessionId?: string;
|
|
139
152
|
}
|
|
140
153
|
type ActivationMode = "toggle" | "hold";
|
|
141
|
-
interface
|
|
142
|
-
transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
|
|
154
|
+
interface OpenFileActionHooks {
|
|
143
155
|
onOpenFile: (filePath: string, lineNumber?: number) => boolean | void;
|
|
144
156
|
transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string;
|
|
145
157
|
}
|
|
158
|
+
interface ActionContextHooks extends OpenFileActionHooks {
|
|
159
|
+
transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
|
|
160
|
+
}
|
|
146
161
|
interface ActionContext {
|
|
147
162
|
element: Element;
|
|
148
163
|
elements: Element[];
|
|
@@ -258,24 +273,24 @@ interface HierarchyState {
|
|
|
258
273
|
activeIndex: number;
|
|
259
274
|
}
|
|
260
275
|
interface PluginHooks {
|
|
261
|
-
onActivate?: () => void
|
|
262
|
-
onDeactivate?: () => void
|
|
263
|
-
onElementHover?: (element: Element) => void
|
|
276
|
+
onActivate?: () => void | Promise<void>;
|
|
277
|
+
onDeactivate?: () => void | Promise<void>;
|
|
278
|
+
onElementHover?: (element: Element) => void | Promise<void>;
|
|
264
279
|
onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
|
|
265
|
-
onDragStart?: (startX: number, startY: number) => void
|
|
266
|
-
onDragEnd?: (elements: Element[], bounds: DragRect) => void
|
|
280
|
+
onDragStart?: (startX: number, startY: number) => void | Promise<void>;
|
|
281
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void | Promise<void>;
|
|
267
282
|
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
268
283
|
transformCopyContent?: (content: string, elements: Element[]) => string | Promise<string>;
|
|
269
|
-
onAfterCopy?: (elements: Element[], success: boolean) => void
|
|
270
|
-
onCopySuccess?: (elements: Element[], content: string) => void
|
|
271
|
-
onCopyError?: (error: Error) => void
|
|
272
|
-
onStateChange?: (state: ReactGrabState) => void
|
|
273
|
-
onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void
|
|
274
|
-
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void
|
|
275
|
-
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void
|
|
276
|
-
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void
|
|
277
|
-
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void
|
|
278
|
-
onContextMenu?: (element: Element, position: Position) => void
|
|
284
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void | Promise<void>;
|
|
285
|
+
onCopySuccess?: (elements: Element[], content: string) => void | Promise<void>;
|
|
286
|
+
onCopyError?: (error: Error) => void | Promise<void>;
|
|
287
|
+
onStateChange?: (state: ReactGrabState) => void | Promise<void>;
|
|
288
|
+
onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void | Promise<void>;
|
|
289
|
+
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void | Promise<void>;
|
|
290
|
+
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void | Promise<void>;
|
|
291
|
+
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void | Promise<void>;
|
|
292
|
+
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void | Promise<void>;
|
|
293
|
+
onContextMenu?: (element: Element, position: Position) => void | Promise<void>;
|
|
279
294
|
onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
|
|
280
295
|
transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
|
|
281
296
|
transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
|
|
@@ -287,7 +302,7 @@ interface PluginConfig {
|
|
|
287
302
|
options?: SettableOptions;
|
|
288
303
|
actions?: ContextMenuAction[];
|
|
289
304
|
hooks?: PluginHooks;
|
|
290
|
-
cleanup?: () =>
|
|
305
|
+
cleanup?: () => undefined;
|
|
291
306
|
}
|
|
292
307
|
interface Plugin {
|
|
293
308
|
name: string;
|
|
@@ -341,6 +356,7 @@ interface SettableOptions extends Options {
|
|
|
341
356
|
interface SourceInfo {
|
|
342
357
|
filePath: string;
|
|
343
358
|
lineNumber: number | null;
|
|
359
|
+
columnNumber: number | null;
|
|
344
360
|
componentName: string | null;
|
|
345
361
|
}
|
|
346
362
|
interface SelectedElementPayload {
|
|
@@ -430,13 +446,19 @@ interface FrozenLabelEntry {
|
|
|
430
446
|
bounds: OverlayBounds;
|
|
431
447
|
mouseX?: number;
|
|
432
448
|
}
|
|
449
|
+
interface FrozenLabelEntryAccessor {
|
|
450
|
+
read: () => FrozenLabelEntry | null;
|
|
451
|
+
}
|
|
452
|
+
interface SelectionLabelInstanceAccessor {
|
|
453
|
+
read: () => SelectionLabelInstance | null;
|
|
454
|
+
}
|
|
433
455
|
interface ReactGrabRendererProps {
|
|
434
456
|
selectionVisible?: boolean;
|
|
435
457
|
selectionBounds?: OverlayBounds;
|
|
436
458
|
selectionBoundsMultiple?: OverlayBounds[];
|
|
437
459
|
selectionShouldSnap?: boolean;
|
|
438
460
|
selectionElementsCount?: number;
|
|
439
|
-
|
|
461
|
+
frozenLabelEntryAccessors?: FrozenLabelEntryAccessor[];
|
|
440
462
|
pendingShiftPreviewEntry?: FrozenLabelEntry;
|
|
441
463
|
selectionFilePath?: string;
|
|
442
464
|
selectionLineNumber?: number;
|
|
@@ -447,6 +469,7 @@ interface ReactGrabRendererProps {
|
|
|
447
469
|
hierarchyState?: HierarchyState;
|
|
448
470
|
hierarchyMenuPosition?: DropdownAnchor | null;
|
|
449
471
|
labelInstances?: SelectionLabelInstance[];
|
|
472
|
+
labelInstanceAccessors?: SelectionLabelInstanceAccessor[];
|
|
450
473
|
dragVisible?: boolean;
|
|
451
474
|
dragBounds?: OverlayBounds;
|
|
452
475
|
grabbedBoxes?: Array<{
|
|
@@ -467,6 +490,7 @@ interface ReactGrabRendererProps {
|
|
|
467
490
|
onToggleExpand?: () => void;
|
|
468
491
|
selectionLabelShakeCount?: number;
|
|
469
492
|
onConfirmDismiss?: () => void;
|
|
493
|
+
onOpenSelectionFile?: () => void;
|
|
470
494
|
discardPrompt?: SelectionDiscardPrompt;
|
|
471
495
|
toolbarVisible?: boolean;
|
|
472
496
|
isActive?: boolean;
|
|
@@ -548,7 +572,7 @@ interface ReactGrabEntry {
|
|
|
548
572
|
frames?: ReactGrabStackFrame[];
|
|
549
573
|
}
|
|
550
574
|
//#endregion
|
|
551
|
-
//#region ../../node_modules/.pnpm/bippy@0.
|
|
575
|
+
//#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/unsubscribe.d.ts
|
|
552
576
|
type Flags = number;
|
|
553
577
|
type Lanes = number;
|
|
554
578
|
type TypeOfMode = number;
|
|
@@ -638,6 +662,14 @@ interface Effect {
|
|
|
638
662
|
interface Family {
|
|
639
663
|
current: unknown;
|
|
640
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* React 19 flight metadata for a server component owner (ReactComponentInfo).
|
|
667
|
+
* Unlike client owners it has no `tag`; the owner chain continues via `owner`.
|
|
668
|
+
*/
|
|
669
|
+
interface RendererRefreshUpdate {
|
|
670
|
+
staleFamilies: Set<Family>;
|
|
671
|
+
updatedFamilies: Set<Family>;
|
|
672
|
+
}
|
|
641
673
|
/**
|
|
642
674
|
* Represents a react-internal Fiber node.
|
|
643
675
|
*/
|
|
@@ -688,6 +720,7 @@ interface ReactDevToolsGlobalHook {
|
|
|
688
720
|
onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void;
|
|
689
721
|
onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
|
|
690
722
|
onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
|
|
723
|
+
onScheduleFiberRoot?: (rendererID: number, root: FiberRoot, children: ReactNode) => void;
|
|
691
724
|
renderers: Map<number, ReactRenderer>;
|
|
692
725
|
supportsFiber: boolean;
|
|
693
726
|
supportsFlight: boolean;
|
|
@@ -706,10 +739,7 @@ interface ReactRenderer {
|
|
|
706
739
|
overridePropsRenamePath?: (fiber: Fiber, oldPath: Array<number | string>, newPath: Array<number | string>) => void;
|
|
707
740
|
reconcilerVersion: string;
|
|
708
741
|
rendererPackageName: string;
|
|
709
|
-
scheduleRefresh?: (root: FiberRoot, update:
|
|
710
|
-
staleFamilies: Set<Family>;
|
|
711
|
-
updatedFamilies: Set<Family>;
|
|
712
|
-
}) => void;
|
|
742
|
+
scheduleRefresh?: (root: FiberRoot, update: RendererRefreshUpdate) => void;
|
|
713
743
|
scheduleRoot?: (root: FiberRoot, element: React.ReactNode) => void;
|
|
714
744
|
scheduleUpdate?: (fiber: Fiber) => void;
|
|
715
745
|
setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void;
|
|
@@ -720,28 +750,30 @@ interface ReactRenderer {
|
|
|
720
750
|
declare global {
|
|
721
751
|
var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;
|
|
722
752
|
} //#endregion
|
|
723
|
-
//#region src/
|
|
724
|
-
/**
|
|
725
|
-
* Returns `true` if bippy's instrumentation is active.
|
|
726
|
-
*/
|
|
727
|
-
declare const isInstrumentationActive: () => boolean;
|
|
728
|
-
/**
|
|
729
|
-
* Returns the latest fiber (since it may be double-buffered).
|
|
730
|
-
*/
|
|
753
|
+
//#region src/unsubscribe.d.ts
|
|
731
754
|
//#endregion
|
|
732
|
-
//#region ../../node_modules/.pnpm/bippy@0.
|
|
755
|
+
//#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/source.d.ts
|
|
733
756
|
//#region src/source/parse-stack.d.ts
|
|
734
757
|
interface StackFrame {
|
|
735
758
|
args?: unknown[];
|
|
736
759
|
columnNumber?: number;
|
|
737
760
|
lineNumber?: number;
|
|
761
|
+
enclosingLineNumber?: number;
|
|
762
|
+
enclosingColumnNumber?: number;
|
|
738
763
|
fileName?: string;
|
|
739
764
|
functionName?: string;
|
|
740
765
|
source?: string;
|
|
741
766
|
isServer?: boolean;
|
|
742
767
|
isSymbolicated?: boolean;
|
|
768
|
+
isIgnoreListed?: boolean;
|
|
743
769
|
}
|
|
744
770
|
//#endregion
|
|
771
|
+
//#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/core.d.ts
|
|
772
|
+
/**
|
|
773
|
+
* Returns `true` if bippy's instrumentation is active.
|
|
774
|
+
*/
|
|
775
|
+
declare const isInstrumentationActive: () => boolean;
|
|
776
|
+
//#endregion
|
|
745
777
|
//#region src/utils/copy-content.d.ts
|
|
746
778
|
interface CopyContentOptions {
|
|
747
779
|
componentName?: string;
|
|
@@ -751,4 +783,4 @@ interface CopyContentOptions {
|
|
|
751
783
|
}
|
|
752
784
|
declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
|
|
753
785
|
//#endregion
|
|
754
|
-
export {
|
|
786
|
+
export { Rect as A, PluginConfig as C, ReactGrabAPI as D, PromptModeContext as E, ToolbarState as F, SettableOptions as M, SourceInfo as N, ReactGrabRendererProps as O, Theme as P, Plugin as S, Position as T, ElementSelectedEventDetail as _, ActionContext as a, Options as b, AgentContext as c, DeepPartial as d, DragRect as f, ElementLabelVariant as g, ElementLabelContext as h, Fiber as i, SelectedElementPayload as j, ReactGrabState as k, ContextMenuAction as l, ElementBounds as m, isInstrumentationActive as n, ActionContextHooks as o, ElementAtPointOptions as p, StackFrame as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, GrabbedBox as v, PluginHooks as w, OverlayBounds as x, OpenFileActionHooks as y };
|
|
@@ -6,6 +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 { ReactNode } from "react";
|
|
10
|
+
|
|
9
11
|
//#region ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/types/reactive/observable.d.ts
|
|
10
12
|
declare global {
|
|
11
13
|
interface SymbolConstructor {
|
|
@@ -23,6 +25,17 @@ interface Position {
|
|
|
23
25
|
x: number;
|
|
24
26
|
y: number;
|
|
25
27
|
}
|
|
28
|
+
interface ElementAtPointOptions {
|
|
29
|
+
container?: Element;
|
|
30
|
+
filter?: (element: Element) => boolean;
|
|
31
|
+
}
|
|
32
|
+
interface ElementBounds {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
borderRadius: string;
|
|
38
|
+
}
|
|
26
39
|
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? T[P] extends ((...args: unknown[]) => unknown) ? T[P] : DeepPartial<T[P]> : T[P] };
|
|
27
40
|
interface Theme {
|
|
28
41
|
/**
|
|
@@ -138,11 +151,13 @@ interface AgentContext<T = unknown> {
|
|
|
138
151
|
sessionId?: string;
|
|
139
152
|
}
|
|
140
153
|
type ActivationMode = "toggle" | "hold";
|
|
141
|
-
interface
|
|
142
|
-
transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
|
|
154
|
+
interface OpenFileActionHooks {
|
|
143
155
|
onOpenFile: (filePath: string, lineNumber?: number) => boolean | void;
|
|
144
156
|
transformOpenFileUrl: (url: string, filePath: string, lineNumber?: number) => string;
|
|
145
157
|
}
|
|
158
|
+
interface ActionContextHooks extends OpenFileActionHooks {
|
|
159
|
+
transformHtmlContent: (html: string, elements: Element[]) => Promise<string>;
|
|
160
|
+
}
|
|
146
161
|
interface ActionContext {
|
|
147
162
|
element: Element;
|
|
148
163
|
elements: Element[];
|
|
@@ -258,24 +273,24 @@ interface HierarchyState {
|
|
|
258
273
|
activeIndex: number;
|
|
259
274
|
}
|
|
260
275
|
interface PluginHooks {
|
|
261
|
-
onActivate?: () => void
|
|
262
|
-
onDeactivate?: () => void
|
|
263
|
-
onElementHover?: (element: Element) => void
|
|
276
|
+
onActivate?: () => void | Promise<void>;
|
|
277
|
+
onDeactivate?: () => void | Promise<void>;
|
|
278
|
+
onElementHover?: (element: Element) => void | Promise<void>;
|
|
264
279
|
onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
|
|
265
|
-
onDragStart?: (startX: number, startY: number) => void
|
|
266
|
-
onDragEnd?: (elements: Element[], bounds: DragRect) => void
|
|
280
|
+
onDragStart?: (startX: number, startY: number) => void | Promise<void>;
|
|
281
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void | Promise<void>;
|
|
267
282
|
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
268
283
|
transformCopyContent?: (content: string, elements: Element[]) => string | Promise<string>;
|
|
269
|
-
onAfterCopy?: (elements: Element[], success: boolean) => void
|
|
270
|
-
onCopySuccess?: (elements: Element[], content: string) => void
|
|
271
|
-
onCopyError?: (error: Error) => void
|
|
272
|
-
onStateChange?: (state: ReactGrabState) => void
|
|
273
|
-
onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void
|
|
274
|
-
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void
|
|
275
|
-
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void
|
|
276
|
-
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void
|
|
277
|
-
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void
|
|
278
|
-
onContextMenu?: (element: Element, position: Position) => void
|
|
284
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void | Promise<void>;
|
|
285
|
+
onCopySuccess?: (elements: Element[], content: string) => void | Promise<void>;
|
|
286
|
+
onCopyError?: (error: Error) => void | Promise<void>;
|
|
287
|
+
onStateChange?: (state: ReactGrabState) => void | Promise<void>;
|
|
288
|
+
onPromptModeChange?: (isPromptMode: boolean, context: PromptModeContext) => void | Promise<void>;
|
|
289
|
+
onSelectionBox?: (visible: boolean, bounds: OverlayBounds | null, element: Element | null) => void | Promise<void>;
|
|
290
|
+
onDragBox?: (visible: boolean, bounds: OverlayBounds | null) => void | Promise<void>;
|
|
291
|
+
onGrabbedBox?: (bounds: OverlayBounds, element: Element) => void | Promise<void>;
|
|
292
|
+
onElementLabel?: (visible: boolean, variant: ElementLabelVariant, context: ElementLabelContext) => void | Promise<void>;
|
|
293
|
+
onContextMenu?: (element: Element, position: Position) => void | Promise<void>;
|
|
279
294
|
onOpenFile?: (filePath: string, lineNumber?: number) => boolean | void;
|
|
280
295
|
transformHtmlContent?: (html: string, elements: Element[]) => string | Promise<string>;
|
|
281
296
|
transformAgentContext?: (context: AgentContext, elements: Element[]) => AgentContext | Promise<AgentContext>;
|
|
@@ -287,7 +302,7 @@ interface PluginConfig {
|
|
|
287
302
|
options?: SettableOptions;
|
|
288
303
|
actions?: ContextMenuAction[];
|
|
289
304
|
hooks?: PluginHooks;
|
|
290
|
-
cleanup?: () =>
|
|
305
|
+
cleanup?: () => undefined;
|
|
291
306
|
}
|
|
292
307
|
interface Plugin {
|
|
293
308
|
name: string;
|
|
@@ -341,6 +356,7 @@ interface SettableOptions extends Options {
|
|
|
341
356
|
interface SourceInfo {
|
|
342
357
|
filePath: string;
|
|
343
358
|
lineNumber: number | null;
|
|
359
|
+
columnNumber: number | null;
|
|
344
360
|
componentName: string | null;
|
|
345
361
|
}
|
|
346
362
|
interface SelectedElementPayload {
|
|
@@ -430,13 +446,19 @@ interface FrozenLabelEntry {
|
|
|
430
446
|
bounds: OverlayBounds;
|
|
431
447
|
mouseX?: number;
|
|
432
448
|
}
|
|
449
|
+
interface FrozenLabelEntryAccessor {
|
|
450
|
+
read: () => FrozenLabelEntry | null;
|
|
451
|
+
}
|
|
452
|
+
interface SelectionLabelInstanceAccessor {
|
|
453
|
+
read: () => SelectionLabelInstance | null;
|
|
454
|
+
}
|
|
433
455
|
interface ReactGrabRendererProps {
|
|
434
456
|
selectionVisible?: boolean;
|
|
435
457
|
selectionBounds?: OverlayBounds;
|
|
436
458
|
selectionBoundsMultiple?: OverlayBounds[];
|
|
437
459
|
selectionShouldSnap?: boolean;
|
|
438
460
|
selectionElementsCount?: number;
|
|
439
|
-
|
|
461
|
+
frozenLabelEntryAccessors?: FrozenLabelEntryAccessor[];
|
|
440
462
|
pendingShiftPreviewEntry?: FrozenLabelEntry;
|
|
441
463
|
selectionFilePath?: string;
|
|
442
464
|
selectionLineNumber?: number;
|
|
@@ -447,6 +469,7 @@ interface ReactGrabRendererProps {
|
|
|
447
469
|
hierarchyState?: HierarchyState;
|
|
448
470
|
hierarchyMenuPosition?: DropdownAnchor | null;
|
|
449
471
|
labelInstances?: SelectionLabelInstance[];
|
|
472
|
+
labelInstanceAccessors?: SelectionLabelInstanceAccessor[];
|
|
450
473
|
dragVisible?: boolean;
|
|
451
474
|
dragBounds?: OverlayBounds;
|
|
452
475
|
grabbedBoxes?: Array<{
|
|
@@ -467,6 +490,7 @@ interface ReactGrabRendererProps {
|
|
|
467
490
|
onToggleExpand?: () => void;
|
|
468
491
|
selectionLabelShakeCount?: number;
|
|
469
492
|
onConfirmDismiss?: () => void;
|
|
493
|
+
onOpenSelectionFile?: () => void;
|
|
470
494
|
discardPrompt?: SelectionDiscardPrompt;
|
|
471
495
|
toolbarVisible?: boolean;
|
|
472
496
|
isActive?: boolean;
|
|
@@ -548,7 +572,7 @@ interface ReactGrabEntry {
|
|
|
548
572
|
frames?: ReactGrabStackFrame[];
|
|
549
573
|
}
|
|
550
574
|
//#endregion
|
|
551
|
-
//#region ../../node_modules/.pnpm/bippy@0.
|
|
575
|
+
//#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/unsubscribe.d.ts
|
|
552
576
|
type Flags = number;
|
|
553
577
|
type Lanes = number;
|
|
554
578
|
type TypeOfMode = number;
|
|
@@ -638,6 +662,14 @@ interface Effect {
|
|
|
638
662
|
interface Family {
|
|
639
663
|
current: unknown;
|
|
640
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* React 19 flight metadata for a server component owner (ReactComponentInfo).
|
|
667
|
+
* Unlike client owners it has no `tag`; the owner chain continues via `owner`.
|
|
668
|
+
*/
|
|
669
|
+
interface RendererRefreshUpdate {
|
|
670
|
+
staleFamilies: Set<Family>;
|
|
671
|
+
updatedFamilies: Set<Family>;
|
|
672
|
+
}
|
|
641
673
|
/**
|
|
642
674
|
* Represents a react-internal Fiber node.
|
|
643
675
|
*/
|
|
@@ -688,6 +720,7 @@ interface ReactDevToolsGlobalHook {
|
|
|
688
720
|
onCommitFiberRoot: (rendererID: number, root: FiberRoot, priority: number | void) => void;
|
|
689
721
|
onCommitFiberUnmount: (rendererID: number, fiber: Fiber) => void;
|
|
690
722
|
onPostCommitFiberRoot: (rendererID: number, root: FiberRoot) => void;
|
|
723
|
+
onScheduleFiberRoot?: (rendererID: number, root: FiberRoot, children: ReactNode) => void;
|
|
691
724
|
renderers: Map<number, ReactRenderer>;
|
|
692
725
|
supportsFiber: boolean;
|
|
693
726
|
supportsFlight: boolean;
|
|
@@ -706,10 +739,7 @@ interface ReactRenderer {
|
|
|
706
739
|
overridePropsRenamePath?: (fiber: Fiber, oldPath: Array<number | string>, newPath: Array<number | string>) => void;
|
|
707
740
|
reconcilerVersion: string;
|
|
708
741
|
rendererPackageName: string;
|
|
709
|
-
scheduleRefresh?: (root: FiberRoot, update:
|
|
710
|
-
staleFamilies: Set<Family>;
|
|
711
|
-
updatedFamilies: Set<Family>;
|
|
712
|
-
}) => void;
|
|
742
|
+
scheduleRefresh?: (root: FiberRoot, update: RendererRefreshUpdate) => void;
|
|
713
743
|
scheduleRoot?: (root: FiberRoot, element: React.ReactNode) => void;
|
|
714
744
|
scheduleUpdate?: (fiber: Fiber) => void;
|
|
715
745
|
setErrorHandler?: (newShouldErrorImpl: (fiber: Fiber) => boolean) => void;
|
|
@@ -720,28 +750,30 @@ interface ReactRenderer {
|
|
|
720
750
|
declare global {
|
|
721
751
|
var __REACT_DEVTOOLS_GLOBAL_HOOK__: ReactDevToolsGlobalHook | undefined;
|
|
722
752
|
} //#endregion
|
|
723
|
-
//#region src/
|
|
724
|
-
/**
|
|
725
|
-
* Returns `true` if bippy's instrumentation is active.
|
|
726
|
-
*/
|
|
727
|
-
declare const isInstrumentationActive: () => boolean;
|
|
728
|
-
/**
|
|
729
|
-
* Returns the latest fiber (since it may be double-buffered).
|
|
730
|
-
*/
|
|
753
|
+
//#region src/unsubscribe.d.ts
|
|
731
754
|
//#endregion
|
|
732
|
-
//#region ../../node_modules/.pnpm/bippy@0.
|
|
755
|
+
//#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/source.d.ts
|
|
733
756
|
//#region src/source/parse-stack.d.ts
|
|
734
757
|
interface StackFrame {
|
|
735
758
|
args?: unknown[];
|
|
736
759
|
columnNumber?: number;
|
|
737
760
|
lineNumber?: number;
|
|
761
|
+
enclosingLineNumber?: number;
|
|
762
|
+
enclosingColumnNumber?: number;
|
|
738
763
|
fileName?: string;
|
|
739
764
|
functionName?: string;
|
|
740
765
|
source?: string;
|
|
741
766
|
isServer?: boolean;
|
|
742
767
|
isSymbolicated?: boolean;
|
|
768
|
+
isIgnoreListed?: boolean;
|
|
743
769
|
}
|
|
744
770
|
//#endregion
|
|
771
|
+
//#region ../../node_modules/.pnpm/bippy@0.6.0_react@19.2.6/node_modules/bippy/dist/core.d.ts
|
|
772
|
+
/**
|
|
773
|
+
* Returns `true` if bippy's instrumentation is active.
|
|
774
|
+
*/
|
|
775
|
+
declare const isInstrumentationActive: () => boolean;
|
|
776
|
+
//#endregion
|
|
745
777
|
//#region src/utils/copy-content.d.ts
|
|
746
778
|
interface CopyContentOptions {
|
|
747
779
|
componentName?: string;
|
|
@@ -751,4 +783,4 @@ interface CopyContentOptions {
|
|
|
751
783
|
}
|
|
752
784
|
declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
|
|
753
785
|
//#endregion
|
|
754
|
-
export {
|
|
786
|
+
export { Rect as A, PluginConfig as C, ReactGrabAPI as D, PromptModeContext as E, ToolbarState as F, SettableOptions as M, SourceInfo as N, ReactGrabRendererProps as O, Theme as P, Plugin as S, Position as T, ElementSelectedEventDetail as _, ActionContext as a, Options as b, AgentContext as c, DeepPartial as d, DragRect as f, ElementLabelVariant as g, ElementLabelContext as h, Fiber as i, SelectedElementPayload as j, ReactGrabState as k, ContextMenuAction as l, ElementBounds as m, isInstrumentationActive as n, ActionContextHooks as o, ElementAtPointOptions as p, StackFrame as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, GrabbedBox as v, PluginHooks as w, OverlayBounds as x, OpenFileActionHooks as y };
|
package/dist/core/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-DBJClC5s.cjs`),t=require(`../freeze-updates-CTawzP3e.cjs`),n=require(`../open-file-nyBpDPAl.cjs`);exports.DEFAULT_THEME=e.l,exports.copyContent=n.n,exports.formatElementInfo=n.r,exports.generateSnippet=e.n,exports.getStack=n.s,exports.init=e.t,exports.isInstrumentationActive=t.Z;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
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 {
|
|
10
|
-
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-
|
|
9
|
+
import { C as PluginConfig, D as ReactGrabAPI, M as SettableOptions, N as SourceInfo, O as ReactGrabRendererProps, S as Plugin, a as ActionContext, b as Options, c as AgentContext, l as ContextMenuAction, n as isInstrumentationActive, t as copyContent, w as PluginHooks, x as OverlayBounds } from "../copy-content-CNT7qnjJ.cjs";
|
|
10
|
+
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-BfkbSQSc.cjs";
|
|
11
11
|
export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
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 {
|
|
10
|
-
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-
|
|
9
|
+
import { C as PluginConfig, D as ReactGrabAPI, M as SettableOptions, N as SourceInfo, O as ReactGrabRendererProps, S as Plugin, a as ActionContext, b as Options, c as AgentContext, l as ContextMenuAction, n as isInstrumentationActive, t as copyContent, w as PluginHooks, x as OverlayBounds } from "../copy-content-BIrPD_Au.js";
|
|
10
|
+
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-OIK6lIEj.js";
|
|
11
11
|
export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
|
package/dist/core/index.js
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
|
-
import{
|
|
9
|
+
import{l as e,n as t,t as n}from"../core-BkdQ4ajU.js";import{Z as r}from"../freeze-updates-BdM-c_Ko.js";import{n as i,r as a,s as o}from"../open-file-UOXq4lSp.js";export{e as DEFAULT_THEME,i as copyContent,a as formatElementInfo,t as generateSnippet,o as getStack,n as init,r as isInstrumentationActive};
|