Complete Email Sortierer implementation with Appwrite and Stripe integration
This commit is contained in:
commit
95349af50b
3355 files changed
+644802
No files matched your search
+10
@@ -0,0 +1,10 @@
|
||||
# Changes to CSS Calc
|
||||
|
||||
### 2.1.4
|
||||
|
||||
_May 27, 2025_
|
||||
|
||||
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#304) (patch)
|
||||
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.5`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#305) (patch)
|
||||
|
||||
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
# CSS Calc <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
|
||||
|
||||
[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-calc.svg" height="20">][npm-url]
|
||||
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
|
||||
[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
|
||||
|
||||
Implemented from : https://drafts.csswg.org/css-values-4/ on 2023-02-17
|
||||
|
||||
## Usage
|
||||
|
||||
Add [CSS calc] to your project:
|
||||
|
||||
```bash
|
||||
npm install @csstools/css-calc @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
|
||||
```
|
||||
|
||||
### With string values :
|
||||
|
||||
```mjs
|
||||
import { calc } from '@csstools/css-calc';
|
||||
|
||||
// '20'
|
||||
console.log(calc('calc(10 * 2)'));
|
||||
```
|
||||
|
||||
### With component values :
|
||||
|
||||
```mjs
|
||||
import { stringify, tokenizer } from '@csstools/css-tokenizer';
|
||||
import { parseCommaSeparatedListOfComponentValues } from '@csstools/css-parser-algorithms';
|
||||
import { calcFromComponentValues } from '@csstools/css-calc';
|
||||
|
||||
const t = tokenizer({
|
||||
css: 'calc(10 * 2)',
|
||||
});
|
||||
|
||||
const tokens = [];
|
||||
|
||||
{
|
||||
while (!t.endOfFile()) {
|
||||
tokens.push(t.nextToken());
|
||||
}
|
||||
|
||||
tokens.push(t.nextToken()); // EOF-token
|
||||
}
|
||||
|
||||
const result = parseCommaSeparatedListOfComponentValues(tokens, {});
|
||||
|
||||
// filter or mutate the component values
|
||||
|
||||
const calcResult = calcFromComponentValues(result, { precision: 5, toCanonicalUnits: true });
|
||||
|
||||
// filter or mutate the component values even further
|
||||
|
||||
const calcResultStr = calcResult.map((componentValues) => {
|
||||
return componentValues.map((x) => stringify(...x.tokens())).join('');
|
||||
}).join(',');
|
||||
|
||||
// '20'
|
||||
console.log(calcResultStr);
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
#### `precision` :
|
||||
|
||||
The default precision is fairly high.
|
||||
It aims to be high enough to make rounding unnoticeable in the browser.
|
||||
|
||||
You can set it to a lower number to suit your needs.
|
||||
|
||||
```mjs
|
||||
import { calc } from '@csstools/css-calc';
|
||||
|
||||
// '0.3'
|
||||
console.log(calc('calc(1 / 3)', { precision: 1 }));
|
||||
// '0.33'
|
||||
console.log(calc('calc(1 / 3)', { precision: 2 }));
|
||||
```
|
||||
|
||||
#### `globals` :
|
||||
|
||||
Pass global values as a map of key value pairs.
|
||||
|
||||
> Example : Relative color syntax (`lch(from pink calc(l / 2) c h)`) exposes color channel information as ident tokens.
|
||||
> By passing globals for `l`, `c` and `h` it is possible to solve nested `calc()`'s.
|
||||
|
||||
```mjs
|
||||
import { calc } from '@csstools/css-calc';
|
||||
|
||||
const globals = new Map([
|
||||
['a', '10px'],
|
||||
['b', '2rem'],
|
||||
]);
|
||||
|
||||
// '20px'
|
||||
console.log(calc('calc(a * 2)', { globals: globals }));
|
||||
// '6rem'
|
||||
console.log(calc('calc(b * 3)', { globals: globals }));
|
||||
```
|
||||
|
||||
#### `toCanonicalUnits` :
|
||||
|
||||
By default this package will try to preserve units.
|
||||
The heuristic to do this is very simplistic.
|
||||
We take the first unit we encounter and try to convert other dimensions to that unit.
|
||||
|
||||
This better matches what users expect from a CSS dev tool.
|
||||
|
||||
If you want to have outputs that are closes to CSS serialized values you can pass `toCanonicalUnits: true`.
|
||||
|
||||
```mjs
|
||||
import { calc } from '@csstools/css-calc';
|
||||
|
||||
// '20hz'
|
||||
console.log(calc('calc(0.01khz + 10hz)', { toCanonicalUnits: true }));
|
||||
|
||||
// '20hz'
|
||||
console.log(calc('calc(10hz + 0.01khz)', { toCanonicalUnits: true }));
|
||||
|
||||
// '0.02khz' !!!
|
||||
console.log(calc('calc(0.01khz + 10hz)', { toCanonicalUnits: false }));
|
||||
|
||||
// '20hz'
|
||||
console.log(calc('calc(10hz + 0.01khz)', { toCanonicalUnits: false }));
|
||||
```
|
||||
|
||||
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
|
||||
[discord]: https://discord.gg/bUadyRwkJS
|
||||
[npm-url]: https://www.npmjs.com/package/@csstools/css-calc
|
||||
|
||||
[CSS calc]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc
|
||||
+1
@@ -0,0 +1 @@
|
||||
"use strict";var e=require("@csstools/css-parser-algorithms"),n=require("@csstools/css-tokenizer");const t=/[A-Z]/g;function toLowerCaseAZ(e){return e.replace(t,(e=>String.fromCharCode(e.charCodeAt(0)+32)))}const o={cm:"px",in:"px",mm:"px",pc:"px",pt:"px",px:"px",q:"px",deg:"deg",grad:"deg",rad:"deg",turn:"deg",ms:"s",s:"s",hz:"hz",khz:"hz"},r=new Map([["cm",e=>e],["mm",e=>10*e],["q",e=>40*e],["in",e=>e/2.54],["pc",e=>e/2.54*6],["pt",e=>e/2.54*72],["px",e=>e/2.54*96]]),i=new Map([["deg",e=>e],["grad",e=>e/.9],["rad",e=>e/180*Math.PI],["turn",e=>e/360]]),u=new Map([["deg",e=>.9*e],["grad",e=>e],["rad",e=>.9*e/180*Math.PI],["turn",e=>.9*e/360]]),a=new Map([["hz",e=>e],["khz",e=>e/1e3]]),s=new Map([["cm",e=>2.54*e],["mm",e=>25.4*e],["q",e=>25.4*e*4],["in",e=>e],["pc",e=>6*e],["pt",e=>72*e],["px",e=>96*e]]),l=new Map([["hz",e=>1e3*e],["khz",e=>e]]),c=new Map([["cm",e=>e/10],["mm",e=>e],["q",e=>4*e],["in",e=>e/25.4],["pc",e=>e/25.4*6],["pt",e=>e/25.4*72],["px",e=>e/25.4*96]]),m=new Map([["ms",e=>e],["s",e=>e/1e3]]),v=new Map([["cm",e=>e/6*2.54],["mm",e=>e/6*25.4],["q",e=>e/6*25.4*4],["in",e=>e/6],["pc",e=>e],["pt",e=>e/6*72],["px",e=>e/6*96]]),T=new Map([["cm",e=>e/72*2.54],["mm",e=>e/72*25.4],["q",e=>e/72*25.4*4],["in",e=>e/72],["pc",e=>e/72*6],["pt",e=>e],["px",e=>e/72*96]]),p=new Map([["cm",e=>e/96*2.54],["mm",e=>e/96*25.4],["q",e=>e/96*25.4*4],["in",e=>e/96],["pc",e=>e/96*6],["pt",e=>e/96*72],["px",e=>e]]),N=new Map([["cm",e=>e/4/10],["mm",e=>e/4],["q",e=>e],["in",e=>e/4/25.4],["pc",e=>e/4/25.4*6],["pt",e=>e/4/25.4*72],["px",e=>e/4/25.4*96]]),f=new Map([["deg",e=>180*e/Math.PI],["grad",e=>180*e/Math.PI/.9],["rad",e=>e],["turn",e=>180*e/Math.PI/360]]),d=new Map([["ms",e=>1e3*e],["s",e=>e]]),k=new Map([["deg",e=>360*e],["grad",e=>360*e/.9],["rad",e=>360*e/180*Math.PI],["turn",e=>e]]),C=new Map([["cm",r],["mm",c],["q",N],["in",s],["pc",v],["pt",T],["px",p],["ms",m],["s",d],["deg",i],["grad",u],["rad",f],["turn",k],["hz",a],["khz",l]]);function convertUnit(e,t){if(!n.isTokenDimension(e))return t;if(!n.isTokenDimension(t))return t;const o=toLowerCaseAZ(e[4].unit),r=toLowerCaseAZ(t[4].unit);if(o===r)return t;const i=C.get(r);if(!i)return t;const u=i.get(o);if(!u)return t;const a=u(t[4].value),s=[n.TokenType.Dimension,"",t[2],t[3],{...t[4],signCharacter:a<0?"-":void 0,type:Number.isInteger(a)?n.NumberType.Integer:n.NumberType.Number,value:a}];return n.mutateUnit(s,e[4].unit),s}function toCanonicalUnit(e){if(!n.isTokenDimension(e))return e;const t=toLowerCaseAZ(e[4].unit),r=o[t];if(t===r)return e;const i=C.get(t);if(!i)return e;const u=i.get(r);if(!u)return e;const a=u(e[4].value),s=[n.TokenType.Dimension,"",e[2],e[3],{...e[4],signCharacter:a<0?"-":void 0,type:Number.isInteger(a)?n.NumberType.Integer:n.NumberType.Number,value:a}];return n.mutateUnit(s,r),s}function addition(t){if(2!==t.length)return-1;const o=t[0].value;let r=t[1].value;if(n.isTokenNumber(o)&&n.isTokenNumber(r)){const t=o[4].value+r[4].value;return new e.TokenNode([n.TokenType.Number,t.toString(),o[2],r[3],{value:t,type:o[4].type===n.NumberType.Integer&&r[4].type===n.NumberType.Integer?n.NumberType.Integer:n.NumberType.Number}])}if(n.isTokenPercentage(o)&&n.isTokenPercentage(r)){const t=o[4].value+r[4].value;return new e.TokenNode([n.TokenType.Percentage,t.toString()+"%",o[2],r[3],{value:t}])}if(n.isTokenDimension(o)&&n.isTokenDimension(r)&&(r=convertUnit(o,r),toLowerCaseAZ(o[4].unit)===toLowerCaseAZ(r[4].unit))){const t=o[4].value+r[4].value;return new e.TokenNode([n.TokenType.Dimension,t.toString()+o[4].unit,o[2],r[3],{value:t,type:o[4].type===n.NumberType.Integer&&r[4].type===n.NumberType.Integer?n.NumberType.Integer:n.NumberType.Number,unit:o[4].unit}])}return-1}function division(t){if(2!==t.length)return-1;const o=t[0].value,r=t[1].value;if(n.isTokenNumber(o)&&n.isTokenNumber(r)){const t=o[4].value/r[4].value;return new e.TokenNode([n.TokenType.Number,t.toString(),o[2],r[3],{value:t,type:Number.isInteger(t)?n.NumberType.Integer:n.NumberType.Number}])}if(n.isTokenPercentage(o)&&n.isTokenNumber(r)){const t=o[4].value/r[4].value;return new e.TokenNode([n.TokenType.Percentage,t.toString()+"%",o[2],r[3],{value:t}])}if(n.isTokenDimension(o)&&n.isTokenNumber(r)){const t=o[4].value/r[4].value;return new e.TokenNode([n.TokenType.Dimension,t.toString()+o[4].unit,o[2],r[3],{value:t,type:Number.isInteger(t)?n.NumberType.Integer:n.NumberType.Number,unit:o[4].unit}])}return-1}function isCalculation(e){return!!e&&"object"==typeof e&&"inputs"in e&&Array.isArray(e.inputs)&&"operation"in e}function solve(n){if(-1===n)return-1;const t=[];for(let o=0;o<n.inputs.length;o++){const r=n.inputs[o];if(e.isTokenNode(r)){t.push(r);continue}const i=solve(r);if(-1===i)return-1;t.push(i)}return n.operation(t)}function multiplication(t){if(2!==t.length)return-1;const o=t[0].value,r=t[1].value;if(n.isTokenNumber(o)&&n.isTokenNumber(r)){const t=o[4].value*r[4].value;return new e.TokenNode([n.TokenType.Number,t.toString(),o[2],r[3],{value:t,type:o[4].type===n.NumberType.IntegerLine truncated
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
import type { ComponentValue } from '@csstools/css-parser-algorithms';
|
||||
import type { TokenDimension } from '@csstools/css-tokenizer';
|
||||
import type { TokenNumber } from '@csstools/css-tokenizer';
|
||||
import type { TokenPercentage } from '@csstools/css-tokenizer';
|
||||
|
||||
export declare function calc(css: string, options?: conversionOptions): string;
|
||||
|
||||
export declare function calcFromComponentValues(componentValuesList: Array<Array<ComponentValue>>, options?: conversionOptions): Array<Array<ComponentValue>>;
|
||||
|
||||
export declare type conversionOptions = {
|
||||
/**
|
||||
* Pass global values as a map of key value pairs.
|
||||
*/
|
||||
globals?: GlobalsWithStrings;
|
||||
/**
|
||||
* The default precision is fairly high.
|
||||
* It aims to be high enough to make rounding unnoticeable in the browser.
|
||||
* You can set it to a lower number to suite your needs.
|
||||
*/
|
||||
precision?: number;
|
||||
/**
|
||||
* By default this package will try to preserve units.
|
||||
* The heuristic to do this is very simplistic.
|
||||
* We take the first unit we encounter and try to convert other dimensions to that unit.
|
||||
*
|
||||
* This better matches what users expect from a CSS dev tool.
|
||||
*
|
||||
* If you want to have outputs that are closes to CSS serialized values you can set `true`.
|
||||
*/
|
||||
toCanonicalUnits?: boolean;
|
||||
/**
|
||||
* Convert NaN, Infinity, ... into standard representable values.
|
||||
*/
|
||||
censorIntoStandardRepresentableValues?: boolean;
|
||||
/**
|
||||
* Some percentages resolve against other values and might be negative or positive depending on context.
|
||||
* Raw percentages are more likely to be safe to simplify outside of a browser context
|
||||
*
|
||||
* @see https://drafts.csswg.org/css-values-4/#calc-simplification
|
||||
*/
|
||||
rawPercentages?: boolean;
|
||||
/**
|
||||
* The values used to generate random value cache keys.
|
||||
*/
|
||||
randomCaching?: {
|
||||
/**
|
||||
* The name of the property the random function is used in.
|
||||
*/
|
||||
propertyName: string;
|
||||
/**
|
||||
* N is the index of the random function among other random functions in the same property value.
|
||||
*/
|
||||
propertyN: number;
|
||||
/**
|
||||
* An element ID identifying the element the style is being applied to.
|
||||
* When omitted any `random()` call will not be computed.
|
||||
*/
|
||||
elementID: string;
|
||||
/**
|
||||
* A document ID identifying the Document the styles are from.
|
||||
* When omitted any `random()` call will not be computed.
|
||||
*/
|
||||
documentID: string;
|
||||
};
|
||||
};
|
||||
|
||||
export declare type GlobalsWithStrings = Map<string, TokenDimension | TokenNumber | TokenPercentage | string>;
|
||||
|
||||
export declare const mathFunctionNames: Set<string>;
|
||||
|
||||
export { }
|
||||
+1
@@ -0,0 +1 @@
|
||||
import{TokenNode as e,isTokenNode as n,isWhitespaceNode as t,isCommentNode as r,isWhiteSpaceOrCommentNode as a,isSimpleBlockNode as u,isFunctionNode as i,FunctionNode as o,WhitespaceNode as l,parseCommaSeparatedListOfComponentValues as c,replaceComponentValues as s}from"@csstools/css-parser-algorithms";import{isTokenDimension as v,TokenType as f,NumberType as m,mutateUnit as p,isTokenNumber as C,isTokenPercentage as g,isTokenIdent as d,isTokenNumeric as D,isTokenOpenParen as N,isTokenDelim as B,isTokenComma as A,isToken as h,tokenizer as F,tokenize as b,stringify as w}from"@csstools/css-tokenizer";const E=/[A-Z]/g;function toLowerCaseAZ(e){return e.replace(E,(e=>String.fromCharCode(e.charCodeAt(0)+32)))}const I={cm:"px",in:"px",mm:"px",pc:"px",pt:"px",px:"px",q:"px",deg:"deg",grad:"deg",rad:"deg",turn:"deg",ms:"s",s:"s",hz:"hz",khz:"hz"},S=new Map([["cm",e=>e],["mm",e=>10*e],["q",e=>40*e],["in",e=>e/2.54],["pc",e=>e/2.54*6],["pt",e=>e/2.54*72],["px",e=>e/2.54*96]]),y=new Map([["deg",e=>e],["grad",e=>e/.9],["rad",e=>e/180*Math.PI],["turn",e=>e/360]]),M=new Map([["deg",e=>.9*e],["grad",e=>e],["rad",e=>.9*e/180*Math.PI],["turn",e=>.9*e/360]]),T=new Map([["hz",e=>e],["khz",e=>e/1e3]]),x=new Map([["cm",e=>2.54*e],["mm",e=>25.4*e],["q",e=>25.4*e*4],["in",e=>e],["pc",e=>6*e],["pt",e=>72*e],["px",e=>96*e]]),k=new Map([["hz",e=>1e3*e],["khz",e=>e]]),P=new Map([["cm",e=>e/10],["mm",e=>e],["q",e=>4*e],["in",e=>e/25.4],["pc",e=>e/25.4*6],["pt",e=>e/25.4*72],["px",e=>e/25.4*96]]),O=new Map([["ms",e=>e],["s",e=>e/1e3]]),W=new Map([["cm",e=>e/6*2.54],["mm",e=>e/6*25.4],["q",e=>e/6*25.4*4],["in",e=>e/6],["pc",e=>e],["pt",e=>e/6*72],["px",e=>e/6*96]]),L=new Map([["cm",e=>e/72*2.54],["mm",e=>e/72*25.4],["q",e=>e/72*25.4*4],["in",e=>e/72],["pc",e=>e/72*6],["pt",e=>e],["px",e=>e/72*96]]),U=new Map([["cm",e=>e/96*2.54],["mm",e=>e/96*25.4],["q",e=>e/96*25.4*4],["in",e=>e/96],["pc",e=>e/96*6],["pt",e=>e/96*72],["px",e=>e]]),$=new Map([["cm",e=>e/4/10],["mm",e=>e/4],["q",e=>e],["in",e=>e/4/25.4],["pc",e=>e/4/25.4*6],["pt",e=>e/4/25.4*72],["px",e=>e/4/25.4*96]]),Z=new Map([["deg",e=>180*e/Math.PI],["grad",e=>180*e/Math.PI/.9],["rad",e=>e],["turn",e=>180*e/Math.PI/360]]),z=new Map([["ms",e=>1e3*e],["s",e=>e]]),q=new Map([["deg",e=>360*e],["grad",e=>360*e/.9],["rad",e=>360*e/180*Math.PI],["turn",e=>e]]),G=new Map([["cm",S],["mm",P],["q",$],["in",x],["pc",W],["pt",L],["px",U],["ms",O],["s",z],["deg",y],["grad",M],["rad",Z],["turn",q],["hz",T],["khz",k]]);function convertUnit(e,n){if(!v(e))return n;if(!v(n))return n;const t=toLowerCaseAZ(e[4].unit),r=toLowerCaseAZ(n[4].unit);if(t===r)return n;const a=G.get(r);if(!a)return n;const u=a.get(t);if(!u)return n;const i=u(n[4].value),o=[f.Dimension,"",n[2],n[3],{...n[4],signCharacter:i<0?"-":void 0,type:Number.isInteger(i)?m.Integer:m.Number,value:i}];return p(o,e[4].unit),o}function toCanonicalUnit(e){if(!v(e))return e;const n=toLowerCaseAZ(e[4].unit),t=I[n];if(n===t)return e;const r=G.get(n);if(!r)return e;const a=r.get(t);if(!a)return e;const u=a(e[4].value),i=[f.Dimension,"",e[2],e[3],{...e[4],signCharacter:u<0?"-":void 0,type:Number.isInteger(u)?m.Integer:m.Number,value:u}];return p(i,t),i}function addition(n){if(2!==n.length)return-1;const t=n[0].value;let r=n[1].value;if(C(t)&&C(r)){const n=t[4].value+r[4].value;return new e([f.Number,n.toString(),t[2],r[3],{value:n,type:t[4].type===m.Integer&&r[4].type===m.Integer?m.Integer:m.Number}])}if(g(t)&&g(r)){const n=t[4].value+r[4].value;return new e([f.Percentage,n.toString()+"%",t[2],r[3],{value:n}])}if(v(t)&&v(r)&&(r=convertUnit(t,r),toLowerCaseAZ(t[4].unit)===toLowerCaseAZ(r[4].unit))){const n=t[4].value+r[4].value;return new e([f.Dimension,n.toString()+t[4].unit,t[2],r[3],{value:n,type:t[4].type===m.Integer&&r[4].type===m.Integer?m.Integer:m.Number,unit:t[4].unit}])}return-1}function division(n){if(2!==n.length)return-1;const t=n[0].value,r=n[1].value;if(C(t)&&C(r)){const n=t[4].value/r[4].value;return new e([f.Number,n.toString(),t[2],r[3],{value:n,type:Number.isInteger(n)?m.Integer:m.Number}])}if(g(t)&&C(r)){const n=t[4].value/r[4].value;return new e([f.Percentage,n.toString()+"%",t[2],r[3],{value:n}])}if(v(t)&&C(r)){const n=t[4].value/r[4].value;return new e([f.Dimension,n.toString()+t[4].unit,t[2],r[3],{value:n,type:Number.isInteger(n)?m.Integer:m.Number,unit:t[4].unit}])}return-1}function isCalculation(e){return!!e&&"object"==typeof e&&"inputs"in e&&Array.isArray(e.inputs)&&"operation"in e}function solve(e){if(-1===e)return-1;const t=[];for(let r=0;r<e.inputs.length;r++){const a=e.inputs[r];if(n(a)){t.push(a);continue}const u=solve(a);if(-1===u)return-1;t.push(u)}return e.operation(t)}function multiplication(n){if(2!==n.length)return-1;const t=n[0].value,r=n[1].value;if(C(t)&&C(r)){const n=t[4].value*r[4].value;return new e([f.Number,n.toString(),t[2],r[3],{value:n,type:t[4].type===m.Integer&&r[4].type===m.Integer?m.Integer:m.Number}])}if(g(t)&&C(r)){const n=t[4].value*r[4].value;return new e([f.Percentage,n.toString()+"%",t[2],r[3Line truncated
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "@csstools/css-calc",
|
||||
"description": "Solve CSS math expressions",
|
||||
"version": "2.1.4",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Antonio Laguna",
|
||||
"email": "antonio@laguna.es",
|
||||
"url": "https://antonio.laguna.es"
|
||||
},
|
||||
{
|
||||
"name": "Romain Menke",
|
||||
"email": "romainmenke@gmail.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE.md",
|
||||
"README.md",
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@csstools/css-parser-algorithms": "^3.0.5",
|
||||
"@csstools/css-tokenizer": "^3.0.4"
|
||||
},
|
||||
"scripts": {},
|
||||
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/csstools/postcss-plugins.git",
|
||||
"directory": "packages/css-calc"
|
||||
},
|
||||
"bugs": "https://github.com/csstools/postcss-plugins/issues",
|
||||
"keywords": [
|
||||
"calc",
|
||||
"css"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user