@tbela99/css-parser 0.9.0 → 0.9.1
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/README.md +8 -5
- package/dist/index-umd-web.js +469 -1946
- package/dist/index.cjs +459 -1936
- package/dist/index.d.ts +25 -12
- package/dist/lib/ast/expand.js +15 -2
- package/dist/lib/ast/minify.js +1 -1
- package/dist/lib/ast/types.js +1 -0
- package/dist/lib/parser/parse.js +66 -40
- package/dist/lib/renderer/color/color.js +2 -2
- package/dist/lib/renderer/color/lab.js +2 -1
- package/dist/lib/renderer/color/prophotoRgb.js +2 -2
- package/dist/lib/renderer/color/prophotorgb.js +2 -2
- package/dist/lib/renderer/color/xyz.js +2 -18
- package/dist/lib/renderer/color/xyzd50.js +20 -2
- package/dist/lib/renderer/render.js +3 -2
- package/dist/lib/renderer/sourcemap/sourcemap.js +1 -1
- package/dist/lib/syntax/syntax.js +2 -1
- package/dist/lib/validation/at-rules/document.js +40 -60
- package/dist/lib/validation/at-rules/import.js +61 -59
- package/dist/lib/validation/at-rules/media.js +2 -1
- package/dist/lib/validation/at-rules/supports.js +40 -9
- package/dist/lib/validation/config.json.js +83 -35
- package/dist/lib/validation/declaration.js +2 -10
- package/dist/lib/validation/parser/parse.js +1 -95
- package/dist/lib/validation/parser/types.js +1 -2
- package/dist/lib/validation/syntax.js +39 -5
- package/dist/lib/validation/syntaxes/compound-selector.js +2 -2
- package/dist/lib/validation/syntaxes/layer-name.js +5 -16
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://tbela99.github.io/css-parser/playground/) [](https://www.npmjs.com/package/@tbela99/css-parser) [](https://jsr.io/@tbela99/css-parser) [](https://github.com/tbela99/css-parser/actions) [](https://www.npmjs.com/package/@tbela99/css-parser)
|
|
3
|
+
)](https://jsr.io/@tbela99/css-parser) [](https://github.com/tbela99/css-parser/actions) [](https://www.npmjs.com/package/@tbela99/css-parser) [](https://www.npmjs.com/package/@tbela99/css-parser)
|
|
4
4
|
|
|
5
5
|
# css-parser
|
|
6
6
|
|
|
@@ -65,7 +65,7 @@ import as a module
|
|
|
65
65
|
|
|
66
66
|
```javascript
|
|
67
67
|
|
|
68
|
-
import {transform} from '
|
|
68
|
+
import {transform} from '@tbela99/css-parser';
|
|
69
69
|
|
|
70
70
|
// ...
|
|
71
71
|
```
|
|
@@ -96,7 +96,7 @@ Javascript module from cdn
|
|
|
96
96
|
|
|
97
97
|
<script type="module">
|
|
98
98
|
|
|
99
|
-
import {transform} from 'https://esm.sh/@tbela99/css-parser@0.
|
|
99
|
+
import {transform} from 'https://esm.sh/@tbela99/css-parser@0.9.0/web';
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
const css = `
|
|
@@ -154,6 +154,7 @@ Include ParseOptions and RenderOptions
|
|
|
154
154
|
> Minify Options
|
|
155
155
|
|
|
156
156
|
- minify: boolean, optional. default to _true_. optimize ast.
|
|
157
|
+
- pass: number, optional. minification pass. default to 1
|
|
157
158
|
- nestingRules: boolean, optional. automatically generated nested rules.
|
|
158
159
|
- expandNestingRules: boolean, optional. convert nesting rules into separate rules. will automatically set nestingRules
|
|
159
160
|
to false.
|
|
@@ -700,7 +701,9 @@ for (const {node, parent, root} of walk(ast)) {
|
|
|
700
701
|
|
|
701
702
|
## Minification
|
|
702
703
|
|
|
703
|
-
- [x]
|
|
704
|
+
- [x] evaluate math functions calc(), clamp(), min(), max(), round(), mod(), rem(), sin(), cos(), tan(), asin(),
|
|
705
|
+
acos(), atan(), atan2(), pow(), sqrt(), hypot(), log(), exp(), abs(), sign()
|
|
706
|
+
- [x] multi-pass minification
|
|
704
707
|
- [x] inline css variables
|
|
705
708
|
- [x] merge identical rules
|
|
706
709
|
- [x] merge adjacent rules
|
|
@@ -816,7 +819,7 @@ the visitor is called only on 'height' declarations
|
|
|
816
819
|
```typescript
|
|
817
820
|
|
|
818
821
|
import {AstDeclaration, LengthToken, ParserOptions} from "../src/@types";
|
|
819
|
-
import {EnumToken
|
|
822
|
+
import {EnumToken} from "../src/lib";
|
|
820
823
|
import {transform} from "../src/node";
|
|
821
824
|
|
|
822
825
|
const options: ParserOptions = {
|