fela-plugin-rtl
Advanced tools
Comparing version 12.0.0-rc.2 to 12.0.0-y.0
import transformStyle from 'rtl-css-js'; | ||
export default function rtl() { | ||
var defaultDirection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rtl'; | ||
return function (style, type, renderer, props) { | ||
return function rtlPlugin(style, type, renderer, props) { | ||
var _props$theme; | ||
@@ -6,0 +6,0 @@ |
@@ -14,3 +14,3 @@ "use strict"; | ||
var defaultDirection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rtl'; | ||
return function (style, type, renderer, props) { | ||
return function rtlPlugin(style, type, renderer, props) { | ||
var _props$theme; | ||
@@ -17,0 +17,0 @@ |
{ | ||
"name": "fela-plugin-rtl", | ||
"version": "12.0.0-rc.2", | ||
"version": "12.0.0-y.0", | ||
"description": "Fela plugin to convert styles to RTL", | ||
@@ -58,3 +58,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "0e5e638041a6a62e52128dbac21e9c5f21d80b66" | ||
"gitHead": "26804548dae15e08097785c19be45d072fee217e" | ||
} |
@@ -8,11 +8,13 @@ # fela-plugin-rtl | ||
## Installation | ||
```sh | ||
yarn add fela-plugin-rtl | ||
``` | ||
You may alternatively use `npm i --save fela-plugin-rtl`. | ||
## 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,13 +25,13 @@ import { createRenderer } from 'fela' | ||
const renderer = createRenderer({ | ||
plugins: [ rtl() ] | ||
plugins: [rtl()], | ||
}) | ||
``` | ||
### Configuration | ||
### Configuration | ||
##### Parameters | ||
| Parameter | Value | Default | Description | | ||
| --- | --- | --- | --- | | ||
| defaultDirection | *("rtl" \| "ltr")* | `rtl` | The default direction which can be useful if one is using the `theme.direction` option to dynamically toggle rtl transformation | | ||
| Parameter | Value | Default | Description | | ||
| ---------------- | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------- | | ||
| defaultDirection | _("rtl" \| "ltr")_ | `rtl` | The default direction which can be useful if one is using the `theme.direction` option to dynamically toggle rtl transformation | | ||
@@ -39,2 +41,3 @@ ## Example | ||
#### Input | ||
```javascript | ||
@@ -48,3 +51,5 @@ { | ||
``` | ||
#### Output | ||
```javascript | ||
@@ -60,2 +65,3 @@ { | ||
## Theme-Based Mode | ||
Apart from enforcing rtl all the time, one can also leverage a special `props.theme.direction` property to enable/disable rtl transformation. This is especially useful together with React to disable transformation for subtrees. | ||
@@ -68,3 +74,3 @@ | ||
cursor: 'w-resize', | ||
textShadow: 'red 2px 0' | ||
textShadow: 'red 2px 0', | ||
}) | ||
@@ -76,8 +82,9 @@ | ||
// wont be transformed | ||
renderer.renderRule(rule, { theme: { direction: 'ltr' }}) | ||
renderer.renderRule(rule, { theme: { direction: 'ltr' } }) | ||
``` | ||
## 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. |
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
15146
84