fela-plugin-unit
Advanced tools
Comparing version 11.7.0 to 12.0.0-rc.0
@@ -1,9 +0,11 @@ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
import defaultIsUnitlessProperty from 'css-in-js-utils/lib/isUnitlessProperty'; | ||
import { isUnitlessProperty as defaultIsUnitlessProperty } from 'css-in-js-utils'; | ||
import isPlainObject from 'isobject'; | ||
function addUnitIfNeeded(value, propertyUnit) { | ||
var valueType = typeof value === 'undefined' ? 'undefined' : _typeof(value); | ||
var valueType = _typeof(value); | ||
/* eslint-disable eqeqeq */ | ||
if ((valueType === 'number' || valueType === 'string' && value == parseFloat(value)) && value != 0) { | ||
@@ -13,2 +15,4 @@ return value + propertyUnit; | ||
/* eslint-enable */ | ||
return value; | ||
@@ -45,11 +49,13 @@ } | ||
/* eslint-disable eqeqeq */ | ||
if ((valueType === 'number' || valueType === 'string' && props.value == parseFloat(props.value)) && props.value != 0) { | ||
var _unit = propertyMap[props.property] || defaultUnit; | ||
props.value += _unit; | ||
} | ||
} // handle arrays | ||
// handle arrays | ||
if (Array.isArray(props.value)) { | ||
var propertyUnit = propertyMap[props.property] || defaultUnit; | ||
props.value = props.value.map(function (value) { | ||
@@ -75,4 +81,3 @@ return addUnitIfNeeded(value, propertyUnit); | ||
plugin.optimized = createOptimized(defaultUnit, propertyMap, isUnitlessProperty); | ||
return plugin; | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,20 +6,17 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = unit; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _cssInJsUtils = require("css-in-js-utils"); | ||
exports.default = unit; | ||
var _isobject = _interopRequireDefault(require("isobject")); | ||
var _isUnitlessProperty = require('css-in-js-utils/lib/isUnitlessProperty'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _isUnitlessProperty2 = _interopRequireDefault(_isUnitlessProperty); | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
var _isobject = require('isobject'); | ||
function addUnitIfNeeded(value, propertyUnit) { | ||
var valueType = _typeof(value); | ||
/* eslint-disable eqeqeq */ | ||
var _isobject2 = _interopRequireDefault(_isobject); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function addUnitIfNeeded(value, propertyUnit) { | ||
var valueType = typeof value === 'undefined' ? 'undefined' : _typeof(value); | ||
/* eslint-disable eqeqeq */ | ||
if ((valueType === 'number' || valueType === 'string' && value == parseFloat(value)) && value != 0) { | ||
@@ -29,2 +26,4 @@ return value + propertyUnit; | ||
/* eslint-enable */ | ||
return value; | ||
@@ -40,3 +39,3 @@ } | ||
if ((0, _isobject2.default)(cssValue)) { | ||
if ((0, _isobject["default"])(cssValue)) { | ||
style[property] = addUnit(cssValue, defaultUnit, propertyMap, isUnitlessProperty); | ||
@@ -62,11 +61,13 @@ } else if (Array.isArray(cssValue)) { | ||
/* eslint-disable eqeqeq */ | ||
if ((valueType === 'number' || valueType === 'string' && props.value == parseFloat(props.value)) && props.value != 0) { | ||
var _unit = propertyMap[props.property] || defaultUnit; | ||
props.value += _unit; | ||
} | ||
} // handle arrays | ||
// handle arrays | ||
if (Array.isArray(props.value)) { | ||
var propertyUnit = propertyMap[props.property] || defaultUnit; | ||
props.value = props.value.map(function (value) { | ||
@@ -85,3 +86,3 @@ return addUnitIfNeeded(value, propertyUnit); | ||
var propertyMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var isUnitlessProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _isUnitlessProperty2.default; | ||
var isUnitlessProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _cssInJsUtils.isUnitlessProperty; | ||
@@ -93,4 +94,3 @@ var plugin = function plugin(style) { | ||
plugin.optimized = createOptimized(defaultUnit, propertyMap, isUnitlessProperty); | ||
return plugin; | ||
} |
{ | ||
"name": "fela-plugin-unit", | ||
"version": "11.7.0", | ||
"version": "12.0.0-rc.0", | ||
"description": "Fela plugin to automatically add units if required", | ||
@@ -13,4 +13,18 @@ "main": "lib/index.js", | ||
"lib/**", | ||
"es/**" | ||
"es/**", | ||
"umd/**" | ||
], | ||
"scripts": { | ||
"setup": "yarn build", | ||
"clean": "rimraf lib es coverage", | ||
"build": "yarn clean && yarn build:es && yarn build:lib", | ||
"build:es": "babel src --out-dir es --ignore **/__tests__", | ||
"build:lib": "cross-env BABEL_ENV=commonjs babel src --out-dir lib --ignore **/__tests__", | ||
"build:umd": "webpack --config webpack.config.js", | ||
"watch": "npm run watch:lib & npm run watch:es", | ||
"watch:lib": "BABEL_ENV=commonjs babel src -d lib -w", | ||
"watch:es": "babel src -d es -w", | ||
"test": "jest --config=jest.config.js", | ||
"coverage": "yarn test --coverage" | ||
}, | ||
"repository": "https://github.com/robinweser/fela/", | ||
@@ -28,3 +42,20 @@ "keywords": [ | ||
}, | ||
"gitHead": "e067b284984d3dbfc259fcbffde9bb50679fda9b" | ||
"devDependencies": { | ||
"@babel/cli": "^7.2.0", | ||
"@babel/core": "^7.2.2", | ||
"@babel/node": "^7.13.0", | ||
"@babel/plugin-transform-modules-commonjs": "^7.5.0", | ||
"@babel/polyfill": "^7.7.0", | ||
"@babel/preset-env": "^7.5.5", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-jest": "^26.6.0", | ||
"babel-loader": "^8.2.3", | ||
"clean-webpack-plugin": "^3.0.0", | ||
"cross-env": "^6.0.3", | ||
"jest": "^26.6.0", | ||
"rimraf": "^3.0.0", | ||
"webpack": "^4.41.6", | ||
"webpack-cli": "^3.3.10" | ||
}, | ||
"gitHead": "00f02f410f17a7693479ea3349bb3a9f223359af" | ||
} |
Sorry, the diff of this file is not supported yet
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 v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
14551
6
138
15
2