This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# Changes to PostCSS Attribute Case Insensitive
### 5.0.2 (June 8, 2022)
- Fix incorrect selector AST updates
### 5.0.1 (3 June, 2022)
- Prevent exponential backtracking when checking for selectors with case insensitive value matching.
### 5.0.0 (15 September, 2020)
- Postcss 8.x support
### 4.0.1 (10 January, 2019)
### 2.0.0 (06 May, 2017)
### 1.0.1 (19 August, 2016)
### 1.0.0 (10 August, 2016)

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright 2020 Dmitry Semigradsky <semigradskyd@gmail.com>
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.

View File

@@ -0,0 +1,54 @@
# PostCSS Attribute Case Insensitive [<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-attribute-case-insensitive.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/case-insensitive-attributes.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 Attribute Case Insensitive] enables support for [Case Insensitive Attribute] matching in selectors.
```pcss
[frame=hsides i] {
border-style: solid none;
}
/* becomes */
[frame=hsides],[frame=Hsides],[frame=hSides],[frame=HSides],[frame=hsIdes],[frame=HsIdes],[frame=hSIdes],[frame=HSIdes],[frame=hsiDes],[frame=HsiDes],[frame=hSiDes],[frame=HSiDes],[frame=hsIDes],[frame=HsIDes],[frame=hSIDes],[frame=HSIDes],[frame=hsidEs],[frame=HsidEs],[frame=hSidEs],[frame=HSidEs],[frame=hsIdEs],[frame=HsIdEs],[frame=hSIdEs],[frame=HSIdEs],[frame=hsiDEs],[frame=HsiDEs],[frame=hSiDEs],[frame=HSiDEs],[frame=hsIDEs],[frame=HsIDEs],[frame=hSIDEs],[frame=HSIDEs],[frame=hsideS],[frame=HsideS],[frame=hSideS],[frame=HSideS],[frame=hsIdeS],[frame=HsIdeS],[frame=hSIdeS],[frame=HSIdeS],[frame=hsiDeS],[frame=HsiDeS],[frame=hSiDeS],[frame=HSiDeS],[frame=hsIDeS],[frame=HsIDeS],[frame=hSIDeS],[frame=HSIDeS],[frame=hsidES],[frame=HsidES],[frame=hSidES],[frame=HSidES],[frame=hsIdES],[frame=HsIdES],[frame=hSIdES],[frame=HSIdES],[frame=hsiDES],[frame=HsiDES],[frame=hSiDES],[frame=HSiDES],[frame=hsIDES],[frame=HsIDES],[frame=hSIDES],[frame=HSIDES] {
border-style: solid none;
}
```
## Usage
Add [PostCSS Attribute Case Insensitive] to your project:
```bash
npm install postcss postcss-attribute-case-insensitive --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssAttributeCaseInsensitive = require('postcss-attribute-case-insensitive');
postcss([
postcssAttributeCaseInsensitive(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Attribute Case Insensitive] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#case-insensitive-attributes
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/postcss-attribute-case-insensitive
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Attribute Case Insensitive]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-attribute-case-insensitive
[Case Insensitive Attribute]: https://www.w3.org/TR/selectors4/#attribute-case

View File

@@ -0,0 +1 @@
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(require("postcss-selector-parser"));function n(e){return"attribute"===e.type&&e.insensitive}function s(e,t,n){const c=n.charAt(t);if(""===c)return e;let r=e.map((e=>e+c));const o=c.toLocaleUpperCase();return o!==c&&(r=r.concat(e.map((e=>e+o)))),s(r,t+1,n)}function c(e){return s([""],0,e.value).map((t=>{const n=e.clone({spaces:{after:e.spaces.after,before:e.spaces.before},insensitive:!1});return n.setValue(t),n}))}function r(e){let s=[];e.each((e=>{(function(e){return e.some(n)})(e)&&(s=s.concat(function(e){let s=[t.default.selector({value:"",nodes:[]})];return e.walk((e=>{if(!n(e))return void s.forEach((t=>{t.append(e.clone())}));const t=c(e),r=[];t.forEach((e=>{s.forEach((t=>{const n=t.clone({});n.append(e),r.push(n)}))})),s=r})),s}(e)),e.remove())})),s.length&&s.forEach((t=>e.append(t)))}const o=()=>({postcssPlugin:"postcss-attribute-case-insensitive",Rule(e){if(e.selector.includes("i]")){const n=t.default(r).processSync(e.selector);if(n===e.selector)return;e.replaceWith(e.clone({selector:n}))}}});o.postcss=!0,module.exports=o;

View File

@@ -0,0 +1,3 @@
import type { PluginCreator } from 'postcss';
declare const creator: PluginCreator<never>;
export default creator;

View File

@@ -0,0 +1 @@
import e from"postcss-selector-parser";function t(e){return"attribute"===e.type&&e.insensitive}function n(e,t,s){const c=s.charAt(t);if(""===c)return e;let o=e.map((e=>e+c));const r=c.toLocaleUpperCase();return r!==c&&(o=o.concat(e.map((e=>e+r)))),n(o,t+1,s)}function s(e){return n([""],0,e.value).map((t=>{const n=e.clone({spaces:{after:e.spaces.after,before:e.spaces.before},insensitive:!1});return n.setValue(t),n}))}function c(n){let c=[];n.each((n=>{(function(e){return e.some(t)})(n)&&(c=c.concat(function(n){let c=[e.selector({value:"",nodes:[]})];return n.walk((e=>{if(!t(e))return void c.forEach((t=>{t.append(e.clone())}));const n=s(e),o=[];n.forEach((e=>{c.forEach((t=>{const n=t.clone({});n.append(e),o.push(n)}))})),c=o})),c}(n)),n.remove())})),c.length&&c.forEach((e=>n.append(e)))}const o=()=>({postcssPlugin:"postcss-attribute-case-insensitive",Rule(t){if(t.selector.includes("i]")){const n=e(c).processSync(t.selector);if(n===t.selector)return;t.replaceWith(t.clone({selector:n}))}}});o.postcss=!0;export{o as default};

View File

@@ -0,0 +1,86 @@
{
"name": "postcss-attribute-case-insensitive",
"description": "Enable support for case insensitive attribute matching in selectors",
"version": "5.0.2",
"contributors": [
{
"name": "Antonio Laguna",
"email": "antonio@laguna.es",
"url": "https://antonio.laguna.es"
},
{
"name": "Romain Menke",
"email": "romainmenke@gmail.com"
},
{
"name": "Dmitry Semigradsky"
}
],
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"LICENSE",
"README.md",
"dist"
],
"dependencies": {
"postcss-selector-parser": "^6.0.10"
},
"peerDependencies": {
"postcss": "^8.2"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "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-attribute-case-insensitive#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-attribute-case-insensitive"
},
"bugs": "https://github.com/csstools/postcss-plugins/issues",
"keywords": [
"CSS4",
"attribute",
"css",
"insensitive",
"postcss",
"postcss-plugin",
"sensitive"
],
"csstools": {
"cssdbId": "case-insensitive-attributes",
"exportName": "postcssAttributeCaseInsensitive",
"humanReadableName": "PostCSS Attribute Case Insensitive",
"specUrl": "https://www.w3.org/TR/selectors4/#attribute-case"
},
"volta": {
"extends": "../../package.json"
}
}