react-grab 0.0.49 → 0.0.51
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 +37 -0
- package/dist/chunk-46DE32OJ.cjs +6293 -0
- package/dist/chunk-UUKVJLMI.js +6285 -0
- package/dist/core-CHAbsaHv.d.cts +272 -0
- package/dist/core-CHAbsaHv.d.ts +272 -0
- package/dist/core.cjs +34 -0
- package/dist/core.d.cts +3 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.js +1 -0
- package/dist/index.cjs +34 -6002
- package/dist/index.d.cts +5 -62
- package/dist/index.d.ts +5 -62
- package/dist/index.global.js +30 -30
- package/dist/index.js +10 -6003
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -130,6 +130,43 @@ if (process.env.NODE_ENV === "development") {
|
|
|
130
130
|
}
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
## Extending React Grab
|
|
134
|
+
|
|
135
|
+
React Grab provides an public customization API. Check out the [type definitions](https://github.com/aidenybai/react-grab/blob/main/packages/react-grab/src/types.ts) to see all available options for extending React Grab.
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { init } from "react-grab/core";
|
|
139
|
+
|
|
140
|
+
const api = init({
|
|
141
|
+
theme: {
|
|
142
|
+
enabled: true, // disable all UI by setting to false
|
|
143
|
+
hue: 180, // shift colors by 180 degrees (pink → cyan/turquoise)
|
|
144
|
+
crosshair: {
|
|
145
|
+
enabled: false, // disable crosshair
|
|
146
|
+
},
|
|
147
|
+
elementLabel: {
|
|
148
|
+
// when hovering over an element
|
|
149
|
+
backgroundColor: "#000000",
|
|
150
|
+
textColor: "#ffffff",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
onElementSelect: (element) => {
|
|
155
|
+
console.log("Selected:", element);
|
|
156
|
+
},
|
|
157
|
+
onCopySuccess: (elements, content) => {
|
|
158
|
+
console.log("Copied to clipboard:", content);
|
|
159
|
+
},
|
|
160
|
+
onStateChange: (state) => {
|
|
161
|
+
console.log("Active:", state.isActive);
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
api.activate();
|
|
166
|
+
api.copyElement(document.querySelector(".my-element"));
|
|
167
|
+
console.log(api.getState());
|
|
168
|
+
```
|
|
169
|
+
|
|
133
170
|
## Resources & Contributing Back
|
|
134
171
|
|
|
135
172
|
Want to try it out? Check the [our demo](https://react-grab.com).
|