fela-plugin-theme-value
Advanced tools
Comparing version 11.7.0 to 12.0.0-rc.0
import isPlainObject from 'isobject'; | ||
import arrayReduce from 'fast-loops/lib/arrayReduce'; | ||
import { arrayReduce } from 'fast-loops'; | ||
@@ -12,3 +12,2 @@ function getThemeValue(object, key) { | ||
}, object); | ||
return value || key; | ||
@@ -19,3 +18,3 @@ } | ||
var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var mapping = arguments[2]; | ||
var mapping = arguments.length > 2 ? arguments[2] : undefined; | ||
@@ -37,6 +36,5 @@ for (var property in style) { | ||
var mapping = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
return function (style, type, renderer, props) { | ||
return resolveThemeValues(style, props.theme, mapping); | ||
return resolveThemeValues(style, props === null || props === void 0 ? void 0 : props.theme, mapping); | ||
}; | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,17 +6,13 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = themeValue; | ||
exports["default"] = themeValue; | ||
var _isobject = require('isobject'); | ||
var _isobject = _interopRequireDefault(require("isobject")); | ||
var _isobject2 = _interopRequireDefault(_isobject); | ||
var _fastLoops = require("fast-loops"); | ||
var _arrayReduce = require('fast-loops/lib/arrayReduce'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _arrayReduce2 = _interopRequireDefault(_arrayReduce); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function getThemeValue(object, key) { | ||
var value = (0, _arrayReduce2.default)(key.split('.'), function (value, index) { | ||
if ((0, _isobject2.default)(value) && value[index]) { | ||
var value = (0, _fastLoops.arrayReduce)(key.split('.'), function (value, index) { | ||
if ((0, _isobject["default"])(value) && value[index]) { | ||
return value[index]; | ||
@@ -27,3 +23,2 @@ } | ||
}, object); | ||
return value || key; | ||
@@ -34,3 +29,3 @@ } | ||
var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var mapping = arguments[2]; | ||
var mapping = arguments.length > 2 ? arguments[2] : undefined; | ||
@@ -42,3 +37,3 @@ for (var property in style) { | ||
style[property] = getThemeValue(mapping[property](theme), value); | ||
} else if ((0, _isobject2.default)(value)) { | ||
} else if ((0, _isobject["default"])(value)) { | ||
style[property] = resolveThemeValues(style[property], theme, mapping); | ||
@@ -53,6 +48,5 @@ } | ||
var mapping = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
return function (style, type, renderer, props) { | ||
return resolveThemeValues(style, props.theme, mapping); | ||
return resolveThemeValues(style, props === null || props === void 0 ? void 0 : props.theme, mapping); | ||
}; | ||
} |
{ | ||
"name": "fela-plugin-theme-value", | ||
"version": "11.7.0", | ||
"version": "12.0.0-rc.0", | ||
"description": "Fela plugin to resolve values from a theme", | ||
@@ -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/", | ||
@@ -34,3 +48,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
10215
6
74
15
2