@promakeai/inspector 1.0.3 → 1.0.6
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 +130 -111
- package/dist/inspector.js +3096 -2728
- package/package.json +2 -3
- package/dist/components/ui/tooltip.d.ts +0 -8
- package/dist/components/ui/tooltip.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,111 +1,130 @@
|
|
|
1
|
-
# @promakeai/inspector
|
|
2
|
-
|
|
3
|
-
Visual element inspector React component with AI prompt support.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @promakeai/inspector
|
|
9
|
-
# or
|
|
10
|
-
yarn add @promakeai/inspector
|
|
11
|
-
# or
|
|
12
|
-
bun add @promakeai/inspector
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Peer Dependencies
|
|
16
|
-
|
|
17
|
-
Make sure you have these installed in your project:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install react react-dom
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
### 1. Add Vite Plugin (for component tracking)
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
// vite.config.ts
|
|
29
|
-
import { defineConfig } from
|
|
30
|
-
import react from
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
export default defineConfig({
|
|
34
|
-
plugins: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
# @promakeai/inspector
|
|
2
|
+
|
|
3
|
+
Visual element inspector React component with AI prompt support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @promakeai/inspector
|
|
9
|
+
# or
|
|
10
|
+
yarn add @promakeai/inspector
|
|
11
|
+
# or
|
|
12
|
+
bun add @promakeai/inspector
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Peer Dependencies
|
|
16
|
+
|
|
17
|
+
Make sure you have these installed in your project:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install react react-dom
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### 1. Add Vite Plugin (for component tracking)
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// vite.config.ts
|
|
29
|
+
import { defineConfig } from "vite";
|
|
30
|
+
import react from "@vitejs/plugin-react";
|
|
31
|
+
import { inspectorDebugger } from "@promakeai/inspector/plugin";
|
|
32
|
+
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
plugins: [inspectorDebugger({ enabled: true }), react()],
|
|
35
|
+
// IMPORTANT: Prevent Vite from bundling React inside inspector
|
|
36
|
+
optimizeDeps: {
|
|
37
|
+
exclude: ["@promakeai/inspector"],
|
|
38
|
+
},
|
|
39
|
+
resolve: {
|
|
40
|
+
dedupe: ["react", "react-dom"],
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Use Inspector Component
|
|
46
|
+
|
|
47
|
+
**Option A: Standalone Mode (inspects itself)**
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Inspector } from "@promakeai/inspector";
|
|
51
|
+
import "@promakeai/inspector/style.css";
|
|
52
|
+
|
|
53
|
+
function App() {
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<YourApp />
|
|
57
|
+
<Inspector /> {/* No src prop - inspects current page */}
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Option B: Parent-Child Mode (parent inspects child iframe)**
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { Inspector } from "@promakeai/inspector";
|
|
67
|
+
import "@promakeai/inspector/style.css";
|
|
68
|
+
|
|
69
|
+
function ParentApp() {
|
|
70
|
+
return (
|
|
71
|
+
<Inspector
|
|
72
|
+
src="http://localhost:5173" // Child app URL
|
|
73
|
+
labels={{
|
|
74
|
+
editText: "Edit Text",
|
|
75
|
+
editImage: "Edit Image",
|
|
76
|
+
// ... other labels
|
|
77
|
+
}}
|
|
78
|
+
theme={{
|
|
79
|
+
primaryColor: "rgb(58, 18, 189)",
|
|
80
|
+
// ... other theme options
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Use Hook in Parent App
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { useInspector } from "@promakeai/inspector-hook";
|
|
91
|
+
|
|
92
|
+
function ParentApp() {
|
|
93
|
+
const {
|
|
94
|
+
isReady,
|
|
95
|
+
selectedElement,
|
|
96
|
+
setInspectorEnabled,
|
|
97
|
+
updateElementText,
|
|
98
|
+
updateElementImage,
|
|
99
|
+
updateElementStyles,
|
|
100
|
+
} = useInspector("inspector-iframe-id");
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<div>
|
|
104
|
+
<button onClick={() => setInspectorEnabled(true)}>
|
|
105
|
+
Enable Inspector
|
|
106
|
+
</button>
|
|
107
|
+
<iframe
|
|
108
|
+
id="inspector-iframe-id"
|
|
109
|
+
src="http://localhost:5173"
|
|
110
|
+
style={{ width: "100%", height: "100vh" }}
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Features
|
|
118
|
+
|
|
119
|
+
- 🎯 Visual element selection
|
|
120
|
+
- ✏️ Text editing
|
|
121
|
+
- 🖼️ Image URL editing
|
|
122
|
+
- 🎨 Style editing (colors, spacing, typography)
|
|
123
|
+
- 🔍 Element stack navigation (select overlapping elements)
|
|
124
|
+
- 🌐 i18n support via labels
|
|
125
|
+
- 🎨 Customizable theme
|
|
126
|
+
- 📱 Responsive design
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT
|