Skip to content

Commit 06c9dea

Browse files
Adding PostCSS Trigonometric Functions to PostCSS Preset Env (#399)
* Adding trigonometric functions to postcss-preset-env * Missing external * Adding tests * Missing comma * Updating CHANGELOG
1 parent ec98ce1 commit 06c9dea

29 files changed

+743
-13
lines changed

package-lock.json

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin-packs/postcss-preset-env/CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
# Changes to PostCSS Preset Env
22

3+
### 7.7.0 (Unreleased)
4+
5+
- Added `@csstools/postcss-trigonometric-functions` <br/> [Check the plugin README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-trigonometric-functions#readme) for usage details.
6+
- Updated `@csstools/postcss-cascade-layers` to `1.0.2` (patch)
7+
- Updated `postcss-color-functional-notation` to `4.2.3` (patch)
8+
- Updated `postcss-nesting` to `10.1.7` (patch)
9+
310
### 7.6.0 (May 19, 2022)
411

512
- Added `@csstools/postcss-cascade-layers` <br/> [Check the plugin README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-cascade-layers#readme) for usage details.
6-
- Updated `@csstools/postcss-hwb-function` to `1.0.1` (patch)
7-
- Updated `@csstools/postcss-is-pseudo-class` to `2.0.4` (patch)
8-
- Updated `@csstools/postcss-unset-value` to `1.0.1` (patch)
13+
- Updated `@csstools/postcss-hwb-function` to `1.0.1` (patch)
14+
- Updated `@csstools/postcss-is-pseudo-class` to `2.0.4` (patch)
15+
- Updated `@csstools/postcss-unset-value` to `1.0.1` (patch)
916
- Updated `postcss-nesting` to `10.1.6` (patch)
10-
- Updated `postcss-pseudo-class-any-link` to `7.1.4` (patch)
17+
- Updated `postcss-pseudo-class-any-link` to `7.1.4` (patch)
1118

1219
### 7.5.0 (May 2, 2022)
1320

plugin-packs/postcss-preset-env/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"dist"
2828
],
2929
"dependencies": {
30-
"@csstools/postcss-cascade-layers": "^1.0.1",
30+
"@csstools/postcss-cascade-layers": "^1.0.2",
3131
"@csstools/postcss-color-function": "^1.1.0",
3232
"@csstools/postcss-font-format-keywords": "^1.0.0",
3333
"@csstools/postcss-hwb-function": "^1.0.1",
@@ -37,6 +37,7 @@
3737
"@csstools/postcss-oklab-function": "^1.1.0",
3838
"@csstools/postcss-progressive-custom-properties": "^1.3.0",
3939
"@csstools/postcss-stepped-value-functions": "^1.0.0",
40+
"@csstools/postcss-trigonometric-functions": "^1.0.0",
4041
"@csstools/postcss-unset-value": "^1.0.1",
4142
"autoprefixer": "^10.4.7",
4243
"browserslist": "^4.20.3",
@@ -46,7 +47,7 @@
4647
"cssdb": "^6.6.2",
4748
"postcss-attribute-case-insensitive": "^5.0.0",
4849
"postcss-clamp": "^4.1.0",
49-
"postcss-color-functional-notation": "^4.2.2",
50+
"postcss-color-functional-notation": "^4.2.3",
5051
"postcss-color-hex-alpha": "^8.0.3",
5152
"postcss-color-rebeccapurple": "^7.0.2",
5253
"postcss-custom-media": "^8.0.0",
@@ -64,7 +65,7 @@
6465
"postcss-lab-function": "^4.2.0",
6566
"postcss-logical": "^5.0.4",
6667
"postcss-media-minmax": "^5.0.0",
67-
"postcss-nesting": "^10.1.6",
68+
"postcss-nesting": "^10.1.7",
6869
"postcss-opacity-percentage": "^1.1.2",
6970
"postcss-overflow-shorthand": "^3.0.3",
7071
"postcss-page-break": "^3.0.4",

plugin-packs/postcss-preset-env/scripts/plugins-data.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,10 @@
209209
"packageName": "@csstools/postcss-cascade-layers",
210210
"id": "cascade-layers",
211211
"importName": "postcssCascadeLayers"
212+
},
213+
{
214+
"packageName": "@csstools/postcss-trigonometric-functions",
215+
"id": "trigonometric-functions",
216+
"importName": "postcssTrigonometricFunctions"
212217
}
213218
]

plugin-packs/postcss-preset-env/src/lib/ids-by-execution-order.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ export default [
3333
'place-properties',
3434
'system-ui-font-family',
3535
'cascade-layers',
36+
'stepped-value-functions',
37+
'trigonometric-functions',
3638
];

plugin-packs/postcss-preset-env/src/plugins/plugins-by-id.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import postcssPrefersColorScheme from 'css-prefers-color-scheme';
3939
import postcssColorRebeccapurple from 'postcss-color-rebeccapurple';
4040
import postcssSteppedValueFunctions from '@csstools/postcss-stepped-value-functions';
4141
import postcssFontFamilySystemUI from '../patch/postcss-system-ui-font-family.mjs';
42+
import postcssTrigonometricFunctions from '@csstools/postcss-trigonometric-functions';
4243
import postcssUnsetValue from '@csstools/postcss-unset-value';
4344

4445
// postcss plugins ordered by id
@@ -85,6 +86,7 @@ export const pluginsById = new Map(
8586
['rebeccapurple-color', postcssColorRebeccapurple],
8687
['stepped-value-functions', postcssSteppedValueFunctions],
8788
['system-ui-font-family', postcssFontFamilySystemUI],
89+
['trigonometric-functions', postcssTrigonometricFunctions],
8890
['unset-value', postcssUnsetValue],
8991
],
9092
);

