browser-haptic 1.0.3 → 1.0.7

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 +28 -2
  2. package/package.json +15 -9
package/README.md CHANGED
@@ -1,19 +1,41 @@
1
1
  # browser-haptic
2
2
 
3
- Lightweight haptic feedback for JavaScript. This repo uses **Bun**. Uses the [Vibration API](https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API) where available (e.g. Android). On **iOS Safari 17.4+** it uses a hidden `input[switch]` toggle so the native switch haptic fires. No runtime dependencies.
3
+ [![npm version](https://img.shields.io/npm/v/browser-haptic.svg)](https://www.npmjs.com/package/browser-haptic)
4
+ [![npm downloads](https://img.shields.io/npm/dm/browser-haptic.svg)](https://www.npmjs.com/package/browser-haptic)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ Lightweight haptic feedback for JavaScript. Uses the [Vibration API](https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API) where available (e.g. Android). On **iOS Safari 17.4+** it uses a hidden `input[switch]` toggle so the native switch haptic fires. No runtime dependencies.
8
+
9
+ **[Try the playground →](https://playground-neon-gamma.vercel.app)** — live demo, install commands, and code samples for React, Vue, Svelte, Angular, and TypeScript.
10
+
11
+ - [Install](#install)
12
+ - [Usage](#usage)
13
+ - [API](#api)
14
+ - [Playground](#playground)
15
+ - [Contributing](#contributing)
4
16
 
5
17
  ## Install
6
18
 
7
- From npm (use your package manager):
19
+ **npm**
8
20
 
9
21
  ```bash
10
22
  npm install browser-haptic
11
23
  ```
12
24
 
25
+ **bun**
26
+
27
+ ```bash
28
+ bun add browser-haptic
29
+ ```
30
+
31
+ **pnpm**
32
+
13
33
  ```bash
14
34
  pnpm add browser-haptic
15
35
  ```
16
36
 
37
+ **yarn**
38
+
17
39
  ```bash
18
40
  yarn add browser-haptic
19
41
  ```
@@ -68,6 +90,10 @@ You can also use named imports if you prefer: `import { light, success, isSuppor
68
90
 
69
91
  On iOS Safari 17.4+, `isSupported()` is `true` but `hasVibration()` is `false`; the library uses a hidden native switch toggle.
70
92
 
93
+ ## Playground
94
+
95
+ A live demo and docs site is available at **[playground-neon-gamma.vercel.app](https://playground-neon-gamma.vercel.app)**. You can try haptic feedback in the browser, copy install commands, and see framework-specific examples (React, Vue, Svelte, Angular, TypeScript). The playground source lives in the `playground/` directory of this repo.
96
+
71
97
  ## Contributing
72
98
 
73
99
  Contributions are welcome. To get started:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "browser-haptic",
3
- "version": "1.0.3",
4
- "description": "Lightweight haptic feedback for JS (Vibration API + iOS Safari switch fallback). No deps.",
3
+ "version": "1.0.7",
4
+ "description": "Lightweight haptic feedback for web apps. Vibration API (Android) + iOS Safari 17.4+ switch fallback. Zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -22,22 +22,28 @@
22
22
  "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
23
23
  "build": "bun run clean && tsc",
24
24
  "prepublishOnly": "bun run build",
25
- "version:patch": "bun scripts/bump.js patch",
26
- "version:minor": "bun scripts/bump.js minor",
27
- "version:major": "bun scripts/bump.js major",
28
- "tag": "node -e \"const v=require('./package.json').version; require('child_process').execSync('git tag -a v'+v+' -m \\\"Release v'+v+'\\\"', {stdio:'inherit'})\""
25
+ "version:patch": "./scripts/bump.sh patch",
26
+ "version:minor": "./scripts/bump.sh minor",
27
+ "version:major": "./scripts/bump.sh major"
29
28
  },
30
29
  "packageManager": "bun",
31
30
  "keywords": [
32
31
  "browser-haptic",
33
32
  "haptic",
33
+ "haptic-feedback",
34
34
  "vibration",
35
35
  "vibrate",
36
+ "vibration-api",
36
37
  "ios",
37
38
  "safari",
38
- "feedback",
39
+ "android",
39
40
  "mobile",
40
- "vibration-api"
41
+ "mobile-web",
42
+ "pwa",
43
+ "tactile",
44
+ "touch-feedback",
45
+ "ux",
46
+ "zero-dependencies"
41
47
  ],
42
48
  "license": "MIT",
43
49
  "author": {
@@ -49,7 +55,7 @@
49
55
  "type": "git",
50
56
  "url": "https://github.com/KemalEmirhan/browser-haptic.git"
51
57
  },
52
- "homepage": "https://github.com/KemalEmirhan/browser-haptic#readme",
58
+ "homepage": "https://playground-neon-gamma.vercel.app",
53
59
  "bugs": {
54
60
  "url": "https://github.com/KemalEmirhan/browser-haptic/issues"
55
61
  },