You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/grab/README.md
+101-7Lines changed: 101 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,15 +201,109 @@ actions: [
201
201
];
202
202
```
203
203
204
-
A plugin can provide any combination of:
204
+
See [`packages/react-grab/src/types.ts`](https://github.com/aidenybai/react-grab/blob/main/packages/react-grab/src/types.ts) for the full `Plugin`, `PluginHooks`, and `PluginConfig` interfaces.
205
205
206
-
- **`actions`** — context menu and/or toolbar items in a single array (use `target:"toolbar"` for toolbar items)
207
-
- **`hooks`** — lifecycle callbacks like `onActivate`, `onElementSelect`, `onCopySuccess`, `transformCopyContent`, etc. (see `PluginHooks`)
208
-
- **`theme`** — partial theme overrides (see `Theme`)
209
-
- **`options`** — override default options like `activationMode` or `keyHoldDuration`
210
-
- **`setup(api)`** — a function that receives the full `ReactGrabAPI` and can return additional config or a `cleanup` function
206
+
## Primitives
211
207
212
-
See [`packages/react-grab/src/types.ts`](https://github.com/aidenybai/react-grab/blob/main/packages/react-grab/src/types.ts) for the full `Plugin`, `PluginHooks`, and `PluginConfig` interfaces.
208
+
React Grab provides a set of primitives for building your own mini React Grab.
209
+
210
+
Here's a simple example of how to build your own element selector with hover highlight and one-click inspection:
if (frame?.fileName) openFile(frame.fileName, frame.lineNumber);
295
+
}}
296
+
>
297
+
Open in Editor
298
+
</button>
299
+
</div>
300
+
)}
301
+
</div>
302
+
);
303
+
};
304
+
```
305
+
306
+
See [`packages/react-grab/src/primitives.ts`](https://github.com/aidenybai/react-grab/blob/main/packages/react-grab/src/primitives.ts) for the full `ReactGrabElementContext`, `getElementContext`, `freeze`, `unfreeze`, and `openFile` primitives.
0 commit comments