@aravindh-arumugam/flash-fill 1.0.0-beta.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 +72 -0
- package/dist/browser.global.js +9 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @aravindh-arumugam/flash-fill ⚡
|
|
2
|
+
|
|
3
|
+
A developer-only form autofill helper that intelligently detects form fields and allows single-click full form autofill. Powered by `@faker-js/faker`.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ⚡ **Single-Click Fill**: Instantly scan and autofill ALL form fields.
|
|
8
|
+
- 🛠 **Dev-Only**: Automatically disables itself in production builds.
|
|
9
|
+
- 🤖 **Smart Detection**: Detects fields by name, id, placeholder, and labels.
|
|
10
|
+
- 🎲 **Realistic Data**: Uses FakerJS to generate names, emails, phones, addresses, etc.
|
|
11
|
+
- 🖱 **UI Controls**:
|
|
12
|
+
- Left-Click ⚡: Fill everything.
|
|
13
|
+
- Right-Click/Long-Press ⚡: Open panel to edit values.
|
|
14
|
+
- ⌨ **Keyboard Shortcut**: `Ctrl + Shift + F` for instant fill.
|
|
15
|
+
- ⚛ **React Support**: Built-in hook `use_flash_fill`.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install --save-dev @aravindh-arumugam/flash-fill
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Vanilla JS / Auto-Initialization
|
|
26
|
+
|
|
27
|
+
Simply import the package in your entry file (e.g., `main.js` or `index.js`). It will automatically initialize the floating button in development mode.
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
import "@aravindh-arumugam/flash-fill";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Manual Initialization
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import { init_flash_fill } from "@aravindh-arumugam/flash-fill";
|
|
37
|
+
|
|
38
|
+
init_flash_fill();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### React Hook
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { use_flash_fill } from "@aravindh-arumugam/flash-fill";
|
|
45
|
+
|
|
46
|
+
function MyComponent() {
|
|
47
|
+
const { trigger_fill } = use_flash_fill({ auto_fill: false });
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<button onClick={trigger_fill}>
|
|
51
|
+
Custom Fill Button
|
|
52
|
+
</button>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## How it works
|
|
58
|
+
|
|
59
|
+
1. **Scans the DOM** for `input`, `textarea`, and `select` elements.
|
|
60
|
+
2. **Normalizes identifiers** based on priority: `name` > `id` > `placeholder` > `label`.
|
|
61
|
+
3. **Matches keywords** (e.g., "mail" -> email, "mobile" -> phone).
|
|
62
|
+
4. **Generates data** using FakerJS or uses default fallbacks.
|
|
63
|
+
5. **Triggers events** (`input`, `change`) to ensure compatibility with reactive frameworks like React/Vue.
|
|
64
|
+
|
|
65
|
+
## Safety
|
|
66
|
+
|
|
67
|
+
- This package checks `process.env.NODE_ENV`. If it's set to `'production'`, the UI contribution and auto-run logic are completely skipped.
|
|
68
|
+
- No external API calls are made.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|