plugin-packs/postcss-preset-env/src/plugins/plugins-data.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,9 @@ export default [
210210
'id': 'cascade-layers',
211211
'importName': 'postcssCascadeLayers',
212212
},
213+
{
214+
'packageName': '@csstools/postcss-trigonometric-functions',
215+
'id': 'trigonometric-functions',
216+
'importName': 'postcssTrigonometricFunctions',
217+
},
213218
];

plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,36 @@
552552
bottom: 2px;
553553
left: 2px;
554554
}
555+
556+
.trigonometric {
557+
left: 0.70711;
558+
left: 0.70711;
559+
left: 1;
560+
left: 30deg;
561+
left: 60deg;
562+
left: 84.29deg;
563+
left: -45deg;
564+
left: 90deg;
565+
left: 135deg;
566+
left: 0.90533;
567+
}
568+
569+
.trigonometric-ignore-not-a-function {
570+
left: sin;
571+
left: cos;
572+
left: tan;
573+
left: asin;
574+
left: acos;
575+
left: atan;
576+
left: atan2;
577+
}
578+
579+
.trigonometric-ignore-no-arguments {
580+
left: sin();
581+
left: cos();
582+
left: tan();
583+
left: asin();
584+
left: acos();
585+
left: atan();
586+
left: atan2();
587+
}

plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,36 @@
552552
bottom: 2px;
553553
left: 2px;
554554
}
555+
556+
.trigonometric {
557+
left: 0.70711;
558+
left: 0.70711;
559+
left: 1;
560+
left: 30deg;
561+
left: 60deg;
562+
left: 84.29deg;
563+
left: -45deg;
564+
left: 90deg;
565+
left: 135deg;
566+
left: 0.90533;
567+
}
568+
569+
.trigonometric-ignore-not-a-function {
570+
left: sin;
571+
left: cos;
572+
left: tan;
573+
left: asin;
574+
left: acos;
575+
left: atan;
576+
left: atan2;
577+
}
578+
579+
.trigonometric-ignore-no-arguments {
580+
left: sin();
581+
left: cos();
582+
left: tan();
583+
left: asin();
584+
left: acos();
585+
left: atan();
586+
left: atan2();
587+
}

