ghostfill 0.1.0 → 0.1.1
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 +110 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# GhostFill
|
|
2
|
+
|
|
3
|
+
Dev tool that fills form fields with fake data. Select a block, click fill — done.
|
|
4
|
+
|
|
5
|
+
Works with any framework (React, Vue, Angular, vanilla). Detects inputs, textareas, selects, checkboxes, radios, date pickers, and custom dropdowns (Headless UI, Radix).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install ghostfill -D
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Vanilla JS
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { init } from "ghostfill";
|
|
19
|
+
|
|
20
|
+
init();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### React / Next.js
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
// app.tsx or layout.tsx
|
|
27
|
+
import { useEffect } from "react";
|
|
28
|
+
|
|
29
|
+
function GhostFill() {
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
import("ghostfill").then((m) => m.init());
|
|
32
|
+
}, []);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// In your app:
|
|
37
|
+
{process.env.NODE_ENV === "development" && <GhostFill />}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Programmatic
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import { fill } from "ghostfill";
|
|
44
|
+
|
|
45
|
+
await fill({ container: document.querySelector("form") });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## How it works
|
|
49
|
+
|
|
50
|
+
1. A ghost icon appears on the page (starts minimized)
|
|
51
|
+
2. Click it to enter selection mode — hover and click a form area
|
|
52
|
+
3. Click the sparkles button to fill all detected fields
|
|
53
|
+
4. By default, generates random fake data locally (no API needed)
|
|
54
|
+
5. Optionally enable AI mode in settings for context-aware data generation
|
|
55
|
+
|
|
56
|
+
## Settings
|
|
57
|
+
|
|
58
|
+
Click the gear icon to configure:
|
|
59
|
+
|
|
60
|
+
- **Highlight Colour** — pick the selection overlay color
|
|
61
|
+
- **Use AI** — toggle AI-powered fills (requires API key)
|
|
62
|
+
- **Provider** — cycle between OpenAI (gpt-4o-mini), xAI (Grok 4 Fast), Moonshot (Kimi K2)
|
|
63
|
+
- **API Key** — your provider API key
|
|
64
|
+
- **Presets** — save prompt templates for domain-specific data (e.g. D365, healthcare)
|
|
65
|
+
- **Dark/Light theme** — toggle with the sun/moon icon
|
|
66
|
+
|
|
67
|
+
## Features
|
|
68
|
+
|
|
69
|
+
- **Zero config** — works out of the box with random fake data
|
|
70
|
+
- **Shadow DOM** — styles don't leak into your app
|
|
71
|
+
- **Framework-aware** — uses native value setters so React/Vue/Angular pick up changes
|
|
72
|
+
- **Smart detection** — labels from `<label>`, `aria-label`, placeholder, preceding siblings
|
|
73
|
+
- **Custom dropdowns** — handles Headless UI Listbox, Radix Select, and other `role="listbox"` components
|
|
74
|
+
- **Draggable** — drag the toolbar or minimized icon anywhere
|
|
75
|
+
- **Presets** — save and reuse prompt templates
|
|
76
|
+
- **Dark/Light mode** — matches your preference
|
|
77
|
+
- **Keyboard shortcut** — `Alt+G` to toggle
|
|
78
|
+
|
|
79
|
+
## API
|
|
80
|
+
|
|
81
|
+
### `init(options?)`
|
|
82
|
+
|
|
83
|
+
Initialize GhostFill and add the UI to the page.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
init({
|
|
87
|
+
apiKey?: string, // API key (can also set in UI)
|
|
88
|
+
shortcut?: string, // Keyboard shortcut (default: "Alt+G")
|
|
89
|
+
systemPrompt?: string // Custom system prompt to prepend
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Returns `{ destroy: () => void }` to remove the UI.
|
|
94
|
+
|
|
95
|
+
### `fill(params)`
|
|
96
|
+
|
|
97
|
+
Programmatic fill without the UI.
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
await fill({
|
|
101
|
+
container: HTMLElement, // The element containing form fields
|
|
102
|
+
prompt?: string // Optional prompt for AI mode
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Returns `{ filled: number, errors: string[] }`.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|