@tbela99/css-parser 0.1.0 → 0.3.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.
Files changed (40) hide show
  1. package/README.md +267 -2
  2. package/dist/config.json.js +611 -4
  3. package/dist/index-umd-web.js +2898 -1223
  4. package/dist/index.cjs +2898 -1223
  5. package/dist/lib/ast/expand.js +11 -11
  6. package/dist/lib/ast/features/calc.js +33 -224
  7. package/dist/lib/ast/features/index.js +3 -3
  8. package/dist/lib/ast/features/inlinecssvariables.js +46 -31
  9. package/dist/lib/ast/features/shorthand.js +7 -7
  10. package/dist/lib/ast/features/utils/math.js +95 -0
  11. package/dist/lib/ast/math/expression.js +185 -0
  12. package/dist/lib/ast/math/math.js +95 -0
  13. package/dist/lib/ast/minify.js +34 -29
  14. package/dist/lib/ast/types.js +108 -78
  15. package/dist/lib/ast/walk.js +42 -9
  16. package/dist/lib/fs/resolve.js +4 -3
  17. package/dist/lib/iterable/set.js +48 -0
  18. package/dist/lib/iterable/weakmap.js +53 -0
  19. package/dist/lib/iterable/weakset.js +48 -0
  20. package/dist/lib/parser/declaration/list.js +7 -3
  21. package/dist/lib/parser/declaration/map.js +86 -7
  22. package/dist/lib/parser/declaration/set.js +43 -23
  23. package/dist/lib/parser/parse.js +561 -387
  24. package/dist/lib/parser/tokenize.js +42 -13
  25. package/dist/lib/parser/utils/declaration.js +67 -0
  26. package/dist/lib/parser/utils/syntax.js +32 -2
  27. package/dist/lib/parser/utils/type.js +7 -2
  28. package/dist/lib/renderer/render.js +163 -47
  29. package/dist/lib/renderer/utils/calccolor.js +238 -0
  30. package/dist/lib/renderer/utils/color.js +36 -164
  31. package/dist/lib/renderer/utils/hex.js +124 -0
  32. package/dist/lib/renderer/utils/hsl.js +49 -0
  33. package/dist/lib/renderer/utils/hsv.js +15 -0
  34. package/dist/lib/renderer/utils/hwb.js +50 -0
  35. package/dist/lib/renderer/utils/rgb.js +66 -0
  36. package/dist/node/index.js +8 -12
  37. package/dist/web/index.js +8 -12
  38. package/package.json +9 -7
  39. package/dist/index.d.ts +0 -1056
  40. /package/dist/lib/ast/{utiles → utils}/minifyfeature.js +0 -0
