ios-haptics 0.1.3 → 0.1.5

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  javascript library for haptic feedback inside of safari on ios
4
4
 
5
+ please note this only works on ios 17.4 to 26.4, as apple patched it in ios 26.5
6
+
5
7
  ![GitHub last commit](https://img.shields.io/github/last-commit/tijnjh/ios-haptics)
6
8
  [![npm version](https://img.shields.io/npm/v/ios-haptics.svg)](https://npmjs.com/package/ios-haptics)
7
9
  ![NPM Downloads](https://img.shields.io/npm/dm/ios-haptics)
@@ -34,6 +36,9 @@ haptic.error()
34
36
 
35
37
  this uses the `<input type="checkbox" switch />` (introduced in safari 17.4), which has haptic feedback when toggled
36
38
 
39
+ > [!IMPORTANT]
40
+ > apple patched the bug this library used for haptic feedback in ios 26.5. you can no longer trigger haptic feedback programmatically by calling `.click()` on a `<label>` that is `for` an `<input type="checkbox" switch />`. haptic feedback still works when the user directly clicks the checkbox switch themselves, but it can no longer be done programmatically.
41
+
37
42
  every `haptic` call, it will create one of those in the background, toggle it, then remove it
38
43
 
39
44
  on devices that support it, `navigator.vibrate()` is called instead, so it works on android too
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * ios-haptics v0.1.3
2
+ * ios-haptics v0.1.4
3
3
  * tijn.dev
4
4
  * @license MIT
5
5
  **/
6
6
  //#region src/index.ts
7
- const supportsHaptics = window.matchMedia("(pointer: coarse)").matches;
7
+ const supportsHaptics = typeof window === "undefined" || typeof window.matchMedia !== "function" ? false : window.matchMedia("(pointer: coarse)").matches;
8
8
  function _haptic() {
9
9
  try {
10
10
  if (navigator.vibrate) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ios-haptics",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "haptic feedback for ios safari",
6
6
  "author": "tijnjh",
7
7
  "license": "MIT",
@@ -32,8 +32,6 @@
32
32
  "dev": "tsdown --watch"
33
33
  },
34
34
  "devDependencies": {
35
- "@antfu/eslint-config": "^5.3.0",
36
- "eslint": "^9.35.0",
37
35
  "tsdown": "latest"
38
36
  }
39
37
  }