@codemirror/lang-html
Advanced tools
Comparing version 0.19.4 to 0.20.0
@@ -0,1 +1,7 @@ | ||
## 0.20.0 (2022-04-20) | ||
### New features | ||
Autocompletion now suggests the `<template>` and `<slot>` elements. | ||
## 0.19.4 (2021-11-30) | ||
@@ -2,0 +8,0 @@ |
@@ -18,3 +18,2 @@ import * as _codemirror_state from '@codemirror/state'; | ||
declare const htmlLanguage: LRLanguage; | ||
declare const htmlCompletion: _codemirror_state.Extension; | ||
/** | ||
@@ -45,2 +44,2 @@ Language support for HTML, including | ||
export { autoCloseTags, html, htmlCompletion, htmlCompletionSource, htmlLanguage }; | ||
export { autoCloseTags, html, htmlCompletionSource, htmlLanguage }; |
@@ -7,3 +7,2 @@ import { parser, configureNesting } from '@lezer/html'; | ||
import { syntaxTree, LRLanguage, indentNodeProp, foldNodeProp, LanguageSupport } from '@codemirror/language'; | ||
import { styleTags, tags } from '@codemirror/highlight'; | ||
@@ -238,2 +237,3 @@ const Targets = ["_blank", "_self", "_top", "_parent"]; | ||
}, | ||
slot: { attrs: { name: null } }, | ||
small: S, | ||
@@ -257,2 +257,3 @@ source: { attrs: { src: null, type: null, media: null } }, | ||
td: { attrs: { colspan: null, rowspan: null, headers: null } }, | ||
template: S, | ||
textarea: { | ||
@@ -395,3 +396,3 @@ attrs: { | ||
} | ||
const identifier = /^[:\-\.\w\u00b7-\uffff]+$/; | ||
const identifier = /^[:\-\.\w\u00b7-\uffff]*$/; | ||
function completeTag(state, tree, from, to) { | ||
@@ -401,3 +402,3 @@ let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">"; | ||
options: allowedChildren(state.doc, tree).map(tagName => ({ label: tagName, type: "type" })).concat(openTags(state.doc, tree).map((tag, i) => ({ label: "/" + tag, apply: "/" + tag + end, type: "type", boost: 99 - i }))), | ||
span: /^\/?[:\-\.\w\u00b7-\uffff]*$/ }; | ||
validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/ }; | ||
} | ||
@@ -408,3 +409,3 @@ function completeCloseTag(state, tree, from, to) { | ||
options: openTags(state.doc, tree).map((tag, i) => ({ label: tag, apply: tag + end, type: "type", boost: 99 - i })), | ||
span: identifier }; | ||
validFor: identifier }; | ||
} | ||
@@ -417,3 +418,3 @@ function completeStartTag(state, tree, pos) { | ||
options.push({ label: "</" + open + ">", type: "type", boost: 99 - level++ }); | ||
return { from: pos, to: pos, options, span: /^<\/?[:\-\.\w\u00b7-\uffff]*$/ }; | ||
return { from: pos, to: pos, options, validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/ }; | ||
} | ||
@@ -425,3 +426,3 @@ function completeAttrName(state, tree, from, to) { | ||
options: names.map(attrName => ({ label: attrName, type: "property" })), | ||
span: identifier }; | ||
validFor: identifier }; | ||
} | ||
@@ -431,3 +432,3 @@ function completeAttrValue(state, tree, from, to) { | ||
let nameNode = (_a = tree.parent) === null || _a === void 0 ? void 0 : _a.getChild("AttributeName"); | ||
let options = [], span = undefined; | ||
let options = [], token = undefined; | ||
if (nameNode) { | ||
@@ -443,3 +444,3 @@ let attrName = state.sliceDoc(nameNode.from, nameNode.to); | ||
if (/^['"]/.test(base)) { | ||
span = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/; | ||
token = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/; | ||
quoteStart = ""; | ||
@@ -451,3 +452,3 @@ quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? "" : base[0]; | ||
else { | ||
span = /^[^\s<>='"]*$/; | ||
token = /^[^\s<>='"]*$/; | ||
} | ||
@@ -458,3 +459,3 @@ for (let value of attrs) | ||
} | ||
return { from, to, options, span }; | ||
return { from, to, options, validFor: token }; | ||
} | ||
@@ -539,15 +540,2 @@ /** | ||
} | ||
}), | ||
/*@__PURE__*/styleTags({ | ||
"Text RawText": tags.content, | ||
"StartTag StartCloseTag SelfCloserEndTag EndTag SelfCloseEndTag": tags.angleBracket, | ||
TagName: tags.tagName, | ||
"MismatchedCloseTag/TagName": [tags.tagName, tags.invalid], | ||
AttributeName: tags.attributeName, | ||
"AttributeValue UnquotedAttributeValue": tags.attributeValue, | ||
Is: tags.definitionOperator, | ||
"EntityReference CharacterReference": tags.character, | ||
Comment: tags.blockComment, | ||
ProcessingInst: tags.processingInstruction, | ||
DoctypeDecl: tags.documentMeta | ||
}) | ||
@@ -574,4 +562,2 @@ ], | ||
}); | ||
// FIXME remove on next major version | ||
const htmlCompletion = /*@__PURE__*/htmlLanguage.data.of({ autocomplete: htmlCompletionSource }); | ||
/** | ||
@@ -587,3 +573,3 @@ Language support for HTML, including | ||
return new LanguageSupport(lang, [ | ||
htmlCompletion, | ||
htmlLanguage.data.of({ autocomplete: htmlCompletionSource }), | ||
config.autoCloseTags !== false ? autoCloseTags : [], | ||
@@ -627,2 +613,2 @@ javascript().support, | ||
export { autoCloseTags, html, htmlCompletion, htmlCompletionSource, htmlLanguage }; | ||
export { autoCloseTags, html, htmlCompletionSource, htmlLanguage }; |
{ | ||
"name": "@codemirror/lang-html", | ||
"version": "0.19.4", | ||
"version": "0.20.0", | ||
"description": "HTML language support for the CodeMirror code editor", | ||
@@ -29,10 +29,9 @@ "scripts": { | ||
"dependencies": { | ||
"@codemirror/autocomplete": "^0.19.0", | ||
"@codemirror/highlight": "^0.19.6", | ||
"@codemirror/lang-css": "^0.19.0", | ||
"@codemirror/lang-javascript": "^0.19.0", | ||
"@codemirror/language": "^0.19.0", | ||
"@codemirror/state": "^0.19.0", | ||
"@lezer/html": "^0.15.0", | ||
"@lezer/common": "^0.15.0" | ||
"@codemirror/autocomplete": "^0.20.0", | ||
"@codemirror/lang-css": "^0.20.0", | ||
"@codemirror/lang-javascript": "^0.20.0", | ||
"@codemirror/language": "^0.20.0", | ||
"@codemirror/state": "^0.20.0", | ||
"@lezer/html": "^0.16.0", | ||
"@lezer/common": "^0.16.0" | ||
}, | ||
@@ -39,0 +38,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
7
54530
1235
+ Added@codemirror/autocomplete@0.20.3(transitive)
+ Added@codemirror/lang-css@0.20.0(transitive)
+ Added@codemirror/lang-javascript@0.20.1(transitive)
+ Added@codemirror/language@0.20.2(transitive)
+ Added@codemirror/lint@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/html@0.16.1(transitive)
+ Added@lezer/javascript@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/gutter@0.19.9(transitive)
- Removed@codemirror/highlight@0.19.8(transitive)
- Removed@codemirror/lang-css@0.19.3(transitive)
- Removed@codemirror/lang-javascript@0.19.7(transitive)
- Removed@codemirror/language@0.19.10(transitive)
- Removed@codemirror/lint@0.19.6(transitive)
- Removed@codemirror/panel@0.19.1(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/html@0.15.1(transitive)
- Removed@lezer/javascript@0.15.3(transitive)
- Removed@lezer/lr@0.15.8(transitive)
Updated@codemirror/lang-css@^0.20.0
Updated@codemirror/language@^0.20.0
Updated@codemirror/state@^0.20.0
Updated@lezer/common@^0.16.0
Updated@lezer/html@^0.16.0