@csstools/postcss-sign-functions 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # Changes to PostCSS Sign Functions
2
2
 
3
- ### 1.1.0
3
+ ### 1.1.2
4
4
 
5
- _November 17, 2024_
5
+ _February 23, 2025_
6
6
 
7
- - Add support for unresolvable values (e.g. `%` and `var()` in `abs()`)
8
- - Change `preserve` option to default to `false`
7
+ - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.1.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#212) (patch)
9
8
 
10
9
  [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-sign-functions/CHANGELOG.md)
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{calcFromComponentValues as e}from"@csstools/css-calc";import{tokenize as s,TokenType as o,NumberType as n}from"@csstools/css-tokenizer";import{replaceComponentValues as t,parseCommaSeparatedListOfComponentValues as a,isFunctionNode as r,FunctionNode as i,SimpleBlockNode as c,parseListOfComponentValues as l,TokenNode as p,WhitespaceNode as v,stringify as u}from"@csstools/css-parser-algorithms";const m=/(?<![-\w])(?:sign|abs)\(/i,f=/(?<![-\w])(?:sign|abs)\(/i,creator=o=>{const n=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-sign-functions",Declaration(o){if(!m.test(o.value))return;let r;r=f.test(o.value)?t(a(s({css:o.value})),replacer):a(s({css:o.value}));const i=u(e(r,{precision:5,toCanonicalUnits:!0}));i!==o.value&&(o.cloneBefore({value:i}),n.preserve||o.remove())}}};function replacer(e){if(!r(e))return;if("abs"!==e.getName().toLowerCase())return;const[s]=t([e.value],replacer);return[new i([o.Function,"max(",-1,-1,{value:"max"}],[o.CloseParen,")",-1,-1,void 0],[new c([o.OpenParen,"(",-1,-1,void 0],[o.CloseParen,")",-1,-1,void 0],l(s.flatMap((e=>e.tokens())))),new p([o.Comma,",",-1,-1,void 0]),new v([[o.Whitespace," ",-1,-1,void 0]]),new p([o.Number,"-1",-1,-1,{value:-1,type:n.Integer,signCharacter:"-"}]),new v([[o.Whitespace," ",-1,-1,void 0]]),new p([o.Delim,"*",-1,-1,{value:"*"}]),new v([[o.Whitespace," ",-1,-1,void 0]]),new c([o.OpenParen,"(",-1,-1,void 0],[o.CloseParen,")",-1,-1,void 0],l(s.flatMap((e=>e.tokens()))))])]}creator.postcss=!0;export{creator as default};
1
+ import{calcFromComponentValues as e}from"@csstools/css-calc";import{tokenize as s,TokenType as o,NumberType as n}from"@csstools/css-tokenizer";import{replaceComponentValues as t,parseCommaSeparatedListOfComponentValues as a,stringify as r,isFunctionNode as i,FunctionNode as c,SimpleBlockNode as l,TokenNode as p,WhitespaceNode as v,parseListOfComponentValues as u}from"@csstools/css-parser-algorithms";const m=/(?<![-\w])(?:sign|abs)\(/i,f=/(?<![-\w])(?:sign|abs)\(/i,creator=o=>{const n=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-sign-functions",Declaration(o){if(!m.test(o.value))return;let i;i=f.test(o.value)?t(a(s({css:o.value})),replacer):a(s({css:o.value}));const c=r(e(i,{precision:5,toCanonicalUnits:!0}));c!==o.value&&(o.cloneBefore({value:c}),n.preserve||o.remove())}}};function replacer(e){if(!i(e))return;if("abs"!==e.getName().toLowerCase())return;const[s]=t([e.value],replacer);return[new c([o.Function,"max(",-1,-1,{value:"max"}],[o.CloseParen,")",-1,-1,void 0],[new l([o.OpenParen,"(",-1,-1,void 0],[o.CloseParen,")",-1,-1,void 0],u(s.flatMap((e=>e.tokens())))),new p([o.Comma,",",-1,-1,void 0]),new v([[o.Whitespace," ",-1,-1,void 0]]),new p([o.Number,"-1",-1,-1,{value:-1,type:n.Integer,signCharacter:"-"}]),new v([[o.Whitespace," ",-1,-1,void 0]]),new p([o.Delim,"*",-1,-1,{value:"*"}]),new v([[o.Whitespace," ",-1,-1,void 0]]),new l([o.OpenParen,"(",-1,-1,void 0],[o.CloseParen,")",-1,-1,void 0],u(s.flatMap((e=>e.tokens()))))])]}creator.postcss=!0;export{creator as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@csstools/postcss-sign-functions",
3
3
  "description": "Use sign and abs functions in CSS",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "Antonio Laguna",
@@ -48,7 +48,7 @@
48
48
  "dist"
49
49
  ],
50
50
  "dependencies": {
51
- "@csstools/css-calc": "^2.1.0",
51
+ "@csstools/css-calc": "^2.1.2",
52
52
  "@csstools/css-parser-algorithms": "^3.0.4",
53
53
  "@csstools/css-tokenizer": "^3.0.3"
54
54
  },