@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 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
- ```mermaid
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
+ ![./architecture.png](./architecture.png)
Binary file