vue-click 2.1.3 → 2.1.6

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
@@ -24,6 +24,21 @@ app.use(VueClick)
24
24
  app.mount('#app')
25
25
  ```
26
26
 
27
+ ## CDN
28
+
29
+ This package is available from the [**JSDELIVR**](https://www.jsdelivr.com/) and [**UNPKG**](https://unpkg.com/) content delivery networks (CDNs) and utilizes the [**UMD**](https://github.com/umdjs/umd#readme) module system so it's ready to use directly in the browser without a build step.
30
+
31
+ ```html
32
+ <script src="https://unpkg.com/vue@next"></script>
33
+ <script src="https://unpkg.com/vue-click@latest"></script>
34
+ <script>
35
+ const app = Vue.createApp({/* App Config */})
36
+ app.use(VueClick.default)
37
+ app.mount('#app')
38
+ </script>
39
+
40
+ ```
41
+
27
42
  # Usage
28
43
 
29
44
  ## Directive
@@ -230,4 +245,4 @@ button[data-vc-bind-press] {
230
245
  ---
231
246
 
232
247
  ## Copyright and License
233
- © 2021 Zachary Cardoza under the [MIT license](LICENSE.md).
248
+ © 2022 Zachary Cardoza under the [MIT license](LICENSE.md).
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueClick=t():e.VueClick=t()}(self,(function(){return(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ClickDirective:()=>a,default:()=>c});var n,o,u=/^(\d+)?(m|s|ms)?$/i,i=function(e){var t;void 0===e&&(e="");var n=u.exec(e);if(null!==n&&n.length>=3){var o=parseFloat(n[1]);switch((null!==(t=n[2])&&void 0!==t?t:"ms").toLowerCase()){case"m":return 6e4*o;case"s":return 1e3*o;case"ms":return o}}return null};!function(e){e.Single="single",e.Double="double",e.Hold="hold",e.Press="press",e.Release="release"}(n||(n={})),function(e){e.Once="once",e.Throttle="throttle",e.Debounce="debounce"}(o||(o={}));var r=function(e,t){return Object.keys(e).filter((function(n){return Object(e)[n]===t})).length>0},d=300,s=function(e){if(void 0!==e.dataset.vcBindClick||void 0!==e.dataset.vcBindDouble||void 0!==e.dataset.vcBindHold||void 0!==e.dataset.vcBindPress||void 0!==e.dataset.vcBindRelease)return function(){};var t=function(t){"mousedown"===t.type||"touchstart"===t.type?e.dataset.vcStateActive="":delete e.dataset.vcStateActive};return e.addEventListener("touchstart",t),e.addEventListener("touchend",t),e.addEventListener("mousedown",t),e.addEventListener("mouseup",t),function(){e.removeEventListener("touchstart",t),e.removeEventListener("touchend",t),e.removeEventListener("mousedown",t),e.removeEventListener("mouseup",t),e.dataset.vcStateDeactivated=""}},a={mounted:function(e,t){var a=function(e){var t,d={behavior:n.Single,modifier:null,time:null,argument:null,once:!1,dispatch:function(){}};for(var s in e.modifiers){var a=s.split(":");void 0!==a[1]&&(d.argument=a[1]),void 0===(t=a[0])&&(t=""),u.test(t)?d.time=i(a[0]):r(n,a[0])?d.behavior=a[0]:r(o,a[0])&&(d.modifier=a[0])}return void 0!==e.arg&&(d.argument=e.arg),"function"==typeof e.value&&(d.dispatch=function(){return e.value(d.argument)}),d}(t),c=function(){return a.dispatch()};switch(a.modifier){case o.Once:c=function(e){return function(t){t(),e.dispatch()}}(a);break;case o.Throttle:c=function(e){var t,n=null!==(t=e.time)&&void 0!==t?t:d,o=null;return function(){null===o?e.dispatch():clearTimeout(o),o=window.setTimeout((function(){o=null}),n)}}(a);break;case o.Debounce:c=function(e){var t,n=null!==(t=e.time)&&void 0!==t?t:d,o=null;return function(){null!==o&&clearTimeout(o),o=window.setTimeout((function(){o=null,e.dispatch()}),n)}}(a)}switch(a.behavior){case n.Single:!function(e,t,n){var o,u=null,i=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),"mousedown"===t.type||"touchstart"===t.type?(null!==u&&clearTimeout(u),u=window.setTimeout((function(){null!==u&&(clearTimeout(u),u=null)}),300)):"mouseup"!==t.type&&"touchend"!==t.type||null===u||(clearTimeout(u),u=null,n((function(){r(),e.removeEventListener("touchstart",i),e.removeEventListener("touchend",i),e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",i),delete e.dataset.vcBindClick}))))},r=s(e);e.addEventListener("touchstart",i),e.addEventListener("touchend",i),e.addEventListener("mousedown",i),e.addEventListener("mouseup",i),e.dataset.vcBindClick=null!==(o=t.modifier)&&void 0!==o?o:""}(e,a,c);break;case n.Double:!function(e,t,n){var o,u,i=null!==(o=t.time)&&void 0!==o?o:d,r=null,a=0,c=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),"mousedown"===t.type||"touchstart"===t.type?(null!==r&&clearTimeout(r),r=window.setTimeout((function(){null!==r&&(clearTimeout(r),r=null,a=0)}),300)):"mouseup"!==t.type&&"touchend"!==t.type||null===r||(clearTimeout(r),r=null,0===a?(a++,r=window.setTimeout((function(){null!==r&&(clearTimeout(r),r=null,a=0)}),i)):(a=0,n((function(){l(),e.removeEventListener("touchstart",c),e.removeEventListener("touchend",c),e.removeEventListener("mousedown",c),e.removeEventListener("mouseup",c),delete e.dataset.vcBindDouble})))))},l=s(e);e.addEventListener("touchstart",c),e.addEventListener("touchend",c),e.addEventListener("mousedown",c),e.addEventListener("mouseup",c),e.dataset.vcBindDouble=null!==(u=t.modifier)&&void 0!==u?u:""}(e,a,c);break;case n.Hold:!function(e,t,n){var o,u,i=null!==(o=t.time)&&void 0!==o?o:d,r=null,a=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),"mousedown"===t.type||"touchstart"===t.type?r=window.setTimeout((function(){n((function(){c(),e.removeEventListener("touchstart",a),e.removeEventListener("touchend",a),e.removeEventListener("mousedown",a),e.removeEventListener("mouseup",a),delete e.dataset.vcBindHold}))}),i):"mouseup"!==t.type&&"touchend"!==t.type||null===r||(clearTimeout(r),r=null))},c=s(e);e.addEventListener("touchstart",a),e.addEventListener("touchend",a),e.addEventListener("mousedown",a),e.addEventListener("mouseup",a),e.dataset.vcBindHold=null!==(u=t.modifier)&&void 0!==u?u:""}(e,a,c);break;case n.Press:!function(e,t,n){var o,u=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),n((function(){i(),e.removeEventListener("touchend",u),e.removeEventListener("mousedown",u),delete e.dataset.vcBindPress})))},i=s(e);e.addEventListener("touchstart",u),e.addEventListener("mousedown",u),e.dataset.vcBindPress=null!==(o=t.modifier)&&void 0!==o?o:""}(e,a,c);break;case n.Release:!function(e,t,n){var o,u="vcBindRelease",i=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),n((function(){r(),e.removeEventListener("touchend",i),e.removeEventListener("mouseup",i),delete e.dataset[u]})))},r=s(e);e.addEventListener("touchend",i),e.addEventListener("mouseup",i),e.dataset[u]=null!==(o=t.modifier)&&void 0!==o?o:""}(e,a,c)}}};const c={install:function(e){e.directive("click",a)}};return t})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueClick=t():e.VueClick=t()}(self,(function(){return(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ClickDirective:()=>c,default:()=>l});var n,o,u=/^(\d+)?(m|s|ms)?$/i,i=function(e){var t;void 0===e&&(e="");var n=u.exec(e);if(null!==n&&n.length>=3){var o=parseFloat(n[1]);switch((null!==(t=n[2])&&void 0!==t?t:"ms").toLowerCase()){case"m":return 6e4*o;case"s":return 1e3*o;case"ms":return o}}return null};!function(e){e.Single="single",e.Double="double",e.Hold="hold",e.Press="press",e.Release="release"}(n||(n={})),function(e){e.Once="once",e.Throttle="throttle",e.Debounce="debounce"}(o||(o={}));var r=function(e,t){return Object.keys(e).filter((function(n){return Object(e)[n]===t})).length>0},d=300,s={capture:!0,passive:!1},a=function(e){if(void 0!==e.dataset.vcBindClick||void 0!==e.dataset.vcBindDouble||void 0!==e.dataset.vcBindHold||void 0!==e.dataset.vcBindPress||void 0!==e.dataset.vcBindRelease)return function(){};var t=function(t){"mousedown"===t.type||"touchstart"===t.type?e.dataset.vcStateActive="":delete e.dataset.vcStateActive};return e.addEventListener("touchstart",t,s),e.addEventListener("touchend",t,s),e.addEventListener("mousedown",t,s),e.addEventListener("mouseup",t,s),function(){e.removeEventListener("touchstart",t,s),e.removeEventListener("touchend",t,s),e.removeEventListener("mousedown",t,s),e.removeEventListener("mouseup",t,s),e.dataset.vcStateDeactivated=""}},c={mounted:function(e,t){var c=function(e){var t,d={behavior:n.Single,modifier:null,time:null,argument:null,once:!1,dispatch:function(){}};for(var s in e.modifiers){var a=s.split(":");void 0!==a[1]&&(d.argument=a[1]),void 0===(t=a[0])&&(t=""),u.test(t)?d.time=i(a[0]):r(n,a[0])?d.behavior=a[0]:r(o,a[0])&&(d.modifier=a[0])}return void 0!==e.arg&&(d.argument=e.arg),"function"==typeof e.value&&(d.dispatch=function(){return e.value(d.argument)}),d}(t),l=function(){return c.dispatch()};switch(c.modifier){case o.Once:l=function(e){return function(t){t(),e.dispatch()}}(c);break;case o.Throttle:l=function(e){var t,n=null!==(t=e.time)&&void 0!==t?t:d,o=null;return function(){null===o?e.dispatch():clearTimeout(o),o=window.setTimeout((function(){o=null}),n)}}(c);break;case o.Debounce:l=function(e){var t,n=null!==(t=e.time)&&void 0!==t?t:d,o=null;return function(){null!==o&&clearTimeout(o),o=window.setTimeout((function(){o=null,e.dispatch()}),n)}}(c)}var v=function(t){!0!==e.disabled&&l(t)};switch(c.behavior){case n.Single:!function(e,t,n){var o,u=null,i=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),"mousedown"===t.type||"touchstart"===t.type?(null!==u&&clearTimeout(u),u=window.setTimeout((function(){null!==u&&(clearTimeout(u),u=null)}),300)):"mouseup"!==t.type&&"touchend"!==t.type||null===u||(clearTimeout(u),u=null,n((function(){r(),e.removeEventListener("touchstart",i,s),e.removeEventListener("touchend",i,s),e.removeEventListener("mousedown",i,s),e.removeEventListener("mouseup",i,s),delete e.dataset.vcBindClick}))))},r=a(e);e.addEventListener("touchstart",i,s),e.addEventListener("touchend",i,s),e.addEventListener("mousedown",i,s),e.addEventListener("mouseup",i,s),e.dataset.vcBindClick=null!==(o=t.modifier)&&void 0!==o?o:""}(e,c,v);break;case n.Double:!function(e,t,n){var o,u,i=null!==(o=t.time)&&void 0!==o?o:d,r=null,c=0,l=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),"mousedown"===t.type||"touchstart"===t.type?(null!==r&&clearTimeout(r),r=window.setTimeout((function(){null!==r&&(clearTimeout(r),r=null,c=0)}),300)):"mouseup"!==t.type&&"touchend"!==t.type||null===r||(clearTimeout(r),r=null,0===c?(c++,r=window.setTimeout((function(){null!==r&&(clearTimeout(r),r=null,c=0)}),i)):(c=0,n((function(){v(),e.removeEventListener("touchstart",l,s),e.removeEventListener("touchend",l,s),e.removeEventListener("mousedown",l,s),e.removeEventListener("mouseup",l,s),delete e.dataset.vcBindDouble})))))},v=a(e);e.addEventListener("touchstart",l,s),e.addEventListener("touchend",l,s),e.addEventListener("mousedown",l,s),e.addEventListener("mouseup",l,s),e.dataset.vcBindDouble=null!==(u=t.modifier)&&void 0!==u?u:""}(e,c,v);break;case n.Hold:!function(e,t,n){var o,u,i=null!==(o=t.time)&&void 0!==o?o:d,r=null,c=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),"mousedown"===t.type||"touchstart"===t.type?r=window.setTimeout((function(){n((function(){l(),e.removeEventListener("touchstart",c,s),e.removeEventListener("touchend",c,s),e.removeEventListener("mousedown",c,s),e.removeEventListener("mouseup",c,s),delete e.dataset.vcBindHold}))}),i):"mouseup"!==t.type&&"touchend"!==t.type||null===r||(clearTimeout(r),r=null))},l=a(e);e.addEventListener("touchstart",c,s),e.addEventListener("touchend",c,s),e.addEventListener("mousedown",c,s),e.addEventListener("mouseup",c,s),e.dataset.vcBindHold=null!==(u=t.modifier)&&void 0!==u?u:""}(e,c,v);break;case n.Press:!function(e,t,n){var o,u=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),n((function(){i(),e.removeEventListener("touchend",u,s),e.removeEventListener("mousedown",u,s),delete e.dataset.vcBindPress})))},i=a(e);e.addEventListener("touchstart",u,s),e.addEventListener("mousedown",u,s),e.dataset.vcBindPress=null!==(o=t.modifier)&&void 0!==o?o:""}(e,c,v);break;case n.Release:!function(e,t,n){var o,u="vcBindRelease",i=function(t){t.isTrusted&&(t.cancelable&&t.preventDefault(),n((function(){r(),e.removeEventListener("touchend",i,s),e.removeEventListener("mouseup",i,s),delete e.dataset[u]})))},r=a(e);e.addEventListener("touchend",i,s),e.addEventListener("mouseup",i,s),e.dataset[u]=null!==(o=t.modifier)&&void 0!==o?o:""}(e,c,v)}}};const l={install:function(e){e.directive("click",c)}};return t})()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-click",
3
- "version": "2.1.3",
3
+ "version": "2.1.6",
4
4
  "private": false,
5
5
  "description": "Vue plugin for advanced click directive.",
6
6
  "author": "Zachary Cardoza",