@@ -1,4 +1,26 @@
1
1
  var properties = {
2
+ gap: {
3
+ shorthand: "gap",
4
+ properties: [
5
+ "row-gap",
6
+ "column-gap"
7
+ ],
8
+ types: [
9
+ "Length",
10
+ "Perc"
11
+ ],
12
+ multiple: false,
13
+ separator: null,
14
+ keywords: [
15
+ "normal"
16
+ ]
17
+ },
18
+ "row-gap": {
19
+ shorthand: "gap"
20
+ },
21
+ "column-gap": {
22
+ shorthand: "gap"
23
+ },
2
24
  inset: {
3
25
  shorthand: "inset",
4
26
  properties: [
@@ -232,6 +254,520 @@ var properties = {
232
254
  }
233
255
  };
234
256
  var map = {
257
+ "flex-flow": {
258
+ shorthand: "flex-flow",
259
+ pattern: "flex-direction flex-wrap",
260
+ keywords: [
261
+ ],
262
+ "default": [
263
+ "row",
264
+ "nowrap"
265
+ ],
266
+ properties: {
267
+ "flex-direction": {
268
+ keywords: [
269
+ "row",
270
+ "row-reverse",
271
+ "column",
272
+ "column-reverse"
273
+ ],
274
+ "default": [
275
+ "row"
276
+ ],
277
+ types: [
278
+ ]
279
+ },
280
+ "flex-wrap": {
281
+ keywords: [
282
+ "wrap",
283
+ "nowrap",
284
+ "wrap-reverse"
285
+ ],
286
+ "default": [
287
+ "nowrap"
288
+ ],
289
+ types: [
290
+ ]
291
+ }
292
+ }
293
+ },
294
+ "flex-direction": {
295
+ shorthand: "flex-flow"
296
+ },
297
+ "flex-wrap": {
298
+ shorthand: "flex-flow"
299
+ },
300
+ container: {
301
+ shorthand: "container",
302
+ pattern: "container-name container-type",
303
+ keywords: [
304
+ ],
305
+ "default": [
306
+ ],
307
+ properties: {
308
+ "container-name": {
309
+ required: true,
310
+ multiple: true,
311
+ keywords: [
312
+ "none"
313
+ ],
314
+ "default": [
315
+ "none"
316
+ ],
317
+ types: [
318
+ "Iden",
319
+ "DashedIden"
320
+ ]
321
+ },
322
+ "container-type": {
323
+ previous: "container-name",
324
+ prefix: {
325
+ typ: "Literal",
326
+ val: "/"
327
+ },
328
+ keywords: [
329
+ "size",
330
+ "inline-size",
331
+ "normal"
332
+ ],
333
+ "default": [
334
+ "normal"
335
+ ],
336
+ types: [
337
+ ]
338
+ }
339
+ }
340
+ },
341
+ "container-name": {
342
+ shorthand: "container"
343
+ },
344
+ "container-type": {
345
+ shorthand: "container"
346
+ },
347
+ flex: {
348
+ shorthand: "flex",
349
+ pattern: "flex-grow flex-shrink flex-basis",
350
+ keywords: [
351
+ "auto",
352
+ "none",
353
+ "initial"
354
+ ],
355
+ "default": [
356
+ "0",
357
+ "0 1",
358
+ "0 auto",
359
+ "0 1 auto"
360
+ ],
361
+ properties: {
362
+ "flex-grow": {
363
+ required: true,
364
+ keywords: [
365
+ ],
366
+ "default": [
367
+ "0"
368
+ ],
369
+ types: [
370
+ "Number"
371
+ ]
372
+ },
373
+ "flex-shrink": {
374
+ keywords: [
375
+ ],
376
+ "default": [
377
+ "1"
378
+ ],
379
+ types: [
380
+ "Number"
381
+ ]
382
+ },
383
+ "flex-basis": {
384
+ keywords: [
385
+ "max-content",
386
+ "min-content",
387
+ "fit-content",
388
+ "fit-content",
389
+ "content",
390
+ "auto"
391
+ ],
392
+ "default": [
393
+ "auto"
394
+ ],
395
+ types: [
396
+ "Length",
397
+ "Perc"
398
+ ]
399
+ }
400
+ }
401
+ },
402
+ "flex-grow": {
403
+ shorthand: "flex"
404
+ },
405
+ "flex-shrink": {
406
+ shorthand: "flex"
407
+ },
408
+ "flex-basis": {
409
+ shorthand: "flex"
410
+ },
411
+ columns: {
412
+ shorthand: "columns",
413
+ pattern: "column-count column-width",
414
+ keywords: [
415
+ "auto"
416
+ ],
417
+ "default": [
418
+ "auto",
419
+ "auto auto"
420
+ ],
421
+ properties: {
422
+ "column-count": {
423
+ keywords: [
424
+ "auto"
425
+ ],
426
+ "default": [
427
+ "auto"
428
+ ],
429
+ types: [
430
+ "Number"
431
+ ]
432
+ },
433
+ "column-width": {
434
+ keywords: [
435
+ "auto"
436
+ ],
437
+ "default": [
438
+ "auto"
439
+ ],
440
+ types: [
441
+ "Length"
442
+ ]
443
+ }
444
+ }
445
+ },
446
+ "column-count": {
447
+ shorthand: "columns"
448
+ },
449
+ "column-width": {
450
+ shorthand: "columns"
451
+ },
452
+ transition: {
453
+ shorthand: "transition",
454
+ multiple: true,
455
+ separator: ",",
456
+ pattern: "transition-property transition-duration transition-timing-function transition-delay transition-behavior",
457
+ keywords: [
458
+ "none",
459
+ "all"
460
+ ],
461
+ "default": [
462
+ "0s",
463
+ "0ms",
464
+ "all",
465
+ "ease",
466
+ "none",
467
+ "normal"
468
+ ],
469
+ mapping: {
470
+ "cubic-bezier(.25,.1,.25,1)": "ease",
471
+ "cubic-bezier(0,0,1,1)": "linear",
472
+ "cubic-bezier(.42,0,1,1)": "ease-in",
473
+ "cubic-bezier(0,0,.58,1)": "ease-out",
474
+ "cubic-bezier(.42,0,.58,.42)": "ease-in-out"
475
+ },
476
+ properties: {
477
+ "transition-property": {
478
+ keywords: [
479
+ "none",
480
+ "all"
481
+ ],
482
+ "default": [
483
+ "all"
484
+ ],
485
+ types: [
486
+ "Iden"
487
+ ]
488
+ },
489
+ "transition-duration": {
490
+ keywords: [
491
+ ],
492
+ "default": [
493
+ "0s",
494
+ "0ms",
495
+ "normal"
496
+ ],
497
+ types: [
498
+ "Time"
499
+ ]
500
+ },
501
+ "transition-timing-function": {
502
+ keywords: [
503
+ "ease",
504
+ "ease-in",
505
+ "ease-out",
506
+ "ease-in-out",
507
+ "linear",
508
+ "step-start",
509
+ "step-end"
510
+ ],
511
+ "default": [
512
+ "ease"
513
+ ],
514
+ types: [
515
+ "TimingFunction"
516
+ ],
517
+ mapping: {
518
+ "cubic-bezier(.25,.1,.25,1)": "ease",
519
+ "cubic-bezier(0,0,1,1)": "linear",
520
+ "cubic-bezier(.42,0,1,1)": "ease-in",
521
+ "cubic-bezier(0,0,.58,1)": "ease-out",
522
+ "cubic-bezier(.42,0,.58,.42)": "ease-in-out"
523
+ }
524
+ },
525
+ "transition-delay": {
526
+ keywords: [
527
+ ],
528
+ "default": [
529
+ "0s"
530
+ ],
531
+ types: [
532
+ "Time"
533
+ ]
534
+ },
535
+ "transition-behavior": {
536
+ keywords: [
537
+ "normal",
538
+ "allow-discrete"
539
+ ],
540
+ "default": [
541
+ "normal"
542
+ ],
543
+ types: [
544
+ ]
545
+ }
546
+ }
547
+ },
548
+ "transition-property": {
549
+ shorthand: "transition"
550
+ },
551
+ "transition-duration": {
552
+ shorthand: "transition"
553
+ },
554
+ "transition-timing-function": {
555
+ shorthand: "transition"
556
+ },
557
+ "transition-delay": {
558
+ shorthand: "transition"
559
+ },
560
+ "transition-behavior": {
561
+ shorthand: "transition"
562
+ },
563
+ animation: {
564
+ shorthand: "animation",
565
+ pattern: "animation-name animation-duration animation-timing-function animation-delay animation-iteration-count animation-direction animation-fill-mode animation-play-state animation-timeline",
566
+ "default": [
567
+ "1",
568
+ "0s",
569
+ "0ms",
570
+ "none",
571
+ "ease",
572
+ "normal",
573
+ "running",
574
+ "auto"
575
+ ],
576
+ properties: {
577
+ "animation-name": {
578
+ keywords: [
579
+ "none"
580
+ ],
581
+ "default": [
582
+ "none"
583
+ ],
584
+ types: [
585
+ "Iden"
586
+ ]
587
+ },
588
+ "animation-duration": {
589
+ keywords: [
590
+ "auto"
591
+ ],
592
+ "default": [
593
+ "0s",
594
+ "0ms",
595
+ "auto"
596
+ ],
597
+ types: [
598
+ "Time"
599
+ ],
600
+ mapping: {
601
+ auto: "0s"
602
+ }
603
+ },
604
+ "animation-timing-function": {
605
+ keywords: [
606
+ "ease",
607
+ "ease-in",
608
+ "ease-out",
609
+ "ease-in-out",
610
+ "linear",
611
+ "step-start",
612
+ "step-end"
613
+ ],
614
+ "default": [
615
+ "ease"
616
+ ],
617
+ types: [
618
+ "TimingFunction"
619
+ ],
620
+ mapping: {
621
+ "cubic-bezier(.25,.1,.25,1)": "ease",
622
+ "cubic-bezier(0,0,1,1)": "linear",
623
+ "cubic-bezier(.42,0,1,1)": "ease-in",
624
+ "cubic-bezier(0,0,.58,1)": "ease-out",
625
+ "cubic-bezier(.42,0,.58,.42)": "ease-in-out"
626
+ }
627
+ },
628
+ "animation-delay": {
629
+ keywords: [
630
+ ],
631
+ "default": [
632
+ "0s",
633
+ "0ms"
634
+ ],
635
+ types: [
636
+ "Time"
637
+ ]
638
+ },
639
+ "animation-iteration-count": {
640
+ keywords: [
641
+ "infinite"
642
+ ],
643
+ "default": [
644
+ "1"
645
+ ],
646
+ types: [
647
+ "Number"
648
+ ]
649
+ },
650
+ "animation-direction": {
651
+ keywords: [
652
+ "normal",
653
+ "reverse",
654
+ "alternate",
655
+ "alternate-reverse"
656
+ ],
657
+ "default": [
658
+ "normal"
659
+ ],
660
+ types: [
661
+ ]
662
+ },
663
+ "animation-fill-mode": {
664
+ keywords: [
665
+ "none",
666
+ "forwards",
667
+ "backwards",
668
+ "both"
669
+ ],
670
+ "default": [
671
+ "none"
672
+ ],
673
+ types: [
674
+ ]
675
+ },
676
+ "animation-play-state": {
677
+ keywords: [
678
+ "running",
679
+ "paused"
680
+ ],
681
+ "default": [
682
+ "running"
683
+ ],
684
+ types: [
685
+ ]
686
+ },
687
+ "animation-timeline": {
688
+ keywords: [
689
+ "none",
690
+ "auto"
691
+ ],
692
+ "default": [
693
+ "auto"
694
+ ],
695
+ types: [
696
+ "DashedIden",
697
+ "TimelineFunction"
698
+ ]
699
+ }
700
+ }
701
+ },
702
+ "animation-name": {
703
+ shorthand: "animation"
704
+ },
705
+ "animation-duration": {
706
+ shorthand: "animation"
707
+ },
708
+ "animation-timing-function": {
709
+ shorthand: "animation"
710
+ },
711
+ "animation-delay": {
712
+ shorthand: "animation"
713
+ },
714
+ "animation-iteration-count": {
715
+ shorthand: "animation"
716
+ },
717
+ "animation-direction": {
718
+ shorthand: "animation"
719
+ },
720
+ "animation-fill-mode": {
721
+ shorthand: "animation"
722
+ },
723
+ "animation-play-state": {
724
+ shorthand: "animation"
725
+ },
726
+ "animation-timeline": {
727
+ shorthand: "animation"
728
+ },
729
+ "text-emphasis": {
730
+ shorthand: "text-emphasis",
731
+ pattern: "text-emphasis-color text-emphasis-style",
732
+ "default": [
733
+ "none",
734
+ "currentcolor"
735
+ ],
736
+ properties: {
737
+ "text-emphasis-style": {
738
+ keywords: [
739
+ "none",
740
+ "filled",
741
+ "open",
742
+ "dot",
743
+ "circle",
744
+ "double-circle",
745
+ "triangle",
746
+ "sesame"
747
+ ],
748
+ "default": [
749
+ "none"
750
+ ],
751
+ types: [
752
+ "String"
753
+ ]
754
+ },
755
+ "text-emphasis-color": {
756
+ "default": [
757
+ "currentcolor"
758
+ ],
759
+ types: [
760
+ "Color"
761
+ ]
762
+ }
763
+ }
764
+ },
765
+ "text-emphasis-style": {
766
+ shorthand: "text-emphasis"
767
+ },
768
+ "text-emphasis-color": {
769
+ shorthand: "text-emphasis"
770
+ },
235
771
  border: {
236
772
  shorthand: "border",
237
773
  pattern: "border-color border-style border-width",
@@ -297,6 +833,75 @@ var map = {
297
833
  "border-width": {
298
834
  shorthand: "border"
299
835
  },
836
+ "list-style": {
837
+ shorthand: "list-style",
838
+ pattern: "list-style-type list-style-position list-style-image",
839
+ keywords: [
840
+ "none",
841
+ "outside"
842
+ ],
843
+ "default": [
844
+ "none",
845
+ "outside"
846
+ ],
847
+ properties: {
848
+ "list-style-position": {
849
+ types: [
850
+ ],
851
+ "default": [
852
+ "outside"
853
+ ],
854
+ keywords: [
855
+ "inside",
856
+ "outside"
857
+ ]
858
+ },
859
+ "list-style-image": {
860
+ "default": [
861
+ "none"
862
+ ],
863
+ keywords: [
864
+ "node"
865
+ ],
866
+ types: [
867
+ "UrlFunc",
868
+ "ImageFunc"
869
+ ]
870
+ },
871
+ "list-style-type": {
872
+ types: [
873
+ "String",
874
+ "Iden",
875
+ "Symbols"
876
+ ],
877
+ "default": [
878
+ "disc"
879
+ ],
880
+ keywords: [
881
+ "disc",
882
+ "circle",
883
+ "square",
884
+ "decimal",
885
+ "decimal-leading-zero",
886
+ "lower-roman",
887
+ "upper-roman",
888
+ "lower-greek",
889
+ "lower-latin",
890
+ "upper-latin",
891
+ "none"
892
+ ]
893
+ }
894
+ }
895
+ },
896
+ "list-style-position": {
897
+ shorthand: "list-style"
898
+ },
899
+ "list-style-image": {
900
+ shorthand: "list-style"
901
+ },
902
+ "list-style-type": {
903
+ shorthand: "list-style"
904
+ },
300
905
  overflow: {
301
906
  shorthand: "overflow",
302
907
  pattern: "overflow-x overflow-y",
@@ -354,7 +959,8 @@ var map = {
354
959
  ],
355
960
  "default": [
356
961
  "0",
357
- "none"
962
+ "none",
963
+ "currentcolor"
358
964
  ],
359
965
  properties: {
360
966
  "outline-color": {
@@ -362,10 +968,10 @@ var map = {
362
968
  "Color"
363
969
  ],
364
970
  "default": [
365
- "currentColor"
971
+ "currentcolor"
366
972
  ],
367
973
  keywords: [
368
- "currentColor"
974
+ "currentcolor"
369
975
  ]
370
976
  },
371
977
  "outline-style": {
@@ -709,7 +1315,8 @@ var map = {
709
1315
  },
710
1316
  "background-image": {
711
1317
  types: [
712
- "UrlFunc"
1318
+ "UrlFunc",
1319
+ "ImageFunc"
713
1320
  ],
714
1321
  "default": [
715
1322
  "none"