@pluginjs/feature
Advanced tools
Comparing version 0.2.19 to 0.6.1
/* eslint no-undef: "off" */ | ||
/* Credit to http://featurejs.com MIT */ | ||
/** | ||
@@ -8,3 +9,2 @@ * 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)); | ||
/** | ||
@@ -14,2 +14,4 @@ * Function that takes a standard CSS property name as a parameter and | ||
*/ | ||
const pfx = function () { | ||
@@ -26,3 +28,3 @@ const prefixes = ['Webkit', 'Moz', 'O', 'ms']; | ||
for (const i in props) { | ||
if (style[props[i]] !== undefined) { | ||
if (typeof style[props[i]] !== 'undefined') { | ||
memory[prop] = props[i]; | ||
@@ -33,2 +35,3 @@ break; | ||
} | ||
return memory[prop]; | ||
@@ -41,9 +44,5 @@ }; | ||
} | ||
const transitionProperty = () => pfx('transition'); | ||
const transformProperty = () => pfx('transform'); | ||
const animationProperty = () => pfx('animation'); | ||
const transitionEndEvent = () => { | ||
@@ -57,5 +56,6 @@ const eventNames = { | ||
const style = document.createElement('dummy').style; | ||
for (const i in eventNames) { | ||
if (eventNames.hasOwnProperty(i)) { | ||
if (style[i] !== undefined) { | ||
if (Object.prototype.hasOwnProperty.call(eventNames, i)) { | ||
if (typeof style[i] !== 'undefined') { | ||
return eventNames[i]; | ||
@@ -65,5 +65,5 @@ } | ||
} | ||
return false; | ||
}; | ||
const animationEndEvent = () => { | ||
@@ -75,8 +75,10 @@ const eventNames = { | ||
MozAnimation: 'animationend', | ||
WebkitAnimation: 'webkitAnimationEnd' | ||
// const style = document.body.style | ||
};const style = {}; | ||
WebkitAnimation: 'webkitAnimationEnd' // const style = document.body.style | ||
}; | ||
const style = {}; | ||
for (const i in eventNames) { | ||
if (eventNames.hasOwnProperty(i)) { | ||
if (style[i] !== undefined) { | ||
if (Object.prototype.hasOwnProperty.call(eventNames, i)) { | ||
if (typeof style[i] !== 'undefined') { | ||
return eventNames[i]; | ||
@@ -86,26 +88,22 @@ } | ||
} | ||
return false; | ||
}; | ||
}; // Test if CSS 3D transforms are supported | ||
// Test if CSS 3D transforms are supported | ||
const transform3D = () => { | ||
const test = !old() && pfx('perspective') !== null; | ||
return Boolean(test); | ||
}; | ||
}; // Test if CSS transforms are supported | ||
// Test if CSS transforms are supported | ||
const transform = () => { | ||
const test = !old() && pfx('transformOrigin') !== null; | ||
return Boolean(test); | ||
}; | ||
}; // Test if CSS transitions are supported | ||
// Test if CSS transitions are supported | ||
const transition = () => { | ||
const test = pfx('transition') !== null; | ||
return Boolean(test); | ||
}; | ||
}; // Test if CSS sticky are supported | ||
// Test if CSS sticky are supported | ||
const canSticky = () => { | ||
const sticky = () => { | ||
let _canSticky = false; | ||
@@ -120,2 +118,3 @@ const documentFragment = document.documentElement; | ||
_canSticky = Boolean(window.getComputedStyle(testElement).position.match('sticky')); | ||
if (_canSticky) { | ||
@@ -125,13 +124,10 @@ break; | ||
} | ||
documentFragment.removeChild(testElement); | ||
return _canSticky; | ||
}; | ||
}; // Test if SVG is supported | ||
// Test if SVG is supported | ||
const isSupportedSvg = () => Boolean(document.createElementNS) && Boolean(document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect); | ||
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 | ||
// 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 | ||
@@ -143,2 +139,2 @@ | ||
export { prefixedProperty, transitionProperty, transformProperty, animationProperty, transitionEndEvent, animationEndEvent, transform3D, transform, transition, canSticky, isSupportedSvg, touch, pointer, pointerEvent }; | ||
export { prefixedProperty, transitionProperty, transformProperty, animationProperty, transitionEndEvent, animationEndEvent, transform3D, transform, transition, sticky, svg, touch, pointer, pointerEvent }; |
{ | ||
"name": "@pluginjs/feature", | ||
"title": "Plugin", | ||
"version": "0.2.19", | ||
"description": "A workflow for modern frontend development.", | ||
"author": "Creation Studio Limited", | ||
"homepage": "https://github.com/amazingSurge/plugin.js", | ||
"license": "GPL-v3", | ||
"main": "dist/feature.js", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"scripts": { | ||
"start": "gulp plugin", | ||
"build": "npm run prestart && gulp build", | ||
"deploy": "gulp deploy", | ||
"deploy:prepare": "gulp deploy:prepare", | ||
"test": "gulp test", | ||
"new": "cp -r ./plugins/sample ./plugins/$Component" | ||
}, | ||
"repository": { | ||
"url": "git@github.com:amazingSurge/plugin.js.git", | ||
"type": "git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/amazingSurge/plugin.js/issues" | ||
}, | ||
"engines": { | ||
"node": ">= 8", | ||
"npm": ">= 5" | ||
}, | ||
"category": "core", | ||
"min": "dist/feature.min.js", | ||
"standalone": "dist/feature.standalone.js", | ||
"module": "dist/feature.esm.js", | ||
"dev-main": "src/main.js" | ||
"name": "@pluginjs/feature", | ||
"description": "A workflow for modern frontend development.", | ||
"license": "GPL-3.0", | ||
"author": "Creation Studio Limited", | ||
"homepage": "https://github.com/pluginjs/pluginjs", | ||
"repository": { | ||
"url": "git@github.com:pluginjs/pluginjs.git", | ||
"type": "git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/pluginjs/pluginjs/issues" | ||
}, | ||
"version": "0.6.1", | ||
"category": "utils", | ||
"main": "dist/feature.umd.js", | ||
"module": "dist/feature.esm.js", | ||
"source": "src/main.js", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"scripts": { | ||
"build": "npm run build:js", | ||
"build:js": "plugin script build-js", | ||
"build:md": "plugin script build-md", | ||
"lint": "npm run lint:js", | ||
"lint:js": "eslint ./src/**/*.js --fix", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.1.2", | ||
"@pluginjs/browserslist-config": "^1.1.1", | ||
"@pluginjs/cli": "^0.6.1", | ||
"babel-jest": "*", | ||
"jest": "*", | ||
"jest-extended": "*", | ||
"rollup": "*", | ||
"rollup-plugin-babel": "*", | ||
"rollup-plugin-commonjs": "*", | ||
"rollup-plugin-node-resolve": "*" | ||
}, | ||
"engines": { | ||
"node": ">= 8", | ||
"npm": ">= 5" | ||
}, | ||
"jest": { | ||
"setupTestFrameworkScriptFile": "jest-extended", | ||
"verbose": true, | ||
"testURL": "http://localhost", | ||
"testPathIgnorePatterns": [ | ||
"fixtures" | ||
] | ||
}, | ||
"browserslist": [ | ||
"extends @pluginjs/browserslist-config" | ||
], | ||
"title": "Plugin", | ||
"gitHead": "353b9f7a27eb7306aecd38b475a479616e7db55d" | ||
} |
@@ -25,3 +25,3 @@ /* eslint no-undef: "off" */ | ||
for (const i in props) { | ||
if (style[props[i]] !== undefined) { | ||
if (typeof style[props[i]] !== 'undefined') { | ||
memory[prop] = props[i] | ||
@@ -55,4 +55,4 @@ break | ||
for (const i in eventNames) { | ||
if (eventNames.hasOwnProperty(i)) { | ||
if (style[i] !== undefined) { | ||
if (Object.prototype.hasOwnProperty.call(eventNames, i)) { | ||
if (typeof style[i] !== 'undefined') { | ||
return eventNames[i] | ||
@@ -76,4 +76,4 @@ } | ||
for (const i in eventNames) { | ||
if (eventNames.hasOwnProperty(i)) { | ||
if (style[i] !== undefined) { | ||
if (Object.prototype.hasOwnProperty.call(eventNames, i)) { | ||
if (typeof style[i] !== 'undefined') { | ||
return eventNames[i] | ||
@@ -105,4 +105,3 @@ } | ||
// Test if CSS sticky are supported | ||
export const canSticky = () => { | ||
export const sticky = () => { | ||
let _canSticky = false | ||
@@ -129,3 +128,3 @@ const documentFragment = document.documentElement | ||
// Test if SVG is supported | ||
export const isSupportedSvg = () => | ||
export const svg = () => | ||
Boolean(document.createElementNS) && | ||
@@ -132,0 +131,0 @@ Boolean( |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
1
167
18694
10
5
369
2