@csstools/postcss-ic-unit 1.0.1 → 2.0.0
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 +4 -0
- package/README.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -52,8 +52,8 @@ postcss([
|
|
|
52
52
|
[PostCSS IC Unit] runs in all Node environments, with special
|
|
53
53
|
instructions for:
|
|
54
54
|
|
|
55
|
-
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [
|
|
56
|
-
| --- | --- | --- | --- | --- |
|
|
55
|
+
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
|
|
56
|
+
| --- | --- | --- | --- | --- |
|
|
57
57
|
|
|
58
58
|
## Options
|
|
59
59
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function
|
|
1
|
+
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/.test(s.params.toLowerCase()))return!0;s=s.parent}else s=s.parent;return!1}const basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(r){if(!r.value.toLowerCase().includes("ic"))return;if(hasSupportsAtRuleAncestor(r))return;const t=s(r.value);t.walk((e=>{if(!e.type||"word"!==e.type)return;const r=s.unit(e.value);r&&"ic"===r.unit.toLowerCase()&&(e.value=`${r.number}em`)}));const o=String(t);o!==r.value&&(r.cloneBefore({value:o}),e.preserve||r.remove())}});basePlugin.postcss=!0;const postcssPlugin=s=>{const r=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},s);return r.enableProgressiveCustomProperties&&r.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[e(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
|
-
|
|
2
|
+
/** postcss-ic-unit plugin options */
|
|
3
|
+
export type pluginOptions = {
|
|
4
|
+
/** Preserve the original notation. default: false */
|
|
3
5
|
preserve?: boolean;
|
|
6
|
+
/** Enable "@csstools/postcss-progressive-custom-properties". default: true */
|
|
4
7
|
enableProgressiveCustomProperties?: boolean;
|
|
5
8
|
};
|
|
6
9
|
declare const postcssPlugin: PluginCreator<pluginOptions>;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@csstools/postcss-progressive-custom-properties";import s from"postcss-value-parser";
|
|
1
|
+
import e from"@csstools/postcss-progressive-custom-properties";import s from"postcss-value-parser";function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/.test(s.params.toLowerCase()))return!0;s=s.parent}else s=s.parent;return!1}const basePlugin=e=>({postcssPlugin:"postcss-ic-unit",Declaration(t){if(!t.value.toLowerCase().includes("ic"))return;if(hasSupportsAtRuleAncestor(t))return;const r=s(t.value);r.walk((e=>{if(!e.type||"word"!==e.type)return;const t=s.unit(e.value);t&&"ic"===t.unit.toLowerCase()&&(e.value=`${t.number}em`)}));const o=String(r);o!==t.value&&(t.cloneBefore({value:o}),e.preserve||t.remove())}});basePlugin.postcss=!0;const postcssPlugin=s=>{const t=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},s);return t.enableProgressiveCustomProperties&&t.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[e(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0;export{postcssPlugin as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csstools/postcss-ic-unit",
|
|
3
3
|
"description": "Use the ic length unit",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
|
6
6
|
"license": "CC0-1.0",
|
|
7
7
|
"funding": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://opencollective.com/csstools"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": "^
|
|
12
|
+
"node": "^14 || ^16 || >=18"
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/index.cjs",
|
|
15
15
|
"module": "dist/index.mjs",
|
|
@@ -28,15 +28,16 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@csstools/postcss-progressive-custom-properties": "^
|
|
31
|
+
"@csstools/postcss-progressive-custom-properties": "^2.0.0",
|
|
32
32
|
"postcss-value-parser": "^4.2.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"postcss": "^8.
|
|
35
|
+
"postcss": "^8.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"prebuild": "npm run clean",
|
|
39
|
+
"build": "rollup -c ../../rollup/default.mjs",
|
|
40
|
+
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
|
|
40
41
|
"docs": "node ../../.github/bin/generate-docs/install.mjs",
|
|
41
42
|
"lint": "npm run lint:eslint && npm run lint:package-json",
|
|
42
43
|
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
|