12.2.1 • Published 1 year ago

fela-plugin-rtl v12.2.1

Weekly downloads
9,019
License
MIT
Repository
github
Last release
1 year ago

fela-plugin-rtl

Uses rtl-css-js to convert a style object to its right-to-left counterpart.

Installation

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.

import { createRenderer } from 'fela'
import rtl from 'fela-plugin-rtl'

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

Configuration

Parameters
 ParameterValueDefaultDescription
defaultDirection("rtl" | "ltr") rtlThe default direction which can be useful if one is using the theme.direction option to dynamically toggle rtl transformation

Example

Input

{
  paddingLeft: 20,
  marginRight: '25px',
  cursor: 'w-resize',
  textShadow: 'red 2px 0'
}

Output

{
  paddingRight: 20,
  marginleft: '25px',
  cursor: 'e-resize',
  textShadow: 'red -2px 0'
}

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.

const rule = () => ({
  paddingLeft: 20,
  marginRight: '25px',
  cursor: 'w-resize',
  textShadow: 'red 2px 0',
})

// will be transformed
renderer.renderRule(rule)

// wont be transformed
renderer.renderRule(rule, { theme: { direction: 'ltr' } })

License

Fela is licensed under the MIT License. Documentation is licensed under Creative Commons License. Created with ♥ by @robinweser and all the great contributors.

12.2.1

1 year ago

12.2.0

2 years ago

12.1.2

2 years ago

12.1.0

2 years ago

12.1.1

2 years ago

12.0.0

2 years ago

12.0.1

2 years ago

12.0.2

2 years ago

12.0.0-rc.1

2 years ago

12.0.0-rc.2

2 years ago

12.0.0-rc.0

2 years ago

12.0.0-y.0

2 years ago

12.0.0-rc.3.0

2 years ago

11.7.0

3 years ago

11.6.1

3 years ago

11.6.0

3 years ago

11.5.2

3 years ago

11.5.1

3 years ago

11.5.0

3 years ago

11.5.0-rc.0

3 years ago

11.4.0

4 years ago

11.3.3

4 years ago

11.3.2

4 years ago

11.3.1

4 years ago

11.3.0

4 years ago

11.2.0

4 years ago

11.1.1

4 years ago

11.1.2

4 years ago

11.1.0

4 years ago

11.0.2

4 years ago

11.0.0

4 years ago

11.0.1

4 years ago

10.8.2

5 years ago

10.8.1

5 years ago

10.8.0

5 years ago

10.7.0

5 years ago

10.6.1

5 years ago

10.6.0

5 years ago

10.5.0

5 years ago

10.4.1

5 years ago

10.4.0

5 years ago

10.3.0

5 years ago

10.2.4

5 years ago

10.2.3

5 years ago

10.2.2

5 years ago

10.2.1

5 years ago

10.2.0

5 years ago

10.1.3

5 years ago

10.1.2

5 years ago

10.1.1

5 years ago

10.1.0

5 years ago

10.0.2

5 years ago

10.0.0

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago