vite-plugin-vanjs
Version:
An async first mini meta-framework for VanJS powered by Vite
139 lines (137 loc) • 3.15 kB
JavaScript
// in the browser we have the Document API, is it possible to
export const namespaceElementsMap = {
"http://www.w3.org/1999/xhtml": [
// tags common with SVG
"a",
"style",
"title",
// "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo",
// "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup",
// "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed",
// "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6",
// "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd",
// "label", "legend", "li", "link", "main", "map", "mark", "menu", "meta", "meter", "nav",
// "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre",
// "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot",
// "small", "source", "span", "strong",
// "sub", "summary", "sup", "table", "tbody",
// "td", "template", "textarea", "tfoot", "th", "thead", "time",
// "tr", "track", "u",
// "ul", "var", "video", "wbr"
],
"http://www.w3.org/2000/svg": [
"svg",
"a",
"animate",
"animateMotion",
"animateTransform",
"circle",
"clipPath",
"defs",
"desc",
"ellipse",
"feBlend",
"feColorMatrix",
"feComponentTransfer",
"feComposite",
"feConvolveMatrix",
"feDiffuseLighting",
"feDisplacementMap",
"feDistantLight",
"feDropShadow",
"feFlood",
"feFuncA",
"feFuncB",
"feFuncG",
"feFuncR",
"feGaussianBlur",
"feImage",
"feMerge",
"feMergeNode",
"feMorphology",
"feOffset",
"fePointLight",
"feSpecularLighting",
"feSpotLight",
"feTile",
"feTurbulence",
"filter",
"foreignObject",
"g",
"image",
"line",
"linearGradient",
"marker",
"mask",
"metadata",
"mpath",
"path",
"pattern",
"polygon",
"polyline",
"radialGradient",
"rect",
"set",
"stop",
"style",
"switch",
"symbol",
"text",
"textPath",
"title",
"tspan",
"use",
"view",
],
"http://www.w3.org/1998/Math/MathML": [
"math",
"maction",
"maligngroup",
"malignmark",
"menclose",
"merror",
"mfenced",
"mfrac",
"mglyph",
"mi",
"mlabeledtr",
"mmultiscripts",
"mn",
"mo",
"mover",
"mpadded",
"mphantom",
"mprescripts",
"mroot",
"mrow",
"ms",
"mspace",
"msqrt",
"mstyle",
"msub",
"msubsup",
"msup",
"mtable",
"mtd",
"mtext",
"mtr",
"munder",
"munderover",
"semantics",
"annotation",
"annotation-xml",
],
};
/**
* Create reverse lookup for namespace elements
* @type {Record<string, string>}
*/
export const namespaceElements = Object.entries(namespaceElementsMap).reduce(
(acc, [namespace, elements]) => {
elements.forEach((element) => {
if (!(element in acc)) acc[element] = namespace;
});
return acc;
},
{},
);