ios-haptics 3.0.0 → 3.1.0

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/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * ios-haptics v3.0.0
2
+ * ios-haptics v3.1.0
3
3
  * tijn.dev
4
4
  * @license MIT
5
5
  **/
6
- function e(e){if(!e)return;let t=document.createElement(`input`);t.type=`checkbox`,t.setAttribute(`switch`,``),Object.assign(t.style,{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,margin:0,opacity:0,cursor:`pointer`,clipPath:`inset(0 round 999px)`,touchAction:`manipulation`}),t.style.setProperty(`-webkit-tap-highlight-color`,`transparent`),e.style.position=`relative`,e.insertAdjacentElement(`beforeend`,t)}export{e as hapticTrigger};
6
+ function e(){return typeof navigator>`u`?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function t(t){if(!t||typeof window>`u`)return;if(`vibrate`in navigator){navigator.vibrate(50);return}if(!e())return;let n=document.createElement(`input`);n.type=`checkbox`,n.setAttribute(`switch`,``),n.setAttribute(`data-haptic-trigger`,``),n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,Object.assign(n.style,{position:`absolute`,inset:`0`,width:`100%`,height:`100%`,margin:`0`,opacity:`0`,clipPath:`inset(0 round 999px)`,touchAction:`manipulation`}),n.style.setProperty(`-webkit-tap-highlight-color`,`transparent`),getComputedStyle(t).position===`static`&&(t.style.position=`relative`),t.insertAdjacentElement(`beforeend`,n)}export{t as hapticTrigger};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ios-haptics",
3
3
  "type": "module",
4
- "version": "3.0.0",
4
+ "version": "3.1.0",
5
5
  "description": "haptic feedback for ios safari",
6
6
  "author": "tijnjh",
7
7
  "license": "MIT",