Socket
Socket
Sign inDemoInstall

fela-plugin-extend

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-extend - npm Package Compare versions

Comparing version 4.2.6 to 4.3.0

75

dist/fela-plugin-extend.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.FelaPluginExtend = factory());
}(this, function () { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('css-in-js-utils/lib/assignStyle')) :
typeof define === 'function' && define.amd ? define(['css-in-js-utils/lib/assignStyle'], factory) :
(global.FelaPluginExtend = factory(global.assignStyle));
}(this, function (assignStyle) { 'use strict';
assignStyle = 'default' in assignStyle ? assignStyle['default'] : assignStyle;
var babelHelpers = {};

@@ -43,59 +45,23 @@ babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {

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 assignStyles(base) {
for (var _len = arguments.length, extendingStyles = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
extendingStyles[_key - 1] = arguments[_key];
}
function isObject(value) {
return (typeof value === 'undefined' ? 'undefined' : babelHelpers.typeof(value)) === 'object' && !Array.isArray(value);
}
for (var i = 0, len = extendingStyles.length; i < len; ++i) {
var style = extendingStyles[i];
for (var property in style) {
var value = style[property];
var baseValue = base[property];
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;
}
function arrayEach(array, iterator) {
for (var i = 0, len = array.length; i < len; ++i) {
iterator(array[i], i);
}
return base;
}
function extendStyle(style, extension) {
function extendStyle(style, extension, extendPlugin) {
// extend conditional style objects
if (extension.hasOwnProperty('condition')) {
if (extension.condition) {
assignStyles(style, extend(extension.style));
assignStyle(style, extendPlugin(extension.style));
}
} else {
// extend basic style objects
assignStyles(style, extension);
assignStyle(style, extension);
}

@@ -107,10 +73,11 @@ }

var value = style[property];
if (property === 'extend') {
// arrayify to loop each extension to support arrays and single extends
var extensions = [].concat(value);
for (var i = 0, len = extensions.length; i < len; ++i) {
extendStyle(style, extensions[i]);
}
arrayEach(extensions, function (extension) {
return extendStyle(style, extension, extend);
});
delete style[property];
} else if (value instanceof Object && !Array.isArray(value)) {
} else if (isObject(value)) {
// support nested extend as well

@@ -117,0 +84,0 @@ style[property] = extend(value);

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

!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});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("css-in-js-utils/lib/assignStyle")):"function"==typeof define&&define.amd?define(["css-in-js-utils/lib/assignStyle"],n):e.FelaPluginExtend=n(e.assignStyle)}(this,function(e){"use strict";function n(e){return"object"===("undefined"==typeof e?"undefined":i.typeof(e))&&!Array.isArray(e)}function t(e,n){for(var t=0,o=e.length;t<o;++t)n(e[t],t)}function o(n,t,o){t.hasOwnProperty("condition")?t.condition&&e(n,o(t.style)):e(n,t)}function r(e){for(var i in e){var f=e[i];if("extend"===i){var u=[].concat(f);t(u,function(n){return o(e,n,r)}),delete e[i]}else n(f)&&(e[i]=r(f))}return e}e="default"in e?e.default:e;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.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},i.extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};var f=function(){return r};return f});
{
"name": "fela-plugin-extend",
"version": "4.2.6",
"version": "4.3.0",
"description": "Fela plugin to extend style objects",

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

"peerDependencies": {
"fela": "4.2.6"
"fela": "4.3.0"
},
"dependencies": {
"css-in-js-utils": "^1.0.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.70kb-brightgreen.svg">
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-0.60kb-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.6/dist/fela-plugin-extend.js"></script>
<script src="https://unpkg.com/fela-plugin-extend@4.3.0/dist/fela-plugin-extend.js"></script>
<!-- Fela (Production): Minified version -->
<script src="https://unpkg.com/fela-plugin-extend@4.2.6/dist/fela-plugin-extend.min.js"></script>
<script src="https://unpkg.com/fela-plugin-extend@4.3.0/dist/fela-plugin-extend.min.js"></script>
```

@@ -23,0 +23,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