Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fela-plugin-unit

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-unit - npm Package Compare versions

Comparing version 4.2.6 to 4.3.0

141

dist/fela-plugin-unit.js

@@ -83,2 +83,14 @@ (function (global, factory) {

babelHelpers.objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
babelHelpers.possibleConstructorReturn = function (self, call) {

@@ -105,6 +117,5 @@ if (!self) {

var __commonjs_global = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this;
function __commonjs(fn, module) { return module = { exports: {} }, fn(module, module.exports, __commonjs_global), module.exports; }
function __commonjs(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; }
var index$1 = __commonjs(function (module) {
var index = __commonjs(function (module) {
'use strict';

@@ -123,7 +134,44 @@

var require$$0 = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
var require$$0$1 = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);
var index = __commonjs(function (module) {
var hyphenateStyleName = require$$0;
var hyphenateProperty = __commonjs(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = hyphenateProperty;
var _hyphenateStyleName = require$$0$1;
var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function hyphenateProperty(property) {
return (0, _hyphenateStyleName2.default)(property);
}
module.exports = exports['default'];
});
var require$$0 = (hyphenateProperty && typeof hyphenateProperty === 'object' && 'default' in hyphenateProperty ? hyphenateProperty['default'] : hyphenateProperty);
var isUnitlessProperty = __commonjs(function (module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isUnitlessProperty;
var _hyphenateProperty = require$$0;
var _hyphenateProperty2 = _interopRequireDefault(_hyphenateProperty);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var unitlessProperties = {

@@ -141,3 +189,2 @@ borderImageOutset: true,

zoom: true,
// SVG-related properties

@@ -154,48 +201,37 @@ fillOpacity: true,

var prefixedUnitlessProperties = {
animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
gridRow: true,
gridColumn: true,
order: true,
lineClamp: true
};
var prefixedUnitlessProperties = ['animationIterationCount', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'gridRow', 'gridColumn', 'order', 'lineClamp'];
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
function getPrefixedKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.slice(1);
function getPrefixedProperty(prefix, property) {
return prefix + property.charAt(0).toUpperCase() + property.slice(1);
}
// add all prefixed properties to the unitless properties
Object.keys(prefixedUnitlessProperties).forEach(function (property) {
for (var i = 0, len = prefixedUnitlessProperties.length; i < len; ++i) {
var property = prefixedUnitlessProperties[i];
unitlessProperties[property] = true;
prefixes.forEach(function (prefix) {
unitlessProperties[getPrefixedKey(prefix, property)] = true;
});
});
for (var j = 0, jLen = prefixes.length; j < jLen; ++j) {
unitlessProperties[getPrefixedProperty(prefixes[j], property)] = true;
}
}
// add all hypenated properties as well
Object.keys(unitlessProperties).forEach(function (property) {
unitlessProperties[hyphenateStyleName(property)] = true;
});
for (var _property in unitlessProperties) {
unitlessProperties[(0, _hyphenateProperty2.default)(_property)] = true;
}
module.exports = function (property) {
return unitlessProperties[property];
};
function isUnitlessProperty(property) {
return unitlessProperties.hasOwnProperty(property);
}
module.exports = exports['default'];
});
var isUnitlessCSSProperty = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);
var isUnitlessProperty$1 = (isUnitlessProperty && typeof isUnitlessProperty === 'object' && 'default' in isUnitlessProperty ? isUnitlessProperty['default'] : isUnitlessProperty);
/* weak */
function isObject(value) {
return (typeof value === 'undefined' ? 'undefined' : babelHelpers.typeof(value)) === 'object' && !Array.isArray(value);
}
/* eslint-disable import/no-mutable-exports */

@@ -218,7 +254,7 @@ var warning = function warning() {

function addUnitIfNeeded(property, value, unit) {
function addUnitIfNeeded(property, value, propertyUnit) {
var valueType = typeof value === 'undefined' ? 'undefined' : babelHelpers.typeof(value);
/* eslint-disable eqeqeq */
if (valueType === 'number' || valueType === 'string' && value == parseFloat(value)) {
value += unit;
value += propertyUnit;
}

@@ -229,14 +265,15 @@ /* eslint-enable */

function addUnit(style, unit, propertyMap) {
function addUnit(style, defaultUnit, propertyMap) {
var _loop = function _loop(property) {
if (!isUnitlessCSSProperty(property)) {
if (!isUnitlessProperty$1(property)) {
(function () {
var cssValue = style[property];
var propertyUnit = propertyMap[property] || unit;
if (Array.isArray(cssValue)) {
var propertyUnit = propertyMap[property] || defaultUnit;
if (isObject(cssValue)) {
style[property] = addUnit(cssValue, defaultUnit, propertyMap);
} else if (Array.isArray(cssValue)) {
style[property] = cssValue.map(function (val) {
return addUnitIfNeeded(property, val, propertyUnit);
});
} else if (cssValue instanceof Object) {
style[property] = addUnit(cssValue, unit, propertyMap);
} else {

@@ -256,12 +293,12 @@ style[property] = addUnitIfNeeded(property, cssValue, propertyUnit);

var unit = (function () {
var unit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'px';
function unit() {
var defaultUnit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'px';
var propertyMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
warning$1(unit.match(/ch|em|ex|rem|vh|vw|vmin|vmax|px|cm|mm|in|pc|pt|mozmm|%/) !== null, 'You are using an invalid unit `' + unit + '`.\n Consider using one of the following ch, em, ex, rem, vh, vw, vmin, vmax, px, cm, mm, in, pc, pt, mozmm or %.');
warning$1(defaultUnit.match(/ch|em|ex|rem|vh|vw|vmin|vmax|px|cm|mm|in|pc|pt|mozmm|%/) !== null, 'You are using an invalid unit "' + defaultUnit + '". Consider using one of the following ch, em, ex, rem, vh, vw, vmin, vmax, px, cm, mm, in, pc, pt, mozmm or %.');
return function (style) {
return addUnit(style, unit, propertyMap);
return addUnit(style, defaultUnit, propertyMap);
};
});
}

@@ -268,0 +305,0 @@ return unit;

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FelaPluginUnit=t()}(this,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports,o),t.exports}function t(e,t,n){var o="undefined"==typeof t?"undefined":r.typeof(t);return("number"===o||"string"===o&&t==parseFloat(t))&&(t+=n),t}function n(e,r,o){var i=function(i){u(i)||!function(){var f=e[i],a=o[i]||r;Array.isArray(f)?e[i]=f.map(function(e){return t(i,e,a)}):f instanceof Object?e[i]=n(f,r,o):e[i]=t(i,f,a)}()};for(var f in e)i(f);return e}var r={};r.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r.createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},r.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},r.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},r.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)};var o="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,i=e(function(e){function t(e){return e in o?o[e]:o[e]=e.replace(n,"-$&").toLowerCase().replace(r,"-ms-")}var n=/[A-Z]/g,r=/^ms-/,o={};e.exports=t}),f=i&&"object"==typeof i&&"default"in i?i.default:i,a=e(function(e){function t(e,t){return e+t.charAt(0).toUpperCase()+t.slice(1)}var n=f,r={borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},o={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,order:!0,lineClamp:!0},i=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){r[e]=!0,i.forEach(function(n){r[t(n,e)]=!0})}),Object.keys(r).forEach(function(e){r[n(e)]=!0}),e.exports=function(e){return r[e]}}),u=a&&"object"==typeof a&&"default"in a?a.default:a,c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"px",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){return n(r,e,t)}};return c});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FelaPluginUnit=t()}(this,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}function t(e){return"object"===("undefined"==typeof e?"undefined":i.typeof(e))&&!Array.isArray(e)}function r(e,t,r){var n="undefined"==typeof t?"undefined":i.typeof(t);return("number"===n||"string"===n&&t==parseFloat(t))&&(t+=r),t}function n(e,o,i){var u=function(u){p(u)||!function(){var f=e[u],a=i[u]||o;t(f)?e[u]=n(f,o,i):Array.isArray(f)?e[u]=f.map(function(e){return r(u,e,a)}):e[u]=r(u,f,a)}()};for(var f in e)u(f);return e}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"px",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){return n(r,e,t)}}var i={};i.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i.createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i.defineProperty=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},i.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},i.objectWithoutProperties=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},i.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},i.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)};var u=e(function(e){function t(e){return e in o?o[e]:o[e]=e.replace(r,"-$&").toLowerCase().replace(n,"-ms-")}var r=/[A-Z]/g,n=/^ms-/,o={};e.exports=t}),f=u&&"object"==typeof u&&"default"in u?u.default:u,a=e(function(e,t){function r(e){return e&&e.__esModule?e:{default:e}}function n(e){return(0,i.default)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=f,i=r(o);e.exports=t.default}),l=a&&"object"==typeof a&&"default"in a?a.default:a,c=e(function(e,t){function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){return e+t.charAt(0).toUpperCase()+t.slice(1)}function o(e){return f.hasOwnProperty(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;for(var i=l,u=r(i),f={borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},a=["animationIterationCount","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridColumn","order","lineClamp"],c=["Webkit","ms","Moz","O"],p=0,s=a.length;p<s;++p){var y=a[p];f[y]=!0;for(var d=0,b=c.length;d<b;++d)f[n(c[d],y)]=!0}for(var h in f)f[(0,u.default)(h)]=!0;e.exports=t.default}),p=c&&"object"==typeof c&&"default"in c?c.default:c;return o});
{
"name": "fela-plugin-unit",
"version": "4.2.6",
"version": "4.3.0",
"description": "Fela plugin to automatically add units if required",

@@ -22,7 +22,7 @@ "module": "index.es2015.js",

"dependencies": {
"unitless-css-property": "1.0.2"
"css-in-js-utils": "^1.0.3"
},
"peerDependencies": {
"fela": "4.2.6"
"fela": "4.3.0"
}
}

@@ -5,3 +5,3 @@ # fela-plugin-unit

<img alt="npm downloads" src="https://img.shields.io/npm/dm/fela-plugin-unit.svg">
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-1.47kb-brightgreen.svg">
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-1.63kb-brightgreen.svg">

@@ -19,5 +19,5 @@ Always writing length values as string with a value applied seems not like the JavaScript way to do it. You can also use mathematics to process number values. <br>

<!-- Fela (Development): Unminified version including all warnings -->
<script src="https://unpkg.com/fela-plugin-unit@4.2.6/dist/fela-plugin-unit.js"></script>
<script src="https://unpkg.com/fela-plugin-unit@4.3.0/dist/fela-plugin-unit.js"></script>
<!-- Fela (Production): Minified version -->
<script src="https://unpkg.com/fela-plugin-unit@4.2.6/dist/fela-plugin-unit.min.js"></script>
<script src="https://unpkg.com/fela-plugin-unit@4.3.0/dist/fela-plugin-unit.min.js"></script>
```

@@ -24,0 +24,0 @@

Sorry, the diff of this file is not supported yet

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