{"name":"@csstools/postcss-sign-functions","version":"2.0.3","keywords":["abs","css","postcss-plugin","sign"],"license":"MIT-0","_id":"@csstools/postcss-sign-functions@2.0.3","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":"8598c38bf3ac8603159bcc2ad44fea16e4205924","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-sign-functions/download/@csstools/postcss-sign-functions-2.0.3.tgz","fileCount":6,"integrity":"sha512-2BCPwlpeQweTC/8S8oQFYhYD5kxYkiroLf3AUJV2kVoKkSZ+4WM4rSwySXlKrqXL8HfCryAwVrJg7B0jr/RnOw==","signatures":[{"sig":"MEYCIQDJhaR5LYHeEcX3SWOTW5nWYqRf5iW9E0s7FF04UBYr+QIhAJshV4qzRcTLO5TsEhHl5+SmUYKcSAg+AnwxVg6etlaX","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7510,"size":3190,"noattachment":false,"key":"/@csstools/postcss-sign-functions/-/@csstools/postcss-sign-functions-2.0.3.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":"8c33b5a348159b0ede371a093bae0740b762324b","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.13.0","description":"Use sign and abs functions in CSS","directories":{},"_nodeVersion":"26.1.0","dependencies":{"@csstools/css-calc":"^3.2.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.3_1778685160323_0.29693115576852613","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":1778685160486,"_cnpm_publish_time":1778685160486,"dist-tags":{"latest":"2.0.10"}}