@codemirror/lang-html
Advanced tools
+6
-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 @@ |
+12
-27
@@ -11,3 +11,2 @@ 'use strict'; | ||
| var language = require('@codemirror/language'); | ||
| var highlight = require('@codemirror/highlight'); | ||
@@ -242,2 +241,3 @@ const Targets = ["_blank", "_self", "_top", "_parent"]; | ||
| }, | ||
| slot: { attrs: { name: null } }, | ||
| small: S, | ||
@@ -261,2 +261,3 @@ source: { attrs: { src: null, type: null, media: null } }, | ||
| td: { attrs: { colspan: null, rowspan: null, headers: null } }, | ||
| template: S, | ||
| textarea: { | ||
@@ -399,3 +400,3 @@ attrs: { | ||
| } | ||
| const identifier = /^[:\-\.\w\u00b7-\uffff]+$/; | ||
| const identifier = /^[:\-\.\w\u00b7-\uffff]*$/; | ||
| function completeTag(state, tree, from, to) { | ||
@@ -405,3 +406,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]*$/ }; | ||
| } | ||
@@ -412,3 +413,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 }; | ||
| } | ||
@@ -421,3 +422,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]*$/ }; | ||
| } | ||
@@ -429,3 +430,3 @@ function completeAttrName(state, tree, from, to) { | ||
| options: names.map(attrName => ({ label: attrName, type: "property" })), | ||
| span: identifier }; | ||
| validFor: identifier }; | ||
| } | ||
@@ -435,3 +436,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) { | ||
@@ -447,3 +448,3 @@ let attrName = state.sliceDoc(nameNode.from, nameNode.to); | ||
| if (/^['"]/.test(base)) { | ||
| span = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/; | ||
| token = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/; | ||
| quoteStart = ""; | ||
@@ -455,3 +456,3 @@ quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? "" : base[0]; | ||
| else { | ||
| span = /^[^\s<>='"]*$/; | ||
| token = /^[^\s<>='"]*$/; | ||
| } | ||
@@ -462,3 +463,3 @@ for (let value of attrs) | ||
| } | ||
| return { from, to, options, span }; | ||
| return { from, to, options, validFor: token }; | ||
| } | ||
@@ -543,15 +544,2 @@ /** | ||
| } | ||
| }), | ||
| highlight.styleTags({ | ||
| "Text RawText": highlight.tags.content, | ||
| "StartTag StartCloseTag SelfCloserEndTag EndTag SelfCloseEndTag": highlight.tags.angleBracket, | ||
| TagName: highlight.tags.tagName, | ||
| "MismatchedCloseTag/TagName": [highlight.tags.tagName, highlight.tags.invalid], | ||
| AttributeName: highlight.tags.attributeName, | ||
| "AttributeValue UnquotedAttributeValue": highlight.tags.attributeValue, | ||
| Is: highlight.tags.definitionOperator, | ||
| "EntityReference CharacterReference": highlight.tags.character, | ||
| Comment: highlight.tags.blockComment, | ||
| ProcessingInst: highlight.tags.processingInstruction, | ||
| DoctypeDecl: highlight.tags.documentMeta | ||
| }) | ||
@@ -578,4 +566,2 @@ ], | ||
| }); | ||
| // FIXME remove on next major version | ||
| const htmlCompletion = htmlLanguage.data.of({ autocomplete: htmlCompletionSource }); | ||
| /** | ||
@@ -591,3 +577,3 @@ Language support for HTML, including | ||
| return new language.LanguageSupport(lang, [ | ||
| htmlCompletion, | ||
| htmlLanguage.data.of({ autocomplete: htmlCompletionSource }), | ||
| config.autoCloseTags !== false ? autoCloseTags : [], | ||
@@ -633,4 +619,3 @@ langJavascript.javascript().support, | ||
| exports.html = html; | ||
| exports.htmlCompletion = htmlCompletion; | ||
| exports.htmlCompletionSource = htmlCompletionSource; | ||
| exports.htmlLanguage = htmlLanguage; |
+1
-2
@@ -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 }; |
+13
-27
@@ -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 }; |
+8
-9
| { | ||
| "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": { |
7
-12.5%54530
-3.03%1235
-2.37%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated