shorter-js
Advanced tools
Comparing version 0.0.5 to 0.0.6
/*! | ||
* shorter-js v0.0.5 (https://thednp.github.io/shorter-js/) | ||
* shorter-js v0.0.6 (https://thednp.github.io/shorter-js/) | ||
* Copyright 2019-2020 © dnp_theme | ||
@@ -18,2 +18,4 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE) | ||
var mouseSwipeEvents = { start: 'mousedown', end: 'mouseup', move:'mousemove', cancel:'mouseup' }; | ||
var transitionDuration = 'webkitTransition' in document.body.style ? 'webkitTransitionDuration' : 'transitionDuration'; | ||
@@ -23,2 +25,4 @@ | ||
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); | ||
var support3DTransform = 'webkitPerspective' in document.body.style || 'perspective' in document.body.style; | ||
@@ -60,2 +64,4 @@ | ||
var supportTouch = ('ontouchstart' in window || navigator.msMaxTouchPoints)||false; | ||
var supportTransition = 'webkitTransition' in document.body.style || 'transition' in document.body.style; | ||
@@ -124,4 +130,6 @@ | ||
exports.isElementInViewport = isElementInViewport; | ||
exports.isMobile = isMobile; | ||
exports.mouseClickEvents = mouseClickEvents; | ||
exports.mouseHoverEvents = mouseHoverEvents; | ||
exports.mouseSwipeEvents = mouseSwipeEvents; | ||
exports.off = off; | ||
@@ -135,2 +143,3 @@ exports.on = on; | ||
exports.supportPassive = supportPassive; | ||
exports.supportTouch = supportTouch; | ||
exports.supportTransform = supportTransform; | ||
@@ -137,0 +146,0 @@ exports.supportTransition = supportTransition; |
@@ -1,2 +0,2 @@ | ||
// shorter-js v0.0.5 | dnp_theme © 2020 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).SHORTER={})}(this,(function(e){"use strict";var t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",o="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",i="webkitPerspective"in document.body.style||"perspective"in document.body.style;function r(e,t,n,o){o=o||!1,e.addEventListener(t,n,o)}function s(e,t,n,o){o=o||!1,e.removeEventListener(t,n,o)}function u(e,t,n,o){r(e,t,(function i(r){r.target===e&&(n(r),s(e,t,i,o))}),o)}var c=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});u(document,"DOMContentLoaded",(function(){}),t)}catch(e){}return e}(),a="webkitTransform"in document.body.style||"transform"in document.body.style,d="webkitTransition"in document.body.style||"transition"in document.body.style;function m(e){var t=d?window.getComputedStyle(e)[n]:0;return t="number"!=typeof(t=parseFloat(t))||isNaN(t)?0:1e3*t}var l=!!c&&{passive:!0};e.addClass=function(e,t){e.classList.add(t)},e.emulateTransitionEnd=function(e,t){var n=0;m(e)?u(e,o,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},e.getElementTransitionDuration=m,e.hasClass=function(e,t){return e.classList.contains(t)},e.isElementInScrollRange=function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},e.isElementInViewport=function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},e.mouseClickEvents={down:"mousedown",up:"mouseup"},e.mouseHoverEvents=t,e.off=s,e.on=r,e.one=u,e.passiveHandler=l,e.queryElement=function(e,t){var n=t&&t instanceof Element?t:document;return e instanceof Element?e:n.querySelector(e)},e.removeClass=function(e,t){e.classList.remove(t)},e.support3DTransform=i,e.supportPassive=c,e.supportTransform=a,e.supportTransition=d,e.touchEvents={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},e.transitionDuration=n,e.transitionEndEvent=o,e.tryWrapper=function(e,t){try{e()}catch(e){console.error(t+": "+e)}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
// shorter-js v0.0.6 | dnp_theme © 2020 | MIT-License | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).SHORTER={})}(this,(function(e){"use strict";var t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",o="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",i=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),s="webkitPerspective"in document.body.style||"perspective"in document.body.style;function r(e,t,n,o){o=o||!1,e.addEventListener(t,n,o)}function u(e,t,n,o){o=o||!1,e.removeEventListener(t,n,o)}function c(e,t,n,o){r(e,t,(function i(s){s.target===e&&(n(s),u(e,t,i,o))}),o)}var a=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});c(document,"DOMContentLoaded",(function(){}),t)}catch(e){}return e}(),d="webkitTransform"in document.body.style||"transform"in document.body.style,m="ontouchstart"in window||navigator.msMaxTouchPoints||!1,l="webkitTransition"in document.body.style||"transition"in document.body.style;function f(e){var t=l?window.getComputedStyle(e)[n]:0;return t="number"!=typeof(t=parseFloat(t))||isNaN(t)?0:1e3*t}var p=!!a&&{passive:!0};e.addClass=function(e,t){e.classList.add(t)},e.emulateTransitionEnd=function(e,t){var n=0;f(e)?c(e,o,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},e.getElementTransitionDuration=f,e.hasClass=function(e,t){return e.classList.contains(t)},e.isElementInScrollRange=function(e){var t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return t.top<=n&&t.bottom>=0},e.isElementInViewport=function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},e.isMobile=i,e.mouseClickEvents={down:"mousedown",up:"mouseup"},e.mouseHoverEvents=t,e.mouseSwipeEvents={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseup"},e.off=u,e.on=r,e.one=c,e.passiveHandler=p,e.queryElement=function(e,t){var n=t&&t instanceof Element?t:document;return e instanceof Element?e:n.querySelector(e)},e.removeClass=function(e,t){e.classList.remove(t)},e.support3DTransform=s,e.supportPassive=a,e.supportTouch=m,e.supportTransform=d,e.supportTransition=l,e.touchEvents={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},e.transitionDuration=n,e.transitionEndEvent=o,e.tryWrapper=function(e,t){try{e()}catch(e){console.error(t+": "+e)}},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "shorter-js", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A small ES6/ES7 library with various JavaScript tools useful for creating light libraries.", | ||
"main": "dist/shorter-js.js", | ||
"module": "src/index.js", | ||
"main": "dist/shorter-js.min.js", | ||
"module": "dist/shorter-js.esm.js", | ||
"jsnext": "src/index.js", | ||
"files" :[ | ||
"dist/*.{js,map}", | ||
"src/**/*.{js,map}" | ||
], | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "rollup --environment FORMAT:umd,MIN:false -c && rollup --environment FORMAT:umd,MIN:true -c", | ||
"min": "rollup --environment FORMAT:umd,MIN:true -c" | ||
"build": "npm run umd && npm run umdmin && npm run esm && npm run esmmin", | ||
"umd": "rollup --environment FORMAT:umd,MIN:false -c", | ||
"umdmin": "rollup --environment FORMAT:umd,MIN:true -c", | ||
"esm": "rollup --environment FORMAT:esm,MIN:false -c", | ||
"esmmin": "rollup --environment FORMAT:esm,MIN:true -c" | ||
}, | ||
@@ -12,0 +20,0 @@ "repository": { |
# shorter-js | ||
**A small ES6/ES7 library with various JavaScript tools useful for creating light libraries. | ||
Featured in [KUTE.js](https://github.com/thednp/kute.js), [BSN](https://github.com/thednp/bootstrap.native) and other libraries.** | ||
Featured in [KUTE.js](https://github.com/thednp/kute.js), [BSN](https://github.com/thednp/bootstrap.native), [Navbar.js](https://github.com/thednp/navbar.js) and other libraries.** | ||
@@ -25,6 +25,8 @@ * The purpose if the library is to speed up the development workflow, minimize the size of larger libraries by providing a shorter syntax for most used JavaScript API methods, most used strings or other helpful utilities. | ||
# boolean | ||
* ***support3DTransform*** - checks preserves the client browser capability for webKit `perspective` | ||
* ***isMobile*** - checks and preserves the client browser is a on Mobile device | ||
* ***support3DTransform*** - checks and preserves the client browser capability for webKit `perspective` | ||
* ***supportTouch*** - checks and preserves the client browser capability for `touch` events | ||
* ***supportPassive*** - checks and preserves the client browser capability for `passive` event option | ||
* ***supportTransform*** - checks and preserves the client browser capability for webKit `transform` | ||
* ***supportTransition*** - checks and preserves the client browser capability for webKit `transition` | ||
* ***supportPassive*** - checks and preserves the client browser capability for `passive` event option | ||
@@ -83,3 +85,4 @@ ```js | ||
* ***queryElement*** - a simple utility to check if a certain item is an *Element* or a selector string, and if a selector string find the FIRST *Element* and return it | ||
* ***tryWrapper*** - a simple `try()` and `catch()` wrapper for functions | ||
* ***tryWrapper*** - a simple `try()` and `catch()` wrapper for functions, with option to preffix the error logs, poiting out the source of the errors | ||
```js | ||
@@ -103,2 +106,3 @@ // EXAMPLES | ||
# strings | ||
* ***mouseSwipeEvents*** - preserves the pointer events from mouse actions: start: `mousedown`, end: `mouseup`, move: `mousemove`, cancel: `mouseup` | ||
* ***mouseClickEvents*** - preserves the pointer events from mouse actions: down: `mousedown`, up: `mouseup` | ||
@@ -105,0 +109,0 @@ * ***mouseHoverEvents*** - preserve browser specific mouse hover events: `mouseenter` and `mouseleave` OR `mouseover` and `mouseout` |
@@ -5,2 +5,3 @@ // strings FIRST | ||
export {touchEvents} from './strings/touchEvents.js' | ||
export {mouseSwipeEvents} from './strings/mouseSwipeEvents.js' | ||
export {transitionDuration} from './strings/transitionDuration.js' | ||
@@ -10,5 +11,7 @@ export {transitionEndEvent} from './strings/transitionEndEvent.js' | ||
// boolean | ||
export {isMobile} from './boolean/isMobile.js' | ||
export {support3DTransform} from './boolean/support3DTransform.js' | ||
export {supportPassive} from './boolean/supportPassive.js' | ||
export {supportTransform} from './boolean/supportTransform.js' | ||
export {supportTouch} from './boolean/supportTouch.js' | ||
export {supportTransition} from './boolean/supportTransition.js' | ||
@@ -15,0 +18,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
29419
33
343
134
0