acetewm 0.0.2-dev.0

Aritz's Custom Element Template Engine
Documentation

use std::collections::HashMap;

use html5ever::QualName;
use lazy_regex::*;
use lazy_static::lazy_static;
/// See https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
pub static VALID_CUSTOM_ELEMENT_NAME: Lazy<Regex> = lazy_regex!(r"^[a-z][\-.0-9_a-z\u{B7}\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{203F}-\u{2040}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}]*-[-.0-9_a-z\u{B7}\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{203F}-\u{2040}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}]+$");
/// A slightly more pessimistic version of what's specified in the HTML spec.
pub static INVALID_CUSTOM_ELEMENT_NAME: Lazy<Regex> = lazy_regex!(r"^(?:annotation-xml|color-.*|font-face|font-face-.*|missing-glyph)$");
lazy_static! {
	pub static ref ATTRIBUTE_INLINE: QualName = QualName::new(None, "".into(), "inline".into());
	pub static ref ATTRIBUTE_NAME: QualName = QualName::new(None, "".into(), "name".into());
	pub static ref ATTRIBUTE_VALUE: QualName = QualName::new(None, "".into(), "value".into());
	pub static ref ATTRIBUTE_TYPE: QualName = QualName::new(None, "".into(), "type".into());
	pub static ref ATTRIBUTE_ACE_REF: QualName = QualName::new(None, "".into(), "ace-ref".into());
	pub static ref ATTRIBUTE_ACE_NAME: QualName = QualName::new(None, "".into(), "ace-name".into());
	pub static ref ATTRIBUTE_ACE_EXTENDS: QualName = QualName::new(None, "".into(), "ace-extends".into());
	pub static ref ATTRIBUTE_ACE_ATTRIBUTES: QualName = QualName::new(None, "".into(), "ace-attributes".into());
	pub static ref ATTRIBUTE_ID: QualName = QualName::new(None, "".into(), "id".into());
	pub static ref HTML_TAG_TO_TYPE: HashMap<&'static str, &'static str> = {
		// Generated from using /^(\s*)"(.*?)"\s*:\s*(.*?);\s*$/gm on HTMLElementTagNameMap in lib.dom.d.ts
		let mut m = HashMap::new();
		m.insert("a", "HTMLAnchorElement");
		m.insert("abbr", "HTMLElement");
		m.insert("address", "HTMLElement");
		m.insert("area", "HTMLAreaElement");
		m.insert("article", "HTMLElement");
		m.insert("aside", "HTMLElement");
		m.insert("audio", "HTMLAudioElement");
		m.insert("b", "HTMLElement");
		m.insert("base", "HTMLBaseElement");
		m.insert("bdi", "HTMLElement");
		m.insert("bdo", "HTMLElement");
		m.insert("blockquote", "HTMLQuoteElement");
		m.insert("body", "HTMLBodyElement");
		m.insert("br", "HTMLBRElement");
		m.insert("button", "HTMLButtonElement");
		m.insert("canvas", "HTMLCanvasElement");
		m.insert("caption", "HTMLTableCaptionElement");
		m.insert("cite", "HTMLElement");
		m.insert("code", "HTMLElement");
		m.insert("col", "HTMLTableColElement");
		m.insert("colgroup", "HTMLTableColElement");
		m.insert("data", "HTMLDataElement");
		m.insert("datalist", "HTMLDataListElement");
		m.insert("dd", "HTMLElement");
		m.insert("del", "HTMLModElement");
		m.insert("details", "HTMLDetailsElement");
		m.insert("dfn", "HTMLElement");
		m.insert("dialog", "HTMLDialogElement");
		m.insert("div", "HTMLDivElement");
		m.insert("dl", "HTMLDListElement");
		m.insert("dt", "HTMLElement");
		m.insert("em", "HTMLElement");
		m.insert("embed", "HTMLEmbedElement");
		m.insert("fieldset", "HTMLFieldSetElement");
		m.insert("figcaption", "HTMLElement");
		m.insert("figure", "HTMLElement");
		m.insert("footer", "HTMLElement");
		m.insert("form", "HTMLFormElement");
		m.insert("h1", "HTMLHeadingElement");
		m.insert("h2", "HTMLHeadingElement");
		m.insert("h3", "HTMLHeadingElement");
		m.insert("h4", "HTMLHeadingElement");
		m.insert("h5", "HTMLHeadingElement");
		m.insert("h6", "HTMLHeadingElement");
		m.insert("head", "HTMLHeadElement");
		m.insert("header", "HTMLElement");
		m.insert("hgroup", "HTMLElement");
		m.insert("hr", "HTMLHRElement");
		m.insert("html", "HTMLHtmlElement");
		m.insert("i", "HTMLElement");
		m.insert("iframe", "HTMLIFrameElement");
		m.insert("img", "HTMLImageElement");
		m.insert("input", "HTMLInputElement");
		m.insert("ins", "HTMLModElement");
		m.insert("kbd", "HTMLElement");
		m.insert("label", "HTMLLabelElement");
		m.insert("legend", "HTMLLegendElement");
		m.insert("li", "HTMLLIElement");
		m.insert("link", "HTMLLinkElement");
		m.insert("main", "HTMLElement");
		m.insert("map", "HTMLMapElement");
		m.insert("mark", "HTMLElement");
		m.insert("menu", "HTMLMenuElement");
		m.insert("meta", "HTMLMetaElement");
		m.insert("meter", "HTMLMeterElement");
		m.insert("nav", "HTMLElement");
		m.insert("noscript", "HTMLElement");
		m.insert("object", "HTMLObjectElement");
		m.insert("ol", "HTMLOListElement");
		m.insert("optgroup", "HTMLOptGroupElement");
		m.insert("option", "HTMLOptionElement");
		m.insert("output", "HTMLOutputElement");
		m.insert("p", "HTMLParagraphElement");
		m.insert("picture", "HTMLPictureElement");
		m.insert("pre", "HTMLPreElement");
		m.insert("progress", "HTMLProgressElement");
		m.insert("q", "HTMLQuoteElement");
		m.insert("rp", "HTMLElement");
		m.insert("rt", "HTMLElement");
		m.insert("ruby", "HTMLElement");
		m.insert("s", "HTMLElement");
		m.insert("samp", "HTMLElement");
		m.insert("script", "HTMLScriptElement");
		m.insert("search", "HTMLElement");
		m.insert("section", "HTMLElement");
		m.insert("select", "HTMLSelectElement");
		m.insert("slot", "HTMLSlotElement");
		m.insert("small", "HTMLElement");
		m.insert("source", "HTMLSourceElement");
		m.insert("span", "HTMLSpanElement");
		m.insert("strong", "HTMLElement");
		m.insert("style", "HTMLStyleElement");
		m.insert("sub", "HTMLElement");
		m.insert("summary", "HTMLElement");
		m.insert("sup", "HTMLElement");
		m.insert("table", "HTMLTableElement");
		m.insert("tbody", "HTMLTableSectionElement");
		m.insert("td", "HTMLTableCellElement");
		m.insert("template", "HTMLTemplateElement");
		m.insert("textarea", "HTMLTextAreaElement");
		m.insert("tfoot", "HTMLTableSectionElement");
		m.insert("th", "HTMLTableCellElement");
		m.insert("thead", "HTMLTableSectionElement");
		m.insert("time", "HTMLTimeElement");
		m.insert("title", "HTMLTitleElement");
		m.insert("tr", "HTMLTableRowElement");
		m.insert("track", "HTMLTrackElement");
		m.insert("u", "HTMLElement");
		m.insert("ul", "HTMLUListElement");
		m.insert("var", "HTMLElement");
		m.insert("video", "HTMLVideoElement");
		m.insert("wbr", "HTMLElement");
		m
	};
}