Socket
Socket
Sign inDemoInstall

@pluginjs/feature

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pluginjs/feature - npm Package Compare versions

Comparing version 0.7.8 to 0.7.9

148

dist/feature.common.js
/*!
* @pluginjs/feature v0.7.8 (https://pluginjs.com)
* @pluginjs/feature v0.7.9 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
undefined
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/* eslint no-undef: "off" */
/* Credit to http://featurejs.com MIT */
/**
* Test if it's an old device that we want to filter out
*/
const old = () => Boolean(/(Android\s(1.|2.))|(Silk\/1.)/i.test(navigator.userAgent));
/**
* Function that takes a standard CSS property name as a parameter and
* returns it's prefixed version valid for current browser it runs in
*/
const pfx = function () {
const prefixes = ['Webkit', 'Moz', 'O', 'ms'];
const memory = {};
const style = document.createElement('dummy').style;
return function (prop) {
if (typeof memory[prop] === 'undefined') {
const ucProp = prop.charAt(0).toUpperCase() + prop.substr(1);
const props = "".concat(prop, " ").concat(prefixes.join("".concat(ucProp, " "))).concat(ucProp).split(' ');
memory[prop] = null;
for (const i in props) {
if (typeof style[props[i]] !== 'undefined') {
memory[prop] = props[i];
break;
}
}
}
return memory[prop];
};
}();
function prefixedProperty(property) {
return pfx(property);
}
const transitionProperty = () => pfx('transition');
const transformProperty = () => pfx('transform');
const animationProperty = () => pfx('animation');
const transitionEndEvent = () => {
const eventNames = {
transition: 'transitionend',
OTransition: 'oTransitionEnd',
MozTransition: 'transitionend',
WebkitTransition: 'webkitTransitionEnd'
};
const style = document.createElement('dummy').style;
for (const i in eventNames) {
if (Object.prototype.hasOwnProperty.call(eventNames, i)) {
if (typeof style[i] !== 'undefined') {
return eventNames[i];
}
}
}
return false;
};
const animationEndEvent = () => {
const eventNames = {
animation: 'animationend',
OAnimation: 'oanimationend',
msAnimation: 'MSAnimationEnd',
MozAnimation: 'animationend',
WebkitAnimation: 'webkitAnimationEnd' // const style = document.body.style
};
const style = {};
for (const i in eventNames) {
if (Object.prototype.hasOwnProperty.call(eventNames, i)) {
if (typeof style[i] !== 'undefined') {
return eventNames[i];
}
}
}
return false;
}; // Test if CSS 3D transforms are supported
const transform3D = () => {
const test = !old() && pfx('perspective') !== null;
return Boolean(test);
}; // Test if CSS transforms are supported
const transform = () => {
const test = !old() && pfx('transformOrigin') !== null;
return Boolean(test);
}; // Test if CSS transitions are supported
const transition = () => {
const test = pfx('transition') !== null;
return Boolean(test);
}; // Test if CSS sticky are supported
const sticky = () => {
let _canSticky = false;
const documentFragment = document.documentElement;
const testElement = document.createElement('div');
documentFragment.appendChild(testElement);
const prefixedSticky = ['sticky', '-webkit-sticky'];
for (let i = 0; i < prefixedSticky.length; i++) {
testElement.style.position = prefixedSticky[i];
_canSticky = Boolean(window.getComputedStyle(testElement).position.match('sticky'));
if (_canSticky) {
break;
}
}
documentFragment.removeChild(testElement);
return _canSticky;
}; // Test if SVG is supported
const svg = () => Boolean(document.createElementNS) && Boolean(document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect); // Tests if touch events are supported, but doesn't necessarily reflect a touchscreen device
const touch = Boolean('ontouchstart' in window || window.navigator && window.navigator.msPointerEnabled && window.MSGesture || window.DocumentTouch && document instanceof DocumentTouch);
const pointer = window.PointerEvent || window.MSPointerEvent ? true : false; // eslint-disable-line no-unneeded-ternary
function pointerEvent(pointerEvent) {
return window.MSPointerEvent ? "MSPointer".concat(pointerEvent.charAt(9).toUpperCase()).concat(pointerEvent.substr(10)) : pointerEvent;
}
exports.animationEndEvent = animationEndEvent;
exports.animationProperty = animationProperty;
exports.pointer = pointer;
exports.pointerEvent = pointerEvent;
exports.prefixedProperty = prefixedProperty;
exports.sticky = sticky;
exports.svg = svg;
exports.touch = touch;
exports.transform = transform;
exports.transform3D = transform3D;
exports.transformProperty = transformProperty;
exports.transition = transition;
exports.transitionEndEvent = transitionEndEvent;
exports.transitionProperty = transitionProperty;

