{"name":"@csstools/postcss-sign-functions","version":"2.0.1","keywords":["abs","css","postcss-plugin","sign"],"license":"MIT-0","_id":"@csstools/postcss-sign-functions@2.0.1","maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"contributors":[{"url":"https://antonio.laguna.es","name":"Antonio Laguna","email":"antonio@laguna.es"},{"name":"Romain Menke","email":"romainmenke@gmail.com"}],"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-sign-functions#readme","bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"dist":{"shasum":"d0cf6d831874f977502d44129cf4898d58fc4050","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-sign-functions/download/@csstools/postcss-sign-functions-2.0.1.tgz","fileCount":6,"integrity":"sha512-C3br0qcHJkQ0qSGUBnDJHXQdO8XObnCpGwai5m1L2tv2nCjt0vRHG6A9aVCQHvh08OqHNM2ty1dYDNNXV99YAQ==","signatures":[{"sig":"MEUCIHn6mwBUcVjq++Mgw6UUe1batRfymW7/wtFrd2iUDX7zAiEAo9pbUmvXagfb/KuOkfFF9KxHhiHAM93F4OjJJNkPgh8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7515,"size":3189,"noattachment":false,"key":"/@csstools/postcss-sign-functions/-/@csstools/postcss-sign-functions-2.0.1.tgz"},"type":"module","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"}},"funding":[{"url":"https://github.com/sponsors/csstools","type":"github"},{"url":"https://opencollective.com/csstools","type":"opencollective"}],"gitHead":"f79d709dd46c9cab91ed985e76a8b4d4a185f4c8","scripts":{},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"repository":{"url":"git+https://github.com/csstools/postcss-plugins.git","type":"git","directory":"plugins/postcss-sign-functions"},"_npmVersion":"11.6.2","description":"Use sign and abs functions in CSS","directories":{},"_nodeVersion":"25.1.0","dependencies":{"@csstools/css-calc":"^3.1.1","@csstools/css-tokenizer":"^4.0.0","@csstools/css-parser-algorithms":"^4.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"postcss":"^8.4"},"_npmOperationalInternal":{"tmp":"tmp/postcss-sign-functions_2.0.1_1771686383405_0.0334827341050703","host":"s3://npm-registry-packages-npm-production"},"readme":"# PostCSS Sign Functions [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\">][PostCSS]\n\n`npm install @csstools/postcss-sign-functions --save-dev`\n\n[PostCSS Sign Functions] lets you use the `sign` and `abs` functions, following the [CSS Values 4] specification.\n\n```css\n.sign {\n\tz-index: sign(-10px);\n}\n\n.sign {\n\tz-index: sign(0);\n}\n\n.sign {\n\tz-index: sign(10px);\n}\n\n.abs {\n\tz-index: abs(-10px);\n}\n\n.abs {\n\tz-index: abs(0);\n}\n\n.abs {\n\tz-index: abs(10px);\n}\n\n.abs {\n\tz-index: abs(10%);\n}\n\n/* becomes */\n\n.sign {\n\tz-index: -1;\n}\n\n.sign {\n\tz-index: 0;\n}\n\n.sign {\n\tz-index: 1;\n}\n\n.abs {\n\tz-index: 10px;\n}\n\n.abs {\n\tz-index: 0;\n}\n\n.abs {\n\tz-index: 10px;\n}\n\n.abs {\n\tz-index: max((10%), -1 * (10%));\n}\n```\n\n> [!NOTE]\n> The utility of static fallbacks for `sign` and `abs` is limited.\n> The most interesting values are variables and dynamic values (e.g. those containing `%`).\n> It is impossible to generate static fallbacks in a build process for values that are dynamic on the client.\n\n## Usage\n\nAdd [PostCSS Sign Functions] to your project:\n\n```bash\nnpm install postcss @csstools/postcss-sign-functions --save-dev\n```\n\nUse it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssSignFunctions = require('@csstools/postcss-sign-functions');\n\npostcss([\n\tpostcssSignFunctions(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n\n\n## ⚠️ About custom properties\n\nGiven 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. \n\nBecause of that, any usage that contains a `var` is skipped.\n\n## Options\n\n### preserve\n\nThe `preserve` option determines whether the original notation\nis preserved. By default, it is not preserved.\n\n```js\npostcssSignFunctions({ preserve: true })\n```\n\n```css\n.sign {\n\tz-index: sign(-10px);\n}\n\n.sign {\n\tz-index: sign(0);\n}\n\n.sign {\n\tz-index: sign(10px);\n}\n\n.abs {\n\tz-index: abs(-10px);\n}\n\n.abs {\n\tz-index: abs(0);\n}\n\n.abs {\n\tz-index: abs(10px);\n}\n\n.abs {\n\tz-index: abs(10%);\n}\n\n/* becomes */\n\n.sign {\n\tz-index: -1;\n\tz-index: sign(-10px);\n}\n\n.sign {\n\tz-index: 0;\n\tz-index: sign(0);\n}\n\n.sign {\n\tz-index: 1;\n\tz-index: sign(10px);\n}\n\n.abs {\n\tz-index: 10px;\n\tz-index: abs(-10px);\n}\n\n.abs {\n\tz-index: 0;\n\tz-index: abs(0);\n}\n\n.abs {\n\tz-index: 10px;\n\tz-index: abs(10px);\n}\n\n.abs {\n\tz-index: max((10%), -1 * (10%));\n\tz-index: abs(10%);\n}\n```\n\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#sign-functions\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-url]: https://www.npmjs.com/package/@csstools/postcss-sign-functions\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Sign Functions]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-sign-functions\n[CSS Values 4]: https://drafts.csswg.org/css-values-4/#sign-funcs\n","publish_time":1771686383537,"_cnpm_publish_time":1771686383537,"dist-tags":{"latest":"2.0.10"}}