diff --git a/plugins/bindable.js b/plugins/bindable.js index e0dc0827..f30a8a4b 100644 --- a/plugins/bindable.js +++ b/plugins/bindable.js @@ -15,7 +15,6 @@ function transform({ node, environment }) { } else { node.attributes.value = object[property] ?? ''; } - node.attributes.name = node.attributes.name || node.attributes.bind; if (environment.client) { if (node.attributes.type === 'checkbox' || node.attributes.type === 'radio') { node.attributes.onclick ??= noop; diff --git a/types/ClientContext.d.ts b/types/ClientContext.d.ts index f41fbb98..ac2db864 100644 --- a/types/ClientContext.d.ts +++ b/types/ClientContext.d.ts @@ -1,16 +1,16 @@ -import { NullstackEnvironment } from "./Environment"; -import { NullstackPage } from "./Page"; -import { NullstackParams } from "./Params"; -import { NullstackProject } from "./Project"; -import { NullstackRouter } from "./Router"; -import { NullstackSettings } from "./Settings"; -import { NullstackWorker } from "./Worker"; +import { NullstackEnvironment } from './Environment'; +import { NullstackNode } from './JSX'; +import { NullstackPage } from './Page'; +import { NullstackParams } from './Params'; +import { NullstackProject } from './Project'; +import { NullstackRouter } from './Router'; +import { NullstackSettings } from './Settings'; +import { NullstackWorker } from './Worker'; /** * @see https://nullstack.app/context */ -export type NullstackClientContext = { - +export type NullstackClientContext = TProps & { /** * Information about the document `head` metatags. * @@ -48,7 +48,7 @@ export type NullstackClientContext = { * @scope client * @see https://nullstack.app/context-instances */ - instances?: Record; + instances?: Record; /** * It gives you information about the current environment. @@ -93,11 +93,19 @@ export type NullstackClientContext = { * * @see https://nullstack.app/renderable-components#components-with-children */ - children?: Readonly>; + children?: NullstackNode; /** - * Custom context prop. + * Bind object. + * + * @see https://nullstack.app/two-way-bindings#complex-bindable-components */ - [key: string]: any; + bind?: { object: Record; property: string }; + /** + * Bind value. + * + * @see https://nullstack.app/two-way-bindings#complex-bindable-components + */ + value?: TBindValue; }; diff --git a/types/Environment.d.ts b/types/Environment.d.ts index f81fd885..1b140a56 100644 --- a/types/Environment.d.ts +++ b/types/Environment.d.ts @@ -1,5 +1,4 @@ export type NullstackEnvironment = { - client: boolean; server: boolean; @@ -24,5 +23,4 @@ export type NullstackEnvironment = { * @see https://nullstack.app/context-environment */ event: string; - -}; \ No newline at end of file +}; diff --git a/types/JSX.d.ts b/types/JSX.d.ts index 429dd2a3..2939dc19 100644 --- a/types/JSX.d.ts +++ b/types/JSX.d.ts @@ -29,7 +29,7 @@ // Guilherme Correia // TypeScript Version: 2.8 -import { NullstackClientContext } from "."; +import { NullstackClientContext } from './ClientContext'; type NativeDragEvent = globalThis.DragEvent; type NativeFocusEvent = globalThis.FocusEvent; @@ -38,31 +38,31 @@ type NativeMouseEvent = globalThis.MouseEvent; type NativePointerEvent = globalThis.PointerEvent; type NativeUIEvent = globalThis.UIEvent; type NativeWheelEvent = globalThis.WheelEvent; -type Booleanish = boolean | "true" | "false"; +type Booleanish = boolean | 'true' | 'false'; // // Nullstack Elements // ---------------------------------------------------------------------- export interface Attributes { - html?: string | undefined; - source?: object | undefined; - bind?: any | undefined; - debounce?: number | undefined; - ref?: any | undefined; - data?: object | undefined; - "data-"?: any; + html?: string; + source?: object; + bind?: any; + debounce?: number; + ref?: any; + data?: object; + 'data-'?: any; [key: string]: any; } export interface NullstackAttributes extends Attributes { children?: NullstackNode; - route?: string | undefined; - persistent?: boolean | undefined; + route?: string; + persistent?: boolean; key?: string; } -export interface ClassAttributes extends Attributes { } +export interface ClassAttributes extends Attributes {} // // Factories @@ -70,16 +70,10 @@ export interface ClassAttributes extends Attributes { } type DetailedHTMLFactory = P; -export interface SVGFactory { } +export interface SVGFactory {} export type NullstackFragment = NullstackNode[]; -export type NullstackNode = - | NullstackFragment - | string - | number - | boolean - | null - | undefined; +export type NullstackNode = NullstackFragment | string | number | boolean | null | undefined; // // Event System @@ -108,15 +102,13 @@ export interface BaseSyntheticEvent { * This might be a child element to the element on which the event listener is registered. * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682 */ -export interface SyntheticEvent - extends BaseSyntheticEvent { } +export interface SyntheticEvent extends BaseSyntheticEvent {} export interface DragEvent extends MouseEvent { dataTransfer: DataTransfer; } -export interface PointerEvent - extends MouseEvent { +export interface PointerEvent extends MouseEvent { pointerId: number; pressure: number; tangentialPressure: number; @@ -125,7 +117,7 @@ export interface PointerEvent twist: number; width: number; height: number; - pointerType: "mouse" | "pen" | "touch"; + pointerType: 'mouse' | 'pen' | 'touch'; isPrimary: boolean; } @@ -135,14 +127,13 @@ export interface FocusEvent target: EventTarget & Target; } -export interface FormEvent extends SyntheticEvent { } +export interface FormEvent extends SyntheticEvent {} export interface ChangeEvent extends SyntheticEvent { target: EventTarget & T; } -export interface KeyboardEvent - extends UIEvent { +export interface KeyboardEvent extends UIEvent { altKey: boolean; /** @deprecated */ charCode: number; @@ -166,8 +157,7 @@ export interface KeyboardEvent which: number; } -export interface MouseEvent - extends UIEvent { +export interface MouseEvent extends UIEvent { altKey: boolean; button: number; buttons: number; @@ -189,13 +179,11 @@ export interface MouseEvent shiftKey: boolean; } -export interface UIEvent - extends SyntheticEvent { +export interface UIEvent extends SyntheticEvent { detail: number; } -export interface WheelEvent - extends MouseEvent { +export interface WheelEvent extends MouseEvent { deltaMode: number; deltaX: number; deltaY: number; @@ -209,8 +197,8 @@ export interface WheelEvent type EventHandler> = | object | { - bivarianceHack(event: { event: E } & NullstackClientContext): void; - }["bivarianceHack"]; + bivarianceHack(event: { event: E } & NullstackClientContext): void; + }['bivarianceHack']; type NullstackEventHandler = EventHandler>; type DragEventHandler = EventHandler>; @@ -229,1021 +217,968 @@ type WheelEventHandler = EventHandler>; type DetailedHTMLProps, T> = E; -export interface SVGProps extends SVGAttributes, ClassAttributes { } +export interface SVGProps extends SVGAttributes, ClassAttributes {} export interface DOMAttributes extends Attributes { // Focus Events - onfocus?: FocusEventHandler | undefined; - onblur?: FocusEventHandler | undefined; + onfocus?: FocusEventHandler; + onblur?: FocusEventHandler; // Form Events - onchange?: FormEventHandler | undefined; - oninput?: FormEventHandler | undefined; - onreset?: FormEventHandler | undefined; - onsubmit?: FormEventHandler | undefined; - oninvalid?: FormEventHandler | undefined; + onchange?: FormEventHandler; + oninput?: FormEventHandler; + onreset?: FormEventHandler; + onsubmit?: FormEventHandler; + oninvalid?: FormEventHandler; // Image Events - onload?: NullstackEventHandler | undefined; - onerror?: NullstackEventHandler | undefined; // also a Media Event + onload?: NullstackEventHandler; + onerror?: NullstackEventHandler; // also a Media Event // Keyboard Events - onkeydown?: KeyboardEventHandler | undefined; + onkeydown?: KeyboardEventHandler; /** @deprecated */ - onkeypress?: KeyboardEventHandler | undefined; - onkeyup?: KeyboardEventHandler | undefined; + onkeypress?: KeyboardEventHandler; + onkeyup?: KeyboardEventHandler; // Media Events - onabort?: NullstackEventHandler | undefined; - oncanplay?: NullstackEventHandler | undefined; - oncanplaythrough?: NullstackEventHandler | undefined; - ondurationchange?: NullstackEventHandler | undefined; - onemptied?: NullstackEventHandler | undefined; - onended?: NullstackEventHandler | undefined; - onloadeddata?: NullstackEventHandler | undefined; - onloadedmetadata?: NullstackEventHandler | undefined; - onloadstart?: NullstackEventHandler | undefined; - onpause?: NullstackEventHandler | undefined; - onplay?: NullstackEventHandler | undefined; - onplaying?: NullstackEventHandler | undefined; - onprogress?: NullstackEventHandler | undefined; - onratechange?: NullstackEventHandler | undefined; - onseeked?: NullstackEventHandler | undefined; - onseeking?: NullstackEventHandler | undefined; - onstalled?: NullstackEventHandler | undefined; - onsuspend?: NullstackEventHandler | undefined; - ontimeupdate?: NullstackEventHandler | undefined; - onvolumechange?: NullstackEventHandler | undefined; - onwaiting?: NullstackEventHandler | undefined; + onabort?: NullstackEventHandler; + oncanplay?: NullstackEventHandler; + oncanplaythrough?: NullstackEventHandler; + ondurationchange?: NullstackEventHandler; + onemptied?: NullstackEventHandler; + onended?: NullstackEventHandler; + onloadeddata?: NullstackEventHandler; + onloadedmetadata?: NullstackEventHandler; + onloadstart?: NullstackEventHandler; + onpause?: NullstackEventHandler; + onplay?: NullstackEventHandler; + onplaying?: NullstackEventHandler; + onprogress?: NullstackEventHandler; + onratechange?: NullstackEventHandler; + onseeked?: NullstackEventHandler; + onseeking?: NullstackEventHandler; + onstalled?: NullstackEventHandler; + onsuspend?: NullstackEventHandler; + ontimeupdate?: NullstackEventHandler; + onvolumechange?: NullstackEventHandler; + onwaiting?: NullstackEventHandler; // MouseEvents - onclick?: MouseEventHandler | undefined; - oncontextmenu?: MouseEventHandler | undefined; - ondblclick?: MouseEventHandler | undefined; - ondrag?: DragEventHandler | undefined; - ondragend?: DragEventHandler | undefined; - ondragenter?: DragEventHandler | undefined; - ondragleave?: DragEventHandler | undefined; - ondragover?: DragEventHandler | undefined; - ondragstart?: DragEventHandler | undefined; - ondrop?: DragEventHandler | undefined; - onmousedown?: MouseEventHandler | undefined; - onmouseenter?: MouseEventHandler | undefined; - onmouseleave?: MouseEventHandler | undefined; - onmousemove?: MouseEventHandler | undefined; - onmouseout?: MouseEventHandler | undefined; - onmouseover?: MouseEventHandler | undefined; - onmouseup?: MouseEventHandler | undefined; + onclick?: MouseEventHandler; + oncontextmenu?: MouseEventHandler; + ondblclick?: MouseEventHandler; + ondrag?: DragEventHandler; + ondragend?: DragEventHandler; + ondragenter?: DragEventHandler; + ondragleave?: DragEventHandler; + ondragover?: DragEventHandler; + ondragstart?: DragEventHandler; + ondrop?: DragEventHandler; + onmousedown?: MouseEventHandler; + onmouseenter?: MouseEventHandler; + onmouseleave?: MouseEventHandler; + onmousemove?: MouseEventHandler; + onmouseout?: MouseEventHandler; + onmouseover?: MouseEventHandler; + onmouseup?: MouseEventHandler; // Wheel Events /** @deprecated */ - onmousewheel?: WheelEventHandler | undefined; + onmousewheel?: WheelEventHandler; // Selection Events - onselect?: NullstackEventHandler | undefined; + onselect?: NullstackEventHandler; // Pointer Events - onpointerdown?: PointerEventHandler | undefined; - onpointermove?: PointerEventHandler | undefined; - onpointerup?: PointerEventHandler | undefined; - onpointercancel?: PointerEventHandler | undefined; - onpointerenter?: PointerEventHandler | undefined; - onpointerleave?: PointerEventHandler | undefined; - onpointerover?: PointerEventHandler | undefined; - onpointerout?: PointerEventHandler | undefined; + onpointerdown?: PointerEventHandler; + onpointermove?: PointerEventHandler; + onpointerup?: PointerEventHandler; + onpointercancel?: PointerEventHandler; + onpointerenter?: PointerEventHandler; + onpointerleave?: PointerEventHandler; + onpointerover?: PointerEventHandler; + onpointerout?: PointerEventHandler; // UI Events - onscroll?: UIEventHandler | undefined; + onscroll?: UIEventHandler; } // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ export interface AriaAttributes { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or applicatio */ - "aria-activedescendant"?: string | undefined; + '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 | undefined; + '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" | undefined; + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; /** 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 | undefined; + 'aria-busy'?: Booleanish; /** * 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; + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; /** * Defines the total number of columns in a table, grid, or treegrid. * @see aria-colindex. */ - "aria-colcount"?: number | undefined; + 'aria-colcount'?: number; /** * 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-colspa */ - "aria-colindex"?: number | undefined; + 'aria-colindex'?: number; /** * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-colindex @see aria-rowspa */ - "aria-colspan"?: number | undefined; + 'aria-colspan'?: number; /** * Identifies the element (or elements) whose contents or presence are controlled by the current element. * @see aria-owns. */ - "aria-controls"?: string | undefined; + 'aria-controls'?: string; /** 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; + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; /** * Identifies the element (or elements) that describes the object. * @see aria-labelledby */ - "aria-describedby"?: string | undefined; + 'aria-describedby'?: string; /** * Identifies the element that provides a detailed, extended description for the object. * @see aria-describedby. */ - "aria-details"?: string | undefined; + '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 | undefined; + '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" - | undefined; + '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 | undefined; + 'aria-errormessage'?: string; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ - "aria-expanded"?: Booleanish | undefined; + '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 | undefined; + 'aria-flowto'?: string; /** * Indicates an element's "grabbed" state in a drag-and-drop operatio * @deprecated in ARIA 1.1 */ - "aria-grabbed"?: Booleanish | undefined; + '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"?: - | boolean - | "false" - | "true" - | "menu" - | "listbox" - | "tree" - | "grid" - | "dialog" - | undefined; + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ - "aria-hidden"?: Booleanish | undefined; + 'aria-hidden'?: Booleanish; /** * Indicates the entered value does not conform to the format expected by the applicatio * @see aria-errormessage. */ - "aria-invalid"?: - | boolean - | "false" - | "true" - | "grammar" - | "spelling" - | undefined; + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ - "aria-keyshortcuts"?: string | undefined; + 'aria-keyshortcuts'?: string; /** * Defines a string value that labels the current element. * @see aria-labelledby. */ - "aria-label"?: string | undefined; + 'aria-label'?: string; /** * Identifies the element (or elements) that labels the current element. * @see aria-describedby. */ - "aria-labelledby"?: string | undefined; + 'aria-labelledby'?: string; /** Defines the hierarchical level of an element within a structure. */ - "aria-level"?: number | undefined; + 'aria-level'?: number; /** 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 regio */ - "aria-live"?: "off" | "assertive" | "polite" | undefined; + 'aria-live'?: 'off' | 'assertive' | 'polite'; /** Indicates whether an element is modal when displayed. */ - "aria-modal"?: Booleanish | undefined; + 'aria-modal'?: Booleanish; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ - "aria-multiline"?: Booleanish | undefined; + 'aria-multiline'?: Booleanish; /** Indicates that the user may select more than one item from the current selectable descendants. */ - "aria-multiselectable"?: Booleanish | undefined; + 'aria-multiselectable'?: Booleanish; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ - "aria-orientation"?: "horizontal" | "vertical" | undefined; + '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 | undefined; + '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 | undefined; + '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"?: number | undefined; + 'aria-posinset'?: number; /** * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ - "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined; + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true'; /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ - "aria-readonly"?: Booleanish | undefined; + '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" - | undefined; + '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"?: Booleanish | undefined; + 'aria-required'?: Booleanish; /** Defines a human-readable, author-localized description for the role of an element. */ - "aria-roledescription"?: string | undefined; + 'aria-roledescription'?: string; /** * Defines the total number of rows in a table, grid, or treegrid. * @see aria-rowindex. */ - "aria-rowcount"?: number | undefined; + 'aria-rowcount'?: number; /** * 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-rowspa */ - "aria-rowindex"?: number | undefined; + 'aria-rowindex'?: number; /** * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-rowindex @see aria-colspa */ - "aria-rowspan"?: number | undefined; + 'aria-rowspan'?: number; /** * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ - "aria-selected"?: Booleanish | undefined; + '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"?: number | undefined; + 'aria-setsize'?: number; /** Indicates if items in a table or grid are sorted in ascending or descending order. */ - "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined; + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; /** Defines the maximum allowed value for a range widget. */ - "aria-valuemax"?: number | undefined; + 'aria-valuemax'?: number; /** Defines the minimum allowed value for a range widget. */ - "aria-valuemin"?: number | undefined; + 'aria-valuemin'?: number; /** * Defines the current value for a range widget. * @see aria-valuetext. */ - "aria-valuenow"?: number | undefined; + 'aria-valuenow'?: number; /** Defines the human readable text alternative of aria-valuenow for a range widget. */ - "aria-valuetext"?: string | undefined; + 'aria-valuetext'?: string; } // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions type AriaRole = - | "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" - | "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" + | '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' + | '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' | (string & {}); export interface HTMLAttributes extends AriaAttributes, DOMAttributes { // Standard HTML Attributes - accesskey?: string | undefined; - class?: string | undefined; - contenteditable?: Booleanish | "inherit" | undefined; - contextmenu?: string | undefined; - dir?: string | undefined; - draggable?: Booleanish | undefined; - hidden?: boolean | undefined; - id?: string | undefined; - lang?: string | undefined; - placeholder?: string | undefined; - slot?: string | undefined; - spellcheck?: Booleanish | undefined; - style?: string | undefined; - tabindex?: number | string | undefined; - title?: string | undefined; - translate?: "yes" | "no" | undefined; + accesskey?: string; + class?: string; + contenteditable?: Booleanish | 'inherit'; + contextmenu?: string; + dir?: string; + draggable?: Booleanish; + hidden?: boolean; + id?: string; + lang?: string; + placeholder?: string; + slot?: string; + spellcheck?: Booleanish; + style?: string; + tabindex?: number | string; + title?: string; + translate?: 'yes' | 'no'; // WAI-ARIA - role?: AriaRole | undefined; + role?: AriaRole; // Non-standard Attributes - autocapitalize?: string | undefined; - itemprop?: string | undefined; - itemscope?: boolean | undefined; - itemtype?: string | undefined; - itemid?: string | undefined; - itemref?: string | undefined; + autocapitalize?: string; + itemprop?: string; + itemscope?: boolean; + itemtype?: string; + itemid?: string; + itemref?: string; // Living Standard /** * 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/interactiohtml#input-modalities:-the-inputmode-attribute */ - inputmode?: - | "none" - | "text" - | "tel" - | "url" - | "email" - | "numeric" - | "decimal" - | "search" - | undefined; + 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 | undefined; + is?: string; } export interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes - accept?: string | undefined; - "accept-charset"?: string | undefined; - action?: string | undefined; - allowfullScreen?: boolean | undefined; - allowTransparency?: boolean | undefined; - alt?: string | undefined; - as?: string | undefined; - async?: boolean | undefined; - autocomplete?: string | undefined; - autofocus?: boolean | undefined; - autoplay?: boolean | undefined; - capture?: boolean | "user" | "environment" | undefined; - charset?: string | undefined; - checked?: boolean | undefined; - cite?: string | undefined; - classid?: string | undefined; - cols?: number | undefined; - colspan?: number | undefined; - content?: string | undefined; - controls?: boolean | undefined; - coords?: string | undefined; - crossorigin?: "anonymous" | "use-credentials" | "" | undefined; - datetime?: string | undefined; - default?: boolean | undefined; - defer?: boolean | undefined; - disabled?: boolean | undefined; + accept?: string; + 'accept-charset'?: string; + action?: string; + allowfullScreen?: boolean; + allowTransparency?: boolean; + alt?: string; + as?: string; + async?: boolean; + autocomplete?: string; + autofocus?: boolean; + autoplay?: boolean; + capture?: boolean | 'user' | 'environment'; + charset?: string; + checked?: boolean; + cite?: string; + classid?: string; + cols?: number; + colspan?: number; + content?: string; + controls?: boolean; + coords?: string; + crossorigin?: 'anonymous' | 'use-credentials' | ''; + datetime?: string; + default?: boolean; + defer?: boolean; + disabled?: boolean; download?: any; - enctype?: string | undefined; - form?: string | undefined; - formaction?: string | undefined; - formenctype?: string | undefined; - formmethod?: string | undefined; - formnovalidate?: boolean | undefined; - formtarget?: string | undefined; - headers?: string | undefined; - height?: number | string | undefined; - high?: number | undefined; - href?: string | undefined; - hreflang?: string | undefined; - "http-equiv"?: string | undefined; - integrity?: string | undefined; - kind?: string | undefined; - label?: string | undefined; - list?: string | undefined; - loop?: boolean | undefined; - low?: number | undefined; - manifest?: string | undefined; - max?: number | string | undefined; - maxlength?: number | undefined; - media?: string | undefined; - mediagroup?: string | undefined; - method?: string | undefined; - min?: number | string | undefined; - minlength?: number | undefined; - multiple?: boolean | undefined; - muted?: boolean | undefined; - name?: string | undefined; - nonce?: string | undefined; - novalidate?: boolean | undefined; - open?: boolean | undefined; - optimum?: number | undefined; - pattern?: string | undefined; - placeholder?: string | undefined; - playsinline?: boolean | undefined; - poster?: string | undefined; - preload?: string | undefined; - readonly?: boolean | undefined; - rel?: string | undefined; - required?: boolean | undefined; - reversed?: boolean | undefined; - rows?: number | undefined; - rowspan?: number | undefined; - sandbox?: string | undefined; - scope?: string | undefined; - scoped?: boolean | undefined; - seamless?: boolean | undefined; - selected?: boolean | undefined; - shape?: string | undefined; - size?: number | undefined; - sizes?: string | undefined; - span?: number | undefined; - src?: string | undefined; - srcdoc?: string | undefined; - srclang?: string | undefined; - srcset?: string | undefined; - start?: number | undefined; - step?: number | string | undefined; - summary?: string | undefined; - target?: string | undefined; - type?: string | undefined; - usemap?: string | undefined; - value?: string | ReadonlyArray | number | undefined; - width?: number | string | undefined; - wrap?: string | undefined; + enctype?: string; + form?: string; + formaction?: string; + formenctype?: string; + formmethod?: string; + formnovalidate?: boolean; + formtarget?: string; + headers?: string; + height?: number | string; + high?: number; + href?: string; + hreflang?: string; + 'http-equiv'?: string; + integrity?: string; + kind?: string; + label?: string; + list?: string; + loop?: boolean; + low?: number; + manifest?: string; + max?: number | string; + maxlength?: number; + media?: string; + mediagroup?: string; + method?: string; + min?: number | string; + minlength?: number; + multiple?: boolean; + muted?: boolean; + name?: string; + nonce?: string; + novalidate?: boolean; + open?: boolean; + optimum?: number; + pattern?: string; + placeholder?: string; + playsinline?: boolean; + poster?: string; + preload?: string; + readonly?: boolean; + rel?: string; + required?: boolean; + reversed?: boolean; + rows?: number; + rowspan?: number; + sandbox?: string; + scope?: string; + scoped?: boolean; + seamless?: boolean; + selected?: boolean; + shape?: string; + size?: number; + sizes?: string; + span?: number; + src?: string; + srcdoc?: string; + srclang?: string; + srcset?: string; + start?: number; + step?: number | string; + summary?: string; + target?: string; + type?: string; + usemap?: string; + value?: string | ReadonlyArray | number; + width?: number | string; + wrap?: string; } type HTMLAttributeReferrerPolicy = - | "" - | "no-referrer" - | "no-referrer-when-downgrade" - | "origin" - | "origin-when-cross-origin" - | "same-origin" - | "strict-origin" - | "strict-origin-when-cross-origin" - | "unsafe-url"; - -type HTMLAttributeAnchorTarget = - | "_self" - | "_blank" - | "_parent" - | "_top" - | (string & {}); + | '' + | 'no-referrer' + | 'no-referrer-when-downgrade' + | 'origin' + | 'origin-when-cross-origin' + | 'same-origin' + | 'strict-origin' + | 'strict-origin-when-cross-origin' + | 'unsafe-url'; + +type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {}); export interface AnchorHTMLAttributes extends HTMLAttributes { download?: any; - href?: string | undefined; - hreflang?: string | undefined; - media?: string | undefined; - ping?: string | undefined; - rel?: string | undefined; - target?: HTMLAttributeAnchorTarget | undefined; - type?: string | undefined; - referrerpolicy?: HTMLAttributeReferrerPolicy | undefined; + href?: string; + hreflang?: string; + media?: string; + ping?: string; + rel?: string; + target?: HTMLAttributeAnchorTarget; + type?: string; + referrerpolicy?: HTMLAttributeReferrerPolicy; // Nullstack Router - params?: object | undefined; - path?: string | undefined; + params?: object; + path?: string; } -export interface AudioHTMLAttributes extends MediaHTMLAttributes { } +export interface AudioHTMLAttributes extends MediaHTMLAttributes {} export interface AreaHTMLAttributes extends HTMLAttributes { - alt?: string | undefined; - coords?: string | undefined; + alt?: string; + coords?: string; download?: any; - href?: string | undefined; - hreflang?: string | undefined; - media?: string | undefined; - referrerpolicy?: HTMLAttributeReferrerPolicy | undefined; - rel?: string | undefined; - shape?: string | undefined; - target?: string | undefined; + href?: string; + hreflang?: string; + media?: string; + referrerpolicy?: HTMLAttributeReferrerPolicy; + rel?: string; + shape?: string; + target?: string; } export interface BaseHTMLAttributes extends HTMLAttributes { - href?: string | undefined; - target?: string | undefined; + href?: string; + target?: string; } export interface BlockquoteHTMLAttributes extends HTMLAttributes { - cite?: string | undefined; + cite?: string; } export interface ButtonHTMLAttributes extends HTMLAttributes { - autofocus?: boolean | undefined; - disabled?: boolean | undefined; - form?: string | undefined; - formaction?: string | undefined; - formenctype?: string | undefined; - formmethod?: string | undefined; - formnovalidate?: boolean | undefined; - formtarget?: string | undefined; - name?: string | undefined; - type?: "submit" | "reset" | "button" | undefined; - value?: string | ReadonlyArray | number | undefined; + autofocus?: boolean; + disabled?: boolean; + form?: string; + formaction?: string; + formenctype?: string; + formmethod?: string; + formnovalidate?: boolean; + formtarget?: string; + name?: string; + type?: 'submit' | 'reset' | 'button'; + value?: string | ReadonlyArray | number; } export interface CanvasHTMLAttributes extends HTMLAttributes { - height?: number | string | undefined; - width?: number | string | undefined; + height?: number | string; + width?: number | string; } export interface ColHTMLAttributes extends HTMLAttributes { - span?: number | undefined; + span?: number; /** @deprecated */ - width?: number | string | undefined; + width?: number | string; } export interface ColgroupHTMLAttributes extends HTMLAttributes { - span?: number | undefined; + span?: number; } export interface DataHTMLAttributes extends HTMLAttributes { - value?: string | ReadonlyArray | number | undefined; + value?: string | ReadonlyArray | number; } export interface DetailsHTMLAttributes extends HTMLAttributes { - open?: boolean | undefined; + open?: boolean; } export interface DelHTMLAttributes extends HTMLAttributes { - cite?: string | undefined; - datetime?: string | undefined; + cite?: string; + datetime?: string; } export interface DialogHTMLAttributes extends HTMLAttributes { - open?: boolean | undefined; + open?: boolean; } export interface EmbedHTMLAttributes extends HTMLAttributes { - height?: number | string | undefined; - src?: string | undefined; - type?: string | undefined; - width?: number | string | undefined; + height?: number | string; + src?: string; + type?: string; + width?: number | string; } export interface FieldsetHTMLAttributes extends HTMLAttributes { - disabled?: boolean | undefined; - form?: string | undefined; - name?: string | undefined; + disabled?: boolean; + form?: string; + name?: string; } export interface FormHTMLAttributes extends HTMLAttributes { - "accept-charset"?: string | undefined; - action?: string | undefined; - autocomplete?: string | undefined; - enctype?: string | undefined; - method?: string | undefined; - name?: string | undefined; - novalidate?: boolean | undefined; - target?: string | undefined; + 'accept-charset'?: string; + action?: string; + autocomplete?: string; + enctype?: string; + method?: string; + name?: string; + novalidate?: boolean; + target?: string; } export interface HtmlHTMLAttributes extends HTMLAttributes { - manifest?: string | undefined; + manifest?: string; } export interface IframeHTMLAttributes extends HTMLAttributes { - allow?: string | undefined; - allowfullScreen?: boolean | undefined; - allowTransparency?: boolean | undefined; + allow?: string; + allowfullScreen?: boolean; + allowTransparency?: boolean; /** @deprecated */ - frameBorder?: number | string | undefined; - height?: number | string | undefined; - loading?: "eager" | "lazy" | undefined; + frameBorder?: number | string; + height?: number | string; + loading?: 'eager' | 'lazy'; /** @deprecated */ - marginHeight?: number | undefined; + marginHeight?: number; /** @deprecated */ - marginWidth?: number | undefined; - name?: string | undefined; - referrerpolicy?: HTMLAttributeReferrerPolicy | undefined; - sandbox?: string | undefined; + marginWidth?: number; + name?: string; + referrerpolicy?: HTMLAttributeReferrerPolicy; + sandbox?: string; /** @deprecated */ - scrolling?: string | undefined; - seamless?: boolean | undefined; - src?: string | undefined; - srcdoc?: string | undefined; - width?: number | string | undefined; + scrolling?: string; + seamless?: boolean; + src?: string; + srcdoc?: string; + width?: number | string; } export interface ImgHTMLAttributes extends HTMLAttributes { - alt?: string | undefined; - crossorigin?: "anonymous" | "use-credentials" | "" | undefined; - decoding?: "async" | "auto" | "sync" | undefined; - height?: number | string | undefined; - loading?: "eager" | "lazy" | undefined; - referrerpolicy?: HTMLAttributeReferrerPolicy | undefined; - sizes?: string | undefined; - src?: string | undefined; - srcset?: string | undefined; - usemap?: string | undefined; - width?: number | string | undefined; + alt?: string; + crossorigin?: 'anonymous' | 'use-credentials' | ''; + decoding?: 'async' | 'auto' | 'sync'; + height?: number | string; + loading?: 'eager' | 'lazy'; + referrerpolicy?: HTMLAttributeReferrerPolicy; + sizes?: string; + src?: string; + srcset?: string; + usemap?: string; + width?: number | string; } export interface InsHTMLAttributes extends HTMLAttributes { - cite?: string | undefined; - datetime?: string | undefined; + cite?: string; + datetime?: string; } type HTMLInputTypeAttribute = - | "button" - | "checkbox" - | "color" - | "date" - | "datetime" - | "datetime-local" - | "email" - | "file" - | "hidden" - | "image" - | "month" - | "number" - | "password" - | "radio" - | "range" - | "reset" - | "search" - | "submit" - | "tel" - | "text" - | "time" - | "url" - | "week" + | 'button' + | 'checkbox' + | 'color' + | 'date' + | 'datetime' + | 'datetime-local' + | 'email' + | 'file' + | 'hidden' + | 'image' + | 'month' + | 'number' + | 'password' + | 'radio' + | 'range' + | 'reset' + | 'search' + | 'submit' + | 'tel' + | 'text' + | 'time' + | 'url' + | 'week' | (string & {}); export interface InputHTMLAttributes extends HTMLAttributes { - accept?: string | undefined; - alt?: string | undefined; - autocomplete?: string | undefined; - autofocus?: boolean | undefined; + accept?: string; + alt?: string; + autocomplete?: string; + autofocus?: boolean; /** @see https://www.w3.org/TR/html-media-capture/#the-capture-attribute */ - capture?: boolean | "user" | "environment" | undefined; - checked?: boolean | undefined; - disabled?: boolean | undefined; - enterkeyhint?: - | "enter" - | "done" - | "go" - | "next" - | "previous" - | "search" - | "send" - | undefined; - form?: string | undefined; - formaction?: string | undefined; - formenctype?: string | undefined; - formmethod?: string | undefined; - formnovalidate?: boolean | undefined; - formtarget?: string | undefined; - height?: number | string | undefined; - list?: string | undefined; - max?: number | string | undefined; - maxlength?: number | undefined; - min?: number | string | undefined; - minlength?: number | undefined; - multiple?: boolean | undefined; - name?: string | undefined; - pattern?: string | undefined; - placeholder?: string | undefined; - readonly?: boolean | undefined; - required?: boolean | undefined; - size?: number | undefined; - src?: string | undefined; - step?: number | string | undefined; - type?: HTMLInputTypeAttribute | undefined; - value?: string | ReadonlyArray | number | undefined; - width?: number | string | undefined; - - onchange?: ChangeEventHandler | undefined; + capture?: boolean | 'user' | 'environment'; + checked?: boolean; + disabled?: boolean; + enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'; + form?: string; + formaction?: string; + formenctype?: string; + formmethod?: string; + formnovalidate?: boolean; + formtarget?: string; + height?: number | string; + list?: string; + max?: number | string; + maxlength?: number; + min?: number | string; + minlength?: number; + multiple?: boolean; + name?: string; + pattern?: string; + placeholder?: string; + readonly?: boolean; + required?: boolean; + size?: number; + src?: string; + step?: number | string; + type?: HTMLInputTypeAttribute; + value?: string | ReadonlyArray | number; + width?: number | string; + + onchange?: ChangeEventHandler; } export interface KeygenHTMLAttributes extends HTMLAttributes { - autofocus?: boolean | undefined; - challenge?: string | undefined; - disabled?: boolean | undefined; - form?: string | undefined; - keytype?: string | undefined; - keyparams?: string | undefined; - name?: string | undefined; + autofocus?: boolean; + challenge?: string; + disabled?: boolean; + form?: string; + keytype?: string; + keyparams?: string; + name?: string; } export interface LabelHTMLAttributes extends HTMLAttributes { - form?: string | undefined; + form?: string; } export interface LiHTMLAttributes extends HTMLAttributes { - value?: string | ReadonlyArray | number | undefined; + value?: string | ReadonlyArray | number; } export interface LinkHTMLAttributes extends HTMLAttributes { - as?: string | undefined; - crossorigin?: true | "anonymous" | "use-credentials" | "" | undefined; - href?: string | undefined; - hreflang?: string | undefined; - integrity?: string | undefined; - media?: string | undefined; - referrerpolicy?: HTMLAttributeReferrerPolicy | undefined; - rel?: string | undefined; - sizes?: string | undefined; - type?: string | undefined; - charset?: string | undefined; + as?: string; + crossorigin?: true | 'anonymous' | 'use-credentials' | ''; + href?: string; + hreflang?: string; + integrity?: string; + media?: string; + referrerpolicy?: HTMLAttributeReferrerPolicy; + rel?: string; + sizes?: string; + type?: string; + charset?: string; } export interface MapHTMLAttributes extends HTMLAttributes { - name?: string | undefined; + name?: string; } export interface MenuHTMLAttributes extends HTMLAttributes { - type?: string | undefined; + type?: string; } export interface MediaHTMLAttributes extends HTMLAttributes { - autoplay?: boolean | undefined; - controls?: boolean | undefined; - crossorigin?: true | "anonymous" | "use-credentials" | "" | undefined; - loop?: boolean | undefined; - mediagroup?: string | undefined; - muted?: boolean | undefined; - playsinline?: boolean | undefined; - preload?: string | undefined; - src?: string | undefined; + autoplay?: boolean; + controls?: boolean; + crossorigin?: true | 'anonymous' | 'use-credentials' | ''; + loop?: boolean; + mediagroup?: string; + muted?: boolean; + playsinline?: boolean; + preload?: string; + src?: string; } export interface MetaHTMLAttributes extends HTMLAttributes { - charset?: string | undefined; - content?: string | undefined; - "http-equiv"?: string | undefined; - name?: string | undefined; - media?: string | undefined; + charset?: string; + content?: string; + 'http-equiv'?: string; + name?: string; + media?: string; } export interface MeterHTMLAttributes extends HTMLAttributes { - form?: string | undefined; - high?: number | undefined; - low?: number | undefined; - max?: number | string | undefined; - min?: number | string | undefined; - optimum?: number | undefined; - value?: string | ReadonlyArray | number | undefined; + form?: string; + high?: number; + low?: number; + max?: number | string; + min?: number | string; + optimum?: number; + value?: string | ReadonlyArray | number; } export interface QuoteHTMLAttributes extends HTMLAttributes { - cite?: string | undefined; + cite?: string; } export interface ObjectHTMLAttributes extends HTMLAttributes { - classid?: string | undefined; - form?: string | undefined; - height?: number | string | undefined; - name?: string | undefined; - type?: string | undefined; - usemap?: string | undefined; - width?: number | string | undefined; + classid?: string; + form?: string; + height?: number | string; + name?: string; + type?: string; + usemap?: string; + width?: number | string; } export interface OlHTMLAttributes extends HTMLAttributes { - reversed?: boolean | undefined; - start?: number | undefined; - type?: "1" | "a" | "A" | "i" | "I" | undefined; + reversed?: boolean; + start?: number; + type?: '1' | 'a' | 'A' | 'i' | 'I'; } export interface OptgroupHTMLAttributes extends HTMLAttributes { - disabled?: boolean | undefined; - label?: string | undefined; + disabled?: boolean; + label?: string; } export interface OptionHTMLAttributes extends HTMLAttributes { - disabled?: boolean | undefined; - label?: string | undefined; - selected?: boolean | undefined; - value?: string | ReadonlyArray | number | boolean | undefined; + disabled?: boolean; + label?: string; + selected?: boolean; + value?: string | ReadonlyArray | number | boolean; } export interface OutputHTMLAttributes extends HTMLAttributes { - form?: string | undefined; - name?: string | undefined; + form?: string; + name?: string; } export interface ParamHTMLAttributes extends HTMLAttributes { - name?: string | undefined; - value?: string | ReadonlyArray | number | undefined; + name?: string; + value?: string | ReadonlyArray | number; } export interface ProgressHTMLAttributes extends HTMLAttributes { - max?: number | string | undefined; - value?: string | ReadonlyArray | number | undefined; + max?: number | string; + value?: string | ReadonlyArray | number; } export interface SlotHTMLAttributes extends HTMLAttributes { - name?: string | undefined; + name?: string; } export interface ScriptHTMLAttributes extends HTMLAttributes { - async?: boolean | undefined; + async?: boolean; /** @deprecated */ - charset?: string | undefined; - crossorigin?: true | "anonymous" | "use-credentials" | "" | undefined; - defer?: boolean | undefined; - integrity?: string | undefined; - nomodule?: boolean | undefined; - nonce?: string | undefined; - referrerpolicy?: HTMLAttributeReferrerPolicy | undefined; - src?: string | undefined; - type?: string | undefined; + charset?: string; + crossorigin?: true | 'anonymous' | 'use-credentials' | ''; + defer?: boolean; + integrity?: string; + nomodule?: boolean; + nonce?: string; + referrerpolicy?: HTMLAttributeReferrerPolicy; + src?: string; + type?: string; } export interface SelectHTMLAttributes extends HTMLAttributes { - autocomplete?: string | undefined; - autofocus?: boolean | undefined; - disabled?: boolean | undefined; - form?: string | undefined; - multiple?: boolean | undefined; - name?: string | undefined; - required?: boolean | undefined; - size?: number | undefined; - value?: string | ReadonlyArray | number | undefined; - onchange?: ChangeEventHandler | undefined; + autocomplete?: string; + autofocus?: boolean; + disabled?: boolean; + form?: string; + multiple?: boolean; + name?: string; + required?: boolean; + size?: number; + value?: string | ReadonlyArray | number; + onchange?: ChangeEventHandler; } export interface SourceHTMLAttributes extends HTMLAttributes { - height?: number | string | undefined; - media?: string | undefined; - sizes?: string | undefined; - src?: string | undefined; - srcset?: string | undefined; - type?: string | undefined; - width?: number | string | undefined; + height?: number | string; + media?: string; + sizes?: string; + src?: string; + srcset?: string; + type?: string; + width?: number | string; } export interface StyleHTMLAttributes extends HTMLAttributes { - media?: string | undefined; - nonce?: string | undefined; - scoped?: boolean | undefined; - type?: string | undefined; + media?: string; + nonce?: string; + scoped?: boolean; + type?: string; } export interface TableHTMLAttributes extends HTMLAttributes { - summary?: string | undefined; - width?: number | string | undefined; + summary?: string; + width?: number | string; } export interface TextareaHTMLAttributes extends HTMLAttributes { - autocomplete?: string | undefined; - autofocus?: boolean | undefined; - cols?: number | undefined; - dirname?: string | undefined; - disabled?: boolean | undefined; - form?: string | undefined; - maxlength?: number | undefined; - minlength?: number | undefined; - name?: string | undefined; - placeholder?: string | undefined; - readonly?: boolean | undefined; - required?: boolean | undefined; - rows?: number | undefined; - value?: string | ReadonlyArray | number | undefined; - wrap?: string | undefined; - - onchange?: ChangeEventHandler | undefined; + autocomplete?: string; + autofocus?: boolean; + cols?: number; + dirname?: string; + disabled?: boolean; + form?: string; + maxlength?: number; + minlength?: number; + name?: string; + placeholder?: string; + readonly?: boolean; + required?: boolean; + rows?: number; + value?: string | ReadonlyArray | number; + wrap?: string; + + onchange?: ChangeEventHandler; } export interface TdHTMLAttributes extends HTMLAttributes { - align?: "left" | "center" | "right" | "justify" | "char" | undefined; - colspan?: number | undefined; - headers?: string | undefined; - rowspan?: number | undefined; - scope?: string | undefined; - abbr?: string | undefined; - height?: number | string | undefined; - width?: number | string | undefined; + align?: 'left' | 'center' | 'right' | 'justify' | 'char'; + colspan?: number; + headers?: string; + rowspan?: number; + scope?: string; + abbr?: string; + height?: number | string; + width?: number | string; } export interface ThHTMLAttributes extends HTMLAttributes { - align?: "left" | "center" | "right" | "justify" | "char" | undefined; - colspan?: number | undefined; - headers?: string | undefined; - rowspan?: number | undefined; - scope?: string | undefined; - abbr?: string | undefined; + align?: 'left' | 'center' | 'right' | 'justify' | 'char'; + colspan?: number; + headers?: string; + rowspan?: number; + scope?: string; + abbr?: string; } export interface TimeHTMLAttributes extends HTMLAttributes { - datetime?: string | undefined; + datetime?: string; } export interface TrackHTMLAttributes extends HTMLAttributes { - default?: boolean | undefined; - kind?: string | undefined; - label?: string | undefined; - src?: string | undefined; - srclang?: string | undefined; + default?: boolean; + kind?: string; + label?: string; + src?: string; + srclang?: string; } export interface VideoHTMLAttributes extends MediaHTMLAttributes { - height?: number | string | undefined; - playsinline?: boolean | undefined; - poster?: string | undefined; - width?: number | string | undefined; - disablePictureInPicture?: boolean | undefined; - disableRemotePlayback?: boolean | undefined; + height?: number | string; + playsinline?: boolean; + poster?: string; + width?: number | string; + disablePictureInPicture?: boolean; + disableRemotePlayback?: boolean; } // The three broad type categories are (in order of restrictiveness): @@ -1252,355 +1187,178 @@ export interface VideoHTMLAttributes extends MediaHTMLAttributes { // - union of string literals export interface SVGAttributes extends AriaAttributes, DOMAttributes { // Attributes which also defined in HTMLAttributes - class?: string | undefined; - color?: string | undefined; - height?: number | string | undefined; - id?: string | undefined; - lang?: string | undefined; - max?: number | string | undefined; - media?: string | undefined; - method?: string | undefined; - min?: number | string | undefined; - name?: string | undefined; - style?: string | undefined; - target?: string | undefined; - type?: string | undefined; - width?: number | string | undefined; + class?: string; + color?: string; + height?: number | string; + id?: string; + lang?: string; + max?: number | string; + media?: string; + method?: string; + min?: number | string; + name?: string; + style?: string; + target?: string; + type?: string; + width?: number | string; // Other HTML properties supported by SVG elements in browsers - role?: AriaRole | undefined; - tabindex?: number | undefined; - crossorigin?: true | "anonymous" | "use-credentials" | "" | undefined; + role?: AriaRole; + tabindex?: number; + crossorigin?: true | 'anonymous' | 'use-credentials' | ''; // SVG Specific attributes - contentScriptType?: number | string | undefined; - contentStyleType?: number | string | undefined; - cursor?: number | string | undefined; - display?: number | string | undefined; - fill?: string | undefined; - filter?: string | undefined; - mask?: string | undefined; - opacity?: number | string | undefined; - preserveAspectRatio?: string | undefined; - requiredExtensions?: number | string | undefined; - stroke?: string | undefined; - systemLanguage?: number | string | undefined; - transform?: string | undefined; - viewBox?: string | undefined; - visibility?: number | string | undefined; - x?: number | string | undefined; - xmlns?: string | undefined; - y?: number | string | undefined; -} - -export type ElementTagHTMLAttributes = AllHTMLAttributes<"div"> & { + contentScriptType?: number | string; + contentStyleType?: number | string; + cursor?: number | string; + display?: number | string; + fill?: string; + filter?: string; + mask?: string; + opacity?: number | string; + preserveAspectRatio?: string; + requiredExtensions?: number | string; + stroke?: string; + systemLanguage?: number | string; + transform?: string; + viewBox?: string; + visibility?: number | string; + x?: number | string; + xmlns?: string; + y?: number | string; +} + +export type ElementTagHTMLAttributes = AllHTMLAttributes<'div'> & { tag?: string; }; -type ExoticElements = Record< - string, - DetailedHTMLProps, HTMLElement> ->; +type ExoticElements = Record, HTMLElement>>; declare global { namespace JSX { type Element = NullstackNode; - interface IntrinsicAttributes extends NullstackAttributes { } - interface IntrinsicClassAttributes extends ClassAttributes { } + interface IntrinsicAttributes extends NullstackAttributes {} + interface IntrinsicClassAttributes extends ClassAttributes {} interface AllElements { // HTML - a: DetailedHTMLProps< - AnchorHTMLAttributes, - HTMLAnchorElement - >; + a: DetailedHTMLProps, HTMLAnchorElement>; abbr: DetailedHTMLProps, HTMLElement>; address: DetailedHTMLProps, HTMLElement>; - area: DetailedHTMLProps< - AreaHTMLAttributes, - HTMLAreaElement - >; + area: DetailedHTMLProps, HTMLAreaElement>; article: DetailedHTMLProps, HTMLElement>; aside: DetailedHTMLProps, HTMLElement>; - audio: DetailedHTMLProps< - AudioHTMLAttributes, - HTMLAudioElement - >; + audio: DetailedHTMLProps, HTMLAudioElement>; b: DetailedHTMLProps, HTMLElement>; - base: DetailedHTMLProps< - BaseHTMLAttributes, - HTMLBaseElement - >; + base: DetailedHTMLProps, HTMLBaseElement>; bdi: DetailedHTMLProps, HTMLElement>; bdo: DetailedHTMLProps, HTMLElement>; big: DetailedHTMLProps, HTMLElement>; - blockquote: DetailedHTMLProps< - BlockquoteHTMLAttributes, - HTMLQuoteElement - >; + blockquote: DetailedHTMLProps, HTMLQuoteElement>; body: DetailedHTMLProps, HTMLBodyElement>; br: DetailedHTMLProps, HTMLBRElement>; - button: DetailedHTMLProps< - ButtonHTMLAttributes, - HTMLButtonElement - >; - canvas: DetailedHTMLProps< - CanvasHTMLAttributes, - HTMLCanvasElement - >; + button: DetailedHTMLProps, HTMLButtonElement>; + canvas: DetailedHTMLProps, HTMLCanvasElement>; caption: DetailedHTMLProps, HTMLElement>; cite: DetailedHTMLProps, HTMLElement>; code: DetailedHTMLProps, HTMLElement>; - col: DetailedHTMLProps< - ColHTMLAttributes, - HTMLTableColElement - >; - colgroup: DetailedHTMLProps< - ColgroupHTMLAttributes, - HTMLTableColElement - >; - data: DetailedHTMLProps< - DataHTMLAttributes, - HTMLDataElement - >; - datalist: DetailedHTMLProps< - HTMLAttributes, - HTMLDataListElement - >; + col: DetailedHTMLProps, HTMLTableColElement>; + colgroup: DetailedHTMLProps, HTMLTableColElement>; + data: DetailedHTMLProps, HTMLDataElement>; + datalist: DetailedHTMLProps, HTMLDataListElement>; dd: DetailedHTMLProps, HTMLElement>; del: DetailedHTMLProps, HTMLModElement>; - details: DetailedHTMLProps< - DetailsHTMLAttributes, - HTMLDetailsElement - >; + details: DetailedHTMLProps, HTMLDetailsElement>; dfn: DetailedHTMLProps, HTMLElement>; - dialog: DetailedHTMLProps< - DialogHTMLAttributes, - HTMLDialogElement - >; + dialog: DetailedHTMLProps, HTMLDialogElement>; div: DetailedHTMLProps, HTMLDivElement>; dl: DetailedHTMLProps, HTMLDListElement>; dt: DetailedHTMLProps, HTMLElement>; em: DetailedHTMLProps, HTMLElement>; - embed: DetailedHTMLProps< - EmbedHTMLAttributes, - HTMLEmbedElement - >; - fieldset: DetailedHTMLProps< - FieldsetHTMLAttributes, - HTMLFieldSetElement - >; + embed: DetailedHTMLProps, HTMLEmbedElement>; + fieldset: DetailedHTMLProps, HTMLFieldSetElement>; figcaption: DetailedHTMLProps, HTMLElement>; figure: DetailedHTMLProps, HTMLElement>; footer: DetailedHTMLProps, HTMLElement>; - form: DetailedHTMLProps< - FormHTMLAttributes, - HTMLFormElement - >; - h1: DetailedHTMLProps< - HTMLAttributes, - HTMLHeadingElement - >; - h2: DetailedHTMLProps< - HTMLAttributes, - HTMLHeadingElement - >; - h3: DetailedHTMLProps< - HTMLAttributes, - HTMLHeadingElement - >; - h4: DetailedHTMLProps< - HTMLAttributes, - HTMLHeadingElement - >; - h5: DetailedHTMLProps< - HTMLAttributes, - HTMLHeadingElement - >; - h6: DetailedHTMLProps< - HTMLAttributes, - HTMLHeadingElement - >; + form: DetailedHTMLProps, HTMLFormElement>; + h1: DetailedHTMLProps, HTMLHeadingElement>; + h2: DetailedHTMLProps, HTMLHeadingElement>; + h3: DetailedHTMLProps, HTMLHeadingElement>; + h4: DetailedHTMLProps, HTMLHeadingElement>; + h5: DetailedHTMLProps, HTMLHeadingElement>; + h6: DetailedHTMLProps, HTMLHeadingElement>; head: DetailedHTMLProps, HTMLHeadElement>; header: DetailedHTMLProps, HTMLElement>; hgroup: DetailedHTMLProps, HTMLElement>; hr: DetailedHTMLProps, HTMLHRElement>; - html: DetailedHTMLProps< - HtmlHTMLAttributes, - HTMLHtmlElement - >; + html: DetailedHTMLProps, HTMLHtmlElement>; i: DetailedHTMLProps, HTMLElement>; - iframe: DetailedHTMLProps< - IframeHTMLAttributes, - HTMLIFrameElement - >; - img: DetailedHTMLProps< - ImgHTMLAttributes, - HTMLImageElement - >; - input: DetailedHTMLProps< - InputHTMLAttributes, - HTMLInputElement - >; + iframe: DetailedHTMLProps, HTMLIFrameElement>; + img: DetailedHTMLProps, HTMLImageElement>; + input: DetailedHTMLProps, HTMLInputElement>; ins: DetailedHTMLProps, HTMLModElement>; kbd: DetailedHTMLProps, HTMLElement>; /** @deprecated */ keygen: DetailedHTMLProps, HTMLElement>; - label: DetailedHTMLProps< - LabelHTMLAttributes, - HTMLLabelElement - >; - legend: DetailedHTMLProps< - HTMLAttributes, - HTMLLegendElement - >; + label: DetailedHTMLProps, HTMLLabelElement>; + legend: DetailedHTMLProps, HTMLLegendElement>; li: DetailedHTMLProps, HTMLLIElement>; - link: DetailedHTMLProps< - LinkHTMLAttributes, - HTMLLinkElement - >; + link: DetailedHTMLProps, HTMLLinkElement>; main: DetailedHTMLProps, HTMLElement>; map: DetailedHTMLProps, HTMLMapElement>; mark: DetailedHTMLProps, HTMLElement>; menu: DetailedHTMLProps, HTMLElement>; menuitem: DetailedHTMLProps, HTMLElement>; - meta: DetailedHTMLProps< - MetaHTMLAttributes, - HTMLMetaElement - >; - meter: DetailedHTMLProps< - MeterHTMLAttributes, - HTMLMeterElement - >; + meta: DetailedHTMLProps, HTMLMetaElement>; + meter: DetailedHTMLProps, HTMLMeterElement>; nav: DetailedHTMLProps, HTMLElement>; noindex: DetailedHTMLProps, HTMLElement>; noscript: DetailedHTMLProps, HTMLElement>; - object: DetailedHTMLProps< - ObjectHTMLAttributes, - HTMLObjectElement - >; - ol: DetailedHTMLProps< - OlHTMLAttributes, - HTMLOListElement - >; - optgroup: DetailedHTMLProps< - OptgroupHTMLAttributes, - HTMLOptGroupElement - >; - option: DetailedHTMLProps< - OptionHTMLAttributes, - HTMLOptionElement - >; - output: DetailedHTMLProps< - OutputHTMLAttributes, - HTMLOutputElement - >; - p: DetailedHTMLProps< - HTMLAttributes, - HTMLParagraphElement - >; - param: DetailedHTMLProps< - ParamHTMLAttributes, - HTMLParamElement - >; + object: DetailedHTMLProps, HTMLObjectElement>; + ol: DetailedHTMLProps, HTMLOListElement>; + optgroup: DetailedHTMLProps, HTMLOptGroupElement>; + option: DetailedHTMLProps, HTMLOptionElement>; + output: DetailedHTMLProps, HTMLOutputElement>; + p: DetailedHTMLProps, HTMLParagraphElement>; + param: DetailedHTMLProps, HTMLParamElement>; picture: DetailedHTMLProps, HTMLElement>; pre: DetailedHTMLProps, HTMLPreElement>; - progress: DetailedHTMLProps< - ProgressHTMLAttributes, - HTMLProgressElement - >; - q: DetailedHTMLProps< - QuoteHTMLAttributes, - HTMLQuoteElement - >; + progress: DetailedHTMLProps, HTMLProgressElement>; + q: DetailedHTMLProps, HTMLQuoteElement>; rp: DetailedHTMLProps, HTMLElement>; rt: DetailedHTMLProps, HTMLElement>; ruby: DetailedHTMLProps, HTMLElement>; s: DetailedHTMLProps, HTMLElement>; samp: DetailedHTMLProps, HTMLElement>; - slot: DetailedHTMLProps< - SlotHTMLAttributes, - HTMLSlotElement - >; - script: DetailedHTMLProps< - ScriptHTMLAttributes, - HTMLScriptElement - >; + slot: DetailedHTMLProps, HTMLSlotElement>; + script: DetailedHTMLProps, HTMLScriptElement>; section: DetailedHTMLProps, HTMLElement>; - select: DetailedHTMLProps< - SelectHTMLAttributes, - HTMLSelectElement - >; + select: DetailedHTMLProps, HTMLSelectElement>; small: DetailedHTMLProps, HTMLElement>; - source: DetailedHTMLProps< - SourceHTMLAttributes, - HTMLSourceElement - >; + source: DetailedHTMLProps, HTMLSourceElement>; span: DetailedHTMLProps, HTMLSpanElement>; strong: DetailedHTMLProps, HTMLElement>; - style: DetailedHTMLProps< - StyleHTMLAttributes, - HTMLStyleElement - >; + style: DetailedHTMLProps, HTMLStyleElement>; sub: DetailedHTMLProps, HTMLElement>; summary: DetailedHTMLProps, HTMLElement>; sup: DetailedHTMLProps, HTMLElement>; - table: DetailedHTMLProps< - TableHTMLAttributes, - HTMLTableElement - >; - template: DetailedHTMLProps< - HTMLAttributes, - HTMLTemplateElement - >; - tbody: DetailedHTMLProps< - HTMLAttributes, - HTMLTableSectionElement - >; - td: DetailedHTMLProps< - TdHTMLAttributes, - HTMLTableDataCellElement - >; - textarea: DetailedHTMLProps< - TextareaHTMLAttributes, - HTMLTextAreaElement - >; - tfoot: DetailedHTMLProps< - HTMLAttributes, - HTMLTableSectionElement - >; - th: DetailedHTMLProps< - ThHTMLAttributes, - HTMLTableHeaderCellElement - >; - thead: DetailedHTMLProps< - HTMLAttributes, - HTMLTableSectionElement - >; - time: DetailedHTMLProps< - TimeHTMLAttributes, - HTMLTimeElement - >; - title: DetailedHTMLProps< - HTMLAttributes, - HTMLTitleElement - >; - tr: DetailedHTMLProps< - HTMLAttributes, - HTMLTableRowElement - >; - track: DetailedHTMLProps< - TrackHTMLAttributes, - HTMLTrackElement - >; + table: DetailedHTMLProps, HTMLTableElement>; + template: DetailedHTMLProps, HTMLTemplateElement>; + tbody: DetailedHTMLProps, HTMLTableSectionElement>; + td: DetailedHTMLProps, HTMLTableDataCellElement>; + textarea: DetailedHTMLProps, HTMLTextAreaElement>; + tfoot: DetailedHTMLProps, HTMLTableSectionElement>; + th: DetailedHTMLProps, HTMLTableHeaderCellElement>; + thead: DetailedHTMLProps, HTMLTableSectionElement>; + time: DetailedHTMLProps, HTMLTimeElement>; + title: DetailedHTMLProps, HTMLTitleElement>; + tr: DetailedHTMLProps, HTMLTableRowElement>; + track: DetailedHTMLProps, HTMLTrackElement>; u: DetailedHTMLProps, HTMLElement>; ul: DetailedHTMLProps, HTMLUListElement>; var: DetailedHTMLProps, HTMLElement>; - video: DetailedHTMLProps< - VideoHTMLAttributes, - HTMLVideoElement - >; + video: DetailedHTMLProps, HTMLVideoElement>; wbr: DetailedHTMLProps, HTMLElement>; // SVG @@ -1666,6 +1424,6 @@ declare global { element: ElementTagHTMLAttributes; } - interface IntrinsicElements extends ExoticElements, AllElements { } + interface IntrinsicElements extends ExoticElements, AllElements {} } } diff --git a/types/Page.d.ts b/types/Page.d.ts index c4b5696a..7f77d1e7 100644 --- a/types/Page.d.ts +++ b/types/Page.d.ts @@ -1,5 +1,4 @@ export type NullstackPage = { - /** * Current page title * @@ -49,14 +48,7 @@ export type NullstackPage = { * * @see https://nullstack.app/context-page */ - changes: - | "always" - | "hourly" - | "daily" - | "weekly" - | "monthly" - | "yearly" - | "never"; + changes: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'; /** * Represents the `priority` key in the **sitemap.xml** @@ -81,5 +73,4 @@ export type NullstackPage = { * @see https://nullstack.app/context-page#custom-events */ event: string; - -}; \ No newline at end of file +}; diff --git a/types/Params.d.ts b/types/Params.d.ts index 9d39ff54..99e7c33f 100644 --- a/types/Params.d.ts +++ b/types/Params.d.ts @@ -1,3 +1 @@ -export type NullstackParams = { - [key: string]: string | boolean; -}; \ No newline at end of file +export type NullstackParams = Record; diff --git a/types/Plugin.d.ts b/types/Plugin.d.ts index 04298d3c..62cd3805 100644 --- a/types/Plugin.d.ts +++ b/types/Plugin.d.ts @@ -1,5 +1,5 @@ -import { NullstackClientContext } from "./ClientContext"; -import { AllHTMLAttributes, NullstackAttributes } from "./JSX"; +import { NullstackClientContext } from './ClientContext'; +import { AllHTMLAttributes, NullstackAttributes } from './JSX'; type NullstackPluginNode = { type: string | boolean; diff --git a/types/Project.d.ts b/types/Project.d.ts index 5380b6e5..b9220711 100644 --- a/types/Project.d.ts +++ b/types/Project.d.ts @@ -1,5 +1,4 @@ export type NullstackProject = { - domain: string; /** @@ -54,6 +53,5 @@ export type NullstackProject = { cdn: string; - protocol: "http" | "https"; - + protocol: 'http' | 'https'; }; diff --git a/types/Router.d.ts b/types/Router.d.ts index 258d9143..d9fed028 100644 --- a/types/Router.d.ts +++ b/types/Router.d.ts @@ -1,5 +1,4 @@ export type NullstackRouter = { - /** * The router path including query params. * Does not contain the domain and port. @@ -37,5 +36,4 @@ export type NullstackRouter = { * @default null */ previous: string; - -}; \ No newline at end of file +}; diff --git a/types/Secrets.d.ts b/types/Secrets.d.ts index 35f14fa0..827eb91d 100644 --- a/types/Secrets.d.ts +++ b/types/Secrets.d.ts @@ -1,3 +1 @@ -export type NullstackSecrets = { - [key: string]: string | boolean; -}; \ No newline at end of file +export type NullstackSecrets = Record; diff --git a/types/Server.d.ts b/types/Server.d.ts index 0903c379..7cac537e 100644 --- a/types/Server.d.ts +++ b/types/Server.d.ts @@ -1,5 +1,4 @@ export type NullstackServer = { - get(...args); post(...args); @@ -24,5 +23,4 @@ export type NullstackServer = { * Will be passed as the argument to [express cors plugin](https://expressjs.com/en/resources/middleware/cors.html). */ cors: object; - -}; \ No newline at end of file +}; diff --git a/types/ServerContext.d.ts b/types/ServerContext.d.ts index 576e4062..e004bb16 100644 --- a/types/ServerContext.d.ts +++ b/types/ServerContext.d.ts @@ -1,15 +1,14 @@ -import { NullstackEnvironment } from "./Environment"; -import { NullstackProject } from "./Project"; -import { NullstackSecrets } from "./Secrets"; -import { NullstackServer } from "./Server"; -import { NullstackSettings } from "./Settings"; -import { NullstackWorker } from "./Worker"; +import { NullstackEnvironment } from './Environment'; +import { NullstackProject } from './Project'; +import { NullstackSecrets } from './Secrets'; +import { NullstackServer } from './Server'; +import { NullstackSettings } from './Settings'; +import { NullstackWorker } from './Worker'; /** * @see https://nullstack.app/context */ export type NullstackServerContext = { - /** * Information about the app manifest and some metatags. * @@ -80,5 +79,4 @@ export type NullstackServerContext = { secrets?: NullstackSecrets; [key: string]: any; - }; diff --git a/types/Settings.d.ts b/types/Settings.d.ts index ccfbb720..a4812021 100644 --- a/types/Settings.d.ts +++ b/types/Settings.d.ts @@ -1,3 +1 @@ -export type NullstackSettings = { - [key: string]: string | boolean; -}; \ No newline at end of file +export type NullstackSettings = Record; diff --git a/types/Worker.d.ts b/types/Worker.d.ts index ed83185a..18f9af25 100644 --- a/types/Worker.d.ts +++ b/types/Worker.d.ts @@ -1,5 +1,4 @@ export type NullstackWorker = { - /** * - keys: server functions names * - values: array of these functions arguments @@ -21,5 +20,4 @@ export type NullstackWorker = { * @see https://nullstack.app/service-worker#loading-screens */ loading: boolean; - -}; \ No newline at end of file +}; diff --git a/types/index.d.ts b/types/index.d.ts index f490fa0b..880209a6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,49 +1,48 @@ -import { NullstackClientContext } from "./ClientContext"; -import { NullstackPlugin } from "./Plugin"; -import { NullstackServerContext } from "./ServerContext"; - -export interface NullstackContext - extends NullstackClientContext, - NullstackServerContext { } - -export * from "./ClientContext"; -export * from "./Environment"; -export * from "./Page"; -export * from "./Params"; -export * from "./Plugin"; -export * from "./Project"; -export * from "./Router"; -export * from "./Secrets"; -export * from "./Server"; -export * from "./ServerContext"; -export * from "./Settings"; -export * from "./Worker"; -export * from "./JSX"; - -export default class Nullstack { +import { NullstackClientContext } from './ClientContext'; +import { NullstackNode } from './JSX'; +import { NullstackPlugin } from './Plugin'; +import { NullstackServerContext } from './ServerContext'; + +export interface NullstackContext extends NullstackClientContext, NullstackServerContext {} + +export * from './ClientContext'; +export * from './Environment'; +export * from './Page'; +export * from './Params'; +export * from './Plugin'; +export * from './Project'; +export * from './Router'; +export * from './Secrets'; +export * from './Server'; +export * from './ServerContext'; +export * from './Settings'; +export * from './Worker'; +export * from './JSX'; + +export default class Nullstack { constructor(props?: TProps); /** * @param App A Nullstack app root component */ - static start?(App: any): NullstackContext; + static start(App: typeof this): NullstackContext; /** * Use a plugin */ - static use?(Plugin: NullstackPlugin): void; + static use(Plugin: NullstackPlugin): void; /** * Could run on the server or client. * @see https://nullstack.app/full-stack-lifecycle#prepare */ - prepare?(context: NullstackContext & TProps): void; + prepare?(context: NullstackContext): void; /** * Could run on the server or client. * @see https://nullstack.app/full-stack-lifecycle#initiate */ - initiate?(context: NullstackContext & TProps): void; + initiate?(context: NullstackContext): void; initiated: boolean; @@ -51,13 +50,13 @@ export default class Nullstack { * Could run on the server or client. * @see https://nullstack.app/full-stack-lifecycle#launch */ - launch?(context: NullstackContext & TProps): void; + launch?(context: NullstackContext): void; /** * Runs on the client. * @see https://nullstack.app/full-stack-lifecycle#hydrate */ - hydrate?(context: NullstackClientContext & TProps): void; + hydrate?(context: NullstackClientContext): void; hydrated: boolean; @@ -65,17 +64,17 @@ export default class Nullstack { * Runs on the client. * @see https://nullstack.app/full-stack-lifecycle#update */ - update?(context: NullstackContext & TProps): void; + update?(context: NullstackContext): void; /** * Runs on the client. * @see https://nullstack.app/full-stack-lifecycle#terminate */ - terminate?(context: NullstackContext & TProps): void; + terminate?(context: NullstackContext): void; terminated: boolean; - render?(context: NullstackContext & TProps): void; + render?(context: NullstackContext): void; prerendered: boolean;