postcss-focus-within 4.0.0 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +4 -4
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +1 -0
- package/package.json +31 -57
- package/dist/index.cjs.js +0 -29
- package/dist/index.esm.js +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changes to PostCSS Focus Within
|
|
2
2
|
|
|
3
|
+
### 5.0.3 (January 2, 2022)
|
|
4
|
+
|
|
5
|
+
- Removed Sourcemaps from package tarball.
|
|
6
|
+
- Moved CLI to CLI Package. See [announcement](https://github.com/csstools/postcss-plugins/discussions/121).
|
|
7
|
+
|
|
8
|
+
### 5.0.2 (December 13, 2021)
|
|
9
|
+
|
|
10
|
+
- Changed: now uses `postcss-selector-parser` for parsing.
|
|
11
|
+
- Updated: documentation
|
|
12
|
+
|
|
13
|
+
### 5.0.1 (September 22, 2021)
|
|
14
|
+
|
|
15
|
+
- Added missing `dist` to bundle.
|
|
16
|
+
- Added missing `exports` to `package.json`
|
|
17
|
+
- Added missing `types` to `package.json`
|
|
18
|
+
- Added bundling & testing as prepublish step.
|
|
19
|
+
|
|
20
|
+
### 5.0.0 (September 17, 2021)
|
|
21
|
+
|
|
22
|
+
- Updated: Support for PostCS 8+ (major).
|
|
23
|
+
- Updated: Support for Node 12+ (major).
|
|
24
|
+
|
|
3
25
|
### 4.0.0 (April 20, 2020)
|
|
4
26
|
|
|
5
27
|
- Fixed: Allow `:focus-within` to appear escaped in a selector
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[<img alt="npm version" src="https://img.shields.io/npm/v/postcss-focus-within.svg" height="20">][npm-url]
|
|
4
4
|
[<img alt="CSS Standard Status" src="https://cssdb.org/badge/focus-within-pseudo-class.svg" height="20">][css-url]
|
|
5
|
-
[<img alt="
|
|
5
|
+
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/tree/main/postcss-focus-within/workflows/test/badge.svg" height="20">][cli-url]
|
|
6
6
|
[<img alt="support chat" src="https://img.shields.io/badge/support-chat-blue.svg" height="20">][git-url]
|
|
7
7
|
|
|
8
8
|
[PostCSS Focus Within] lets you use the `:focus-within` pseudo-class in CSS,
|
|
@@ -39,7 +39,7 @@ rule can be disabled using the `preserve` option.
|
|
|
39
39
|
Add [PostCSS Focus Within] to your project:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npm install postcss-focus-within --save-dev
|
|
42
|
+
npm install postcss postcss-focus-within --save-dev
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Use [PostCSS Focus Within] to process your CSS:
|
|
@@ -116,7 +116,7 @@ focusWithin({ replaceWith: '.focus-within' });
|
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
[css-url]: https://cssdb.org/#focus-within-pseudo-class
|
|
119
|
-
[cli-url]: https://
|
|
119
|
+
[cli-url]: https://github.com/csstools/postcss-plugins/tree/main/postcss-focus-within/actions/workflows/test.yml?query=workflow/test
|
|
120
120
|
[git-url]: https://gitter.im/postcss/postcss
|
|
121
121
|
[npm-url]: https://www.npmjs.com/package/postcss-focus-within
|
|
122
122
|
|
|
@@ -124,6 +124,6 @@ focusWithin({ replaceWith: '.focus-within' });
|
|
|
124
124
|
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
|
|
125
125
|
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
|
|
126
126
|
[PostCSS]: https://github.com/postcss/postcss
|
|
127
|
-
[PostCSS Focus Within]: https://github.com/csstools/postcss-focus-within
|
|
127
|
+
[PostCSS Focus Within]: https://github.com/csstools/postcss-plugins/tree/main/postcss-focus-within
|
|
128
128
|
[PostCSS Loader]: https://github.com/postcss/postcss-loader
|
|
129
129
|
[Selectors Level 4 specification]: https://www.w3.org/TR/selectors-4/#the-focus-within-pseudo
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(require("postcss-selector-parser"));const s=e=>{const s=String(Object(e).replaceWith||"[focus-within]"),r=Boolean(!("preserve"in Object(e))||e.preserve),o=t.default().astSync(s);return{postcssPlugin:"postcss-focus-within",Rule:(e,{result:s})=>{if(!e.selector.includes(":focus-within"))return;let c;try{const s=t.default((e=>{e.walkPseudos((e=>{":focus-within"===e.value&&(e.nodes&&e.nodes.length||e.replaceWith(o.clone({})))}))})).processSync(e.selector);c=String(s)}catch(t){return void e.warn(s,`Failed to parse selector : ${e.selector}`)}if(void 0===c)return;if(c===e.selector)return;const n=e.clone({selector:c});r?e.before(n):e.replaceWith(n)}}};s.postcss=!0,module.exports=s;
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"postcss-selector-parser";const s=s=>{const t=String(Object(s).replaceWith||"[focus-within]"),r=Boolean(!("preserve"in Object(s))||s.preserve),o=e().astSync(t);return{postcssPlugin:"postcss-focus-within",Rule:(s,{result:t})=>{if(!s.selector.includes(":focus-within"))return;let c;try{const t=e((e=>{e.walkPseudos((e=>{":focus-within"===e.value&&(e.nodes&&e.nodes.length||e.replaceWith(o.clone({})))}))})).processSync(s.selector);c=String(t)}catch(e){return void s.warn(t,`Failed to parse selector : ${s.selector}`)}if(void 0===c)return;if(c===s.selector)return;const n=s.clone({selector:c});r?s.before(n):s.replaceWith(n)}}};s.postcss=!0;export{s as default};
|
package/package.json
CHANGED
|
@@ -1,75 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-focus-within",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Use the :focus-within pseudo-selector in CSS",
|
|
5
5
|
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
|
6
6
|
"license": "CC0-1.0",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
7
|
+
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-focus-within#readme",
|
|
8
|
+
"bugs": "https://github.com/csstools/postcss-plugins/issues",
|
|
9
|
+
"main": "dist/index.cjs",
|
|
10
|
+
"module": "dist/index.mjs",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
12
|
"files": [
|
|
13
|
+
"CHANGELOG.md",
|
|
14
|
+
"LICENSE.md",
|
|
15
|
+
"README.md",
|
|
13
16
|
"dist"
|
|
14
17
|
],
|
|
15
18
|
"scripts": {
|
|
16
|
-
"build": "
|
|
17
|
-
"
|
|
18
|
-
"lint": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"test": "
|
|
22
|
-
"
|
|
19
|
+
"build": "rollup -c ../../rollup/default.js",
|
|
20
|
+
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
|
|
21
|
+
"lint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
|
|
22
|
+
"prepublishOnly": "npm run clean && npm run build && npm run test",
|
|
23
|
+
"stryker": "stryker run --logLevel error",
|
|
24
|
+
"test": "postcss-tape --ci && npm run test:exports",
|
|
25
|
+
"test:exports": "node ./test/_import.mjs && node ./test/_require.cjs"
|
|
23
26
|
},
|
|
24
27
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
28
|
+
"node": "^12 || ^14 || >=16"
|
|
26
29
|
},
|
|
27
30
|
"dependencies": {
|
|
28
|
-
"postcss": "^
|
|
31
|
+
"postcss-selector-parser": "^6.0.8"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"babel-eslint": "^10.1.0",
|
|
34
|
-
"eslint": "^6.8.0",
|
|
35
|
-
"postcss-tape": "5.0.2",
|
|
36
|
-
"pre-commit": "^1.2.2",
|
|
37
|
-
"rollup": "^2.6.1",
|
|
38
|
-
"rollup-plugin-babel": "^4.4.0"
|
|
34
|
+
"postcss": "^8.3.6",
|
|
35
|
+
"postcss-tape": "^6.0.1"
|
|
39
36
|
},
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
[
|
|
43
|
-
"@babel/env",
|
|
44
|
-
{
|
|
45
|
-
"targets": "maintained node versions"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
"eslintConfig": {
|
|
51
|
-
"env": {
|
|
52
|
-
"es6": true,
|
|
53
|
-
"node": true
|
|
54
|
-
},
|
|
55
|
-
"extends": "eslint:recommended",
|
|
56
|
-
"parser": "babel-eslint"
|
|
57
|
-
},
|
|
58
|
-
"rollup": {
|
|
59
|
-
"input": "src/index.js",
|
|
60
|
-
"plugins": [
|
|
61
|
-
"rollup-plugin-babel"
|
|
62
|
-
],
|
|
63
|
-
"output": [
|
|
64
|
-
{
|
|
65
|
-
"file": "dist/index.cjs.js",
|
|
66
|
-
"format": "cjs"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"file": "dist/index.esm.js",
|
|
70
|
-
"format": "esm"
|
|
71
|
-
}
|
|
72
|
-
]
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"postcss": "^8.3"
|
|
73
39
|
},
|
|
74
40
|
"keywords": [
|
|
75
41
|
"postcss",
|
|
@@ -84,5 +50,13 @@
|
|
|
84
50
|
"a11y",
|
|
85
51
|
"descendants",
|
|
86
52
|
"ancestors"
|
|
87
|
-
]
|
|
53
|
+
],
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "https://github.com/csstools/postcss-plugins.git",
|
|
57
|
+
"directory": "plugins/postcss-focus-within"
|
|
58
|
+
},
|
|
59
|
+
"volta": {
|
|
60
|
+
"extends": "../../package.json"
|
|
61
|
+
}
|
|
88
62
|
}
|
package/dist/index.cjs.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
|
-
|
|
5
|
-
var postcss = _interopDefault(require('postcss'));
|
|
6
|
-
|
|
7
|
-
const selectorRegExp = /(?<!\\):focus-within([^\w-]|$)/gi;
|
|
8
|
-
var index = postcss.plugin('postcss-focus-within', opts => {
|
|
9
|
-
const replaceWith = String(Object(opts).replaceWith || '[focus-within]');
|
|
10
|
-
const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
|
|
11
|
-
return root => {
|
|
12
|
-
root.walkRules(selectorRegExp, rule => {
|
|
13
|
-
const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
|
|
14
|
-
return `${replaceWith}${$1}`;
|
|
15
|
-
});
|
|
16
|
-
const clone = rule.clone({
|
|
17
|
-
selector
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (preserve) {
|
|
21
|
-
rule.before(clone);
|
|
22
|
-
} else {
|
|
23
|
-
rule.replaceWith(clone);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
module.exports = index;
|
package/dist/index.esm.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import postcss from 'postcss';
|
|
2
|
-
|
|
3
|
-
const selectorRegExp = /(?<!\\):focus-within([^\w-]|$)/gi;
|
|
4
|
-
var index = postcss.plugin('postcss-focus-within', opts => {
|
|
5
|
-
const replaceWith = String(Object(opts).replaceWith || '[focus-within]');
|
|
6
|
-
const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
|
|
7
|
-
return root => {
|
|
8
|
-
root.walkRules(selectorRegExp, rule => {
|
|
9
|
-
const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
|
|
10
|
-
return `${replaceWith}${$1}`;
|
|
11
|
-
});
|
|
12
|
-
const clone = rule.clone({
|
|
13
|
-
selector
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
if (preserve) {
|
|
17
|
-
rule.before(clone);
|
|
18
|
-
} else {
|
|
19
|
-
rule.replaceWith(clone);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export default index;
|