UNPKG

jsx-dom-runtime

Version:

A tiny 500-byte library for JSX syntax templates targeting the DOM. Supports HTML, SVG, and MathML tags

1,317 lines (1,281 loc) 138 kB
/// <reference lib="dom" /> /// <reference lib="es2024" /> import type { Properties, Property } from 'csstype'; type AnyString = string & {} type Booleanish = boolean | 'true' | 'false' type Numeric = number | `${number}` type JSXElement = | Element | DocumentFragment | Text | Comment type JSXChild = | string | number | bigint | false | null | undefined | JSXElement | JSXChild[] export interface RefObject<T> { readonly current: T } export type RefCallback<T> = (instance: T) => void export type PropsWithChildren<P> = P & { children?: JSXChild | JSXChild[] } interface VoidElement { /** * Void element cannot have any child nodes (i.e., nested elements or text nodes) * @see https://developer.mozilla.org/en-US/docs/Glossary/Void_element * @deprecated */ children?: never | void | null } export declare function jsx< K extends keyof JSX.IntrinsicElements | AnyString, R = K extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[K] : K extends keyof HTMLElementDeprecatedTagNameMap ? HTMLElementDeprecatedTagNameMap[K] : K extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[K] : K extends keyof MathMLElementTagNameMap ? MathMLElementTagNameMap[K] : Element >( tag: K, props: K extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[K] : JSX.HTMLAttributes<R>, children?: JSXChild | JSXChild[] ): R export type FunctionComponent<P = {}> = JSX.FC<P> export { FunctionComponent as FC }; export declare const extensions: Map< string, (node: Element, value: any, key: string) => void >; export declare const svgNs = 'http://www.w3.org/2000/svg'; export declare const mathmlNs = 'http://www.w3.org/1998/Math/MathML'; export declare function useRef<T = any>(current?: T): RefObject<T> export declare function useText<T = string>(initContent?: T): readonly [ Text, (content: T) => void ] export declare function parseFromString(html: string): DocumentFragment export declare function Fragment(children?: JSXChild | JSXChild[]): DocumentFragment export declare function Template(props: { children: string }): DocumentFragment /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/CommandEvent) */ interface CommandEvent extends Event { /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/CommandEvent/source) */ readonly source: Element | null; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/CommandEvent/command) */ readonly command: CommandEventType; } interface CurrentTarget<T> { readonly currentTarget: EventTarget & T } export interface EventHandlerObject<E = Event, T = Element> { handleEvent(event: E & CurrentTarget<T>): void } type EventHandlerFunction<E, T> = (this: T, event: E & CurrentTarget<T>) => void type EventHandler<E, T> = EventHandlerFunction<E, T> | EventHandlerObject<E, T> export type AnimationEventHandler<T = Element> = EventHandlerFunction<AnimationEvent, T> export type ClipboardEventHandler<T = Element> = EventHandlerFunction<ClipboardEvent, T> export type CompositionEventHandler<T = Element> = EventHandlerFunction<CompositionEvent, T> export type DragEventHandler<T = Element> = EventHandlerFunction<DragEvent, T> export type FocusEventHandler<T = Element> = EventHandlerFunction<FocusEvent, T> export type FormDataEventHandler<T = Element> = EventHandlerFunction<FormDataEvent, T> export type GenericEventHandler<T = Element> = EventHandlerFunction<Event, T> export type InputEventHandler<T = Element> = EventHandlerFunction<InputEvent, T> export type KeyboardEventHandler<T = Element> = EventHandlerFunction<KeyboardEvent, T> export type MediaEncryptedEventHandler<T = Element> = EventHandlerFunction<MediaEncryptedEvent, T> export type MouseEventHandler<T = Element> = EventHandlerFunction<MouseEvent, T> export type PictureInPictureEventHandler<T = Element> = EventHandlerFunction<PictureInPictureEvent, T> export type PointerEventHandler<T = Element> = EventHandlerFunction<PointerEvent, T> export type SubmitEventHandler<T = Element> = EventHandlerFunction<SubmitEvent, T> export type ToggleEventHandler<T = Element> = EventHandlerFunction<ToggleEvent, T> export type TouchEventHandler<T = Element> = EventHandlerFunction<TouchEvent, T> export type TransitionEventHandler<T = Element> = EventHandlerFunction<TransitionEvent, T> export type UIEventHandler<T = Element> = EventHandlerFunction<UIEvent, T> export type WebGLContextEventHandler<T = Element> = EventHandlerFunction<WebGLContextEvent, T> export type WheelEventHandler<T = Element> = EventHandlerFunction<WheelEvent, T> export type ContentVisibilityAutoStateChangeEventHandler<T = Element> = EventHandlerFunction<ContentVisibilityAutoStateChangeEvent, T> export type CommandEventHandler<T = Element> = EventHandlerFunction<CommandEvent, T> export interface CSSProperties extends Properties<number | string> { cssText?: string | null [key: `--${string}`]: number | string } export type ControlsList = | 'nodownload' | 'nofullscreen' | 'noremoteplayback' | 'noplaybackrate' | AnyString export type Target = '_self' | '_parent' | '_top' | '_blank' | '_unfencedTop' | AnyString export type CrossOrigin = boolean | '' | 'anonymous' | 'use-credentials' export type FetchPriority = 'high' | 'low' | 'auto' export type CommandEventType = | 'show-modal' | 'close' | 'request-close' | 'show-popover' | 'hide-popover' | 'toggle-popover' | `--${string}` export type FormEnctype = | 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | AnyString export type FormMethod = 'post' | 'get' | 'dialog' | AnyString export type DirName = 'rtl' | 'ltr' export type AriaRole = | 'alert' | 'alertdialog' | 'application' | 'article' | 'banner' | 'blockquote' | 'button' | 'caption' | 'cell' | 'checkbox' | 'code' | 'columnheader' | 'combobox' | 'command' | 'complementary' | 'composite' | 'contentinfo' | 'definition' | 'deletion' | 'dialog' | 'directory' | 'document' | 'emphasis' | 'feed' | 'figure' | 'form' | 'generic' | 'grid' | 'gridcell' | 'group' | 'heading' | 'img' | 'input' | 'insertion' | 'landmark' | 'link' | 'list' | 'listbox' | 'listitem' | 'log' | 'main' | 'marquee' | 'math' | 'meter' | 'menu' | 'menubar' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'navigation' | 'none' | 'note' | 'option' | 'paragraph' | 'presentation' | 'progressbar' | 'radio' | 'radiogroup' | 'range' | 'region' | 'roletype' | 'row' | 'rowgroup' | 'rowheader' | 'scrollbar' | 'search' | 'searchbox' | 'section' | 'sectionhead' | 'select' | 'separator' | 'slider' | 'spinbutton' | 'status' | 'strong' | 'structure' | 'subscript' | 'superscript' | 'switch' | 'tab' | 'table' | 'tablist' | 'tabpanel' | 'term' | 'textbox' | 'time' | 'timer' | 'toolbar' | 'tooltip' | 'tree' | 'treegrid' | 'treeitem' | 'widget' | 'window' | 'none presentation' // the Digital Publishing WAI-ARIA | 'doc-abstract' | 'doc-acknowledgments' | 'doc-afterword' | 'doc-appendix' | 'doc-backlink' | 'doc-biblioentry' | 'doc-bibliography' | 'doc-biblioref' | 'doc-chapter' | 'doc-colophon' | 'doc-conclusion' | 'doc-cover' | 'doc-credit' | 'doc-credits' | 'doc-dedication' | 'doc-endnote' | 'doc-endnotes' | 'doc-epigraph' | 'doc-epilogue' | 'doc-errata' | 'doc-example' | 'doc-footnote' | 'doc-foreword' | 'doc-glossary' | 'doc-glossref' | 'doc-index' | 'doc-introduction' | 'doc-noteref' | 'doc-notice' | 'doc-pagebreak' | 'doc-pagelist' | 'doc-part' | 'doc-preface' | 'doc-prologue' | 'doc-pullquote' | 'doc-qna' | 'doc-subtitle' | 'doc-tip' | 'doc-toc' export interface AriaAttributes { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 'aria-activedescendant'?: string /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ 'aria-atomic'?: Booleanish /** * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be * presented if they are made. */ 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' /** * Defines a string value that labels the current element, which is intended to be converted into Braille. * @see aria-label. */ 'aria-braillelabel'?: string /** * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. * @see aria-roledescription. */ 'aria-brailleroledescription'?: string /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ 'aria-busy'?: Booleanish /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * @see aria-pressed @see aria-selected. */ 'aria-checked'?: Booleanish | 'mixed' /** * Defines the total number of columns in a table, grid, or treegrid. * @see aria-colindex. */ 'aria-colcount'?: Numeric /** * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. * @see aria-colcount @see aria-colspan. */ 'aria-colindex'?: Numeric /** * Defines a human readable text alternative of aria-colindex. * @see aria-rowindextext. */ 'aria-colindextext'?: string /** * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-colindex @see aria-rowspan. */ 'aria-colspan'?: Numeric /** * Identifies the element (or elements) whose contents or presence are controlled by the current element. * @see aria-owns. */ 'aria-controls'?: string /** Indicates the element that represents the current item within a container or set of related elements. */ 'aria-current'?: Booleanish | 'page' | 'step' | 'location' | 'date' | 'time' /** * Identifies the element (or elements) that describes the object. * @see aria-labelledby */ 'aria-describedby'?: string /** * Defines a string value that describes or annotates the current element. * @see related aria-describedby. */ 'aria-description'?: string /** * Identifies the element that provides a detailed, extended description for the object. * @see aria-describedby. */ 'aria-details'?: string /** * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * @see aria-hidden @see aria-readonly. */ 'aria-disabled'?: Booleanish /** * Indicates what functions can be performed when a dragged object is released on the drop target. * @deprecated in ARIA 1.1 */ 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' /** * Identifies the element that provides an error message for the object. * @see aria-invalid @see aria-describedby. */ 'aria-errormessage'?: string /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ 'aria-expanded'?: Booleanish /** * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, * allows assistive technology to override the general default of reading in document source order. */ 'aria-flowto'?: string /** * Indicates an element's "grabbed" state in a drag-and-drop operation. * @deprecated in ARIA 1.1 */ 'aria-grabbed'?: Booleanish /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 'aria-haspopup'?: Booleanish | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ 'aria-hidden'?: Booleanish /** * Indicates the entered value does not conform to the format expected by the application. * @see aria-errormessage. */ 'aria-invalid'?: Booleanish | 'grammar' | 'spelling' /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ 'aria-keyshortcuts'?: string /** * Defines a string value that labels the current element. * @see aria-labelledby. */ 'aria-label'?: string /** * Identifies the element (or elements) that labels the current element. * @see aria-describedby. */ 'aria-labelledby'?: string /** Defines the hierarchical level of an element within a structure. */ 'aria-level'?: Numeric /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 'aria-live'?: 'off' | 'assertive' | 'polite' /** Indicates whether an element is modal when displayed. */ 'aria-modal'?: Booleanish /** Indicates whether a text box accepts multiple lines of input or only a single line. */ 'aria-multiline'?: Booleanish /** Indicates that the user may select more than one item from the current selectable descendants. */ 'aria-multiselectable'?: Booleanish /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ 'aria-orientation'?: 'horizontal' | 'vertical' /** * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. * @see aria-controls. */ 'aria-owns'?: string /** * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. * A hint could be a sample value or a brief description of the expected format. */ 'aria-placeholder'?: string /** * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-setsize. */ 'aria-posinset'?: Numeric /** * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ 'aria-pressed'?: Booleanish | 'mixed' /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ 'aria-readonly'?: Booleanish /** * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ 'aria-relevant'?: | 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' /** Indicates that user input is required on the element before a form may be submitted. */ 'aria-required'?: Booleanish /** Defines a human-readable, author-localized description for the role of an element. */ 'aria-roledescription'?: string /** * Defines the total number of rows in a table, grid, or treegrid. * @see aria-rowindex. */ 'aria-rowcount'?: Numeric /** * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. * @see aria-rowcount @see aria-rowspan. */ 'aria-rowindex'?: Numeric /** * Defines a human readable text alternative of aria-rowindex. * @see aria-colindextext. */ 'aria-rowindextext'?: string /** * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-rowindex @see aria-colspan. */ 'aria-rowspan'?: Numeric /** * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ 'aria-selected'?: Booleanish /** * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-posinset. */ 'aria-setsize'?: Numeric /** Indicates if items in a table or grid are sorted in ascending or descending order. */ 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' /** Defines the maximum allowed value for a range widget. */ 'aria-valuemax'?: Numeric /** Defines the minimum allowed value for a range widget. */ 'aria-valuemin'?: Numeric /** * Defines the current value for a range widget. * @see aria-valuetext. */ 'aria-valuenow'?: Numeric /** Defines the human readable text alternative of aria-valuenow for a range widget. */ 'aria-valuetext'?: string /** * All the WAI-ARIA 1.2 role attribute values * @see https://www.w3.org/TR/wai-aria-1.2/#role_definitions * All the Digital Publishing WAI-ARIA 1.0 role attribute values * @see https://www.w3.org/TR/dpub-aria-1.0/#role_definitions */ role?: AriaRole 'prop:ariaActivedescendant'?: string 'prop:ariaAtomic'?: Booleanish 'prop:ariaAutocomplete'?: 'none' | 'inline' | 'list' | 'both' 'prop:ariaBraillelabel'?: string 'prop:ariaBrailleroledescription'?: string 'prop:ariaBusy'?: Booleanish 'prop:ariaChecked'?: Booleanish | 'mixed' 'prop:ariaColcount'?: Numeric 'prop:ariaColindex'?: Numeric 'prop:ariaColindextext'?: string 'prop:ariaColspan'?: Numeric 'prop:ariaControls'?: string 'prop:ariaCurrent'?: Booleanish | 'page' | 'step' | 'location' | 'date' | 'time' 'prop:ariaDescribedby'?: string 'prop:ariaDescription'?: string 'prop:ariaDetails'?: string 'prop:ariaDisabled'?: Booleanish 'prop:ariaDropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' 'prop:ariaErrormessage'?: string 'prop:ariaExpanded'?: Booleanish 'prop:ariaFlowto'?: string 'prop:ariaGrabbed'?: Booleanish 'prop:ariaHaspopup'?: Booleanish | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' 'prop:ariaHidden'?: Booleanish 'prop:ariaInvalid'?: Booleanish | 'grammar' | 'spelling' 'prop:ariaKeyshortcuts'?: string 'prop:ariaLabel'?: string 'prop:ariaLabelledby'?: string 'prop:ariaLevel'?: Numeric 'prop:ariaLive'?: 'off' | 'assertive' | 'polite' 'prop:ariaModal'?: Booleanish 'prop:ariaMultiline'?: Booleanish 'prop:ariaMultiselectable'?: Booleanish 'prop:ariaOrientation'?: 'horizontal' | 'vertical' 'prop:ariaOwns'?: string 'prop:ariaPlaceholder'?: string 'prop:ariaPosinset'?: Numeric 'prop:ariaPressed'?: Booleanish | 'mixed' 'prop:ariaReadonly'?: Booleanish 'prop:ariaRelevant'?: | 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' 'prop:ariaRequired'?: Booleanish 'prop:ariaRoledescription'?: string 'prop:ariaRowcount'?: Numeric 'prop:ariaRowindex'?: Numeric 'prop:ariaRowindextext'?: string 'prop:ariaRowspan'?: Numeric 'prop:ariaSelected'?: Booleanish 'prop:ariaSetsize'?: Numeric 'prop:ariaSort'?: 'none' | 'ascending' | 'descending' | 'other' 'prop:ariaValuemax'?: Numeric 'prop:ariaValuemin'?: Numeric 'prop:ariaValuenow'?: Numeric 'prop:ariaValuetext'?: string 'prop:role'?: AriaRole } interface NoRolePermited { /** No `role` permitted */ role?: never 'prop:role'?: never } declare global { namespace JSX { type Element = JSXElement interface ElementChildrenAttribute { children: {} } type FC<P = {}> = (props: PropsWithChildren<P>) => JSXElement | null type Ref<T = unknown> = RefCallback<T> | RefObject<T> type AnimationEventListener<T = globalThis.Element> = EventHandler<AnimationEvent, T> type ClipboardEventListener<T = globalThis.Element> = EventHandler<ClipboardEvent, T> type CompositionEventListener<T = globalThis.Element> = EventHandler<CompositionEvent, T> type DragEventListener<T = globalThis.Element> = EventHandler<DragEvent, T> type EventListener<T = globalThis.Element> = EventHandler<Event, T> type FocusEventListener<T = globalThis.Element> = EventHandler<FocusEvent, T> type FormDataEventListener<T = globalThis.Element> = EventHandler<FormDataEvent, T> type InputEventListener<T = globalThis.Element> = EventHandler<InputEvent, T> type KeyboardEventListener<T = globalThis.Element> = EventHandler<KeyboardEvent, T> type MediaEncryptedEventListener<T = globalThis.Element> = EventHandler<MediaEncryptedEvent, T> type MouseEventListener<T = globalThis.Element> = EventHandler<MouseEvent, T> type PictureInPictureEventListener<T = globalThis.Element> = EventHandler<PictureInPictureEvent, T> type PointerEventListener<T = globalThis.Element> = EventHandler<PointerEvent, T> type SubmitEventListener<T = globalThis.Element> = EventHandler<SubmitEvent, T> type ToggleEventListener<T = globalThis.Element> = EventHandler<ToggleEvent, T> type TouchEventListener<T = globalThis.Element> = EventHandler<TouchEvent, T> type TransitionEventListener<T = globalThis.Element> = EventHandler<TransitionEvent, T> type UIEventListener<T = globalThis.Element> = EventHandler<UIEvent, T> type WebGLContextEventListener<T = globalThis.Element> = EventHandler<WebGLContextEvent, T> type WheelEventListener<T = globalThis.Element> = EventHandler<WheelEvent, T> type CommandEventListener<T = globalThis.Element> = EventHandler<CommandEvent, T> type ContentVisibilityAutoStateChangeEventListener<T = globalThis.Element> = EventHandler<ContentVisibilityAutoStateChangeEvent, T> interface Attributes { accessKey?: string class?: string /** * Making document regions editable * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable */ contentEditable?: '' | 'plaintext-only' | Booleanish /** * This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes * @deprecated */ contextMenu?: string dir?: DirName | 'auto' /** * This attribute is enumerated and not Boolean. A value of `true` or `false` is mandatory, and shorthand like `<img draggable>` is forbidden. The correct usage is `<img draggable="true">` * @see https://developer.mozilla.org/en-US/docs/Glossary/Enumerated */ draggable?: 'true' | 'false' enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' hidden?: boolean | 'hidden' | 'until-found' | '' id?: string inert?: boolean | '' lang?: string slot?: string /** * This attribute is enumerated and not Boolean. A value of `true` or `false` is mandatory, and shorthand like `<input spellcheck>` is forbidden. The correct usage is `<input spellcheck="true">` * @see https://developer.mozilla.org/en-US/docs/Glossary/Enumerated */ spellcheck?: 'true' | 'false' style?: string | CSSProperties tabIndex?: Numeric title?: string translate?: 'yes' | 'no' // Unknown radioGroup?: string // <command>, <menuitem> // RDFa Attributes about?: string datatype?: string inlist?: any property?: string resource?: string typeof?: string vocab?: string autocapitalize?: 'none' | 'off' | 'on' | 'sentences' | 'words' | 'characters' /** * Non-standard attribute. Safari only. A string which indicates whether to activate automatic correction while the user is editing this field */ autocorrect?: 'on' | 'off' autosave?: string color?: Property.Color itemProp?: string itemScope?: boolean | '' itemType?: string itemID?: string itemRef?: string results?: Numeric security?: string unselectable?: 'on' | 'off' /** * Hints at the type of data that might be entered by the user while editing the element or its contents * @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute */ inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' /** * Specify that a standard HTML element should behave like a defined custom built-in element * @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is */ is?: string popover?: boolean | 'auto' | 'manual' | 'hint' | '' /** * A space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the `::part` pseudo-element. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part */ part?: string /** * Allows you to select and style elements existing in nested shadow trees, by exporting their `part` names. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts */ exportparts?: string /** * Used to indicate that an element is flagged for tracking by `PerformanceObserver` objects using the "element" type. * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/elementtiming */ elementTiming?: string /** * This is an experimental technology * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/virtualkeyboardpolicy */ virtualkeyboardpolicy?: 'auto' | 'manual' /** * In browsers that support them, writing suggestions are enabled by default. To disable them, set the writingsuggestions attribute's value to `false`. Setting the attribute's value to `true`, or omitting the value, enables writing suggestions * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/writingsuggestions */ writingsuggestions?: Booleanish | '' } interface JSXDirectives<T> { // Attributes [key: `attr:${string}`]: string | number | bigint | null | undefined // Properties 'prop:nodeValue'?: string | null 'prop:classList'?: string 'prop:className'?: string 'prop:id'?: string 'prop:innerHTML'?: string 'prop:outerHTML'?: string 'prop:part'?: string 'prop:scrollLeft'?: number 'prop:scrollTop'?: number 'prop:slot'?: string 'prop:accessKey'?: string 'prop:autocapitalize'?: 'none' | 'off' | 'on' | 'sentences' | 'words' | 'characters' 'prop:autocorrect'?: 'on' | 'off' 'prop:autofocus'?: boolean 'prop:contentEditable'?: 'true' | 'false' | 'plaintext-only' 'prop:dir'?: DirName | 'auto' | '' 'prop:draggable'?: 'true' | 'false' 'prop:enterKeyHint'?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' 'prop:hidden'?: boolean 'prop:inert'?: boolean 'prop:innerText'?: string 'prop:inputMode'?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' 'prop:lang'?: string 'prop:outerText'?: string 'prop:popover'?: 'auto' | 'manual' | 'hint' | null 'prop:spellcheck'?: 'true' | 'false' 'prop:tabIndex'?: number 'prop:title'?: string 'prop:translate'?: 'yes' | 'no' 'prop:virtualKeyboardPolicy'?: 'auto' | 'manual' 'prop:writingSuggestions'?: 'true' | 'false' [key: `prop:${string}`]: any // Event Listeners // ClipboardEvent 'on:copy'?: ClipboardEventListener<T> 'on:cut'?: ClipboardEventListener<T> 'on:paste'?: ClipboardEventListener<T> // CompositionEvent 'on:compositionEnd'?: CompositionEventListener<T> 'on:compositionStart'?: CompositionEventListener<T> 'on:compositionUpdate'?: CompositionEventListener<T> // FocusEvent 'on:focus'?: FocusEventListener<T> 'on:blur'?: FocusEventListener<T> 'on:focusIn'?: FocusEventListener<T> 'on:focusOut'?: FocusEventListener<T> // InputEvent 'on:beforeInput'?: InputEventListener<T> 'on:input'?: InputEventListener<T> // [Form] Event 'on:change'?: EventListener<T> 'on:reset'?: EventListener<T> 'on:invalid'?: EventListener<T> // Event 'on:load'?: EventListener<T> 'on:error'?: EventListener<T> 'on:select'?: EventListener<T> // SubmitEvent 'on:submit'?: SubmitEventListener<T> // KeyboardEvent 'on:keyDown'?: KeyboardEventListener<T> /** * This feature is no longer recommended. * Since event has been deprecated, you should use `on:beforeInput` or `on:keyDown` instead * @deprecated */ 'on:keyPress'?: KeyboardEventListener<T> 'on:keyUp'?: KeyboardEventListener<T> // [Media] Event 'on:abort'?: EventListener<T> 'on:canPlay'?: EventListener<T> 'on:canPlayThrough'?: EventListener<T> 'on:durationChange'?: EventListener<T> 'on:emptied'?: EventListener<T> 'on:ended'?: EventListener<T> 'on:loadedData'?: EventListener<T> 'on:loadedMetadata'?: EventListener<T> 'on:loadStart'?: EventListener<T> 'on:pause'?: EventListener<T> 'on:play'?: EventListener<T> 'on:playing'?: EventListener<T> 'on:progress'?: EventListener<T> 'on:rateChange'?: EventListener<T> 'on:seeked'?: EventListener<T> 'on:seeking'?: EventListener<T> 'on:stalled'?: EventListener<T> 'on:suspend'?: EventListener<T> 'on:timeUpdate'?: EventListener<T> 'on:volumeChange'?: EventListener<T> 'on:waiting'?: EventListener<T> // MouseEvent 'on:auxclick'?: MouseEventListener<T> 'on:click'?: MouseEventListener<T> 'on:contextMenu'?: MouseEventListener<T> 'on:dblClick'?: MouseEventListener<T> 'on:mouseDown'?: MouseEventListener<T> 'on:mouseEnter'?: MouseEventListener<T> 'on:mouseLeave'?: MouseEventListener<T> 'on:mouseMove'?: MouseEventListener<T> 'on:mouseOut'?: MouseEventListener<T> 'on:mouseOver'?: MouseEventListener<T> 'on:mouseUp'?: MouseEventListener<T> // DragEvent 'on:drag'?: DragEventListener<T> 'on:dragEnd'?: DragEventListener<T> 'on:dragEnter'?: DragEventListener<T> /** @deprecated */ 'on:dragExit'?: DragEventListener<T> 'on:dragLeave'?: DragEventListener<T> 'on:dragOver'?: DragEventListener<T> 'on:dragStart'?: DragEventListener<T> 'on:drop'?: DragEventListener<T> // TouchEvent 'on:touchCancel'?: TouchEventListener<T> 'on:touchEnd'?: TouchEventListener<T> 'on:touchMove'?: TouchEventListener<T> 'on:touchStart'?: TouchEventListener<T> // PointerEvent 'on:pointerDown'?: PointerEventListener<T> 'on:pointerMove'?: PointerEventListener<T> 'on:pointerUp'?: PointerEventListener<T> 'on:pointerCancel'?: PointerEventListener<T> 'on:pointerEnter'?: PointerEventListener<T> 'on:pointerLeave'?: PointerEventListener<T> 'on:pointerOver'?: PointerEventListener<T> 'on:pointerOut'?: PointerEventListener<T> 'on:gotPointerCapture'?: PointerEventListener<T> 'on:lostPointerCapture'?: PointerEventListener<T> // UIEvent 'on:scroll'?: UIEventListener<T> 'on:scrollEnd'?: UIEventListener<T> // WheelEvent 'on:wheel'?: WheelEventListener<T> // AnimationEvent 'on:animationStart'?: AnimationEventListener<T> 'on:animationEnd'?: AnimationEventListener<T> 'on:animationIteration'?: AnimationEventListener<T> 'on:animationCancel'?: AnimationEventListener<T> // TransitionEvent 'on:transitionStart'?: TransitionEventListener<T> 'on:transitionEnd'?: TransitionEventListener<T> 'on:transitionRun'?: TransitionEventListener<T> 'on:transitionCancel'?: TransitionEventListener<T> // Fullscreen API 'on:fullscreenChange'?: EventListener<T> 'on:fullscreenError'?: EventListener<T> // ToggleEvent 'on:beforeToggle'?: ToggleEventListener<T> 'on:toggle'?: ToggleEventListener<T> // ContentVisibilityAutoStateChangeEvent 'on:contentVisibilityAutoStateChange'?: ContentVisibilityAutoStateChangeEventListener<T> // CommandEvent 'on:command'?: CommandEventListener<T> } interface HTMLAttributes<T> extends AriaAttributes, Attributes, JSXDirectives<T> { _?: string $?: Record<string, EventListener<T>> ref?: Ref<T> | false | null | undefined | (Ref<T> | false | null | undefined)[] children?: JSXChild | JSXChild[] // ClipboardEvent /** @deprecated use `on:copy` instead */ oncopy?: ClipboardEventHandler<T> /** @deprecated use `on:cut` instead */ oncut?: ClipboardEventHandler<T> /** @deprecated use `on:paste` instead */ onpaste?: ClipboardEventHandler<T> // CompositionEvent /** @deprecated use `on:compositionEnd` instead */ oncompositionend?: CompositionEventHandler<T> /** @deprecated use `on:compositionStart` instead */ oncompositionstart?: CompositionEventHandler<T> /** @deprecated use `on:compositionUpdate` instead */ oncompositionupdate?: CompositionEventHandler<T> // FocusEvent /** @deprecated use `on:focus` instead */ onfocus?: FocusEventHandler<T> /** @deprecated use `on:blur` instead */ onblur?: FocusEventHandler<T> // InputEvent /** @deprecated use `on:beforeInput` instead */ onbeforeinput?: InputEventHandler<T> /** @deprecated use `on:input` instead */ oninput?: InputEventHandler<T> // [Form] Event /** @deprecated use `on:change` instead */ onchange?: GenericEventHandler<T> /** @deprecated use `on:reset` instead */ onreset?: GenericEventHandler<T> /** @deprecated use `on:invalid` instead */ oninvalid?: GenericEventHandler<T> // Event /** @deprecated use `on:load` instead */ onload?: GenericEventHandler<T> /** @deprecated use `on:error` instead */ onerror?: GenericEventHandler<T> /** @deprecated use `on:select` instead */ onselect?: GenericEventHandler<T> // SubmitEvent /** @deprecated use `on:submit` instead */ onsubmit?: SubmitEventHandler<T> // KeyboardEvent /** @deprecated use `on:keyDown` instead */ onkeydown?: KeyboardEventHandler<T> /** * This feature is no longer recommended. * Since event has been deprecated, you should use `on:beforeInput` or `on:keyDown` instead * @deprecated */ onkeypress?: KeyboardEventHandler<T> /** @deprecated use `on:keyUp` instead */ onkeyup?: KeyboardEventHandler<T> // [Media] Event /** @deprecated use `on:abort` instead */ onabort?: GenericEventHandler<T> /** @deprecated use `on:canPlay` instead */ oncanplay?: GenericEventHandler<T> /** @deprecated use `on:canPlayThrough` instead */ oncanplaythrough?: GenericEventHandler<T> /** @deprecated use `on:durationChange` instead */ ondurationchange?: GenericEventHandler<T> /** @deprecated use `on:emptied` instead */ onemptied?: GenericEventHandler<T> /** @deprecated use `on:ended` instead */ onended?: GenericEventHandler<T> /** @deprecated use `on:loadedData` instead */ onloadeddata?: GenericEventHandler<T> /** @deprecated use `on:loadedMetadata` instead */ onloadedmetadata?: GenericEventHandler<T> /** @deprecated use `on:loadStart` instead */ onloadstart?: GenericEventHandler<T> /** @deprecated use `on:pause` instead */ onpause?: GenericEventHandler<T> /** @deprecated use `on:play` instead */ onplay?: GenericEventHandler<T> /** @deprecated use `on:playing` instead */ onplaying?: GenericEventHandler<T> /** @deprecated use `on:progress` instead */ onprogress?: GenericEventHandler<T> /** @deprecated use `on:rateChange` instead */ onratechange?: GenericEventHandler<T> /** @deprecated use `on:seeked` instead */ onseeked?: GenericEventHandler<T> /** @deprecated use `on:seeking` instead */ onseeking?: GenericEventHandler<T> /** @deprecated use `on:stalled` instead */ onstalled?: GenericEventHandler<T> /** @deprecated use `on:suspend` instead */ onsuspend?: GenericEventHandler<T> /** @deprecated use `on:timeUpdate` instead */ ontimeupdate?: GenericEventHandler<T> /** @deprecated use `on:volumeChange` instead */ onvolumechange?: GenericEventHandler<T> /** @deprecated use `on:waiting` instead */ onwaiting?: GenericEventHandler<T> // MouseEvent /** @deprecated use `on:auxclick` instead */ onauxclick?: MouseEventHandler<T> /** @deprecated use `on:click` instead */ onclick?: MouseEventHandler<T> /** @deprecated use `on:contextMenu` instead */ oncontextmenu?: MouseEventHandler<T> /** @deprecated use `on:dblClick` instead */ ondblclick?: MouseEventHandler<T> /** @deprecated use `on:mouseDown` instead */ onmousedown?: MouseEventHandler<T> /** @deprecated use `on:mouseEnter` instead */ onmouseenter?: MouseEventHandler<T> /** @deprecated use `on:mouseLeave` instead */ onmouseleave?: MouseEventHandler<T> /** @deprecated use `on:mouseMove` instead */ onmousemove?: MouseEventHandler<T> /** @deprecated use `on:mouseOut` instead */ onmouseout?: MouseEventHandler<T> /** @deprecated use `on:mouseOver` instead */ onmouseover?: MouseEventHandler<T> /** @deprecated use `on:mouseUp` instead */ onmouseup?: MouseEventHandler<T> // DragEvent /** @deprecated use `on:drag` instead */ ondrag?: DragEventHandler<T> /** @deprecated use `on:dragEnd` instead */ ondragend?: DragEventHandler<T> /** @deprecated use `on:dragEnter` instead */ ondragenter?: DragEventHandler<T> /** @deprecated use `on:dragExit` instead */ ondragexit?: DragEventHandler<T> /** @deprecated use `on:dragLeave` instead */ ondragleave?: DragEventHandler<T> /** @deprecated use `on:dragOver` instead */ ondragover?: DragEventHandler<T> /** @deprecated use `on:dragStart` instead */ ondragstart?: DragEventHandler<T> /** @deprecated use `on:drop` instead */ ondrop?: DragEventHandler<T> // TouchEvent /** @deprecated use `on:touchCancel` instead */ ontouchcancel?: TouchEventHandler<T> /** @deprecated use `on:touchEnd` instead */ ontouchend?: TouchEventHandler<T> /** @deprecated use `on:touchMove` instead */ ontouchmove?: TouchEventHandler<T> /** @deprecated use `on:touchStart` instead */ ontouchstart?: TouchEventHandler<T> // PointerEvent /** @deprecated use `on:pointerDown` instead */ onpointerdown?: PointerEventHandler<T> /** @deprecated use `on:pointerMove` instead */ onpointermove?: PointerEventHandler<T> /** @deprecated use `on:pointerUp` instead */ onpointerup?: PointerEventHandler<T> /** @deprecated use `on:pointerCancel` instead */ onpointercancel?: PointerEventHandler<T> /** @deprecated use `on:pointerEnter` instead */ onpointerenter?: PointerEventHandler<T> /** @deprecated use `on:pointerLeave` instead */ onpointerleave?: PointerEventHandler<T> /** @deprecated use `on:pointerOver` instead */ onpointerover?: PointerEventHandler<T> /** @deprecated use `on:pointerOut` instead */ onpointerout?: PointerEventHandler<T> /** @deprecated use `on:gotPointerCapture` instead */ ongotpointercapture?: PointerEventHandler<T> /** @deprecated use `on:lostPointerCapture` instead */ onlostpointercapture?: PointerEventHandler<T> // UIEvent /** @deprecated use `on:scroll` instead */ onscroll?: UIEventHandler<T> /** @deprecated use `on:scrollEnd` instead */ onscrollend?: UIEventHandler<T> // WheelEvent /** @deprecated use `on:wheel` instead */ onwheel?: WheelEventHandler<T> // AnimationEvent /** @deprecated use `on:animationStart` instead */ onanimationstart?: AnimationEventHandler<T> /** @deprecated use `on:animationEnd` instead */ onanimationend?: AnimationEventHandler<T> /** @deprecated use `on:animationIteration` instead */ onanimationiteration?: AnimationEventHandler<T> /** @deprecated use `on:animationCancel` instead */ onanimationcancel?: AnimationEventHandler<T> // TransitionEvent /** @deprecated use `on:transitionStart` instead */ ontransitionstart?: TransitionEventHandler<T> /** @deprecated use `on:transitionEnd` instead */ ontransitionend?: TransitionEventHandler<T> /** @deprecated use `on:transitionRun` instead */ ontransitionrun?: TransitionEventHandler<T> /** @deprecated use `on:transitionCancel` instead */ ontransitioncancel?: TransitionEventHandler<T> // Fullscreen API /** @deprecated use `on:fullscreenChange` instead */ onfullscreenchange?: GenericEventHandler<T> /** @deprecated use `on:fullscreenError` instead */ onfullscreenerror?: GenericEventHandler<T> // ToggleEvent /** @deprecated use `on:beforeToggle` instead */ onbeforetoggle?: ToggleEventHandler<T> /** @deprecated use `on:toggle` instead */ ontoggle?: ToggleEventHandler<T> // ContentVisibilityAutoStateChangeEvent /** @deprecated use `on:contentVisibilityAutoStateChange` instead */ oncontentvisibilityautostatechange?: ContentVisibilityAutoStateChangeEventHandler<T> // CommandEvent /** @deprecated use `on:command` instead */ oncommand?: CommandEventHandler<T> } interface SVGAttributes<T extends EventTarget> extends HTMLAttributes<T> { _?: typeof svgNs xmlns?: typeof svgNs href?: string cx?: number | string cy?: number | string fx?: number | string fy?: number | string fr?: string d?: string /** * The `accent-height` attribute defines the distance from the origin to the top of accent characters, measured by a distance within the font coordinate system * @deprecated */ 'accent-height'?: Numeric accumulate?: 'none' | 'sum' additive?: 'replace' | 'sum' 'alignment-baseline'?: Property.AlignmentBaseline allowReorder?: 'no' | 'yes' /** @deprecated */ alphabetic?: number | string amplitude?: Numeric /** @deprecated */ 'arabic-form'?: 'initial' | 'medial' | 'terminal' | 'isolated' /** * The `ascent` attribute defines the maximum unaccented height of the font within the font coordinate system * @deprecated */ ascent?: Numeric attributeName?: string /** @deprecated */ attributeType?: 'CSS' | 'XML' | 'auto' autoReverse?: number | string azimuth?: Numeric baseFrequency?: number | string 'baseline-shift'?: Property.BaselineShift baseProfile?: number | string /** @deprecated */ bbox?: number | string begin?: number | string bias?: Numeric by?: number | string calcMode?: 'discrete' | 'linear' | 'paced' | 'spline' /** @deprecated */ 'cap-height'?: number | string /** @deprecated */ clip?: Property.Clip 'clip-path'?: Property.ClipPath clipPathUnits?: 'userSpaceOnUse' | 'objectBoundingBox' 'clip-rule'?: Property.ClipRule 'color-interpolation'?: Property.ColorInterpolation 'color-interpolation-filters'?: Property.ColorInterpolation /** @deprecated */ 'color-profile'?: Property.Color /** @deprecated */ 'color-rendering'?: Property.ColorRendering /** @deprecated */ contentScriptType?: string /** @deprecated */ contentStyleType?: string cursor?: Property.Cursor decelerate?: number | string descent?: number | string diffuseConstant?: Numeric direction?: Property.Direction display?: Property.Display divisor?: number | string 'dominant-baseline'?: Property.DominantBaseline dur?: number | string dx?: number | string dy?: number | string edgeMode?: 'duplicate' | 'wrap' | 'none' elevation?: Numeric /** @deprecated */ 'enable-background'?: number | string end?: number | string exponent?: Numeric /** @deprecated */ externalResourcesRequired?: 'true' | 'false' fill?: Property.Fill 'fill-opacity'?: Property.FillOpacity 'fill-rule'?: Property.FillRule filter?: Property.Filter /** @deprecated */ filterRes?: number | string filterUnits?: 'userSpaceOnUse' | 'objectBoundingBox' 'flood-color'?: Property.FloodColor 'flood-opacity'?: Property.FillOpacity focusable?: 'true' | 'false' | 'auto' focusHighlight?: 'auto' | 'none' 'font-family'?: Property.FontFamily 'font-size'?: Property.FontSize 'font-size-adjust'?: Property.FontSizeAdjust 'font-stretch'?: Property.FontStretch 'font-style'?: Property.FontStyle 'font-variant'?: Property.FontVariant 'font-weight'?: Property.FontWeight /** @deprecated */ format?: string from?: number | string /** @deprecated */ g1?: number | string /** @deprecated */ g2?: number | string /** @deprecated */ 'glyph-name'?: string /** @deprecated */ 'glyph-orientation-horizontal'?: string /** @deprecated */ 'glyph-orientation-vertical'?: Property.GlyphOrientationVertical /** @deprecated */ glyphRef?: string gradientTransform?: string gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox' /** @deprecated */ hanging?: Numeric /** @deprecated */ 'horiz-adv-x'?: Numeric /** @deprecated */ 'horiz-origin-x'?: Numeric /** @deprecated */ 'horiz-origin-y'?: Numeric /** @deprecated */ ideographic?: Numeric 'image-rendering'?: 'auto' | 'optimizeQuality' | 'optimizeSpeed' | 'inherit' in2?: string in?: string intercept?: Numeric k1?: Numeric k2?: Numeric k3?: Numeric k4?: Numeric /** @deprecated */ k?: Numeric kernelMatrix?: number | string /** @deprecated */ kernelUnitLength?: number | string /** @deprecated */ kerning?: number | string keyPoints?: number | string keySplines?: number | string keyTimes?: number | string lang?: string lengthAdjust?: 'spacing' | 'spacingAndGlyphs' 'letter-spacing'?: Property.LetterSpacing 'lighting-color'?: Property.LightingColor limitingConeAngle?: Numeric marker?: Property.Marker 'marker-start'?: Property.MarkerStart 'marker-end'?: Property.MarkerEnd 'marker-mid'?: Property.MarkerMid markerHeight?: number | string markerUnits?: 'userSpaceOnUse' | 'strokeWidth' markerWidth?: number | string local?: string mask?: Property.Mask maskContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox' maskUnits?: 'userSpaceOnUse' | 'objectBoundingBox' /** @deprecated */ mathematical?: Numeric max?: string min?: string media?: string method?: 'align' | 'stretch' mode?: string name?: string numOctaves?: Numeric offset?: Property.Offset opacity?: Property.Opacity operator?: 'over' | 'in' | 'out' | 'atop' | 'xor' | 'lighter' | 'arithmetic' | 'erode' | 'dilate' order?: Property.Order orient?: 'auto' | 'auto-start-reverse' | number | AnyString /** @deprecated */ orientation?: 'h' | 'v' origin?: 'default' | AnyString overflow?: Property.Overflow 'overline-position'?: Numeric 'overline-thickness'?: Numeric 'paint-order'?: Property.PaintOrder /** @deprecated */ 'panose-1'?: string path?: string pathLength?: Numeric patternContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox' patternTransform?: string patternUnits?: 'userSpaceOnUse' | 'objectBoundingBox' 'pointer-events'?: Property.PointerEvents points?: string pointsAtX?: Numeric pointsAtY?: Numeric pointsAtZ?: Numeric preserveAlpha?: 'true' | 'false' preserveAspectRatio?: string primitiveUnits?: 'userSpaceOnUse' | 'objectBoundingBox' r?: number | string radius?: number | string refX?: 'left' | 'center' | 'right' | number | AnyString refY?: 'top' | 'center' | 'bottom' | number | AnyString renderingIntent?: number | string repeatCount?: 'indefinite' | Numeric repeatDur?: 'indefinite' | number | AnyString requiredExtensions?: number | string /** @deprecated */ requiredFeatures?: string restart?: 'always' | 'whenNotActive' | 'never' result?: string rotate?: Numeric | 'auto' | 'auto-reverse' rx?: 'auto' | number | AnyString ry?: 'auto' | number | AnyString scale?: Numeric seed?: Numeric 'shape-rendering'?: Property.ShapeRendering side?: 'left' | 'right' /** @deprecated */ slope?: Numeric spacing?: 'auto' | 'exact' specularConstant?: Numeric specularExponent?: Numeric speed?: number | string spreadMethod?: 'pad' | 'reflect' | 'repeat' star