{"name":"@csstools/postcss-sign-functions","description":"Use sign and abs functions in CSS","version":"1.1.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"}}},"dependencies":{"@csstools/css-calc":"^2.1.0","@csstools/css-parser-algorithms":"^3.0.4","@csstools/css-tokenizer":"^3.0.3"},"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"],"_id":"@csstools/postcss-sign-functions@1.1.0","gitHead":"9f204e47814621e4e5672194322f770b0cae8d0c","types":"./dist/index.d.ts","_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-SLcc20Nujx/kqbSwDmj6oaXgpy3UjFhBy1sfcqPgDkHfOIfUtUVH7OXO+j7BU4v/At5s61N5ZX6shvgPwluhsA==","shasum":"a524fae1374b0e167729f612ca875d7b1b334262","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-sign-functions/download/@csstools/postcss-sign-functions-1.1.0.tgz","fileCount":7,"unpackedSize":9227,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvCgO3gzG0bNUoKvmXN68UZYXNpk+8fguODzNN2eBfegIgWzteNOJJYI9qIpQNDnhKat27Y3tMd01ndWk2GCHoq4k="}],"size":3499,"noattachment":false,"key":"/@csstools/postcss-sign-functions/-/@csstools/postcss-sign-functions-1.1.0.tgz"},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postcss-sign-functions_1.1.0_1731863173240_0.7319980406717372"},"_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":1731863173533,"maintainers":[{"name":"romainmenke","email":"romainmenke@gmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"_cnpm_publish_time":1731863173533,"dist-tags":{"latest":"2.0.10"}}