4

dist/feature.common.min.js
/*!
* @pluginjs/feature v0.7.8 (https://pluginjs.com)
* @pluginjs/feature v0.7.9 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
undefined
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const old=()=>Boolean(/(Android\s(1.|2.))|(Silk\/1.)/i.test(navigator.userAgent)),pfx=function(){const t=["Webkit","Moz","O","ms"],n={},o=document.createElement("dummy").style;return function(e){if(void 0===n[e]){const r=e.charAt(0).toUpperCase()+e.substr(1),i="".concat(e," ").concat(t.join("".concat(r," "))).concat(r).split(" ");n[e]=null;for(const t in i)if(void 0!==o[i[t]]){n[e]=i[t];break}}return n[e]}}();function prefixedProperty(t){return pfx(t)}const transitionProperty=()=>pfx("transition"),transformProperty=()=>pfx("transform"),animationProperty=()=>pfx("animation"),transitionEndEvent=()=>{const t={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=document.createElement("dummy").style;for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&void 0!==n[o])return t[o];return!1},animationEndEvent=()=>{const t={animation:"animationend",OAnimation:"oanimationend",msAnimation:"MSAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"},n={};for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&void 0!==n[o])return t[o];return!1},transform3D=()=>{const t=!old()&&null!==pfx("perspective");return Boolean(t)},transform=()=>{const t=!old()&&null!==pfx("transformOrigin");return Boolean(t)},transition=()=>{const t=null!==pfx("transition");return Boolean(t)},sticky=()=>{let t=!1;const n=document.documentElement,o=document.createElement("div");n.appendChild(o);const e=["sticky","-webkit-sticky"];for(let n=0;n<e.length&&(o.style.position=e[n],!(t=Boolean(window.getComputedStyle(o).position.match("sticky"))));n++);return n.removeChild(o),t},svg=()=>Boolean(document.createElementNS)&&Boolean(document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),touch=Boolean("ontouchstart"in window||window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture||window.DocumentTouch&&document instanceof DocumentTouch),pointer=!(!window.PointerEvent&&!window.MSPointerEvent);function pointerEvent(t){return window.MSPointerEvent?"MSPointer".concat(t.charAt(9).toUpperCase()).concat(t.substr(10)):t}exports.animationEndEvent=animationEndEvent,exports.animationProperty=animationProperty,exports.pointer=pointer,exports.pointerEvent=pointerEvent,exports.prefixedProperty=prefixedProperty,exports.sticky=sticky,exports.svg=svg,exports.touch=touch,exports.transform=transform,exports.transform3D=transform3D,exports.transformProperty=transformProperty,exports.transition=transition,exports.transitionEndEvent=transitionEndEvent,exports.transitionProperty=transitionProperty;
/*!
* @pluginjs/feature v0.7.8 (https://pluginjs.com)
* @pluginjs/feature v0.7.9 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
undefined
/* eslint no-undef: "off" */
/* Credit to http://featurejs.com MIT */
/**
* Test if it's an old device that we want to filter out
*/
const old = () => Boolean(/(Android\s(1.|2.))|(Silk\/1.)/i.test(navigator.userAgent));
/**
* Function that takes a standard CSS property name as a parameter and
* returns it's prefixed version valid for current browser it runs in
*/
const pfx = function () {
const prefixes = ['Webkit', 'Moz', 'O', 'ms'];
const memory = {};
const style = document.createElement('dummy').style;
return function (prop) {
if (typeof memory[prop] === 'undefined') {
const ucProp = prop.charAt(0).toUpperCase() + prop.substr(1);
const props = "".concat(prop, " ").concat(prefixes.join("".concat(ucProp, " "))).concat(ucProp).split(' ');
memory[prop] = null;
for (const i in props) {
if (typeof style[props[i]] !== 'undefined') {
memory[prop] = props[i];
break;
}
}
}
return memory[prop];
};
}();
function prefixedProperty(property) {
return pfx(property);
}
const transitionProperty = () => pfx('transition');
const transformProperty = () => pfx('transform');
const animationProperty = () => pfx('animation');
const transitionEndEvent = () => {
const eventNames = {
transition: 'transitionend',
OTransition: 'oTransitionEnd',
MozTransition: 'transitionend',
WebkitTransition: 'webkitTransitionEnd'
};
const style = document.createElement('dummy').style;
for (const i in eventNames) {
if (Object.prototype.hasOwnProperty.call(eventNames, i)) {
if (typeof style[i] !== 'undefined') {
return eventNames[i];
}
}
}
return false;
};
const animationEndEvent = () => {
const eventNames = {
animation: 'animationend',
OAnimation: 'oanimationend',
msAnimation: 'MSAnimationEnd',
MozAnimation: 'animationend',
WebkitAnimation: 'webkitAnimationEnd' // const style = document.body.style
};
const style = {};
for (const i in eventNames) {
if (Object.prototype.hasOwnProperty.call(eventNames, i)) {
if (typeof style[i] !== 'undefined') {
return eventNames[i];
}
}
}
return false;
}; // Test if CSS 3D transforms are supported
const transform3D = () => {
const test = !old() && pfx('perspective') !== null;
return Boolean(test);
}; // Test if CSS transforms are supported
const transform = () => {
const test = !old() && pfx('transformOrigin') !== null;
return Boolean(test);
}; // Test if CSS transitions are supported
const transition = () => {
const test = pfx('transition') !== null;
return Boolean(test);
}; // Test if CSS sticky are supported
const sticky = () => {
let _canSticky = false;
const documentFragment = document.documentElement;
const testElement = document.createElement('div');
documentFragment.appendChild(testElement);
const prefixedSticky = ['sticky', '-webkit-sticky'];
for (let i = 0; i < prefixedSticky.length; i++) {
testElement.style.position = prefixedSticky[i];
_canSticky = Boolean(window.getComputedStyle(testElement).position.match('sticky'));
if (_canSticky) {
break;
}
}
documentFragment.removeChild(testElement);
return _canSticky;
}; // Test if SVG is supported
const svg = () => Boolean(document.createElementNS) && Boolean(document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect); // Tests if touch events are supported, but doesn't necessarily reflect a touchscreen device
const touch = Boolean('ontouchstart' in window || window.navigator && window.navigator.msPointerEnabled && window.MSGesture || window.DocumentTouch && document instanceof DocumentTouch);
const pointer = window.PointerEvent || window.MSPointerEvent ? true : false; // eslint-disable-line no-unneeded-ternary
function pointerEvent(pointerEvent) {
return window.MSPointerEvent ? "MSPointer".concat(pointerEvent.charAt(9).toUpperCase()).concat(pointerEvent.substr(10)) : pointerEvent;
}
export { animationEndEvent, animationProperty, pointer, pointerEvent, prefixedProperty, sticky, svg, touch, transform, transform3D, transformProperty, transition, transitionEndEvent, transitionProperty };
/*!
* @pluginjs/feature v0.7.8 (https://pluginjs.com)
* @pluginjs/feature v0.7.9 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
undefined
const n=()=>Boolean(/(Android\s(1.|2.))|(Silk\/1.)/i.test(navigator.userAgent)),t=function(){const n=["Webkit","Moz","O","ms"],t={},o=document.createElement("dummy").style;return function(e){if(void 0===t[e]){const i=e.charAt(0).toUpperCase()+e.substr(1),r="".concat(e," ").concat(n.join("".concat(i," "))).concat(i).split(" ");t[e]=null;for(const n in r)if(void 0!==o[r[n]]){t[e]=r[n];break}}return t[e]}}();function o(n){return t(n)}const e=()=>t("transition"),i=()=>t("transform"),r=()=>t("animation"),a=()=>{const n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},t=document.createElement("dummy").style;for(const o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&void 0!==t[o])return n[o];return!1},c=()=>{const n={animation:"animationend",OAnimation:"oanimationend",msAnimation:"MSAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"},t={};for(const o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&void 0!==t[o])return n[o];return!1},s=()=>{const o=!n()&&null!==t("perspective");return Boolean(o)},d=()=>{const o=!n()&&null!==t("transformOrigin");return Boolean(o)},u=()=>{const n=null!==t("transition");return Boolean(n)},m=()=>{let n=!1;const t=document.documentElement,o=document.createElement("div");t.appendChild(o);const e=["sticky","-webkit-sticky"];for(let t=0;t<e.length&&(o.style.position=e[t],!(n=Boolean(window.getComputedStyle(o).position.match("sticky"))));t++);return t.removeChild(o),n},l=()=>Boolean(document.createElementNS)&&Boolean(document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),w=Boolean("ontouchstart"in window||window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture||window.DocumentTouch&&document instanceof DocumentTouch),p=!(!window.PointerEvent&&!window.MSPointerEvent);function f(n){return window.MSPointerEvent?"MSPointer".concat(n.charAt(9).toUpperCase()).concat(n.substr(10)):n}export{c as animationEndEvent,r as animationProperty,p as pointer,f as pointerEvent,o as prefixedProperty,m as sticky,l as svg,w as touch,d as transform,s as transform3D,i as transformProperty,u as transition,a as transitionEndEvent,e as transitionProperty};
/*!
* @pluginjs/feature v0.7.8 (https://pluginjs.com)
* @pluginjs/feature v0.7.9 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
undefined
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global['@pluginjs/feature'] = {}));
}(this, function (exports) { 'use strict';
/* eslint no-undef: "off" */
/* Credit to http://featurejs.com MIT */
/**
* Test if it's an old device that we want to filter out
*/
var old = function old() {
return Boolean(/(Android\s(1.|2.))|(Silk\/1.)/i.test(navigator.userAgent));
};
/**
* Function that takes a standard CSS property name as a parameter and
* returns it's prefixed version valid for current browser it runs in
*/
var pfx = function () {
var prefixes = ['Webkit', 'Moz', 'O', 'ms'];
var memory = {};
var style = document.createElement('dummy').style;
return function (prop) {
if (typeof memory[prop] === 'undefined') {
var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1);
var props = "".concat(prop, " ").concat(prefixes.join("".concat(ucProp, " "))).concat(ucProp).split(' ');
memory[prop] = null;
for (var i in props) {
if (typeof style[props[i]] !== 'undefined') {
memory[prop] = props[i];
break;
}
}
}
return memory[prop];
};
}();
function prefixedProperty(property) {
return pfx(property);
}
var transitionProperty = function transitionProperty() {
return pfx('transition');
};
var transformProperty = function transformProperty() {
return pfx('transform');
};
var animationProperty = function animationProperty() {
return pfx('animation');
};
var transitionEndEvent = function transitionEndEvent() {
var eventNames = {
transition: 'transitionend',
OTransition: 'oTransitionEnd',
MozTransition: 'transitionend',
WebkitTransition: 'webkitTransitionEnd'
};
var style = document.createElement('dummy').style;
for (var i in eventNames) {
if (Object.prototype.hasOwnProperty.call(eventNames, i)) {
if (typeof style[i] !== 'undefined') {
return eventNames[i];
}
}
}
return false;
};
var animationEndEvent = function animationEndEvent() {
var eventNames = {
animation: 'animationend',
OAnimation: 'oanimationend',
msAnimation: 'MSAnimationEnd',
MozAnimation: 'animationend',
WebkitAnimation: 'webkitAnimationEnd' // const style = document.body.style
};
var style = {};
for (var i in eventNames) {
if (Object.prototype.hasOwnProperty.call(eventNames, i)) {
if (typeof style[i] !== 'undefined') {
return eventNames[i];
}
}
}
return false;
}; // Test if CSS 3D transforms are supported
var transform3D = function transform3D() {
var test = !old() && pfx('perspective') !== null;
return Boolean(test);
}; // Test if CSS transforms are supported
var transform = function transform() {
var test = !old() && pfx('transformOrigin') !== null;
return Boolean(test);
}; // Test if CSS transitions are supported
var transition = function transition() {
var test = pfx('transition') !== null;
return Boolean(test);
}; // Test if CSS sticky are supported
var sticky = function sticky() {
var _canSticky = false;
var documentFragment = document.documentElement;
var testElement = document.createElement('div');
documentFragment.appendChild(testElement);
var prefixedSticky = ['sticky', '-webkit-sticky'];
for (var i = 0; i < prefixedSticky.length; i++) {
testElement.style.position = prefixedSticky[i];
_canSticky = Boolean(window.getComputedStyle(testElement).position.match('sticky'));
if (_canSticky) {
break;
}
}
documentFragment.removeChild(testElement);
return _canSticky;
}; // Test if SVG is supported
var svg = function svg() {
return Boolean(document.createElementNS) && Boolean(document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect);
}; // Tests if touch events are supported, but doesn't necessarily reflect a touchscreen device
var touch = Boolean('ontouchstart' in window || window.navigator && window.navigator.msPointerEnabled && window.MSGesture || window.DocumentTouch && document instanceof DocumentTouch);
var pointer = window.PointerEvent || window.MSPointerEvent ? true : false; // eslint-disable-line no-unneeded-ternary
function pointerEvent(pointerEvent) {
return window.MSPointerEvent ? "MSPointer".concat(pointerEvent.charAt(9).toUpperCase()).concat(pointerEvent.substr(10)) : pointerEvent;
}
exports.animationEndEvent = animationEndEvent;
exports.animationProperty = animationProperty;
exports.pointer = pointer;
exports.pointerEvent = pointerEvent;
exports.prefixedProperty = prefixedProperty;
exports.sticky = sticky;
exports.svg = svg;
exports.touch = touch;
exports.transform = transform;
exports.transform3D = transform3D;
exports.transformProperty = transformProperty;
exports.transition = transition;
exports.transitionEndEvent = transitionEndEvent;
exports.transitionProperty = transitionProperty;
Object.defineProperty(exports, '__esModule', { value: true });
}));
/*!
* @pluginjs/feature v0.7.8 (https://pluginjs.com)
* @pluginjs/feature v0.7.9 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
undefined
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self)["@pluginjs/feature"]={})}(this,function(n){"use strict";var t,o,e,i=function(){return Boolean(/(Android\s(1.|2.))|(Silk\/1.)/i.test(navigator.userAgent))},r=(t=["Webkit","Moz","O","ms"],o={},e=document.createElement("dummy").style,function(n){if(void 0===o[n]){var i=n.charAt(0).toUpperCase()+n.substr(1),r="".concat(n," ").concat(t.join("".concat(i," "))).concat(i).split(" ");for(var a in o[n]=null,r)if(void 0!==e[r[a]]){o[n]=r[a];break}}return o[n]});var a=Boolean("ontouchstart"in window||window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture||window.DocumentTouch&&document instanceof DocumentTouch),c=!(!window.PointerEvent&&!window.MSPointerEvent);n.animationEndEvent=function(){var n={animation:"animationend",OAnimation:"oanimationend",msAnimation:"MSAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"},t={};for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&void 0!==t[o])return n[o];return!1},n.animationProperty=function(){return r("animation")},n.pointer=c,n.pointerEvent=function(n){return window.MSPointerEvent?"MSPointer".concat(n.charAt(9).toUpperCase()).concat(n.substr(10)):n},n.prefixedProperty=function(n){return r(n)},n.sticky=function(){var n=!1,t=document.documentElement,o=document.createElement("div");t.appendChild(o);for(var e=["sticky","-webkit-sticky"],i=0;i<e.length&&(o.style.position=e[i],!(n=Boolean(window.getComputedStyle(o).position.match("sticky"))));i++);return t.removeChild(o),n},n.svg=function(){return Boolean(document.createElementNS)&&Boolean(document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect)},n.touch=a,n.transform=function(){var n=!i()&&null!==r("transformOrigin");return Boolean(n)},n.transform3D=function(){var n=!i()&&null!==r("perspective");return Boolean(n)},n.transformProperty=function(){return r("transform")},n.transition=function(){var n=null!==r("transition");return Boolean(n)},n.transitionEndEvent=function(){var n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},t=document.createElement("dummy").style;for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&void 0!==t[o])return n[o];return!1},n.transitionProperty=function(){return r("transition")},Object.defineProperty(n,"__esModule",{value:!0})});

@@ -14,3 +14,3 @@ {

},
"version": "0.7.8",
"version": "0.7.9",
"category": "utils",

@@ -38,4 +38,4 @@ "main": "dist/feature.common.js",

"@babel/core": "^7.4.4",
"@pluginjs/browserslist-config": "^1.2.5",
"@pluginjs/cli": "^0.7.8",
"@pluginjs/browserslist-config": "^1.2.6",
"@pluginjs/cli": "^0.7.9",
"babel-jest": "*",

@@ -66,3 +66,4 @@ "jest": "*",

],
"title": "Plugin"
"title": "Plugin",
"gitHead": "9ae759d6378f7bd8b952e5c1951dec91a101966e"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc