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

fela-plugin-extend

Package Overview
Dependencies
Maintainers
2
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 12.0.0-rc.2 to 12.0.0-rc.3.0

22

es/index.js

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

import { arrayEach, objectEach } from 'fast-loops';
import { arrayEach, arrayFilter, objectEach } from 'fast-loops';
import { assignStyle } from 'css-in-js-utils';

@@ -11,4 +11,4 @@ import isPlainObject from 'isobject';

} else if (Array.isArray(value)) {
style[property] = value.filter(function (val) {
return !isUndefinedValue(val);
style[property] = arrayFilter(value, function (item) {
return !isUndefinedValue(item);
});

@@ -24,14 +24,14 @@ } else if (isUndefinedValue(value)) {

// extend conditional style objects
if (extension && Object.prototype.hasOwnProperty.call(extension, 'condition')) {
if (extension && extension.hasOwnProperty('condition')) {
if (extension.condition) {
// eslint-disable-next-line no-use-before-define
assignStyle(style, extend(extension.style));
assignStyle(style, extendPlugin(extension.style));
}
} else {
// extend basic style objects
assignStyle(style, removeUndefined(extend(extension)));
assignStyle(style, removeUndefined(extendPlugin(extension)));
}
}
function extend(style) {
function extendPlugin(style) {
objectEach(style, function (value, property) {

@@ -46,3 +46,3 @@ if (property === 'extend') {

// support nested extend as well
style[property] = extend(value);
style[property] = extendPlugin(value);
}

@@ -53,4 +53,4 @@ });

export default (function () {
return extend;
});
export default function extend() {
return extendPlugin;
}

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = void 0;
exports["default"] = extend;

@@ -24,4 +24,4 @@ var _fastLoops = require("fast-loops");

} else if (Array.isArray(value)) {
style[property] = value.filter(function (val) {
return !(0, _felaUtils.isUndefinedValue)(val);
style[property] = (0, _fastLoops.arrayFilter)(value, function (item) {
return !(0, _felaUtils.isUndefinedValue)(item);
});

@@ -37,14 +37,14 @@ } else if ((0, _felaUtils.isUndefinedValue)(value)) {

// extend conditional style objects
if (extension && Object.prototype.hasOwnProperty.call(extension, 'condition')) {
if (extension && extension.hasOwnProperty('condition')) {
if (extension.condition) {
// eslint-disable-next-line no-use-before-define
(0, _cssInJsUtils.assignStyle)(style, extend(extension.style));
(0, _cssInJsUtils.assignStyle)(style, extendPlugin(extension.style));
}
} else {
// extend basic style objects
(0, _cssInJsUtils.assignStyle)(style, removeUndefined(extend(extension)));
(0, _cssInJsUtils.assignStyle)(style, removeUndefined(extendPlugin(extension)));
}
}
function extend(style) {
function extendPlugin(style) {
(0, _fastLoops.objectEach)(style, function (value, property) {

@@ -59,3 +59,3 @@ if (property === 'extend') {

// support nested extend as well
style[property] = extend(value);
style[property] = extendPlugin(value);
}

@@ -66,6 +66,4 @@ });

var _default = function _default() {
return extend;
};
exports["default"] = _default;
function extend() {
return extendPlugin;
}
{
"name": "fela-plugin-extend",
"version": "12.0.0-rc.2",
"version": "12.0.0-rc.3.0",
"description": "Fela plugin to extend style objects",

@@ -43,3 +43,3 @@ "main": "lib/index.js",

"fast-loops": "^1.0.0",
"fela-utils": "^12.0.0-rc.2",
"fela-utils": "^12.0.0-rc.3.0",
"isobject": "^3.0.1"

@@ -64,3 +64,3 @@ },

},
"gitHead": "0e5e638041a6a62e52128dbac21e9c5f21d80b66"
"gitHead": "71e887614179a10c85332e326cf1d943ca51289a"
}

@@ -9,10 +9,13 @@ # fela-plugin-extend

## Installation
```sh
yarn add fela-plugin-extend
```
You may alternatively use `npm i --save fela-plugin-extend`.
## Usage
Make sure to read the documentation on [how to use plugins](http://fela.js.org/docs/advanced/Plugins.html).
Make sure to read the documentation on [how to use plugins](https://fela.js.org/docs/latest/advanced/plugins#using-plugins).
```javascript

@@ -23,3 +26,3 @@ import { createRenderer } from 'fela'

const renderer = createRenderer({
plugins: [ extend() ]
plugins: [extend()],
})

@@ -31,3 +34,5 @@ ```

### `extend: styleObject`
#### Input
```javascript

@@ -39,3 +44,5 @@ {

```
#### Output
```javascript

@@ -49,3 +56,5 @@ {

### `extend: { condition, styleObject }`
#### Input
```javascript

@@ -60,4 +69,7 @@ {

```
#### Output
Rendered using `{ bg: true }` as `props`:
```javascript

@@ -69,3 +81,5 @@ {

```
Rendered using `{ bg: false }` as `props`
```javascript

@@ -78,4 +92,6 @@ {

### `extend: [...]`
You can also mix basic and conditional extending.
It will extend the styles from left to right.
```javascript

@@ -95,4 +111,7 @@ {

```
#### Output
Using `{ bg: true }` as `props`:
```javascript

@@ -108,4 +127,5 @@ {

## License
Fela is licensed under the [MIT License](http://opensource.org/licenses/MIT).<br>
Documentation is licensed under [Creative Commons License](http://creativecommons.org/licenses/by/4.0/).<br>
Created with ♥ by [@robinweser](http://weser.io) and all the great contributors.

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

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("FelaPluginExtend",[],n):"object"==typeof exports?exports.FelaPluginExtend=n():t.FelaPluginExtend=n()}(window,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=1)}([function(t,n,e){"use strict";
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("FelaPluginExtend",[],n):"object"==typeof exports?exports.FelaPluginExtend=n():t.FelaPluginExtend=n()}(window,(function(){return function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=1)}([function(t,n,r){"use strict";
/*!

@@ -7,2 +7,2 @@ * isobject <https://github.com/jonschlinkert/isobject>

* Released under the MIT License.
*/t.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},function(t,n,e){"use strict";function r(t,n){for(var e in t)n(t[e],e,t)}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,n){if(!t)return;if("string"==typeof t)return i(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(t,n)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function f(t){return t.filter((function(n,e){return t.lastIndexOf(n)===e}))}function c(t){for(var n=0,e=arguments.length<=1?0:arguments.length-1;n<e;++n){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r){var l=r[i],a=t[i];if(a&&l){if(Array.isArray(a)){t[i]=f(a.concat(l));continue}if(Array.isArray(l)){t[i]=f([a].concat(u(l)));continue}if("object"===o(l)){t[i]=c({},a,l);continue}}t[i]=l}}return t}e.r(n);var l=e(0),a=e.n(l),y=/undefined|null/,p=/url/;function s(t){return null==t||"string"==typeof t&&y.test(t)&&!p.test(t)}function d(t,n){n&&Object.prototype.hasOwnProperty.call(n,"condition")?n.condition&&c(t,b(n.style)):c(t,function t(n){return r(n,(function(e,r){a()(e)?n[r]=t(e):Array.isArray(e)?n[r]=e.filter((function(t){return!s(t)})):s(e)&&delete n[r]})),n}(b(n)))}function b(t){return r(t,(function(n,e){"extend"===e?(!function(t,n){for(var e=0,r=t.length;e<r;++e)n(t[e],e,r,t)}([].concat(n),(function(n){return d(t,n)})),delete t[e]):a()(n)&&(t[e]=b(n))})),t}n.default=function(){return b}}])}));
*/t.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},function(t,n,r){"use strict";function e(t,n){for(var r in t)n(t[r],r,t)}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,n){if(!t)return;if("string"==typeof t)return i(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,n)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}function f(t){return t.filter((function(n,r){return t.lastIndexOf(n)===r}))}function c(t){for(var n=0,r=arguments.length<=1?0:arguments.length-1;n<r;++n){var e=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in e){var a=e[i],l=t[i];if(l&&a){if(Array.isArray(l)){t[i]=f(l.concat(a));continue}if(Array.isArray(a)){t[i]=f([l].concat(u(a)));continue}if("object"===o(a)){t[i]=c({},l,a);continue}}t[i]=a}}return t}r.r(n),r.d(n,"default",(function(){return m}));var a=r(0),l=r.n(a),y=/undefined|null/,p=/url/;function s(t){return null==t||"string"==typeof t&&y.test(t)&&!p.test(t)}function d(t,n){n&&n.hasOwnProperty("condition")?n.condition&&c(t,b(n.style)):c(t,function t(n){return e(n,(function(r,e){l()(r)?n[e]=t(r):Array.isArray(r)?n[e]=function(t,n){for(var r=[],e=0,o=t.length;e<o;++e){var u=t[e];n(u,e,o,t)&&r.push(u)}return r}(r,(function(t){return!s(t)})):s(r)&&delete n[e]})),n}(b(n)))}function b(t){return e(t,(function(n,r){"extend"===r?(!function(t,n){for(var r=0,e=t.length;r<e;++r)n(t[r],r,e,t)}([].concat(n),(function(n){return d(t,n)})),delete t[r]):l()(n)&&(t[r]=b(n))})),t}function m(){return b}}])}));
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