Socket
Socket
Sign inDemoInstall

fela-plugin-fallback-value

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-fallback-value - npm Package Compare versions

Comparing version 12.0.0-rc.2 to 12.0.0-rc.3.0

12

es/index.js
import { resolveArrayValue } from 'css-in-js-utils';
import isPlainObject from 'isobject';
function resolveFallbackValues(style) {
function fallbackValuePlugin(style) {
for (var property in style) {

@@ -11,3 +11,3 @@ var value = style[property];

} else if (isPlainObject(value) && property !== 'fontFace') {
style[property] = resolveFallbackValues(value);
style[property] = fallbackValuePlugin(value);
}

@@ -19,3 +19,3 @@ }

resolveFallbackValues.optimized = function (props) {
fallbackValuePlugin.optimized = function (props) {
if (Array.isArray(props.value)) {

@@ -28,4 +28,4 @@ props.value = resolveArrayValue(props.property, props.value);

export default (function () {
return resolveFallbackValues;
});
export default function fallbackValue() {
return fallbackValuePlugin;
}

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

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

@@ -15,3 +15,3 @@ var _cssInJsUtils = require("css-in-js-utils");

function resolveFallbackValues(style) {
function fallbackValuePlugin(style) {
for (var property in style) {

@@ -23,3 +23,3 @@ var value = style[property];

} else if ((0, _isobject["default"])(value) && property !== 'fontFace') {
style[property] = resolveFallbackValues(value);
style[property] = fallbackValuePlugin(value);
}

@@ -31,3 +31,3 @@ }

resolveFallbackValues.optimized = function (props) {
fallbackValuePlugin.optimized = function (props) {
if (Array.isArray(props.value)) {

@@ -40,6 +40,4 @@ props.value = (0, _cssInJsUtils.resolveArrayValue)(props.property, props.value);

var _default = function _default() {
return resolveFallbackValues;
};
exports["default"] = _default;
function fallbackValue() {
return fallbackValuePlugin;
}
{
"name": "fela-plugin-fallback-value",
"version": "12.0.0-rc.2",
"version": "12.0.0-rc.3.0",
"description": "Fela plugin to resolve fallback values",

@@ -60,3 +60,3 @@ "typings": "index.d.ts",

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

@@ -5,16 +5,18 @@ # fela-plugin-fallback-value

Sometimes you want to provide alternative values also know as *fallback values*. <br>
For example in Internet Explorer 8 there is no `rgba` compatibility for colors which means just passing *e.g. `color: rgba(0, 0, 0, 0.5)`* would not be applied correctly.
Sometimes you want to provide alternative values also know as _fallback values_. <br>
For example in Internet Explorer 8 there is no `rgba` compatibility for colors which means just passing _e.g. `color: rgba(0, 0, 0, 0.5)`_ would not be applied correctly.
By passing an array of values you can provide fallback values.
## Installation
```sh
yarn add fela-plugin-fallback-value
```
You may alternatively use `npm i --save fela-plugin-fallback-value`.
## 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

@@ -25,3 +27,3 @@ import { createRenderer } from 'fela'

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

@@ -33,8 +35,11 @@ ```

#### Input
```javascript
{
color: [ '#ccc', 'rgba(0, 0, 0, 0.5)' ]
color: ['#ccc', 'rgba(0, 0, 0, 0.5)']
}
```
#### Output
```javascript

@@ -45,3 +50,5 @@ {

```
which is similar to the following CSS code:
```CSS

@@ -55,4 +62,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.
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