@tbela99/css-parser 1.6.6 → 1.6.7
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 +50 -0
- package/README.md +1 -58
- package/architecture.png +0 -0
- package/dist/index-umd-web.js +605 -410
- package/dist/index.cjs +605 -410
- package/dist/index.d.ts +16 -8
- package/dist/lib/ast/expand.js +12 -10
- package/dist/lib/ast/features/prefix.js +1 -3
- package/dist/lib/ast/features/transform.js +1 -1
- package/dist/lib/ast/types.js +16 -8
- package/dist/lib/ast/walk.js +9 -0
- package/dist/lib/parser/declaration/list.js +17 -8
- package/dist/lib/parser/declaration/map.js +2 -1
- package/dist/lib/parser/parse.js +32 -28
- package/dist/lib/parser/utils/declaration.js +10 -0
- package/dist/lib/printer/render.js +11 -8
- package/dist/lib/syntax/color/color-mix.js +132 -48
- package/dist/lib/syntax/color/color.js +0 -1
- package/dist/lib/syntax/color/hsl.js +45 -38
- package/dist/lib/syntax/color/hsv.js +1 -15
- package/dist/lib/syntax/color/hwb.js +83 -53
- package/dist/lib/syntax/color/oklab.js +1 -1
- package/dist/lib/syntax/color/relative-color.js +29 -0
- package/dist/lib/syntax/color/srgb.js +81 -58
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v1.6.7
|
|
4
|
+
|
|
5
|
+
## Improvement
|
|
6
|
+
|
|
7
|
+
- limit the amount of memory used when parsing large files
|
|
8
|
+
- use node flags as bitmasks
|
|
9
|
+
|
|
10
|
+
## Fixes
|
|
11
|
+
|
|
12
|
+
- [x] fix powerless and missing components handling with color-mix(). missing and powerless colors are now [carried forwarded](https://drafts.csswg.org/css-color-5/#rcs-intro)
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
const css = `
|
|
16
|
+
|
|
17
|
+
button {
|
|
18
|
+
|
|
19
|
+
color: color-mix(in hsl, hwb(none none none), hsl(11 33 44));
|
|
20
|
+
color: color-mix(in hsl, lch(none none 180), hsl(11 33 44));
|
|
21
|
+
color: color-mix(in srgb, white, black);
|
|
22
|
+
color: color-mix(in oklch, oklch(0.783 0.108 326.5 / 0.5), oklch(0.392 0.4 0 / none));
|
|
23
|
+
|
|
24
|
+
color: color-mix(in srgb, color(display-p3 none none none), color(srgb 0.11 0.33 0.44));
|
|
25
|
+
color: color-mix(in oklch, oklch(78.3% 0.108 326.5), oklch(39.2% 0.4 none)) ;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const result = transformSync({input: css,
|
|
31
|
+
beautify: true,
|
|
32
|
+
inlineCssVariables: true,
|
|
33
|
+
removeDuplicateDeclarations: false,
|
|
34
|
+
convertColor: ColorType.SRGB
|
|
35
|
+
});
|
|
36
|
+
// console.debug(result);
|
|
37
|
+
console.debug(result.code);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
result
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
button {
|
|
44
|
+
color: color(srgb .78255 .272052 .15745);
|
|
45
|
+
color: color(srgb .5852 .32384 .2948);
|
|
46
|
+
color: color(srgb .5 .5 .5);
|
|
47
|
+
color: color(srgb .843871 -.026576 .636173/50%);
|
|
48
|
+
color: color(srgb .11 .33 .44);
|
|
49
|
+
color: color(srgb .764947 .131643 .788822)
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
3
53
|
# v1.6.6
|
|
4
54
|
|
|
5
55
|
## Fixes
|
package/README.md
CHANGED
|
@@ -242,61 +242,4 @@ Try it [online](https://tbela99.github.io/css-parser/playground/)
|
|
|
242
242
|
|
|
243
243
|
# Architecture
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
flowchart TD
|
|
247
|
-
%% --- Transform ---
|
|
248
|
-
Input(["CSS input"])
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
%% The Grouped Container
|
|
252
|
-
subgraph Group10["Transform step"]
|
|
253
|
-
|
|
254
|
-
transform["transform()/transformSync()"]
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
%% The Grouped Container
|
|
258
|
-
subgraph Group1 ["Parse step"]
|
|
259
|
-
|
|
260
|
-
%% --- Parse step ---
|
|
261
|
-
parse["parse()/parseSync()"]
|
|
262
|
-
tokenize(["tokenize()"])
|
|
263
|
-
parseNode(["parse and validate token stream"])
|
|
264
|
-
visitors(["visitors"])
|
|
265
|
-
minify(["minify AST"])
|
|
266
|
-
cssModules(["generate CSS module"])
|
|
267
|
-
parseResult["Parse result"]
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
%% The Grouped Container
|
|
271
|
-
subgraph Group2 ["Render step"]
|
|
272
|
-
|
|
273
|
-
%% --- Render step ---
|
|
274
|
-
renderAst(["Render AST"])
|
|
275
|
-
sourcemap([Sourcemap generation])
|
|
276
|
-
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
%% --- Result step ---
|
|
280
|
-
transformResult["Transform result"]
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
%% --- Routing step ---
|
|
284
|
-
Input --> transform
|
|
285
|
-
transform --> parse
|
|
286
|
-
parse --> tokenize
|
|
287
|
-
tokenize --> parseNode
|
|
288
|
-
parseNode -- "Visitors set?" --> visitors
|
|
289
|
-
visitors -- "Minify AST?" --> minify
|
|
290
|
-
minify -- "CSS module?" --> cssModules
|
|
291
|
-
visitors -- "CSS module?" --> cssModules
|
|
292
|
-
cssModules --> parseResult
|
|
293
|
-
parseNode -- "CSS module?" --> cssModules
|
|
294
|
-
parseNode -- "Minify AST?" --> minify
|
|
295
|
-
parseNode --> parseResult
|
|
296
|
-
visitors --> parseResult
|
|
297
|
-
minify --> parseResult
|
|
298
|
-
parseResult --> renderAst
|
|
299
|
-
renderAst -- "Sourcemap?" --> sourcemap
|
|
300
|
-
renderAst --> transformResult
|
|
301
|
-
sourcemap --> transformResult
|
|
302
|
-
```
|
|
245
|
+

|
package/architecture.png
ADDED
|
Binary file
|