diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/postcss-custom-selectors | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/postcss-custom-selectors')
| -rw-r--r-- | node_modules/postcss-custom-selectors/CHANGELOG.md | 27 | ||||
| -rw-r--r-- | node_modules/postcss-custom-selectors/LICENSE.md | 21 | ||||
| -rw-r--r-- | node_modules/postcss-custom-selectors/README.md | 120 | ||||
| -rw-r--r-- | node_modules/postcss-custom-selectors/dist/index.cjs | 1 | ||||
| -rw-r--r-- | node_modules/postcss-custom-selectors/dist/index.d.ts | 12 | ||||
| -rw-r--r-- | node_modules/postcss-custom-selectors/dist/index.mjs | 1 | ||||
| -rw-r--r-- | node_modules/postcss-custom-selectors/package.json | 92 |
7 files changed, 0 insertions, 274 deletions
diff --git a/node_modules/postcss-custom-selectors/CHANGELOG.md b/node_modules/postcss-custom-selectors/CHANGELOG.md deleted file mode 100644 index 1026c169..00000000 --- a/node_modules/postcss-custom-selectors/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# Changes to PostCSS Custom Selectors - -### 7.1.12 - -_July 6, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.4.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#241) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#271) (patch) -- Updated [`@csstools/cascade-layer-name-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser) to [`1.0.13`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser/CHANGELOG.md#1013) (patch) - -### 7.1.11 - -_June 29, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#232) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#270) (minor) -- Updated [`@csstools/cascade-layer-name-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser) to [`1.0.12`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser/CHANGELOG.md#1012) (patch) - -### 7.1.10 - -_May 4, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#231) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#263) (patch) -- Updated [`@csstools/cascade-layer-name-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser) to [`1.0.11`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser/CHANGELOG.md#1011) (patch) - -[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-selectors/CHANGELOG.md) diff --git a/node_modules/postcss-custom-selectors/LICENSE.md b/node_modules/postcss-custom-selectors/LICENSE.md deleted file mode 100644 index 6d704708..00000000 --- a/node_modules/postcss-custom-selectors/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -# The MIT License (MIT) - -Copyright © PostCSS - -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, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -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-custom-selectors/README.md b/node_modules/postcss-custom-selectors/README.md deleted file mode 100644 index 71e6626d..00000000 --- a/node_modules/postcss-custom-selectors/README.md +++ /dev/null @@ -1,120 +0,0 @@ -# PostCSS Custom Selectors [<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-custom-selectors.svg" height="20">][npm-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]<br><br>[<img alt="Baseline Status" src="https://cssdb.org/images/badges-baseline/custom-selectors.svg" height="20">][css-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/custom-selectors.svg" height="20">][css-url] - -```bash -npm install postcss-custom-selectors --save-dev -``` - -[PostCSS Custom Selectors] lets you define `@custom-selector` in CSS following the [Custom Selectors Specification]. - -```pcss -@custom-selector :--heading h1, h2, h3; - -article :--heading + p { - margin-top: 0; -} - -/* becomes */ - -article :is(h1, h2, h3) + p { - margin-top: 0; -} -``` - -## Usage - -Add [PostCSS Custom Selectors] to your project: - -```bash -npm install postcss postcss-custom-selectors --save-dev -``` - -Use it as a [PostCSS] plugin: - -```js -const postcss = require('postcss'); -const postcssCustomSelectors = require('postcss-custom-selectors'); - -postcss([ - postcssCustomSelectors(/* pluginOptions */) -]).process(YOUR_CSS /*, processOptions */); -``` - -[PostCSS Custom Selectors] 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 -postcssCustomSelectors({ preserve: true }) -``` - -```pcss -@custom-selector :--heading h1, h2, h3; - -article :--heading + p { - margin-top: 0; -} - -/* becomes */ - -@custom-selector :--heading h1, h2, h3; - -article :is(h1, h2, h3) + p { - margin-top: 0; -} - -article :--heading + p { - margin-top: 0; -} -``` - -## Modular CSS Processing - -If you're using Modular CSS such as, CSS Modules, `postcss-loader` or `vanilla-extract` to name a few, you'll probably -notice that custom selectors are not being resolved. This happens because each file is processed separately so -unless you import the custom selector definitions in each file, they won't be resolved. - -To overcome this, we recommend using the [PostCSS Global Data](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-global-data#readme) -plugin which allows you to pass a list of files that will be globally available. The plugin won't inject any extra code -in the output but will provide the context needed to resolve custom selectors. - -For it to run it needs to be placed before the [PostCSS Custom Selectors] plugin. - -```js -const postcss = require('postcss'); -const postcssCustomSelectors = require('postcss-custom-selectors'); -const postcssGlobalData = require('@csstools/postcss-global-data'); - -postcss([ - postcssGlobalData({ - files: [ - 'path/to/your/custom-selectors.css' - ] - }), - postcssCustomSelectors(/* pluginOptions */) -]).process(YOUR_CSS /*, processOptions */); -``` - -[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test -[css-url]: https://cssdb.org/#custom-selectors -[discord]: https://discord.gg/bUadyRwkJS -[npm-url]: https://www.npmjs.com/package/postcss-custom-selectors - -[PostCSS]: https://github.com/postcss/postcss -[PostCSS Custom Selectors]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-selectors -[Custom Selectors Specification]: https://drafts.csswg.org/css-extensions/#custom-selectors diff --git a/node_modules/postcss-custom-selectors/dist/index.cjs b/node_modules/postcss-custom-selectors/dist/index.cjs deleted file mode 100644 index a088dd20..00000000 --- a/node_modules/postcss-custom-selectors/dist/index.cjs +++ /dev/null @@ -1 +0,0 @@ -"use strict";var e=require("postcss-selector-parser"),r=require("@csstools/cascade-layer-name-parser");const t=r.parse("csstools-implicit-layer")[0];function collectCascadeLayerOrder(e){const s=new Map,o=new Map,n=[];e.walkAtRules((e=>{if("layer"!==e.name.toLowerCase())return;{let r=e.parent;for(;r;){if("atrule"!==r.type||"layer"!==r.name.toLowerCase()){if(r===e.root())break;return}r=r.parent}}let a;if(e.nodes)a=normalizeLayerName(e.params,1);else{if(!e.params.trim())return;a=e.params}let c=r.parse(a);if(c?.length){{let r=e.parent;for(;r&&"atrule"===r.type&&"layer"===r.name.toLowerCase();){const e=o.get(r);e?(c=c.map((r=>e.concat(r))),r=r.parent):r=r.parent}}if(r.addLayerToModel(n,c),e.nodes){const r=c[0].concat(t);s.set(e,r),o.set(e,c[0])}}}));for(const e of s.values())r.addLayerToModel(n,[e]);const a=new WeakMap;for(const[e,r]of s)a.set(e,n.findIndex((e=>r.equal(e))));return a}function normalizeLayerName(e,r){return e.trim()?e:"csstools-anon-layer--"+r++}const s=new Set(["scope","container","layer"]);function isProcessableCustomSelectorRule(e){if("atrule"!==e.type)return!1;if("custom-selector"!==e.name.toLowerCase())return!1;if(!e.params||!e.params.includes(":--"))return!1;if(e.nodes&&e.nodes.length>0)return!1;let r=e.parent;for(;r;){if("rule"===r.type)return!1;if("atrule"===r.type&&!s.has(r.name.toLowerCase()))return!1;r=r.parent}return!0}function getCustomSelectors(r,t,s){const o=new Map,n=new Map,a=collectCascadeLayerOrder(r);return r.walkAtRules((r=>{var c,l;if(isProcessableCustomSelectorRule(r))try{const t=r.params.trim(),p=e().astSync(t),u=p?.nodes?.[0]?.nodes?.[0];if(!u||"pseudo"!==u.type||!u.value.startsWith(":--"))return;const i=u.toString(),m=(l=a,(c=r).parent&&"atrule"===c.parent.type&&"layer"===c.parent.name.toLowerCase()?l.has(c.parent)?l.get(c.parent)+1:0:1e7),f=n.get(i)??-1;if(m&&m>=f&&(n.set(i,m),o.set(i,e().astSync(t.slice(i.length).trim()))),!s.preserve){const e=r.parent;r.remove(),removeEmptyAncestorBlocks(e)}}catch(e){r.warn(t,`Failed to parse selector : "${r.params}" with message: "${e instanceof Error?e.message:e}"`)}})),o}function removeEmptyAncestorBlocks(e){if(!e)return;let r=e;for(;r;){if(r.nodes&&r.nodes.length>0)return;const e=r.parent;r.remove(),r=e}}function transformRule(r,t,s){let o=r.selector;try{o=e((r=>{r.walkPseudos((r=>{if(!s.has(r.value))return;const t=e.pseudo({value:":is",nodes:[]}),o=s.get(r.value);o&&(o.each((e=>{t.append(e.clone())})),r.replaceWith(t))}))})).processSync(r.selector)}catch(e){return r.warn(t,`Failed to parse selector : "${o}" with message: "${e instanceof Error?e.message:e}"`),r.selector}return o}const creator=e=>{const r=e?.preserve??!1;if("importFrom"in Object(e))throw new Error('[postcss-custom-selectors] "importFrom" is no longer supported');if("exportTo"in Object(e))throw new Error('[postcss-custom-selectors] "exportTo" is no longer supported');return{postcssPlugin:"postcss-custom-selectors",prepare(){const e=new WeakSet;let t=new Map;return{postcssPlugin:"postcss-custom-selectors",Once(e,{result:s}){t=getCustomSelectors(e,s,{preserve:r})},Rule(s,{result:o}){if(e.has(s))return;if(!s.selector?.includes(":--"))return;const n=transformRule(s,o,t);n!==s.selector&&(e.add(s),s.cloneBefore({selector:n}),r||s.remove())}}}}};creator.postcss=!0,module.exports=creator; diff --git a/node_modules/postcss-custom-selectors/dist/index.d.ts b/node_modules/postcss-custom-selectors/dist/index.d.ts deleted file mode 100644 index d745e5f7..00000000 --- a/node_modules/postcss-custom-selectors/dist/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { PluginCreator } from 'postcss'; - -declare const creator: PluginCreator<pluginOptions>; -export default creator; - -/** postcss-custom-selectors plugin options */ -export declare type pluginOptions = { - /** Preserve the original notation. default: false */ - preserve?: boolean; -}; - -export { } diff --git a/node_modules/postcss-custom-selectors/dist/index.mjs b/node_modules/postcss-custom-selectors/dist/index.mjs deleted file mode 100644 index 0e09b1d6..00000000 --- a/node_modules/postcss-custom-selectors/dist/index.mjs +++ /dev/null @@ -1 +0,0 @@ -import e from"postcss-selector-parser";import{parse as r,addLayerToModel as t}from"@csstools/cascade-layer-name-parser";const s=r("csstools-implicit-layer")[0];function collectCascadeLayerOrder(e){const o=new Map,n=new Map,a=[];e.walkAtRules((e=>{if("layer"!==e.name.toLowerCase())return;{let r=e.parent;for(;r;){if("atrule"!==r.type||"layer"!==r.name.toLowerCase()){if(r===e.root())break;return}r=r.parent}}let c;if(e.nodes)c=normalizeLayerName(e.params,1);else{if(!e.params.trim())return;c=e.params}let l=r(c);if(l?.length){{let r=e.parent;for(;r&&"atrule"===r.type&&"layer"===r.name.toLowerCase();){const e=n.get(r);e?(l=l.map((r=>e.concat(r))),r=r.parent):r=r.parent}}if(t(a,l),e.nodes){const r=l[0].concat(s);o.set(e,r),n.set(e,l[0])}}}));for(const e of o.values())t(a,[e]);const c=new WeakMap;for(const[e,r]of o)c.set(e,a.findIndex((e=>r.equal(e))));return c}function normalizeLayerName(e,r){return e.trim()?e:"csstools-anon-layer--"+r++}const o=new Set(["scope","container","layer"]);function isProcessableCustomSelectorRule(e){if("atrule"!==e.type)return!1;if("custom-selector"!==e.name.toLowerCase())return!1;if(!e.params||!e.params.includes(":--"))return!1;if(e.nodes&&e.nodes.length>0)return!1;let r=e.parent;for(;r;){if("rule"===r.type)return!1;if("atrule"===r.type&&!o.has(r.name.toLowerCase()))return!1;r=r.parent}return!0}function getCustomSelectors(r,t,s){const o=new Map,n=new Map,a=collectCascadeLayerOrder(r);return r.walkAtRules((r=>{var c,l;if(isProcessableCustomSelectorRule(r))try{const t=r.params.trim(),p=e().astSync(t),u=p?.nodes?.[0]?.nodes?.[0];if(!u||"pseudo"!==u.type||!u.value.startsWith(":--"))return;const i=u.toString(),m=(l=a,(c=r).parent&&"atrule"===c.parent.type&&"layer"===c.parent.name.toLowerCase()?l.has(c.parent)?l.get(c.parent)+1:0:1e7),f=n.get(i)??-1;if(m&&m>=f&&(n.set(i,m),o.set(i,e().astSync(t.slice(i.length).trim()))),!s.preserve){const e=r.parent;r.remove(),removeEmptyAncestorBlocks(e)}}catch(e){r.warn(t,`Failed to parse selector : "${r.params}" with message: "${e instanceof Error?e.message:e}"`)}})),o}function removeEmptyAncestorBlocks(e){if(!e)return;let r=e;for(;r;){if(r.nodes&&r.nodes.length>0)return;const e=r.parent;r.remove(),r=e}}function transformRule(r,t,s){let o=r.selector;try{o=e((r=>{r.walkPseudos((r=>{if(!s.has(r.value))return;const t=e.pseudo({value:":is",nodes:[]}),o=s.get(r.value);o&&(o.each((e=>{t.append(e.clone())})),r.replaceWith(t))}))})).processSync(r.selector)}catch(e){return r.warn(t,`Failed to parse selector : "${o}" with message: "${e instanceof Error?e.message:e}"`),r.selector}return o}const creator=e=>{const r=e?.preserve??!1;if("importFrom"in Object(e))throw new Error('[postcss-custom-selectors] "importFrom" is no longer supported');if("exportTo"in Object(e))throw new Error('[postcss-custom-selectors] "exportTo" is no longer supported');return{postcssPlugin:"postcss-custom-selectors",prepare(){const e=new WeakSet;let t=new Map;return{postcssPlugin:"postcss-custom-selectors",Once(e,{result:s}){t=getCustomSelectors(e,s,{preserve:r})},Rule(s,{result:o}){if(e.has(s))return;if(!s.selector?.includes(":--"))return;const n=transformRule(s,o,t);n!==s.selector&&(e.add(s),s.cloneBefore({selector:n}),r||s.remove())}}}}};creator.postcss=!0;export{creator as default}; diff --git a/node_modules/postcss-custom-selectors/package.json b/node_modules/postcss-custom-selectors/package.json deleted file mode 100644 index 82efc065..00000000 --- a/node_modules/postcss-custom-selectors/package.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "postcss-custom-selectors", - "description": "Use Custom Selectors in CSS", - "version": "7.1.12", - "contributors": [ - { - "name": "Antonio Laguna", - "email": "antonio@laguna.es", - "url": "https://antonio.laguna.es" - }, - { - "name": "Romain Menke", - "email": "romainmenke@gmail.com" - }, - { - "name": "Jonathan Neal", - "email": "jonathantneal@hotmail.com" - }, - { - "name": "Maxime Thirouin" - }, - { - "name": "yisi" - } - ], - "license": "MIT", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/csstools" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - } - ], - "engines": { - "node": "^14 || ^16 || >=18" - }, - "type": "module", - "main": "dist/index.cjs", - "module": "dist/index.mjs", - "exports": { - ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.mjs" - }, - "require": { - "default": "./dist/index.cjs" - } - } - }, - "files": [ - "CHANGELOG.md", - "LICENSE.md", - "README.md", - "dist" - ], - "dependencies": { - "@csstools/cascade-layer-name-parser": "^1.0.13", - "@csstools/css-parser-algorithms": "^2.7.1", - "@csstools/css-tokenizer": "^2.4.1", - "postcss-selector-parser": "^6.1.0" - }, - "peerDependencies": { - "postcss": "^8.4" - }, - "scripts": {}, - "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-selectors#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/csstools/postcss-plugins.git", - "directory": "plugins/postcss-custom-selectors" - }, - "bugs": "https://github.com/csstools/postcss-plugins/issues", - "keywords": [ - "at-rule", - "atrule", - "css", - "csswg", - "custom", - "declarative", - "extensions", - "postcss", - "postcss-plugin", - "rule", - "selectors", - "specification", - "w3c" - ] -} |
