UNPKG

solid-js

Version:

A declarative JavaScript library for building user interfaces.

1,236 lines (1,220 loc) 95.1 kB
import * as csstype from "csstype"; /** * Based on JSX types for Surplus and Inferno and adapted for `dom-expressions`. * * https://github.com/adamhaile/surplus/blob/master/index.d.ts * https://github.com/infernojs/inferno/blob/master/packages/inferno/src/core/types.ts */ type DOMElement = Element; export namespace JSX { type Element = Node | ArrayElement | (string & {}) | number | boolean | null | undefined; interface ArrayElement extends Array<Element> {} interface ElementClass { // empty, libs can define requirements downstream } interface ElementAttributesProperty { // empty, libs can define requirements downstream } interface ElementChildrenAttribute { children: {}; } interface EventHandler<T, E extends Event> { ( e: E & { currentTarget: T; target: DOMElement; } ): void; } interface BoundEventHandler< T, E extends Event, EHandler extends EventHandler<T, any> = EventHandler<T, E> > { 0: (data: any, ...e: Parameters<EHandler>) => void; 1: any; } type EventHandlerUnion< T, E extends Event, EHandler extends EventHandler<T, any> = EventHandler<T, E> > = EHandler | BoundEventHandler<T, E, EHandler>; interface EventHandlerWithOptions<T, E extends Event, EHandler = EventHandler<T, E>> extends AddEventListenerOptions { handleEvent: EHandler; } type EventHandlerWithOptionsUnion< T, E extends Event, EHandler extends EventHandler<T, any> = EventHandler<T, E> > = EHandler | EventHandlerWithOptions<T, E, EHandler>; interface InputEventHandler<T, E extends InputEvent> { ( e: E & { currentTarget: T; target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement ? T : DOMElement; } ): void; } type InputEventHandlerUnion<T, E extends InputEvent> = EventHandlerUnion< T, E, InputEventHandler<T, E> >; interface ChangeEventHandler<T, E extends Event> { ( e: E & { currentTarget: T; target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement ? T : DOMElement; } ): void; } type ChangeEventHandlerUnion<T, E extends Event> = EventHandlerUnion< T, E, ChangeEventHandler<T, E> >; interface FocusEventHandler<T, E extends FocusEvent> { ( e: E & { currentTarget: T; target: T extends HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement ? T : DOMElement; } ): void; } type FocusEventHandlerUnion<T, E extends FocusEvent> = EventHandlerUnion< T, E, FocusEventHandler<T, E> >; const SERIALIZABLE: unique symbol; interface SerializableAttributeValue { toString(): string; [SERIALIZABLE]: never; } interface IntrinsicAttributes { ref?: unknown | ((e: unknown) => void) | undefined; } interface CustomAttributes<T> { ref?: T | ((el: T) => void) | undefined; classList?: | { [k: string]: boolean | undefined; } | undefined; $ServerOnly?: boolean | undefined; } type Accessor<T> = () => T; interface Directives {} interface DirectiveFunctions { [x: string]: (el: DOMElement, accessor: Accessor<any>) => void; } interface ExplicitProperties {} interface ExplicitAttributes {} interface ExplicitBoolAttributes {} interface CustomEvents {} /** @deprecated Replaced by CustomEvents */ interface CustomCaptureEvents {} type DirectiveAttributes = { [Key in keyof Directives as `use:${Key}`]?: Directives[Key]; }; type DirectiveFunctionAttributes<T> = { [K in keyof DirectiveFunctions as string extends K ? never : `use:${K}`]?: DirectiveFunctions[K] extends ( el: infer E, // will be unknown if not provided ...rest: infer R // use rest so that we can check whether it's provided or not ) => void ? T extends E // everything extends unknown if E is unknown ? R extends [infer A] // check if has accessor provided ? A extends Accessor<infer V> ? V // it's an accessor : never // it isn't, type error : true // no accessor provided : never // T is the wrong element : never; // it isn't a function }; type PropAttributes = { [Key in keyof ExplicitProperties as `prop:${Key}`]?: ExplicitProperties[Key]; }; type AttrAttributes = { [Key in keyof ExplicitAttributes as `attr:${Key}`]?: ExplicitAttributes[Key]; }; type BoolAttributes = { [Key in keyof ExplicitBoolAttributes as `bool:${Key}`]?: ExplicitBoolAttributes[Key]; }; type OnAttributes<T> = { [Key in keyof CustomEvents as `on:${Key}`]?: EventHandlerWithOptionsUnion<T, CustomEvents[Key]>; }; type OnCaptureAttributes<T> = { [Key in keyof CustomCaptureEvents as `oncapture:${Key}`]?: EventHandler< T, CustomCaptureEvents[Key] >; }; interface DOMAttributes<T> extends CustomAttributes<T>, DirectiveAttributes, DirectiveFunctionAttributes<T>, PropAttributes, AttrAttributes, BoolAttributes, OnAttributes<T>, OnCaptureAttributes<T>, CustomEventHandlersCamelCase<T>, CustomEventHandlersLowerCase<T>, CustomEventHandlersNamespaced<T> { children?: Element | undefined; innerHTML?: string | undefined; innerText?: string | number | undefined; textContent?: string | number | undefined; // camel case events onCopy?: EventHandlerUnion<T, ClipboardEvent> | undefined; onCut?: EventHandlerUnion<T, ClipboardEvent> | undefined; onPaste?: EventHandlerUnion<T, ClipboardEvent> | undefined; onCompositionEnd?: EventHandlerUnion<T, CompositionEvent> | undefined; onCompositionStart?: EventHandlerUnion<T, CompositionEvent> | undefined; onCompositionUpdate?: EventHandlerUnion<T, CompositionEvent> | undefined; onFocusOut?: FocusEventHandlerUnion<T, FocusEvent> | undefined; onFocusIn?: FocusEventHandlerUnion<T, FocusEvent> | undefined; onEncrypted?: EventHandlerUnion<T, Event> | undefined; onDragExit?: EventHandlerUnion<T, DragEvent> | undefined; // lower case events oncopy?: EventHandlerUnion<T, ClipboardEvent> | undefined; oncut?: EventHandlerUnion<T, ClipboardEvent> | undefined; onpaste?: EventHandlerUnion<T, ClipboardEvent> | undefined; oncompositionend?: EventHandlerUnion<T, CompositionEvent> | undefined; oncompositionstart?: EventHandlerUnion<T, CompositionEvent> | undefined; oncompositionupdate?: EventHandlerUnion<T, CompositionEvent> | undefined; onfocusout?: FocusEventHandlerUnion<T, FocusEvent> | undefined; onfocusin?: FocusEventHandlerUnion<T, FocusEvent> | undefined; onencrypted?: EventHandlerUnion<T, Event> | undefined; ondragexit?: EventHandlerUnion<T, DragEvent> | undefined; // lower case events "on:copy"?: EventHandlerWithOptionsUnion<T, ClipboardEvent> | undefined; "on:cut"?: EventHandlerWithOptionsUnion<T, ClipboardEvent> | undefined; "on:paste"?: EventHandlerWithOptionsUnion<T, ClipboardEvent> | undefined; "on:compositionend"?: EventHandlerWithOptionsUnion<T, CompositionEvent> | undefined; "on:compositionstart"?: EventHandlerWithOptionsUnion<T, CompositionEvent> | undefined; "on:compositionupdate"?: EventHandlerWithOptionsUnion<T, CompositionEvent> | undefined; "on:focusout"?: | EventHandlerWithOptionsUnion<T, FocusEvent, FocusEventHandler<T, FocusEvent>> | undefined; "on:focusin"?: | EventHandlerWithOptionsUnion<T, FocusEvent, FocusEventHandler<T, FocusEvent>> | undefined; "on:encrypted"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:dragexit"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; } interface CustomEventHandlersCamelCase<T> { onAbort?: EventHandlerUnion<T, Event> | undefined; onAnimationEnd?: EventHandlerUnion<T, AnimationEvent> | undefined; onAnimationIteration?: EventHandlerUnion<T, AnimationEvent> | undefined; onAnimationStart?: EventHandlerUnion<T, AnimationEvent> | undefined; onAuxClick?: EventHandlerUnion<T, MouseEvent> | undefined; onBeforeInput?: InputEventHandlerUnion<T, InputEvent> | undefined; onBeforeToggle?: EventHandlerUnion<T, ToggleEvent> | undefined; onBlur?: FocusEventHandlerUnion<T, FocusEvent> | undefined; onCanPlay?: EventHandlerUnion<T, Event> | undefined; onCanPlayThrough?: EventHandlerUnion<T, Event> | undefined; onChange?: ChangeEventHandlerUnion<T, Event> | undefined; onClick?: EventHandlerUnion<T, MouseEvent> | undefined; onContextMenu?: EventHandlerUnion<T, MouseEvent> | undefined; onDblClick?: EventHandlerUnion<T, MouseEvent> | undefined; onDrag?: EventHandlerUnion<T, DragEvent> | undefined; onDragEnd?: EventHandlerUnion<T, DragEvent> | undefined; onDragEnter?: EventHandlerUnion<T, DragEvent> | undefined; onDragLeave?: EventHandlerUnion<T, DragEvent> | undefined; onDragOver?: EventHandlerUnion<T, DragEvent> | undefined; onDragStart?: EventHandlerUnion<T, DragEvent> | undefined; onDrop?: EventHandlerUnion<T, DragEvent> | undefined; onDurationChange?: EventHandlerUnion<T, Event> | undefined; onEmptied?: EventHandlerUnion<T, Event> | undefined; onEnded?: EventHandlerUnion<T, Event> | undefined; onError?: EventHandlerUnion<T, Event> | undefined; onFocus?: FocusEventHandlerUnion<T, FocusEvent> | undefined; onGotPointerCapture?: EventHandlerUnion<T, PointerEvent> | undefined; onInput?: InputEventHandlerUnion<T, InputEvent> | undefined; onInvalid?: EventHandlerUnion<T, Event> | undefined; onKeyDown?: EventHandlerUnion<T, KeyboardEvent> | undefined; onKeyPress?: EventHandlerUnion<T, KeyboardEvent> | undefined; onKeyUp?: EventHandlerUnion<T, KeyboardEvent> | undefined; onLoad?: EventHandlerUnion<T, Event> | undefined; onLoadedData?: EventHandlerUnion<T, Event> | undefined; onLoadedMetadata?: EventHandlerUnion<T, Event> | undefined; onLoadStart?: EventHandlerUnion<T, Event> | undefined; onLostPointerCapture?: EventHandlerUnion<T, PointerEvent> | undefined; onMouseDown?: EventHandlerUnion<T, MouseEvent> | undefined; onMouseEnter?: EventHandlerUnion<T, MouseEvent> | undefined; onMouseLeave?: EventHandlerUnion<T, MouseEvent> | undefined; onMouseMove?: EventHandlerUnion<T, MouseEvent> | undefined; onMouseOut?: EventHandlerUnion<T, MouseEvent> | undefined; onMouseOver?: EventHandlerUnion<T, MouseEvent> | undefined; onMouseUp?: EventHandlerUnion<T, MouseEvent> | undefined; onPause?: EventHandlerUnion<T, Event> | undefined; onPlay?: EventHandlerUnion<T, Event> | undefined; onPlaying?: EventHandlerUnion<T, Event> | undefined; onPointerCancel?: EventHandlerUnion<T, PointerEvent> | undefined; onPointerDown?: EventHandlerUnion<T, PointerEvent> | undefined; onPointerEnter?: EventHandlerUnion<T, PointerEvent> | undefined; onPointerLeave?: EventHandlerUnion<T, PointerEvent> | undefined; onPointerMove?: EventHandlerUnion<T, PointerEvent> | undefined; onPointerOut?: EventHandlerUnion<T, PointerEvent> | undefined; onPointerOver?: EventHandlerUnion<T, PointerEvent> | undefined; onPointerUp?: EventHandlerUnion<T, PointerEvent> | undefined; onProgress?: EventHandlerUnion<T, ProgressEvent> | undefined; onRateChange?: EventHandlerUnion<T, Event> | undefined; onReset?: EventHandlerUnion<T, Event> | undefined; onScroll?: EventHandlerUnion<T, Event> | undefined; onScrollEnd?: EventHandlerUnion<T, Event> | undefined; onSeeked?: EventHandlerUnion<T, Event> | undefined; onSeeking?: EventHandlerUnion<T, Event> | undefined; onSelect?: EventHandlerUnion<T, Event> | undefined; onStalled?: EventHandlerUnion<T, Event> | undefined; onSubmit?: EventHandlerUnion<T, SubmitEvent> | undefined; onSuspend?: EventHandlerUnion<T, Event> | undefined; onTimeUpdate?: EventHandlerUnion<T, Event> | undefined; onToggle?: EventHandlerUnion<T, ToggleEvent> | undefined; onTouchCancel?: EventHandlerUnion<T, TouchEvent> | undefined; onTouchEnd?: EventHandlerUnion<T, TouchEvent> | undefined; onTouchMove?: EventHandlerUnion<T, TouchEvent> | undefined; onTouchStart?: EventHandlerUnion<T, TouchEvent> | undefined; onTransitionStart?: EventHandlerUnion<T, TransitionEvent> | undefined; onTransitionEnd?: EventHandlerUnion<T, TransitionEvent> | undefined; onTransitionRun?: EventHandlerUnion<T, TransitionEvent> | undefined; onTransitionCancel?: EventHandlerUnion<T, TransitionEvent> | undefined; onVolumeChange?: EventHandlerUnion<T, Event> | undefined; onWaiting?: EventHandlerUnion<T, Event> | undefined; onWheel?: EventHandlerUnion<T, WheelEvent> | undefined; } /** @type {GlobalEventHandlers} */ interface CustomEventHandlersLowerCase<T> { onabort?: EventHandlerUnion<T, Event> | undefined; onanimationend?: EventHandlerUnion<T, AnimationEvent> | undefined; onanimationiteration?: EventHandlerUnion<T, AnimationEvent> | undefined; onanimationstart?: EventHandlerUnion<T, AnimationEvent> | undefined; onauxclick?: EventHandlerUnion<T, MouseEvent> | undefined; onbeforeinput?: InputEventHandlerUnion<T, InputEvent> | undefined; onbeforetoggle?: EventHandlerUnion<T, ToggleEvent> | undefined; onblur?: FocusEventHandlerUnion<T, FocusEvent> | undefined; oncanplay?: EventHandlerUnion<T, Event> | undefined; oncanplaythrough?: EventHandlerUnion<T, Event> | undefined; onchange?: ChangeEventHandlerUnion<T, Event> | undefined; onclick?: EventHandlerUnion<T, MouseEvent> | undefined; oncontextmenu?: EventHandlerUnion<T, MouseEvent> | undefined; ondblclick?: EventHandlerUnion<T, MouseEvent> | undefined; ondrag?: EventHandlerUnion<T, DragEvent> | undefined; ondragend?: EventHandlerUnion<T, DragEvent> | undefined; ondragenter?: EventHandlerUnion<T, DragEvent> | undefined; ondragleave?: EventHandlerUnion<T, DragEvent> | undefined; ondragover?: EventHandlerUnion<T, DragEvent> | undefined; ondragstart?: EventHandlerUnion<T, DragEvent> | undefined; ondrop?: EventHandlerUnion<T, DragEvent> | undefined; ondurationchange?: EventHandlerUnion<T, Event> | undefined; onemptied?: EventHandlerUnion<T, Event> | undefined; onended?: EventHandlerUnion<T, Event> | undefined; onerror?: EventHandlerUnion<T, Event> | undefined; onfocus?: FocusEventHandlerUnion<T, FocusEvent> | undefined; ongotpointercapture?: EventHandlerUnion<T, PointerEvent> | undefined; oninput?: InputEventHandlerUnion<T, InputEvent> | undefined; oninvalid?: EventHandlerUnion<T, Event> | undefined; onkeydown?: EventHandlerUnion<T, KeyboardEvent> | undefined; onkeypress?: EventHandlerUnion<T, KeyboardEvent> | undefined; onkeyup?: EventHandlerUnion<T, KeyboardEvent> | undefined; onload?: EventHandlerUnion<T, Event> | undefined; onloadeddata?: EventHandlerUnion<T, Event> | undefined; onloadedmetadata?: EventHandlerUnion<T, Event> | undefined; onloadstart?: EventHandlerUnion<T, Event> | undefined; onlostpointercapture?: EventHandlerUnion<T, PointerEvent> | undefined; onmousedown?: EventHandlerUnion<T, MouseEvent> | undefined; onmouseenter?: EventHandlerUnion<T, MouseEvent> | undefined; onmouseleave?: EventHandlerUnion<T, MouseEvent> | undefined; onmousemove?: EventHandlerUnion<T, MouseEvent> | undefined; onmouseout?: EventHandlerUnion<T, MouseEvent> | undefined; onmouseover?: EventHandlerUnion<T, MouseEvent> | undefined; onmouseup?: EventHandlerUnion<T, MouseEvent> | undefined; onpause?: EventHandlerUnion<T, Event> | undefined; onplay?: EventHandlerUnion<T, Event> | undefined; onplaying?: EventHandlerUnion<T, Event> | undefined; onpointercancel?: EventHandlerUnion<T, PointerEvent> | undefined; onpointerdown?: EventHandlerUnion<T, PointerEvent> | undefined; onpointerenter?: EventHandlerUnion<T, PointerEvent> | undefined; onpointerleave?: EventHandlerUnion<T, PointerEvent> | undefined; onpointermove?: EventHandlerUnion<T, PointerEvent> | undefined; onpointerout?: EventHandlerUnion<T, PointerEvent> | undefined; onpointerover?: EventHandlerUnion<T, PointerEvent> | undefined; onpointerup?: EventHandlerUnion<T, PointerEvent> | undefined; onprogress?: EventHandlerUnion<T, ProgressEvent> | undefined; onratechange?: EventHandlerUnion<T, Event> | undefined; onreset?: EventHandlerUnion<T, Event> | undefined; onscroll?: EventHandlerUnion<T, Event> | undefined; onscrollend?: EventHandlerUnion<T, Event> | undefined; onseeked?: EventHandlerUnion<T, Event> | undefined; onseeking?: EventHandlerUnion<T, Event> | undefined; onselect?: EventHandlerUnion<T, Event> | undefined; onstalled?: EventHandlerUnion<T, Event> | undefined; onsubmit?: EventHandlerUnion<T, SubmitEvent> | undefined; onsuspend?: EventHandlerUnion<T, Event> | undefined; ontimeupdate?: EventHandlerUnion<T, Event> | undefined; ontoggle?: EventHandlerUnion<T, ToggleEvent> | undefined; ontouchcancel?: EventHandlerUnion<T, TouchEvent> | undefined; ontouchend?: EventHandlerUnion<T, TouchEvent> | undefined; ontouchmove?: EventHandlerUnion<T, TouchEvent> | undefined; ontouchstart?: EventHandlerUnion<T, TouchEvent> | undefined; ontransitionstart?: EventHandlerUnion<T, TransitionEvent> | undefined; ontransitionend?: EventHandlerUnion<T, TransitionEvent> | undefined; ontransitionrun?: EventHandlerUnion<T, TransitionEvent> | undefined; ontransitioncancel?: EventHandlerUnion<T, TransitionEvent> | undefined; onvolumechange?: EventHandlerUnion<T, Event> | undefined; onwaiting?: EventHandlerUnion<T, Event> | undefined; onwheel?: EventHandlerUnion<T, WheelEvent> | undefined; } interface CustomEventHandlersNamespaced<T> { "on:abort"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:animationend"?: EventHandlerWithOptionsUnion<T, AnimationEvent> | undefined; "on:animationiteration"?: EventHandlerWithOptionsUnion<T, AnimationEvent> | undefined; "on:animationstart"?: EventHandlerWithOptionsUnion<T, AnimationEvent> | undefined; "on:auxclick"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:beforeinput"?: | EventHandlerWithOptionsUnion<T, InputEvent, InputEventHandler<T, InputEvent>> | undefined; "on:beforetoggle"?: EventHandlerWithOptionsUnion<T, ToggleEvent> | undefined; "on:blur"?: | EventHandlerWithOptionsUnion<T, FocusEvent, FocusEventHandler<T, FocusEvent>> | undefined; "on:canplay"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:canplaythrough"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:change"?: EventHandlerWithOptionsUnion<T, Event, ChangeEventHandler<T, Event>> | undefined; "on:click"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:contextmenu"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:dblclick"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:drag"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; "on:dragend"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; "on:dragenter"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; "on:dragleave"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; "on:dragover"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; "on:dragstart"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; "on:drop"?: EventHandlerWithOptionsUnion<T, DragEvent> | undefined; "on:durationchange"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:emptied"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:ended"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:error"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:focus"?: | EventHandlerWithOptionsUnion<T, FocusEvent, FocusEventHandler<T, FocusEvent>> | undefined; "on:gotpointercapture"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:input"?: | EventHandlerWithOptionsUnion<T, InputEvent, InputEventHandler<T, InputEvent>> | undefined; "on:invalid"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:keydown"?: EventHandlerWithOptionsUnion<T, KeyboardEvent> | undefined; "on:keypress"?: EventHandlerWithOptionsUnion<T, KeyboardEvent> | undefined; "on:keyup"?: EventHandlerWithOptionsUnion<T, KeyboardEvent> | undefined; "on:load"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:loadeddata"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:loadedmetadata"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:loadstart"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:lostpointercapture"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:mousedown"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:mouseenter"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:mouseleave"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:mousemove"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:mouseout"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:mouseover"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:mouseup"?: EventHandlerWithOptionsUnion<T, MouseEvent> | undefined; "on:pause"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:play"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:playing"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:pointercancel"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:pointerdown"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:pointerenter"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:pointerleave"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:pointermove"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:pointerout"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:pointerover"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:pointerup"?: EventHandlerWithOptionsUnion<T, PointerEvent> | undefined; "on:progress"?: EventHandlerWithOptionsUnion<T, ProgressEvent> | undefined; "on:ratechange"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:reset"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:scroll"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:scrollend"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:seeked"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:seeking"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:select"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:stalled"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:submit"?: EventHandlerWithOptionsUnion<T, SubmitEvent> | undefined; "on:suspend"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:timeupdate"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:toggle"?: EventHandlerWithOptionsUnion<T, ToggleEvent> | undefined; "on:touchcancel"?: EventHandlerWithOptionsUnion<T, TouchEvent> | undefined; "on:touchend"?: EventHandlerWithOptionsUnion<T, TouchEvent> | undefined; "on:touchmove"?: EventHandlerWithOptionsUnion<T, TouchEvent> | undefined; "on:touchstart"?: EventHandlerWithOptionsUnion<T, TouchEvent> | undefined; "on:transitionstart"?: EventHandlerWithOptionsUnion<T, TransitionEvent> | undefined; "on:transitionend"?: EventHandlerWithOptionsUnion<T, TransitionEvent> | undefined; "on:transitionrun"?: EventHandlerWithOptionsUnion<T, TransitionEvent> | undefined; "on:transitioncancel"?: EventHandlerWithOptionsUnion<T, TransitionEvent> | undefined; "on:volumechange"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:waiting"?: EventHandlerWithOptionsUnion<T, Event> | undefined; "on:wheel"?: EventHandlerWithOptionsUnion<T, WheelEvent> | undefined; } interface CSSProperties extends csstype.PropertiesHyphen { // Override [key: `-${string}`]: string | number | undefined; } type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters"; type HTMLDir = "ltr" | "rtl" | "auto"; type HTMLFormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain"; type HTMLFormMethod = "post" | "get" | "dialog"; type HTMLCrossorigin = "anonymous" | "use-credentials" | ""; type HTMLReferrerPolicy = | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type HTMLIframeSandbox = | "allow-downloads-without-user-activation" | "allow-downloads" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocols"; type HTMLLinkAs = | "audio" | "document" | "embed" | "fetch" | "font" | "image" | "object" | "script" | "style" | "track" | "video" | "worker"; // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ interface AriaAttributes { /** * Identifies the currently active element when DOM focus is on a composite widget, textbox, * group, or application. */ "aria-activedescendant"?: string | undefined; /** * 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"?: boolean | "false" | "true" | undefined; /** * 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" | undefined; /** * 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"?: boolean | "false" | "true" | undefined; /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * * @see aria-pressed @see aria-selected. */ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined; /** * Defines the total number of columns in a table, grid, or treegrid. * * @see aria-colindex. */ "aria-colcount"?: number | string | undefined; /** * 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"?: number | string | undefined; /** * 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"?: number | string | undefined; /** * Identifies the element (or elements) whose contents or presence are controlled by the current * element. * * @see aria-owns. */ "aria-controls"?: string | undefined; /** * Indicates the element that represents the current item within a container or set of related * elements. */ "aria-current"?: | boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined; /** * Identifies the element (or elements) that describes the object. * * @see aria-labelledby */ "aria-describedby"?: string | undefined; /** * Identifies the element that provides a detailed, extended description for the object. * * @see aria-describedby. */ "aria-details"?: string | undefined; /** * Indicates that the element is perceivable but disabled, so it is not editable or otherwise * operable. * * @see aria-hidden @see aria-readonly. */ "aria-disabled"?: boolean | "false" | "true" | undefined; /** * 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" | undefined; /** * Identifies the element that provides an error message for the object. * * @see aria-invalid @see aria-describedby. */ "aria-errormessage"?: string | undefined; /** * Indicates whether the element, or another grouping element it controls, is currently expanded * or collapsed. */ "aria-expanded"?: boolean | "false" | "true" | undefined; /** * 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 | undefined; /** * Indicates an element's "grabbed" state in a drag-and-drop operation. * * @deprecated In ARIA 1.1 */ "aria-grabbed"?: boolean | "false" | "true" | undefined; /** * Indicates the availability and type of interactive popup element, such as menu or dialog, * that can be triggered by an element. */ "aria-haspopup"?: | boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined; /** * Indicates whether the element is exposed to an accessibility API. * * @see aria-disabled. */ "aria-hidden"?: boolean | "false" | "true" | undefined; /** * Indicates the entered value does not conform to the format expected by the application. * * @see aria-errormessage. */ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined; /** * Indicates keyboard shortcuts that an author has implemented to activate or give focus to an * element. */ "aria-keyshortcuts"?: string | undefined; /** * Defines a string value that labels the current element. * * @see aria-labelledby. */ "aria-label"?: string | undefined; /** * Identifies the element (or elements) that labels the current element. * * @see aria-describedby. */ "aria-labelledby"?: string | undefined; /** Defines the hierarchical level of an element within a structure. */ "aria-level"?: number | string | undefined; /** * 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" | undefined; /** Indicates whether an element is modal when displayed. */ "aria-modal"?: boolean | "false" | "true" | undefined; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ "aria-multiline"?: boolean | "false" | "true" | undefined; /** * Indicates that the user may select more than one item from the current selectable * descendants. */ "aria-multiselectable"?: boolean | "false" | "true" | undefined; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ "aria-orientation"?: "horizontal" | "vertical" | undefined; /** * 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 | undefined; /** * 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 | undefined; /** * 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"?: number | string | undefined; /** * Indicates the current "pressed" state of toggle buttons. * * @see aria-checked @see aria-selected. */ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined; /** * Indicates that the element is not editable, but is otherwise operable. * * @see aria-disabled. */ "aria-readonly"?: boolean | "false" | "true" | undefined; /** * 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" | undefined; /** Indicates that user input is required on the element before a form may be submitted. */ "aria-required"?: boolean | "false" | "true" | undefined; /** Defines a human-readable, author-localized description for the role of an element. */ "aria-roledescription"?: string | undefined; /** * Defines the total number of rows in a table, grid, or treegrid. * * @see aria-rowindex. */ "aria-rowcount"?: number | string | undefined; /** * 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"?: number | string | undefined; /** * 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"?: number | string | undefined; /** * Indicates the current "selected" state of various widgets. * * @see aria-checked @see aria-pressed. */ "aria-selected"?: boolean | "false" | "true" | undefined; /** * 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"?: number | string | undefined; /** Indicates if items in a table or grid are sorted in ascending or descending order. */ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined; /** Defines the maximum allowed value for a range widget. */ "aria-valuemax"?: number | string | undefined; /** Defines the minimum allowed value for a range widget. */ "aria-valuemin"?: number | string | undefined; /** * Defines the current value for a range widget. * * @see aria-valuetext. */ "aria-valuenow"?: number | string | undefined; /** Defines the human readable text alternative of aria-valuenow for a range widget. */ "aria-valuetext"?: string | undefined; role?: | "alert" | "alertdialog" | "application" | "article" | "banner" | "button" | "cell" | "checkbox" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "dialog" | "directory" | "document" | "feed" | "figure" | "form" | "grid" | "gridcell" | "group" | "heading" | "img" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "meter" | "navigation" | "none" | "note" | "option" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem" | undefined; } // TODO: Should we allow this? // type ClassKeys = `class:${string}`; // type CSSKeys = Exclude<keyof csstype.PropertiesHyphen, `-${string}`>; // type CSSAttributes = { // [key in CSSKeys as `style:${key}`]: csstype.PropertiesHyphen[key]; // }; interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> { // [key: ClassKeys]: boolean; accessKey?: string | undefined; class?: string | undefined; contenteditable?: boolean | "plaintext-only" | "inherit" | undefined; contextmenu?: string | undefined; dir?: HTMLDir | undefined; draggable?: boolean | "false" | "true" | undefined; hidden?: boolean | "hidden" | "until-found" | undefined; id?: string | undefined; is?: string | undefined; inert?: boolean | undefined; lang?: string | undefined; spellcheck?: boolean | undefined; style?: CSSProperties | string | undefined; tabindex?: number | string | undefined; title?: string | undefined; translate?: "yes" | "no" | undefined; about?: string | undefined; datatype?: string | undefined; inlist?: any | undefined; popover?: boolean | "manual" | "auto" | undefined; prefix?: string | undefined; property?: string | undefined; resource?: string | undefined; typeof?: string | undefined; vocab?: string | undefined; autocapitalize?: HTMLAutocapitalize | undefined; slot?: string | undefined; color?: string | undefined; itemprop?: string | undefined; itemscope?: boolean | undefined; itemtype?: string | undefined; itemid?: string | undefined; itemref?: string | undefined; part?: string | undefined; exportparts?: string | undefined; inputmode?: | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined; contentEditable?: boolean | "plaintext-only" | "inherit" | undefined; contextMenu?: string | undefined; tabIndex?: number | string | undefined; autoCapitalize?: HTMLAutocapitalize | undefined; itemProp?: string | undefined; itemScope?: boolean | undefined; itemType?: string | undefined; itemId?: string | undefined; itemRef?: string | undefined; exportParts?: string | undefined; inputMode?: | "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined; } interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> { download?: any | undefined; href?: string | undefined; hreflang?: string | undefined; media?: string | undefined; ping?: string | undefined; referrerpolicy?: HTMLReferrerPolicy | undefined; rel?: string | undefined; target?: "_self" | "_blank" | "_parent" | "_top" | (string & {}) | undefined; type?: string | undefined; referrerPolicy?: HTMLReferrerPolicy | undefined; } interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {} interface AreaHTMLAttributes<T> extends HTMLAttributes<T> { alt?: string | undefined; coords?: string | undefined; download?: any | undefined; href?: string | undefined; hreflang?: string | undefined; ping?: string | undefined; referrerpolicy?: HTMLReferrerPolicy | undefined; rel?: string | undefined; shape?: "rect" | "circle" | "poly" | "default" | undefined; target?: string | undefined; referrerPolicy?: HTMLReferrerPolicy | undefined; } interface BaseHTMLAttributes<T> extends HTMLAttributes<T> { href?: string | undefined; target?: string | undefined; } interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; } interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> { autofocus?: boolean | undefined; disabled?: boolean | undefined; form?: string | undefined; formaction?: string | SerializableAttributeValue | undefined; formenctype?: HTMLFormEncType | undefined; formmethod?: HTMLFormMethod | undefined; formnovalidate?: boolean | undefined; formtarget?: string | undefined; popovertarget?: string | undefined; popovertargetaction?: "hide" | "show" | "toggle" | undefined; name?: string | undefined; type?: "submit" | "reset" | "button" | undefined; value?: string | undefined; formAction?: string | SerializableAttributeValue | undefined; formEnctype?: HTMLFormEncType | undefined; formMethod?: HTMLFormMethod | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; popoverTarget?: string | undefined; popoverTargetAction?: "hide" | "show" | "toggle" | undefined; } interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> { width?: number | string | undefined; height?: number | string | undefined; } interface ColHTMLAttributes<T> extends HTMLAttributes<T> { span?: number | string | undefined; width?: number | string | undefined; } interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> { span?: number | string | undefined; } interface DataHTMLAttributes<T> extends HTMLAttributes<T> { value?: string | string[] | number | undefined; } interface DetailsHtmlAttributes<T> extends HTMLAttributes<T> { open?: boolean | undefined; onToggle?: EventHandlerUnion<T, Event> | undefined; ontoggle?: EventHandlerUnion<T, Event> | undefined; } interface DialogHtmlAttributes<T> extends HTMLAttributes<T> { open?: boolean | undefined; onClose?: EventHandlerUnion<T, Event> | undefined; onCancel?: EventHandlerUnion<T, Event> | undefined; } interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> { height?: number | string | undefined; src?: string | undefined; type?: string | undefined; width?: number | string | undefined; } interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; form?: string | undefined; name?: string | undefined; } interface FormHTMLAttributes<T> extends HTMLAttributes<T> { "accept-charset"?: string | undefined; action?: string | SerializableAttributeValue | undefined; autocomplete?: string | undefined; encoding?: HTMLFormEncType | undefined; enctype?: HTMLFormEncType | undefined; method?: HTMLFormMethod | undefined; name?: string | undefined; novalidate?: boolean | undefined; target?: string | undefined; noValidate?: boolean | undefined; } interface IframeHTMLAttributes<T> extends HTMLAttributes<T> { allow?: string | undefined; allowfullscreen?: boolean | undefined; height?: number | string | undefined; loading?: "eager" | "lazy" | undefined; name?: string | undefined; referrerpolicy?: HTMLReferrerPolicy | undefined; sandbox?: HTMLIframeSandbox | string | undefined; src?: string | undefined; srcdoc?: string | undefined; width?: number | string | undefined; referrerPolicy?: HTMLReferrerPolicy | undefined; } interface ImgHTMLAttributes<T> extends HTMLAttributes<T> { alt?: string | undefined; crossorigin?: HTMLCrossorigin | undefined; decoding?: "sync" | "async" | "auto" | undefined; height?: number | string | undefined; ismap?: boolean | undefined; isMap?: boolean | undefined; loading?: "eager" | "lazy" | undefined; referrerpolicy?: HTMLReferrerPolicy | undefined; referrerPolicy?: HTMLReferrerPolicy | undefined; sizes?: string | undefined; src?: string | undefined; srcset?: string | undefined; srcSet?: string | undefined; usemap?: string | undefined; useMap?: string | undefined; width?: number | string | undefined; crossOrigin?: HTMLCrossorigin | undefined; elementtiming?: string | undefined; fetchpriority?: "high" | "low" | "auto" | undefined; } interface InputHTMLAttributes<T> extends HTMLAttributes<T> { accept?: string | undefined; alt?: string | undefined; autocomplete?: string | undefined; autocorrect?: "on" | "off" | undefined; autofocus?: boolean | undefined; capture?: boolean | string | undefined; checked?: boolean | undefined; crossorigin?: HTMLCrossorigin | undefined; disabled?: boolean | undefined; enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined; form?: string | undefined; formaction?: string | SerializableAttributeValue | undefined; formenctype?: HTMLFormEncType | undefined; formmethod?: HTMLFormMethod | undefined; formnovalidate?: boolean | undefined; formtarget?: string | undefined; height?: number | string | undefined; incremental?: boolean | undefined; list?: string | undefined; max?: number | string | undefined; maxlength?: number | string | undefined; min?: number | string | undefined; minlength?: number | string | undefined; multiple?: boolean | undefined; name?: string | undefined; pattern?: string | undefined; placeholder?: string | undefined; readonly?: boolean | undefined; results?: number | undefined; required?: boolean | undefined; size?: number | string | undefined; src?: string | undefined; step?: number | string | undefined; type?: | "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week" | (string & {}) | undefined; value?: string | string[] | number | undefined; width?: number | string | undefined; crossOrigin?: HTMLCrossorigin | undefined; formAction?: string | SerializableAttributeValue | undefined; formEnctype?: HTMLFormEncType | undefined; formMethod?: HTMLFormMethod | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; maxLength?: number | string | undefined; minLength?: number | string | undefined; readOnly?: boolean | undefined; } interface InsHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; dateTime?: string | undefined; } interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> { autofocus?: boolean | undefined; challenge?: string | undefined; disabled?: boolean | undefined; form?: string | undefined; keytype?: string | undefined; keyparams?: string | undefined; name?: string | undefined; } interface LabelHTMLAttributes<T> extends HTMLAttributes<T> { for?: string | undefined; form?: string | undefined; } interface LiHTMLAttributes<T> extends HTMLAttributes<T> { value?: number | string | undefined; } interface LinkHTMLAttributes<T> extends HTMLAttributes<T> { as?: HTMLLinkAs | undefined; crossorigin?: HTMLCrossorigin | undefined; disabled?: boolean | undefined; fetchpriority?: "high" | "low" | "auto" | undefined; href?: string | undefined; hreflang?: string | undefined; imagesizes?: string | undefined; imagesrcset?: string | undefined; integrity?: string | undefined; media?: string | undefined; referrerpolicy?: HTMLReferrerPolicy | undefined; rel?: string | undefined; sizes?: string | undefined; type?: string | undefined; crossOrigin?: HTMLCrossorigin | undefined; referrerPolicy?: HTMLReferrerPolicy | undefined; } interface MapHTMLAttributes<T> extends HTMLAttributes<T> { name?: string | undefined; } interface MediaHTMLAttributes<T> extends HTMLAttributes<T> { autoplay?: boolean | undefined; controls?: boolean | undefined; controlslist?: | "nodownload" | "nofullscreen" | "noplaybackrate" | "noremoteplayback" | (string & {}) | undefined; crossorigin?: HTMLCrossorigin | undefined; loop?: boolean | undefined; mediagroup?: string | undefined; muted?: boolean | undefined; preload?: "none" | "metadata" | "auto" | "" | undefined; src?: string | undefined; crossOrigin?: HTMLCrossorigin | undefined; mediaGroup?: string | undefined; } interface MenuHTMLAttributes<T> extends HTMLAttributes<T> { label?: string | undefined; type?: "context" | "toolbar" | undefined; } interface MetaHTMLAttributes<T> extends HTMLAttributes<T> { charset?: string | undefined; content?: string | undefined; "http-equiv"?: string | undefined; name?: string | undefined; media?: string | undefined; } interface MeterHTMLAttributes<T> extends HTMLAttri