From 9e598b4250a4b3c6bf003c5f623a61b825527646 Mon Sep 17 00:00:00 2001
From: Romain Menke
Date: Mon, 11 Nov 2024 09:35:04 +0100
Subject: [PATCH 1/7] postcss-sign-functions
---
plugins/postcss-sign-functions/.gitignore | 6 +
plugins/postcss-sign-functions/.nvmrc | 1 +
plugins/postcss-sign-functions/CHANGELOG.md | 170 +++++++++++++
plugins/postcss-sign-functions/INSTALL.md | 235 ++++++++++++++++++
plugins/postcss-sign-functions/LICENSE.md | 18 ++
plugins/postcss-sign-functions/README.md | 180 ++++++++++++++
.../postcss-sign-functions/api-extractor.json | 4 +
plugins/postcss-sign-functions/dist/index.cjs | 1 +
.../postcss-sign-functions/dist/index.d.ts | 12 +
plugins/postcss-sign-functions/dist/index.mjs | 1 +
plugins/postcss-sign-functions/docs/README.md | 65 +++++
plugins/postcss-sign-functions/package.json | 91 +++++++
plugins/postcss-sign-functions/src/index.ts | 48 ++++
.../postcss-sign-functions/test/_import.mjs | 6 +
.../postcss-sign-functions/test/_require.cjs | 6 +
plugins/postcss-sign-functions/test/_tape.mjs | 23 ++
plugins/postcss-sign-functions/test/basic.css | 61 +++++
.../test/basic.expect.css | 72 ++++++
.../test/basic.preserve-false.expect.css | 61 +++++
.../test/examples/example.css | 23 ++
.../test/examples/example.expect.css | 29 +++
.../example.preserve-false.expect.css | 23 ++
plugins/postcss-sign-functions/tsconfig.json | 10 +
23 files changed, 1146 insertions(+)
create mode 100644 plugins/postcss-sign-functions/.gitignore
create mode 100644 plugins/postcss-sign-functions/.nvmrc
create mode 100644 plugins/postcss-sign-functions/CHANGELOG.md
create mode 100644 plugins/postcss-sign-functions/INSTALL.md
create mode 100644 plugins/postcss-sign-functions/LICENSE.md
create mode 100644 plugins/postcss-sign-functions/README.md
create mode 100644 plugins/postcss-sign-functions/api-extractor.json
create mode 100644 plugins/postcss-sign-functions/dist/index.cjs
create mode 100644 plugins/postcss-sign-functions/dist/index.d.ts
create mode 100644 plugins/postcss-sign-functions/dist/index.mjs
create mode 100644 plugins/postcss-sign-functions/docs/README.md
create mode 100644 plugins/postcss-sign-functions/package.json
create mode 100644 plugins/postcss-sign-functions/src/index.ts
create mode 100644 plugins/postcss-sign-functions/test/_import.mjs
create mode 100644 plugins/postcss-sign-functions/test/_require.cjs
create mode 100644 plugins/postcss-sign-functions/test/_tape.mjs
create mode 100644 plugins/postcss-sign-functions/test/basic.css
create mode 100644 plugins/postcss-sign-functions/test/basic.expect.css
create mode 100644 plugins/postcss-sign-functions/test/basic.preserve-false.expect.css
create mode 100644 plugins/postcss-sign-functions/test/examples/example.css
create mode 100644 plugins/postcss-sign-functions/test/examples/example.expect.css
create mode 100644 plugins/postcss-sign-functions/test/examples/example.preserve-false.expect.css
create mode 100644 plugins/postcss-sign-functions/tsconfig.json
diff --git a/plugins/postcss-sign-functions/.gitignore b/plugins/postcss-sign-functions/.gitignore
new file mode 100644
index 000000000..e5b28db4a
--- /dev/null
+++ b/plugins/postcss-sign-functions/.gitignore
@@ -0,0 +1,6 @@
+node_modules
+package-lock.json
+yarn.lock
+*.result.css
+*.result.css.map
+*.result.html
diff --git a/plugins/postcss-sign-functions/.nvmrc b/plugins/postcss-sign-functions/.nvmrc
new file mode 100644
index 000000000..6ed5da955
--- /dev/null
+++ b/plugins/postcss-sign-functions/.nvmrc
@@ -0,0 +1 @@
+v20.2.0
diff --git a/plugins/postcss-sign-functions/CHANGELOG.md b/plugins/postcss-sign-functions/CHANGELOG.md
new file mode 100644
index 000000000..135c12cf2
--- /dev/null
+++ b/plugins/postcss-sign-functions/CHANGELOG.md
@@ -0,0 +1,170 @@
+# Changes to PostCSS Stepped Value Functions
+
+### 4.0.4
+
+_November 1, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#303) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#304) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#204) (patch)
+
+### 4.0.3
+
+_October 23, 2024_
+
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#303) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#203) (patch)
+
+### 4.0.2
+
+_October 10, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#302) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#302) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#202) (patch)
+
+### 4.0.1
+
+_August 18, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#301) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#301) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#201) (patch)
+
+### 4.0.0
+
+_August 3, 2024_
+
+- Updated: Support for Node v18+ (major).
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#300) (major)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#300) (major)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#200) (major)
+
+### 3.0.10
+
+_July 6, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.4.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#241) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#271) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#124) (patch)
+
+### 3.0.9
+
+_June 29, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#232) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#270) (minor)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#123) (patch)
+
+### 3.0.8
+
+_May 4, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#231) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#263) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#122) (patch)
+
+### 3.0.7
+
+_May 4, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#230) (minor)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#262) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#121) (patch)
+
+### 3.0.6
+
+_March 13, 2024_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#224) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#261) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#120) (minor)
+
+### 3.0.5
+
+_February 19, 2024_
+
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#260) (minor)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.7`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#117) (patch)
+
+### 3.0.4
+
+_December 31, 2023_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#223) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.5.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#250) (minor)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.6`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#116) (patch)
+
+### 3.0.3
+
+_December 15, 2023_
+
+- Fix type definitions
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#222) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.4.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#240) (minor)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.5`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#115) (patch)
+
+### 3.0.2
+
+_September 24, 2023_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#221) (patch)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#232) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#114) (patch)
+
+### 3.0.1
+
+_July 24, 2023_
+
+- Use the latest utilities from `@csstools/css-tokenizer` to reduce the bundle size.
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#220) (minor)
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#231) (patch)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#113) (patch)
+
+### 3.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/))
+- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#230) (minor)
+- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#112) (patch)
+
+### 2.1.1
+
+_April 10, 2023_
+
+- Updated `@csstools/css-tokenizer` to `2.1.1` (patch)
+- Updated `@csstools/css-parser-algorithms` to `2.1.1` (patch)
+- Updated `@csstools/css-calc` to `1.1.1` (patch)
+
+### 2.1.0
+
+_February 21, 2023_
+
+- Removed: warnings on `var()` or otherwise unconvertible values (doesn't affect the output, non-breaking)
+- Added: `@csstools/css-calc`
+- Added: unit conversions (`mod(735ms, 0.1s)`)
+
+### 2.0.1
+
+_January 28, 2023_
+
+- Improve `types` declaration in `package.json`
+
+### 2.0.0
+
+_January 24, 2023_
+
+- Updated: Support for Node v14+ (major).
+
+### 1.0.1
+
+_July 8, 2022_
+
+- Fix case insensitive matching.
+
+### 1.0.0
+
+_May 2, 2022_
+
+- Initial version
diff --git a/plugins/postcss-sign-functions/INSTALL.md b/plugins/postcss-sign-functions/INSTALL.md
new file mode 100644
index 000000000..e190aba65
--- /dev/null
+++ b/plugins/postcss-sign-functions/INSTALL.md
@@ -0,0 +1,235 @@
+# Installing PostCSS Sign Functions
+
+[PostCSS Sign Functions] runs in all Node environments, with special instructions for:
+
+- [Node](#node)
+- [PostCSS CLI](#postcss-cli)
+- [PostCSS Load Config](#postcss-load-config)
+- [Webpack](#webpack)
+- [Next.js](#nextjs)
+- [Gulp](#gulp)
+- [Grunt](#grunt)
+
+
+
+## Node
+
+Add [PostCSS Sign Functions] to your project:
+
+```bash
+npm install postcss @csstools/postcss-sign-functions --save-dev
+```
+
+Use it as a [PostCSS] plugin:
+
+```js
+// commonjs
+const postcss = require('postcss');
+const postcssSignFunctions = require('@csstools/postcss-sign-functions');
+
+postcss([
+ postcssSignFunctions(/* pluginOptions */)
+]).process(YOUR_CSS /*, processOptions */);
+```
+
+```js
+// esm
+import postcss from 'postcss';
+import postcssSignFunctions from '@csstools/postcss-sign-functions';
+
+postcss([
+ postcssSignFunctions(/* pluginOptions */)
+]).process(YOUR_CSS /*, processOptions */);
+```
+
+## PostCSS CLI
+
+Add [PostCSS CLI] to your project:
+
+```bash
+npm install postcss-cli @csstools/postcss-sign-functions --save-dev
+```
+
+Use [PostCSS Sign Functions] in your `postcss.config.js` configuration file:
+
+```js
+const postcssSignFunctions = require('@csstools/postcss-sign-functions');
+
+module.exports = {
+ plugins: [
+ postcssSignFunctions(/* pluginOptions */)
+ ]
+}
+```
+
+## PostCSS Load Config
+
+If your framework/CLI supports [`postcss-load-config`](https://github.com/postcss/postcss-load-config).
+
+```bash
+npm install @csstools/postcss-sign-functions --save-dev
+```
+
+`package.json`:
+
+```json
+{
+ "postcss": {
+ "plugins": {
+ "@csstools/postcss-sign-functions": {}
+ }
+ }
+}
+```
+
+`.postcssrc.json`:
+
+```json
+{
+ "plugins": {
+ "@csstools/postcss-sign-functions": {}
+ }
+}
+```
+
+_See the [README of `postcss-load-config`](https://github.com/postcss/postcss-load-config#usage) for more usage options._
+
+## Webpack
+
+_Webpack version 5_
+
+Add [PostCSS Loader] to your project:
+
+```bash
+npm install postcss-loader @csstools/postcss-sign-functions --save-dev
+```
+
+Use [PostCSS Sign Functions] in your Webpack configuration:
+
+```js
+module.exports = {
+ module: {
+ rules: [
+ {
+ test: /\.css$/i,
+ use: [
+ "style-loader",
+ {
+ loader: "css-loader",
+ options: { importLoaders: 1 },
+ },
+ {
+ loader: "postcss-loader",
+ options: {
+ postcssOptions: {
+ plugins: [
+ // Other plugins,
+ [
+ "@csstools/postcss-sign-functions",
+ {
+ // Options
+ },
+ ],
+ ],
+ },
+ },
+ },
+ ],
+ },
+ ],
+ },
+};
+```
+
+## Next.js
+
+Read the instructions on how to [customize the PostCSS configuration in Next.js](https://nextjs.org/docs/advanced-features/customizing-postcss-config)
+
+```bash
+npm install @csstools/postcss-sign-functions --save-dev
+```
+
+Use [PostCSS Sign Functions] in your `postcss.config.json` file:
+
+```json
+{
+ "plugins": [
+ "@csstools/postcss-sign-functions"
+ ]
+}
+```
+
+```json5
+{
+ "plugins": [
+ [
+ "@csstools/postcss-sign-functions",
+ {
+ // Optionally add plugin options
+ }
+ ]
+ ]
+}
+```
+
+## Gulp
+
+Add [Gulp PostCSS] to your project:
+
+```bash
+npm install gulp-postcss @csstools/postcss-sign-functions --save-dev
+```
+
+Use [PostCSS Sign Functions] in your Gulpfile:
+
+```js
+const postcss = require('gulp-postcss');
+const postcssSignFunctions = require('@csstools/postcss-sign-functions');
+
+gulp.task('css', function () {
+ var plugins = [
+ postcssSignFunctions(/* pluginOptions */)
+ ];
+
+ return gulp.src('./src/*.css')
+ .pipe(postcss(plugins))
+ .pipe(gulp.dest('.'));
+});
+```
+
+## Grunt
+
+Add [Grunt PostCSS] to your project:
+
+```bash
+npm install grunt-postcss @csstools/postcss-sign-functions --save-dev
+```
+
+Use [PostCSS Sign Functions] in your Gruntfile:
+
+```js
+const postcssSignFunctions = require('@csstools/postcss-sign-functions');
+
+grunt.loadNpmTasks('grunt-postcss');
+
+grunt.initConfig({
+ postcss: {
+ options: {
+ processors: [
+ postcssSignFunctions(/* pluginOptions */)
+ ]
+ },
+ dist: {
+ src: '*.css'
+ }
+ }
+});
+```
+
+[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
+[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
+[PostCSS]: https://github.com/postcss/postcss
+[PostCSS CLI]: https://github.com/postcss/postcss-cli
+[PostCSS Loader]: https://github.com/postcss/postcss-loader
+[PostCSS Sign Functions]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-sign-functions
+[Next.js]: https://nextjs.org
diff --git a/plugins/postcss-sign-functions/LICENSE.md b/plugins/postcss-sign-functions/LICENSE.md
new file mode 100644
index 000000000..e8ae93b9f
--- /dev/null
+++ b/plugins/postcss-sign-functions/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/plugins/postcss-sign-functions/README.md b/plugins/postcss-sign-functions/README.md
new file mode 100644
index 000000000..3d955e6fb
--- /dev/null
+++ b/plugins/postcss-sign-functions/README.md
@@ -0,0 +1,180 @@
+# PostCSS Sign Functions [
][PostCSS]
+
+[
][npm-url] [
][cli-url] [
][discord]
[
][css-url] [
][css-url]
+
+```bash
+npm install @csstools/postcss-sign-functions --save-dev
+```
+
+[PostCSS Sign Functions] lets you use the `sign` and `abs` functions, following the [CSS Values 4].
+
+```pcss
+.sign {
+ z-index: sign(-10px);
+}
+
+.sign {
+ z-index: sign(0);
+}
+
+.sign {
+ z-index: sign(10px);
+}
+
+.abs {
+ z-index: abs(-10px);
+}
+
+.abs {
+ z-index: abs(0);
+}
+
+.abs {
+ z-index: abs(10px);
+}
+
+/* becomes */
+
+.sign {
+ z-index: -1;
+ z-index: sign(-10px);
+}
+
+.sign {
+ z-index: 0;
+ z-index: sign(0);
+}
+
+.sign {
+ z-index: 1;
+ z-index: sign(10px);
+}
+
+.abs {
+ z-index: 10px;
+ z-index: abs(-10px);
+}
+
+.abs {
+ z-index: 0;
+ z-index: abs(0);
+}
+
+.abs {
+ z-index: 10px;
+ z-index: abs(10px);
+}
+```
+
+> [!NOTE]
+> The utility of static fallbacks for `sign` and `abs` is limited.
+> The most interesting values are variables and dynamic values (e.g. those containing `%`).
+> It is impossible to generate static fallbacks in a build process for values that are dynamic on the client.
+
+## Usage
+
+Add [PostCSS Sign Functions] to your project:
+
+```bash
+npm install postcss @csstools/postcss-sign-functions --save-dev
+```
+
+Use it as a [PostCSS] plugin:
+
+```js
+const postcss = require('postcss');
+const postcssSignFunctions = require('@csstools/postcss-sign-functions');
+
+postcss([
+ postcssSignFunctions(/* pluginOptions */)
+]).process(YOUR_CSS /*, processOptions */);
+```
+
+[PostCSS Sign Functions] 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)
+
+## ⚠️ About custom properties
+
+Given the dynamic nature of custom properties it's impossible to know what the variable value is, which means the plugin can't compute a final value for the stylesheet.
+
+Because of that, any usage that contains a `var` is skipped.
+
+## Options
+
+### preserve
+
+The `preserve` option determines whether the original notation
+is preserved. By default, it is preserved.
+
+```js
+postcssSignFunctions({ preserve: false })
+```
+
+```pcss
+.sign {
+ z-index: sign(-10px);
+}
+
+.sign {
+ z-index: sign(0);
+}
+
+.sign {
+ z-index: sign(10px);
+}
+
+.abs {
+ z-index: abs(-10px);
+}
+
+.abs {
+ z-index: abs(0);
+}
+
+.abs {
+ z-index: abs(10px);
+}
+
+/* becomes */
+
+.sign {
+ z-index: -1;
+}
+
+.sign {
+ z-index: 0;
+}
+
+.sign {
+ z-index: 1;
+}
+
+.abs {
+ z-index: 10px;
+}
+
+.abs {
+ z-index: 0;
+}
+
+.abs {
+ z-index: 10px;
+}
+```
+
+[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
+[css-url]: https://cssdb.org/#sign-functions
+[discord]: https://discord.gg/bUadyRwkJS
+[npm-url]: https://www.npmjs.com/package/@csstools/postcss-sign-functions
+
+[PostCSS]: https://github.com/postcss/postcss
+[PostCSS Sign Functions]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-sign-functions
+[CSS Values 4]: https://drafts.csswg.org/css-values-4/#sign-funcs
diff --git a/plugins/postcss-sign-functions/api-extractor.json b/plugins/postcss-sign-functions/api-extractor.json
new file mode 100644
index 000000000..42058be51
--- /dev/null
+++ b/plugins/postcss-sign-functions/api-extractor.json
@@ -0,0 +1,4 @@
+{
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
+ "extends": "../../api-extractor.json"
+}
diff --git a/plugins/postcss-sign-functions/dist/index.cjs b/plugins/postcss-sign-functions/dist/index.cjs
new file mode 100644
index 000000000..65d2f9af0
--- /dev/null
+++ b/plugins/postcss-sign-functions/dist/index.cjs
@@ -0,0 +1 @@
+"use strict";var s=require("@csstools/css-calc");const e=/(?{const c=Object.assign({preserve:!0},t);return{postcssPlugin:"postcss-stepped-value-functions",Declaration(t){if(!e.test(t.value))return;const o=s.calc(t.value,{precision:5,toCanonicalUnits:!0});o!==t.value&&(t.cloneBefore({value:o}),c.preserve||t.remove())}}};creator.postcss=!0,module.exports=creator;
diff --git a/plugins/postcss-sign-functions/dist/index.d.ts b/plugins/postcss-sign-functions/dist/index.d.ts
new file mode 100644
index 000000000..6a61dad48
--- /dev/null
+++ b/plugins/postcss-sign-functions/dist/index.d.ts
@@ -0,0 +1,12 @@
+import type { PluginCreator } from 'postcss';
+
+declare const creator: PluginCreator;
+export default creator;
+
+/** postcss-stepped-value-functions plugin options */
+export declare type pluginOptions = {
+ /** Preserve the original notation. default: true */
+ preserve?: boolean;
+};
+
+export { }
diff --git a/plugins/postcss-sign-functions/dist/index.mjs b/plugins/postcss-sign-functions/dist/index.mjs
new file mode 100644
index 000000000..534c7d850
--- /dev/null
+++ b/plugins/postcss-sign-functions/dist/index.mjs
@@ -0,0 +1 @@
+import{calc as s}from"@csstools/css-calc";const e=/(?{const o=Object.assign({preserve:!0},t);return{postcssPlugin:"postcss-stepped-value-functions",Declaration(t){if(!e.test(t.value))return;const c=s(t.value,{precision:5,toCanonicalUnits:!0});c!==t.value&&(t.cloneBefore({value:c}),o.preserve||t.remove())}}};creator.postcss=!0;export{creator as default};
diff --git a/plugins/postcss-sign-functions/docs/README.md b/plugins/postcss-sign-functions/docs/README.md
new file mode 100644
index 000000000..cf096695a
--- /dev/null
+++ b/plugins/postcss-sign-functions/docs/README.md
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[] lets you use the `sign` and `abs` functions, following the [CSS Values 4].
+
+```pcss
+
+
+/* becomes */
+
+
+```
+
+> [!NOTE]
+> The utility of static fallbacks for `sign` and `abs` is limited.
+> The most interesting values are variables and dynamic values (e.g. those containing `%`).
+> It is impossible to generate static fallbacks in a build process for values that are dynamic on the client.
+
+
+
+
+
+## ⚠️ About custom properties
+
+Given the dynamic nature of custom properties it's impossible to know what the variable value is, which means the plugin can't compute a final value for the stylesheet.
+
+Because of that, any usage that contains a `var` is skipped.
+
+## Options
+
+### preserve
+
+The `preserve` option determines whether the original notation
+is preserved. By default, it is preserved.
+
+```js
+({ preserve: false })
+```
+
+```pcss
+
+
+/* becomes */
+
+
+```
+
+
+[CSS Values 4]:
diff --git a/plugins/postcss-sign-functions/package.json b/plugins/postcss-sign-functions/package.json
new file mode 100644
index 000000000..449907ecd
--- /dev/null
+++ b/plugins/postcss-sign-functions/package.json
@@ -0,0 +1,91 @@
+{
+ "name": "@csstools/postcss-sign-functions",
+ "description": "Use sign and abs functions in CSS",
+ "version": "0.0.0",
+ "contributors": [
+ {
+ "name": "Antonio Laguna",
+ "email": "antonio@laguna.es",
+ "url": "https://antonio.laguna.es"
+ },
+ {
+ "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": ">=18"
+ },
+ "type": "module",
+ "main": "dist/index.cjs",
+ "module": "dist/index.mjs",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./dist/index.d.ts",
+ "default": "./dist/index.mjs"
+ },
+ "require": {
+ "default": "./dist/index.cjs"
+ }
+ }
+ },
+ "files": [
+ "CHANGELOG.md",
+ "LICENSE.md",
+ "README.md",
+ "dist"
+ ],
+ "dependencies": {
+ "@csstools/css-calc": "^2.0.4",
+ "@csstools/css-parser-algorithms": "^3.0.4",
+ "@csstools/css-tokenizer": "^3.0.3"
+ },
+ "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 --test",
+ "test:rewrite-expects": "REWRITE_EXPECTS=true node --test"
+ },
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-sign-functions#readme",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
+ "directory": "plugins/postcss-sign-functions"
+ },
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
+ "keywords": [
+ "abs",
+ "css",
+ "postcss-plugin",
+ "sign"
+ ],
+ "csstools": {
+ "cssdbId": "sign-functions",
+ "exportName": "postcssSignFunctions",
+ "humanReadableName": "PostCSS Sign Functions",
+ "specUrl": "https://drafts.csswg.org/css-values-4/#sign-funcs"
+ },
+ "volta": {
+ "extends": "../../package.json"
+ }
+}
diff --git a/plugins/postcss-sign-functions/src/index.ts b/plugins/postcss-sign-functions/src/index.ts
new file mode 100644
index 000000000..4f5fb9582
--- /dev/null
+++ b/plugins/postcss-sign-functions/src/index.ts
@@ -0,0 +1,48 @@
+import type { PluginCreator } from 'postcss';
+import { calc } from '@csstools/css-calc';
+
+/** postcss-stepped-value-functions plugin options */
+export type pluginOptions = {
+ /** Preserve the original notation. default: true */
+ preserve?: boolean,
+};
+
+const FUNCTION_CALL_REGEX = /(? = (opts?: pluginOptions) => {
+ const options: pluginOptions = Object.assign(
+ // Default options
+ {
+ preserve: true,
+ },
+ // Provided options
+ opts,
+ );
+
+ return {
+ postcssPlugin: 'postcss-stepped-value-functions',
+ Declaration(decl): void {
+ if (!FUNCTION_CALL_REGEX.test(decl.value)) {
+ return;
+ }
+
+ const modifiedValue = calc(decl.value, {
+ precision: 5,
+ toCanonicalUnits: true,
+ });
+ if (modifiedValue === decl.value) {
+ return;
+ }
+
+ decl.cloneBefore({ value: modifiedValue });
+
+ if (!options.preserve) {
+ decl.remove();
+ }
+ },
+ };
+};
+
+creator.postcss = true;
+
+export default creator;
diff --git a/plugins/postcss-sign-functions/test/_import.mjs b/plugins/postcss-sign-functions/test/_import.mjs
new file mode 100644
index 000000000..a0a1f6ca5
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/_import.mjs
@@ -0,0 +1,6 @@
+import assert from 'node:assert';
+import plugin from '@csstools/postcss-sign-functions';
+plugin();
+
+assert.ok(plugin.postcss, 'should have "postcss flag"');
+assert.equal(typeof plugin, 'function', 'should return a function');
diff --git a/plugins/postcss-sign-functions/test/_require.cjs b/plugins/postcss-sign-functions/test/_require.cjs
new file mode 100644
index 000000000..3b771b378
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/_require.cjs
@@ -0,0 +1,6 @@
+const assert = require('assert');
+const plugin = require('@csstools/postcss-sign-functions');
+plugin();
+
+assert.ok(plugin.postcss, 'should have "postcss flag"');
+assert.equal(typeof plugin, 'function', 'should return a function');
diff --git a/plugins/postcss-sign-functions/test/_tape.mjs b/plugins/postcss-sign-functions/test/_tape.mjs
new file mode 100644
index 000000000..c5f8fb8ee
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/_tape.mjs
@@ -0,0 +1,23 @@
+import { postcssTape } from '@csstools/postcss-tape';
+import plugin from '@csstools/postcss-sign-functions';
+
+postcssTape(plugin)({
+ basic: {
+ message: 'supports basic usage',
+ },
+ 'basic:preserve-false': {
+ message: 'supports { preserve: false } usage',
+ options: {
+ preserve: false,
+ },
+ },
+ 'examples/example': {
+ message: 'minimal example',
+ },
+ 'examples/example:preserve-false': {
+ message: 'minimal example',
+ options: {
+ preserve: false,
+ },
+ },
+});
diff --git a/plugins/postcss-sign-functions/test/basic.css b/plugins/postcss-sign-functions/test/basic.css
new file mode 100644
index 000000000..482874782
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/basic.css
@@ -0,0 +1,61 @@
+.sign-ignore {
+ z-index: sign(10%);
+}
+
+.sign-b {
+ z-index: sign(10px);
+}
+
+.sign-c {
+ z-index: sign(0);
+}
+
+.sign-d {
+ z-index: sign(0px);
+}
+
+.sign-e {
+ z-index: sign(-10px);
+}
+
+.sign-f {
+ z-index: sign(-0px);
+}
+
+.abs-ignore {
+ z-index: abs(10%);
+}
+
+.abs-b {
+ z-index: abs(10px);
+}
+
+.abs-c {
+ z-index: abs(0);
+}
+
+.abs-d {
+ z-index: abs(0px);
+}
+
+.abs-e {
+ z-index: abs(-10px);
+}
+
+.abs-f {
+ z-index: abs(-0px);
+}
+
+:root {
+ --foo: sign(10px);
+}
+
+.var-ignore-a {
+ --foo: 10px;
+ z-index: sign(var(--foo));
+}
+
+.var-ignore-b {
+ --foo: 10px;
+ z-index: abs(var(--foo));
+}
diff --git a/plugins/postcss-sign-functions/test/basic.expect.css b/plugins/postcss-sign-functions/test/basic.expect.css
new file mode 100644
index 000000000..341650b36
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/basic.expect.css
@@ -0,0 +1,72 @@
+.sign-ignore {
+ z-index: sign(10%);
+}
+
+.sign-b {
+ z-index: 1;
+ z-index: sign(10px);
+}
+
+.sign-c {
+ z-index: 0;
+ z-index: sign(0);
+}
+
+.sign-d {
+ z-index: 0;
+ z-index: sign(0px);
+}
+
+.sign-e {
+ z-index: -1;
+ z-index: sign(-10px);
+}
+
+.sign-f {
+ z-index: -0;
+ z-index: sign(-0px);
+}
+
+.abs-ignore {
+ z-index: abs(10%);
+}
+
+.abs-b {
+ z-index: 10px;
+ z-index: abs(10px);
+}
+
+.abs-c {
+ z-index: 0;
+ z-index: abs(0);
+}
+
+.abs-d {
+ z-index: 0px;
+ z-index: abs(0px);
+}
+
+.abs-e {
+ z-index: 10px;
+ z-index: abs(-10px);
+}
+
+.abs-f {
+ z-index: 0px;
+ z-index: abs(-0px);
+}
+
+:root {
+ --foo: 1;
+ --foo: sign(10px);
+}
+
+.var-ignore-a {
+ --foo: 10px;
+ z-index: sign(var(--foo));
+}
+
+.var-ignore-b {
+ --foo: 10px;
+ z-index: abs(var(--foo));
+}
diff --git a/plugins/postcss-sign-functions/test/basic.preserve-false.expect.css b/plugins/postcss-sign-functions/test/basic.preserve-false.expect.css
new file mode 100644
index 000000000..b819c3a09
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/basic.preserve-false.expect.css
@@ -0,0 +1,61 @@
+.sign-ignore {
+ z-index: sign(10%);
+}
+
+.sign-b {
+ z-index: 1;
+}
+
+.sign-c {
+ z-index: 0;
+}
+
+.sign-d {
+ z-index: 0;
+}
+
+.sign-e {
+ z-index: -1;
+}
+
+.sign-f {
+ z-index: -0;
+}
+
+.abs-ignore {
+ z-index: abs(10%);
+}
+
+.abs-b {
+ z-index: 10px;
+}
+
+.abs-c {
+ z-index: 0;
+}
+
+.abs-d {
+ z-index: 0px;
+}
+
+.abs-e {
+ z-index: 10px;
+}
+
+.abs-f {
+ z-index: 0px;
+}
+
+:root {
+ --foo: 1;
+}
+
+.var-ignore-a {
+ --foo: 10px;
+ z-index: sign(var(--foo));
+}
+
+.var-ignore-b {
+ --foo: 10px;
+ z-index: abs(var(--foo));
+}
diff --git a/plugins/postcss-sign-functions/test/examples/example.css b/plugins/postcss-sign-functions/test/examples/example.css
new file mode 100644
index 000000000..24fb32287
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/examples/example.css
@@ -0,0 +1,23 @@
+.sign {
+ z-index: sign(-10px);
+}
+
+.sign {
+ z-index: sign(0);
+}
+
+.sign {
+ z-index: sign(10px);
+}
+
+.abs {
+ z-index: abs(-10px);
+}
+
+.abs {
+ z-index: abs(0);
+}
+
+.abs {
+ z-index: abs(10px);
+}
diff --git a/plugins/postcss-sign-functions/test/examples/example.expect.css b/plugins/postcss-sign-functions/test/examples/example.expect.css
new file mode 100644
index 000000000..29c7340a1
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/examples/example.expect.css
@@ -0,0 +1,29 @@
+.sign {
+ z-index: -1;
+ z-index: sign(-10px);
+}
+
+.sign {
+ z-index: 0;
+ z-index: sign(0);
+}
+
+.sign {
+ z-index: 1;
+ z-index: sign(10px);
+}
+
+.abs {
+ z-index: 10px;
+ z-index: abs(-10px);
+}
+
+.abs {
+ z-index: 0;
+ z-index: abs(0);
+}
+
+.abs {
+ z-index: 10px;
+ z-index: abs(10px);
+}
diff --git a/plugins/postcss-sign-functions/test/examples/example.preserve-false.expect.css b/plugins/postcss-sign-functions/test/examples/example.preserve-false.expect.css
new file mode 100644
index 000000000..bc6cbe8f2
--- /dev/null
+++ b/plugins/postcss-sign-functions/test/examples/example.preserve-false.expect.css
@@ -0,0 +1,23 @@
+.sign {
+ z-index: -1;
+}
+
+.sign {
+ z-index: 0;
+}
+
+.sign {
+ z-index: 1;
+}
+
+.abs {
+ z-index: 10px;
+}
+
+.abs {
+ z-index: 0;
+}
+
+.abs {
+ z-index: 10px;
+}
diff --git a/plugins/postcss-sign-functions/tsconfig.json b/plugins/postcss-sign-functions/tsconfig.json
new file mode 100644
index 000000000..1b60a463a
--- /dev/null
+++ b/plugins/postcss-sign-functions/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "dist",
+ "declarationDir": ".",
+ "strict": true
+ },
+ "include": ["./src/**/*"],
+ "exclude": ["dist"],
+}
From 8d8fbcd2805e2a14eb1e9553ab416d1390e91fd5 Mon Sep 17 00:00:00 2001
From: Romain Menke <11521496+romainmenke@users.noreply.github.com>
Date: Mon, 11 Nov 2024 09:51:35 +0100
Subject: [PATCH 2/7] Update CHANGELOG.md
---
plugins/postcss-sign-functions/CHANGELOG.md | 169 +-------------------
1 file changed, 2 insertions(+), 167 deletions(-)
diff --git a/plugins/postcss-sign-functions/CHANGELOG.md b/plugins/postcss-sign-functions/CHANGELOG.md
index 135c12cf2..838c15423 100644
--- a/plugins/postcss-sign-functions/CHANGELOG.md
+++ b/plugins/postcss-sign-functions/CHANGELOG.md
@@ -1,170 +1,5 @@
-# Changes to PostCSS Stepped Value Functions
+# Changes to PostCSS Sign Functions
-### 4.0.4
-
-_November 1, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#303) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#304) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#204) (patch)
-
-### 4.0.3
-
-_October 23, 2024_
-
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#303) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#203) (patch)
-
-### 4.0.2
-
-_October 10, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#302) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#302) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#202) (patch)
-
-### 4.0.1
-
-_August 18, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#301) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#301) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#201) (patch)
-
-### 4.0.0
-
-_August 3, 2024_
-
-- Updated: Support for Node v18+ (major).
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#300) (major)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#300) (major)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#200) (major)
-
-### 3.0.10
-
-_July 6, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.4.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#241) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#271) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#124) (patch)
-
-### 3.0.9
-
-_June 29, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#232) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#270) (minor)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#123) (patch)
-
-### 3.0.8
-
-_May 4, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#231) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#263) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#122) (patch)
-
-### 3.0.7
-
-_May 4, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#230) (minor)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#262) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#121) (patch)
-
-### 3.0.6
-
-_March 13, 2024_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#224) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#261) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#120) (minor)
-
-### 3.0.5
-
-_February 19, 2024_
-
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#260) (minor)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.7`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#117) (patch)
-
-### 3.0.4
-
-_December 31, 2023_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#223) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.5.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#250) (minor)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.6`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#116) (patch)
-
-### 3.0.3
-
-_December 15, 2023_
-
-- Fix type definitions
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#222) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.4.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#240) (minor)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.5`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#115) (patch)
-
-### 3.0.2
-
-_September 24, 2023_
-
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#221) (patch)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#232) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#114) (patch)
-
-### 3.0.1
-
-_July 24, 2023_
-
-- Use the latest utilities from `@csstools/css-tokenizer` to reduce the bundle size.
-- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#220) (minor)
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#231) (patch)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#113) (patch)
-
-### 3.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/))
-- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#230) (minor)
-- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#112) (patch)
-
-### 2.1.1
-
-_April 10, 2023_
-
-- Updated `@csstools/css-tokenizer` to `2.1.1` (patch)
-- Updated `@csstools/css-parser-algorithms` to `2.1.1` (patch)
-- Updated `@csstools/css-calc` to `1.1.1` (patch)
-
-### 2.1.0
-
-_February 21, 2023_
-
-- Removed: warnings on `var()` or otherwise unconvertible values (doesn't affect the output, non-breaking)
-- Added: `@csstools/css-calc`
-- Added: unit conversions (`mod(735ms, 0.1s)`)
-
-### 2.0.1
-
-_January 28, 2023_
-
-- Improve `types` declaration in `package.json`
-
-### 2.0.0
-
-_January 24, 2023_
-
-- Updated: Support for Node v14+ (major).
-
-### 1.0.1
-
-_July 8, 2022_
-
-- Fix case insensitive matching.
-
-### 1.0.0
-
-_May 2, 2022_
+### Unreleased (major)
- Initial version
From 8ef840336682c756c2df063322d6c34ec56fc6a9 Mon Sep 17 00:00:00 2001
From: Romain Menke <11521496+romainmenke@users.noreply.github.com>
Date: Mon, 11 Nov 2024 09:53:14 +0100
Subject: [PATCH 3/7] Update index.ts
---
plugins/postcss-sign-functions/src/index.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/postcss-sign-functions/src/index.ts b/plugins/postcss-sign-functions/src/index.ts
index 4f5fb9582..48aba37ac 100644
--- a/plugins/postcss-sign-functions/src/index.ts
+++ b/plugins/postcss-sign-functions/src/index.ts
@@ -1,7 +1,7 @@
import type { PluginCreator } from 'postcss';
import { calc } from '@csstools/css-calc';
-/** postcss-stepped-value-functions plugin options */
+/** postcss-sign-functions plugin options */
export type pluginOptions = {
/** Preserve the original notation. default: true */
preserve?: boolean,
From 712ec54db555164685dd09b9ea5c3d0ec01172a8 Mon Sep 17 00:00:00 2001
From: Romain Menke <11521496+romainmenke@users.noreply.github.com>
Date: Mon, 11 Nov 2024 09:53:30 +0100
Subject: [PATCH 4/7] Update index.ts
---
plugins/postcss-sign-functions/src/index.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/postcss-sign-functions/src/index.ts b/plugins/postcss-sign-functions/src/index.ts
index 48aba37ac..c8bb579cf 100644
--- a/plugins/postcss-sign-functions/src/index.ts
+++ b/plugins/postcss-sign-functions/src/index.ts
@@ -20,7 +20,7 @@ const creator: PluginCreator = (opts?: pluginOptions) => {
);
return {
- postcssPlugin: 'postcss-stepped-value-functions',
+ postcssPlugin: 'postcss-sign-functions',
Declaration(decl): void {
if (!FUNCTION_CALL_REGEX.test(decl.value)) {
return;
From a864d24a76939fa610d57b331ddf89925b9e88aa Mon Sep 17 00:00:00 2001
From: Romain Menke
Date: Mon, 11 Nov 2024 10:21:15 +0100
Subject: [PATCH 5/7] rebuild
---
plugins/postcss-sign-functions/dist/index.cjs | 2 +-
plugins/postcss-sign-functions/dist/index.d.ts | 2 +-
plugins/postcss-sign-functions/dist/index.mjs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/postcss-sign-functions/dist/index.cjs b/plugins/postcss-sign-functions/dist/index.cjs
index 65d2f9af0..ab0feb4f7 100644
--- a/plugins/postcss-sign-functions/dist/index.cjs
+++ b/plugins/postcss-sign-functions/dist/index.cjs
@@ -1 +1 @@
-"use strict";var s=require("@csstools/css-calc");const e=/(?{const c=Object.assign({preserve:!0},t);return{postcssPlugin:"postcss-stepped-value-functions",Declaration(t){if(!e.test(t.value))return;const o=s.calc(t.value,{precision:5,toCanonicalUnits:!0});o!==t.value&&(t.cloneBefore({value:o}),c.preserve||t.remove())}}};creator.postcss=!0,module.exports=creator;
+"use strict";var s=require("@csstools/css-calc");const e=/(?{const t=Object.assign({preserve:!0},c);return{postcssPlugin:"postcss-sign-functions",Declaration(c){if(!e.test(c.value))return;const o=s.calc(c.value,{precision:5,toCanonicalUnits:!0});o!==c.value&&(c.cloneBefore({value:o}),t.preserve||c.remove())}}};creator.postcss=!0,module.exports=creator;
diff --git a/plugins/postcss-sign-functions/dist/index.d.ts b/plugins/postcss-sign-functions/dist/index.d.ts
index 6a61dad48..79981d076 100644
--- a/plugins/postcss-sign-functions/dist/index.d.ts
+++ b/plugins/postcss-sign-functions/dist/index.d.ts
@@ -3,7 +3,7 @@ import type { PluginCreator } from 'postcss';
declare const creator: PluginCreator;
export default creator;
-/** postcss-stepped-value-functions plugin options */
+/** postcss-sign-functions plugin options */
export declare type pluginOptions = {
/** Preserve the original notation. default: true */
preserve?: boolean;
diff --git a/plugins/postcss-sign-functions/dist/index.mjs b/plugins/postcss-sign-functions/dist/index.mjs
index 534c7d850..53c8ce002 100644
--- a/plugins/postcss-sign-functions/dist/index.mjs
+++ b/plugins/postcss-sign-functions/dist/index.mjs
@@ -1 +1 @@
-import{calc as s}from"@csstools/css-calc";const e=/(?{const o=Object.assign({preserve:!0},t);return{postcssPlugin:"postcss-stepped-value-functions",Declaration(t){if(!e.test(t.value))return;const c=s(t.value,{precision:5,toCanonicalUnits:!0});c!==t.value&&(t.cloneBefore({value:c}),o.preserve||t.remove())}}};creator.postcss=!0;export{creator as default};
+import{calc as s}from"@csstools/css-calc";const e=/(?{const t=Object.assign({preserve:!0},o);return{postcssPlugin:"postcss-sign-functions",Declaration(o){if(!e.test(o.value))return;const n=s(o.value,{precision:5,toCanonicalUnits:!0});n!==o.value&&(o.cloneBefore({value:n}),t.preserve||o.remove())}}};creator.postcss=!0;export{creator as default};
From 3d5737d745dab1aef6a30be458f18e607fcdcb00 Mon Sep 17 00:00:00 2001
From: Romain Menke
Date: Mon, 11 Nov 2024 10:21:37 +0100
Subject: [PATCH 6/7] package lock
---
package-lock.json | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/package-lock.json b/package-lock.json
index 4c29b5278..1dedbfc97 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1996,6 +1996,10 @@
"resolved": "plugins/postcss-scope-pseudo-class",
"link": true
},
+ "node_modules/@csstools/postcss-sign-functions": {
+ "resolved": "plugins/postcss-sign-functions",
+ "link": true
+ },
"node_modules/@csstools/postcss-slow-plugins": {
"resolved": "plugins/postcss-slow-plugins",
"link": true
@@ -10909,6 +10913,34 @@
"postcss": "^8.4"
}
},
+ "plugins/postcss-sign-functions": {
+ "version": "0.0.0",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT-0",
+ "dependencies": {
+ "@csstools/css-calc": "^2.0.4",
+ "@csstools/css-parser-algorithms": "^3.0.4",
+ "@csstools/css-tokenizer": "^3.0.3"
+ },
+ "devDependencies": {
+ "@csstools/postcss-tape": "*"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "postcss": "^8.4"
+ }
+ },
"plugins/postcss-slow-plugins": {
"name": "@csstools/postcss-slow-plugins",
"version": "2.0.0",
From 6d3609cbc185a998200dba1042f9c3e9e3261fc8 Mon Sep 17 00:00:00 2001
From: Romain Menke
Date: Mon, 11 Nov 2024 10:23:22 +0100
Subject: [PATCH 7/7] labeler
---
.github/ISSUE_TEMPLATE/css-issue.yml | 1 +
.github/ISSUE_TEMPLATE/plugin-issue.yml | 1 +
.github/labeler.yml | 6 ++++++
3 files changed, 8 insertions(+)
diff --git a/.github/ISSUE_TEMPLATE/css-issue.yml b/.github/ISSUE_TEMPLATE/css-issue.yml
index e42dd65f3..02dbb2a02 100644
--- a/.github/ISSUE_TEMPLATE/css-issue.yml
+++ b/.github/ISSUE_TEMPLATE/css-issue.yml
@@ -125,6 +125,7 @@ body:
- PostCSS Replace Overflow Wrap
- PostCSS Scope Pseudo Class
- PostCSS Selector Not
+ - PostCSS Sign Functions
- PostCSS Slow Plugins
- PostCSS Stepped Value Functions
- PostCSS System Ui Font Family
diff --git a/.github/ISSUE_TEMPLATE/plugin-issue.yml b/.github/ISSUE_TEMPLATE/plugin-issue.yml
index 554cdfcfe..91bab5022 100644
--- a/.github/ISSUE_TEMPLATE/plugin-issue.yml
+++ b/.github/ISSUE_TEMPLATE/plugin-issue.yml
@@ -122,6 +122,7 @@ body:
- PostCSS Replace Overflow Wrap
- PostCSS Scope Pseudo Class
- PostCSS Selector Not
+ - PostCSS Sign Functions
- PostCSS Slow Plugins
- PostCSS Stepped Value Functions
- PostCSS System Ui Font Family
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 263ec4322..c918d0a26 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -425,6 +425,12 @@
- plugins/postcss-selector-not/**
- experimental/postcss-selector-not/**
+"plugins/postcss-sign-functions":
+ - changed-files:
+ - any-glob-to-any-file:
+ - plugins/postcss-sign-functions/**
+ - experimental/postcss-sign-functions/**
+
"plugins/postcss-slow-plugins":
- changed-files:
- any-glob-to-any-file: