{"name":"postcss-dir-pseudo-class","description":"Use the :dir pseudo-class in CSS","version":"10.0.0","contributors":[{"name":"Antonio Laguna","email":"antonio@laguna.es","url":"https://antonio.laguna.es"},{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},{"name":"Romain Menke","email":"romainmenke@gmail.com"}],"license":"MIT-0","funding":[{"type":"github","url":"https://github.com/sponsors/csstools"},{"type":"opencollective","url":"https://opencollective.com/csstools"}],"engines":{"node":">=20.19.0"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"}},"dependencies":{"postcss-selector-parser":"^7.1.1"},"peerDependencies":{"postcss":"^8.4"},"scripts":{},"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-dir-pseudo-class#readme","repository":{"type":"git","url":"git+https://github.com/csstools/postcss-plugins.git","directory":"plugins/postcss-dir-pseudo-class"},"bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"keywords":["attribute","css","directionality","directions","left","left-to-right","ltr","polyfill","postcss","postcss-plugin","right","right-to-left","rtl","selector"],"gitHead":"1044702e638c640563afbe57c7bd65f3c96c466e","_id":"postcss-dir-pseudo-class@10.0.0","_nodeVersion":"25.1.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-DmtIzULpyC8XaH4b5AaUgt4Jic4QmrECqidNCdR7u7naQFdnxX80YI06u238a+ZVRXwURDxVzy0s/UQnWmpVeg==","shasum":"c5ead4e9af647b8acdf022a096727df12ff83968","tarball":"http://registry-npm.ywwl.com/postcss-dir-pseudo-class/download/postcss-dir-pseudo-class-10.0.0.tgz","fileCount":6,"unpackedSize":9178,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBXTBnMj34jVPmSypHpbQg947B4Lronuo8Nn77lVI54WAiEAjq+kXOkIhoy8W/2MHfj6U+t0HH/bkv3FaF9IpvfaKxY="}],"size":3770,"noattachment":false,"key":"/postcss-dir-pseudo-class/-/postcss-dir-pseudo-class-10.0.0.tgz"},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"directories":{},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postcss-dir-pseudo-class_10.0.0_1768375328980_0.8167220048133437"},"_hasShrinkwrap":false,"readme":"# PostCSS Dir Pseudo Class [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\">][PostCSS]\n\n`npm install postcss-dir-pseudo-class --save-dev`\n\n[PostCSS Dir Pseudo Class] lets you style by directionality using the `:dir()`\npseudo-class in CSS, following the [Selectors] specification.\n\n```css\narticle h3:dir(rtl) {\n\tmargin-right: 10px;\n}\n\narticle h3:dir(ltr) {\n\tmargin-left: 10px;\n}\n\n/* becomes */\n\n[dir=\"rtl\"] article h3 {\n\tmargin-right: 10px;\n}\n\n[dir=\"ltr\"] article h3 {\n\tmargin-left: 10px;\n}\n```\n\n### Maintaining Specificity\n\nUsing [PostCSS Dir Pseudo Class] will not impact selector weight, but it will\nrequire having at least one `[dir]` attribute in your HTML. If you don’t have\n_any_ `[dir]` attributes, consider using the following JavaScript:\n\n```js\n// force at least one dir attribute (this can run at any time)\ndocument.documentElement.dir=document.documentElement.dir||'ltr';\n```\n\nIf you absolutely cannot add a `[dir]` attribute in your HTML or even force one\nvia JavaScript, you can still work around this by presuming a direction in your\nCSS using the [`dir` option](#dir), but understand that this will\nsometimes increase selector weight by one element (`html`).\n\n## Usage\n\nAdd [PostCSS Dir Pseudo Class] to your project:\n\n```bash\nnpm install postcss postcss-dir-pseudo-class --save-dev\n```\n\nUse it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssDirPseudoClass = require('postcss-dir-pseudo-class');\n\npostcss([\n\tpostcssDirPseudoClass(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n\n\n## Options\n\n### preserve\n\nThe `preserve` option determines whether the original notation\nis preserved. By default, it is not preserved.\n\n```js\npostcssDirPseudoClass({ preserve: true })\n```\n\n```css\narticle h3:dir(rtl) {\n\tmargin-right: 10px;\n}\n\narticle h3:dir(ltr) {\n\tmargin-left: 10px;\n}\n\n/* becomes */\n\n[dir=\"rtl\"] article h3 {\n\tmargin-right: 10px;\n}\n\narticle h3:dir(rtl) {\n\tmargin-right: 10px;\n}\n\n[dir=\"ltr\"] article h3 {\n\tmargin-left: 10px;\n}\n\narticle h3:dir(ltr) {\n\tmargin-left: 10px;\n}\n```\n\n### dir\n\nThe `dir` option allows you presume a direction in your CSS. By default, this\nis not specified and you are required to include a direction `[dir]` attribute\nsomewhere in your HTML, preferably on the `html` element.\n\n```js\npostcssDirPseudoClass({ dir: 'ltr' });\n```\n\n```css\narticle h3:dir(rtl) {\n\tmargin-right: 10px;\n}\n\narticle h3:dir(ltr) {\n\tmargin-left: 10px;\n}\n\n/* becomes */\n\n[dir=\"rtl\"] article h3 {\n\tmargin-right: 10px;\n}\n\nhtml:not([dir=\"rtl\"]) article h3 {\n\tmargin-left: 10px;\n}\n```\n\n```js\npostcssDirPseudoClass({ dir: 'rtl' });\n```\n\n```css\narticle h3:dir(rtl) {\n\tmargin-right: 10px;\n}\n\narticle h3:dir(ltr) {\n\tmargin-left: 10px;\n}\n\n/* becomes */\n\nhtml:not([dir=\"ltr\"]) article h3 {\n\tmargin-right: 10px;\n}\n\n[dir=\"ltr\"] article h3 {\n\tmargin-left: 10px;\n}\n```\n\n### shadow\n\nThe `shadow` option determines whether the CSS is assumed to be used in Shadow DOM with Custom Elements.\n\n```js\npostcssDirPseudoClass({ shadow: true })\n```\n\n```css\narticle h3:dir(rtl) {\n\tmargin-right: 10px;\n}\n\narticle h3:dir(ltr) {\n\tmargin-left: 10px;\n}\n\n/* becomes */\n\n:host-context([dir=\"rtl\"]) article h3 {\n\tmargin-right: 10px;\n}\n\n:host-context([dir=\"ltr\"]) article h3 {\n\tmargin-left: 10px;\n}\n```\n\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#dir-pseudo-class\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-url]: https://www.npmjs.com/package/postcss-dir-pseudo-class\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Dir Pseudo Class]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-dir-pseudo-class\n[Selectors]: https://www.w3.org/TR/selectors-4/#the-dir-pseudo\n","publish_time":1768375329122,"_cnpm_publish_time":1768375329122,"dist-tags":{"latest":"10.0.0"}}