react-grab 0.0.47 → 0.0.49
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 +149 -0
- package/dist/index.cjs +4320 -207
- package/dist/index.global.js +25 -24
- package/dist/index.js +4203 -90
- package/dist/styles.css +2 -0
- package/package.json +10 -2
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# <img src="https://github.com/aidenybai/react-grab/blob/main/.github/public/logo.png?raw=true" width="60" align="center" /> React Grab
|
|
2
|
+
|
|
3
|
+
[](https://bundlephobia.com/package/react-grab)
|
|
4
|
+
[](https://npmjs.com/package/react-grab)
|
|
5
|
+
[](https://npmjs.com/package/react-grab)
|
|
6
|
+
|
|
7
|
+
Grab any element on in your app and give it to Cursor, Claude Code, etc. to change.
|
|
8
|
+
|
|
9
|
+
By default coding agents cannot access elements on your page. React Grab fixes this - just point and click to provide context!
|
|
10
|
+
|
|
11
|
+
- Hold <kbd>⌘C</kbd> and click on any element on your page
|
|
12
|
+
- Works with Cursor, Claude Code, OpenCode
|
|
13
|
+
- Just a single script tag (it’s just JavaScript!)
|
|
14
|
+
|
|
15
|
+
### [Try out a demo! →](https://react-grab.com)
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
> [**Install using Cursor**](https://cursor.com/link/prompt?text=1.+Run+curl+-s+https%3A%2F%2Freact-grab.com%2Fllms.txt+%0A2.+Understand+the+content+and+follow+the+instructions+to+install+React+Grab.%0A3.+Tell+the+user+to+refresh+their+local+app+and+explain+how+to+use+React+Grab)
|
|
22
|
+
|
|
23
|
+
Get started in 1 minute by adding this script tag to your app:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<script
|
|
27
|
+
src="//unpkg.com/react-grab/dist/index.global.js"
|
|
28
|
+
crossorigin="anonymous"
|
|
29
|
+
data-enabled="true"
|
|
30
|
+
></script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If you're using a React framework or build tool, view instructions below:
|
|
34
|
+
|
|
35
|
+
#### Next.js (App router)
|
|
36
|
+
|
|
37
|
+
Add this inside of your `app/layout.tsx`:
|
|
38
|
+
|
|
39
|
+
```jsx
|
|
40
|
+
import Script from "next/script";
|
|
41
|
+
|
|
42
|
+
export default function RootLayout({ children }) {
|
|
43
|
+
return (
|
|
44
|
+
<html>
|
|
45
|
+
<head>
|
|
46
|
+
{/* put this in the <head> */}
|
|
47
|
+
{process.env.NODE_ENV === "development" && (
|
|
48
|
+
<Script
|
|
49
|
+
src="//unpkg.com/react-grab/dist/index.global.js"
|
|
50
|
+
crossOrigin="anonymous"
|
|
51
|
+
strategy="beforeInteractive"
|
|
52
|
+
data-enabled="true"
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
{/* rest of your scripts go under */}
|
|
56
|
+
</head>
|
|
57
|
+
<body>{children}</body>
|
|
58
|
+
</html>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Next.js (Pages router)
|
|
64
|
+
|
|
65
|
+
Add this into your `pages/_document.tsx`:
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
import { Html, Head, Main, NextScript } from "next/document";
|
|
69
|
+
|
|
70
|
+
export default function Document() {
|
|
71
|
+
return (
|
|
72
|
+
<Html lang="en">
|
|
73
|
+
<Head>
|
|
74
|
+
{/* put this in the <Head> */}
|
|
75
|
+
{process.env.NODE_ENV === "development" && (
|
|
76
|
+
<Script
|
|
77
|
+
src="//unpkg.com/react-grab/dist/index.global.js"
|
|
78
|
+
crossOrigin="anonymous"
|
|
79
|
+
strategy="beforeInteractive"
|
|
80
|
+
data-enabled="true"
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
{/* rest of your scripts go under */}
|
|
84
|
+
</Head>
|
|
85
|
+
<body>
|
|
86
|
+
<Main />
|
|
87
|
+
<NextScript />
|
|
88
|
+
</body>
|
|
89
|
+
</Html>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Vite
|
|
95
|
+
|
|
96
|
+
Your `index.html` could look like this:
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<!doctype html>
|
|
100
|
+
<html lang="en">
|
|
101
|
+
<head>
|
|
102
|
+
<script type="module">
|
|
103
|
+
// first npm i react-grab
|
|
104
|
+
// then in head:
|
|
105
|
+
if (import.meta.env.DEV) {
|
|
106
|
+
import("react-grab");
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
</head>
|
|
110
|
+
<body>
|
|
111
|
+
<div id="root"></div>
|
|
112
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
113
|
+
</body>
|
|
114
|
+
</html>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### Webpack
|
|
118
|
+
|
|
119
|
+
First, install React Grab:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npm install react-grab
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Then add this at the top of your main entry file (e.g., `src/index.tsx` or `src/main.tsx`):
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
if (process.env.NODE_ENV === "development") {
|
|
129
|
+
import("react-grab");
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Resources & Contributing Back
|
|
134
|
+
|
|
135
|
+
Want to try it out? Check the [our demo](https://react-grab.com).
|
|
136
|
+
|
|
137
|
+
Looking to contribute back? Check the [Contributing Guide](https://github.com/aidenybai/react-grab/blob/main/CONTRIBUTING.md) out.
|
|
138
|
+
|
|
139
|
+
Want to talk to the community? Hop in our [Discord](https://discord.com/invite/G7zxfUzkm7) and share your ideas and what you've build with React Grab.
|
|
140
|
+
|
|
141
|
+
Find a bug? Head over to our [issue tracker](https://github.com/aidenybai/react-grab/issues) and we'll do our best to help. We love pull requests, too!
|
|
142
|
+
|
|
143
|
+
We expect all contributors to abide by the terms of our [Code of Conduct](https://github.com/aidenybai/react-grab/blob/main/.github/CODE_OF_CONDUCT.md).
|
|
144
|
+
|
|
145
|
+
[**→ Start contributing on GitHub**](https://github.com/aidenybai/react-grab/blob/main/CONTRIBUTING.md)
|
|
146
|
+
|
|
147
|
+
### License
|
|
148
|
+
|
|
149
|
+
React Grab is MIT-licensed open-source software.
|