diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
| commit | c06f7ee0a40255214c477e13d9b956a7e07c2900 (patch) | |
| tree | f5982a568ef8fab865d0142e71c7494fea3e4c1b /node_modules/postcss-pseudo-class-any-link | |
| parent | 3fd9400d4dccc25aa29b5702216732e0b7542073 (diff) | |
postcss,(plugins): nanocss, postcss-preset-env
Diffstat (limited to 'node_modules/postcss-pseudo-class-any-link')
8 files changed, 428 insertions, 0 deletions
diff --git a/node_modules/postcss-pseudo-class-any-link/CHANGELOG.md b/node_modules/postcss-pseudo-class-any-link/CHANGELOG.md new file mode 100644 index 00000000..1755caaf --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/CHANGELOG.md @@ -0,0 +1,183 @@ +# Changes to PostCSS Pseudo Class Any Link + +### 9.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/)) + +### 8.0.2 + +_February 9, 2023_ + +- Reduce the amount of duplicate fallback CSS. + +### 8.0.1 + +_January 28, 2023_ + +- Improve `types` declaration in `package.json` + +### 8.0.0 + +_January 24, 2023_ + +- Updated: Support for Node v14+ (major). +- Fix: Do not throw when a selector is invalid, show a warning instead. + +### 7.1.6 + +_July 8, 2022_ + +- Fix case insensitive `:any-link` matching. + +### 7.1.5 + +_June 23, 2022_ + +- Fix selector order with any pseudo element. This plugin will no longer re-order selectors. + +### 7.1.4 + +_May 17, 2022_ + +- Fix selector order with `:before` and other pseudo elements. + +### 7.1.3 + +_May 6, 2022_ + +- Improve handling of `<area>` fallbacks for IE and Edge. + +```diff +a:any-link { + text-decoration: none; +} + +/* becomes */ + +- a:link, a:visited, aarea[href] { ++ a:link, a:visited { + text-decoration: none; +} +``` + +### 7.1.2 + +_April 4, 2022_ + +- Improved : compound selector order with pseudo elements + +### 7.1.1 + +_February 5, 2022_ + +- Improved `es module` and `commonjs` compatibility + +### 7.1.0 + +_January 31, 2022_ + +- Add support in IE and Edge for the `<area>` element +- Add support for `:any-link` in pseudo class functions (`:not(:any-link)`) + +To support matching `:any-link` in IE and Edge on `<area href>` you need to set the `subFeatures.areaHrefNeedsFixing` option to `true`: + +```js +postcssPseudoClassAnyLink({ + subFeatures: { + areaHrefNeedsFixing: true + } +}) +``` + +### 7.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). + +### 7.0.1 + +_December 13, 2021_ + +- Updated: documentation + +### 7.0.0 + +_September 17, 2021_ + +- Updated: Support for PostCSS 8+ (major). +- Updated: Support for Node v12+ (major). + +### 6.0.0 + +_September 17, 2018_ + +- Updated: Support for PostCSS v7+ +- Updated: Support for Node v6+ +- Updated: PostCSS Selector Parser 5.0.0-rc.3 (major) + +### 5.0.0 + +_May 7, 2018_ + +- Updated: `postcss-selector-parser` to v4.0.0 (major) +- Updated: `postcss` to v6.0.22 (patch) +- Changed: Preserves `:any-link` by default + +### 4.0.0 + +_May 10, 2017_ + +- Added: Support for PostCSS v6 +- Added: Support for Node v4 +- Removed: `prefix` option, as that would be non-spec + +### 3.0.1 + +_December 8, 2016_ + +- Updated: Use destructing assignment on plugin options +- Updated: Use template literals + +### 3.0.0 + +_December 5, 2016_ + +- Updated: boilerplate conventions (Node v6.9.1 LTS) + +### 1.0.0 + +_September 1, 2015_ + +- Updated: PostCSS 5 +- Updated: Develop dependencies +- Updated: ESLint configuration + +### 0.3.0 + +_June 16, 2015_ + +- Added: Support for complex uses +- Added: Code documentation +- Changed: Coding conventions + +### 0.2.1 + +_June 16, 2015_ + +- Fixed: postcss-selector-parser is included as a dependency + +### 0.2.0 + +_June 15, 2015_ + +- Changed: use postcss-selector-parser + +### 0.1.1 + +_June 14, 2015_ + +Initial release diff --git a/node_modules/postcss-pseudo-class-any-link/LICENSE.md b/node_modules/postcss-pseudo-class-any-link/LICENSE.md new file mode 100644 index 00000000..e8ae93b9 --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/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-pseudo-class-any-link/README.md b/node_modules/postcss-pseudo-class-any-link/README.md new file mode 100644 index 00000000..ae1ec6ea --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/README.md @@ -0,0 +1,115 @@ +# PostCSS Pseudo Class Any Link [<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-pseudo-class-any-link.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/any-link-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 Pseudo Class Any Link] lets you `:any-link` pseudo-class in CSS, +following the [Selectors] specification. + +```pcss +nav :any-link > span { + background-color: yellow; +} + +/* becomes */ + +nav :link > span, nav :visited > span { + background-color: yellow; +} +nav :any-link > span { + background-color: yellow; +} +``` + +## Usage + +Add [PostCSS Pseudo Class Any Link] to your project: + +```bash +npm install postcss postcss-pseudo-class-any-link --save-dev +``` + +Use it as a [PostCSS] plugin: + +```js +const postcss = require('postcss'); +const postcssPseudoClassAnyLink = require('postcss-pseudo-class-any-link'); + +postcss([ + postcssPseudoClassAnyLink(/* pluginOptions */) +]).process(YOUR_CSS /*, processOptions */); +``` + +[PostCSS Pseudo Class Any Link] 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 preserved. + +```js +postcssPseudoClassAnyLink({ preserve: false }) +``` + +```pcss +nav :any-link > span { + background-color: yellow; +} + +/* becomes */ + +nav :link > span, nav :visited > span { + background-color: yellow; +} +``` + +### subFeatures + +#### areaHrefNeedsFixing + +The `subFeatures.areaHrefNeedsFixing` option determines if `<area href>` elements should match `:any-link` pseudo-class.<br> +In IE and Edge these do not match `:link` or `:visited`. + +_This increased CSS bundle size and is disabled by default._ + +```js +postcssPseudoClassAnyLink({ + subFeatures: { + areaHrefNeedsFixing: true + } +}) +``` + +```pcss +nav :any-link > span { + background-color: yellow; +} + +/* becomes */ + +nav :link > span, nav :visited > span, nav area[href] > span { + background-color: yellow; +} +nav :any-link > span { + background-color: yellow; +} +``` + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[css-url]: https://cssdb.org/#any-link-pseudo-class +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/postcss-pseudo-class-any-link + +[PostCSS]: https://github.com/postcss/postcss +[PostCSS Pseudo Class Any Link]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-pseudo-class-any-link +[Selectors]: https://www.w3.org/TR/selectors-4/#the-any-link-pseudo diff --git a/node_modules/postcss-pseudo-class-any-link/dist/index.cjs b/node_modules/postcss-pseudo-class-any-link/dist/index.cjs new file mode 100644 index 00000000..a460c1c8 --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var e=require("postcss-selector-parser");const t=e().astSync(":link").nodes[0],s=e().astSync(":visited").nodes[0],n=e().astSync("area[href]").nodes[0],o=e().astSync("[href]").nodes[0];function replaceAnyLink(e,t,s,n){const o=[],r=[];try{for(let t=0;t<e.selectors.length;t++){const s=e.selectors[t],l=modifiedSelector(s,n);l.length?o.push(...l):r.push(s)}}catch(s){return e.warn(t,`Failed to parse selector : "${e.selector}" with message: "${s.message}"`),!1}return!!o.length&&(e.cloneBefore({selectors:o}),r.length&&e.cloneBefore({selectors:r}),s||e.remove(),!0)}function modifiedSelector(r,l){const c=[];return e((e=>{const r=[];if(e.walkPseudos((e=>{if(":any-link"!==e.value.toLowerCase()||e.nodes&&e.nodes.length)return;if(!l)return void r.push([t.clone({}),s.clone({})]);const c=getTagElementsNextToPseudo(e);c.includes("area")?r.push([t.clone({}),s.clone({}),o.clone({})]):c.length?r.push([t.clone({}),s.clone({})]):r.push([t.clone({}),s.clone({}),n.clone({})])})),!r.length)return;cartesianProduct(...r).forEach((t=>{const s=e.clone({});s.walkPseudos((e=>{":any-link"!==e.value.toLowerCase()||e.nodes&&e.nodes.length||(insertNode(e.parent,e,t.shift()),e.remove())})),c.push(s.toString())}))})).processSync(r),c}function cartesianProduct(...e){const t=[],s=e.length-1;return function helper(n,o){for(let r=0,l=e[o].length;r<l;r++){const l=n.slice(0);l.push(e[o][r]),o==s?t.push(l):helper(l,o+1)}}([],0),t}function getTagElementsNextToPseudo(t){const s=[];let n=t.prev();for(;n&&"combinator"!==n.type&&!e.isPseudoElement(n);)"tag"===n.type&&s.push(n.value.toLowerCase()),n=n.prev();let o=t.next();for(;o&&"combinator"!==o.type&&!e.isPseudoElement(o);)"tag"===o.type&&s.push(o.value.toLowerCase()),o=o.next();return s}function insertNode(t,s,n){let o=n.type;"selector"===n.type&&n.nodes&&n.nodes.length&&(o=n.nodes[0].type);let r=-1,l=-1;const c=t.index(s);for(let s=c;s>=0&&("combinator"!==t.nodes[s].type&&!e.isPseudoElement(t.nodes[s].type));s--)r=s;if("tag"!==o){for(let s=c;s<t.nodes.length&&("combinator"!==t.nodes[s].type&&!e.isPseudoElement(t.nodes[s].type));s++)l=s;for(let e=r;e<=l;e++)if(t.nodes[e].type===o)return void t.insertAfter(t.at(e),n);t.insertAfter(t.at(r),n)}else t.insertBefore(t.at(r),n)}const creator=e=>{const t={preserve:!0,...e},s={areaHrefNeedsFixing:!1,...Object(t.subFeatures)};return{postcssPlugin:"postcss-pseudo-class-any-link",prepare(){const e=new WeakSet;return{Rule(n,{result:o}){if(!n.selector.toLowerCase().includes(":any-link"))return;if(e.has(n))return;if((n.raws.selector&&n.raws.selector.raw||n.selector).endsWith(":"))return;replaceAnyLink(n,o,t.preserve,s.areaHrefNeedsFixing)&&e.add(n)}}}}};creator.postcss=!0,module.exports=creator; diff --git a/node_modules/postcss-pseudo-class-any-link/dist/index.d.ts b/node_modules/postcss-pseudo-class-any-link/dist/index.d.ts new file mode 100644 index 00000000..69101055 --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/dist/index.d.ts @@ -0,0 +1,12 @@ +import type { PluginCreator } from 'postcss'; +/** postcss-pseudo-class-any-link plugin options */ +export type pluginOptions = { + /** Preserve the original notation. default: true */ + preserve?: boolean; + /** Add an extra fallback for the "<area>" element in IE and Edge. default: false */ + subFeatures?: { + areaHrefNeedsFixing?: boolean; + }; +}; +declare const creator: PluginCreator<pluginOptions>; +export default creator; diff --git a/node_modules/postcss-pseudo-class-any-link/dist/index.mjs b/node_modules/postcss-pseudo-class-any-link/dist/index.mjs new file mode 100644 index 00000000..0d91f460 --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/dist/index.mjs @@ -0,0 +1 @@ +import e from"postcss-selector-parser";const t=e().astSync(":link").nodes[0],s=e().astSync(":visited").nodes[0],n=e().astSync("area[href]").nodes[0],o=e().astSync("[href]").nodes[0];function replaceAnyLink(e,t,s,n){const o=[],r=[];try{for(let t=0;t<e.selectors.length;t++){const s=e.selectors[t],l=modifiedSelector(s,n);l.length?o.push(...l):r.push(s)}}catch(s){return e.warn(t,`Failed to parse selector : "${e.selector}" with message: "${s.message}"`),!1}return!!o.length&&(e.cloneBefore({selectors:o}),r.length&&e.cloneBefore({selectors:r}),s||e.remove(),!0)}function modifiedSelector(r,l){const c=[];return e((e=>{const r=[];if(e.walkPseudos((e=>{if(":any-link"!==e.value.toLowerCase()||e.nodes&&e.nodes.length)return;if(!l)return void r.push([t.clone({}),s.clone({})]);const c=getTagElementsNextToPseudo(e);c.includes("area")?r.push([t.clone({}),s.clone({}),o.clone({})]):c.length?r.push([t.clone({}),s.clone({})]):r.push([t.clone({}),s.clone({}),n.clone({})])})),!r.length)return;cartesianProduct(...r).forEach((t=>{const s=e.clone({});s.walkPseudos((e=>{":any-link"!==e.value.toLowerCase()||e.nodes&&e.nodes.length||(insertNode(e.parent,e,t.shift()),e.remove())})),c.push(s.toString())}))})).processSync(r),c}function cartesianProduct(...e){const t=[],s=e.length-1;return function helper(n,o){for(let r=0,l=e[o].length;r<l;r++){const l=n.slice(0);l.push(e[o][r]),o==s?t.push(l):helper(l,o+1)}}([],0),t}function getTagElementsNextToPseudo(t){const s=[];let n=t.prev();for(;n&&"combinator"!==n.type&&!e.isPseudoElement(n);)"tag"===n.type&&s.push(n.value.toLowerCase()),n=n.prev();let o=t.next();for(;o&&"combinator"!==o.type&&!e.isPseudoElement(o);)"tag"===o.type&&s.push(o.value.toLowerCase()),o=o.next();return s}function insertNode(t,s,n){let o=n.type;"selector"===n.type&&n.nodes&&n.nodes.length&&(o=n.nodes[0].type);let r=-1,l=-1;const c=t.index(s);for(let s=c;s>=0&&("combinator"!==t.nodes[s].type&&!e.isPseudoElement(t.nodes[s].type));s--)r=s;if("tag"!==o){for(let s=c;s<t.nodes.length&&("combinator"!==t.nodes[s].type&&!e.isPseudoElement(t.nodes[s].type));s++)l=s;for(let e=r;e<=l;e++)if(t.nodes[e].type===o)return void t.insertAfter(t.at(e),n);t.insertAfter(t.at(r),n)}else t.insertBefore(t.at(r),n)}const creator=e=>{const t={preserve:!0,...e},s={areaHrefNeedsFixing:!1,...Object(t.subFeatures)};return{postcssPlugin:"postcss-pseudo-class-any-link",prepare(){const e=new WeakSet;return{Rule(n,{result:o}){if(!n.selector.toLowerCase().includes(":any-link"))return;if(e.has(n))return;if((n.raws.selector&&n.raws.selector.raw||n.selector).endsWith(":"))return;replaceAnyLink(n,o,t.preserve,s.areaHrefNeedsFixing)&&e.add(n)}}}}};creator.postcss=!0;export{creator as default}; diff --git a/node_modules/postcss-pseudo-class-any-link/dist/replace-any-link.d.ts b/node_modules/postcss-pseudo-class-any-link/dist/replace-any-link.d.ts new file mode 100644 index 00000000..f465ab2b --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/dist/replace-any-link.d.ts @@ -0,0 +1,2 @@ +import type { Result, Rule } from 'postcss'; +export declare function replaceAnyLink(rule: Rule, result: Result, preserve: boolean, areaHrefNeedsFixing: boolean): boolean; diff --git a/node_modules/postcss-pseudo-class-any-link/package.json b/node_modules/postcss-pseudo-class-any-link/package.json new file mode 100644 index 00000000..e4b0de32 --- /dev/null +++ b/node_modules/postcss-pseudo-class-any-link/package.json @@ -0,0 +1,96 @@ +{ + "name": "postcss-pseudo-class-any-link", + "description": "Use the :any-link pseudo-class in CSS", + "version": "9.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-pseudo-class-any-link#readme", + "repository": { + "type": "git", + "url": "https://github.com/csstools/postcss-plugins.git", + "directory": "plugins/postcss-pseudo-class-any-link" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "a", + "any-link", + "area", + "css", + "href", + "hyperlink", + "link", + "postcss", + "postcss-plugin", + "visited" + ], + "csstools": { + "cssdbId": "any-link-pseudo-class", + "exportName": "postcssPseudoClassAnyLink", + "humanReadableName": "PostCSS Pseudo Class Any Link", + "specUrl": "https://www.w3.org/TR/selectors-4/#the-any-link-pseudo" + }, + "volta": { + "extends": "../../package.json" + } +} |
