{"name":"@csstools/postcss-sign-functions","description":"Use sign and abs functions in CSS","version":"2.0.4","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":">=20.19.0"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"}},"dependencies":{"@csstools/css-calc":"^3.3.0","@csstools/css-parser-algorithms":"^4.0.0","@csstools/css-tokenizer":"^4.0.0"},"peerDependencies":{"postcss":"^8.4"},"scripts":{},"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":{"url":"https://github.com/csstools/postcss-plugins/issues"},"keywords":["abs","css","postcss-plugin","sign"],"gitHead":"be16e302cba31c669b7c342963a25210833e3983","_id":"@csstools/postcss-sign-functions@2.0.4","_nodeVersion":"26.1.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-vHfgUnPoKNF687H7ycoisAvoFYBq71X90N7pHclouRUUwZRea8XIJVo+Cq0jgRJEzv9vx+X7XEl+arTqns/C/A==","shasum":"f70ec986098ab8056ff4e343a9f8fb372fa3630f","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-sign-functions/download/@csstools/postcss-sign-functions-2.0.4.tgz","fileCount":6,"unpackedSize":7511,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICRHY7ljLsN14r+YU4epJQrU5JXdwOH3JKn7/J2E7u47AiBy7ejxgQt403buNbMbIhciMNuazXGHAtkewIjojFOJ3w=="}],"size":3188,"noattachment":false,"key":"/@csstools/postcss-sign-functions/-/@csstools/postcss-sign-functions-2.0.4.tgz"},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"directories":{},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postcss-sign-functions_2.0.4_1784737201972_0.5272121047306231"},"_hasShrinkwrap":false,"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":1784737202118,"_cnpm_publish_time":1784737202118,"dist-tags":{"latest":"2.0.10"}}