fela-plugin-extend
Advanced tools
Comparing version 4.2.2 to 4.2.3
@@ -43,6 +43,16 @@ (function (global, factory) { | ||
babelHelpers.toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
babelHelpers; | ||
/* weak */ | ||
function assign(base) { | ||
function assignStyles(base) { | ||
for (var _len = arguments.length, extendingStyles = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
@@ -57,8 +67,21 @@ extendingStyles[_key - 1] = arguments[_key]; | ||
var value = style[property]; | ||
var baseValue = base[property]; | ||
if (base[property] instanceof Object && value instanceof Object) { | ||
base[property] = assign({}, base[property], value); | ||
} else { | ||
base[property] = value; | ||
if (baseValue instanceof Object) { | ||
if (Array.isArray(baseValue)) { | ||
if (Array.isArray(value)) { | ||
base[property] = [].concat(babelHelpers.toConsumableArray(baseValue), babelHelpers.toConsumableArray(value)); | ||
} else { | ||
base[property] = [].concat(babelHelpers.toConsumableArray(baseValue), [value]); | ||
} | ||
continue; | ||
} | ||
if (value instanceof Object && !Array.isArray(value)) { | ||
base[property] = assignStyles({}, baseValue, value); | ||
continue; | ||
} | ||
} | ||
base[property] = value; | ||
} | ||
@@ -74,7 +97,7 @@ } | ||
if (extension.condition) { | ||
assign(style, extend(extension.style)); | ||
assignStyles(style, extend(extension.style)); | ||
} | ||
} else { | ||
// extend basic style objects | ||
assign(style, extension); | ||
assignStyles(style, extension); | ||
} | ||
@@ -81,0 +104,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.FelaPluginExtend=n()}(this,function(){"use strict";function e(n){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];for(var f=0,i=r.length;f<i;++f){var c=r[f];for(var a in c){var u=c[a];n[a]instanceof Object&&u instanceof Object?n[a]=e({},n[a],u):n[a]=u}}return n}function n(n,r){r.hasOwnProperty("condition")?r.condition&&e(n,t(r.style)):e(n,r)}function t(e){for(var r in e){var o=e[r];if("extend"===r){for(var f=[].concat(o),i=0,c=f.length;i<c;++i)n(e,f[i]);delete e[r]}else o instanceof Object&&!Array.isArray(o)&&(e[r]=t(o))}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.defineProperty=function(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e},r.extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e};var o=function(){return t};return o}); | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):r.FelaPluginExtend=n()}(this,function(){"use strict";function r(n){for(var e=arguments.length,o=Array(e>1?e-1:0),a=1;a<e;a++)o[a-1]=arguments[a];for(var i=0,f=o.length;i<f;++i){var y=o[i];for(var c in y){var u=y[c],l=n[c];if(l instanceof Object){if(Array.isArray(l)){Array.isArray(u)?n[c]=[].concat(t.toConsumableArray(l),t.toConsumableArray(u)):n[c]=[].concat(t.toConsumableArray(l),[u]);continue}if(u instanceof Object&&!Array.isArray(u)){n[c]=r({},l,u);continue}}n[c]=u}}return n}function n(n,t){t.hasOwnProperty("condition")?t.condition&&r(n,e(t.style)):r(n,t)}function e(r){for(var t in r){var o=r[t];if("extend"===t){for(var a=[].concat(o),i=0,f=a.length;i<f;++i)n(r,a[i]);delete r[t]}else o instanceof Object&&!Array.isArray(o)&&(r[t]=e(o))}return r}var t={};t.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},t.defineProperty=function(r,n,e){return n in r?Object.defineProperty(r,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[n]=e,r},t.extends=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}return r},t.toConsumableArray=function(r){if(Array.isArray(r)){for(var n=0,e=Array(r.length);n<r.length;n++)e[n]=r[n];return e}return Array.from(r)};var o=function(){return e};return o}); |
{ | ||
"name": "fela-plugin-extend", | ||
"version": "4.2.2", | ||
"version": "4.2.3", | ||
"description": "Fela plugin to extend style objects", | ||
@@ -21,4 +21,4 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"fela": "4.2.2" | ||
"fela": "4.2.3" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # fela-plugin-extend | ||
<img alt="npm downloads" src="https://img.shields.io/npm/dm/fela-plugin-extend.svg"> | ||
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-0.61kb-brightgreen.svg"> | ||
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-0.70kb-brightgreen.svg"> | ||
@@ -18,5 +18,5 @@ Allows styles to be extended with other style objects. Supports a condition-based API. | ||
<!-- Fela (Development): Unminified version including all warnings --> | ||
<script src="https://unpkg.com/fela-plugin-extend@4.2.2/dist/fela-plugin-extend.js"></script> | ||
<script src="https://unpkg.com/fela-plugin-extend@4.2.3/dist/fela-plugin-extend.js"></script> | ||
<!-- Fela (Production): Minified version --> | ||
<script src="https://unpkg.com/fela-plugin-extend@4.2.2/dist/fela-plugin-extend.min.js"></script> | ||
<script src="https://unpkg.com/fela-plugin-extend@4.2.3/dist/fela-plugin-extend.min.js"></script> | ||
``` | ||
@@ -23,0 +23,0 @@ |
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
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
13656
107