native-canvas
Version:
A canvas library allows for a HTML canvas to run natively on NodeJs, without a WebBrowser
521 lines (520 loc) • 22.6 kB
TypeScript
import { SdlContext } from './sdl-context';
import { NativeWindow } from '../../../window/native-window';
export declare class SdlCanvas implements HTMLCanvasElement {
window: NativeWindow;
private _accessKeyLabel;
private _autocapitalize;
private _translate;
private _onfullscreenchange;
private _onfullscreenerror;
private _onauxclick;
private _oncancel;
private _onclose;
private _ondragexit;
private _onloadend;
private _onresize;
private _onsecuritypolicyviolation;
private _ontoggle;
private _inputMode;
private _nonce;
private _firstChild;
private _lastChild;
private _parentNode;
private _ATTRIBUTE_NODE;
private _CDATA_SECTION_NODE;
private _COMMENT_NODE;
private _DOCUMENT_FRAGMENT_NODE;
private _DOCUMENT_NODE;
private _DOCUMENT_POSITION_CONTAINED_BY;
private _DOCUMENT_POSITION_CONTAINS;
private _DOCUMENT_POSITION_DISCONNECTED;
private _DOCUMENT_POSITION_FOLLOWING;
private _DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;
private _DOCUMENT_POSITION_PRECEDING;
private _DOCUMENT_TYPE_NODE;
private _ELEMENT_NODE;
private _ENTITY_NODE;
private _ENTITY_REFERENCE_NODE;
private _NOTATION_NODE;
private _PROCESSING_INSTRUCTION_NODE;
private _TEXT_NODE;
private _accessKey;
private _assignedSlot;
private _attributes;
private _baseURI;
private _childElementCount;
private _childNodes;
private _children;
private _classList;
private _className;
private _clientHeight;
private _clientLeft;
private _clientTop;
private _clientWidth;
private _contentEditable;
private _dataset;
private _dir;
private _draggable;
private _firstElementChild;
private _hidden;
private _hideFocus;
private _id;
private _innerHTML;
private _innerText;
private _isConnected;
private _isContentEditable;
private _lang;
private _lastElementChild;
private _localName;
private _msContentZoomFactor;
private _msRegionOverflow;
private _namespaceURI;
private _nextElementSibling;
private _nextSibling;
private _nodeName;
private _nodeType;
private _nodeValue;
private _offsetHeight;
private _offsetLeft;
private _offsetParent;
private _offsetTop;
private _offsetWidth;
private _height;
private _width;
private _onabort;
private _onactivate;
private _onanimationcancel;
private _onanimationend;
private _onanimationiteration;
private _onanimationstart;
private _onariarequest;
private _onbeforeactivate;
private _onbeforecopy;
private _onbeforecut;
private _onbeforedeactivate;
private _onbeforepaste;
private _onblur;
private _oncanplay;
private _oncanplaythrough;
private _onchange;
private _onclick;
private _oncommand;
private _oncontextmenu;
private _oncopy;
private _oncuechange;
private _oncut;
private _ondblclick;
private _ondeactivate;
private _ondrag;
private _ondragend;
private _ondragenter;
private _ondragleave;
private _ondragover;
private _ondragstart;
private _ondrop;
private _ondurationchange;
private _onemptied;
private _onended;
private _onerror;
private _onfocus;
private _ongotpointercapture;
private _oninput;
private _oninvalid;
private _onkeydown;
private _onkeypress;
private _onkeyup;
private _onload;
private _onloadeddata;
private _onloadedmetadata;
private _onloadstart;
private _onlostpointercapture;
private _onmousedown;
private _onmouseenter;
private _onmouseleave;
private _onmousemove;
private _onmouseout;
private _onmouseover;
private _onmouseup;
private _onmousewheel;
private _onmscontentzoom;
private _onmsgesturechange;
private _onmsgesturedoubletap;
private _onmsgestureend;
private _onmsgesturehold;
private _onmsgesturestart;
private _onmsgesturetap;
private _onmsgotpointercapture;
private _onmsinertiastart;
private _onmslostpointercapture;
private _onmsmanipulationstatechanged;
private _onmspointercancel;
private _onmspointerdown;
private _onmspointerenter;
private _onmspointerleave;
private _onmspointermove;
private _onmspointerout;
private _onmspointerover;
private _onmspointerup;
private _onpaste;
private _onpause;
private _onplay;
private _onplaying;
private _onpointercancel;
private _onpointerdown;
private _onpointerenter;
private _onpointerleave;
private _onpointermove;
private _onpointerout;
private _onpointerover;
private _onpointerup;
private _onprogress;
private _onratechange;
private _onreset;
private _onscroll;
private _onseeked;
private _onseeking;
private _onselect;
private _onselectstart;
private _onstalled;
private _onsubmit;
private _onsuspend;
private _ontimeupdate;
private _ontouchcancel;
private _ontouchend;
private _ontouchmove;
private _ontouchstart;
private _ontransitioncancel;
private _ontransitionend;
private _ontransitionrun;
private _ontransitionstart;
private _onvolumechange;
private _onwaiting;
private _onwebkitfullscreenchange;
private _onwebkitfullscreenerror;
private _onwheel;
private _outerHTML;
private _outerText;
private _ownerDocument;
private _parentElement;
private _prefix;
private _previousElementSibling;
private _previousSibling;
private _scrollHeight;
private _scrollLeft;
private _scrollTop;
private _scrollWidth;
private _shadowRoot;
private _slot;
private _spellcheck;
private _style;
private _tabIndex;
private _tagName;
private _textContent;
private _title;
private _nativeCtx;
private _canvas;
constructor(window: NativeWindow);
firstChild: Node | any;
lastChild: Node | any;
parentNode: Node | any;
ATTRIBUTE_NODE: number;
CDATA_SECTION_NODE: number;
COMMENT_NODE: number;
DOCUMENT_FRAGMENT_NODE: number;
DOCUMENT_NODE: number;
DOCUMENT_POSITION_CONTAINED_BY: number;
DOCUMENT_POSITION_CONTAINS: number;
DOCUMENT_POSITION_DISCONNECTED: number;
DOCUMENT_POSITION_FOLLOWING: number;
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
DOCUMENT_POSITION_PRECEDING: number;
DOCUMENT_TYPE_NODE: number;
ELEMENT_NODE: number;
ENTITY_NODE: number;
ENTITY_REFERENCE_NODE: number;
NOTATION_NODE: number;
PROCESSING_INSTRUCTION_NODE: number;
TEXT_NODE: number;
assignedSlot: HTMLSlotElement | null;
attributes: NamedNodeMap;
baseURI: string | null;
childElementCount: number;
childNodes: NodeListOf<Node & ChildNode>;
children: HTMLCollection;
classList: DOMTokenList;
clientHeight: number;
clientLeft: number;
clientTop: number;
clientWidth: number;
dataset: DOMStringMap;
firstElementChild: Element | null;
isConnected: boolean;
isContentEditable: boolean;
lastElementChild: Element | null;
localName: string | null;
msRegionOverflow: string;
namespaceURI: string | null;
nextElementSibling: Element | null;
nextSibling: Node | null;
nodeName: string;
nodeType: number;
offsetHeight: number;
offsetLeft: number;
offsetParent: Element;
offsetTop: number;
offsetWidth: number;
ownerDocument: Document;
parentElement: HTMLElement | null;
prefix: string | null;
previousElementSibling: Element | null;
previousSibling: Node | null;
scrollHeight: number;
scrollWidth: number;
shadowRoot: ShadowRoot | null;
style: CSSStyleDeclaration;
tagName: string;
accessKeyLabel: string;
autocapitalize: string;
translate: boolean;
inputMode: string;
nonce: string;
accessKey: string;
className: string;
contentEditable: string;
dir: string;
draggable: boolean;
hidden: boolean;
hideFocus: boolean;
id: string;
innerHTML: string;
innerText: string;
lang: string;
msContentZoomFactor: number;
nodeValue: string | null;
height: number;
width: number;
onactivate: ((this: HTMLElement, ev: Event) => any) | null;
onariarequest: ((this: Element, ev: Event) => any) | null;
onbeforeactivate: ((this: HTMLElement, ev: Event) => any) | null;
onbeforecopy: ((this: HTMLElement, ev: Event) => any) | null;
onbeforecut: ((this: HTMLElement, ev: Event) => any) | null;
onbeforedeactivate: ((this: HTMLElement, ev: Event) => any) | null;
onbeforepaste: ((this: HTMLElement, ev: Event) => any) | null;
oncommand: ((this: Element, ev: Event) => any) | null;
ondeactivate: ((this: HTMLElement, ev: Event) => any) | null;
onmousewheel: ((this: HTMLElement, ev: WheelEvent) => any) | null;
onmscontentzoom: ((this: HTMLElement, ev: Event) => any) | null;
onmsgesturechange: ((this: Element, ev: Event) => any) | null;
onmsgesturedoubletap: ((this: Element, ev: Event) => any) | null;
onmsgestureend: ((this: Element, ev: Event) => any) | null;
onmsgesturehold: ((this: Element, ev: Event) => any) | null;
onmsgesturestart: ((this: Element, ev: Event) => any) | null;
onmsgesturetap: ((this: Element, ev: Event) => any) | null;
onmsgotpointercapture: ((this: Element, ev: Event) => any) | null;
onmsinertiastart: ((this: Element, ev: Event) => any) | null;
onmslostpointercapture: ((this: Element, ev: Event) => any) | null;
onmsmanipulationstatechanged: ((this: HTMLElement, ev: Event) => any) | null;
onmspointercancel: ((this: Element, ev: Event) => any) | null;
onmspointerdown: ((this: Element, ev: Event) => any) | null;
onmspointerenter: ((this: Element, ev: Event) => any) | null;
onmspointerleave: ((this: Element, ev: Event) => any) | null;
onmspointermove: ((this: Element, ev: Event) => any) | null;
onmspointerout: ((this: Element, ev: Event) => any) | null;
onmspointerover: ((this: Element, ev: Event) => any) | null;
onmspointerup: ((this: Element, ev: Event) => any) | null;
onselectstart: ((this: HTMLElement, ev: Event) => any) | null;
onwebkitfullscreenchange: ((this: Element, ev: Event) => any) | null;
onwebkitfullscreenerror: ((this: Element, ev: Event) => any) | null;
outerHTML: string;
outerText: string;
scrollLeft: number;
scrollTop: number;
slot: string;
spellcheck: boolean;
tabIndex: number;
textContent: string | null;
title: string;
nativeCtx: SdlContext;
animate(keyframes: any[] | any | null, options?: number | any): Animation;
appendChild<T extends Node>(newChild: T): T;
attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;
blur(): void;
click(): void;
cloneNode(deep?: boolean): Node;
closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
closest(selector: string): Element | null;
compareDocumentPosition(other: Node): number;
contains(child: Node): boolean;
dispatchEvent(evt: Event): boolean;
dragDrop(): boolean;
focus(): void;
getAnimations(): Animation[];
getAttribute(qualifiedName: string): string | null;
getAttributeNS(namespaceURI: string, localName: string): string;
getAttributeNode(name: string): Attr | null;
getAttributeNodeNS(namespaceURI: string, localName: string): Attr | null;
getBoundingClientRect(): ClientRect | DOMRect;
getClientRects(): ClientRectList | DOMRectList;
getElementsByTagName(name: any): any;
getElementsByTagNameNS(namespaceURI: 'http://www.w3.org/1999/xhtml', localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: 'http://www.w3.org/2000/svg', localName: string): HTMLCollectionOf<SVGElement>;
getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;
hasAttribute(name: string): boolean;
hasAttributeNS(namespaceURI: string, localName: string): boolean;
hasAttributes(): boolean;
hasChildNodes(): boolean;
hasPointerCapture(pointerId: number): boolean;
insertAdjacentElement(position: InsertPosition, insertedElement: Element): Element | null;
insertAdjacentHTML(where: InsertPosition, html: string): void;
insertAdjacentText(where: InsertPosition, text: string): void;
insertBefore<T extends Node>(newChild: T, refChild: Node | null): T;
isDefaultNamespace(namespaceURI: string | null): boolean;
isEqualNode(arg: Node): boolean;
isSameNode(other: Node): boolean;
lookupNamespaceURI(prefix: string | null): string | null;
lookupPrefix(namespaceURI: string | null): string | null;
matches(selectors: string): boolean;
msGetInputContext(): MSInputMethodContext;
msGetRegionContent(): any;
msGetUntransformedBounds(): ClientRect;
msMatchesSelector(selectors: string): boolean;
msReleasePointerCapture(pointerId: number): void;
msSetPointerCapture(pointerId: number): void;
msZoomTo(args: any): void;
normalize(): void;
remove(): void;
removeAttribute(qualifiedName: string): void;
removeAttributeNS(namespaceURI: string, localName: string): void;
removeAttributeNode(oldAttr: Attr): Attr;
removeChild<T extends Node>(oldChild: T): T;
replaceChild<T extends Node>(newChild: Node, oldChild: T): T;
requestPointerLock(): void;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollTo(x: number, y: number): void;
setAttribute(qualifiedName: string, value: string): void;
setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;
setAttributeNode(newAttr: Attr): Attr;
setAttributeNodeNS(newAttr: Attr): Attr;
setPointerCapture(pointerId: number): void;
webkitMatchesSelector(selectors: string): boolean;
webkitRequestFullScreen(): void;
webkitRequestFullscreen(): void;
addEventListener(type: any, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
getContext(contextId: '2d' | string, contextAttributes?: any): CanvasRenderingContext2D | WebGLRenderingContext | any;
msToBlob(): Blob;
removeEventListener(type: any, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
toBlob(callback: (result: (Blob | null)) => void, type?: string, ...args: any[]): void;
toDataURL(type?: string, ...args: any[]): string;
getElementsByClassName(classNames: string): any;
querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | any;
querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | any;
querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
requestFullscreen(): any;
releasePointerCapture(pointerId: number): void;
getAttributeNames(): string[];
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
getRootNode(options?: any): Node;
append(...nodes: (string | Node)[]): void;
prepend(...nodes: (string | Node)[]): void;
after(...nodes: (string | Node)[]): void;
before(...nodes: (string | Node)[]): void;
replaceWith(...nodes: (string | Node)[]): void;
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
onauxclick: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
oncopy: any;
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oncut: any;
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragexit: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onerror: ErrorEventHandler;
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
onfullscreenchange: any;
onfullscreenerror: any | null;
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onloadend: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onreadystatechange: ((this: Document, ev: ProgressEvent) => any) | null;
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
onscroll: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onselect: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onsubmit: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
ontouchcancel: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchend: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchmove: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontouchstart: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
onvisibilitychange: ((this: Document, ev: Event) => any) | null;
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
}