@tbela99/css-parser 1.3.2 → 1.3.3
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 +5 -0
- package/README.md +41 -5
- package/dist/index-umd-web.js +1272 -961
- package/dist/index.cjs +1194 -920
- package/dist/index.d.ts +921 -264
- package/dist/lib/ast/features/calc.js +5 -6
- package/dist/lib/ast/features/inlinecssvariables.js +5 -6
- package/dist/lib/ast/features/prefix.js +4 -14
- package/dist/lib/ast/features/shorthand.js +4 -6
- package/dist/lib/ast/features/transform.js +5 -6
- package/dist/lib/ast/features/type.js +4 -2
- package/dist/lib/ast/minify.js +55 -114
- package/dist/lib/ast/types.js +2 -2
- package/dist/lib/ast/walk.js +149 -59
- package/dist/lib/fs/resolve.js +6 -4
- package/dist/lib/parser/declaration/list.js +1 -1
- package/dist/lib/parser/parse.js +297 -57
- package/dist/lib/parser/tokenize.js +1 -1
- package/dist/lib/renderer/render.js +5 -5
- package/dist/lib/syntax/color/cmyk.js +6 -3
- package/dist/lib/syntax/color/color-mix.js +2 -3
- package/dist/lib/syntax/color/color.js +28 -6
- package/dist/lib/syntax/color/hex.js +3 -0
- package/dist/lib/syntax/color/hsl.js +18 -7
- package/dist/lib/syntax/color/hwb.js +3 -3
- package/dist/lib/syntax/color/lab.js +4 -4
- package/dist/lib/syntax/color/lch.js +7 -4
- package/dist/lib/syntax/color/oklab.js +4 -4
- package/dist/lib/syntax/color/oklch.js +18 -6
- package/dist/lib/syntax/color/relativecolor.js +9 -56
- package/dist/lib/syntax/color/srgb.js +1 -1
- package/dist/lib/validation/config.json.js +4 -12
- package/dist/node.js +53 -31
- package/dist/web.js +76 -17
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -41,6 +41,10 @@ $ deno add @tbela99/css-parser
|
|
|
41
41
|
- flatten @import rules
|
|
42
42
|
- experimental CSS prefix removal
|
|
43
43
|
|
|
44
|
+
## Online documentation
|
|
45
|
+
|
|
46
|
+
See the full documentation at the [CSS Parser](https://tbela99.github.io/css-parser/docs) documentation site
|
|
47
|
+
|
|
44
48
|
## Playground
|
|
45
49
|
|
|
46
50
|
Try it [online](https://tbela99.github.io/css-parser/playground/)
|
|
@@ -97,8 +101,7 @@ Javascript module from cdn
|
|
|
97
101
|
|
|
98
102
|
<script type="module">
|
|
99
103
|
|
|
100
|
-
import {transform} from 'https://esm.sh/@tbela99/css-parser@1.3.
|
|
101
|
-
|
|
104
|
+
import {transform} from 'https://esm.sh/@tbela99/css-parser@1.3.3/web';
|
|
102
105
|
|
|
103
106
|
const css = `
|
|
104
107
|
.s {
|
|
@@ -119,11 +122,44 @@ Javascript module
|
|
|
119
122
|
<script src="dist/web.js" type="module"></script>
|
|
120
123
|
```
|
|
121
124
|
|
|
122
|
-
|
|
125
|
+
Javascript umd module from cdn
|
|
123
126
|
|
|
124
|
-
```
|
|
127
|
+
```html
|
|
128
|
+
|
|
129
|
+
<script src="https://unpkg.com/@tbela99/css-parser@1.3.2/dist/index-umd-web.js"></script>
|
|
130
|
+
<script>
|
|
131
|
+
|
|
132
|
+
(async () => {
|
|
133
|
+
|
|
134
|
+
const css = `
|
|
135
|
+
|
|
136
|
+
.table {
|
|
137
|
+
border-collapse: collapse;
|
|
138
|
+
width: 100%;
|
|
139
|
+
}
|
|
125
140
|
|
|
126
|
-
|
|
141
|
+
.table td, .table th {
|
|
142
|
+
border: 1px solid #ddd;
|
|
143
|
+
padding: 8px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.table tr:nth-child(even){background-color: #f2f2f2;}
|
|
147
|
+
|
|
148
|
+
.table tr:hover {background-color: #ddd;}
|
|
149
|
+
|
|
150
|
+
.table th {
|
|
151
|
+
padding-top: 12px;
|
|
152
|
+
padding-bottom: 12px;
|
|
153
|
+
text-align: left;
|
|
154
|
+
background-color: #4CAF50;
|
|
155
|
+
color: white;
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
console.debug(await CSSParser.transform(css, {beautify: true, convertColor: CSSParser.ColorType.OKLCH}).then(r => r.code));
|
|
160
|
+
})();
|
|
161
|
+
|
|
162
|
+
</script>
|
|
127
163
|
```
|
|
128
164
|
|
|
129
165
|
## Transform
|