{ "manifest": { "name": "rtl-css-js", "version": "1.16.1", "description": "Right To Left conversion for CSS in JS objects", "main": "dist/cjs/index.js", "jsnext:main": "dist/esm/index.js", "module": "dist/esm/index.js", "types": "types.d.ts", "exports": { ".": { "types": "./types.d.ts", "node": "./dist/cjs/index.js", "import": "./dist/esm/index.js", "default": "./dist/cjs/index.js" }, "./core": { "types": "./core.d.ts", "node": "./dist/cjs/core.js", "import": "./dist/esm/core.js", "default": "./dist/cjs/core.js" }, "./core.esm": { "default": "./dist/esm/core.js" }, "./core.esm.js": { "default": "./dist/esm/core.js" }, "./core.js": { "default": "./dist/cjs/core.js" }, "./package.json": "./package.json" }, "scripts": { "build": "rimraf dist && npm-run-all build:**", "build:bundlers": "kcd-scripts build --bundle cjs,esm --environment BUILD_INPUT:src/*.js --no-clean", "build:umd:main": "kcd-scripts build --bundle umd,umd.min BUILD_NAME:rtlCSSJS --no-clean", "build:umd:core": "kcd-scripts build --bundle umd,umd.min --environment BUILD_NAME:rtlCSSJSCore,BUILD_FILENAME_SUFFIX:\".core\",BUILD_INPUT:src/core.js --no-clean", "postbuild:bundlers": "node scripts/add-proxies-typings.js", "lint": "kcd-scripts lint", "test": "kcd-scripts test", "test:update": "npm run test -s -- --coverage --updateSnapshot", "validate": "kcd-scripts validate" }, "husky": { "hooks": { "pre-commit": "kcd-scripts pre-commit" } }, "files": [ "dist", "core", "types.d.ts", "core.d.ts", "core.esm.js", "core.esm.d.ts" ], "keywords": [ "css-in-js", "ltr", "rtl", "cssjanus" ], "author": { "name": "Kent C. Dodds", "email": "kent@doddsfamily.us", "url": "http://kentcdodds.com/" }, "license": "MIT", "devDependencies": { "kcd-scripts": "^1.11.0", "npm-run-all": "^4.1.1", "rimraf": "^3.0.0", "tiny-glob": "^0.2.0" }, "eslintConfig": { "extends": "./node_modules/kcd-scripts/eslint.js" }, "eslintIgnore": [ "node_modules", "coverage", "dist" ], "repository": { "type": "git", "url": "https://github.com/kentcdodds/rtl-css-js.git" }, "bugs": { "url": "https://github.com/kentcdodds/rtl-css-js/issues" }, "homepage": "https://github.com/kentcdodds/rtl-css-js#readme", "dependencies": { "@babel/runtime": "^7.1.2" }, "_registry": "npm", "_loc": "/home/josie/.cache/yarn/v6/npm-rtl-css-js-1.16.1-integrity/node_modules/rtl-css-js/package.json", "readmeFilename": "README.md", "readme": "# rtl-css-js\n\nRTL conversion for CSS in JS objects\n\n\n[![Build Status][build-badge]][build]\n[![Code Coverage][coverage-badge]][coverage]\n[![version][version-badge]][package]\n[![downloads][downloads-badge]][npmtrends]\n[![MIT License][license-badge]][license]\n[![All Contributors][all-contributors-badge]](#contributors-)\n[![PRs Welcome][prs-badge]][prs]\n[![Code of Conduct][coc-badge]][coc]\n\n\n## The problem\n\nFor some locales, it's necessary to change `padding-left` to `padding-right`\nwhen your text direction is right to left. There are tools like this for CSS\n([`cssjanus`](https://github.com/cssjanus/cssjanus) for example) which\nmanipulate strings of CSS to do this, but none for CSS in JS where your CSS is\nrepresented by an object.\n\n## This solution\n\nThis is a function which accepts a CSS in JS object and can convert\n`padding-left` to `padding-right` as well as all other properties where it makes\nsense to do that (at least, that's what it's going to be when it's done... This\nis a work in progress).\n\n## Table of Contentss\n\n\n\n\n- [Installation](#installation)\n- [Usage](#usage)\n - [kebab-case](#kebab-case)\n - [core](#core)\n- [Caveats](#caveats)\n - [`background`](#background)\n - [CSS variables - `var()`](#css-variables---var)\n- [Inspiration](#inspiration)\n- [Ecosystem](#ecosystem)\n- [Other Solutions](#other-solutions)\n- [Contributors](#contributors)\n- [LICENSE](#license)\n\n\n\n## Installation\n\nThis module is distributed via [npm][npm] which is bundled with [node][node] and\nshould be installed as one of your project's `dependencies`:\n\n```\nnpm install --save rtl-css-js\n```\n\n## Usage\n\nThis module is exposed via [CommonJS](http://wiki.commonjs.org/wiki/CommonJS) as\nwell as [UMD](https://github.com/umdjs/umd) with the global as `rtlCSSJS`\n\nCommonJS:\n\n```javascript\nconst rtlCSSJS = require('rtl-css-js')\nconst styles = rtlCSSJS({paddingLeft: 23})\nconsole.log(styles) // logs {paddingRight: 23}\n```\n\nYou can also just include a script tag in your browser and use the `rtlCSSJS`\nvariable:\n\n```html\n\n\n```\n\nYou can also control which rules you don't want to flip by adding a\n`/* @noflip */` CSS comment to your rule\n\n```javascript\nconst rtlCSSJS = require('rtl-css-js')\nconst styles = rtlCSSJS({paddingLeft: '20px /* @noflip */'})\nconsole.log(styles) // logs {paddingLeft: '20px /* @noflip */' }\n```\n\n### kebab-case\n\nThis library support kebab-case properties too.\n\n```javascript\nconst rtlCSSJS = require('rtl-css-js')\nconst styles = rtlCSSJS({'padding-right': 23})\nconsole.log(styles) // logs {'padding-left': 23}\n```\n\n### core\n\n`rtl-css-js` also exposes its internal helpers and utilities so you can deal\nwith [certain scenarios](https://github.com/kentcdodds/rtl-css-js/pull/22)\nyourself. To use these you can use the `rtlCSSJSCore` global with the UMD build,\n`require('rtl-css-js/core')`, or use\n`import {propertyValueConverters, arrayToObject} from 'rtl-css-js/core'`.\n\nYou can import anything that's exported from `src/core`. Please see the code\ncomments for documentation on how to use these.\n\n## Caveats\n\n### `background`\n\nRight now `background` and `backgroundImage` just replace all instances of `ltr`\nwith `rtl` and `right` with `left`. This is so you can have a different image\nfor your LTR and RTL, and in order to flip linear gradients. Note that this is\ncase sensitive! Must be lower case. Note also that it _will not_ change `bright`\nto `bleft`. It's a _little_ smarter than that. But this is definitely something\nto consider with your URLs.\n\n### CSS variables - `var()`\n\nSince it's impossible to know what the contents of a css variable are until the\nstyles are actually calculated by the browser, any CSS variable contents will\nnot be converted.\n\n## Inspiration\n\n[CSSJanus](https://github.com/cssjanus/cssjanus) was a major inspiration.\n\n## Ecosystem\n\n- **[react-with-styles-interface-aphrodite](https://github.com/airbnb/react-with-styles-interface-aphrodite):**\n An interface to use\n [`react-with-styles`](https://github.com/airbnb/react-with-styles) with\n [Aphrodite](https://github.com/khan/aphrodite)\n- **[fela-plugin-rtl](https://www.npmjs.com/package/fela-plugin-rtl):** A plugin\n for [fela](http://fela.js.org/) that uses rtl-css-js to convert a style object\n to its right-to-left counterpart\n- **[bidi-css-js](https://github.com/TxHawks/bidi-css-js):** A library for\n authoring flow-relative css, which uses `rtl-css-js`'s core.\n- **[jss-rtl](https://github.com/alitaheri/jss-rtl):** A plugin for\n [`jss`](https://github.com/cssinjs/jss) to support flipping styles\n dynamically.\n\n## Other Solutions\n\nI'm not aware of any, if you are please\n[make a pull request](http://makeapullrequest.com) and add it here!\n\n## Contributors\n\nThanks goes to these people ([emoji key][emojis]):\n\n\n\n\n
Kent C. Dodds 💻 ⚠️ 🚇 | \n Ahmed El Gabri 💻 📖 ⚠️ | \n Maja Wichrowska 💻 ⚠️ | \n Yaniv 💻 ⚠️ | \n Jonathan Pollak 💻 ⚠️ | \n Ali Taheri Moghaddar 💻 📖 ⚠️ | \n garrettberg 💻 ⚠️ | \n
Miles Johnson 💻 ⚠️ | \n Kevin Weber 💻 | \n Justin Dorfman 🔍 | \n Royston Shufflebotham 🐛 💻 ⚠️ | \n Oleksandr Fediashov 💻 | \n Lingfan Gao 💻 ⚠️ | \n Miroslav Stastny 💻 📖 ⚠️ | \n