html-spec-tags
Version:
All HTML tags supported by the current spec. With types!
56 lines (55 loc) • 1.97 kB
TypeScript
import { type Values } from '@augment-vir/common';
import { type HtmlSpecTagName, htmlSpecConstructorsByTagName } from './html.js';
import { type MathmlSpecTagName, mathmlSpecConstructorsByTagName } from './mathml.js';
import { type SvgSpecTagName, svgSpecConstructorsByTagName } from './svg.js';
/**
* All possible spec tag names in a single array.
*
* @category Tag
*/
export declare const allSpecTagNames: ReadonlyArray<SpecTagName>;
/**
* Any valid spec tag name.
*
* @category Tag
*/
export type SpecTagName = HtmlSpecTagName | SvgSpecTagName | MathmlSpecTagName;
/**
* Any of the possible spec tag name constructors.
*
* @category Tag
*/
export type SpecTagNameConstructor = Values<typeof htmlSpecConstructorsByTagName> | Values<typeof mathmlSpecConstructorsByTagName> | Values<typeof svgSpecConstructorsByTagName>;
/**
* Get the constructor for the given tag name. Since there are some duplicate tag names, the
* priority is:
*
* 1. HTML tags
* 2. SVG tags
* 3. MathML tags
*
* Meaning, if a tag name is duplicated between HTML and SVG tags, the HTML constructor will be
* returned. If the lower priority tag constructor is desired these types of situations, use its
* constructor list directly. For example,use `svgSpecConstructorsByTagName` directly.
*
* @category Tag
*/
export declare function getSpecTagNameConstructor(tagName: SpecTagName): SpecTagNameConstructor;
/**
* Type guards the input as a valid spec tag name.
*
* @category Assertion
*/
export declare function isSpecTagName(input: unknown): input is SpecTagName;
/**
* Asserts that the input as a valid spec tag name.
*
* @category Assertion
*/
export declare function assertSpecTagName(input: unknown, failureMessage?: string | undefined): asserts input is SpecTagName;
/**
* Passes the input through if it's a valid spec tag name, throws an error if not.
*
* @category Assertion
*/
export declare function ensureSpecTagName(input: unknown): SpecTagName;