@tbela99/css-parser 1.6.2 → 1.6.4
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 +40 -0
- package/README.md +8 -8
- package/dist/{lib/data → data}/properties.json.js +296 -29
- package/dist/{lib/data → data}/validation.json.js +6 -0
- package/dist/index-umd-web.js +678 -461
- package/dist/index.cjs +678 -461
- package/dist/index.d.ts +9 -4
- package/dist/lib/ast/expand.js +1 -1
- package/dist/lib/ast/features/if.js +1 -1
- package/dist/lib/ast/features/inlinecssvariables.js +1 -1
- package/dist/lib/ast/features/prefix.js +1 -1
- package/dist/lib/ast/features/shorthand.js +10 -5
- package/dist/lib/ast/features/transform.js +1 -1
- package/dist/lib/ast/minify.js +1 -1
- package/dist/lib/ast/transform/utils.js +2 -2
- package/dist/lib/ast/walk.js +108 -90
- package/dist/lib/parser/declaration/list.js +19 -26
- package/dist/lib/parser/declaration/map.js +152 -33
- package/dist/lib/parser/parse.js +7 -7
- package/dist/lib/parser/source.js +2 -2
- package/dist/lib/parser/utils/config.js +1 -1
- package/dist/lib/parser/utils/declaration.js +0 -18
- package/dist/lib/parser/utils/hash.js +10 -5
- package/dist/lib/parser/utils/selector.js +1 -1
- package/dist/lib/{renderer → printer}/render.js +17 -17
- package/dist/lib/syntax/color/lch.js +0 -1
- package/dist/lib/syntax/color/oklch.js +0 -1
- package/dist/lib/syntax/color/xyzd50.js +0 -17
- package/dist/lib/syntax/constants.js +1 -1
- package/dist/lib/validation/config.js +5 -33
- package/dist/lib/validation/match.js +50 -180
- package/dist/node.js +3 -3
- package/dist/web.js +3 -3
- package/package.json +2 -2
- /package/dist/lib/{renderer → printer}/sourcemap/lib/codec.js +0 -0
- /package/dist/lib/{renderer → printer}/sourcemap/sourcemap.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v1.6.4
|
|
4
|
+
|
|
5
|
+
## New
|
|
6
|
+
|
|
7
|
+
Compute shorthand properties:
|
|
8
|
+
- grid-area
|
|
9
|
+
- grid-row
|
|
10
|
+
- grid-column
|
|
11
|
+
|
|
12
|
+
## Improvement
|
|
13
|
+
|
|
14
|
+
faster tokenizer and node walker functions.
|
|
15
|
+
|
|
16
|
+
# v1.6.3
|
|
17
|
+
|
|
18
|
+
## Fix
|
|
19
|
+
- [x] fix infinity rendering as 1/0 instead of 0/0 (NaN)
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
|
|
23
|
+
@media (min-width: 300px) and (max-width: 768px){
|
|
24
|
+
.s {
|
|
25
|
+
|
|
26
|
+
margin-left: calc(infinity + 1 + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
|
|
27
|
+
margin-right: calc(infinity + 1px + calc(infinity - 1 + calc(infinity / 1 + calc(infinity * 1))));
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
is parsed as
|
|
33
|
+
|
|
34
|
+
```css
|
|
35
|
+
@media (300px<=width<=768px) {
|
|
36
|
+
.s {
|
|
37
|
+
margin-left: calc(1/0);
|
|
38
|
+
margin-right: calc(1/0 + 1px)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
3
43
|
# v1.6.2
|
|
4
44
|
|
|
5
45
|
## Fix
|
package/README.md
CHANGED
|
@@ -61,11 +61,11 @@ A sample result:
|
|
|
61
61
|
|
|
62
62
|
| File | ligthningcss | CSS Parser |
|
|
63
63
|
| ------------------------------ | ------------- | ------------- |
|
|
64
|
-
| tailwind.css - 2380419 bytes | 1864728 bytes |
|
|
65
|
-
| bootstrap-4.css - 200078 bytes | 153616 bytes |
|
|
66
|
-
| bootstrap-5.css - 205481 bytes | 159987 bytes |
|
|
64
|
+
| tailwind.css - 2380419 bytes | 1864728 bytes | 1633188 bytes |
|
|
65
|
+
| bootstrap-4.css - 200078 bytes | 153616 bytes | 144571 bytes |
|
|
66
|
+
| bootstrap-5.css - 205481 bytes | 159987 bytes | 150852 bytes |
|
|
67
67
|
|
|
68
|
-
On the [complete benchmark suite](https://tbela99.github.io/css-parser/benchmark/index.html), css-parser generated a total output size of 2,
|
|
68
|
+
On the [complete benchmark suite](https://tbela99.github.io/css-parser/benchmark/index.html), css-parser generated a total output size of 2,158,698 bytes, compared to 2,494,113 bytes for Lightning CSS and larger outputs for all other tested minifiers.
|
|
69
69
|
While some tools prioritize raw execution speed, css-parser focuses on maximizing compression while preserving stylesheet semantics, resulting in consistently smaller production bundles.
|
|
70
70
|
|
|
71
71
|
## Playground
|
|
@@ -171,10 +171,10 @@ Try it [online](https://tbela99.github.io/css-parser/playground/)
|
|
|
171
171
|
- [ ] font-variant
|
|
172
172
|
- [x] gap
|
|
173
173
|
- [ ] grid
|
|
174
|
-
- [
|
|
175
|
-
- [
|
|
176
|
-
- [
|
|
177
|
-
- [
|
|
174
|
+
- [x] grid-area
|
|
175
|
+
- [x] grid-column
|
|
176
|
+
- [x] grid-row
|
|
177
|
+
- [x] grid-template
|
|
178
178
|
- [x] inset
|
|
179
179
|
- [x] list-style
|
|
180
180
|
- [x] margin
|
|
@@ -313,35 +313,6 @@ var properties = {
|
|
|
313
313
|
"border-left-color": {
|
|
314
314
|
map: "border",
|
|
315
315
|
shorthand: "border-color"
|
|
316
|
-
},
|
|
317
|
-
"grid-row": {
|
|
318
|
-
shorthand: "grid-row",
|
|
319
|
-
properties: [
|
|
320
|
-
"grid-row-start",
|
|
321
|
-
"grid-row-end"
|
|
322
|
-
],
|
|
323
|
-
types: [
|
|
324
|
-
"Iden",
|
|
325
|
-
"Number"
|
|
326
|
-
],
|
|
327
|
-
multiple: true,
|
|
328
|
-
valueSeparator: {
|
|
329
|
-
typ: "Literal",
|
|
330
|
-
val: "/"
|
|
331
|
-
},
|
|
332
|
-
"default": [
|
|
333
|
-
"auto"
|
|
334
|
-
],
|
|
335
|
-
keywords: [
|
|
336
|
-
"auto",
|
|
337
|
-
"span"
|
|
338
|
-
]
|
|
339
|
-
},
|
|
340
|
-
"grid-row-start": {
|
|
341
|
-
shorthand: "grid-row"
|
|
342
|
-
},
|
|
343
|
-
"grid-row-end": {
|
|
344
|
-
shorthand: "grid-row"
|
|
345
316
|
}
|
|
346
317
|
};
|
|
347
318
|
var map = {
|
|
@@ -1607,6 +1578,302 @@ var map = {
|
|
|
1607
1578
|
},
|
|
1608
1579
|
"background-size": {
|
|
1609
1580
|
shorthand: "background"
|
|
1581
|
+
},
|
|
1582
|
+
"grid-area": {
|
|
1583
|
+
shorthand: "grid-area",
|
|
1584
|
+
pattern: "grid-row-start grid-column-start grid-row-end grid-column-end",
|
|
1585
|
+
keywords: [
|
|
1586
|
+
"auto"
|
|
1587
|
+
],
|
|
1588
|
+
"default": [
|
|
1589
|
+
"auto"
|
|
1590
|
+
],
|
|
1591
|
+
multiple: false,
|
|
1592
|
+
expandShorthands: true,
|
|
1593
|
+
separator: {
|
|
1594
|
+
typ: "Literal",
|
|
1595
|
+
val: "/"
|
|
1596
|
+
},
|
|
1597
|
+
mapping: {
|
|
1598
|
+
"auto/auto": "auto",
|
|
1599
|
+
"auto/auto/auto": "auto",
|
|
1600
|
+
"auto/auto/auto/auto": "auto"
|
|
1601
|
+
},
|
|
1602
|
+
expandedProperties: {
|
|
1603
|
+
"grid-row": [
|
|
1604
|
+
"grid-row-start",
|
|
1605
|
+
"grid-row-end"
|
|
1606
|
+
],
|
|
1607
|
+
"grid-column": [
|
|
1608
|
+
"grid-column-start",
|
|
1609
|
+
"grid-column-end"
|
|
1610
|
+
]
|
|
1611
|
+
},
|
|
1612
|
+
properties: {
|
|
1613
|
+
"grid-row-start": {
|
|
1614
|
+
map: "grid-area",
|
|
1615
|
+
shorthand: "grid-row",
|
|
1616
|
+
types: [
|
|
1617
|
+
"Iden",
|
|
1618
|
+
"Number"
|
|
1619
|
+
],
|
|
1620
|
+
"default": [
|
|
1621
|
+
"auto"
|
|
1622
|
+
],
|
|
1623
|
+
keywords: [
|
|
1624
|
+
"auto"
|
|
1625
|
+
]
|
|
1626
|
+
},
|
|
1627
|
+
"grid-column-start": {
|
|
1628
|
+
map: "grid-area",
|
|
1629
|
+
shorthand: "grid-column",
|
|
1630
|
+
types: [
|
|
1631
|
+
"Iden",
|
|
1632
|
+
"Number"
|
|
1633
|
+
],
|
|
1634
|
+
prefix: {
|
|
1635
|
+
typ: "Literal",
|
|
1636
|
+
val: "/"
|
|
1637
|
+
},
|
|
1638
|
+
"default": [
|
|
1639
|
+
"auto"
|
|
1640
|
+
],
|
|
1641
|
+
keywords: [
|
|
1642
|
+
"auto"
|
|
1643
|
+
]
|
|
1644
|
+
},
|
|
1645
|
+
"grid-row-end": {
|
|
1646
|
+
map: "grid-area",
|
|
1647
|
+
shorthand: "grid-row",
|
|
1648
|
+
types: [
|
|
1649
|
+
"Iden",
|
|
1650
|
+
"Number"
|
|
1651
|
+
],
|
|
1652
|
+
prefix: {
|
|
1653
|
+
typ: "Literal",
|
|
1654
|
+
val: "/"
|
|
1655
|
+
},
|
|
1656
|
+
"default": [
|
|
1657
|
+
"auto"
|
|
1658
|
+
],
|
|
1659
|
+
keywords: [
|
|
1660
|
+
"auto"
|
|
1661
|
+
]
|
|
1662
|
+
},
|
|
1663
|
+
"grid-column-end": {
|
|
1664
|
+
map: "grid-area",
|
|
1665
|
+
shorthand: "grid-column",
|
|
1666
|
+
types: [
|
|
1667
|
+
"Iden",
|
|
1668
|
+
"Number"
|
|
1669
|
+
],
|
|
1670
|
+
prefix: {
|
|
1671
|
+
typ: "Literal",
|
|
1672
|
+
val: "/"
|
|
1673
|
+
},
|
|
1674
|
+
"default": [
|
|
1675
|
+
"auto"
|
|
1676
|
+
],
|
|
1677
|
+
keywords: [
|
|
1678
|
+
"auto"
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
},
|
|
1683
|
+
"grid-row-start": {
|
|
1684
|
+
shorthand: "grid-row"
|
|
1685
|
+
},
|
|
1686
|
+
"grid-column-start": {
|
|
1687
|
+
shorthand: "grid-column"
|
|
1688
|
+
},
|
|
1689
|
+
"grid-row-end": {
|
|
1690
|
+
shorthand: "grid-row"
|
|
1691
|
+
},
|
|
1692
|
+
"grid-column-end": {
|
|
1693
|
+
shorthand: "grid-column"
|
|
1694
|
+
},
|
|
1695
|
+
"grid-row": {
|
|
1696
|
+
shorthand: "grid-row",
|
|
1697
|
+
map: "grid-area",
|
|
1698
|
+
pattern: "grid-row-start grid-row-end",
|
|
1699
|
+
types: [
|
|
1700
|
+
"Iden",
|
|
1701
|
+
"Number"
|
|
1702
|
+
],
|
|
1703
|
+
keywords: [
|
|
1704
|
+
"auto"
|
|
1705
|
+
],
|
|
1706
|
+
"default": [
|
|
1707
|
+
"auto"
|
|
1708
|
+
],
|
|
1709
|
+
multiple: false,
|
|
1710
|
+
mapping: {
|
|
1711
|
+
"auto auto": "auto",
|
|
1712
|
+
"auto/auto": "auto"
|
|
1713
|
+
},
|
|
1714
|
+
properties: {
|
|
1715
|
+
"grid-row-start": {
|
|
1716
|
+
map: "grid-area",
|
|
1717
|
+
types: [
|
|
1718
|
+
"Iden",
|
|
1719
|
+
"Number"
|
|
1720
|
+
],
|
|
1721
|
+
"default": [
|
|
1722
|
+
"auto"
|
|
1723
|
+
],
|
|
1724
|
+
multiple: true,
|
|
1725
|
+
keywords: [
|
|
1726
|
+
"auto"
|
|
1727
|
+
]
|
|
1728
|
+
},
|
|
1729
|
+
"grid-row-end": {
|
|
1730
|
+
map: "grid-area",
|
|
1731
|
+
types: [
|
|
1732
|
+
"Iden",
|
|
1733
|
+
"Number"
|
|
1734
|
+
],
|
|
1735
|
+
"default": [
|
|
1736
|
+
"auto"
|
|
1737
|
+
],
|
|
1738
|
+
prefix: {
|
|
1739
|
+
typ: "Literal",
|
|
1740
|
+
val: "/"
|
|
1741
|
+
},
|
|
1742
|
+
multiple: true,
|
|
1743
|
+
keywords: [
|
|
1744
|
+
"auto"
|
|
1745
|
+
]
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
"grid-column": {
|
|
1750
|
+
shorthand: "grid-column",
|
|
1751
|
+
map: "grid-area",
|
|
1752
|
+
pattern: "grid-column-start grid-column-end",
|
|
1753
|
+
types: [
|
|
1754
|
+
"Iden",
|
|
1755
|
+
"Number"
|
|
1756
|
+
],
|
|
1757
|
+
keywords: [
|
|
1758
|
+
"auto"
|
|
1759
|
+
],
|
|
1760
|
+
"default": [
|
|
1761
|
+
"auto"
|
|
1762
|
+
],
|
|
1763
|
+
multiple: false,
|
|
1764
|
+
mapping: {
|
|
1765
|
+
"auto/auto": "auto"
|
|
1766
|
+
},
|
|
1767
|
+
properties: {
|
|
1768
|
+
"grid-column-start": {
|
|
1769
|
+
map: "grid-area",
|
|
1770
|
+
types: [
|
|
1771
|
+
"Iden",
|
|
1772
|
+
"Number"
|
|
1773
|
+
],
|
|
1774
|
+
"default": [
|
|
1775
|
+
"auto"
|
|
1776
|
+
],
|
|
1777
|
+
multiple: true,
|
|
1778
|
+
keywords: [
|
|
1779
|
+
"auto"
|
|
1780
|
+
]
|
|
1781
|
+
},
|
|
1782
|
+
"grid-column-end": {
|
|
1783
|
+
map: "grid-area",
|
|
1784
|
+
types: [
|
|
1785
|
+
"Iden",
|
|
1786
|
+
"Number"
|
|
1787
|
+
],
|
|
1788
|
+
"default": [
|
|
1789
|
+
"auto"
|
|
1790
|
+
],
|
|
1791
|
+
multiple: true,
|
|
1792
|
+
prefix: {
|
|
1793
|
+
typ: "Literal",
|
|
1794
|
+
val: "/"
|
|
1795
|
+
},
|
|
1796
|
+
keywords: [
|
|
1797
|
+
"auto"
|
|
1798
|
+
]
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
},
|
|
1802
|
+
"grid-template": {
|
|
1803
|
+
shorthand: "grid-template",
|
|
1804
|
+
pattern: "grid-template-areas grid-template-rows grid-template-columns",
|
|
1805
|
+
keywords: [
|
|
1806
|
+
"none"
|
|
1807
|
+
],
|
|
1808
|
+
"default": [
|
|
1809
|
+
"none"
|
|
1810
|
+
],
|
|
1811
|
+
multiple: false,
|
|
1812
|
+
mapping: {
|
|
1813
|
+
"none none": "none",
|
|
1814
|
+
"none/none": "none",
|
|
1815
|
+
"none none/none": "none"
|
|
1816
|
+
},
|
|
1817
|
+
properties: {
|
|
1818
|
+
"grid-template-areas": {
|
|
1819
|
+
types: [
|
|
1820
|
+
"String"
|
|
1821
|
+
],
|
|
1822
|
+
"default": [
|
|
1823
|
+
"none"
|
|
1824
|
+
],
|
|
1825
|
+
multiple: true,
|
|
1826
|
+
keywords: [
|
|
1827
|
+
"none",
|
|
1828
|
+
"auto"
|
|
1829
|
+
],
|
|
1830
|
+
mapping: {
|
|
1831
|
+
}
|
|
1832
|
+
},
|
|
1833
|
+
"grid-template-rows": {
|
|
1834
|
+
types: [
|
|
1835
|
+
"Perc",
|
|
1836
|
+
"Iden",
|
|
1837
|
+
"Length",
|
|
1838
|
+
"Flex"
|
|
1839
|
+
],
|
|
1840
|
+
"default": [
|
|
1841
|
+
"none"
|
|
1842
|
+
],
|
|
1843
|
+
multiple: true,
|
|
1844
|
+
keywords: [
|
|
1845
|
+
"none"
|
|
1846
|
+
]
|
|
1847
|
+
},
|
|
1848
|
+
"grid-template-columns": {
|
|
1849
|
+
types: [
|
|
1850
|
+
"Perc",
|
|
1851
|
+
"Iden",
|
|
1852
|
+
"Length",
|
|
1853
|
+
"Flex"
|
|
1854
|
+
],
|
|
1855
|
+
"default": [
|
|
1856
|
+
"none"
|
|
1857
|
+
],
|
|
1858
|
+
prefix: {
|
|
1859
|
+
typ: "Literal",
|
|
1860
|
+
val: "/"
|
|
1861
|
+
},
|
|
1862
|
+
multiple: true,
|
|
1863
|
+
keywords: [
|
|
1864
|
+
"none"
|
|
1865
|
+
]
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
},
|
|
1869
|
+
"grid-template-areas": {
|
|
1870
|
+
shorthand: "grid-template"
|
|
1871
|
+
},
|
|
1872
|
+
"grid-template-rows": {
|
|
1873
|
+
shorthand: "grid-template"
|
|
1874
|
+
},
|
|
1875
|
+
"grid-template-columns": {
|
|
1876
|
+
shorthand: "grid-template"
|
|
1610
1877
|
}
|
|
1611
1878
|
};
|
|
1612
1879
|
var property = {
|
|
@@ -1577,6 +1577,9 @@ var declarations = {
|
|
|
1577
1577
|
scale: {
|
|
1578
1578
|
syntax: "none | [ <number> | <percentage> ]{1,3}"
|
|
1579
1579
|
},
|
|
1580
|
+
"scroll-axis-lock": {
|
|
1581
|
+
syntax: "auto | none"
|
|
1582
|
+
},
|
|
1580
1583
|
"scroll-behavior": {
|
|
1581
1584
|
syntax: "auto | smooth"
|
|
1582
1585
|
},
|
|
@@ -1982,6 +1985,9 @@ var declarations = {
|
|
|
1982
1985
|
"will-change": {
|
|
1983
1986
|
syntax: "auto | <animateable-feature>#"
|
|
1984
1987
|
},
|
|
1988
|
+
"window-drag": {
|
|
1989
|
+
syntax: "none | move"
|
|
1990
|
+
},
|
|
1985
1991
|
"word-break": {
|
|
1986
1992
|
syntax: "normal | break-all | keep-all | break-word | auto-phrase"
|
|
1987
1993
|
},
|