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

fela-plugin-unit

Package Overview
Dependencies
Maintainers
2
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-unit - npm Package Compare versions

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

8

es/index.js

@@ -74,8 +74,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

var plugin = function plugin(style) {
function unitPlugin(style) {
return addUnit(style, defaultUnit, propertyMap, isUnitlessProperty);
};
}
plugin.optimized = createOptimized(defaultUnit, propertyMap, isUnitlessProperty);
return plugin;
unitPlugin.optimized = createOptimized(defaultUnit, propertyMap, isUnitlessProperty);
return unitPlugin;
}

@@ -84,8 +84,8 @@ "use strict";

var plugin = function plugin(style) {
function unitPlugin(style) {
return addUnit(style, defaultUnit, propertyMap, isUnitlessProperty);
};
}
plugin.optimized = createOptimized(defaultUnit, propertyMap, isUnitlessProperty);
return plugin;
unitPlugin.optimized = createOptimized(defaultUnit, propertyMap, isUnitlessProperty);
return unitPlugin;
}
{
"name": "fela-plugin-unit",
"version": "12.0.0-rc.2",
"version": "12.0.0-rc.3.0",
"description": "Fela plugin to automatically add units if required",

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

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

@@ -9,12 +9,13 @@ # fela-plugin-unit

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

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

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

@@ -31,10 +32,13 @@ ```

### Configuration
##### Parameters
| Parameter | Value | Default | Description |
| --- | --- | --- | --- |
| unit | `ch`, `em`, `ex`, `rem`, `vh`, `vw`, `vmin`, `vmax`, `px`, `cm`, `mm`, `in`, `pc`, `pt`, `mozmm` | `px` | unit which gets applied |
| unitPerProperty | *(Object)* | `{}` | Default units per property |
| isUnitlessProperty | *(Function)* | [`util function`](https://github.com/robinweser/css-in-js-utils/blob/master/modules/isUnitlessProperty.js) | check whether property should remain unitless |
|  Parameter | Value | Default | Description |
| ------------------ | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| unit | `ch`, `em`, `ex`, `rem`, `vh`, `vw`, `vmin`, `vmax`, `px`, `cm`, `mm`, `in`, `pc`, `pt`, `mozmm` |  `px` | unit which gets applied |
| unitPerProperty |  *(Object)* | `{}` |  Default units per property |
| isUnitlessProperty | _(Function)_ | [`util function`](https://github.com/robinweser/css-in-js-utils/blob/master/modules/isUnitlessProperty.js) | check whether property should remain unitless |
##### Example
```javascript

@@ -46,15 +50,16 @@ import { createRenderer } from 'fela'

margin: '%',
fontSize: 'pt'
fontSize: 'pt',
})
const renderer = createRenderer({
plugins: [ unitPlugin ]
plugins: [unitPlugin],
})
```
## Example
## Example
Using the above example code:
#### Input
```javascript

@@ -70,3 +75,5 @@ {

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

@@ -84,4 +91,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.

@@ -7,2 +7,2 @@ !function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("FelaPluginUnit",[],e):"object"==typeof exports?exports.FelaPluginUnit=e():r.FelaPluginUnit=e()}(window,(function(){return function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){"use strict";t.r(e),t.d(e,"default",(function(){return P}));var n=/[A-Z]/g,o=/^ms-/,i={};function u(r){return"-"+r.toLowerCase()}var a=function(r){if(i.hasOwnProperty(r))return i[r];var e=r.replace(n,u);return i[r]=o.test(e)?"-"+e:e};function f(r){return a(r)}var l,c,p={borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},d=["animationIterationCount","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","order"],s=["Webkit","ms","Moz","O"];for(var y=0,v=d.length;y<v;++y){var b=d[y];p[b]=!0;for(var m=0,g=s.length;m<g;++m)p[(l=s[m],c=b,l+c.charAt(0).toUpperCase()+c.slice(1))]=!0}for(var x in p)p[f(x)]=!0;function h(r){return p.hasOwnProperty(r)}

* Released under the MIT License.
*/function O(r){return(O="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})(r)}function S(r,e){var t=O(r);return("number"===t||"string"===t&&r==parseFloat(r))&&0!=r?r+e:r}function w(r,e,t,n){for(var o in r)n(o)||function(){var i,u=r[o],a=t[o]||e;null!=(i=u)&&"object"==typeof i&&!1===Array.isArray(i)?r[o]=w(u,e,t,n):Array.isArray(u)?r[o]=u.map((function(r){return S(r,a)})):r[o]=S(u,a)}();return r}function j(r,e,t){return function(n){if(!t(n.property)){var o=O(n.value);if(("number"===o||"string"===o&&n.value==parseFloat(n.value))&&0!=n.value){var i=e[n.property]||r;n.value+=i}if(Array.isArray(n.value)){var u=e[n.property]||r;n.value=n.value.map((function(r){return S(r,u)}))}}return n}}function P(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"px",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h,n=function(n){return w(n,r,e,t)};return n.optimized=j(r,e,t),n}}])}));
*/function O(r){return(O="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})(r)}function S(r,e){var t=O(r);return("number"===t||"string"===t&&r==parseFloat(r))&&0!=r?r+e:r}function w(r,e,t,n){for(var o in r)n(o)||function(){var i,u=r[o],a=t[o]||e;null!=(i=u)&&"object"==typeof i&&!1===Array.isArray(i)?r[o]=w(u,e,t,n):Array.isArray(u)?r[o]=u.map((function(r){return S(r,a)})):r[o]=S(u,a)}();return r}function j(r,e,t){return function(n){if(!t(n.property)){var o=O(n.value);if(("number"===o||"string"===o&&n.value==parseFloat(n.value))&&0!=n.value){var i=e[n.property]||r;n.value+=i}if(Array.isArray(n.value)){var u=e[n.property]||r;n.value=n.value.map((function(r){return S(r,u)}))}}return n}}function P(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"px",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h;function n(n){return w(n,r,e,t)}return n.optimized=j(r,e,t),n}}])}));
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