@lezer/css 1.1.6 → 1.1.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,3 +1,9 @@
1
+ ## 1.1.7 (2024-01-08)
2
+
3
+ ### Bug fixes
4
+
5
+ Correctly parse properties with a space before the colon.
6
+
1
7
  ## 1.1.6 (2024-01-01)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -47,7 +47,8 @@ const descendant = new lr.ExternalTokenizer(input => {
47
47
  if (space.includes(input.peek(-1))) {
48
48
  let {next} = input;
49
49
  if (isAlpha(next) || next == underscore || next == hash || next == period ||
50
- next == bracketL || next == colon || next == dash || next == ampersand)
50
+ next == bracketL || next == colon && isAlpha(input.peek(1)) ||
51
+ next == dash || next == ampersand)
51
52
  input.acceptToken(descendantOp);
52
53
  }
53
54
  });
package/dist/index.js CHANGED
@@ -43,7 +43,8 @@ const descendant = new ExternalTokenizer(input => {
43
43
  if (space.includes(input.peek(-1))) {
44
44
  let {next} = input;
45
45
  if (isAlpha(next) || next == underscore || next == hash || next == period ||
46
- next == bracketL || next == colon || next == dash || next == ampersand)
46
+ next == bracketL || next == colon && isAlpha(input.peek(1)) ||
47
+ next == dash || next == ampersand)
47
48
  input.acceptToken(descendantOp);
48
49
  }
49
50
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lezer/css",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "lezer-based CSS grammar",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
package/src/tokens.js CHANGED
@@ -36,7 +36,8 @@ export const descendant = new ExternalTokenizer(input => {
36
36
  if (space.includes(input.peek(-1))) {
37
37
  let {next} = input
38
38
  if (isAlpha(next) || next == underscore || next == hash || next == period ||
39
- next == bracketL || next == colon || next == dash || next == ampersand)
39
+ next == bracketL || next == colon && isAlpha(input.peek(1)) ||
40
+ next == dash || next == ampersand)
40
41
  input.acceptToken(descendantOp)
41
42
  }
42
43
  })
@@ -142,3 +142,19 @@ foo {
142
142
  StyleSheet(RuleSet(TagSelector(TagName),Block(
143
143
  Declaration(VariableName,ValueName),
144
144
  Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))))))
145
+
146
+ # Space before colon
147
+
148
+ div {
149
+ color : red;
150
+ .x :active {
151
+ color : blue;
152
+ }
153
+ }
154
+
155
+ ==>
156
+
157
+ StyleSheet(RuleSet(TagSelector(TagName),Block(
158
+ Declaration(PropertyName,ValueName),
159
+ RuleSet(DescendantSelector(ClassSelector(ClassName),PseudoClassSelector(PseudoClassName)),Block(
160
+ Declaration(PropertyName,ValueName))))))