summaryrefslogtreecommitdiff
path: root/node_modules/postcss-dir-pseudo-class
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/postcss-dir-pseudo-class')
-rw-r--r--node_modules/postcss-dir-pseudo-class/CHANGELOG.md118
-rw-r--r--node_modules/postcss-dir-pseudo-class/LICENSE.md18
-rw-r--r--node_modules/postcss-dir-pseudo-class/README.md202
-rw-r--r--node_modules/postcss-dir-pseudo-class/dist/index.cjs1
-rw-r--r--node_modules/postcss-dir-pseudo-class/dist/index.d.ts12
-rw-r--r--node_modules/postcss-dir-pseudo-class/dist/index.mjs1
-rw-r--r--node_modules/postcss-dir-pseudo-class/package.json100
7 files changed, 452 insertions, 0 deletions
diff --git a/node_modules/postcss-dir-pseudo-class/CHANGELOG.md b/node_modules/postcss-dir-pseudo-class/CHANGELOG.md
new file mode 100644
index 00000000..b83424fe
--- /dev/null
+++ b/node_modules/postcss-dir-pseudo-class/CHANGELOG.md
@@ -0,0 +1,118 @@
+# Changes to PostCSS Dir Pseudo Class
+
+### 8.0.0
+
+_July 3, 2023_
+
+- Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
+
+### 7.0.2
+
+_February 6, 2023_
+
+- Reduce the amount of duplicate fallback CSS.
+
+### 7.0.1
+
+_January 28, 2023_
+
+- Improve `types` declaration in `package.json`
+
+### 7.0.0
+
+_January 24, 2023_
+
+- Updated: Support for Node v14+ (major).
+- Added: TypeScript support.
+
+### 6.0.5
+
+_July 8, 2022_
+
+- Fix case insensitive matching.
+
+### 6.0.4
+
+_February 5, 2022_
+
+- Improved `es module` and `commonjs` compatibility
+
+### 6.0.3
+
+_January 12, 2022_
+
+- Fix compatibility with PostCSS `v8.2.x` [#147](https://github.com/csstools/postcss-plugins/issues/147)
+
+This version is not officially supported but some tool providers pinned PostCSS to `v8.2.x`,
+making it impossible for end users to have a working setup.
+
+### 6.0.2
+
+_January 2, 2022_
+
+- Removed Sourcemaps from package tarball.
+- Moved CLI to CLI Package. See [announcement](https://github.com/csstools/postcss-plugins/discussions/121).
+
+### 6.0.1
+
+_December 13, 2021_
+
+- Updated: documentation
+
+### 6.0.0
+
+_September 17, 2021_
+
+- Updated: Support for PostCS 8+ (major).
+- Updated: Support for Node 12+ (major).
+
+### 5.0.0
+
+_September 17, 2018_
+
+- Updated: Support for PostCSS v7+
+- Updated: Support for Node v6+
+- Updated: `postcss-selector-parser` to v5.0.0-rc.3+ (major)
+
+### 4.0.0
+
+_May 8, 2018_
+
+- Updated: `postcss-selector-parser` to v4.0.0 (major)
+- Updated: `postcss` to v6.0.22 (patch)
+
+### 3.0.0
+
+_March 21, 2018_
+
+- Added: `preserve` option to preserve the original `:dir()` rule
+- Updated: `postcss-selector-parser` to v3 (major)
+- Removed: `browsers` option which is better covered by
+ [PostCSS Preset Env](https://github.com/jonathantneal/postcss-preset-env/)
+
+### 2.1.0
+
+_September 19, 2017_
+
+- Fixed: Enforcement of presumed direction, e.g. `html:dir([dir="rtl"])`
+- Updated: Browserslist and PostCSS
+- Improved: How options are safely called, i.e. `Object(opts)`
+
+### 2.0.0
+
+_July 24, 2017_
+
+- Changed: Method of presumed direction from `:root` to `html:not([dir])`
+
+### 1.1.0
+
+_June 2, 2017_
+
+- Added: Support for browserslist and a 'browsers' option
+- Added: Support for a presumed direction via the 'browsers' option
+
+### 1.0.0
+
+_May 30, 2017_
+
+- Initial version
diff --git a/node_modules/postcss-dir-pseudo-class/LICENSE.md b/node_modules/postcss-dir-pseudo-class/LICENSE.md
new file mode 100644
index 00000000..e8ae93b9
--- /dev/null
+++ b/node_modules/postcss-dir-pseudo-class/LICENSE.md
@@ -0,0 +1,18 @@
+MIT No Attribution (MIT-0)
+
+Copyright © CSSTools Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/postcss-dir-pseudo-class/README.md b/node_modules/postcss-dir-pseudo-class/README.md
new file mode 100644
index 00000000..6ed9382c
--- /dev/null
+++ b/node_modules/postcss-dir-pseudo-class/README.md
@@ -0,0 +1,202 @@
+# PostCSS Dir Pseudo Class [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS]
+
+[<img alt="npm version" src="https://img.shields.io/npm/v/postcss-dir-pseudo-class.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/dir-pseudo-class.svg" height="20">][css-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
+
+[PostCSS Dir Pseudo Class] lets you style by directionality using the `:dir()`
+pseudo-class in CSS, following the [Selectors] specification.
+
+```pcss
+article h3:dir(rtl) {
+ margin-right: 10px;
+}
+
+article h3:dir(ltr) {
+ margin-left: 10px;
+}
+
+/* becomes */
+
+[dir="rtl"] article h3 {
+ margin-right: 10px;
+}
+
+[dir="ltr"] article h3 {
+ margin-left: 10px;
+}
+```
+
+### Maintaining Specificity
+
+Using [PostCSS Dir Pseudo Class] will not impact selector weight, but it will
+require having at least one `[dir]` attribute in your HTML. If you don’t have
+_any_ `[dir]` attributes, consider using the following JavaScript:
+
+```js
+// force at least one dir attribute (this can run at any time)
+document.documentElement.dir=document.documentElement.dir||'ltr';
+```
+
+If you absolutely cannot add a `[dir]` attribute in your HTML or even force one
+via JavaScript, you can still work around this by presuming a direction in your
+CSS using the [`dir` option](#dir), but understand that this will
+sometimes increase selector weight by one element (`html`).
+
+## Usage
+
+Add [PostCSS Dir Pseudo Class] to your project:
+
+```bash
+npm install postcss postcss-dir-pseudo-class --save-dev
+```
+
+Use it as a [PostCSS] plugin:
+
+```js
+const postcss = require('postcss');
+const postcssDirPseudoClass = require('postcss-dir-pseudo-class');
+
+postcss([
+ postcssDirPseudoClass(/* pluginOptions */)
+]).process(YOUR_CSS /*, processOptions */);
+```
+
+[PostCSS Dir Pseudo Class] runs in all Node environments, with special
+instructions for:
+
+- [Node](INSTALL.md#node)
+- [PostCSS CLI](INSTALL.md#postcss-cli)
+- [PostCSS Load Config](INSTALL.md#postcss-load-config)
+- [Webpack](INSTALL.md#webpack)
+- [Next.js](INSTALL.md#nextjs)
+- [Gulp](INSTALL.md#gulp)
+- [Grunt](INSTALL.md#grunt)
+
+## Options
+
+### preserve
+
+The `preserve` option determines whether the original notation
+is preserved. By default, it is not preserved.
+
+```js
+postcssDirPseudoClass({ preserve: true })
+```
+
+```pcss
+article h3:dir(rtl) {
+ margin-right: 10px;
+}
+
+article h3:dir(ltr) {
+ margin-left: 10px;
+}
+
+/* becomes */
+
+[dir="rtl"] article h3 {
+ margin-right: 10px;
+}
+
+article h3:dir(rtl) {
+ margin-right: 10px;
+}
+
+[dir="ltr"] article h3 {
+ margin-left: 10px;
+}
+
+article h3:dir(ltr) {
+ margin-left: 10px;
+}
+```
+
+### dir
+
+The `dir` option allows you presume a direction in your CSS. By default, this
+is not specified and you are required to include a direction `[dir]` attribute
+somewhere in your HTML, preferably on the `html` element.
+
+```js
+postcssDirPseudoClass({ dir: 'ltr' });
+```
+
+```pcss
+article h3:dir(rtl) {
+ margin-right: 10px;
+}
+
+article h3:dir(ltr) {
+ margin-left: 10px;
+}
+
+/* becomes */
+
+[dir="rtl"] article h3 {
+ margin-right: 10px;
+}
+
+html:not([dir="rtl"]) article h3 {
+ margin-left: 10px;
+}
+```
+
+```js
+postcssDirPseudoClass({ dir: 'rtl' });
+```
+
+```pcss
+article h3:dir(rtl) {
+ margin-right: 10px;
+}
+
+article h3:dir(ltr) {
+ margin-left: 10px;
+}
+
+/* becomes */
+
+html:not([dir="ltr"]) article h3 {
+ margin-right: 10px;
+}
+
+[dir="ltr"] article h3 {
+ margin-left: 10px;
+}
+```
+
+### shadow
+
+The `shadow` option determines whether the CSS is assumed to be used in Shadow DOM with Custom Elements.
+
+```js
+postcssDirPseudoClass({ shadow: true })
+```
+
+```pcss
+article h3:dir(rtl) {
+ margin-right: 10px;
+}
+
+article h3:dir(ltr) {
+ margin-left: 10px;
+}
+
+/* becomes */
+
+:host-context([dir="rtl"]) article h3 {
+ margin-right: 10px;
+}
+
+:host-context([dir="ltr"]) article h3 {
+ margin-left: 10px;
+}
+```
+
+[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
+[css-url]: https://cssdb.org/#dir-pseudo-class
+[discord]: https://discord.gg/bUadyRwkJS
+[npm-url]: https://www.npmjs.com/package/postcss-dir-pseudo-class
+
+[PostCSS]: https://github.com/postcss/postcss
+[PostCSS Dir Pseudo Class]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-dir-pseudo-class
+[Selectors]: https://www.w3.org/TR/selectors-4/#the-dir-pseudo
diff --git a/node_modules/postcss-dir-pseudo-class/dist/index.cjs b/node_modules/postcss-dir-pseudo-class/dist/index.cjs
new file mode 100644
index 00000000..f91c7465
--- /dev/null
+++ b/node_modules/postcss-dir-pseudo-class/dist/index.cjs
@@ -0,0 +1 @@
+"use strict";var e=require("postcss-selector-parser");const creator=t=>{const r=Object.assign({dir:null,preserve:!1,shadow:!1},t);return{postcssPlugin:"postcss-dir-pseudo-class",prepare(){const t=new WeakSet;return{Rule(o,{result:s}){if(t.has(o))return;let a,n=!1;if(o.selector.toLowerCase().includes(":dir(")){try{a=e((t=>{t.nodes.forEach((t=>{t.walk((t=>{if("pseudo"!==t.type)return;if(":dir"!==t.value.toLowerCase())return;if(!t.nodes||!t.nodes.length)return;const a=t.nodes.toString().toLowerCase();if("rtl"!==a&&"ltr"!==a)return;const l=t.parent;l.nodes.filter((e=>"pseudo"===e.type&&":dir"===e.value.toLowerCase())).length>1&&!n&&(n=!0,o.warn(s,`Hierarchical :dir pseudo class usage can't be transformed correctly to [dir] attributes. This will lead to incorrect selectors for "${o.selector}"`));const c=t.prev(),p=t.next(),i=c&&c.type&&"combinator"!==c.type,u=p&&p.type&&"combinator"!==p.type,d=p&&p.type&&("combinator"!==p.type||"combinator"===p.type&&" "===p.value);i||u||0===l.nodes.indexOf(t)&&d||1===l.nodes.length?t.remove():t.replaceWith(e.universal());const v=l.nodes[0],w=v&&"combinator"===v.type&&" "===v.value,y=v&&"tag"===v.type&&"html"===v.value.toLowerCase(),f=v&&"pseudo"===v.type&&":root"===v.value.toLowerCase();!v||y||f||w||l.prepend(e.combinator({value:" "}));const h=r.dir===a,b=e.attribute({attribute:"dir",operator:"=",quoteMark:'"',value:`"${a}"`,raws:null}),m=e.pseudo({value:":host-context"});m.append(b);const g=e.pseudo({value:(y||f?"":"html")+":not"});g.append(e.attribute({attribute:"dir",operator:"=",quoteMark:'"',value:`"${"ltr"===a?"rtl":"ltr"}"`,raws:null})),h?y?l.insertAfter(v,g):l.prepend(g):y?l.insertAfter(v,b):r.shadow&&!f?l.prepend(m):l.prepend(b)}))}))})).processSync(o.selector)}catch(e){return void o.warn(s,`Failed to parse selector : ${o.selector}`)}void 0!==a&&a!==o.selector&&(t.add(o),o.cloneBefore({selector:a}),r.preserve||o.remove())}}}}}};creator.postcss=!0,module.exports=creator;
diff --git a/node_modules/postcss-dir-pseudo-class/dist/index.d.ts b/node_modules/postcss-dir-pseudo-class/dist/index.d.ts
new file mode 100644
index 00000000..8e6f1148
--- /dev/null
+++ b/node_modules/postcss-dir-pseudo-class/dist/index.d.ts
@@ -0,0 +1,12 @@
+import type { PluginCreator } from 'postcss';
+/** postcss-dir-pseudo-class plugin options */
+export type pluginOptions = {
+ /** Preserve the original notation. default: true */
+ preserve?: boolean;
+ /** Assume a direction for the document. default: null */
+ dir?: 'ltr' | 'rtl';
+ /** Assume that the CSS is intended to be used in Shadow DOM with Custom Elements. default: false */
+ shadow?: boolean;
+};
+declare const creator: PluginCreator<pluginOptions>;
+export default creator;
diff --git a/node_modules/postcss-dir-pseudo-class/dist/index.mjs b/node_modules/postcss-dir-pseudo-class/dist/index.mjs
new file mode 100644
index 00000000..66e7dabe
--- /dev/null
+++ b/node_modules/postcss-dir-pseudo-class/dist/index.mjs
@@ -0,0 +1 @@
+import e from"postcss-selector-parser";const creator=t=>{const r=Object.assign({dir:null,preserve:!1,shadow:!1},t);return{postcssPlugin:"postcss-dir-pseudo-class",prepare(){const t=new WeakSet;return{Rule(o,{result:s}){if(t.has(o))return;let a,n=!1;if(o.selector.toLowerCase().includes(":dir(")){try{a=e((t=>{t.nodes.forEach((t=>{t.walk((t=>{if("pseudo"!==t.type)return;if(":dir"!==t.value.toLowerCase())return;if(!t.nodes||!t.nodes.length)return;const a=t.nodes.toString().toLowerCase();if("rtl"!==a&&"ltr"!==a)return;const l=t.parent;l.nodes.filter((e=>"pseudo"===e.type&&":dir"===e.value.toLowerCase())).length>1&&!n&&(n=!0,o.warn(s,`Hierarchical :dir pseudo class usage can't be transformed correctly to [dir] attributes. This will lead to incorrect selectors for "${o.selector}"`));const p=t.prev(),c=t.next(),i=p&&p.type&&"combinator"!==p.type,d=c&&c.type&&"combinator"!==c.type,u=c&&c.type&&("combinator"!==c.type||"combinator"===c.type&&" "===c.value);i||d||0===l.nodes.indexOf(t)&&u||1===l.nodes.length?t.remove():t.replaceWith(e.universal());const v=l.nodes[0],f=v&&"combinator"===v.type&&" "===v.value,w=v&&"tag"===v.type&&"html"===v.value.toLowerCase(),y=v&&"pseudo"===v.type&&":root"===v.value.toLowerCase();!v||w||y||f||l.prepend(e.combinator({value:" "}));const h=r.dir===a,b=e.attribute({attribute:"dir",operator:"=",quoteMark:'"',value:`"${a}"`,raws:null}),m=e.pseudo({value:":host-context"});m.append(b);const g=e.pseudo({value:(w||y?"":"html")+":not"});g.append(e.attribute({attribute:"dir",operator:"=",quoteMark:'"',value:`"${"ltr"===a?"rtl":"ltr"}"`,raws:null})),h?w?l.insertAfter(v,g):l.prepend(g):w?l.insertAfter(v,b):r.shadow&&!y?l.prepend(m):l.prepend(b)}))}))})).processSync(o.selector)}catch(e){return void o.warn(s,`Failed to parse selector : ${o.selector}`)}void 0!==a&&a!==o.selector&&(t.add(o),o.cloneBefore({selector:a}),r.preserve||o.remove())}}}}}};creator.postcss=!0;export{creator as default};
diff --git a/node_modules/postcss-dir-pseudo-class/package.json b/node_modules/postcss-dir-pseudo-class/package.json
new file mode 100644
index 00000000..8abca57e
--- /dev/null
+++ b/node_modules/postcss-dir-pseudo-class/package.json
@@ -0,0 +1,100 @@
+{
+ "name": "postcss-dir-pseudo-class",
+ "description": "Use the :dir pseudo-class in CSS",
+ "version": "8.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": "^14 || ^16 || >=18"
+ },
+ "main": "dist/index.cjs",
+ "module": "dist/index.mjs",
+ "types": "dist/index.d.ts",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.mjs",
+ "require": "./dist/index.cjs",
+ "default": "./dist/index.mjs"
+ }
+ },
+ "files": [
+ "CHANGELOG.md",
+ "LICENSE.md",
+ "README.md",
+ "dist"
+ ],
+ "dependencies": {
+ "postcss-selector-parser": "^6.0.13"
+ },
+ "peerDependencies": {
+ "postcss": "^8.4"
+ },
+ "devDependencies": {
+ "@csstools/postcss-tape": "*"
+ },
+ "scripts": {
+ "build": "rollup -c ../../rollup/default.mjs",
+ "docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
+ "lint": "node ../../.github/bin/format-package-json.mjs",
+ "prepublishOnly": "npm run build && npm run test",
+ "test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
+ "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
+ },
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-dir-pseudo-class#readme",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/csstools/postcss-plugins.git",
+ "directory": "plugins/postcss-dir-pseudo-class"
+ },
+ "bugs": "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"
+ ],
+ "csstools": {
+ "cssdbId": "dir-pseudo-class",
+ "exportName": "postcssDirPseudoClass",
+ "humanReadableName": "PostCSS Dir Pseudo Class",
+ "specUrl": "https://www.w3.org/TR/selectors-4/#the-dir-pseudo"
+ },
+ "volta": {
+ "extends": "../../package.json"
+ }
+}