dev-tooltip 1.1.0 → 1.1.3

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.
Files changed (2) hide show
  1. package/README.md +91 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,23 +1,102 @@
1
1
  # dev-tooltip
2
2
 
3
- Dev-only tooltips for frontend apps using `debug_*` attributes.
4
- All debug attributes are automatically **removed from production builds**.
5
-
6
- Built for **Vite + React**, with zero runtime cost in production.
3
+ Dev-only tooltips using `debug_*` attributes, stripped from production builds.
4
+ Built for **Vite + React** projects to show tooltips in development and automatically remove debug info in production.
7
5
 
8
6
  ---
9
7
 
10
- ## Features
8
+ ## Features
11
9
 
12
- - Dev-only tooltips (no production leakage)
13
- - Build-time removal of `debug_*` attributes
14
- - No manual runtime imports needed
15
- - One-line Vite setup
16
- - ✅ Zero impact on production bundle
10
+ - Show tooltips in dev mode on any element with `debug_*` attributes
11
+ - Automatically stripped from production builds
12
+ - Works with React JSX/TSX
13
+ - Simple one-line plugin import
17
14
 
18
15
  ---
19
16
 
20
- ## 📦 Installation
17
+ ## Installation
21
18
 
22
19
  ```bash
23
- npm install dev-tooltip
20
+ npm install dev-tooltip --save-dev
21
+ ```
22
+ or
23
+ ```bash
24
+ pnpm add dev-tooltip -D
25
+ ```
26
+
27
+
28
+ # Usage
29
+ Vite Config
30
+
31
+ In your vite.config.js:
32
+ ```js
33
+ import { defineConfig } from 'vite';
34
+ import react from '@vitejs/plugin-react';
35
+ import { devTooltip } from 'dev-tooltip';
36
+
37
+ export default defineConfig({
38
+ plugins: [
39
+ react(),
40
+ devTooltip()
41
+ ],
42
+ });
43
+ ```
44
+
45
+ This will:
46
+
47
+ Show tooltips in dev mode for elements with debug_* attributes.
48
+
49
+ Automatically strip the attributes in production builds.
50
+
51
+ Require no manual runtime import — the plugin injects the tooltip automatically in dev.
52
+
53
+ Example in JSX
54
+
55
+ ```jsx
56
+ function App() {
57
+ return (
58
+ <div
59
+ title="Database table name users"
60
+ debug_title="Users table">
61
+ Hover me in development
62
+ </div>
63
+ );
64
+ }
65
+
66
+ export default App;
67
+ ```
68
+
69
+ In dev mode, hovering over the element will show the tooltip.
70
+
71
+ In production build (npm run build), debug_title will be removed automatically.
72
+
73
+ Options
74
+
75
+ devTooltip({ prefix }) — optional config:
76
+
77
+ Option Default Description
78
+ prefix "debug_" The prefix for debug attributes.
79
+
80
+ Example:
81
+ ```javascript
82
+ devTooltip({ prefix: "dev_" })
83
+ ```
84
+ Advanced Tips
85
+
86
+ You can use multiple debug attributes on a single element:
87
+ ```jsx
88
+ <div debug_title="Users table" debug_note="Only for admin">
89
+ Hover me in dev
90
+ </div>
91
+ ```
92
+
93
+ All attributes with the given prefix are stripped automatically in production.
94
+
95
+ Works out-of-the-box for multiple projects — just install and add devTooltip() in vite.config.js.
96
+
97
+ License
98
+
99
+ MIT © Abhishek Kumar
100
+
101
+
102
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-tooltip",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "description": "Dev-only tooltips using debug_* attributes, stripped from production builds",
5
5
  "type": "module",
6
6
  "main": "index.js",