@csstools/postcss-exponential-functions 1.0.0
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 +10 -0
- package/LICENSE.md +18 -0
- package/README.md +100 -0
- package/dist/calc.d.ts +1 -0
- package/dist/checks.d.ts +2 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +1 -0
- package/package.json +85 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changes to PostCSS Exponential Functions
|
|
2
|
+
|
|
3
|
+
### 1.0.0
|
|
4
|
+
|
|
5
|
+
_July 24, 2023_
|
|
6
|
+
|
|
7
|
+
- Initial version
|
|
8
|
+
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#220) (minor)
|
|
9
|
+
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#231) (patch)
|
|
10
|
+
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#113) (patch)
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT No Attribution (MIT-0)
|
|
2
|
+
|
|
3
|
+
Copyright © CSSTools Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# PostCSS Exponential Functions [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS]
|
|
2
|
+
|
|
3
|
+
[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/postcss-exponential-functions.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/exponential-functions.svg" height="20">][css-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
|
|
4
|
+
|
|
5
|
+
[PostCSS Exponential Functions] lets you use the `pow()`, `sqrt()`, `hypot()`, `log()`, `exp()` functions following the [CSS Values 4 Specification].
|
|
6
|
+
|
|
7
|
+
```pcss
|
|
8
|
+
.foo {
|
|
9
|
+
top: calc(1px * pow(2, 3));
|
|
10
|
+
line-height: sqrt(1.2);
|
|
11
|
+
padding: hypot(3px, 4px);
|
|
12
|
+
order: log(10, 10);
|
|
13
|
+
min-height: calc(e - exp(1));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* becomes */
|
|
17
|
+
|
|
18
|
+
.foo {
|
|
19
|
+
top: 8px;
|
|
20
|
+
line-height: 1.0954451150103;
|
|
21
|
+
padding: 5px;
|
|
22
|
+
order: 1;
|
|
23
|
+
min-height: 0;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Add [PostCSS Exponential Functions] to your project:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install postcss @csstools/postcss-exponential-functions --save-dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use it as a [PostCSS] plugin:
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const postcss = require('postcss');
|
|
39
|
+
const postcssExponentialFunctions = require('@csstools/postcss-exponential-functions');
|
|
40
|
+
|
|
41
|
+
postcss([
|
|
42
|
+
postcssExponentialFunctions(/* pluginOptions */)
|
|
43
|
+
]).process(YOUR_CSS /*, processOptions */);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
[PostCSS Exponential Functions] runs in all Node environments, with special
|
|
47
|
+
instructions for:
|
|
48
|
+
|
|
49
|
+
- [Node](INSTALL.md#node)
|
|
50
|
+
- [PostCSS CLI](INSTALL.md#postcss-cli)
|
|
51
|
+
- [PostCSS Load Config](INSTALL.md#postcss-load-config)
|
|
52
|
+
- [Webpack](INSTALL.md#webpack)
|
|
53
|
+
- [Next.js](INSTALL.md#nextjs)
|
|
54
|
+
- [Gulp](INSTALL.md#gulp)
|
|
55
|
+
- [Grunt](INSTALL.md#grunt)
|
|
56
|
+
|
|
57
|
+
## Options
|
|
58
|
+
|
|
59
|
+
### preserve
|
|
60
|
+
|
|
61
|
+
The `preserve` option determines whether the original notation
|
|
62
|
+
is preserved. By default, it is not preserved.
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
postcssExponentialFunctions({ preserve: true })
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```pcss
|
|
69
|
+
.foo {
|
|
70
|
+
top: calc(1px * pow(2, 3));
|
|
71
|
+
line-height: sqrt(1.2);
|
|
72
|
+
padding: hypot(3px, 4px);
|
|
73
|
+
order: log(10, 10);
|
|
74
|
+
min-height: calc(e - exp(1));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* becomes */
|
|
78
|
+
|
|
79
|
+
.foo {
|
|
80
|
+
top: 8px;
|
|
81
|
+
top: calc(1px * pow(2, 3));
|
|
82
|
+
line-height: 1.0954451150103;
|
|
83
|
+
line-height: sqrt(1.2);
|
|
84
|
+
padding: 5px;
|
|
85
|
+
padding: hypot(3px, 4px);
|
|
86
|
+
order: 1;
|
|
87
|
+
order: log(10, 10);
|
|
88
|
+
min-height: 0;
|
|
89
|
+
min-height: calc(e - exp(1));
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
|
|
94
|
+
[css-url]: https://cssdb.org/#exponential-functions
|
|
95
|
+
[discord]: https://discord.gg/bUadyRwkJS
|
|
96
|
+
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-exponential-functions
|
|
97
|
+
|
|
98
|
+
[PostCSS]: https://github.com/postcss/postcss
|
|
99
|
+
[PostCSS Exponential Functions]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-exponential-functions
|
|
100
|
+
[CSS Values 4 Specification]: https://www.w3.org/TR/css-values-4/#exponent-funcs
|
package/dist/calc.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function calc(css: string): string;
|
package/dist/checks.d.ts
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("@csstools/css-calc");const s=new RegExp(`(${["exp","hypot","log","pow","sqrt"].join("|")})\\(`,"i"),creator=o=>{const t=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-exponential-functions",Declaration(o){if(!s.test(o.value))return;const c=e.calc(o.value);c!==o.value&&(o.cloneBefore({value:c}),t.preserve||o.remove())}}};creator.postcss=!0,module.exports=creator;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PluginCreator } from 'postcss';
|
|
2
|
+
/** postcss-exponential-functions plugin options */
|
|
3
|
+
export type pluginOptions = {
|
|
4
|
+
/** Preserve the original notation. default: false */
|
|
5
|
+
preserve?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const creator: PluginCreator<pluginOptions>;
|
|
8
|
+
export default creator;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{calc as e}from"@csstools/css-calc";const s=new RegExp(`(${["exp","hypot","log","pow","sqrt"].join("|")})\\(`,"i"),creator=o=>{const t=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-exponential-functions",Declaration(o){if(!s.test(o.value))return;const n=e(o.value);n!==o.value&&(o.cloneBefore({value:n}),t.preserve||o.remove())}}};creator.postcss=!0;export{creator as default};
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@csstools/postcss-exponential-functions",
|
|
3
|
+
"description": "Use pow(), sqrt(), hypot(), log(), exp() exponential functions in CSS",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"contributors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Antonio Laguna",
|
|
8
|
+
"email": "antonio@laguna.es",
|
|
9
|
+
"url": "https://antonio.laguna.es"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "Romain Menke",
|
|
13
|
+
"email": "romainmenke@gmail.com"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT-0",
|
|
17
|
+
"funding": [
|
|
18
|
+
{
|
|
19
|
+
"type": "github",
|
|
20
|
+
"url": "https://github.com/sponsors/csstools"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"type": "opencollective",
|
|
24
|
+
"url": "https://opencollective.com/csstools"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": "^14 || ^16 || >=18"
|
|
29
|
+
},
|
|
30
|
+
"main": "dist/index.cjs",
|
|
31
|
+
"module": "dist/index.mjs",
|
|
32
|
+
"types": "dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.mjs",
|
|
37
|
+
"require": "./dist/index.cjs",
|
|
38
|
+
"default": "./dist/index.mjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"CHANGELOG.md",
|
|
43
|
+
"LICENSE.md",
|
|
44
|
+
"README.md",
|
|
45
|
+
"dist"
|
|
46
|
+
],
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@csstools/css-calc": "^1.1.3",
|
|
49
|
+
"@csstools/css-parser-algorithms": "^2.3.1",
|
|
50
|
+
"@csstools/css-tokenizer": "^2.2.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"postcss": "^8.4"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@csstools/postcss-tape": "*"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rollup -c ../../rollup/default.mjs",
|
|
60
|
+
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
|
|
61
|
+
"lint": "node ../../.github/bin/format-package-json.mjs",
|
|
62
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
63
|
+
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
|
|
64
|
+
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-exponential-functions#readme",
|
|
67
|
+
"repository": {
|
|
68
|
+
"type": "git",
|
|
69
|
+
"url": "https://github.com/csstools/postcss-plugins.git",
|
|
70
|
+
"directory": "plugins/postcss-exponential-functions"
|
|
71
|
+
},
|
|
72
|
+
"bugs": "https://github.com/csstools/postcss-plugins/issues",
|
|
73
|
+
"keywords": [
|
|
74
|
+
"postcss-plugin"
|
|
75
|
+
],
|
|
76
|
+
"csstools": {
|
|
77
|
+
"cssdbId": "exponential-functions",
|
|
78
|
+
"exportName": "postcssExponentialFunctions",
|
|
79
|
+
"humanReadableName": "PostCSS Exponential Functions",
|
|
80
|
+
"specUrl": "https://www.w3.org/TR/css-values-4/#exponent-funcs"
|
|
81
|
+
},
|
|
82
|
+
"volta": {
|
|
83
|
+
"extends": "../../package.json"
|
|
84
|
+
}
|
|
85
|
+
}
|