From 22cc604e38ffc957195349c710cae340dd1a7825 Mon Sep 17 00:00:00 2001 From: dpiercey Date: Mon, 16 Dec 2024 11:21:24 -0700 Subject: [PATCH] fix: add tags api runtime types --- .changeset/neat-moles-jog.md | 5 + packages/runtime-tags/index.d.ts | 144 + packages/runtime-tags/src/html/template.ts | 2 +- packages/runtime-tags/tags-html.d.ts | 3935 ++++++++++++++++++++ 4 files changed, 4085 insertions(+), 1 deletion(-) create mode 100644 .changeset/neat-moles-jog.md create mode 100644 packages/runtime-tags/index.d.ts create mode 100644 packages/runtime-tags/tags-html.d.ts diff --git a/.changeset/neat-moles-jog.md b/.changeset/neat-moles-jog.md new file mode 100644 index 0000000000..e9c0894f3d --- /dev/null +++ b/.changeset/neat-moles-jog.md @@ -0,0 +1,5 @@ +--- +"@marko/runtime-tags": patch +--- + +Add tags api runtime types. diff --git a/packages/runtime-tags/index.d.ts b/packages/runtime-tags/index.d.ts new file mode 100644 index 0000000000..b936ab3f93 --- /dev/null +++ b/packages/runtime-tags/index.d.ts @@ -0,0 +1,144 @@ +import "./tags-html"; + +declare module "*.marko" { + const template: Marko.Template; + export default template; +} + +declare global { + namespace NodeJS { + interface ReadableStream {} + } + + namespace Marko { + /** A mutable global object for the current render. */ + export interface Global { + [x: PropertyKey]: unknown; + /** An AbortSignal instance that, when aborted, stops further streamed content. */ + signal?: AbortSignal; + /** A CSP Nonce to add to each script output from Marko. */ + cspNonce?: string; + /** Used for rendering multiple Marko templates in a single hydrated page. */ + renderId?: string; + /** Used to uniquely identify a instance of a Marko runtime. */ + runtimeId?: string; + /** A list of globals that should be serialized to the browser. */ + serializedGlobals?: + | (string | number)[] + | Record; + } + + export type TemplateInput = Input & { + /** Data available within all rendered templates as `$global`. */ + $global?: Global; + }; + + /** Body content created from by a component, typically held in an object with a renderBody property. */ + export interface Body< + in Params extends readonly any[] = [], + out Return = void, + > {} + + /** Valid data types which can be passed in as a <${dynamic}/> tag name. */ + export type Renderable = + | { renderBody: Body | Template | string } + | Body + | Template + | string; + + /** Extract the return tag type from a renderBody. */ + export type BodyReturnType = + B extends Body ? Return : never; + + /** Extract the tag parameter types received by a renderBody. */ + export type BodyParameters = + B extends Body ? Params : never; + + /** The top level api for a Marko Template. */ + export abstract class Template { + /** + * The folowing types are processed up by the @marko/language-tools + * and inlined into the compiled template. + * + * This is done to support generics on each of these methods + * until TypeScript supports higher kinded types. + * + * https://github.com/microsoft/TypeScript/issues/1213 + */ + + /** @marko-overload-start */ + /** Render the template to a string. */ + abstract render(input: Marko.TemplateInput): Promise & + AsyncIterable & { + toReadable(): ReadableStream; + pipe(stream: { + write(chunk: string): unknown; + end(): unknown; + flush?(): void; + }): void; + toString(): string; + }; + + /** Render and attach the template to a DOM node. */ + abstract mount( + input: Marko.TemplateInput, + reference: ParentNode & Node, + position?: "afterbegin" | "afterend" | "beforebegin" | "beforeend", + ): { + update(input: Input): void; + destroy(): void; + }; + /** @marko-overload-end */ + } + + export type AttrTag = T & { + [Symbol.iterator](): Iterator; + }; + + export interface NativeTag< + Input extends Record, + Return extends Element, + > { + input: Input; + return: { value: () => Return }; + } + export interface NativeTags { + [name: string]: NativeTag, Element>; + } + + export type Input = 0 extends 1 & Name + ? any + : Name extends string + ? Name extends keyof NativeTags + ? NativeTags[Name]["input"] + : Record + : Name extends + | Template + | { _(): () => (input: infer Input) => any } + ? Input + : Name extends Body + ? Args extends { + length: infer Length; + } + ? number extends Length + ? Args[0] | undefined + : 0 extends Length + ? undefined + : Args[0] + : never + : never; + + export type Return = 0 extends 1 & Name + ? any + : Name extends string + ? Name extends keyof NativeTags + ? NativeTags[Name]["return"] + : () => Element + : Name extends + | { _(): () => (input: any) => { return: infer Return } } + | Template + | Body + ? Return + : never; + } +} diff --git a/packages/runtime-tags/src/html/template.ts b/packages/runtime-tags/src/html/template.ts index 8bc5d42188..8824dec1d9 100644 --- a/packages/runtime-tags/src/html/template.ts +++ b/packages/runtime-tags/src/html/template.ts @@ -141,7 +141,7 @@ class ServerRenderResult implements RenderResult { write: (chunk: string) => void; end: () => void; flush?: () => void; - emit?: (eventName: string, ...args: any[]) => any; + emit?: (eventName: PropertyKey, ...args: any[]) => any; }) { this.#read( (html) => { diff --git a/packages/runtime-tags/tags-html.d.ts b/packages/runtime-tags/tags-html.d.ts new file mode 100644 index 0000000000..bf4dc6bd9b --- /dev/null +++ b/packages/runtime-tags/tags-html.d.ts @@ -0,0 +1,3935 @@ +import * as csstype from "csstype"; + +/** + * Potential improvements: + * - Share properties between input interfaces + * - Add more interfaces of `Link` which restrict specific attributes based on type. + * - Isolate some event handlers to specific elements (eg media events). + * - Create more interface for individual aria roles. + */ + +declare global { + namespace Marko { + interface NativeTags { + a: NativeTag; + abbr: NativeTag; + address: NativeTag; + area: NativeTag; + article: NativeTag; + aside: NativeTag; + audio: NativeTag; + b: NativeTag; + base: NativeTag; + bdi: NativeTag; + bdo: NativeTag; + blockquote: NativeTag; + body: NativeTag; + br: NativeTag; + button: NativeTag; + canvas: NativeTag; + caption: NativeTag; + cite: NativeTag; + code: NativeTag; + col: NativeTag; + colgroup: NativeTag; + data: NativeTag; + datalist: NativeTag; + dd: NativeTag; + del: NativeTag; + details: NativeTag; + dfn: NativeTag; + dialog: NativeTag; + div: NativeTag; + dl: NativeTag; + dt: NativeTag; + em: NativeTag; + embed: NativeTag; + fieldset: NativeTag; + figcaption: NativeTag; + figure: NativeTag; + footer: NativeTag; + form: NativeTag; + h1: NativeTag; + h2: NativeTag; + h3: NativeTag; + h4: NativeTag; + h5: NativeTag; + h6: NativeTag; + head: NativeTag; + header: NativeTag; + hgroup: NativeTag; + hr: NativeTag; + html: NativeTag; + i: NativeTag; + iframe: NativeTag; + img: NativeTag; + input: NativeTag; + ins: NativeTag; + kbd: NativeTag; + label: NativeTag; + legend: NativeTag; + li: NativeTag; + link: NativeTag; + main: NativeTag; + map: NativeTag; + mark: NativeTag; + menu: NativeTag; + meta: NativeTag; + meter: NativeTag; + nav: NativeTag; + noscript: NativeTag; + object: NativeTag; + ol: NativeTag; + optgroup: NativeTag; + option: NativeTag; + output: NativeTag; + p: NativeTag; + picture: NativeTag; + pre: NativeTag; + progress: NativeTag; + q: NativeTag; + rp: NativeTag; + rt: NativeTag; + ruby: NativeTag; + s: NativeTag; + samp: NativeTag; + script: NativeTag; + section: NativeTag; + select: NativeTag; + slot: NativeTag; + small: NativeTag; + source: NativeTag; + span: NativeTag; + strong: NativeTag; + style: NativeTag; + sub: NativeTag; + summary: NativeTag; + sup: NativeTag; + table: NativeTag; + tbody: NativeTag; + td: NativeTag; + template: NativeTag; + textarea: NativeTag; + tfoot: NativeTag; + th: NativeTag; + thead: NativeTag; + time: NativeTag; + title: NativeTag; + tr: NativeTag; + track: NativeTag; + u: NativeTag; + ul: NativeTag; + var: NativeTag; + video: NativeTag; + wbr: NativeTag; + } + + namespace CSS { + export interface Properties + extends csstype.PropertiesHyphen, + csstype.Properties {} + } + + namespace HTML { + interface A extends HTMLAttributes { + /** + * Specifies whether to download the resource, or the name of the file to download. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-download + */ + download?: AttrBooleanOrString; + + /** + * Specifies the URL of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href + */ + href?: AttrString; + + /** + * Specifies the language of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-hreflang + */ + hreflang?: AttrString; + + /** + * Specifies the intended media type for the linked resource. + * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-link-media + */ + media?: AttrString; + + /** + * Specifies a space-separated list of URLs to send a ping request to when the link is followed. + * @see https://html.spec.whatwg.org/multipage/links.html#ping + */ + ping?: AttrString; + + /** + * Specifies the referrer policy for the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-referrerpolicy + */ + referrerpolicy?: AttrReferrerPolicy; + + /** + * Specifies the relationship between the current document and the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#linkTypes + */ + rel?: + | AttrMissing + | "alternate" + | "author" + | "bookmark" + | "external" + | "help" + | "license" + | "next" + | "nofollow" + | "noopener" + | "noreferrer" + | "opener" + | "prev" + | "search" + | "tag" + | (string & {}); + + /** + * Specifies the browsing context for the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-target + */ + target?: AttrTarget; + + /** + * Specifies the MIME type of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-type + */ + type?: AttrString; + + /** @deprecated */ + charset?: AttrString; + + /** @deprecated */ + coords?: AttrString; + + /** @deprecated */ + name?: AttrString; + + /** @deprecated */ + rev?: AttrString; + + /** @deprecated */ + shape?: AttrString; + } + + interface Abbr extends HTMLAttributes {} + interface Address extends HTMLAttributes {} + interface Area extends HTMLAttributes { + /** + * Specifies an alternative text for the area. + * @see https://html.spec.whatwg.org/multipage/image-maps.html#attr-area-alt + */ + alt?: AttrString; + + /** + * Specifies the coordinates of the area's shape. + * @see https://html.spec.whatwg.org/multipage/image-maps.html#attr-area-coords + */ + coords?: AttrString; + + /** + * Specifies whether to download the resource, or the name of the file to download. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-download + */ + download?: A["download"]; + + /** + * Specifies the URL of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href + */ + href?: A["href"]; + + /** + * Specifies the language of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-hreflang + */ + hreflang?: A["hreflang"]; + + /** + * Specifies a space-separated list of URLs to send a ping request to when the link is followed. + * @see https://html.spec.whatwg.org/multipage/links.html#ping + */ + ping?: A["ping"]; + + /** + * Specifies the referrer policy for the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-referrerpolicy + */ + referrerpolicy?: A["referrerpolicy"]; + + /** + * Specifies the relationship between the current document and the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#linkTypes + */ + rel?: A["rel"]; + + /** + * Specifies the shape of the clickable region on the area. + * @see https://html.spec.whatwg.org/multipage/image-maps.html#attr-area-shape + */ + shape?: AttrMissing | "rect" | "circle" | "poly" | "default"; + + /** + * Specifies the browsing context for the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-target + */ + target?: A["target"]; + + /** @deprecated */ + name?: AttrString; + + /** @deprecated */ + nohref?: AttrString; + + /** @deprecated */ + type?: AttrString; + } + interface Article extends HTMLAttributes {} + interface Aside extends HTMLAttributes {} + interface Audio extends HTMLAttributes { + /** + * Specifies whether the audio should start playing automatically. + * @see https://html.spec.whatwg.org/multipage/media.html#attr-media-autoplay + */ + autoplay?: AttrBoolean; + + /** + * Specifies whether the audio controls should be displayed. + * @see https://html.spec.whatwg.org/multipage/media.html#attr-media-controls + */ + controls?: AttrBoolean; + + /** + * Specifies the controls to be shown or hidden on the audio player. + * @see https://wicg.github.io/controls-list/explainer.html + */ + controlslist?: + | AttrMissing + | "nodownload" + | "nofullscreen" + | "noplaybackrate" + | "noremoteplayback" + | (string & {}); + + /** + * Specifies the CORS settings for the audio resource. + * @see https://html.spec.whatwg.org/multipage/media.html#attr-media-crossorigin + */ + crossorigin?: AttrCrossOrigin; + + /** + * Specifies whether to disable remote playback of the audio. + * @see https://www.w3.org/TR/remote-playback/#the-disableremoteplayback-attribute + */ + disableremoteplayback?: AttrBoolean; + + /** + * Specifies whether the audio should start over again when finished. + * @see https://html.spec.whatwg.org/multipage/media.html#attr-media-loop + */ + loop?: AttrBoolean; + + /** + * Specifies whether the audio should be muted by default. + * @see https://html.spec.whatwg.org/multipage/media.html#attr-media-muted + */ + muted?: AttrBoolean; + + /** + * Specifies the type of preloading for the audio. + * @see https://html.spec.whatwg.org/multipage/media.html#attr-media-preload + */ + preload?: AttrBoolean | "none" | "metadata" | "auto"; + + /** + * Specifies the URL of the audio resource. + * @see https://html.spec.whatwg.org/multipage/media.html#attr-media-src + */ + src?: AttrString; + } + + interface B extends HTMLAttributes {} + interface Base extends HTMLAttributes { + /** + * Specifies the base URL for resolving relative URLs within the document. + * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-base-href + */ + href?: AttrString; + + /** + * Specifies the default browsing context for links and forms in the document. + * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-base-target + */ + target?: AttrTarget; + } + interface BDI extends HTMLAttributes {} + interface BDO extends HTMLAttributes {} + interface BlockQuote extends HTMLAttributes { + /** + * Specifies the URL of the source document or quoted content. + * @see https://html.spec.whatwg.org/multipage/grouping-content.html#attr-blockquote-cite + */ + cite?: AttrString; + } + interface Body extends HTMLAttributes { + /** + * Fires after printing the document. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-afterprint + */ + onAfterprint?: AttrEventHandler; + "on-afterprint"?: this["onAfterprint"]; + + /** + * Fires before printing the document. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-beforeprint + */ + onBeforeprint?: AttrEventHandler; + "on-beforeprint"?: this["onBeforeprint"]; + + /** + * Fired when the page is about to be unloaded, in case the page would like to show a warning prompt. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-beforeunload + */ + onBeforeunload?: AttrEventHandler; + "on-beforeunload"?: this["onBeforeunload"]; + + /** + * Fired when the fragment part of the document's URL changes. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-hashchange + */ + onHashchange?: AttrEventHandler; + "on-hashchange"?: this["onHashchange"]; + + /** + * Fired when the user's preferred languages change. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-languagechange + */ + onLanguagechange?: AttrEventHandler; + "on-languagechange"?: this["onLanguagechange"]; + + /** + * Fired when the window receives a message. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-message + */ + onMessage?: AttrEventHandler; + "on-message"?: this["onMessage"]; + + /** + * Fired when the window receives an error message. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-messageerror + */ + onMessageerror?: AttrEventHandler; + "on-messageerror"?: this["onMessageerror"]; + + /** + * Fired when the network connection is lost. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-offline + */ + onOffline?: AttrEventHandler; + "on-offline"?: this["onOffline"]; + + /** + * Fired when the network connection is recovered. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-online + */ + onOnline?: AttrEventHandler; + "on-online"?: this["onOnline"]; + + /** + * Fired when the page's session history entry stops being the active entry. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-pagehide + */ + onPagehide?: AttrEventHandler; + "on-pagehide"?: this["onPagehide"]; + + /** + * Fired when the page's session history entry becomes the active entry. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-pageshow + */ + onPageshow?: AttrEventHandler; + "on-pageshow"?: this["onPageshow"]; + + /** + * Fired when the window's session history is popped. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-popstate + */ + onPopstate?: AttrEventHandler; + "on-popstate"?: this["onPopstate"]; + + /** + * Fires when a previously-unhandled promise rejection becomes handled. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-rejectionhandled + */ + onRejectionhandled?: AttrEventHandler; + "on-rejectionhandled"?: this["onRejectionhandled"]; + + /** + * Fired when the corresponding localStorage or sessionStorage storage areas change. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-storage + */ + onStorage?: AttrEventHandler; + "on-storage"?: this["onStorage"]; + + /** + * Fired when a promise rejection goes unhandled. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-unhandledrejection + */ + onUnhandledRejection?: AttrEventHandler< + PromiseRejectionEvent, + HTMLBodyElement + >; + "on-unhandledrejection"?: this["onUnhandledRejection"]; + + /** + * Fired when the page is going away. + * @see https://html.spec.whatwg.org/multipage/indices.html#event-unload + */ + onUnload?: AttrEventHandler; + "on-unload"?: this["onUnload"]; + + /** @deprecated */ + alink?: AttrString; + + /** @deprecated */ + background?: AttrString; + + /** @deprecated */ + bgcolor?: AttrString; + + /** @deprecated */ + link?: AttrString; + + /** @deprecated */ + text?: AttrString; + + /** @deprecated */ + vlink?: AttrString; + + /** @deprecated */ + bottommargin?: AttrStringOrNumber; + + /** @deprecated */ + leftmargin?: AttrStringOrNumber; + + /** @deprecated */ + rightmargin?: AttrStringOrNumber; + + /** @deprecated */ + topmargin?: AttrStringOrNumber; + } + + interface Br extends HTMLAttributes { + /** @deprecated */ + clear?: AttrString; + } + interface Button extends HTMLAttributes { + /** + * Specifies whether the button should be disabled. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-disabled + */ + disabled?: AttrBoolean; + + /** + * Specifies the form element associated with the button. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fae-form + */ + form?: AttrString; + + /** + * Specifies the URL of the form's action when the button is clicked. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fs-formaction + */ + formaction?: Form["action"]; + + /** + * Specifies the enctype attribute for the form when the button is clicked. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fs-formenctype + */ + formenctype?: Form["enctype"]; + + /** + * Specifies the method attribute for the form when the button is clicked. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fs-formmethod + */ + formmethod?: Form["method"]; + + /** + * Specifies whether the form should not validate when the button is clicked. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fs-formnovalidate + */ + formnovalidate?: Form["novalidate"]; + + /** + * Specifies the target attribute for the form when the button is clicked. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fs-formtarget + */ + formtarget?: Form["target"]; + + /** + * Specifies the name of the button. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name + */ + name?: AttrString; + + /** + * Specifies the type of the button. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-type + */ + type?: AttrMissing | "submit" | "reset" | "button"; + + /** + * Specifies the value of the button. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-value + */ + value?: AttrString; + + /** + * Specifies the target element for the popover. + * @see https://developer.chrome.com/docs/web-platform/popover-api/popovertargetaction-toggle-attribute + */ + popovertarget?: AttrString; + + /** + * Specifies the action to perform on the popover target. + * @see https://developer.chrome.com/docs/web-platform/popover-api/popovertargetaction-toggle-attribute + */ + popovertargetaction?: AttrMissing | "toggle" | "show" | "hide"; + } + interface Canvas extends HTMLAttributes { + /** + * Specifies the height of the canvas element. + * @see https://html.spec.whatwg.org/multipage/canvas.html#attr-canvas-height + */ + height?: AttrStringOrNumber; + + /** + * Specifies the width of the canvas element. + * @see https://html.spec.whatwg.org/multipage/canvas.html#attr-canvas-width + */ + width?: AttrStringOrNumber; + } + interface Caption extends HTMLAttributes { + /** @deprecated */ + align?: AttrString; + } + interface Cite extends HTMLAttributes {} + interface Code extends HTMLAttributes {} + interface Col extends HTMLAttributes { + /** + * Specifies how many columns in the table the `` element spans. + * @see https://html.spec.whatwg.org/multipage/tables.html#attr-col-span + */ + span?: AttrStringOrNumber; + + /** @deprecated */ + align?: AttrString; + + /** @deprecated */ + char?: AttrString; + + /** @deprecated */ + charoff?: AttrStringOrNumber; + + /** @deprecated */ + valign?: AttrString; + + /** @deprecated */ + width?: AttrStringOrNumber; + } + interface ColGroup extends HTMLAttributes { + /** + * Specifies how many columns in the table the `` element spans. + * @see https://html.spec.whatwg.org/multipage/tables.html#attr-colgroup-span + */ + span?: AttrStringOrNumber; + + /** @deprecated */ + align?: AttrString; + + /** @deprecated */ + bgcolor?: AttrString; + + /** @deprecated */ + char?: AttrString; + + /** @deprecated */ + charoff?: AttrStringOrNumber; + + /** @deprecated */ + valign?: AttrString; + } + interface Data extends HTMLAttributes { + /** + * Specifies the machine-readable value of the `` element. + * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html#attr-data-value + */ + value?: AttrStringOrNumber; + } + + interface DataList extends HTMLAttributes {} + interface DD extends HTMLAttributes { + /** @deprecated */ + nowrap?: AttrYesNoString; + } + interface Del extends HTMLAttributes { + /** + * Specifies the URL of the source of the quote or change. + * @see https://html.spec.whatwg.org/multipage/edits.html#attr-mod-cite + */ + cite?: AttrString; + + /** + * Specifies the date and time of the quote or change. + * @see https://html.spec.whatwg.org/multipage/edits.html#attr-mod-datetime + */ + datetime?: AttrString; + } + interface Details extends HTMLAttributes { + /** + * Specifies whether the `
` element is open. + * @see https://html.spec.whatwg.org/multipage/interactive-elements.html#attr-details-open + */ + open?: AttrBoolean; + + // NON STANDARD + /** + * Called whenever a the `open` attribute has changed. + * When `openChange` is a function, `open` becomes controlled. + */ + openChange?: AttrMissing | ((open: boolean) => void); + } + interface Dfn extends HTMLAttributes {} + interface Dialog extends HTMLAttributes { + /** + * Specifies whether the `` element is open. + * @see https://html.spec.whatwg.org/multipage/interactive-elements.html#attr-dialog-open + */ + open?: AttrBoolean; + + // NON STANDARD + /** + * Called whenever a the `open` attribute has changed. + * When `openChange` is a function, `open` becomes controlled. + */ + openChange?: AttrMissing | ((open: boolean) => void); + } + interface Div extends HTMLAttributes {} + interface DL extends HTMLAttributes {} + interface DT extends HTMLAttributes {} + interface Em extends HTMLAttributes {} + interface Embed extends HTMLAttributes { + /** + * Specifies the height of the embedded content. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-height + */ + height?: AttrStringOrNumber; + + /** + * Specifies the URL of the resource to embed. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-embed-src + */ + src?: AttrString; + + /** + * Specifies the MIME type of the embedded content. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-embed-type + */ + type?: AttrString; + + /** + * Specifies the width of the embedded content. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-width + */ + width?: AttrStringOrNumber; + } + interface FieldSet extends HTMLAttributes { + /** + * Specifies whether the `
` element is disabled. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fieldset-disabled + */ + disabled?: AttrBoolean; + /** + * Specifies associated form for the `
`. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form + */ + form?: AttrString; + /** + * Specifies the name of the `
` on the form.elements api. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name + * @see HTMLFormElement.elements + */ + name?: AttrString; + } + interface FigCaption extends HTMLAttributes {} + interface Figure extends HTMLAttributes {} + interface Form extends HTMLAttributes { + /** + * Specifies the character encodings that are to be used for the form submission. + * @see https://html.spec.whatwg.org/multipage/forms.html#attr-form-accept-charset + */ + "accept-charset"?: AttrString; + /** + * Specifies the URL which the form data will be submitted to. + * @see https://html.spec.whatwg.org/multipage/forms.html#attr-fs-action + */ + action?: AttrString; + /** + * Controls whether the browser should automatically complete form input values. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete + */ + autocomplete?: AttrOnOff; + /** + * Specifies the content type used to submit the form to the server. + * @see https://html.spec.whatwg.org/multipage/forms.html#attr-form-enctype + */ + enctype?: + | AttrMissing + | "application/x-www-form-urlencoded" + | "multipart/form-data" + | "text/plain"; + /** + * Specifies the HTTP method used to submit the form to the server. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-method + */ + method?: + | AttrMissing + | "POST" + | "post" + | "GET" + | "get" + | "dialog" + | "DIALOG"; + /** + * The name attribute represents the form's name within the forms collection. + * @see https://html.spec.whatwg.org/multipage/forms.html#attr-form-name + * @see Document.forms + */ + name?: AttrString; + /** + * Indicates that the form should not be validated when submitted. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-novalidate + */ + novalidate?: AttrBoolean; + /** + * Specifies the relationship between the current document and the linked document. + * @see https://html.spec.whatwg.org/multipage/links.html#linkTypes + */ + rel?: + | AttrMissing + | "external" + | "help" + | "license" + | "next" + | "nofollow" + | "noopener" + | "noreferrer" + | "opener" + | "prev" + | "search" + | (string & {}); + /** + * Specifies the browsing context in which the linked resource will be opened. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-target + */ + target?: AttrTarget; + /** @deprecated */ + accept?: AttrString; + + /** + * Fired at a form element when it is constructing the entry list + * @see https://html.spec.whatwg.org/multipage/indices.html#event-formdata + */ + onFormdata?: AttrEventHandler; + "on-formdata"?: this["onFormdata"]; + + /** + * Fired when a form is submitted, either by user interaction or through a script. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#event-submit + */ + onSubmit?: AttrEventHandler; + "on-submit"?: this["onSubmit"]; + } + interface H1 extends HTMLAttributes {} + interface H2 extends HTMLAttributes {} + interface H3 extends HTMLAttributes {} + interface H4 extends HTMLAttributes {} + interface H5 extends HTMLAttributes {} + interface H6 extends HTMLAttributes {} + interface Footer extends HTMLAttributes {} + interface Head extends HTMLAttributes { + /** @deprecated */ + profile?: AttrString; + /** @see https://ogp.me/ */ + prefix?: AttrString; + } + interface Header extends HTMLAttributes {} + interface HGroup extends HTMLAttributes {} + interface HR extends HTMLAttributes { + /** @deprecated */ + align?: AttrMissing | "left" | "center" | "right"; + /** @deprecated */ + color?: AttrString; + /** @deprecated */ + noshade?: AttrBoolean; + /** @deprecated */ + size?: AttrStringOrNumber; + /** @deprecated */ + width?: AttrStringOrNumber; + } + interface HTML extends HTMLAttributes { + /** @deprecated */ + xmlns?: AttrString; + /** @deprecated */ + manifest?: AttrString; + /** @deprecated */ + version?: AttrString; + /** @see https://ogp.me/ */ + prefix?: AttrString; + } + interface I extends HTMLAttributes {} + interface IFrame extends HTMLAttributes { + /** + * A space-separated list of permissions that are granted to the content inside the frame. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-allow + */ + allow?: AttrString; + /** + * Indicates whether the iframe can be displayed in fullscreen mode. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-allowfullscreen + */ + allowfullscreen?: AttrBoolean; + /** + * The height of the iframe. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-height + */ + height?: AttrStringOrNumber; + /** + * Indicates whether the browser should eagerly load the frame's contents or not. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-loading + */ + loading?: AttrMissing | "eager" | "lazy"; + /** + * A name or keyword that can be used to refer to the iframe from elsewhere in the document. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-name + */ + name?: AttrString; + /** + * Specifies the referrer policy for the iframe. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-referrerpolicy + */ + referrerpolicy?: AttrReferrerPolicy; + /** + * A set of sandbox flags that are applied to the iframe. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-sandbox + */ + sandbox?: + | AttrMissing + | "allow-downloads-without-user-activation" + | "allow-downloads" + | "allow-forms" + | "allow-modals" + | "allow-orientation-lock" + | "allow-pointer-lock" + | "allow-popups-to-escape-sandbox" + | "allow-popups" + | "allow-presentation" + | "allow-same-origin" + | "allow-scripts" + | "allow-storage-access-by-user-activation" + | "allow-top-navigation-by-user-activation" + | "allow-top-navigation-to-custom-protocols" + | "allow-top-navigation" + | (string & {}); + /** + * The URL of the page to embed in the iframe. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-src + */ + src?: AttrString; + /** + * A document to render inside the iframe. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-srcdoc + */ + srcdoc?: AttrString; + /** + * The width of the iframe. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-width + */ + width?: AttrStringOrNumber; + /** @deprecated */ + align?: AttrString; + /** @deprecated */ + frameborder?: AttrStringOrNumber; + /** @deprecated */ + longdesc?: AttrString; + /** @deprecated */ + marginheight?: AttrStringOrNumber; + /** @deprecated */ + marginwidth?: AttrStringOrNumber; + /** @deprecated */ + scrolling?: AttrYesNoString | "auto"; + } + interface Img extends HTMLAttributes { + /** + * The alternative text for the image, displayed when the image cannot be loaded or + * rendered. This is useful for accessibility purposes. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-alt + */ + alt?: AttrString; + + /** + * A CORS setting attribute that determines if the image should be fetched with CORS or not. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-crossorigin + */ + crossorigin?: AttrCrossOrigin; + + /** + * Specifies the decoding mode for the image, which can be "sync", "async", or "auto". + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-decoding + */ + decoding?: AttrMissing | "sync" | "async" | "auto"; + + /** + * Sets the fetch priority of the image, which can be "auto", "high", or "low". + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-fetchpriority + */ + fetchpriority?: AttrMissing | "auto" | "high" | "low"; + + /** + * The height of the image, either as a string (CSS length value) or a number (pixels). + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-dim-height + */ + height?: AttrStringOrNumber; + + /** + * Indicates that the image is part of a server-side image map. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-ismap + */ + ismap?: AttrBoolean; + + /** + * Specifies the loading behavior of the image, which can be "eager" or "lazy". + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading + */ + loading?: AttrMissing | "eager" | "lazy"; + + /** + * Sets the referrer policy for the image request. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-referrerpolicy + */ + referrerpolicy?: AttrReferrerPolicy; + + /** + * A string containing size descriptors for responsive images. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-sizes + */ + sizes?: AttrString; + + /** + * The URL of the image to display. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-src + */ + src?: AttrString; + + /** + * A string containing URL and size descriptor pairs for responsive images. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-srcset + */ + srcset?: AttrString; + + /** + * The URL of a client-side image map to associate with the image. + * @see https://html.spec.whatwg.org/multipage/image-maps.html#attr-hyperlink-usemap + */ + usemap?: AttrString; + + /** + * The width of the image, either as a string (CSS length value) or a number (pixels + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-dim-width + */ + width?: AttrStringOrNumber; + + /** @deprecated */ + align?: AttrMissing | "left" | "center" | "right" | "justify" | "char"; + /** @deprecated */ + border?: AttrStringOrNumber; + /** @deprecated */ + hspace?: AttrStringOrNumber; + /** @deprecated */ + longdesc?: AttrString; + /** @deprecated */ + name?: AttrString; + /** @deprecated */ + vspace?: AttrStringOrNumber; + } + interface Input extends HTMLAttributes { + /** + * A comma-separated list of file types that a file input should accept. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-accept + */ + accept?: AttrString; + + /** + * The alternate text for an image input, displayed if the image cannot be loaded. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-alt + */ + alt?: AttrString; + + /** + * Specifies whether the input field should have autocomplete enabled or disabled. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete + */ + autocomplete?: AttrAutoComplete; + + /** + * Indicates whether a file input should use a specific capture method. + * "user" indicates the front camera, "environment" indicates the rear camera. + * @see https://w3c.github.io/html-media-capture/#dfn-capture + */ + capture?: AttrBoolean | "user" | "environment"; + + /** + * Indicates whether a checkbox should be checked or not. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-checked + */ + checked?: AttrBoolean; + + /** + * Enables the submission of the directionality of a text input. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-dirname + */ + dirname?: AttrString; + + /** + * Indicates whether the input should be disabled or not. When disabled, + * the input will not be interactable or submitted with the form. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-disabled + */ + disabled?: AttrBoolean; + + /** + * The ID of the form element that this input is associated with. + * This allows the input to be associated with a form even if it is + * not a direct descendant of the form element. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form + */ + form?: AttrString; + + /** + * The URL of the form processing endpoint when the input image is used for form submission. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formaction + */ + formaction?: Form["action"]; + + /** + * The encoding type for the form data when the input image is used for form submission. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formenctype + */ + formenctype?: Form["enctype"]; + + /** + * The HTTP method to use when the input image is used for form submission. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formmethod + */ + formmethod?: Form["method"]; + + /** + * Indicates whether form validation should be skipped when the input image is used for form submission. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formnovalidate + */ + formnovalidate?: Form["novalidate"]; + + /** + * The browsing context for displaying the response after form submission when the input image is used. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formtarget + */ + formtarget?: Form["target"]; + + /** + * The height of of an image input in pixels. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-height + */ + height?: AttrStringOrNumber; + + /** + * The ID of a element that provides a list of suggested values for the input. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-list + */ + list?: AttrString; + + /** + * The maximum allowed value for the input. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-max + */ + max?: AttrStringOrNumber; + + /** + * The maximum number of characters allowed in the input. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-maxlength + */ + maxlength?: AttrStringOrNumber; + + /** + * The minimum allowed value for the input. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-min + */ + min?: AttrStringOrNumber; + + /** + * The minimum number of characters required in the input. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-minlength + */ + minlength?: AttrStringOrNumber; + + /** + * Indicates whether the input should allow more than one value. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-multiple + */ + multiple?: AttrBoolean; + + /** + * Used as a key when submitting the forms data. Also the name used in the form.elements api. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name + * @see HTMLFormElement.elements + */ + name?: AttrString; + + /** + * A regular expression pattern to be validated against the input value. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-pattern + */ + pattern?: AttrString; + + /** + * A short hint to display in the input field before the user enters a value. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder + */ + placeholder?: AttrStringOrNumber; + + /** + * Specifies the target element for the popover. + * @see https://developer.chrome.com/docs/web-platform/popover-api/popovertargetaction-toggle-attribute + */ + popovertarget?: AttrString; + + /** + * Specifies the action to perform on the popover target. + * @see https://developer.chrome.com/docs/web-platform/popover-api/popovertargetaction-toggle-attribute + */ + popovertargetaction?: AttrMissing | "toggle" | "show" | "hide"; + + /** + * Indicates whether the input should be read-only or not. Read-only inputs cannot be edited. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-readonly + */ + readonly?: AttrBoolean; + + /** + * Indicates whether the input is required to have a value for the form to be submitted. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-required + */ + required?: AttrBoolean; + + /** + * The number of characters wide a text input field should be displayed. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-size + */ + size?: AttrStringOrNumber; + + /** + * The URL of the image file. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-src + */ + src?: AttrString; + + /** + * Specifies the allowed number intervals for the input value. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-step + */ + step?: AttrStringOrNumber; + + /** + * Controls the data type (and associated control) of the element. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-type + */ + type?: + | AttrMissing + | "button" + | "checkbox" + | "color" + | "date" + | "datetime-local" + | "email" + | "file" + | "hidden" + | "image" + | "month" + | "number" + | "password" + | "radio" + | "range" + | "reset" + | "search" + | "submit" + | "tel" + | "text" + | "time" + | "url" + | "week"; + + /** + * Specifies the string value you want to pass back to the server. + * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-value + */ + value?: AttrStringOrNumber; + + /** + * The width of an image input in pixels. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-width + */ + width?: AttrStringOrNumber; + } + + interface Ins extends HTMLAttributes { + /** + * A URI for a resource that explains the reason for the insertion. + * @see https://html.spec.whatwg.org/multipage/edits.html#attr-mod-cite + */ + cite?: AttrString; + + /** + * The date and time when the element's contents were inserted, in the format "YYYY-MM-DDThh:mm:ssZ". + * @see https://html.spec.whatwg.org/multipage/edits.html#attr-mod-datetime + */ + datetime?: AttrString; + } + + interface Kbd extends HTMLAttributes {} + interface Label extends HTMLAttributes { + /** + * The ID of a form control that this label is associated with. + * @see https://html.spec.whatwg.org/multipage/forms.html#attr-label-for + */ + for?: AttrString; + + /** + * The ID of the form element that this label is associated with, if the form control is not a descendant of the label element. + * Note that this attribute is non standard. + * + * @see https://www.w3schools.com/tags//att_label_form.asp + */ + form?: AttrString; + } + + interface Legend extends HTMLAttributes {} + interface LI extends HTMLAttributes { + /** + * The value used to determine the ordinal value of the list item. + * @see https://html.spec.whatwg.org/multipage/grouping-content.html#attr-li-value + */ + value?: AttrStringOrNumber; + + /** @deprecated */ + type?: AttrString; + } + // TODO break into multiple interfaces based on rel? + interface Link extends HTMLAttributes { + /** + * Specifies the type of resource for the preload request. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-as + */ + as?: + | AttrMissing + | "audio" + | "document" + | "embed" + | "fetch" + | "font" + | "image" + | "object" + | "script" + | "style" + | "track" + | "video" + | "worker"; + + /** + * Specifies whether the link should block rendering or not. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-blocking + */ + blocking?: AttrMissing | "render"; + + /** + * Specifies how the CORS requests for the element should be handled. + * @see https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes + */ + crossorigin?: AttrCrossOrigin; + + /** + * Indicates if the link element is disabled. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-disabled + */ + disabled?: AttrBoolean; + + /** + * Specifies the priority for the fetch request. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-fetchpriority + */ + fetchpriority?: AttrMissing | "auto" | "high" | "low"; + + /** + * Specifies the URL of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-href + */ + href?: AttrString; + + /** + * Specifies the language of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-hreflang + */ + hreflang?: AttrString; + + /** + * Specifies the sizes for image resources. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-imagesizes + */ + imagesizes?: AttrString; + + /** + * Specifies a set of source sizes for responsive images. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-imagesrcset + */ + imagesrcset?: AttrString; + + /** + * Allows a resource to be fetched with a cryptographic hash, ensuring the integrity of the resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-integrity + */ + integrity?: AttrString; + + /** + * Specifies the media for which the linked resource is designed. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-media + */ + media?: AttrString; + + /** + * Specifies the referrer policy for the request initiated by the link element. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-referrerpolicy + */ + referrerpolicy?: AttrReferrerPolicy; + + /** + * Specifies the relationship between the current document and the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-rel + */ + rel?: + | AttrMissing + | "alternate" + | "author" + | "bookmark" + | "canonical" + | "dns-prefetch" + | "external" + | "help" + | "icon" + | "manifest" + | "modulepreload" + | "license" + | "next" + | "pingback" + | "preconnect" + | "prefetch" + | "preload" + | "prev" + | "search" + | "stylesheet" + | (string & {}); + + /** + * Specifies the size of the resource for rel="icon" or rel="apple-touch-icon". + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-sizes + */ + sizes?: AttrString; + + /** + * Specifies the MIME type of the linked resource. + * @see https://html.spec.whatwg.org/multipage/links.html#attr-link-type + */ + type?: AttrString; + + // DEPRECATED + + /** @deprecated */ + charset?: AttrString; + + /** @deprecated */ + rev?: AttrString; + + // NON STANDARD + + /** + * Called whenever a the `checked` property of an `input` has changed. + * When `checkedChange` is a function, `checked` becomes controlled. + * This means the `checked` property is synchronized instead of the `checked` attribute. + */ + checkedChange?: AttrMissing | ((checked: boolean) => void); + + /** + * Used to synchronize the `checked` attribute with a `value` attribute used across related `input type="checkbox"` and `input type="radio"` controls. + * When `checkedValue` is a string, the `checked` attribute will be set to a boolean that is `true` if the `checkedValue` is the same as the `value`. + * When `checkedValue` is an array of strings, the `checked` attribute will be set to a boolean that is `true` if the `checkedValue` array includes the `value`. + * If the `checkedValue` is falsy then `checked` is always `false`. + */ + checkedValue?: AttrMissing | string | string[]; + /** + * Called whenever a `input type="checkbox"` or `input type="radio"` using the `checkedValue` attribute has changed. + * When `checkedValueChange` is a function, `checked` becomes controlled. + * This means the `checked` property is synchronized instead of the `checked` attribute. + */ + checkedValueChange?: + | AttrMissing + | (( + /** Note this is hack that allows you to work with the value as both a string and a string[] without needing generics */ + checkedValue: string & string[], + ) => void); + + /** + * Called whenever a the `value` property of an `input` has changed. + * When `valueChange` is a function, `value` becomes controlled. This means + * This means the `value` property is synchronized instead of the `value` attribute. + */ + valueChange?: AttrMissing | ((value: string) => void); + } + + interface Main extends HTMLAttributes {} + interface Map extends HTMLAttributes { + /** + * Specifies the name of the map. + * @see https://html.spec.whatwg.org/multipage/embedded-content.html#attr-map-name + */ + name?: AttrString; + } + interface Mark extends HTMLAttributes {} + interface Menu extends HTMLAttributes { + /** + * Specifies the title of the menu. + * @see https://html.spec.whatwg.org/multipage/interactive-elements.html#attr-menu-label + */ + label?: AttrString; + + /** + * Specifies the type of the menu, either a context menu or a toolbar. + * @see https://html.spec.whatwg.org/multipage/interactive-elements.html#attr-menu-type + */ + type?: AttrMissing | "context" | "toolbar"; + } + interface Meta extends HTMLAttributes { + /** + * Specifies the character encoding for the HTML document. + * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-charset + */ + charset?: AttrString; + + /** + * Specifies the value associated with the http-equiv or name attribute. + * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-content + */ + content?: AttrString; + + /** + * Specifies a pragma directive to affect the behavior of the user agent or server. + * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv + */ + "http-equiv"?: + | AttrMissing + | "Content-Security-Policy" + | "Content-Type" + | "Default-Style" + | "Refresh" + | "X-UA-Compatible"; + + /** + * Specifies the metadata name for the content attribute. + * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-name + */ + name?: AttrString; + + /** @see https://ogp.me/ */ + property?: AttrString; + } + interface Meter extends HTMLAttributes { + /** + * Specifies the upper bound of the high end of the measured range. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-meter-high + */ + high?: AttrStringOrNumber; + + /** + * Specifies the lower bound of the low end of the measured range. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-meter-low + */ + low?: AttrStringOrNumber; + + /** + * Specifies the maximum value of the range. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-meter-max + */ + max?: AttrStringOrNumber; + + /** + * Specifies the minimum value of the range. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-meter-min + */ + min?: AttrStringOrNumber; + + /** + * Specifies the value that is considered optimal. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-meter-optimum + */ + optimum?: AttrStringOrNumber; + + /** + * Specifies the current value of the meter. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-meter-value + */ + value?: AttrStringOrNumber; + } + + interface Nav extends HTMLAttributes {} + interface NoScript extends HTMLAttributes {} + interface Object extends HTMLAttributes { + /** + * Specifies the URL of the resource to be embedded. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-data + */ + data?: AttrString; + + /** + * Associates the object element with a form element. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form + */ + form?: AttrString; + + /** + * Specifies the height of the object element. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-height + */ + height?: AttrStringOrNumber; + + /** + * Specifies the name of the object element. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-name + */ + name?: AttrString; + + /** + * Specifies the MIME type of the resource. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-type + */ + type?: AttrString; + + /** + * Specifies a client-side image map to be used with the object element. + * @see https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-usemap + */ + usemap?: AttrString; + + /** + * Specifies the width of the object element. + * @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-width + */ + width?: AttrStringOrNumber; + + /** @deprecated */ + archive?: AttrString; + /** @deprecated */ + border?: AttrString; + /** @deprecated */ + classid?: AttrString; + /** @deprecated */ + codebase?: AttrString; + /** @deprecated */ + codetype?: AttrString; + /** @deprecated */ + declare?: AttrBoolean; + /** @deprecated */ + standby?: AttrString; + } + interface OL extends HTMLAttributes { + /** + * Specifies whether the list items are numbered in reverse order. + * @see https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-reversed + */ + reversed?: AttrBoolean; + + /** + * Specifies the starting value of the list items. + * @see https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-start + */ + start?: AttrStringOrNumber; + + /** + * Specifies the numbering type of the list items. + * @see https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type + */ + type?: AttrMissing | "1" | "a" | "A" | "i" | "I"; + } + interface OptGroup extends HTMLAttributes { + /** + * Specifies that the option group is disabled. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-optgroup-disabled + */ + disabled?: AttrBoolean; + + /** + * Specifies a label for the option group. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-optgroup-label + */ + label?: AttrString; + } + interface Option extends HTMLAttributes { + /** + * Specifies that the option is disabled. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-option-disabled + */ + disabled?: AttrBoolean; + + /** + * Specifies a label for the option element. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-option-label + */ + label?: AttrString; + + /** + * Specifies that the option element is selected by default. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-option-selected + */ + selected?: AttrBoolean; + + /** + * Specifies the value of the option element. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-option-value + */ + value?: AttrStringOrNumber; + } + interface Output extends HTMLAttributes { + /** + * Specifies the ID of the form element that this output element is associated with. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-output-for + */ + for?: AttrString; + + /** + * Specifies the ID of the form that this output element belongs to. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form + */ + form?: AttrString; + + /** + * Specifies the name of the output element. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name + */ + name?: AttrString; + } + + interface P extends HTMLAttributes {} + interface Picture extends HTMLAttributes {} + interface Pre extends HTMLAttributes { + /** @deprecated */ + cols?: AttrStringOrNumber; + /** @deprecated */ + width?: AttrStringOrNumber; + /** @deprecated */ + wrap?: AttrString; + } + interface Progress extends HTMLAttributes { + /** + * Specifies the maximum value of the progress bar. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-progress-max + */ + max?: AttrStringOrNumber; + + /** + * Specifies the current value of the progress bar. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-progress-value + */ + value?: AttrStringOrNumber; + } + + interface Q extends HTMLAttributes { + /** + * Specifies the URL of the source document or message that the quotation came from. + * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html#attr-q-cite + */ + cite?: AttrString; + } + + interface RP extends HTMLAttributes {} + interface RT extends HTMLAttributes {} + interface Ruby extends HTMLAttributes {} + interface S extends HTMLAttributes {} + interface Samp extends HTMLAttributes {} + interface Script extends HTMLAttributes { + /** + * Specifies that the script should be executed asynchronously. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-async + */ + async?: AttrBoolean; + + /** + * Specifies that the script should be fetched and executed after the page is rendered. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-blocking + */ + blocking?: AttrMissing | "render"; + + /** + * Specifies whether CORS (Cross-Origin Resource Sharing) requests should be used when fetching the script. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-crossorigin + */ + crossorigin?: AttrCrossOrigin; + + /** + * Specifies that the script should be executed after the page is parsed, but before the document is loaded. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-defer + */ + defer?: AttrBoolean; + + /** + * Specifies the priority level for fetching the script. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-fetchpriority + */ + fetchpriority?: AttrMissing | "auto" | "high" | "low"; + + /** + * Specifies the integrity hash for the script. + * @see https://html.spec.whatwg.org/multipage/urls-and-fetching.html#attr-link-integrity + */ + integrity?: AttrString; + + /** + * Specifies that the script should be ignored if the browser doesn't support modules. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-nomodule + */ + nomodule?: AttrBoolean; + + /** + * Specifies the referrer policy for the script. + * @see https://html.spec.whatwg.org/multipage/urls-and-fetching.html#attr-link-referrerpolicy + */ + referrerpolicy?: AttrReferrerPolicy; + + /** + * Specifies the URL of the script. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-src + */ + src?: AttrString; + + /** + * Specifies the type of the script. + * @see https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type + */ + type?: + | AttrMissing + | "application/javascript" + | "module" + | "import-map" + | (string & {}); + + /** @deprecated */ + charset?: AttrString; + /** @deprecated */ + language?: AttrString; + } + + interface Section extends HTMLAttributes {} + interface Select extends HTMLAttributes { + /** + * Controls whether the browser should automatically complete the value for the select. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete + */ + autocomplete?: AttrAutoComplete; + + /** + * Indicates whether the select element should be disabled or not. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-disabled + */ + disabled?: AttrBoolean; + + /** + * Specifies the form element associated with the select. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-fae-form + */ + form?: AttrString; + + /** + * Indicates that multiple options can be selected. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-select-multiple + */ + multiple?: AttrBoolean; + + /** + * The name attribute of the select element, which is used as a key + * when submitting the form data. Also the named used in the form.elements. + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name + * @see HTMLFormElement.elements + */ + name?: AttrString; + + /** + * Indicates whether a selection is required or not for the select. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-select-required + */ + required?: AttrBoolean; + + /** + * Specifies how many options are visible at once. + * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-select-size + */ + size?: AttrStringOrNumber; + + // NON STANDARD + + /** + * When the `value` is a string, nested `