plugin-packs/postcss-preset-env/test/basic.ch38.expect.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,36 @@
471471
bottom: 2px;
472472
left: 2px;
473473
}
474+
475+
.trigonometric {
476+
left: 0.70711;
477+
left: 0.70711;
478+
left: 1;
479+
left: 30deg;
480+
left: 60deg;
481+
left: 84.29deg;
482+
left: -45deg;
483+
left: 90deg;
484+
left: 135deg;
485+
left: 0.90533;
486+
}
487+
488+
.trigonometric-ignore-not-a-function {
489+
left: sin;
490+
left: cos;
491+
left: tan;
492+
left: asin;
493+
left: acos;
494+
left: atan;
495+
left: atan2;
496+
}
497+
498+
.trigonometric-ignore-no-arguments {
499+
left: sin();
500+
left: cos();
501+
left: tan();
502+
left: asin();
503+
left: acos();
504+
left: atan();
505+
left: atan2();
506+
}

plugin-packs/postcss-preset-env/test/basic.ch88-ff78-saf10.expect.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,36 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
468468
bottom: 2px;
469469
left: 2px;
470470
}
471+
472+
.trigonometric {
473+
left: 0.70711;
474+
left: 0.70711;
475+
left: 1;
476+
left: 30deg;
477+
left: 60deg;
478+
left: 84.29deg;
479+
left: -45deg;
480+
left: 90deg;
481+
left: 135deg;
482+
left: 0.90533;
483+
}
484+
485+
.trigonometric-ignore-not-a-function {
486+
left: sin;
487+
left: cos;
488+
left: tan;
489+
left: asin;
490+
left: acos;
491+
left: atan;
492+
left: atan2;
493+
}
494+
495+
.trigonometric-ignore-no-arguments {
496+
left: sin();
497+
left: cos();
498+
left: tan();
499+
left: asin();
500+
left: acos();
501+
left: atan();
502+
left: atan2();
503+
}

plugin-packs/postcss-preset-env/test/basic.ch88-ff78.expect.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,3 +442,36 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
442442
bottom: 2px;
443443
left: 2px;
444444
}
445+
446+
.trigonometric {
447+
left: 0.70711;
448+
left: 0.70711;
449+
left: 1;
450+
left: 30deg;
451+
left: 60deg;
452+
left: 84.29deg;
453+
left: -45deg;
454+
left: 90deg;
455+
left: 135deg;
456+
left: 0.90533;
457+
}
458+
459+
.trigonometric-ignore-not-a-function {
460+
left: sin;
461+
left: cos;
462+
left: tan;
463+
left: asin;
464+
left: acos;
465+
left: atan;
466+
left: atan2;
467+
}
468+
469+
.trigonometric-ignore-no-arguments {
470+
left: sin();
471+
left: cos();
472+
left: tan();
473+
left: asin();
474+
left: acos();
475+
left: atan();
476+
left: atan2();
477+
}

plugin-packs/postcss-preset-env/test/basic.ch88-ff78.no-is-pseudo.expect.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,3 +442,36 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
442442
bottom: 2px;
443443
left: 2px;
444444
}
445+
446+
.trigonometric {
447+
left: 0.70711;
448+
left: 0.70711;
449+
left: 1;
450+
left: 30deg;
451+
left: 60deg;
452+
left: 84.29deg;
453+
left: -45deg;
454+
left: 90deg;
455+
left: 135deg;
456+
left: 0.90533;
457+
}
458+
459+
.trigonometric-ignore-not-a-function {
460+
left: sin;
461+
left: cos;
462+
left: tan;
463+
left: asin;
464+
left: acos;
465+
left: atan;
466+
left: atan2;
467+
}
468+
469+
.trigonometric-ignore-no-arguments {
470+
left: sin();
471+
left: cos();
472+
left: tan();
473+
left: asin();
474+
left: acos();
475+
left: atan();
476+
left: atan2();
477+
}

0 commit comments

Comments
 (0)