@codemirror/lang-css
Advanced tools
Comparing version 0.19.3 to 0.20.0
@@ -0,1 +1,7 @@ | ||
## 0.20.0 (2022-04-20) | ||
### Breaking changes | ||
Update dependencies to 0.20.0 | ||
## 0.19.3 (2021-09-24) | ||
@@ -2,0 +8,0 @@ |
import { LRLanguage, LanguageSupport } from '@codemirror/language'; | ||
import { Extension } from '@codemirror/state'; | ||
import { CompletionSource } from '@codemirror/autocomplete'; | ||
@@ -16,3 +15,2 @@ | ||
declare const cssLanguage: LRLanguage; | ||
declare const cssCompletion: Extension; | ||
/** | ||
@@ -23,2 +21,2 @@ Language support for CSS. | ||
export { css, cssCompletion, cssCompletionSource, cssLanguage }; | ||
export { css, cssCompletionSource, cssLanguage }; |
import { parser } from '@lezer/css'; | ||
import { syntaxTree, LRLanguage, indentNodeProp, continuedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language'; | ||
import { styleTags, tags as tags$1 } from '@codemirror/highlight'; | ||
@@ -120,3 +119,3 @@ let _properties = null; | ||
].map(name => ({ type: "type", label: name })); | ||
const span = /^[\w-]*/; | ||
const identifier = /^[\w-]*/; | ||
/** | ||
@@ -128,12 +127,12 @@ CSS property and value keyword completion source. | ||
if (node.name == "PropertyName") | ||
return { from: node.from, options: properties(), span }; | ||
return { from: node.from, options: properties(), validFor: identifier }; | ||
if (node.name == "ValueName") | ||
return { from: node.from, options: values, span }; | ||
return { from: node.from, options: values, validFor: identifier }; | ||
if (node.name == "PseudoClassName") | ||
return { from: node.from, options: pseudoClasses, span }; | ||
return { from: node.from, options: pseudoClasses, validFor: identifier }; | ||
if (node.name == "TagName") { | ||
for (let { parent } = node; parent; parent = parent.parent) | ||
if (parent.name == "Block") | ||
return { from: node.from, options: properties(), span }; | ||
return { from: node.from, options: tags, span }; | ||
return { from: node.from, options: properties(), validFor: identifier }; | ||
return { from: node.from, options: tags, validFor: identifier }; | ||
} | ||
@@ -144,7 +143,7 @@ if (!context.explicit) | ||
if (before && before.name == ":" && above.name == "PseudoClassSelector") | ||
return { from: pos, options: pseudoClasses, span }; | ||
return { from: pos, options: pseudoClasses, validFor: identifier }; | ||
if (before && before.name == ":" && above.name == "Declaration" || above.name == "ArgList") | ||
return { from: pos, options: values, span }; | ||
return { from: pos, options: values, validFor: identifier }; | ||
if (above.name == "Block") | ||
return { from: pos, options: properties(), span }; | ||
return { from: pos, options: properties(), validFor: identifier }; | ||
return null; | ||
@@ -166,38 +165,2 @@ }; | ||
Block: foldInside | ||
}), | ||
/*@__PURE__*/styleTags({ | ||
"import charset namespace keyframes": tags$1.definitionKeyword, | ||
"media supports": tags$1.controlKeyword, | ||
"from to selector": tags$1.keyword, | ||
NamespaceName: tags$1.namespace, | ||
KeyframeName: tags$1.labelName, | ||
TagName: tags$1.tagName, | ||
ClassName: tags$1.className, | ||
PseudoClassName: /*@__PURE__*/tags$1.constant(tags$1.className), | ||
IdName: tags$1.labelName, | ||
"FeatureName PropertyName": tags$1.propertyName, | ||
AttributeName: tags$1.attributeName, | ||
NumberLiteral: tags$1.number, | ||
KeywordQuery: tags$1.keyword, | ||
UnaryQueryOp: tags$1.operatorKeyword, | ||
"CallTag ValueName": tags$1.atom, | ||
VariableName: tags$1.variableName, | ||
Callee: tags$1.operatorKeyword, | ||
Unit: tags$1.unit, | ||
"UniversalSelector NestingSelector": tags$1.definitionOperator, | ||
AtKeyword: tags$1.keyword, | ||
MatchOp: tags$1.compareOperator, | ||
"ChildOp SiblingOp, LogicOp": tags$1.logicOperator, | ||
BinOp: tags$1.arithmeticOperator, | ||
Important: tags$1.modifier, | ||
Comment: tags$1.blockComment, | ||
ParenthesizedContent: /*@__PURE__*/tags$1.special(tags$1.name), | ||
ColorLiteral: tags$1.color, | ||
StringLiteral: tags$1.string, | ||
":": tags$1.punctuation, | ||
"PseudoOp #": tags$1.derefOperator, | ||
"; ,": tags$1.separator, | ||
"( )": tags$1.paren, | ||
"[ ]": tags$1.squareBracket, | ||
"{ }": tags$1.brace | ||
}) | ||
@@ -212,4 +175,2 @@ ] | ||
}); | ||
// FIXME remove on next major version | ||
const cssCompletion = /*@__PURE__*/cssLanguage.data.of({ autocomplete: cssCompletionSource }); | ||
/** | ||
@@ -219,5 +180,5 @@ Language support for CSS. | ||
function css() { | ||
return new LanguageSupport(cssLanguage, cssCompletion); | ||
return new LanguageSupport(cssLanguage, cssLanguage.data.of({ autocomplete: cssCompletionSource })); | ||
} | ||
export { css, cssCompletion, cssCompletionSource, cssLanguage }; | ||
export { css, cssCompletionSource, cssLanguage }; |
{ | ||
"name": "@codemirror/lang-css", | ||
"version": "0.19.3", | ||
"version": "0.20.0", | ||
"description": "CSS language support for the CodeMirror code editor", | ||
@@ -29,7 +29,6 @@ "scripts": { | ||
"dependencies": { | ||
"@codemirror/autocomplete": "^0.19.0", | ||
"@codemirror/highlight": "^0.19.6", | ||
"@codemirror/language": "^0.19.0", | ||
"@codemirror/state": "^0.19.0", | ||
"@lezer/css": "^0.15.2" | ||
"@codemirror/autocomplete": "^0.20.0", | ||
"@codemirror/language": "^0.20.0", | ||
"@codemirror/state": "^0.20.0", | ||
"@lezer/css": "^0.16.0" | ||
}, | ||
@@ -36,0 +35,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
29483
371
+ Added@codemirror/autocomplete@0.20.3(transitive)
+ Added@codemirror/state@0.20.1(transitive)
+ Added@codemirror/view@0.20.7(transitive)
+ Added@lezer/common@0.16.1(transitive)
+ Added@lezer/css@0.16.0(transitive)
+ Added@lezer/highlight@0.16.0(transitive)
+ Added@lezer/lr@0.16.3(transitive)
- Removed@codemirror/highlight@^0.19.6
- Removed@codemirror/autocomplete@0.19.15(transitive)
- Removed@codemirror/highlight@0.19.8(transitive)
- Removed@codemirror/rangeset@0.19.9(transitive)
- Removed@codemirror/state@0.19.9(transitive)
- Removed@codemirror/text@0.19.6(transitive)
- Removed@codemirror/tooltip@0.19.16(transitive)
- Removed@codemirror/view@0.19.48(transitive)
- Removed@lezer/common@0.15.12(transitive)
- Removed@lezer/css@0.15.2(transitive)
- Removed@lezer/lr@0.15.8(transitive)
Updated@codemirror/language@^0.20.0
Updated@codemirror/state@^0.20.0
Updated@lezer/css@^0.16.0