@tbela99/css-parser 0.5.2 → 0.5.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/dist/index-umd-web.js +3 -2
- package/dist/index.cjs +3 -2
- package/dist/lib/ast/expand.js +2 -1
- package/dist/lib/renderer/color/rec2020.js +1 -1
- package/package.json +1 -1
- package/syntax.md +62 -0
package/dist/index-umd-web.js
CHANGED
|
@@ -1481,7 +1481,7 @@
|
|
|
1481
1481
|
return val / 4.5;
|
|
1482
1482
|
}
|
|
1483
1483
|
return sign * (Math.pow((abs + α - 1) / α, 1 / 0.45));
|
|
1484
|
-
}).concat(
|
|
1484
|
+
}).concat([] );
|
|
1485
1485
|
}
|
|
1486
1486
|
function lrec20202rec2020(r, g, b, a) {
|
|
1487
1487
|
// convert an array of linear-light rec2020 RGB in the range 0.0-1.0
|
|
@@ -7264,7 +7264,8 @@
|
|
|
7264
7264
|
for (const t of walkValues(tokens)) {
|
|
7265
7265
|
if (t.value.typ == exports.EnumToken.LiteralTokenType) {
|
|
7266
7266
|
if (t.value.val == '&') {
|
|
7267
|
-
|
|
7267
|
+
const rule = splitRule(replace);
|
|
7268
|
+
t.value.val = rule.length > 1 ? ':is(' + replace + ')' : replace;
|
|
7268
7269
|
}
|
|
7269
7270
|
else if (t.value.val.length > 1 && t.value.val.charAt(0) == '&') {
|
|
7270
7271
|
t.value.val = replaceCompoundLiteral(t.value.val, replace);
|
package/dist/index.cjs
CHANGED
|
@@ -1479,7 +1479,7 @@ function rec20202lrec2020(r, g, b, a) {
|
|
|
1479
1479
|
return val / 4.5;
|
|
1480
1480
|
}
|
|
1481
1481
|
return sign * (Math.pow((abs + α - 1) / α, 1 / 0.45));
|
|
1482
|
-
}).concat(
|
|
1482
|
+
}).concat([] );
|
|
1483
1483
|
}
|
|
1484
1484
|
function lrec20202rec2020(r, g, b, a) {
|
|
1485
1485
|
// convert an array of linear-light rec2020 RGB in the range 0.0-1.0
|
|
@@ -7262,7 +7262,8 @@ function replaceCompound(input, replace) {
|
|
|
7262
7262
|
for (const t of walkValues(tokens)) {
|
|
7263
7263
|
if (t.value.typ == exports.EnumToken.LiteralTokenType) {
|
|
7264
7264
|
if (t.value.val == '&') {
|
|
7265
|
-
|
|
7265
|
+
const rule = splitRule(replace);
|
|
7266
|
+
t.value.val = rule.length > 1 ? ':is(' + replace + ')' : replace;
|
|
7266
7267
|
}
|
|
7267
7268
|
else if (t.value.val.length > 1 && t.value.val.charAt(0) == '&') {
|
|
7268
7269
|
t.value.val = replaceCompoundLiteral(t.value.val, replace);
|
package/dist/lib/ast/expand.js
CHANGED
|
@@ -121,7 +121,8 @@ function replaceCompound(input, replace) {
|
|
|
121
121
|
for (const t of walkValues(tokens)) {
|
|
122
122
|
if (t.value.typ == EnumToken.LiteralTokenType) {
|
|
123
123
|
if (t.value.val == '&') {
|
|
124
|
-
|
|
124
|
+
const rule = splitRule(replace);
|
|
125
|
+
t.value.val = rule.length > 1 ? ':is(' + replace + ')' : replace;
|
|
125
126
|
}
|
|
126
127
|
else if (t.value.val.length > 1 && t.value.val.charAt(0) == '&') {
|
|
127
128
|
t.value.val = replaceCompoundLiteral(t.value.val, replace);
|
|
@@ -28,7 +28,7 @@ function rec20202lrec2020(r, g, b, a) {
|
|
|
28
28
|
return val / 4.5;
|
|
29
29
|
}
|
|
30
30
|
return sign * (Math.pow((abs + α - 1) / α, 1 / 0.45));
|
|
31
|
-
}).concat(
|
|
31
|
+
}).concat([] );
|
|
32
32
|
}
|
|
33
33
|
function lrec20202rec2020(r, g, b, a) {
|
|
34
34
|
// convert an array of linear-light rec2020 RGB in the range 0.0-1.0
|
package/package.json
CHANGED
package/syntax.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
- postfix (+|?|*)
|
|
3
|
+
|
|
4
|
+
- Expression
|
|
5
|
+
- Statement
|
|
6
|
+
- Literals
|
|
7
|
+
- Unary Expression
|
|
8
|
+
- Binary Expressions
|
|
9
|
+
- Parentheses
|
|
10
|
+
|
|
11
|
+
Grammar
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
expression → literal
|
|
15
|
+
| unary
|
|
16
|
+
| binary
|
|
17
|
+
| grouping ;
|
|
18
|
+
|
|
19
|
+
literal → NUMBER | STRING | "true" | "false" | "nil" ;
|
|
20
|
+
grouping → "(" expression ")" ;
|
|
21
|
+
unary → ( "-" | "!" ) expression ;
|
|
22
|
+
binary → expression operator expression ;
|
|
23
|
+
operator → "==" | "!=" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" ;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Syntax tree
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax#question_mark
|
|
30
|
+
|
|
31
|
+
syntax: "keyword | <'property'> | <function>"
|
|
32
|
+
syntax: "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards"
|
|
33
|
+
syntax: "none | [ [<dashed-ident> || <try-tactic>] | inset-area( <'inset-area'> ) ]#"
|
|
34
|
+
syntax: "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )"
|
|
35
|
+
syntax: "[ center | [ [ left | right | x-start | x-end ]? <length-percentage>? ]! ]#"
|
|
36
|
+
syntax: "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?
|
|
37
|
+
syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]"
|
|
38
|
+
syntax: "[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar"
|
|
39
|
+
syntax: "false | true"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
||: at least one option must appear in any order each component appears at most once. example border property <'border-width'> || <'border-style'> || <'border-color'>
|
|
43
|
+
|
|
44
|
+
|: exclusive options. at least one must be present
|
|
45
|
+
|
|
46
|
+
&&: tokens appear in any order
|
|
47
|
+
|
|
48
|
+
juxtaposition: space separated and exact order
|
|
49
|
+
|
|
50
|
+
*: postfix. the entity appears 0 or many times
|
|
51
|
+
|
|
52
|
+
+: postfix. apppears at least once.
|
|
53
|
+
|
|
54
|
+
{a,b}: postfix. appears at least A, at most B.
|
|
55
|
+
|
|
56
|
+
#: postfix, repeated one or more times, separated by comma ','
|
|
57
|
+
|
|
58
|
+
!: postfix. the group is required and must produce at least one value.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
| -> []
|
|
62
|
+
| -> []
|