diff --git a/libantosdk/README.md b/libantosdk/README.md index 5772d60..3b9d957 100644 --- a/libantosdk/README.md +++ b/libantosdk/README.md @@ -2,6 +2,7 @@ AntOSDK: development API for AntOS based applications/projects ## Change logs +- 0.1.0: antOS SDK is no longer delivered in this package, it will be fetched directly from AntOS release site - 0.0.18: Add some public API on grid view - 0.0.17: Use lastest AntOS d.ts file - 0.0.16: Fix jquery encoding error diff --git a/libantosdk/build.json b/libantosdk/build.json index a3d6bd2..f9a7ba7 100644 --- a/libantosdk/build.json +++ b/libantosdk/build.json @@ -30,8 +30,10 @@ "data": ["build","build/debug","build/release"] }, { - "name": "ts-import", - "data": ["core/ts/core.d.ts", "core/ts/jquery.d.ts","core/ts/antos.d.ts"] + "name": "ts-antos-sdk", + "data": { + "version": "2.0.x" + } }, { "name": "ts-compile", diff --git a/libantosdk/build/debug/README.md b/libantosdk/build/debug/README.md index 5772d60..3b9d957 100644 --- a/libantosdk/build/debug/README.md +++ b/libantosdk/build/debug/README.md @@ -2,6 +2,7 @@ AntOSDK: development API for AntOS based applications/projects ## Change logs +- 0.1.0: antOS SDK is no longer delivered in this package, it will be fetched directly from AntOS release site - 0.0.18: Add some public API on grid view - 0.0.17: Use lastest AntOS d.ts file - 0.0.16: Fix jquery encoding error diff --git a/libantosdk/build/debug/core/ts.worker.js b/libantosdk/build/debug/core/ts.worker.js index 192b77f..cf66a5a 100644 --- a/libantosdk/build/debug/core/ts.worker.js +++ b/libantosdk/build/debug/core/ts.worker.js @@ -1,7 +1,7 @@ importScripts('typescript.min.js'); const tslib = {}; - +const SDK_URL = "https://ci.iohub.dev/public/antos-release/sdk"; class TSJob extends AntOSDKBaseJob { constructor(data) @@ -22,6 +22,9 @@ class TSJob extends AntOSDKBaseJob { case 'ts-compile': this.compile(); break; + case 'ts-antos-sdk': + this.load_sdk(); + break; default: const err_msg = `Unkown job ${this.job.cmd}`; this.log_error(err_msg); @@ -54,6 +57,44 @@ class TSJob extends AntOSDKBaseJob { this.error(e); }); } + async load_sdk() + { + let version = "master"; + if(this.job.data && this.job.data.version) + { + version = this.job.data.version; + } + const files = [ + `${SDK_URL}/${version}/core.d.ts`, + `${SDK_URL}/${version}/jquery.d.ts`, + `${SDK_URL}/${version}/antos.d.ts`, + ]; + try{ + const promises = []; + const load = []; + for(let file of files) + { + if(!tslib[file]) + { + load.push(file); + this.log_info(`Loading library ${file}`); + promises.push(this.get(file, undefined)); + } + } + const results = await Promise.all(promises); + for(let i in load) + { + const lib = load[i]; + tslib[lib] = ts.createSourceFile(lib, results[i], ts.ScriptTarget.Latest); + this.log_info(`Typescript library ${lib} loaded`); + } + this.result("Typescript libraries loaded"); + } + catch(e) + { + this.log_error(e.toString()); + } + } compile() { let files = []; @@ -140,3 +181,4 @@ class TSJob extends AntOSDKBaseJob { API.jobhandle["ts-import"] = TSJob; API.jobhandle["ts-compile"] = TSJob; +API.jobhandle["ts-antos-sdk"] = TSJob; diff --git a/libantosdk/build/debug/package.json b/libantosdk/build/debug/package.json index da101de..f59997d 100644 --- a/libantosdk/build/debug/package.json +++ b/libantosdk/build/debug/package.json @@ -7,7 +7,7 @@ "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version": "0.0.18-a", + "version": "0.1.0-b", "category": "Development", "iconclass": "fa fa-cog", "mimes": [ diff --git a/libantosdk/build/debug/scheme.html b/libantosdk/build/debug/scheme.html index 938ddbc..33d2f25 100644 --- a/libantosdk/build/debug/scheme.html +++ b/libantosdk/build/debug/scheme.html @@ -1,12 +1,12 @@ - +
- - + +
diff --git a/libantosdk/build/release/libantosdk.zip b/libantosdk/build/release/libantosdk.zip index ee93e6d..114f347 100644 Binary files a/libantosdk/build/release/libantosdk.zip and b/libantosdk/build/release/libantosdk.zip differ diff --git a/libantosdk/core/ts.worker.js b/libantosdk/core/ts.worker.js index 192b77f..cf66a5a 100644 --- a/libantosdk/core/ts.worker.js +++ b/libantosdk/core/ts.worker.js @@ -1,7 +1,7 @@ importScripts('typescript.min.js'); const tslib = {}; - +const SDK_URL = "https://ci.iohub.dev/public/antos-release/sdk"; class TSJob extends AntOSDKBaseJob { constructor(data) @@ -22,6 +22,9 @@ class TSJob extends AntOSDKBaseJob { case 'ts-compile': this.compile(); break; + case 'ts-antos-sdk': + this.load_sdk(); + break; default: const err_msg = `Unkown job ${this.job.cmd}`; this.log_error(err_msg); @@ -54,6 +57,44 @@ class TSJob extends AntOSDKBaseJob { this.error(e); }); } + async load_sdk() + { + let version = "master"; + if(this.job.data && this.job.data.version) + { + version = this.job.data.version; + } + const files = [ + `${SDK_URL}/${version}/core.d.ts`, + `${SDK_URL}/${version}/jquery.d.ts`, + `${SDK_URL}/${version}/antos.d.ts`, + ]; + try{ + const promises = []; + const load = []; + for(let file of files) + { + if(!tslib[file]) + { + load.push(file); + this.log_info(`Loading library ${file}`); + promises.push(this.get(file, undefined)); + } + } + const results = await Promise.all(promises); + for(let i in load) + { + const lib = load[i]; + tslib[lib] = ts.createSourceFile(lib, results[i], ts.ScriptTarget.Latest); + this.log_info(`Typescript library ${lib} loaded`); + } + this.result("Typescript libraries loaded"); + } + catch(e) + { + this.log_error(e.toString()); + } + } compile() { let files = []; @@ -140,3 +181,4 @@ class TSJob extends AntOSDKBaseJob { API.jobhandle["ts-import"] = TSJob; API.jobhandle["ts-compile"] = TSJob; +API.jobhandle["ts-antos-sdk"] = TSJob; diff --git a/libantosdk/core/ts/antos.d.ts b/libantosdk/core/ts/antos.d.ts deleted file mode 100644 index efc6b63..0000000 --- a/libantosdk/core/ts/antos.d.ts +++ /dev/null @@ -1,11449 +0,0 @@ -declare namespace OS { - namespace API { - /** - * Interface for user login data - * - * @export - * @interface UserLoginType - */ - interface UserLoginType { - /** - * The user credential - * - * @type {string} - * @memberof UserLoginType - */ - username: string; - /** - * The user password - * - * @type {string} - * @memberof UserLoginType - */ - password: string; - } - /** - * Interface for a command sent to - * server side package manage, it contains two field: - * - * @export - * @interface PackageCommandType - */ - interface PackageCommandType { - /** - * Command name, should be: `init`, `cache`, `install`, - * `uninstall` or `list` - * - * @type {string} - * @memberof PackageCommandType - */ - command: string; - /** - * Parameter object of each command - * - * @type {GenericObject} - * @memberof PackageCommandType - */ - args: GenericObject; - } - /** - * - * Interface for basic request result returned - * from the server-side. A valid server-side response should - * be in the following format - * ```json - * { - * "error": boolean or string_err, - * "result": JSON result object - * } - * ``` - * - * @export - * @interface RequestResult - */ - interface RequestResult { - /** - * Indicate whether the response is error - * - * @type {(boolean | string)} - * @memberof RequestResult - */ - error: boolean | string; - /** - * The response result, this value must be - * set when `error` is false - * - * @type {(string - * | boolean - * | GenericObject - * | any[] - * | FileInfoType - * | FileInfoType[] - * | setting.UserSettingType)} - * @memberof RequestResult - */ - result: string | boolean | GenericObject | any[] | FileInfoType | FileInfoType[] | setting.UserSettingType; - } - /** - * The host name of the server-side - */ - var HOST: string; - /** - * The base URI of the server-side API - */ - var BASE_URI: string; - /** - * The base REST URI of the server-side API - */ - var REST: string; - /** - * The namespace `handle` contains some low level API to - * communicate with the server side API. It is the only - * API layer that communicate directly with the server. - * To make AntOS compatible with any server side API, - * all exported variable unctions defined in the `handle` - * namespace should be re-implemented - */ - namespace handle { - /** - * Base URI for reading content of VFS file - */ - var get: string; - /** - * Base URI for VFS file sharing - */ - var shared: string; - /** - * Send a request to the server-side API for a directory scanning - * operation - * - * @export - * @param {string} p a VFS file path e.g. home://test/ - * @returns {Promise} A promise on a [[RequestResult]] - * which contains an error or a list of FileInfoType - */ - function scandir(p: string): Promise; - /** - * - * Send a request to the server-side API for directory creation - * - * @export - * @param {string} p VFS path of the directory to be created - * @returns {Promise} A promise on a RequestResult - * which contains an error or true on success - */ - function mkdir(p: string): Promise; - /** - * Send a request to the server-side API for sharing/unsharing a VFS file, - * once shared a VFS file will be publicly visible by everyone - * - * @export - * @param {string} p VFS file path to be shared - * @param {boolean} pub flag: share (true) or unshare (false) - * @returns {Promise} A promise on a RequestResult - * which contains an error or true on success - */ - function sharefile(p: string, pub: boolean): Promise; - /** - * Get VFS file meta-data - * - * @export - * @param {string} p VFS file path - * @returns {Promise} A promise on a [[RequestResult]] - * which contains an error or an object of FileInfoType - */ - function fileinfo(p: string): Promise; - /** - * Read a VFS file content. There are many ways a VFS file can be read: - * - Read as a raw text content - * - Read as a javascript file, in this case the content of the - * file will be executed - * - Read as JSON object - * - * @export - * @param {string} p path of the VFS file - * @param {string} t return data type: - * - jsonp: the response is an json object - * - script: the response is a javascript code - * - xml, html: the response is a XML/HTML object - * - text: plain text - * - * @returns {Promise} A promise on a [[RequestResult]] - * which contains an error or an object of [[FileInfoType]] - */ - function readfile(p: string, t: string): Promise; - /** - * Move a file to another location on server-side - * - * @export - * @param {string} s VFS source file path - * @param {string} d VFS destination file path - * @returns {Promise} A promise on a [[RequestResult]] - * which contains an error or a success response - */ - function move(s: string, d: string): Promise; - /** - * Delete a VFS file on the server-side - * - * @export - * @param {string} p VFS file path - * @returns {Promise} A promise on a [[RequestResult]] - * which contains an error or a success response - */ - function remove(p: string): Promise; - /** - * Read the file as binary data - * - * @export - * @param {string} p VFS file to be read - * @returns {Promise} a Promise on an array buffer - */ - function fileblob(p: string): Promise; - /** - * Send a command to the serverside package manager - * - * @export - * @param {PackageCommandType} d a package command of type PackageCommandType - * @returns {Promise} a promise on a [[RequestResult]] - */ - function packages(d: PackageCommandType): Promise; - /** - * Upload file to the server via VFS interface - * - * @export - * @param {string} d VFS destination directory path - * @returns {Promise} a promise on a [[RequestResult]] - */ - function upload(d: string): Promise; - /** - * Write Base 64 encoded data to a VFS file - * - * @export - * @param {string} p path to the VFS file - * @param {string} d file data encoded in Base 64 - * @returns {Promise} a promise on a [[RequestResult]] - */ - function write(p: string, d: string): Promise; - /** - * An apigateway allows client side to execute a custom server-side - * script and get back the result. This gateway is particularly - * useful in case of performing a task that is not provided by the core - * API - * - * @export - * @param {GenericObject} d execution indication, provided only when ws is `false` - * otherwise, `d` should be written directly to the websocket stream as JSON object. - * Two possible formats of `d`: - * ```text - * execute an server-side script file: - * - * { - * path: [VFS path], - * parameters: [parameters of the server-side script] - * } - * - * or, execute directly a snippet of server-side script: - * - * { code: [server-side script code snippet as string] } - * - * ``` - * - * @param {boolean} ws flag indicate whether to use websocket for the connection - * to the gateway API. In case of streaming data, the websocket is preferred - * @returns {Promise} a promise on the result object (any) - */ - function apigateway(d: GenericObject, ws: boolean): Promise; - /** - * Check if a user is logged in - * - * @export - * @returns {Promise} a promise on a [[RequestResult]] that - * contains an error or a [[UserSettingType]] object - */ - function auth(): Promise; - /** - * Perform a login operation - * - * @export - * @param {UserLoginType} d user data [[UserLoginType]] - * @returns {Promise} a promise on a [[RequestResult]] that - * contains an error or a [[UserSettingType]] object - */ - function login(d: UserLoginType): Promise; - /** - * Perform a logout operation - * - * @export - * @returns {Promise} a promise on a [[RequestResult]] - */ - function logout(): Promise; - /** - * Save the current user settings - * - * @export - * @returns {Promise} a promise on a [[RequestResult]] - */ - function setting(): Promise; - /** - * This is the low level function of AntOS VDB API. - * It requests the server API to perform some simple - * SQL query. - * - * @export - * @param {string} cmd action to perform: save, delete, get, select - * @param {GenericObject} d data object of the request based on each action: - * - save: - * ``` - * { table: "table name", data: [record data object]} - * ``` - * - get: - * ``` - * { table: "table name", id: [record id]} - * ``` - * - delete: - * ``` - * { table: "table name", id: [record id]} - * or - * { table: "table name", cond: [conditional object]} - * ``` - * - select: - * ``` - * { table: "table name", cond: [conditional object]} - * ``` - * @returns {Promise} a promise of [[RequestResult]] on the - * query data - * - * A conditional object represents a SQL condition statement as an object, - * example: `pid = 10 AND cid = 2 ORDER BY date DESC` - * ``` - * { - * exp: { - * "and": { - * pid: 10, - * cid: 2 - * } - * }, - * order: { - * date: "DESC" - * } - * } - * ``` - */ - function dbquery(cmd: string, d: GenericObject): Promise; - } - } -} -declare namespace OS { - namespace GUI { - /** - * the SubWindow class is the abstract prototype of all - * modal windows or dialogs definition in AntOS - * - * @export - * @abstract - * @class SubWindow - * @extends {BaseModel} - */ - abstract class SubWindow extends BaseModel { - /** - * Placeholder indicates whether the sub window is in - * modal mode. This value is reserver for future use - * - * @type {boolean} - * @memberof SubWindow - */ - modal: boolean; - /** - * Reference to the parent of the current sub-window - * - * @type {(BaseModel | typeof GUI)} - * @memberof SubWindow - */ - parent: BaseModel | typeof GUI; - /** - *Creates an instance of SubWindow. - * @param {string} name SubWindow (class) name - * @memberof SubWindow - */ - constructor(name: string); - /** - * Purge the model from the system - * - * @protected - * @memberof BaseModel - */ - protected destroy(): void; - /** - * Init the sub-window, this function is called - * on creation of the sub-window object. It is used - * to render the sub-window UI. - * - * Need to be implemented by subclasses - * - * - * @returns {void} - * @memberof BaseDialog - */ - init(): void; - /** - * Main entry point after rendering of the sub-window - * - * @abstract - * @memberof SubWindow - */ - abstract main(): void; - /** - * Return the parent meta-data of the current - * sub-window - * - * @returns {API.PackageMetaType} - * @memberof SubWindow - */ - meta(): API.PackageMetaType; - /** - * Show the sub-window - * - * @memberof SubWindow - */ - show(): void; - /** - * Hide the sub-window - * - * @returns {void} - * @memberof SubWindow - */ - hide(): void; - /** - * blur the sub-window - * - * @returns {void} - * @memberof SubWindow - */ - blur(): void; - } - /** - * Abstract prototype of all AntOS dialogs widget - * - * @export - * @abstract - * @class BaseDialog - * @extends {SubWindow} - */ - abstract class BaseDialog extends SubWindow { - /** - * Placeholder for the dialog callback on exit - * - * @memberof BaseDialog - */ - handle: (d: any) => void; - /** - * Placeholder of the dialog input data - * - * @type {GenericObject} - * @memberof BaseDialog - */ - data: GenericObject; - /** - *Creates an instance of BaseDialog. - * @param {string} name Dialog (class) name - * @memberof BaseDialog - */ - constructor(name: string); - /** - * Function called when dialog exits - * - * @protected - * @param {BaseEvent} _e - * @returns {void} - * @memberof BaseDialog - */ - protected onexit(_e: BaseEvent): void; - /** - * Show the dialog - * - * @memberof BaseDialog - */ - show(): void; - } - /** - * A basic dialog renders a dialog widget using the UI - * scheme provided in it constructor or defined in its - * class variable `scheme` - * - * @export - * @class BasicDialog - * @extends {BaseDialog} - */ - class BasicDialog extends BaseDialog { - ['constructor']: typeof BasicDialog; - /** - * Placeholder for the UI scheme to be rendered. This can - * be either the string definition of the scheme or - * the VFS file handle of the scheme file - * - * @protected - * @type {(string | OS.API.VFS.BaseFileHandle)} - * @memberof BasicDialog - */ - protected markup: string | OS.API.VFS.BaseFileHandle; - /** - * If the `markup` variable is not provided, then - * the [[init]] function will find the scheme definition - * in this class variable - * - * @static - * @type {string} - * @memberof BasicDialog - */ - static scheme: string; - /** - *Creates an instance of BasicDialog. - * @param {string} name dialog name - * @param {(string | OS.API.VFS.BaseFileHandle)} [markup] UI scheme definition - * @memberof BasicDialog - */ - constructor(name: string, markup?: string | OS.API.VFS.BaseFileHandle); - /** - * Render the dialog using the UI scheme provided by either - * the `markup` instance variable or the `scheme` class variable - * - * @returns {void} - * @memberof BasicDialog - */ - init(): void; - /** - * Main entry point for the dialog - * - * @memberof BasicDialog - */ - main(): void; - } - /** - * The namespace `dialogs` is dedicated to all Dialog definition - * in AntOS - */ - namespace dialogs { - /** - * Simple prompt dialog to get user input text. - * The input data of the dialog: - * - * ```typescript - * { - * title: string, // window title - * label: string, // label text - * value: string, // user input text - * type: string // input type: text or password - * } - * ``` - * - * The data passing from the dialog to the callback function is - * in the string text of the user input value - * - * @export - * @class PromptDialog - * @extends {BasicDialog} - */ - class PromptDialog extends BasicDialog { - /** - *Creates an instance of PromptDialog. - * @memberof PromptDialog - */ - constructor(); - /** - * Main entry point - * - * @memberof PromptDialog - */ - main(): void; - } - /** - * A text dialog is similar to a [[PromptDialog]] nut allows - * user to input multi-line text. - * - * Refer to [[PromptDialog]] for the definition of input and callback data - * of the dialog - * - * @export - * @class TextDialog - * @extends {BasicDialog} - */ - class TextDialog extends BasicDialog { - /** - *Creates an instance of TextDialog. - * @memberof TextDialog - */ - constructor(); - /** - * Main entry point - * - * @memberof TextDialog - */ - main(): void; - } - /** - * A Calendar dialog allows user to select a date - * - * Input data: - * - * ```typescript - * { - * title: string // window title - * } - * ``` - * - * @export - * @class CalendarDialog - * @extends {BasicDialog} - */ - class CalendarDialog extends BasicDialog { - /** - * Creates an instance of CalendarDialog. - * - * Callback data: a Date object represent the selected date - * - * - * @memberof CalendarDialog - */ - constructor(); - /** - * - * - * @memberof CalendarDialog - */ - main(): void; - } - /** - * Color picker dialog - * - * Input data: - * - * ```typescript - * { - * title: string // window title - * } - * ``` - * Callback data: [[ColorType]] object - * - * @export - * @class ColorPickerDialog - * @extends {BasicDialog} - */ - class ColorPickerDialog extends BasicDialog { - /** - *Creates an instance of ColorPickerDialog. - * @memberof ColorPickerDialog - */ - constructor(); - /** - * - * - * @memberof ColorPickerDialog - */ - main(): void; - } - /** - * Show key-value pair of the input object - * - * Input data: - * - * ```typescript - * { - * title: string, // window title - * [propName:string]: any - * } - * ``` - * - * No data for callback - * - * @export - * @class InfoDialog - * @extends {BasicDialog} - */ - class InfoDialog extends BasicDialog { - /** - *Creates an instance of InfoDialog. - * @memberof InfoDialog - */ - constructor(); - /** - * - * - * @memberof InfoDialog - */ - main(): void; - } - /** - * A simple confirm dialog - * - * Input data: - * - * ```typescript - * { - * title: string, // window title - * icon?: string, // label icon - * iconclass?: string, // label iconclass - * text: string // label text - * } - * ``` - * - * Callback data: `boolean` - * - * @export - * @class YesNoDialog - * @extends {BasicDialog} - */ - class YesNoDialog extends BasicDialog { - /** - *Creates an instance of YesNoDialog. - * @memberof YesNoDialog - */ - constructor(); - /** - * Main entry point - * - * @memberof YesNoDialog - */ - main(): void; - } - /** - * A selection dialog provide user with a list of options to - * select. - * - * Input data: - * - * ```typescript - * { - * title: string, // window title - * data: - * { - * text: string, - * [propName:string]: any - * } [] // list data - * ``` - * - * Callback data: the selected data in the input list - * - * @export - * @class SelectionDialog - * @extends {BasicDialog} - */ - class SelectionDialog extends BasicDialog { - /** - *Creates an instance of SelectionDialog. - * @memberof SelectionDialog - */ - constructor(); - /** - * Main entry - * - * @memberof SelectionDialog - */ - main(): void; - } - /** - * An About dialog is dedicated to show the parent - * application meta-data - * - * Input data: no - * - * Callback data: no - * - * @export - * @class AboutDialog - * @extends {BasicDialog} - */ - class AboutDialog extends BasicDialog { - /** - *Creates an instance of AboutDialog. - * @memberof AboutDialog - */ - constructor(); - /** - * Main entry point - * - * @returns {void} - * @memberof AboutDialog - */ - main(): void; - } - /** - * File dialog allows user to select a file/folder - * - * Input data: - * - * ```typescript - * { - * title: string, // window title - * root?: string, // the root path folder of the file view - * type?: "file"|"dir"|"app", // file type to be selected - * mimes?: string[], // mime types of file to be selected - * hidden?: boolean, // show/hide hidden file - * file?: string // file name - * - * } - * ``` - * - * Callback data: - * - * ```typescript - * { - * file: string, // selected file path - * name: string // user input file name - * } - * ``` - * - * @export - * @class FileDialog - * @extends {BasicDialog} - */ - class FileDialog extends BasicDialog { - /** - *Creates an instance of FileDialog. - * @memberof FileDialog - */ - constructor(); - /** - * Store the last opened directory - * - * @static - * @type {string} - * @memberof FileDialog - */ - static last_opened: string; - /** - * - * - * @returns {void} - * @memberof FileDialog - */ - main(): void; - } - /** - * Generic & dynamic key-value dialog. The content - * of the dialog consist of an array of label and input elements - * which are generated based on the input model - * - * The input data of the dialog should be: - * - * ```typescript - * { - * title: string, // window title - * model: { - * [propName:string]: string - * }, - * data: { - * [propName:string]: string - * }, - * allow_empty: boolean - * } - * ``` - * Where: - * - keys of `model` are data fields, each key correspond to an input element - * - values of `model` are description texts of fields, each value correspond to a label text - * - data is the input data object in the format of model (optional) - * - * ``` - * Example: - * { - * title: "Greeting", - * model: { - * name: "Your name", - * email: "Your email" - * }, - * allow_empty: false - * } - *``` - - * The data passing from the dialog to the callback function is - * the user input data corresponding to the input model - * - * Example of callback data for the above model: - * - * ``` - * { - * name: "John Doe", - * email: "jd@mail.com" - * } - * ``` - * - * @export - * @class MultiInputDialog - * @extends {BasicDialog} - */ - class MultiInputDialog extends BasicDialog { - /** - * References to all the input fields in the - * dialog - * - * @private - * @type {HTMLElement[]} - * @memberof MultiInputDialog - */ - private inputs; - /** - *Creates an instance of MultiInputDialog. - * @memberof MultiInputDialog - */ - constructor(); - /** - * Generate the scheme before rendering - * - * @memberof MultiInputDialog - */ - init(): void; - /** - * Main entry point - * - * @memberof MultiInputDialog - */ - main(): void; - } - /** - * Generic dynamic key-value dialog - * - * Allow user to input any data key-value based object: - * - * { - * [prop:string]: string; - * } - * - * @export - * @class KeyValueDialog - * @extends {BasicDialog} - */ - class KeyValueDialog extends BasicDialog { - /** - * Reference to the form container - * - * @private - * @type {HTMLDivElement} - * @memberof KeyValueDialog - */ - private container; - /** - * Creates an instance of KeyValueDialog. - * @memberof KeyValueDialog - */ - constructor(); - /** - * Main entry point - * - * @memberof KeyValueDialog - */ - main(): void; - /** - * Add new input key-value field to the dialog - * - * @private - * @memberof KeyValueDialog - */ - private addField; - } - } - } -} -/// -declare namespace OS { - /** - * This namespace is dedicated to all APIs related to AntOS UI system, - * these API are called AFX APIs which handle: - * - The mouse and keyboard interaction with the UI system - * - UI rendering - * - Custom tags definition - * - Load/unload system, applications and services UI - * - System dialogs definition - */ - namespace GUI { - /** - * Enum definition of different UI locattion - * - * @export - * @enum {string } - */ - enum ANCHOR { - /** - * Center top - */ - NORTH = "NORTH", - /** - * Center bottom - */ - SOUTH = "SOUTH", - /** - * Center left - */ - WEST = "WEST", - /** - * Center right - */ - EST = "EST", - /** - * Top left - */ - NORTH_WEST = "NORTH_WEST", - /** - * Bottom left - */ - SOUTH_WEST = "SOUTH_WEST", - /** - * Top right - */ - NORTH_EST = "NORTH_EST", - /** - * Bottom right - */ - SOUTH_EST = "SOUTH_EST" - } - /** - * AntOS keyboard shortcut type definition - * - * @export - * @interface ShortcutType - */ - interface ShortcutType { - /** - * Placeholder for all shortcut callbacks, example: - * ```typescript - * fn_193462204.c = function() {..} - * // this function will be called when the hotkey `ALT-C` is triggered - * // fn_${"ALT".hash()} is fn_193462204 - * ``` - * - * @memberof ShortcutType - */ - [propName: string]: GenericObject<(e: JQuery.KeyDownEvent) => void>; - } - /** - * Basic item type definition which is usually used by some UI element - * such as list view, tree view, menu and grid view - * - * - * @export - * @interface BasicItemType - */ - interface BasicItemType { - /** - * Item text - * - * @type {(string | FormattedString)} - * @memberof BasicItemType - */ - text: string | FormattedString; - /** - * Item children, usually used by tree view or menu item - * This property is keep for compatibility purposes only. - * Otherwise, the [[nodes]] property should be used - * - * @type {BasicItemType[]} - * @memberof BasicItemType - */ - children?: BasicItemType[]; - /** - * Item children, usually used by tree view or menu item - * - * @type {BasicItemType[]} - * @memberof BasicItemType - */ - nodes?: BasicItemType[]; - [propName: string]: any; - } - /** - * Element id of the virtual desktop, used by JQuery - */ - var workspace: string; - /** - * Indicate whether the system is in fullscreen mode - */ - var fullscreen: boolean; - /** - * Reference to the current system dialog, only one dialog - * is allowed at a time. A dialog may have sub dialog - */ - var dialog: BaseDialog; - /** - * Convert an application html scheme to - * UI elements, then insert this UI scheme to the DOM tree. - * - * This function renders the UI of the application before calling the - * application's [[main]] function - * - * @export - * @param {string} html html scheme string - * @param {BaseModel} app reference to the target application - * @param {(Element | string)} parent - * The parent HTML element where the application is rendered. - * This is usually the reference to the virtual desktop element. - */ - function htmlToScheme(html: string, app: BaseModel, parent: Element | string): void; - /** - * Load an application scheme file then render - * it with [[htmlToScheme]] - * - * @export - * @param {string} path VFS path to the scheme file - * @param {BaseModel} app the target application - * @param {(HTMLElement | string)} parent The parent HTML element where the application is rendered. - */ - function loadScheme(path: string, app: BaseModel, parent: HTMLElement | string): void; - /** - * Clear the current system theme - * - * @export - */ - function clearTheme(): void; - /** - * Load a theme based on its name, then refresh the - * system UI theme - * - * @export - * @param {string} name name of the theme e.g. `antos_dark` - * @param {boolean} force force to clear the system theme before applying the new one - */ - function loadTheme(name: string, force: boolean): void; - /** - * Get the system dock tag - * - * @export - * @return {*} {GUI.tag.AppDockTag} - */ - function systemDock(): GUI.tag.AppDockTag; - /** - * Get the current virtual desktop - * - * @export - * @return {*} {GUI.tag.DesktopTag} - */ - function desktop(): GUI.tag.DesktopTag; - /** - * Open a system dialog. - * - * @export - * @param {(BaseDialog | string)} d a dialog object or a dialog class name - * @param {GenericObject} [data] input data of the dialog, refer to each - * dialog definition for the format of the input data - * @returns {Promise} A promise on the callback data of the dialog, refer - * to each dialog definition for the format of the callback data - */ - function openDialog(d: string | BaseDialog, data: GenericObject): Promise; - /** - * Toast notification configuration options - * - * - * @export - * @interface ToastOptions - */ - interface ToastOptions { - /** - * Where the Toast is displayed? see [[ANCHOR]] - * - * @type {ANCHOR} - * @memberof ToastOptions - */ - location?: ANCHOR; - /** - * Timeout (in seconds) before the Toast disappears - * Set this value to 0 to prevent the Toast to disappear, - * in this case, user need to explicitly close the notification - * - * @type {number} - * @memberof ToastOptions - */ - timeout?: number; - /** - * AFXTag that is used to render the data - * - * @type {number} - * @memberof ToastOptions - */ - tag?: string; - } - /** - * Toast notification API - * Show a toast message on different posisition on screen, see [[ToastOptions]] - * - * @export - * @param - * @returns - */ - function toast(data: any, opts?: ToastOptions, app?: application.BaseApplication): void; - /** - * Find a list of applications that support a specific mime - * type in the system packages meta-data - * - * @export - * @param {string} mime the mime type - * @returns {API.PackageMetaType[]} - */ - function appsByMime(mime: string): API.PackageMetaType[]; - /** - * Find all applications that have services attached to it. - * This function allows to collect all the services available - * on the system. These services may or may not be running. - * - * @export - * @returns {GenericObject} result in forme of: - * `service_name:service-meta-data` key-value pairs - */ - function appsWithServices(): GenericObject; - /** - * Find an launch an application using input application argument - * such as VFS file meta-data. - * - * Based on the input application argument, the function will try - * to find all applications that is compatible with that argument. - * Three cases possible: - * - There is no application that can handle the argument, a message will - * be notified to user. - * - There is one application that can handle the argument, the application - * will be launched with the argument - * - There are many applications that can handle the arguments, a selection - * dialog will be popped up and allows user to select an application to launch. - * - * @export - * @param {AppArgumentsType} it application argument - * @returns {void} - */ - function openWith(it: AppArgumentsType): void; - /** - * Kil all processes related to an application, reload the application - * prototype definition and launch a new process of this application. - * - * This function is used only for debug purpose or used by - * AntOSDK during in-browser application development - * - * @export - * @param {string} app the application class name - * @param {AppArgumentsType[]} args application arguments - * @returns {void} - */ - function forceLaunch(app: string, args: AppArgumentsType[]): void; - /** - * Kill an running processes of an application, then - * unregister the application prototype definition - * from the [[application]] namespace. - * - * This process is similar to uninstall the application - * from the current system state - * - * @export - * @param {string} app - */ - function unloadApp(app: string, save?: boolean): void; - /** - * Create a service process. - * - * Services are singleton processes, there is only - * one process of a service at a time - * - * @export - * @param {string} ph - * @returns {Promise} - */ - function pushService(ph: string): Promise; - /** - * Synchronously start a list of services - * - * @export - * @param {string[]} srvs list of service class names - * @returns {Promise} - */ - function pushServices(srvs: string[]): Promise; - /** - * Launch an application with arguments - * - * @export - * @param {string} app application class name - * @param {AppArgumentsType[]} args application arguments - */ - function launch(app: string, args: AppArgumentsType[]): Promise; - /** - * Dock an application to the system application dock - * - * @export - * @param {BaseApplication} app reference to the application process - * @param {API.PackageMetaType} meta Application meta-data - * @returns {void} - */ - function dock(app: OS.application.BaseApplication, meta: API.PackageMetaType): void; - /** - * Toggle system fullscreen - * - * @export - */ - function toggleFullscreen(): void; - /** - * Remove an application process from the system application - * dock. This action will also exit the process - * - * @export - * @param {BaseApplication} app - * @returns - */ - function undock(app: application.BaseApplication): void; - /** - * Attach a running service process to the system tray - * - * @export - * @param {BaseService} srv reference to the running service process - * @returns {void} - */ - function attachservice(srv: application.BaseService): void; - /** - * Detach a running process from the system tray - * - * @export - * @param {BaseService} srv reference to the running service process - * @returns {void} - */ - function detachservice(srv: application.BaseService): void; - /** - * Register a hot key and its handle in the - * system shortcut - * - * @export - * @param {string} k the hotkey e.g. `ALT-C` - * @param {(e: JQuery.KeyPressEvent) => void} f handle function - * @param {boolean} force force to rebind the hotkey - * @returns {void} - */ - function bindKey(k: string, f: (e: JQuery.KeyDownEvent) => void, force?: boolean): void; - /** - * Load and apply system wallpaper from the setting object - * - * @export - * @param {setting.WPSettingType} obj wallpaper setting object - */ - function wallpaper(obj?: setting.WPSettingType): void; - /** - * Refresh the virtual desktop - * - * @export - */ - function refreshDesktop(): void; - /** - * Show the login screen and perform the login operation. - * - * Once login successfully, the [[startAntOS]] will be called - * - * @export - */ - function login(): void; - /** - * Start AntOS after a successful login. - * - * This function performs the following operations: - * - * - System cleanup - * - Apply system setting - * - Load desktop wallpaper and the current theme from the system setting - * - Load system package meta-data - * - Load and apply system locale and language - * - * - * @export - * @param {*} conf - */ - function startAntOS(conf: any): void; - /** - * HTML schemes used by the system: - * - The login screen scheme - * - The workspace including: - * - System panel - * - Virtual desktop - * - Context menu - * - System tooltip - */ - const schemes: GenericObject; - } -} -/** - * Reference to the global this - */ -declare const Ant: typeof globalThis; -/** - * Extend the String prototype with some API - * functions used by AntOS API - * - * @interface String - */ -interface String { - /** - * Simple string hash function - * - * @returns {number} - * @memberof String - */ - hash(): number; - /** - * Parse the current string and convert it - * to an object of type [[Version]] if the string - * is in the format recognized by [[Version]], - * e.g.: `1.0.1-a` - * - * @returns {OS.Version} - * @memberof String - */ - __v(): OS.Version; - /** - * Convert the current string to base 64 string - * - * @returns {string} - * @memberof String - */ - asBase64(): string; - /** - * Unescape all escaped characters on the - * string using `\` - * - * @returns {string} - * @memberof String - */ - unescape(): string; - /** - * Escape the current string using backslash - * - * @returns {string} - * @memberof String - */ - escape(): string; - /** - * Convert the current string to uint8 array - * - * @returns {Uint8Array} - * @memberof String - */ - asUint8Array(): Uint8Array; - /** - * Format the current using input parameters. - * The current string should be a formatted string - * in the following form: - * - * ```typescript - * "example string: {0} and {1}".format("hello", "world") - * // return "example string: hello and world" - * ``` - * - * @param {...any[]} args - * @returns {string} - * @memberof String - */ - format(...args: any[]): string; - /** - * Create a [[FormattedString]] object using the current - * string and the input parameters - * - * @param {...any[]} args - * @returns {OS.FormattedString} - * @memberof String - */ - f(...args: any[]): OS.FormattedString; - /** - * Check if the current string is translatable, if it - * is the case, translate the string to the language specified - * in the current system locale setting. - * - * A translatable string is a string in the following - * form: `"__(example string)"` - * - * @returns {string} - * @memberof String - */ - __(): string; - /** - * Translate current string to the language specified - * by the system locale setting - * - * @returns {string} - * @memberof String - */ - l(): string; - /** - * Trim left of a string by a mask string - * - * @param {string} arg specifies a sub-string to be removed - * @returns {string} - * @memberof String - */ - trimFromLeft(arg: string): string; - /** - * Trim right of a string by a mask string - * - * @param {string} arg specifies a sub-string to be removed - * @returns {string} - * @memberof String - */ - trimFromRight(arg: string): string; - /** - * Trim both left and right of a string by a mask string - * - * @param {string} arg specifies a sub-string to be removed - * @returns {string} - * @memberof String - */ - trimBy(arg: string): string; -} -/** - * Extend the Data prototype with the - * [[timestamp]] function - * - * @interface Date - */ -interface Date { - /** - * Return the timestamp of the current Date object - * - * @returns {number} - * @memberof Date - */ - timestamp(): number; - /** - * Covnert to GMTString - * - * @returns {number} - * @memberof Date - */ - toGMTString(): string; -} -/** - * Generic key-value pair object interface - * - * @interface GenericObject - * @template T - */ -interface GenericObject { - [index: string]: T; -} -/** - * Global function to create a [[FormattedString]] from - * a formatted string and a list of parameters. Example - * - * ```typescript - * __("hello {0}", world) // return a FormattedString object - * ``` - * - * @param {...any[]} args - * @returns {(OS.FormattedString | string)} - */ -declare function __(...args: any[]): OS.FormattedString | string; -/** - * This global function allow chaining stack trace from one error to - * another. It is particular helping when tracking the source of - * the error in promises chain which results in some obfuscated stack - * traces as the stack resets on every new promise. - * - * @param {Error} e - * @returns {Error} - */ -declare function __e(e: Error): Error; -/** - * This namespace is the main entry point of AntOS - * API - */ -declare namespace OS { - /** - * Represent a translatable formatted string - * - * @export - * @class FormattedString - */ - class FormattedString { - /** - * Format string in the following form - * - * ```typescript - * "format string with {0} and {1}" - * // {[0-9]} is the format pattern - * ``` - * - * @type {string} - * @memberof FormattedString - */ - fs: string; - /** - * The value of the format pattern represented - * in [[fs]] - * - * @type {any[]} - * @memberof FormattedString - */ - values: any[]; - /** - * Creates an instance of FormattedString. - * @param {string} fs format string - * @param {any[]} args input values of the format patterns - * @memberof FormattedString - */ - constructor(fs: string, args: any[]); - /** - * Convert FormattedString to String - * - * @returns {string} - * @memberof FormattedString - */ - toString(): string; - /** - * Translate the format string to the current system - * locale language, format the string with values and - * then converted it to normal `string` - * - * @returns {string} - * @memberof FormattedString - */ - __(): string; - /** - * Return the hash number of the formatted string - * - * @returns {number} - * @memberof FormattedString - */ - hash(): number; - /** - * Match the formatted string against a regular expression - * a string pattern - * - * @param {(string | RegExp)} t string or regular expression - * @returns {RegExpMatchArray} - * @memberof FormattedString - */ - match(t: string | RegExp): RegExpMatchArray; - /** - * Convert the formatted string to Base^$ - * - * @returns {string} - * @memberof FormattedString - */ - asBase64(): string; - /** - * Un escape the formatted string - * - * @returns {string} - * @memberof FormattedString - */ - unescape(): string; - /** - * Escape the formatted string - * - * @returns {string} - * @memberof FormattedString - */ - escape(): string; - /** - * Convert the formatted string to uint8 array - * - * @returns {Uint8Array} - * @memberof FormattedString - */ - asUint8Array(): Uint8Array; - /** - * Input values for the format string - * - * @param {...any[]} args - * @memberof FormattedString - */ - format(...args: any[]): void; - } - /** - * This class represents the Version number format used by AntOS. A typical - * AntOS version number is in the following format: - * - * ``` - * [major_number].[minor_number].[patch]-[branch]-[build ID]) - * - * e.g.: 1.2.3-r-b means that: - * - version major number is 1 - * - version minor number is 2 - * - patch version is 3 - * - the current branch is release `r` - * - build ID (optional) - * ``` - * - * @export - * @class Version - */ - class Version { - /** - * The version string - * - * @private - * @type {string} - * @memberof Version - */ - private string; - /** - * The current branch - * - 1: `a` - alpha branch - * - 2: `b` - beta branch - * - 3: `r` - release branch - * - * @private - * @type {number} - * @memberof Version - */ - private branch; - /** - * Version major number - * - * @type {number} - * @memberof Version - */ - major: number; - /** - * Version minor number - * - * @type {number} - * @memberof Version - */ - minor: number; - /** - * Version patch number - * - * @type {number} - * @memberof Version - */ - patch: number; - /** - * Version build ID (optional): usually the current git commit hash - * - * @type {number} - * @memberof Version - */ - build_id: string; - /** - *Creates an instance of Version. - * - * @param {string} string string represents the version - * @memberof Version - */ - constructor(string: string); - /** - * Setter/getter to set the version string to the object - * - * @memberof Version - */ - set version_string(v: string); - get version_string(): string; - /** - * Compare the current version with another version. - * - * The comparison priority is `branch>major>minor>patch`. - * - * For the branch, the priority is `r>b>a` - * - * @param {(string | Version)} o version string or object - * @returns {(0 | 1 | -1)} - * Return 0 if the two versions are the same, 1 if - * the current version is newer than the input version, - * otherwise return -1 - * @memberof Version - */ - compare(o: string | Version): 0 | 1 | -1; - /** - * Check if the current version is newer than - * the input version - * - * @param {(string | Version)} o version string or object - * @returns {boolean} - * @memberof Version - */ - nt(o: string | Version): boolean; - /** - * Check if the current version is older than - * the input version - * - * @param {(string | Version)} o version string or object - * @returns {boolean} - * @memberof Version - */ - ot(o: string | Version): boolean; - /** - * Return itself - * - * @returns {Version} - * @memberof Version - */ - __v(): Version; - /** - * Convert Version object to string - * - * @returns {string} - * @memberof Version - */ - toString(): string; - } - /** - * Variable represents the current AntOS version, it - * is an instance of [[Version]] - */ - const VERSION: Version; - /** - * Variable represents the current AntOS source code repository - * is an instance of [[string]] - */ - const REPOSITORY: string; - /** - * Indicate whether the current de - */ - var mobile: boolean; - /** - * Register a model prototype to the system namespace. - * There are two types of model to be registered, if the model - * is of type [[SubWindow]], its prototype will be registered - * in the [[dialogs]] namespace, otherwise, if the model type - * is [[Application]] or [[Service]], its prototype will be - * registered in the [[application]] namespace. - * - * When a model is loaded in the system, its prototype is registered - * for later uses - * - * @export - * @param {string} name class name - * @param {*} x the corresponding class - * @returns {*} - */ - function register(name: string, x: PM.ModelTypeClass): void; - /** - * This function cleans up the entire system and - * makes sure the system is in a new and clean session. - * It performs the following operations: - * - * - Kill all running processes - * - Unregister all global events and reset the global - * announcement system - * - Clear the current theme - * - Reset process manager and all system settings - * - * @export - */ - function cleanup(): void; - /** - * Booting up AntOS. This function checks whether the user - * is successfully logged in, then call [[startAntOS]], otherwise - * it shows the login screen - * - * @export - */ - function boot(): void; - /** - * Placeholder for all the callbacks that are called when the system - * exits. These callbacks are useful when an application or service wants - * to perform a particular task before shuting down the system - */ - const cleanupHandles: { - [index: string]: () => Promise; - }; - /** - * Perform the system shutdown operation. This function calls all - * clean up handles in [[cleanupHandles]], then save the system setting - * before exiting - * - * @export - */ - function exit(): void; - /** - * Register a callback to the system [[cleanupHandles]] - * - * @export - * @param {string} n callback string name - * @param {() => void} f the callback handle - * @returns - */ - function onexit(n: string, f: () => Promise): () => Promise; - /** - * The namespace API is dedicated to the definition of the core system APIs - * used by AntOS and its applications. The following core APIs are defined: - * - * - The AntOS announcement system - * - Virtual File system - * - Virtual Database - * - Low-level REST based client-server communication - * - Dependencies management - * - System utilities - * - * These APIs are considered as middle-ware that abstracts the client-server - * communication and provide the application layer with a standardized APIs - * for file/database access, system events handling (announcement), automatic - * dependencies resolving, etc. - */ - namespace API { - /** - * AntOS package meta-data type definition - * - * @export - * @interface PackageMetaType - */ - interface PackageMetaType { - /** - * The application class name, if the package has only services - * this property is ignored and [[pkgname]] should be specified - * - * @type {string} - * @memberof PackageMetaType - */ - app?: string; - /** - * Package name, in case of [[app]] being undefined, this property - * need to be specified - * - * @type {string} - * @memberof PackageMetaType - */ - pkgname?: string; - /** - * Package category - * - * @type {string} - * @memberof PackageMetaType - */ - category: string; - /** - * Package description string - * - * @type {string} - * @memberof PackageMetaType - */ - description: string; - /** - * List of services that is attached to the - * package - * - * @type {string[]} - * @memberof PackageMetaType - */ - services?: string[]; - /** - * CSS icon class of the package - * - * @type {string} - * @memberof PackageMetaType - */ - iconclass?: string; - /** - * VFS application icon path - * - * @type {string} - * @memberof PackageMetaType - */ - icon?: string; - /** - * Package information - * - * @type {{ - * author: string; - * email: string; - * [propName: string]: any; - * }} - * @memberof PackageMetaType - */ - info: { - /** - * Author of the package - * - * @type {string} - */ - author: string; - /** - * Author's email - * - * @type {string} - */ - email: string; - [propName: string]: any; - }; - /** - * Application-specific locale definition. When the system locale changes, - * translatable texts inside the application will be first translated using - * the locale dictionary defined in the package meta-data. If no translation - * found, the system locale dictionary is used instead. - * - * A local dictionary definition should be in the following format: - * - * ```typescript - * { - * [locale_name: string]: { - * [origin_string]: string // translation string - * } - * } - * ``` - * - * Example of locale dictionaries: - * - * ```typescript - * { - * "en_GB": { - * "Cancel": "Cancel", - * "Modify": "Modify" - * }, - * "fr_FR": { - * "Cancel": "Annuler", - * "Modify": "Modifier" - * } - * } - * ``` - * - * @type {{ [index: string]: GenericObject }} locale dictionaries - * @memberof PackageMetaType - */ - locales: { - [index: string]: GenericObject; - }; - /** - * Mime types supported by the packages, regular expression can be used - * to specified a range of mimes in common - * - * @type {string[]} - * @memberof PackageMetaType - */ - mimes: string[]; - /** - * Package (application) name - * - * @type {string} - * @memberof PackageMetaType - */ - name: string; - /** - * VFS path to package installation location - * - * @type {string} - * @memberof PackageMetaType - */ - path: string; - /** - * Package version, should be in a format conforming - * to the version definition in [[Version]] class - * - * @type {string} - * @memberof PackageMetaType - */ - version: string; - /** - * Package dependencies, each entry is in the following format - * - * `package_name@version` - * - * Example: - * - * ```json - * [ - * "File@0.1.5-b" - * ] - * ``` - * - * @type {string[]} - * @memberof PackageMetaType - */ - dependencies: string[]; - [propName: string]: any; - } - /** - * Placeholder to store all loaded shared libraries. Once - * a shared library is firstly loaded, its identity will be - * stored in this variable. Based on this information, in - * the next use of the library, the system knows that the - * library is already loaded and ready to use. - * - * A shared library can be a javascript or a CSS file. - */ - const shared: GenericObject; - /** - * Placeholder for all global search handles registered to the system. - * These callbacks will be called when user performs the search operation - * in the spotlight UI. - * - * Applications can define their own search handle to provide the spotlight UI - * with additional search results - * - */ - const searchHandle: GenericObject<(text: string) => any[]>; - /** - * Placeholder of the current system locale dictionary, the system uses - * this dictionary to translate all translatable texts to the current - * locale language - */ - var lang: GenericObject; - /** - * Re-export the system announcement [[getMID]] function to the - * core API - * - * @export - * @returns {number} - */ - function mid(): number; - /** - * REST-based API. - * - * Perform a POST request to the server. Data exchanged - * is in `application/json` - * - * @export - * @param {string} p the server URI - * @param {*} d data object that will be converted to JSON - * @returns {Promise} a promise on the result data - */ - function post(p: string, d: any): Promise; - /** - * REST-based API. - * - * Perform a GET request and read back the data in - * `ArrayBuffer` (binary) format. This is useful for - * binary data reading - * - * @export - * @param {string} p resource URI - * @returns {Promise} a promise on the returned binary data - */ - function blob(p: string): Promise; - /** - * REST-based API. - * - * Send file to server - * - * @export - * @param {string} p resource URI - * @param {string} d VFS path of the destination file - * @returns {Promise} - */ - function upload(p: string, d: string): Promise; - /** - * REST-based API. - * - * Download a file - * - * @export - * @param {string} name file name - * @param {*} b file content - */ - function saveblob(name: string, b: any): void; - /** - * Helper function to trigger the global `loading` - * event. This event should be triggered in the - * beginning of a heavy task - * - * @export - * @param {number} q message id, see [[mid]] - * @param {string} p message string - */ - function loading(q: number, p: string): void; - /** - * Helper function to trigger the global `loaded` - * event: This event should be triggered in the - * end of a heavy task that has previously triggered - * the `loading` event - * - * @export - * @param {number} q the message id of the corresponding `loading` event - * @param {string} p the message string - * @param {string} m message status (`OK` of `FAIL`) - */ - function loaded(q: number, p: string, m: string): void; - /** - * Perform an REST GET request - * - * @export - * @param {string} p the URI of the request - * @param {string} [t=undefined] the response data type: - * - jsonp: the response is an json object - * - script: the response is a javascript code - * - xm, html: the response is a XML/HTML object - * - text: plain text - * @returns {Promise} a Promise on the requested data - */ - function get(p: string, t?: string): Promise; - /** - * REST-based API - * - * Perform a GET operation and executed the returned - * content as javascript - * - * @export - * @param {string} p URI resource - * @returns {Promise} promise on the executed content - */ - function script(p: string): Promise; - /** - * REST-based API - * - * Get the content of a global asset resource stored - * in `os://resources/` - * - * @export - * @param {string} r relative path to the resource - * @returns {Promise} promise on the returned content - */ - function resource(r: string): Promise; - /** - * Helper function to verify whether a shared library - * is loaded and ready to use - * - * @export - * @param {string} l path to the library - * @returns {boolean} - */ - function libready(l: string): boolean; - /** - * Load a shared library if not ready - * - * @export - * @param {string} l VFS path to the library - * @param {string} force force reload library - * @returns {Promise} a promise on the result data - */ - function requires(l: string, force?: boolean): Promise; - /** - * Synchronously load a list of shared libraries - * - * @export - * @param {string[]} libs list of shared libraries - * @returns {Promise} - */ - function require(libs: string[]): Promise; - /** - * The namespace packages is dedicated to all package management - * related APIs. - */ - namespace packages { - /** - * Fetch the package meta-data from the server - * - * @export - * @returns {Promise} Promise on a [[RequestResult]]. - * A success request result should contain a list of [[PackageMetaType]] - */ - function fetch(): Promise; - /** - * Request the server to regenerate the package - * caches - * - * @export - * @returns {Promise} - */ - function cache(): Promise; - } - /** - * Save the current user setting - * - * @export - * @returns {Promise} promise on a [[RequestResult]] - */ - function setting(): Promise; - /** - * An apigateway allows client side to execute a custom server-side - * script and get back the result. This gateway is particularly - * useful in case of performing a task that is not provided by the core - * API - * - * @export - * @param {GenericObject} d execution indication, provided only when ws is `false` - * otherwise, `d` should be written directly to the websocket stream as JSON object. - * Two possible formats of `d`: - * ```text - * execute an server-side script file: - * - * { - * path: [VFS path], - * parameters: [parameters of the server-side script] - * } - * - * or, execute directly a snippet of server-side script: - * - * { code: [server-side script code snippet as string] } - * - * ``` - * - * @param {boolean} ws flag indicate whether to use websocket for the connection - * to the gateway API. In case of streaming data, the websocket is preferred - * @returns {Promise} a promise on the result object (any) - */ - function apigateway(d: GenericObject, ws: boolean): Promise; - /** - * Perform the global search operation when user enter - * text in spotlight. - * - * This function will call all the search handles stored - * in [[searchHandle]] and build the search result based - * on output of these handle - * - * @export - * @param {string} text text to search - * @returns {any[]} - */ - function search(text: string): any[]; - /** - * Register a search handle to the global [[searchHandle]] - * - * @export - * @param {string} name handle name string - * @param {(text: string) => any[]} fn search handle - */ - function onsearch(name: string, fn: (text: string) => any[]): void; - /** - * Set the current system locale: This function will - * find and load the locale dictionary definition file in the - * system asset resource, then trigger the global event - * `systemlocalechange` to translated all translatable text - * to the target language - * - * @export - * @param {string} name locale name, e.g. `en_GB` - * @returns {Promise} - */ - function setLocale(name: string): Promise; - /** - * Return an error Object: AntOS use this function to - * collect information (stack trace) from user reported - * error. - * - * @export - * @param {(string | FormattedString)} n error string - * @returns {Error} - */ - function throwe(n: string | FormattedString): Error; - /** - * Set value to the system clipboard - * - * @export - * @param {string} v clipboard value - * @returns {boolean} - */ - function setClipboard(v: string): boolean; - /** - * Get the clipboard data - * - * @export - * @returns {Promise} Promise on the clipboard data - */ - function getClipboard(): Promise; - /** - * A switcher object is a special object in which - * each object's property is a boolean option. All object's - * properties are mutual exclusive. It means that when a property - * is set to true, all other properties will be reset to false. - * - * Example: - * - * ```typescript - * let view = API.switcher("tree", "list", "icon") - * view.tree = true // view.list = false and view.icon = false - * view.list = true // view.tree = false and view.icon = false - * ``` - * - * @export - * @returns {*} - */ - function switcher(...args: string[]): any; - } -} -/// -declare namespace OS { - /** - * This namespace is dedicated to application and service definition. - * When an application is loaded, its prototype definition will be - * inserted to this namespace for reuse lately - */ - namespace application { - /** - * Abstract prototype of all AntOS applications. - * Any new application definition should extend - * this prototype - * - * @export - * @abstract - * @class BaseApplication - * @extends {BaseModel} - */ - abstract class BaseApplication extends BaseModel { - /** - * Placeholder of all settings specific to the application. - * The settings stored in this object will be saved to system - * setting when logout and can be reused in the next login session - * - * @type {GenericObject} - * @memberof BaseApplication - */ - setting: GenericObject; - /** - * Hotkeys (shortcuts) defined for this application - * - * @protected - * @type {GUI.ShortcutType} - * @memberof BaseApplication - */ - protected keycomb: GUI.ShortcutType; - /** - * Reference to the system dock - * - * @type {GUI.tag.AppDockTag} - * @memberof BaseApplication - */ - sysdock: GUI.tag.AppDockTag; - /** - * Loading animation check timeout - * - * @private - * @memberof BaseApplication - */ - private _loading_toh; - /** - * Store pending loading task - * - * @private - * @type {number[]} - * @memberof BaseApplication - */ - private _pending_task; - /** - *Creates an instance of BaseApplication. - * @param {string} name application name - * @param {AppArgumentsType[]} args application arguments - * @memberof BaseApplication - */ - constructor(name: string, args: AppArgumentsType[]); - /** - * Init the application, this function is called when the - * application process is created and docked in the application - * dock. - * - * The application UI will be rendered after the execution - * of this function. - * - * @returns {void} - * @memberof BaseApplication - */ - init(): void; - /** - * Render the application UI by first loading its scheme - * and then mount this scheme to the DOM tree - * - * @protected - * @returns {void} - * @memberof BaseApplication - */ - protected loadScheme(): void; - /** - * API function to perform an heavy task. - * This function will trigger the global `loading` - * event at the beginning of the task, and the `loaded` - * event after finishing the task - * - * @protected - * @param {Promise} promise the promise on a task to be performed - * @returns {Promise} - * @memberof BaseApplication - */ - protected load(promise: Promise): Promise; - /** - * Bind a hotkey to the application, this function - * is used to define application keyboard shortcut - * - * @protected - * @param {string} k the hotkey to bind, should be in the following - * format: `[ALT|SHIFT|CTRL|META]-KEY`, e.g. `CTRL-S` - * @param {(e: JQuery.KeyboardEventBase) => void} f the callback function - * @returns {void} - * @memberof BaseApplication - */ - protected bindKey(k: string, f: (e: JQuery.KeyboardEventBase) => void): void; - /** - * Update the application local from the system - * locale or application specific locale configuration - * - * @param {string} name locale name e.g. `en_GB` - * @returns {void} - * @memberof BaseApplication - */ - updateLocale(name: string): void; - /** - * Execute the callback subscribed to a - * keyboard shortcut - * - * @param {string} fnk meta or modifier key e.g. `CTRL`, `ALT`, `SHIFT` or `META` - * @param {string} c a regular key - * @param {JQuery.KeyDownEvent} e JQuery keyboard event - * @returns {boolean} return whether the shortcut is executed - * @memberof BaseApplication - */ - shortcut(fnk: string, c: string, e: JQuery.KeyDownEvent): boolean; - /** - * Apply a setting to the application - * - * @protected - * @param {string} k the setting name - * @memberof BaseApplication - */ - protected applySetting(k: string): void; - /** - * Apply all settings to the application - * - * @protected - * @memberof BaseApplication - */ - protected applyAllSetting(): void; - /** - * Set a setting value to the application setting - * registry - * - * @protected - * @param {string} k setting name - * @param {*} v setting value - * @returns {void} - * @memberof BaseApplication - */ - protected registry(k: string, v: any): void; - /** - * Show the appliation - * - * @returns {void} - * @memberof BaseApplication - */ - show(): void; - /** - * Blur the application - * - * @returns {void} - * @memberof BaseApplication - */ - blur(): void; - /** - * Hide the application - * - * @returns {void} - * @memberof BaseApplication - */ - hide(): void; - /** - * Maximize or restore the application window size - * and its position - * - * @returns {void} - * @memberof BaseApplication - */ - toggle(): void; - /** - * Get the application title - * - * @returns {(string| FormattedString)} - * @memberof BaseApplication - */ - title(): string | FormattedString; - /** - * Getter to access the application window instance - * - * @memberof BaseApplication - */ - get window(): GUI.tag.WindowTag; - /** - * Function called when the application exit. - * If the input exit event is prevented, the application - * process will not be killed - * - * - * @protected - * @param {BaseEvent} evt exit event - * @memberof BaseApplication - */ - protected onexit(evt: BaseEvent): void; - /** - * Get the application meta-data - * - * @returns {API.PackageMetaType} - * @memberof BaseApplication - */ - meta(): API.PackageMetaType; - /** - * Base menu definition. This function - * returns the based menu definition of all applications. - * Other application specific menu entries - * should be defined in [[menu]] function - * - * @protected - * @returns {GUI.BasicItemType[]} - * @memberof BaseApplication - */ - protected baseMenu(): GUI.BasicItemType[]; - /** - * The main application entry that is called after - * the application UI is rendered. This application - * must be implemented by all subclasses - * - * @abstract - * @memberof BaseApplication - */ - abstract main(): void; - /** - * Application specific menu definition - * - * @protected - * @returns {GUI.BasicItemType[]} - * @memberof BaseApplication - */ - protected menu(): GUI.BasicItemType[]; - /** - * Show local toast notification - * - * @param {any} data to send - * @param {GUI.ToastOptions} notification options see [[GUI.ToastOptions]] - * @returns {void} - * @memberof BaseApplication - */ - toast(data: any, opts?: GUI.ToastOptions): void; - /** - * The cleanup function that is called by [[onexit]] function. - * Application need to override this function to perform some - * specific task before exiting or to prevent the application - * to be exited - * - * @protected - * @param {BaseEvent} e - * @memberof BaseApplication - */ - protected cleanup(e: BaseEvent): void; - /** - * Check if the loading tasks ended, - * if it the case, stop the animation - * - * @private - * @memberof BaseApplication - */ - private animation_check; - } - } -} -/// -/// -declare namespace OS { - /** - * Application argument type definition - * - * @export - * @interface AppArgumentsType - */ - interface AppArgumentsType { - /** - * File type to be open by the app - * - * @type {string} - * @memberof AppArgumentsType - */ - type?: string; - /** - * File path to be opened - * - * @type {string} - * @memberof AppArgumentsType - */ - path: string; - /** - * Any other object - */ - [propName: string]: any; - } - /** - * Enum definition of different model types - * - * @export - * @enum {number} - */ - enum ModelType { - /** - * Applications - */ - Application = 0, - /** - * Services - */ - Service = 1, - /** - * Sub-window such as dialogs - */ - SubWindow = 2 - } - /** - * Base AntOS event definition - * - * @export - * @class BaseEvent - */ - class BaseEvent { - /** - * The event name placeholder - * - * @type {string} - * @memberof BaseEvent - */ - name: string; - /** - * Placeholder indicates whether the event is forced to - * be happen - * - * @private - * @type {boolean} - * @memberof BaseEvent - */ - private force; - /** - * Placeholder indicates whether the event is prevented. - * This value has not effect if `force` is set to `true` - * - * @type {boolean} - * @memberof BaseEvent - */ - prevent: boolean; - /** - *Creates an instance of BaseEvent. - * @param {string} name event name - * @param {boolean} force indicates whether the event is forced - * @memberof BaseEvent - */ - constructor(name: string, force: boolean); - /** - * Prevent the current event. This function - * has no effect if `force` is set to true - * - * @memberof BaseEvent - */ - preventDefault(): void; - } - /** - * The root model of all applications, dialogs or services - * in the system - * - * @export - * @abstract - * @class BaseModel - */ - abstract class BaseModel { - /** - * The class name - * - * @type {string} - * @memberof BaseModel - */ - name: string; - /** - * The argument of the model - * - * @type {AppArgumentsType[]} - * @memberof BaseModel - */ - args: AppArgumentsType[]; - /** - * Each model has its own local announcement system - * to handle all local events inside that model. - * - * This observable object is propagate to all the - * UI elements ([[AFXTag]]) inside the model - * - * @protected - * @type {API.Announcer} - * @memberof BaseModel - */ - protected _observable: API.Announcer; - /** - * Reference to the core API namespace - * - * @protected - * @type {typeof API} - * @memberof BaseModel - */ - protected _api: typeof API; - /** - * Reference to the core GUI namespace - * - * @protected - * @type {typeof GUI} - * @memberof BaseModel - */ - protected _gui: typeof GUI; - /** - * Reference to the model's dialog - * - * @type {GUI.BaseDialog} - * @memberof BaseModel - */ - dialog: GUI.BaseDialog; - /** - * The HTML element ID of the virtual desktop - * - * @protected - * @type {HTMLElement} - * @memberof BaseModel - */ - protected host: HTMLElement; - /** - * The process number of the current model. - * For sub-window this number is the number - * of the parent window - * - * @type {number} - * @memberof BaseModel - */ - pid: number; - /** - * Reference the DOM element of the UI scheme belong to - * this model - * - * @type {HTMLElement} - * @memberof BaseModel - */ - scheme: HTMLElement; - /** - * Reference to the system setting - * - * @protected - * @type {typeof setting} - * @memberof BaseModel - */ - protected systemsetting: typeof setting; - /** - * Placeholder for the process creation timestamp - * - * @type {number} - * @memberof BaseModel - */ - birth: number; - /** - * Different model type - * - * @static - * @type {ModelType} - * @memberof BaseModel - */ - static type: ModelType; - /** - * Allow singleton on this model - * - * @static - * @type {boolean} - * @memberof BaseModel - */ - static singleton: boolean; - /** - * The javascript or css files that the model depends on. All dependencies - * will be loaded before the model is rendered - * - * @static - * @type {string[]} list of VFS paths of dependencies - * @memberof BaseModel - */ - static dependencies: string[]; - /** - * Reference to the CSS Element of the model - * - * @static - * @type {(HTMLElement | string)} - * @memberof BaseModel - */ - static style: HTMLElement | string; - /** - * Place holder for model meta-data - * - * @static - * @type {API.PackageMetaType} - * @memberof BaseModel - */ - static meta: API.PackageMetaType; - /** - *Creates an instance of BaseModel. - * @param {string} name class name - * @param {AppArgumentsType[]} args arguments - * @memberof BaseModel - */ - constructor(name: string, args: AppArgumentsType[]); - /** - * Getter: get the local announcer object - * - * @readonly - * @type {API.Announcer} - * @memberof BaseModel - */ - get observable(): API.Announcer; - /** - * Update the model locale - * - * @param {string} name - * @memberof BaseModel - */ - updateLocale(name: string): void; - /** - * Render the model's UI - * - * @protected - * @param {string} p VFS path to the UI scheme definition - * @returns {void} - * @memberof BaseModel - */ - protected render(p: string): void; - /** - * Exit the model - * - * @param {boolean} force set this value to `true` will bypass the prevented exit event by user - * @returns {void} - * @memberof BaseModel - */ - quit(force?: boolean): void; - /** - * Purge the model from the system - * - * @protected - * @memberof BaseModel - */ - protected destroy(): void; - /** - * Model meta data, need to be implemented by - * subclasses - * - * @abstract - * @returns {API.PackageMetaType} - * @memberof BaseModel - */ - abstract meta(): API.PackageMetaType; - /** - * VFS path to the model asset - * - * @returns {string} - * @memberof BaseModel - */ - path(): string; - /** - * Execute a server side script and get back the result - * - * @protected - * @param {GenericObject} cmd execution indication, should be: - * - * ``` - * { - * path?: string, // VFS path to the server side script - * code: string, // or server side code to be executed - * parameters: any // the parameters of the server side execution - * } - * ``` - * - * @returns {Promise} - * @memberof BaseModel - */ - protected call(cmd: GenericObject): Promise; - /** - * Connect to the server side api using a websocket connection - * - * Server side script can be execute inside the stream by writing - * data in JSON format with the following interface - * - * ``` - * { - * path?: string, // VFS path to the server side script - * code: string, // or server side code to be executed - * parameters: any // the parameters of the server side execution - * } - * ``` - * - * @protected - * @returns {Promise} - * @memberof BaseModel - */ - protected stream(): Promise; - /** - * Init the model before UI rendering - * - * @abstract - * @memberof BaseModel - */ - abstract init(): void; - /** - * Main entry point after UI rendering - * - * @abstract - * @memberof BaseModel - */ - abstract main(): void; - /** - * Show the model - * - * @abstract - * @memberof BaseModel - */ - abstract show(): void; - /** - * Hide the model - * - * @abstract - * @memberof BaseModel - */ - abstract hide(): void; - /** - * Function called when the model exits - * - * @protected - * @abstract - * @param {BaseEvent} e exit event - * @memberof BaseModel - */ - protected abstract onexit(e: BaseEvent): void; - /** - * subscribe once to a local event - * - * @protected - * @param {string} e name of the event - * @param {(d: any) => void} f event callback - * @returns {void} - * @memberof BaseModel - */ - protected one(e: string, f: (d: any) => void): void; - /** - * Subscribe to a local event - * - * @protected - * @param {string} e event name - * @param {(d: any) => void} f event callback - * @returns {void} - * @memberof BaseModel - */ - protected on(e: string, f: (d: any) => void): void; - /** - * Unsubscribe an event - * - * @protected - * @param {string} e event name or `*` (all events) - * @param {(d: any) => void} [f] callback to be unsubscribed, can be `undefined` - * @returns {void} - * @memberof BaseModel - */ - protected off(e: string, f?: (d: any) => void): void; - /** - * trigger a local event - * - * @param {string} e event name - * @param {*} [d] event data - * @returns {void} - * @memberof BaseModel - */ - trigger(e: string, d?: any): void; - /** - * subscribe to an event on the global announcement system - * - * @protected - * @param {string} e event name - * @param {(d: API.AnnouncementDataType) => void} f event callback - * @returns {void} - * @memberof BaseModel - */ - subscribe(e: string, f: (d: API.AnnouncementDataType) => void): void; - /** - * Open a dialog - * - * @param {(GUI.BaseDialog | string)} d a dialog object or a dialog class name - * @param {GenericObject} [data] input data of the dialog, refer to each - * dialog definition for the format of the input data - * @returns {Promise} A promise on the callback data of the dialog, refer - * to each dialog definition for the format of the callback data - * @memberof BaseModel - */ - openDialog(d: GUI.BaseDialog | string, data?: GenericObject): Promise; - /** - * Open a [[YesNoDialog]] to confirm a task - * - * @protected - * @param {GenericObject} data [[YesNoDialog]] input data - * @returns {Promise} - * @memberof BaseModel - */ - protected ask(data: GenericObject): Promise; - /** - * Trigger a global event - * - * @protected - * @param {string} t event name - * @param {(string | FormattedString)} m event message - * @param {any} u_data user data object if any - * @returns {void} - * @memberof BaseModel - */ - protected publish(t: string, m: string | FormattedString, u_data?: any): void; - /** - * Publish a global notification - * - * @param {(string | FormattedString)} m notification string - * @param {any} u_data user data object if any - * @returns {void} - * @memberof BaseModel - */ - notify(m: string | FormattedString, data?: any): void; - /** - * Publish a global warning - * - * @param {(string | FormattedString)} m warning string - * @returns {void} - * @memberof BaseModel - */ - warn(m: string | FormattedString): void; - /** - * Report a global error - * - * @param {(string | FormattedString)} m error message - * @param {Error} [e] error object if any - * @returns - * @memberof BaseModel - */ - error(m: string | FormattedString, e?: Error): void; - /** - * Report a global fail event - * - * @param {string} m fail message - * @param {Error} [e] error object if any - * @returns - * @memberof BaseModel - */ - fail(m: string, e?: Error): void; - /** - * Throw an error inside the model - * - * @returns {Error} - * @memberof BaseModel - */ - throwe(): Error; - /** - * Update the model, this will update all its UI elements - * - * @returns {void} - * @memberof BaseModel - */ - update(): void; - /** - * Find a HTMLElement in the UI of the model - * using the `data-id` attribute of the element - * - * @protected - * @param {string} id - * @returns {HTMLElement} - * @memberof BaseModel - */ - protected find(id: string): HTMLElement; - /** - * Select all DOM Element inside the UI of the model - * using JQuery selector - * - * @protected - * @param {string} sel - * @returns {HTMLElement} - * @memberof BaseModel - */ - protected select(sel: string): JQuery; - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A switch tag is basically used to visualize an boolean data value. - * - * @export - * @class SwitchTag - * @extends {AFXTag} - */ - class SwitchTag extends AFXTag { - /** - * Placeholder for the onchange event handle - * - * @private - * @type {TagEventCallback} - * @memberof SwitchTag - */ - private _onchange; - /** - * Setter: Turn on/off the switch - * - * Getter: Check whether the switch is turned on - * - * @memberof SwitchTag - */ - set swon(v: boolean); - get swon(): boolean; - /** - * Setter: Enable the switch - * - * Getter: Check whether the switch is enabled - * - * @memberof SwitchTag - */ - set enable(v: boolean); - get enable(): boolean; - /** - * Set the onchange event handle - * - * @memberof SwitchTag - */ - set onswchange(v: TagEventCallback); - /** - * Mount the tag and bind the click event to the switch - * - * @protected - * @memberof SwitchTag - */ - protected mount(): void; - /** - * This function will turn the switch (on/off) - * and trigger the onchange event - * - * @private - * @param {JQuery.ClickEvent} e - * @returns - * @memberof SwitchTag - */ - private makechange; - /** - * Tag layout definition - * - * @protected - * @returns - * @memberof SwitchTag - */ - protected layout(): { - el: string; - ref: string; - }[]; - /** - * Init the tag: - * - switch is turn off - * - switch is enabled - * - * @protected - * @memberof SwitchTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @memberof SwitchTag - */ - protected calibrate(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof SwitchTag - */ - protected reload(d?: any): void; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Definition of system file view widget - * - * @export - * @class FileViewTag - * @extends {AFXTag} - */ - class FileViewTag extends AFXTag { - /** - * placeholder for file select event callback - * - * @private - * @type {TagEventCallback} - * @memberof FileViewTag - */ - private _onfileselect; - /** - * placeholder for file open event callback - * - * @private - * @type {TagEventCallback} - * @memberof FileViewTag - */ - private _onfileopen; - /** - * placeholder for directory changed event callback - * - * @private - * @type {TagEventCallback} - * @memberof FileViewTag - */ - private _ondirchanged; - /** - * Reference to the all selected files meta-datas - * - * @private - * @type {API.FileInfoType[]} - * @memberof FileViewTag - */ - private _selectedFiles; - /** - * Data placeholder of the current working directory - * - * @private - * @type {API.FileInfoType[]} - * @memberof FileViewTag - */ - private _data; - /** - * The path of the current working directory - * - * @private - * @type {string} - * @memberof FileViewTag - */ - private _path; - /** - * Header definition of the widget grid view - * - * @private - * @type {(GenericObject[])} - * @memberof FileViewTag - */ - private _header; - /** - * placeholder for the user-specified meta-data fetch function - * - * @private - * @memberof FileViewTag - */ - private _fetch; - /** - *Creates an instance of FileViewTag. - * @memberof FileViewTag - */ - constructor(); - /** - * Init the widget before mounting - * - * @protected - * @memberof FileViewTag - */ - protected init(): void; - /** - * Update the current widget, do nothing - * - * @protected - * @param {*} [d] - * @memberof FileViewTag - */ - protected reload(d?: any): void; - /** - * set the function that allows to fetch file entries. - * This handle function should return a promise on - * an arry of [[API.FileInfoType]] - * - * @memberof FileViewTag - */ - set fetch(v: (p: string) => Promise); - /** - * set the callback handle for the file select event. - * The parameter of the callback should be an object - * of type [[TagEventType]] with the data type `T` is [[API.FileInfoType]] - * - * @memberof FileViewTag - */ - set onfileselect(e: TagEventCallback); - /** - * set the callback handle for the directory changed event. - * The parameter of the callback should be an object - * of type [[TagEventType]] with the data type `T` is [[API.VFS.BaseFileHandle]] - * - * @memberof FileViewTag - */ - set onchdir(e: TagEventCallback); - /** - set the callback handle for the file open event. - * The parameter of the callback should be an object - * of type [[TagEventType]] with the data type `T` is [[API.FileInfoType]] - * - * @memberof FileViewTag - */ - set onfileopen(e: TagEventCallback); - /** - * Setter: - * - * chang the view of the widget, there are three different views - * - `icon` - * - `list` - * - `tree` - * - * Getter: - * - * Get the current view setting of the widget - * - * @memberof FileViewTag - */ - set view(v: string); - get view(): string; - /** - * Setter: - * - * Turn on/off the changing current working directory feature - * of the widget when a directory is double clicked. If enabled, - * the widget will use the configured [[fetch]] function to query - * the content of the selected directory - * - * Getter: - * - * check whether changing current working directory feature - * is enabled - * - * @memberof FileViewTag - */ - set chdir(v: boolean); - get chdir(): boolean; - /** - * Setter : Enable or disable the status bar of the widget - * - * Getter: Check whether the status bar is enabled - * - * @memberof FileViewTag - */ - set status(v: boolean); - get status(): boolean; - /** - * Setter: - * - * Allow the widget to show or hide hidden file - * - * Getter: - * - * Check whether the hidden file should be shown in - * the widget - * - * @memberof FileViewTag - */ - set showhidden(v: boolean); - get showhidden(): boolean; - /** - * Setter: - * - * Allow multiple selection on file view - * - * Getter: - * - * Check whether the multiselection is actived - * - * @memberof FileViewTag - */ - set multiselect(v: boolean); - get multiselect(): boolean; - /** - * Get the current selected file - * - * @readonly - * @type {API.FileInfoType} - * @memberof FileViewTag - */ - get selectedFile(): API.FileInfoType; - /** - * Get all selected files - * - * @readonly - * @type {API.FileInfoType[]} - * @memberof FileViewTag - */ - get selectedFiles(): API.FileInfoType[]; - /** - * Setter: - * - * Set the path of the current working directory. - * When called the widget will refresh the current - * working directory using the configured [[fetch]] - * function - * - * Getter: - * - * Get the path of the current working directory - * - * @memberof FileViewTag - */ - set path(v: string); - get path(): string; - /** - * Setter: Set the data of the current working directory - * - * Getter: Get the data of the current working directory - * - * @memberof FileViewTag - */ - set data(v: API.FileInfoType[]); - get data(): API.FileInfoType[]; - /** - * Set the file drag and drop event handle. This allows application - * to define custom behavior of the event - * - * @memberof FileViewTag - */ - set ondragndrop(v: TagEventCallback>); - /** - * Sort file by its type - * - * @private - * @param {API.FileInfoType} a - * @param {API.FileInfoType} b - * @return {*} {number} - * @memberof FileViewTag - */ - private sortByType; - /** - * sort file by its name - * - * @private - * @param {API.FileInfoType} a first file meta-data - * @param {API.FileInfoType} b second file meta-data - * @returns {number} - * @memberof FileViewTag - */ - private sortByName; - /** - * calibrate the widget layout - * - * @memberof FileViewTag - */ - calibrate(): void; - /** - * Refresh the list view of the widget. This function - * is called when the view of the widget changed to `icon` - * - * @private - * @memberof FileViewTag - */ - private refreshList; - /** - * Refresh the grid view of the widget, this function is called - * when the view of the widget set to `list` - * - * @private - * @memberof FileViewTag - */ - private refreshGrid; - /** - * Refresh the Treeview of the widget, this function is called - * when the view of the widget set to `tree` - * - * @private - * @memberof FileViewTag - */ - private refreshTree; - /** - * Create the tree data from the list of input - * file meta-data - * - * @private - * @param {API.FileInfoType[]} data list of file meta-data - * @returns {TreeViewDataType[]} - * @memberof FileViewTag - */ - private getTreeData; - /** - * Refresh data of the current widget view - * - * @private - * @returns {void} - * @memberof FileViewTag - */ - private refreshData; - /** - * Switch between three view options - * - * @private - * @memberof FileViewTag - */ - private switchView; - /** - * This function triggers the file select event - * - * @private - * @param {API.FileInfoType} e selected file meta-data - * @memberof FileViewTag - */ - private fileselect; - /** - * This function triggers the file open event - * - * @private - * @param {API.FileInfoType} e selected file meta-data - * @memberof FileViewTag - */ - private filedbclick; - /** - * Mount the widget in the DOM tree - * - * @protected - * @memberof FileViewTag - */ - protected mount(): void; - /** - * Layout definition of the widget - * - * @protected - * @returns {TagLayoutType[]} - * @memberof FileViewTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -/// -/** - * - * Extend the HTMLElement interface with some utility function need - * by AFX API - * - * @interface HTMLElement - */ -interface HTMLElement { - /** - * Recursively update a tag and all its children - * - * @param {*} [d] data to send to all element in the DOM subtree - * @memberof HTMLElement - */ - update(d?: any): void; - /** - * - * AFX will automatically bind the context menu on an HTMLElement - * if this function is defined on that element. The function should - * define the content of the context menu and its action - * - * Once the context menu is bound to the element, all context menu handle - * defined on any child of this element will be ignored. - * - * @param {JQuery.MouseEventBase} e a mouse event - * @param {OS.GUI.tag.StackMenuTag} m The context menu element [[StackMenuTag]] - * @memberof HTMLElement - */ - contextmenuHandle(e: JQuery.MouseEventBase, m: OS.GUI.tag.StackMenuTag): void; - /** - * Mount the element and all the children on its DOM subtree. This action - * is performed in a top-down manner - * - * @memberof HTMLElement - */ - sync(): void; - /** - * - * This action allows to generated all the DOM nodes defined by all AFX tags - * in its hierarchy. - * It performs two operations, one top-down operation to generate all the - * necessary DOM nodes, another bottom-up operation to init all the AFX tag - * in the current element DOM hierarchy - * - * @param {OS.API.Announcer} o an AntOS observable object - * @memberof HTMLElement - */ - afxml(o: OS.API.Announcer): void; - /** - * Enable the drag event dispatching on this - * element - * - * This will trigger the `dragging` and `drop` event on the enabled - * element when the mouse is down, move, then up, then move - * - * The event can be listened using the traditional way, - * Example: - * ``` - * elem.addEventListener('dragging', (e) => { }, false); - * elem.addEventListener('drop', (e) => { }, false); - * ``` - * - * @meberof HTMLElement - */ - enable_drag(): void; - /** - * Perform DOM generation ([[afxml]]) then mount ([[sync]]) all the - * elements. - * - * @param {OS.API.Announcer} o an AntOS observable object - * @param {boolean} [flag] indicates whether this is the top-most call of the operation - * @memberof HTMLElement - */ - uify(o: OS.API.Announcer, flag?: boolean): void; - /** - * - * - * @type {*} - * @memberof HTMLElement - */ - mozRequestFullScreen: any; - /** - * - * - * @type {*} - * @memberof HTMLElement - */ - webkitRequestFullscreen: any; - /** - * - * - * @type {*} - * @memberof HTMLElement - */ - msRequestFullscreen: any; -} -/** - * - * - * @interface Document - */ -interface Document { - mozCancelFullScreen: any; - webkitExitFullscreen: any; - cancelFullScreen: any; -} -declare namespace OS { - namespace GUI { - /** - * [[TagLayoutType]] interface using by AFX tags to defined - * its internal DOM hierarchy - * - * @export - * @interface TagLayoutType - */ - interface TagLayoutType { - /** - * Element tag name - * - * @type {string} - * @memberof TagLayoutType - */ - el: string; - /** - * Children layout of the current element - * - * @type {TagLayoutType[]} - * @memberof TagLayoutType - */ - children?: TagLayoutType[]; - /** - * Reference name of the element used by AFX Tag - * - * @type {string} - * @memberof TagLayoutType - */ - ref?: string; - /** - * CSS class of the element - * - * @type {string} - * @memberof TagLayoutType - */ - class?: string; - /** - * this is the `data-id` attribute of the element, - * can be query by the [[aid]] Tag API function. - * Not to be confused with the DOM `id` attribute - * - * @type {(string | number)} - * @memberof TagLayoutType - */ - id?: string | number; - /** - * Tooltip text of the element - * - * @type {(string | FormattedString)} - * @memberof TagLayoutType - */ - tooltip?: string | FormattedString; - /** - * `data-width` of the element, not to be confused with - * the `width` attribute of the DOM element - * - * @type {number|string} - * @memberof TagLayoutType - */ - width?: number | string; - /** - ** `data-height` of the element, not to be confused with - * the `height` attribute of the DOM element - * - * @type {number|string} - * @memberof TagLayoutType - */ - height?: number | string; - } - /** - * Data type for event issued by AFX tags - * - * @export - * @interface TagEventDataType - * @template T item template - */ - interface TagEventDataType { - /** - * Reference to the item involved in the event - * - * @type {T} - * @memberof TagEventDataType - */ - item?: T; - [propName: string]: any; - } - /** - * Format of the event issued by AFX tags - * - * @export - * @interface TagEventType - * @template T data type - */ - interface TagEventType { - /** - * `data-id` of the tag that trigger the - * event - * - * @type {(number | string)} - * @memberof TagEventType - */ - id: number | string; - /** - * Data object of the event - * - * @type {T} - * @memberof TagEventType - */ - data: T; - /** - * Original event if any - * - * @type {any} - * @memberof TagEventType - */ - originalEvent?: any; - } - /** - * Drag and Drop data type sent between mouse events - * - * @export - * @interface DnDEventDataType - * @template T - */ - interface DnDEventDataType { - /** - * Reference to the source DOM element - * - * @type {T} - * @memberof DnDEventDataType - */ - from: T[]; - /** - * Reference to the target DOM element - * - * @type {T} - * @memberof DnDEventDataType - */ - to: T; - } - /** - * Tag event callback type - */ - type TagEventCallback = (e: TagEventType) => void; - /** - * Base abstract class for tag implementation, any AFX tag should be - * subclass of this class - * - * @export - * @abstract - * @class AFXTag - * @extends {HTMLElement} - */ - abstract class AFXTag extends HTMLElement { - /** - * The announcer object of the tag - * - * @type {API.Announcer} - * @memberof AFXTag - */ - observable: API.Announcer; - /** - * Reference to some of the tag's children - * element. This reference object is built - * based on the `ref` property found in the - * tag layout [[TagLayoutType]] - * - * @protected - * @type {GenericObject} - * @memberof AFXTag - */ - protected refs: GenericObject; - /** - * boolean value indicated whether the tag - * is already mounted in the DOM tree - * - * @protected - * @type {boolean} - * @memberof AFXTag - */ - protected _mounted: boolean; - /** - *Creates an instance of AFXTag. - * @memberof AFXTag - */ - constructor(); - /** - * This function verifies if a property name of the input object - * corresponds to a setter of the current tag. If this is the - * case, it sets the value of that property to the setter - * - * @param {GenericObject} v input object - * @memberof AFXTag - */ - set(v: GenericObject): void; - /** - * Setter to set the tooltip text to the current tag. - * The text should be in the following format: - * ```text - * cr|cl|ct|cb: tooltip text - * ``` - * - * @memberof AFXTag - */ - set tooltip(v: string); - /** - * - * This function looking for a property name of the tag - * in its prototype chain. The descriptor of the property - * will be returned if it exists - * - * @private - * @param {string} k the property name to be queried - * @returns {PropertyDescriptor} the property descriptor or undefined - * @memberof AFXTag - */ - private descriptor_of; - /** - * Setter: set the id of the tag in string or number - * - * Getter: get the id of the current tag - * - * @memberof AFXTag - */ - set aid(v: string | number); - get aid(): string | number; - /** - * Implementation from HTMLElement interface, - * this function mount the current tag hierarchy - * - * @returns {void} - * @memberof AFXTag - */ - sync(): void; - /** - * Generate the DOM hierarchy of the current tag - * - * @param {API.Announcer} o observable object - * @memberof AFXTag - */ - afxml(o: API.Announcer): void; - /** - * Update the current tag hierarchy - * - * @param {*} d any data object - * @memberof AFXTag - */ - update(d: any): void; - /** - * Init the current tag, this function - * is called before the [[mount]] function - * - * @protected - * @abstract - * @memberof AFXTag - */ - protected abstract init(): void; - /** - * Mount only the current tag - * - * @protected - * @abstract - * @memberof AFXTag - */ - protected abstract mount(): void; - /** - * Layout definition of a tag - * - * @protected - * @abstract - * @returns {TagLayoutType[]} tag layout object - * @memberof AFXTag - */ - protected abstract layout(): TagLayoutType[]; - /** - * Update only the current tag, this function is - * called by [[update]] before chaining the - * update process to its children - * - * @protected - * @abstract - * @param {*} [d] - * @memberof AFXTag - */ - protected abstract reload(d?: any): void; - /** - * This function is used to re-render the current - * tag - * - * @protected - * @memberof AFXTag - */ - protected calibrate(): void; - /** - * This function parses the input layout object - * and generates all the elements defined by - * the tag - * - * @private - * @param {TagLayoutType} tag tag layout object - * @returns {Element} the DOM element specified by the tag layout - * @memberof AFXTag - */ - private mkui; - /** - * This function inserts or removes an attribute name - * to/from the target element based on the input `flag`. - * - * @protected - * @param {boolean} flag indicates whether the attribute name should be inserted o removed - * @param {string} v the attribute name - * @param {HTMLElement} [el] the target element - * @memberof AFXTag - */ - protected attsw(flag: boolean, v: string, el?: HTMLElement): void; - /** - * Insert the attribute name to the target element - * - * @protected - * @param {string} v the attribute name - * @param {HTMLElement} [el] the target element - * @memberof AFXTag - */ - protected atton(v: string, el?: HTMLElement): void; - /** - * Remove the attribute name from the target element - * - * @protected - * @param {string} v attribute name - * @param {HTMLElement} [el] the target element - * @memberof AFXTag - */ - protected attoff(v: string, el?: HTMLElement): void; - /** - * Verify if the target element has an attribute name - * - * @protected - * @param {string} v attribute name - * @param {HTMLElement} [el] target element - * @returns {boolean} - * @memberof AFXTag - */ - protected hasattr(v: string, el?: HTMLElement): boolean; - } - /** - * All the AFX tags are defined in this namespace, - * these tags are defined as custom DOM elements and will be - * stored in the `customElements` registry of the browser - */ - namespace tag { - /** - * Alias to all classes that extends [[AFXTag]] - */ - type AFXTagTypeClass = { - new (): T; - }; - /** - * Define an AFX tag as a custom element and add it to the - * global `customElements` registry. If the tag is redefined, i.e. - * the tag already exists, its behavior will be updated with the - * new definition - * - * @export - * @template T all classes that extends [[AFXTag]] - * @param {string} name name of the tag - * @param {{ new (): T }} cls the class that defines the tag - * @returns {void} - */ - function define(name: string, cls: { - new (): T; - }): void; - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * List item event data type - */ - type ListItemEventData = TagEventDataType; - /** - * A list item represent the individual view of an item in the [[ListView]]. - * This class is an abstract prototype class, implementation of any - * list view item should extend it - * - * - * @export - * @abstract - * @class ListViewItemTag - * @extends {AFXTag} - */ - abstract class ListViewItemTag extends AFXTag { - /** - * Data placeholder for the list item - * - * @private - * @type {GenericObject} - * @memberof ListViewItemTag - */ - private _data; - /** - * placeholder for the item select event callback - * - * @private - * @type {TagEventCallback} - * @memberof ListViewItemTag - */ - private _onselect; - /** - * Context menu event callback handle - * - * @private - * @type {TagEventCallback} - * @memberof ListViewItemTag - */ - private _onctxmenu; - /** - * Click event callback placeholder - * - * @private - * @type {TagEventCallback} - * @memberof ListViewItemTag - */ - private _onclick; - /** - * Double click event callback handle - * - * @private - * @type {TagEventCallback} - * @memberof ListViewItemTag - */ - private _ondbclick; - /** - * Item close event callback placeholder - * - * @private - * @type {TagEventCallback} - * @memberof ListViewItemTag - */ - private _onclose; - /** - *Creates an instance of ListViewItemTag. - * @memberof ListViewItemTag - */ - constructor(); - /** - * Setter: Turn on/off the `closable` feature of the list item - * - * Getter: Check whether the item is closable - * - * @memberof ListViewItemTag - */ - set closable(v: boolean); - get closable(): boolean; - /** - * Set item select event handle - * - * @memberof ListViewItemTag - */ - set onitemselect(v: TagEventCallback); - /** - * Setter: select/unselect the current item - * - * Getter: Check whether the current item is selected - * - * @memberof ListViewItemTag - */ - set selected(v: boolean); - get selected(): boolean; - /** - * Set the context menu event handle - * - * @memberof ListViewItemTag - */ - set onctxmenu(v: TagEventCallback); - /** - * Set the item click event handle - * - * @memberof ListViewItemTag - */ - set onitemclick(v: TagEventCallback); - /** - * Set the item double click event handle - * - * @memberof ListViewItemTag - */ - set onitemdbclick(v: TagEventCallback); - /** - * set the item close event handle - * - * @memberof ListViewItemTag - */ - set onitemclose(v: TagEventCallback); - /** - * Mount the tag and bind some events - * - * @protected - * @memberof ListViewItemTag - */ - protected mount(): void; - /** - * Layout definition of the item tag. - * This function define the outer layout of the item. - * Custom inner layout of each item implementation should - * be defined in [[itemlayout]] - * - * @protected - * @returns {TagLayoutType[]} - * @memberof ListViewItemTag - */ - protected layout(): TagLayoutType[]; - /** - * Setter: - * - * Set the data of the list item. This will - * trigger the [[ondatachange]] function - * - * Getter: - * - * Get the data of the current list item - * - * @memberof ListViewItemTag - */ - set data(v: GenericObject); - get data(): GenericObject; - /** - * Any subclass of this class should implement this - * function to provide its custom item layout - * - * @protected - * @abstract - * @returns {TagLayoutType | TagLayoutType[]} - * @memberof ListViewItemTag - */ - protected abstract itemlayout(): TagLayoutType | TagLayoutType[]; - /** - * This function is called when the item data is changed. - * It should be implemented in all subclass of this class - * - * @protected - * @abstract - * @memberof ListViewItemTag - */ - protected abstract ondatachange(): void; - } - /** - * The layout of a simple list item contains only a - * AFX label - * - * @export - * @class SimpleListItemTag - * @extends {ListViewItemTag} - */ - class SimpleListItemTag extends ListViewItemTag { - /** - *Creates an instance of SimpleListItemTag. - * @memberof SimpleListItemTag - */ - constructor(); - /** - * Reset some property to default - * - * @protected - * @memberof SimpleListItemTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @memberof SimpleListItemTag - */ - protected calibrate(): void; - /** - * Refresh the inner label when the item data - * is changed - * - * @protected - * @returns {void} - * @memberof SimpleListItemTag - */ - protected ondatachange(): void; - /** - * Re-render the list item - * - * @protected - * @memberof SimpleListItemTag - */ - protected reload(): void; - /** - * List item custom layout definition - * - * @protected - * @returns {TagLayoutType | TagLayoutType[]} - * @memberof SimpleListItemTag - */ - protected itemlayout(): TagLayoutType | TagLayoutType[]; - } - /** - * The layout of a double line list item contains two - * AFX labels - * - * @export - * @class DoubleLineListItemTag - * @extends {ListViewItemTag} - */ - class DoubleLineListItemTag extends ListViewItemTag { - /** - *Creates an instance of DoubleLineListItemTag. - * @memberof DoubleLineListItemTag - */ - constructor(); - /** - * Reset some property to default - * - * @protected - * @memberof DoubleLineListItemTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @memberof DoubleLineListItemTag - */ - protected calibrate(): void; - /** - * Refresh the inner label when the item data - * is changed - * - * @protected - * @returns {void} - * @memberof DoubleLineListItemTag - */ - protected ondatachange(): void; - /** - * Re-render the list item - * - * @protected - * @memberof DoubleLineListItemTag - */ - protected reload(): void; - /** - * List item custom layout definition - * - * @protected - * @returns {TagLayoutType | TagLayoutType[]} - * @memberof DoubleLineListItemTag - */ - protected itemlayout(): TagLayoutType | TagLayoutType[]; - } - /** - * This tag defines a traditional or a dropdown list widget. - * It contains a collection of list items in which layout - * of each item may be variable - * - * @export - * @class ListViewTag - * @extends {AFXTag} - */ - class ListViewTag extends AFXTag { - /** - * placeholder of list select event handle - * - * @private - * @type {TagEventCallback} - * @memberof ListViewTag - */ - private _onlistselect; - /** - * placeholder of list double click event handle - * - * @private - * @type {TagEventCallback} - * @memberof ListViewTag - */ - private _onlistdbclick; - /** - * placeholder of list drag and drop event handle - * - * @private - * @type {TagEventCallback>} - * @memberof ListViewTag - */ - private _ondragndrop; - /** - * placeholder of list item close event handle - * - * @private - * @memberof ListViewTag - */ - private _onitemclose; - /** - * placeholder of drag and drop mouse down event handle - * - * @private - * @memberof ListViewTag - */ - private _onmousedown; - /** - * placeholder of drag and drop mouse up event handle - * - * @private - * @memberof ListViewTag - */ - private _onmouseup; - /** - * placeholder of drag and drop mouse move event handle - * - * @private - * @memberof ListViewTag - */ - private _onmousemove; - /** - * Reference to the latest selected DOM item - * - * @private - * @type {ListViewItemTag} - * @memberof ListViewTag - */ - private _selectedItem; - /** - * A collection of selected items in the list. - * The maximum size of this collection is 1 if - * the [[multiselect]] feature is disabled - * - * @private - * @type {ListViewItemTag[]} - * @memberof ListViewTag - */ - private _selectedItems; - /** - * The anchor element that the list view positioned on - * This is helpful when rendering dropdown list - * @private - * @type{HTMLElement} - * @memberof ListViewTag - */ - private _anchor; - /** - * Data placeholder of the list - * - * @private - * @type {GenericObject[]} - * @memberof ListViewTag - */ - private _data; - /** - * Event data passing between mouse event when performing - * drag and drop on the list - * - * @private - * @type {{ from: ListViewItemTag[]; to: ListViewItemTag }} - * @memberof ListViewTag - */ - private _dnd; - /** - *Creates an instance of ListViewTag. - * @memberof ListViewTag - */ - constructor(); - /** - * Reset the tag's properties to the default values - * - * @protected - * @memberof ListViewTag - */ - protected init(): void; - /** - * This function does nothing - * - * @protected - * @param {*} [d] - * @memberof ListViewTag - */ - protected reload(d?: any): void; - /** - * Setter: toggle between dropdown and traditional list - * - * Getter: Check whether the list is dropdown or traditional list - * - * @memberof ListViewTag - */ - set dropdown(v: boolean); - /** - * Set drag and drop event handle - * - * @memberof ListViewTag - */ - set ondragndrop(v: TagEventCallback>); - /** - * Set list select event handle - * - * @memberof ListViewTag - */ - set onlistselect(v: TagEventCallback); - /** - * Set double click event handle - * - * @memberof ListViewTag - */ - set onlistdbclick(v: TagEventCallback); - /** - * Set item close event handle - * - * @memberof ListViewTag - */ - set onitemclose(v: (e: TagEventType) => boolean); - get dropdown(): boolean; - /** - * Setter: - * - * Set the default tag name of list's items. - * If the tag name is not specified in the - * data of a list item, this tag will be used - * - * Getter: - * - * Get the default tag name of list item - * - * @memberof ListViewTag - */ - set itemtag(v: string); - get itemtag(): string; - /** - * Setter: - * - * Turn on/off of the `multiselect` feature - * - * Getter: - * - * Check whether multi-select is allowed - * in this list - * - * @memberof ListViewTag - */ - set multiselect(v: boolean); - get multiselect(): boolean; - /** - * Setter: Enable/disable drag and drop event in the list - * - * Getter: Check whether the drag and drop event is enabled - * - * @memberof ListViewTag - */ - set dragndrop(v: boolean); - get dragndrop(): boolean; - /** - * Set the buttons layout of the list. - * Button layout allows to add some custom - * behaviors to the list. - * - * Each button data should define the [[onbtclick]] - * event handle to specify the custom behavior - * - * When the list is configured as dropdown. The buttons - * layout will be disabled - * - * Example of a button data: - * - * ``` - * { - * text: "Button text", - * icon: "home://path/to/icon.png", - * iconclass: "icon-class-name", - * onbtclick: (e) => console.log(e) - * } - * ``` - * - * @memberof ListViewTag - */ - set buttons(v: GenericObject[]); - /** - * Getter: Get list direction: horizontal or vertical (default) - * - * Setter: Get list direction: horizontal or vertical - * - * @type {string} - * @memberof ListViewTag - */ - set dir(v: string); - get dir(): string; - /** - * Getter: Get data of the list - * - * Setter: Set data to the list - * - * @type {GenericObject[]} - * @memberof ListViewTag - */ - get data(): GenericObject[]; - set data(data: GenericObject[]); - /** - * Do nothing - * - * @protected - * @memberof ListViewTag - */ - protected ondatachange(): void; - /** - * Setter: Select list item(s) by their indexes - * - * Getter: Get the indexes of all selected items - * - * @memberof ListViewTag - */ - set selected(idx: number | number[]); - /** - * Get the latest selected item - * - * @readonly - * @type {ListViewItemTag} - * @memberof ListViewTag - */ - get selectedItem(): ListViewItemTag; - /** - * Get all the selected items - * - * @readonly - * @type {ListViewItemTag[]} - * @memberof ListViewTag - */ - get selectedItems(): ListViewItemTag[]; - /** - * get the selected item index - * - * @readonly - * @type {number} - * @memberof ListViewTag - */ - get selected(): number | number[]; - /** - * Add an item to the beginning of the list - * - * @param {GenericObject} item - * @returns {ListViewItemTag} the added list item element - * @memberof ListViewTag - */ - unshift(item: GenericObject): ListViewItemTag; - /** - * check whether the list has data - * - * @private - * @param {GenericObject} v - * @returns - * @memberof ListViewTag - */ - private has_data; - /** - * Add an item to the beginning or end of the list - * - * @param {GenericObject} item list item data - * @param {boolean} flag indicates whether to add the item in the beginning of the list - * @returns {ListViewItemTag} the added list item element - * @memberof ListViewTag - */ - push(item: GenericObject, flag?: boolean): ListViewItemTag; - /** - * Delete an item - * - * @param {ListViewItemTag} item item DOM element - * @memberof ListViewTag - */ - delete(item: ListViewItemTag): void; - /** - * Select item next to the currently selected item. - * If there is no item selected, the first item will - * be selected - * - * @returns {void} - * @memberof ListViewTag - */ - selectNext(): void; - /** - * Select the previous item in the list. - * - * @returns {void} - * @memberof ListViewTag - */ - selectPrev(): void; - /** - * Unselect all the selected items in the list - * - * @returns {void} - * @memberof ListViewTag - */ - unselect(): void; - /** - * This function triggers the click event on an item - * - * @private - * @param {TagEventType} e tag event object - * @param {boolean} flag indicates whether this is a double click event - * @returns {void} - * @memberof ListViewTag - */ - private iclick; - /** - * This function triggers the double click event on an item - * - * @protected - * @param {TagEventType} e tag event object - * @returns - * @memberof ListViewTag - */ - protected idbclick(e: TagEventType): void; - /** - * This function triggers the list item select event - * - * @protected - * @param {TagEventType} e tag event object - * @returns - * @memberof ListViewTag - */ - protected iselect(e: TagEventType): void; - /** - * Mount the tag and bind some basic event - * - * @protected - * @returns {void} - * @memberof ListViewTag - */ - protected mount(): void; - /** - * This function triggers the item close event - * - * @private - * @param {TagEventType} e tag event object - * @returns {void} - * @memberof ListViewTag - */ - private iclose; - /** - * Show the dropdown list. - * This function is called only when the list is a dropdown - * list - * - * @protected - * @param {*} e - * @returns {void} - * @memberof ListViewTag - */ - protected showlist(e: any): void; - /** - * Hide the dropdown list. - * This function is called only when the list is a dropdown - * list - * - * @protected - * @param {*} e - * @memberof ListViewTag - */ - protected dropoff(e: any): void; - /** - * calibrate the list layout - * - * @protected - * @returns {void} - * @memberof ListViewTag - */ - protected calibrate(): void; - /** - * List view layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof ListViewTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A simple number sinner tag - * - * @export - * @class NSpinnerTag - * @extends {AFXTag} - */ - class NSpinnerTag extends AFXTag { - /** - * Placeholder for value change event handle - * - * @private - * @type {TagEventCallback} - * @memberof NSpinnerTag - */ - private _onchange; - /** - * Placeholder for the spinner data - * - * @private - * @type {number} - * @memberof NSpinnerTag - */ - private _value; - /** - * Place holder for the spinner step - * - * @type {number} - * @memberof NSpinnerTag - */ - step: number; - /** - *Creates an instance of NSpinnerTag. - * @memberof NSpinnerTag - */ - constructor(); - /** - * Init the spinner value to `0` and step to `1` - * - * @protected - * @memberof NSpinnerTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof NSpinnerTag - */ - protected reload(d?: any): void; - /** - * Set the value change event handle - * - * @memberof NSpinnerTag - */ - set onvaluechange(f: TagEventCallback); - /** - * Mount the tag and bind basic events - * - * @protected - * @memberof NSpinnerTag - */ - protected mount(): void; - /** - * Calibrate the layout of the spinner - * - * @memberof NSpinnerTag - */ - calibrate(): void; - /** - * Setter: Set the spinner value - * - * Getter: Get the spinner value - * - * @memberof NSpinnerTag - */ - set value(v: number); - get value(): number; - /** - * Spinner layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof NSpinnerTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -/// -declare namespace OS { - namespace GUI { - namespace tag { - /** - * This tag define a basic text input and its behavior - * - * @export - * @class InputTag - * @extends {AFXTag} - */ - class InputTag extends AFXTag { - /** - *Creates an instance of InputTag. - * @memberof InputTag - */ - constructor(); - /** - * Set the path to the header icon, the path should be - * a VFS file path - * - * @memberof InputTag - */ - set icon(v: string); - /** - * Set the icon class to the header - * - * @memberof InputTag - */ - set iconclass(v: string); - /** - * Alias to header setter/getter - * - * @memberof InputTag - */ - set text(v: string | FormattedString); - get text(): string | FormattedString; - /** - * Setter: Set the text of the label - * - * Getter: Get the current label test - * - * @memberof InputTag - */ - set label(v: string | FormattedString); - get label(): string | FormattedString; - /** - * Setter: Enable or disable the input - * - * Getter: Get the `enable` property of the input - * - * @memberof InputTag - */ - set disable(v: boolean); - get disable(): boolean; - /** - * Setter: set verbosity of the input - * - * Getter: Get the current input verbosity - * - * @memberof InputTag - */ - set verbose(v: boolean); - get verbose(): boolean; - /** - * JQuery style generic event handling on the input element - * - * @param {string} enname: JQuery event name - * @param {JQuery.TypeEventHandler} handle: JQuery handle - * @memberof InputTag - */ - on(ename: string, handle: JQuery.TypeEventHandler): void; - /** - * Manually trigger an event - * - * @param {string} evt: JQuery event name - * @memberof InputTag - */ - trigger(evt: string): void; - /** - * Mount the tag - * - * @protected - * @memberof InputTag - */ - protected mount(): void; - /** - * Get the current active input element - * - * @memberof InputTag - */ - get input(): HTMLInputElement | HTMLTextAreaElement; - /** - * Get/set the current active input value - * - * @memberof InputTag - */ - get value(): string; - set value(v: string); - /** - * Get/set input type - * This only affects the inline input element - * - * @memberof InputTag - */ - get type(): string; - set type(v: string); - /** - * Get/set input name - * - * @memberof InputTag - */ - get name(): string; - set name(v: string); - /** - * Init the tag before mounting - * - * @protected - * @memberof InputTag - */ - protected init(): void; - /** - * Re-calibrate, do nothing in this tag - * - * @protected - * @memberof InputTag - */ - protected calibrate(): void; - /** - * Update the current tag, do nothing in this tag - * - * @param {*} [d] - * @memberof InputTag - */ - reload(d?: any): void; - /** - * Input layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof InputTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Tag event data type definition - */ - type TabEventData = TagEventDataType; - /** - * a TabBar allows to control a collection of tabs - * - * @export - * @class TabBarTag - * @extends {AFXTag} - */ - export class TabBarTag extends AFXTag { - /** - * Placeholder of currently selected tab index - * - * @private - * @type {number} - * @memberof TabBarTag - */ - private _selected; - /** - * Placeholder of tab close event handle - * - * @private - * @memberof TabBarTag - */ - private _ontabclose; - /** - * Placeholder of tab select event handle - * - * @private - * @type {TagEventCallback} - * @memberof TabBarTag - */ - private _ontabselect; - /** - * Cache of touch event - * - * @private - * @meberof TabBarTag - */ - private _previous_touch; - /** - *Creates an instance of TabBarTag. - * @memberof TabBarTag - */ - constructor(); - /** - * Init the tag - * - * @protected - * @memberof TabBarTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof TabBarTag - */ - protected reload(d?: any): void; - /** - * Setter: Enable/disable a tab to be closed - * - * Getter: Check whether tabs can be closed - * - * @memberof TabBarTag - */ - set closable(v: boolean); - get closable(): boolean; - /** - * Setter: - * - * Set the tab bar direction: - * - `horizontal`: horizontal direction - * - `vertical`: vertical direction - * - * Getter: - * - * Get the tab bar direction - * - * @memberof TabBarTag - */ - set dir(v: string); - get dir(): string; - /** - * Add a tab in the end of the tab bar - * - * @param {GenericObject} item tab data - * @memberof TabBarTag - */ - push(item: GenericObject): ListViewItemTag; - /** - * Delete a tab - * - * @param {ListViewItemTag} el reference to DOM element of a tab - * @memberof TabBarTag - */ - delete(el: ListViewItemTag): void; - /** - * Add a tab to the beginning of the tab bar - * - * @param {GenericObject} item tab data - * @memberof TabBarTag - */ - unshift(item: GenericObject): ListViewItemTag; - /** - * Setter: Set tabs data - * - * Getter: Get all tabs data - * - * @memberof TabBarTag - */ - set items(v: GenericObject[]); - get items(): GenericObject[]; - /** - * Setter: Select a tab by its index - * - * Getter: Get the currently selected tab - * - * @memberof TabBarTag - */ - set selected(v: number | number[]); - get selected(): number | number[]; - /** - * Get the latest selected item - * - * @readonly - * @type {ListViewItemTag} - * @memberof TabBarTag - */ - get selectedItem(): ListViewItemTag; - /** - * Set the tab close event handle - * - * @memberof TabBarTag - */ - set ontabclose(v: (e: TagEventType) => boolean); - /** - * Set the tab select event handle - * - * @memberof TabBarTag - */ - set ontabselect(v: TagEventCallback); - /** - * Mount the tab bar and bind some basic events - * - * @protected - * @memberof TabBarTag - */ - protected mount(): void; - /** - * TabBar layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof TabBarTag - */ - protected layout(): TagLayoutType[]; - } - export {}; - } - } -} -declare namespace OS { - namespace GUI { - /** - * Color type used by AFX API - * - * @export - * @interface ColorType - */ - interface ColorType { - /** - * Red chanel - * - * @type {number} - * @memberof ColorType - */ - r: number; - /** - * Green chanel - * - * @type {number} - * @memberof ColorType - */ - g: number; - /** - * Blue chanel - * - * @type {number} - * @memberof ColorType - */ - b: number; - /** - * Alpha chanel - * - * @type {number} - * @memberof ColorType - */ - a?: number; - /** - * color text in CSS format - * - * @type {string} - * @memberof ColorType - */ - text?: string; - /** - * Color in hex format - * - * @type {string} - * @memberof ColorType - */ - hex?: string; - } - namespace tag { - /** - * Class definition of Color picker widget - * - * @export - * @class ColorPickerTag - * @extends {AFXTag} - */ - class ColorPickerTag extends AFXTag { - /** - * The current selected color object - * - * @private - * @type {ColorType} - * @memberof ColorPickerTag - */ - private _selectedColor; - /** - * placeholder for the color select event callback - * - * @private - * @type {TagEventCallback} - * @memberof ColorPickerTag - */ - private _oncolorselect; - /** - * Creates an instance of ColorPickerTag. - * @memberof ColorPickerTag - */ - constructor(); - /** - * Init tag before mounting, do nothing - * - * @protected - * @memberof ColorPickerTag - */ - protected init(): void; - /** - * Reload tag, do nothing - * - * @protected - * @param {*} [d] - * @memberof ColorPickerTag - */ - protected reload(d?: any): void; - /** - * Get selected color value - * - * @readonly - * @type {ColorType} - * @memberof ColorPickerTag - */ - get selectedColor(): ColorType; - /** - * Set the color select event handle - * - * @memberof ColorPickerTag - */ - set oncolorselect(v: TagEventCallback); - /** - * Mount the widget to DOM tree - * - * @protected - * @memberof ColorPickerTag - */ - protected mount(): void; - /** - * Build the color palette - * - * @private - * @memberof ColorPickerTag - */ - private build_palette; - /** - * layout definition of the widget - * - * @protected - * @returns {TagLayoutType[]} - * @memberof ColorPickerTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -/// -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A `resizer` tag is basically used to dynamically resize an element using mouse. - * It is usually put inside a [[TileLayoutTag]] an can be attached to any element. Example: - * - * The resizer tag in the following example will be attached to the first `afx-vbox`, - * and allows to resize this element using mouse - * - * ```xml - * - * ... - * - * ... - * - * ``` - * - * @export - * @class ResizerTag - * @extends {AFXTag} - */ - class ResizerTag extends AFXTag { - /** - * Reference to the element that this tag is attached to - * - * @private - * @type {*} - * @memberof ResizerTag - */ - private _resizable_el; - /** - * Reference to the resize event callback - * - * @private - * @type {TagEventCallback} - * @memberof ResizerTag - */ - private _onresize; - /** - * Reference to the parent tag of the current tag. - * The parent tag should be an instance of a [[TileLayoutTag]] - * such as [[VBoxTag]] or [[HBoxTag]] - * - * @private - * @type {*} - * @memberof ResizerTag - */ - private _parent; - /** - * Placeholder of the minimum value that - * the attached element can be resized - * - * @private - * @type {number} - * @memberof ResizerTag - */ - private _minsize; - /** - *Creates an instance of ResizerTag. - * @memberof ResizerTag - */ - constructor(); - /** - * Set the properties of the tag to default values - * - * @protected - * @memberof ResizerTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof ResizerTag - */ - protected reload(d?: any): void; - /** - * Setter: - * - * Set resize direction, two possible values: - * - `hz` - horizontal direction, resize by width - * - `ve` - vertical direction, resize by height - * - * Getter: - * - * Get the resize direction - * - * @memberof ResizerTag - */ - set dir(v: string); - get dir(): string; - /** - * Getter : Check whether the resizer should attach to its next or previous element - * - * Setter: if `v=true` select next element as attached element of the resizer, otherwise - * select the previous element - * @readonly - * @type {boolean} - * @memberof ResizerTag - */ - get attachnext(): boolean; - set attachnext(v: boolean); - /** - * Setter: - * - set the resize event callback - * - * Getter: - * - get the resize event callback - * - * @memberof ResizerTag - */ - set onelresize(v: TagEventCallback); - get onelresize(): TagEventCallback; - /** - * Mount the tag to the DOM tree - * - * @protected - * @memberof ResizerTag - */ - protected mount(): void; - /** - * Enable draggable on the element - * - * @private - * @memberof ResizerTag - */ - private make_draggable; - /** - * Resize the attached element in the horizontal direction (width) - * - * @private - * @param {JQuery.MouseEventBase} e JQuery mouse event - * @returns {void} - * @memberof ResizerTag - */ - private horizontalResize; - /** - * Resize the attached element in the vertical direction (height) - * - * @protected - * @param {JQuery.MouseEventBase} e JQuery mouse event - * @returns {void} - * @memberof ResizerTag - */ - protected verticalResize(e: JQuery.MouseEventBase): void; - /** - * Layout definition of the tag, empty layout - * - * @protected - * @returns {TagLayoutType[]} - * @memberof ResizerTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * This class defines basic AFX label tag. - * A label contains a text and an icon (optional) - * - * @export - * @class LabelTag - * @extends {AFXTag} - */ - class LabelTag extends AFXTag { - /** - * placeholder of the text to be displayed - * - * @private - * @type {(string | FormattedString)} - * @memberof LabelTag - */ - private _text; - /** - *Creates an instance of LabelTag. - * @memberof LabelTag - */ - constructor(); - /** - * this implementation does nothing in this tag - * - * @protected - * @memberof LabelTag - */ - protected mount(): void; - /** - * Refresh the text in the label - * - * @protected - * @param {*} d - * @memberof LabelTag - */ - protected reload(d: any): void; - /** - * Reset to default some property value - * - * @protected - * @memberof LabelTag - */ - protected init(): void; - /** - * This implementation of the function does nothing - * - * @protected - * @memberof LabelTag - */ - protected calibrate(): void; - /** - * Set the VFS path of the label icon - * - * @memberof LabelTag - */ - set icon(v: string); - /** - * set horizontal aligment of the label content - * - * @param {string} v shall be "left, right, or center" - */ - set halign(v: string); - /** - * set horizontal aligment of the label content - * - * @param {string} v shall be "top, bottom, or center" - */ - set valign(v: string); - /** - * Set the CSS class of the label icon - * - * @memberof LabelTag - */ - set iconclass(v: string); - /** - * Set the CSS class of the label icon on the right side - * - * @memberof LabelTag - */ - set iconclass_end(v: string); - /** - * Set the CSS class of the label icon on the right side - * - * @memberof LabelTag - */ - set iconclass$(v: string); - /** - * Setter: Set the text of the label - * - * Getter: Get the text displayed on the label - * - * @memberof LabelTag - */ - set text(v: string | FormattedString); - get text(): string | FormattedString; - /** - * Setter: Turn on/off text selection - * - * Getter: Check whether the label is selectable - * - * @memberof LabelTag - */ - set selectable(v: boolean); - get swon(): boolean; - /** - * Lqbel layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof LabelTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - /** - * Tab container data type definition - * - * @export - * @interface TabContainerTabType - */ - interface TabContainerTabType { - /** - * Reference to the DOM element of the current container - * - * @type {HTMLElement} - * @memberof TabContainerTabType - */ - container: HTMLElement; - [propName: string]: any; - } - namespace tag { - /** - * A tab container allows to attach each tab on a [[TabBarTag]] - * with a container widget. The attached container widget should be - * composed inside a [[HBoxTag]] - * - * The tab bar in a tab container can be configured to display tabs - * in horizontal (row) or vertical (column) order. Default to vertical order - * - * Once a tab is selected, its attached container will be shown - * - * @export - * @class TabContainerTag - * @extends {AFXTag} - */ - class TabContainerTag extends AFXTag { - /** - * Reference to the currently selected tab DOM element - * - * @private - * @type {TabContainerTabType} - * @memberof TabContainerTag - */ - private _selectedTab; - /** - * Placeholder of the tab select event handle - * - * @protected - * @type {TagEventCallback} - * @memberof TabContainerTag - */ - protected _ontabselect: TagEventCallback; - /** - *Creates an instance of TabContainerTag. - * @memberof TabContainerTag - */ - constructor(); - /** - * Init the tab bar direction to vertical (column) - * - * @protected - * @memberof TabContainerTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof TabContainerTag - */ - protected reload(d?: any): void; - /** - * Set the tab select event handle - * - * @memberof TabContainerTag - */ - set ontabselect(f: TagEventCallback); - /** - * Get all tab items in the container - * - * @readonly - * @type {TabContainerTabType[]} - * @memberof TabContainerTag - */ - get tabs(): TabContainerTabType[]; - /** - * Setter: Select a tab by its index - * Getter: Get the current selected index - * - * @memberof TabContainerTag - */ - set selectedIndex(i: number); - get selectedIndex(): number; - /** - * Setter: - * - * Set the tab bar direction: - * - `row`: horizontal direction - * - `column`: vertical direction - * - * Getter: - * - * Get the tab bar direction - * - * @memberof TabContainerTag - */ - set dir(v: "row" | "column"); - get dir(): "row" | "column"; - /** - * Setter: - * - * Select a tab using the its tab data type. - * This will show the attached container to the tab - * - * Getter: - * - * Get the tab data of the currently selected Tab - * - * @memberof TabContainerTag - */ - set selectedTab(v: TabContainerTabType); - get selectedTab(): TabContainerTabType; - /** - * Set the tab bar width, this function only - * works when the tab bar direction is set to - * `row` - * - * @memberof TabContainerTag - */ - set tabbarwidth(v: number); - /** - * Set the tab bar height, this function only works - * when the tab bar direction is set to `column` - * - * @memberof TabContainerTag - */ - set tabbarheight(v: number); - /** - * Add a new tab with container to the container - * - * item should be in the following format: - * - * ```ts - * { - * text: string, - * icon?: string, - * iconclass?: string, - * container: HTMLElement - * } - * ``` - * - * @param {GenericObject} item tab descriptor - * @param {boolean} insert insert the tab content to the container ? - * @returns {ListViewItemTag} the tab DOM element - * @memberof TabContainerTag - */ - addTab(item: GenericObject, insert: boolean): ListViewItemTag; - /** - * Remove a tab from the container - * - * @param {ListViewItemTag} tab the tab item to be removed - * @memberof TabContainerTag - */ - removeTab(tab: ListViewItemTag): void; - /** - * Mount the tag and bind basic events - * - * @protected - * @memberof TabContainerTag - */ - protected mount(): void; - /** - * calibrate the tab container - * - * @memberof TabContainerTag - */ - calibrate(): void; - /** - * Layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof TabContainerTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -/** - * Extend the Array interface with some - * property needed by AFX API - * - * @interface Array - * @template T - */ -interface Array { - /** - * Reference to a DOM element created by AFX API, - * this property is used by some AFX tags to refer - * to its child element in it data object - * - * @type {GenericObject} - * @memberof Array - */ - domel?: GenericObject; -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Row item event data type - */ - type GridRowEventData = TagEventDataType; - /** - * A grid Row is a simple element that - * contains a group of grid cell - * - * @export - * @class GridRowTag - * @extends {AFXTag} - */ - class GridRowTag extends AFXTag { - /** - * Data placeholder for a collection of cell data - * - * @type {GenericObject[]} - * @memberof GridRowTag - */ - data: GenericObject[]; - /** - * placeholder for the row select event callback - * - * @private - * @type {TagEventCallback} - * @memberof ListViewItemTag - */ - private _onselect; - /** - *Creates an instance of GridRowTag. - * @memberof GridRowTag - */ - constructor(); - /** - * Set item select event handle - * - * @memberof ListViewItemTag - */ - set onrowselect(v: TagEventCallback); - /** - * Setter: select/unselect the current item - * - * Getter: Check whether the current item is selected - * - * @memberof ListViewItemTag - */ - set selected(v: boolean); - get selected(): boolean; - /** - * Mount the tag, do nothing - * - * @protected - * @memberof GridRowTag - */ - protected mount(): void; - /** - * Init the tag before mounting: reset the data placeholder - * - * @protected - * @memberof GridRowTag - */ - protected init(): void; - /** - * Empty layout - * - * @protected - * @returns {TagLayoutType[]} - * @memberof GridRowTag - */ - protected layout(): TagLayoutType[]; - /** - * This function does nothing in this tag - * - * @protected - * @memberof GridRowTag - */ - protected calibrate(): void; - /** - * This function does nothing in this tag - * - * @protected - * @param {*} [d] - * @memberof GridRowTag - */ - protected reload(d?: any): void; - } - /** - * Event data used by grid cell - */ - type CellEventData = TagEventDataType; - /** - * Prototype of any grid cell, custom grid cell - * definition should extend and implement this - * abstract prototype - * - * @export - * @abstract - * @class GridCellPrototype - * @extends {AFXTag} - */ - abstract class GridCellPrototype extends AFXTag { - /** - * placeholder for cell selected event callback - * - * @private - * @type {TagEventCallback} - * @memberof GridCellPrototype - */ - private _oncellselect; - /** - * placeholder for cell double click event callback - * - * @private - * @type {TagEventCallback} - * @memberof GridCellPrototype - */ - private _oncelldbclick; - /** - * Data placeholder of the current cell - * - * @private - * @type {GenericObject} - * @memberof GridCellPrototype - */ - private _data; - /** - *Creates an instance of GridCellPrototype. - * @memberof GridCellPrototype - */ - constructor(); - /** - * Set the cell selected event callback - * - * @memberof GridCellPrototype - */ - set oncellselect(v: TagEventCallback); - /** - * Set the cell double click event callback - * - * @memberof GridCellPrototype - */ - set oncelldbclick(v: TagEventCallback); - /** - * Setter: - * - * Set the data of the cell, this will trigger - * the [[ondatachange]] function - * - * Getter: - * - * Get the current cell data placeholder - * - * @memberof GridCellPrototype - */ - set data(v: GenericObject); - get data(): GenericObject; - /** - * Setter: - * - * Set/unset the current cell as selected. - * This will trigger the [[cellselect]] - * event - * - * Getter: - * - * Check whether the current cell is selected - * - * @memberof GridCellPrototype - */ - set selected(v: boolean); - get selected(): boolean; - /** - * Update the current cell. This will - * reset the cell data - * - * @protected - * @param {*} d - * @memberof GridCellPrototype - */ - protected reload(d: any): void; - /** - * Mount the current cell to the grid - * - * @protected - * @memberof GridCellPrototype - */ - protected mount(): void; - /** - * This function triggers the cell select - * event - * - * @private - * @param {TagEventType} e - * @param {boolean} flag - * @returns {void} - * @memberof GridCellPrototype - */ - private cellselect; - /** - * Abstract function called when the cell data changed. - * This should be implemented by subclasses - * - * @protected - * @abstract - * @memberof GridCellPrototype - */ - protected abstract ondatachange(): void; - } - /** - * Simple grid cell defines a grid cell with - * an [[LabelTag]] as it cell layout - * - * @export - * @class SimpleGridCellTag - * @extends {GridCellPrototype} - */ - class SimpleGridCellTag extends GridCellPrototype { - /** - *Creates an instance of SimpleGridCellTag. - * @memberof SimpleGridCellTag - */ - constructor(); - /** - * Reset the label of the cell with its data - * - * @protected - * @memberof SimpleGridCellTag - */ - protected ondatachange(): void; - /** - * This function do nothing in this tag - * - * @protected - * @memberof SimpleGridCellTag - */ - protected init(): void; - /** - * This function do nothing in this tag - * - * @protected - * @memberof SimpleGridCellTag - */ - protected calibrate(): void; - /** - * The layout of the cell with a simple [[LabelTag]] - * - * @returns - * @memberof SimpleGridCellTag - */ - layout(): { - el: string; - ref: string; - }[]; - } - /** - * A Grid contains a header and a collection grid rows - * which has the same number of cells as the number of - * the header elements - * - * @export - * @class GridViewTag - * @extends {AFXTag} - */ - class GridViewTag extends AFXTag { - /** - * Grid header definition - * - * @private - * @type {GenericObject[]} - * @memberof GridViewTag - */ - private _header; - /** - * Grid rows data placeholder - * - * @private - * @type {GenericObject[][]} - * @memberof GridViewTag - */ - private _rows; - /** - * Reference to the current selected row DOM element - * - * @private - * @type {GridRowTag} - * @memberof GridViewTag - */ - private _selectedRow; - /** - * A collection of selected grid rows DOM element - * - * @private - * @type {GridRowTag[]} - * @memberof GridViewTag - */ - private _selectedRows; - /** - * Reference to the current selected cell - * - * @private - * @type {GridCellPrototype} - * @memberof GridViewTag - */ - private _selectedCell; - /** - * Cell select event callback placeholder - * - * @private - * @type {TagEventCallback} - * @memberof GridViewTag - */ - private _oncellselect; - /** - * Row select event callback placeholder - * - * @private - * @type {TagEventCallback} - * @memberof GridViewTag - */ - private _onrowselect; - /** - * Cell double click event callback placeholder - * - * @private - * @type {TagEventCallback} - * @memberof GridViewTag - */ - private _oncelldbclick; - /** - * Event data passing between mouse event when performing - * drag and drop on the list - * - * @private - * @type {{ from: GridRowTag[]; to: GridRowTag }} - * @memberof GridViewTag - */ - private _dnd; - /** - * placeholder of list drag and drop event handle - * - * @private - * @type {TagEventCallback>} - * @memberof GridViewTag - */ - private _ondragndrop; - /** - * Creates an instance of GridViewTag. - * @memberof GridViewTag - */ - constructor(); - /** - * Set drag and drop event handle - * - * @memberof GridViewTag - */ - set ondragndrop(v: TagEventCallback>); - /** - * Setter: Enable/disable drag and drop event in the list - * - * Getter: Check whether the drag and drop event is enabled - * - * @memberof GridViewTag - */ - set dragndrop(v: boolean); - get dragndrop(): boolean; - /** - * placeholder of drag and drop mouse down event handle - * - * @private - * @memberof GridViewTag - */ - private _onmousedown; - /** - * placeholder of drag and drop mouse up event handle - * - * @private - * @memberof GridViewTag - */ - private _onmouseup; - /** - * placeholder of drag and drop mouse move event handle - * - * @private - * @memberof GridViewTag - */ - private _onmousemove; - /** - * Init the grid view before mounting. - * Reset all the placeholders to default values - * - * @protected - * @memberof GridViewTag - */ - protected init(): void; - /** - * This function does nothing - * - * @protected - * @param {*} [d] - * @memberof GridViewTag - */ - protected reload(d?: any): void; - /** - * set the cell select event callback - * - * @memberof GridViewTag - */ - set oncellselect(v: TagEventCallback); - /** - * set the row select event callback - * - * @memberof GridViewTag - */ - set onrowselect(v: TagEventCallback); - /** - * set the cell double click event callback - * - * @memberof GridViewTag - */ - set oncelldbclick(v: TagEventCallback); - /** - * Setter: set the tag name of the header cells - * - * Getter: get the grid header tag name - * - * @memberof GridViewTag - */ - set headeritem(v: string); - get headeritem(): string; - /** - * Setter: set the tag name of the grid cell - * - * Getter: get the tag name of the grid cell - * - * @memberof GridViewTag - */ - set cellitem(v: string); - get cellitem(): string; - /** - * Setter: set the header data - * - * Getter: get the header data placeholder - * - * @type {GenericObject[]} - * @memberof GridViewTag - */ - get header(): GenericObject[]; - set header(v: GenericObject[]); - /** - * Get all the selected rows - * - * @readonly - * @type {GridRowTag[]} - * @memberof GridViewTag - */ - get selectedRows(): GridRowTag[]; - /** - * Get the latest selected row - * - * @readonly - * @type {GridRowTag} - * @memberof GridViewTag - */ - get selectedRow(): GridRowTag; - /** - * Get the current selected cell - * - * @readonly - * @type {GridCellPrototype} - * @memberof GridViewTag - */ - get selectedCell(): GridCellPrototype; - /** - * Setter: set the rows data - * - * Getter: get the rows data - * - * @memberof GridViewTag - */ - set rows(rows: GenericObject[][]); - get rows(): GenericObject[][]; - /** - * Setter: activate deactivate multi-select - * - * Getter: check whether the `multiselect` option is activated - * - * @memberof GridViewTag - */ - set multiselect(v: boolean); - get multiselect(): boolean; - /** - * Set and Get the resizable attribute - * - * This allows to enable/disable column resize feature - * - * @memberof GridViewTag - */ - set resizable(v: boolean); - get resizable(): boolean; - /** - * Sort the grid using a sort function - * - * @param {context: any} context of the executed function - * @param {(a:GenericObject[], b:GenericObject[]) => boolean} a sort function that compares two rows data - * * @param {index: number} current header index - * @returns {void} - * @memberof GridViewTag - */ - sort(context: any, fn: (a: GenericObject[], b: GenericObject[], index?: number) => number): void; - /** - * Delete a grid rows - * - * @param {GridRowTag} row row DOM element - * @returns {void} - * @memberof GridViewTag - */ - delete(row: GridRowTag): void; - /** - * Scroll the grid view to bottom - * - * @memberof GridViewTag - */ - scroll_to_bottom(): void; - /** - * Scroll the grid view to top - * - * @memberof GridViewTag - */ - scroll_to_top(): void; - /** - * Push a row to the grid - * - * @param {GenericObject[]} row list of cell data - * @param {boolean} flag indicates where the row is add to beginning or end - * of the row - * @memberof GridViewTag - */ - push(row: GenericObject[], flag: boolean): void; - /** - * Unshift a row to the grid - * - * @param {GenericObject[]} row list of cell data in the row - * @memberof GridViewTag - */ - unshift(row: GenericObject[]): void; - /** - * This function triggers the cell select event - * - * @private - * @param {TagEventType} e event contains cell event data - * @param {boolean} flag indicates whether the event is double clicked - * @returns {void} - * @memberof GridViewTag - */ - private cellselect; - /** - * This function triggers the row select event, a cell select - * event will also trigger this event - * - * @param {TagEventType} e - * @returns {void} - * @memberof GridViewTag - */ - private rowselect; - /** - * Unselect all the selected rows in the grid - * - * @returns {void} - * @memberof GridViewTag - */ - unselect(): void; - /** - * Check whether the grid has header - * - * @private - * @returns {boolean} - * @memberof GridViewTag - */ - private has_header; - /** - * Calibrate the grid - * - * @protected - * @memberof GridViewTag - */ - protected calibrate(): void; - /** - * Recalculate the size of each header cell, changing - * in header cell size will also resize the entire - * related column - * - * @private - * @returns {void} - * @memberof GridViewTag - */ - private calibrate_header; - /** - * Mount the grid view tag - * - * @protected - * @returns {void} - * @memberof GridViewTag - */ - protected mount(): void; - /** - * Layout definition of the grid view - * - * @protected - * @returns {TagLayoutType[]} - * @memberof GridViewTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A system panel contains the following elements: - * - Spotlight to access to applications menu - * - Current focused application menu - * - System tray for all running services running in background - * - * @export - * @class SystemPanelTag - * @extends {AFXTag} - */ - class SystemPanelTag extends AFXTag { - /** - * Reference to spotlight data - * - * @private - * @type {(GenericObject)} - * @memberof SystemPanelTag - */ - private _osmenu; - /** - * Placeholder indicates whether the spotlight is currently shown - * - * @private - * @type {boolean} - * @memberof SystemPanelTag - */ - private _view; - /** - * Store pending loading task - * - * @private - * @type {number[]} - * @memberof SystemPanelTag - */ - private _pending_task; - /** - * Flag indicate where the selected application shall be openned - * - * @private - * @type {boolean} - * @memberof SystemPanelTag - */ - private _prevent_open; - /** - * Store the current attached service - * - * @private - * @type {number[]} - * @memberof SystemPanelTag - */ - private _services; - /** - * Loading animation check timeout - * - * @memberof SystemPanelTag - */ - private _loading_toh; - /** - * Place holder for a private callback function - * - * @private - * @memberof SystemPanelTag - */ - private _cb; - /** - * Place holder for system app list - * - * @private - * @type {GenericObject[]} - * @memberof SystemPanelTag - */ - private app_list; - /** - *Creates an instance of SystemPanelTag. - * @memberof SystemPanelTag - */ - constructor(); - /** - * Do nothing - * - * @protected - * @memberof SystemPanelTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof SystemPanelTag - */ - protected reload(d?: any): void; - /** - * Attach a service to the system tray on the pannel, - * this operation is performed when a service is started - * - * @param {BaseService} s - * @returns - * @memberof SystemPanelTag - */ - attachservice(s: application.BaseService): void; - /** - * Launch the selected application from the spotlight - * applications list - * - * @private - * @returns {void} - * @memberof SystemPanelTag - */ - private open; - /** - * Perform spotlight search operation on keyboard event - * - * @private - * @param {JQuery.KeyboardEventBase} e - * @returns {void} - * @memberof SystemPanelTag - */ - private search; - /** - * detach a service from the system tray of the panel. - * This function is called when the corresponding running - * service is killed - * - * @param {BaseService} s - * @memberof SystemPanelTag - */ - detachservice(s: application.BaseService): void; - /** - * Layout definition of the panel - * - * @protected - * @returns {TagLayoutType[]} - * @memberof SystemPanelTag - */ - protected layout(): TagLayoutType[]; - /** - * Refresh applications list on the spotlight widget - * from system packages meta-data - * - * @private - * @memberof SystemPanelTag - */ - private refreshAppList; - /** - * Show/hide the spotlight - * - * @private - * @param {boolean} flag - * @memberof SystemPanelTag - */ - private toggle; - /** - * Calibrate the spotlight widget - * - * @memberof SystemPanelTag - */ - calibrate(): void; - /** - * Check if the loading tasks ended, - * if it the case, stop the animation - * - * @private - * @memberof SystemPanelTag - */ - private animation_check; - private show_systray; - /** - * Mount the tag bind some basic event - * - * @protected - * @memberof SystemPanelTag - */ - protected mount(): void; - } - } - } -} -/// -declare namespace OS { - namespace GUI { - namespace tag { - /** - * This tag define a basic button and its behavior - * - * @export - * @class ButtonTag - * @extends {AFXTag} - */ - class ButtonTag extends AFXTag { - /** - * Variable hold the button click callback handle - * - * @private - * @type {TagEventCallback} - * @memberof ButtonTag - */ - private _onbtclick; - /** - * Custom user data - * - * @type {any} - * @memberof ButtonTag - */ - private _data; - /** - * Custom user data setter/gettter - * - * @memberof ButtonTag - */ - set data(v: any); - get data(): any; - /** - *Creates an instance of ButtonTag. - * @memberof ButtonTag - */ - constructor(); - /** - * Set the click callback handle for the target button - * - * @memberof ButtonTag - */ - set onbtclick(v: TagEventCallback); - /** - * Set the path to the button icon, the path should be - * a VFS file path - * - * @memberof ButtonTag - */ - set icon(v: string); - /** - * Set the icon class to the button, this property - * allows to style the button icon using CSS - * - * @memberof ButtonTag - */ - set iconclass(v: string); - /** - * Set the icon class on the right side of the button, this property - * allows to style the button icon using CSS - * - * @memberof ButtonTag - */ - set iconclass$(v: string); - /** - * Set the CSS class of the label icon on the right side - * - * @memberof ButtonTag - */ - set iconclass_end(v: string); - /** - * Setter: Set the text of the button - * - * Getter: Get the current button test - * - * @memberof ButtonTag - */ - set text(v: string | FormattedString); - get text(): string | FormattedString; - /** - * Setter: Enable or disable the button - * - * Getter: Get the `enable` property of the button - * - * @memberof ButtonTag - */ - set enable(v: boolean); - get enable(): boolean; - /** - * Setter: set or remove the attribute `selected` of the button - * - * Getter: check whether the attribute `selected` of the button is set - * - * @memberof ButtonTag - */ - set selected(v: boolean); - get selected(): boolean; - /** - * Setter: activate or deactivate the toggle mode of the button - * - * Getter: Check whether the button is in toggle mode - * - * @memberof ButtonTag - */ - set toggle(v: boolean); - get toggle(): boolean; - /** - * Mount the tag - * - * @protected - * @memberof ButtonTag - */ - protected mount(): void; - /** - * Init the tag before mounting - * - * @protected - * @memberof ButtonTag - */ - protected init(): void; - /** - * Re-calibrate the button, do nothing in this tag - * - * @protected - * @memberof ButtonTag - */ - protected calibrate(): void; - /** - * Update the current tag, do nothing in this tag - * - * @param {*} [d] - * @memberof ButtonTag - */ - reload(d?: any): void; - /** - * Button layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof ButtonTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A tile layout organize it child elements - * in a fixed horizontal or vertical direction. - * - * The size of each child element is attributed based - * on its configuration of automatically based on the - * remaining space in the layout - * - * - * @export - * @class TileLayoutTag - * @extends {AFXTag} - */ - class TileLayoutTag extends AFXTag { - /** - *C reates an instance of TileLayoutTag. - * @memberof TileLayoutTag - */ - constructor(); - private _padding; - /** - * Do nothing - * - * @protected - * @memberof TileLayoutTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof TileLayoutTag - */ - protected reload(d?: any): void; - /** - * Setter: Set the name of the tile container, should be: `hbox` or `vbox` - * - * Getter: Get the name of the tile container - * - * @memberof TileLayoutTag - */ - set name(v: string); - get name(): string; - /** - * Setter: - * - * SET the layout direction, should be: - * - `row`: horizontal direction - * - `column`: vertical direction - * - * Getter: - * - * Get layout direction - * - * @memberof TileLayoutTag - */ - set dir(v: "row" | "column"); - get dir(): "row" | "column"; - /** - * Setter: - * - * SET content padding - * - * Getter: - * - * Get content padding - * - * @memberof TileLayoutTag - */ - set padding(v: number); - get padding(): number; - /** - * Mount the element - * - * @protected - * @returns {void} - * @memberof TileLayoutTag - */ - protected mount(): void; - /** - * re-organize the layout - * - * @returns {void} - * @memberof TileLayoutTag - */ - calibrate(): void; - /** - * Organize the layout in horizontal direction, only work when - * the layout direction set to horizontal - * - * @private - * @returns {void} - * @memberof TileLayoutTag - */ - private hcalibrate; - /** - * Organize the layout in vertical direction, only work when - * the layout direction set to vertical - * - * @private - * @returns {void} - * @memberof TileLayoutTag - */ - private vcalibrate; - /** - * Layout definition - * - * @returns - * @memberof TileLayoutTag - */ - layout(): { - el: string; - ref: string; - }[]; - } - /** - * A HBox organize its child elements in horizontal direction - * - * @export - * @class HBoxTag - * @extends {TileLayoutTag} - */ - class HBoxTag extends TileLayoutTag { - /** - * Creates an instance of HBoxTag. - * @memberof HBoxTag - */ - constructor(); - /** - * Mount the tag - * - * @protected - * @memberof HBoxTag - */ - protected mount(): void; - } - /** - * A VBox organize its child elements in vertical direction - * - * @export - * @class VBoxTag - * @extends {TileLayoutTag} - */ - class VBoxTag extends TileLayoutTag { - /** - *Creates an instance of VBoxTag. - * @memberof VBoxTag - */ - constructor(); - /** - * Mount the tag - * - * @protected - * @memberof VBoxTag - */ - protected mount(): void; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Tree view data type definition - * - * @export - * @interface TreeViewDataType - */ - interface TreeViewDataType { - /** - * The child nodes data of the current tree node - * - * @type {TreeViewDataType[]} - * @memberof TreeViewDataType - */ - nodes?: TreeViewDataType[]; - /** - * Boolean indicates whether the current node is opened. - * Only work when the current node is not a leaf node - * - * @type {boolean} - * @memberof TreeViewDataType - */ - open?: boolean; - /** - * The node's path from the root node - * - * @type {string} - * @memberof TreeViewDataType - */ - path?: string; - /** - * Indicates whether this node should be selected - * - * @type {boolean} - * @memberof TreeViewDataType - */ - selected?: boolean; - [propName: string]: any; - } - /** - * Tree node event data type definition - */ - type TreeItemEventData = TagEventDataType; - /** - * Abstract prototype of a tree node. All tree node definition should - * extend this class - * - * @class TreeViewItemPrototype - * @extends {AFXTag} - */ - abstract class TreeViewItemPrototype extends AFXTag { - /** - * Node data placeholder - * - * @private - * @type {TreeViewDataType} - * @memberof TreeViewItemPrototype - */ - private _data; - /** - * Placeholder for the indent level of the current node from root node - * - * @private - * @type {number} - * @memberof TreeViewItemPrototype - */ - private _indent; - /** - * private event object used by current node event - * - * @private - * @type {TagEventType} - * @memberof TreeViewItemPrototype - */ - private _evt; - /** - * Reference to the root node - * - * @type {TreeViewTag} - * @memberof TreeViewItemPrototype - */ - treeroot: TreeViewTag; - /** - * The tree path from the root node - * - * @type {string} - * @memberof TreeViewItemPrototype - */ - treepath: string; - /** - * Reference to the parent node of the current node - * - * @type {TreeViewTag} - * @memberof TreeViewItemPrototype - */ - parent: TreeViewTag; - /** - * Placeholder for the `fetch` function of the node. - * This function is used to fetch the child nodes of the - * current nodes. This function should return a promise on - * a list of [[TreeViewDataType]] - * - * @memberof TreeViewItemPrototype - */ - fetch: (d: TreeViewItemPrototype) => Promise; - /** - *Creates an instance of TreeViewItemPrototype. - * @memberof TreeViewItemPrototype - */ - constructor(); - /** - * Update the tree, this function - * is used to refresh/expand/collapse the - * current node based on the input parameter - * - * @protected - * @param {*} p string indication, the value should be: - * - `expand`: expand the current node - * - `collapse`: collapse the current node - * - other string: this string is considered as a tree path of a node. If this value - * is the value of current node tree path, the node will be refreshed. Otherwise, nothing - * happens - * @returns {void} - * @memberof TreeViewItemPrototype - */ - protected reload(p: any): void; - /** - * Setter: - * - * Set the data of the current node. This will trigger the - * [[ondatachange]] function - * - * Getter: - * - * Get the current node's data - * - * @memberof TreeViewItemPrototype - */ - set data(v: TreeViewDataType); - get data(): TreeViewDataType; - /** - * Setter: - * - * Select or unselect the current node. - * This will trigger the item select event - * on the tree root if the parameter is `true` - * - * Getter: - * - * Check whether the current node is selected - * - * @memberof TreeViewItemPrototype - */ - set selected(v: boolean); - get selected(): boolean; - /** - * Setter: - * - * Refresh the current node and expands its sub tree. - * This function only works if the current node is not - * a leaf node - * - * Getter: - * - * Check whether the current node is expanded - * - * @memberof TreeViewItemPrototype - */ - set open(v: boolean); - get open(): boolean; - /** - * Setter: Set the current indent level of this node from the root node - * - * Getter: Get the current indent level - * - * @type {number} - * @memberof TreeViewItemPrototype - */ - get indent(): number; - set indent(v: number); - /** - * Check whether the current node is not a leaf node - * - * @private - * @returns {boolean} - * @memberof TreeViewItemPrototype - */ - private is_folder; - /** - * Getter: Get the child nodes data of the current node - * - * Setter: Set the child nodes data of the current node - * - * @type {TreeViewDataType[]} - * @memberof TreeViewItemPrototype - */ - get nodes(): TreeViewDataType[]; - set nodes(nodes: TreeViewDataType[]); - /** - * Init the tag with default properties data - * - * @protected - * @memberof TreeViewItemPrototype - */ - protected init(): void; - /** - * Mount the tag and bind basic events - * - * @protected - * @memberof TreeViewItemPrototype - */ - protected mount(): void; - /** - * Layout definition of a node. This function - * returns the definition of the base outer layout - * of a node. Custom inner layout of the node should - * be defined in the [[itemlayout]] function - * - * @protected - * @returns {TagLayoutType[]} - * @memberof TreeViewItemPrototype - */ - protected layout(): TagLayoutType[]; - /** - * This function need to be implemented by all subclasses - * to define the inner layout of the node - * - * @protected - * @abstract - * @returns {TagLayoutType[]} - * @memberof TreeViewItemPrototype - */ - protected abstract itemlayout(): TagLayoutType[]; - /** - * This function is called when the node data change. - * It needs to be implemented on all subclasses of this - * class - * - * @protected - * @abstract - * @memberof TreeViewItemPrototype - */ - protected abstract ondatachange(): void; - } - /** - * SimpleTreeViewItem extends [[TreeViewItemPrototype]] and - * define it inner layout using a [[LabelTag]] - * - * @export - * @class SimpleTreeViewItem - * @extends {TreeViewItemPrototype} - */ - class SimpleTreeViewItem extends TreeViewItemPrototype { - /** - *Creates an instance of SimpleTreeViewItem. - * @memberof SimpleTreeViewItem - */ - constructor(); - /** - * Refresh the label when data changed - * - * @protected - * @returns {void} - * @memberof SimpleTreeViewItem - */ - protected ondatachange(): void; - /** - * Inner layout definition - * - * @protected - * @returns - * @memberof SimpleTreeViewItem - */ - protected itemlayout(): { - el: string; - ref: string; - }[]; - } - /** - * A tree view widget presents a hierarchical list of nodes. - * - * @export - * @class TreeViewTag - * @extends {AFXTag} - */ - class TreeViewTag extends AFXTag { - /** - * Reference to the selected node - * - * @private - * @type {TreeViewItemPrototype} - * @memberof TreeViewTag - */ - private _selectedItem; - /** - * Placeholder for tree select event handle - * - * @private - * @type {TagEventCallback} - * @memberof TreeViewTag - */ - private _ontreeselect; - /** - * Place holder for tree double click event handle - * - * @private - * @type {TagEventCallback} - * @memberof TreeViewTag - */ - private _ontreedbclick; - /** - * Placeholder for drag and drop event handle - * - * @private - * @type {TagEventCallback>} - * @memberof TreeViewTag - */ - private _ondragndrop; - /** - * Tree data placeholder - * - * @private - * @type {TreeViewDataType} - * @memberof TreeViewTag - */ - private _data; - /** - * Placeholder for private dragndrop mouse down event handle - * - * @private - * @memberof TreeViewTag - */ - private _treemousedown; - /** - * Placeholder for private dragndrop mouse up event handle - * - * @private - * @memberof TreeViewTag - */ - private _treemouseup; - /** - * Placeholder for private dragndrop mouse move event handle - * - * @private - * @memberof TreeViewTag - */ - private _treemousemove; - /** - * Private data object passing between dragndrop mouse event - * - * @private - * @type {{ from: TreeViewTag[]; to: TreeViewTag }} - * @memberof TreeViewTag - */ - private _dnd; - /** - * Reference to parent tree of the current tree. - * This value is undefined if the current tree is the root - * - * @type {TreeViewTag} - * @memberof TreeViewTag - */ - parent: TreeViewTag; - /** - * Reference to the root tree, this value is undefined - * if the curent tree is root - * - * @type {TreeViewTag} - * @memberof TreeViewTag - */ - treeroot: TreeViewTag; - /** - * tree path of the current tree from the root - * - * @type {string} - * @memberof TreeViewTag - */ - treepath: string; - /** - * Indent level of the current tree - * - * @type {number} - * @memberof TreeViewTag - */ - indent: number; - /** - * Indicates whether the tree should be expanded - * - * @type {boolean} - * @memberof TreeViewTag - */ - open: boolean; - /** - * Placeholder for the `fetch` function of the tree. - * This function is used to fetch the child nodes of the - * current tree. This function should return a promise on - * a list of [[TreeViewDataType]] - * - * @memberof TreeViewTag - */ - fetch: (d: TreeViewItemPrototype) => Promise; - /** - *Creates an instance of TreeViewTag. - * @memberof TreeViewTag - */ - constructor(); - /** - * Init the tree view before mounting: - * - * @protected - * @memberof TreeViewTag - */ - protected init(): void; - /** - * Layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof TreeViewTag - */ - protected layout(): TagLayoutType[]; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof TreeViewTag - */ - protected reload(d?: any): void; - /** - * Setter: Enable/disable drag and drop event on the tree - * - * Getter: Check whether the drag and drop event is enabled - * - * @memberof TreeViewTag - */ - set dragndrop(v: boolean); - get dragndrop(): boolean; - /** - * Set the tree select event handle - * - * @memberof TreeViewTag - */ - set ontreeselect(v: TagEventCallback); - /** - * Set the tree double click event handle - * - * @memberof TreeViewTag - */ - set ontreedbclick(v: TagEventCallback); - /** - * Setter: - * - * Set the default tag name of the tree node. - * If there is no tag name in the node data, - * this value will be used when creating node. - * - * Defaut to `afx-tree-view-item` - * - * Getter: - * - * Get the default node tag name - * - * @memberof TreeViewTag - */ - set itemtag(v: string); - get itemtag(): string; - /** - * Unselect the selected element in the tree - * - * @memberof TreeViewTag - */ - unselect(): void; - /** - * Setter: Set the selected node using its DOM element - * - * Getter: Get the DOM element of the selected node - * - * @type {TreeViewItemPrototype} - * @memberof TreeViewTag - */ - get selectedItem(): TreeViewItemPrototype; - set selectedItem(v: TreeViewItemPrototype); - /** - * Expand all nodes in the tree - * - * @returns {void} - * @memberof TreeViewTag - */ - expandAll(): void; - /** - * Collapse all nodes in the tree - * - * @returns {void} - * @memberof TreeViewTag - */ - collapseAll(): void; - /** - * This function will trigger the tree select or tree double click - * event - * - * @param {TagEventType} e - * @returns {void} - * @memberof TreeViewTag - */ - itemclick(e: TagEventType): void; - /** - * Check whether the current tree is a root tree - * - * @returns {boolean} - * @memberof TreeViewTag - */ - is_root(): boolean; - /** - * Check whether the current tree tag is a leaf - * - * @returns {boolean} - * @memberof TreeViewTag - */ - is_leaf(): boolean; - /** - * Set drag and drop event handle - * - * @memberof TreeViewTag - */ - set ondragndrop(v: TagEventCallback>); - /** - * Setter: - * - * Set the tree data. This operation will create - * all tree node elements of the current tree - * - * Getter: - * - * Get the tree data - * - * @memberof TreeViewTag - */ - set data(v: TreeViewDataType); - get data(): TreeViewDataType; - /** - * Mount the tree view - * - * @protected - * @memberof TreeViewTag - */ - protected mount(): void; - } - } - } -} -/// -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Menu event data interface definition - */ - type MenuEventData = TagEventDataType; - /** - * This class defines the abstract prototype of an menu entry. - * Any implementation of menu entry tag should extend this class - * - * @export - * @abstract - * @class MenuEntryTag - * @extends {AFXTag} - */ - abstract class MenuEntryTag extends AFXTag { - /** - * Data placeholder of the menu entry - * - * @private - * @type {GenericObject} - * @memberof MenuEntryTag - */ - private _data; - /** - * placeholder of `menu entry select` event handle - * - * @private - * @type {TagEventCallback} - * @memberof MenuEntryTag - */ - private _onmenuselect; - /** - * placeholder of `sub-menu entry select event` handle - * - * @private - * @type {TagEventCallback} - * @memberof MenuEntryTag - */ - private _onchildselect; - /** - * Reference to the parent menu entry of current one - * - * @type {MenuEntryTag} - * @memberof MenuEntryTag - */ - parent: MenuEntryTag; - /** - * Reference to the root menu entry - * - * @type {MenuTag} - * @memberof MenuEntryTag - */ - root: MenuTag; - /** - *Creates an instance of MenuEntryTag. - * @memberof MenuEntryTag - */ - constructor(); - /** - * Init the tag before mounting - * - * @protected - * @memberof MenuEntryTag - */ - protected init(): void; - /** - * Set the `menu entry select` event handle - * - * @memberof MenuEntryTag - */ - set onmenuselect(v: TagEventCallback); - /** - * Setter: Set the `sub menu entry select` event handle - * - * Getter: get the current `sub menu entry select` event handle - * - * @memberof MenuEntryTag - */ - set onchildselect(v: TagEventCallback); - get onchildselect(): TagEventCallback; - /** - * Setter: Set data to the entry - * - * Getter: Get data of the current menu entry - * - * @memberof MenuEntryTag - */ - set data(data: GenericObject); - get data(): GenericObject; - /** - * Check whether the current menu entry has sub-menu - * - * @protected - * @returns {boolean} - * @memberof MenuEntryTag - */ - protected has_nodes(): boolean; - /** - * Check whether the current menu entry is the root entry - * - * @protected - * @returns - * @memberof MenuEntryTag - */ - protected is_root(): boolean; - /** - * Layout definition of the menu entry - * This function define the outer layout of the menu entry. - * Custom inner layout of each item implementation should - * be defined in [[itemlayout]] - * @protected - * @returns {TagLayoutType[]} - * @memberof MenuEntryTag - */ - protected layout(): TagLayoutType[]; - /** - * Setter: Set the sub-menu data - * - * Getter: Get the sub-menu data - * - * @memberof MenuEntryTag - */ - set nodes(v: GenericObject[]); - get nodes(): GenericObject[]; - /** - * Bind some base event to the menu entry - * - * @protected - * @memberof MenuEntryTag - */ - protected mount(): void; - /** - * Hide the sub-menu of the current menu entry - * - * @private - * @returns {void} - * @memberof MenuEntryTag - */ - private submenuoff; - /** - * This function trigger two event: - * - the `onmenuselect` event on the current entry - * - the `onchildselect` event on the parent of the current entry - * - * @protected - * @param {JQuery.ClickEvent} e - * @memberof MenuEntryTag - */ - protected select(e: JQuery.ClickEvent): void; - /** - * custom inner layout of a menu entry - * - * @protected - * @abstract - * @returns {TagLayoutType[]} - * @memberof MenuEntryTag - */ - protected abstract itemlayout(): TagLayoutType[]; - } - /** - * This class extends the [[MenuEntryTag]] prototype. It inner layout is - * defined with the following elements: - * - a [[SwitchTag]] acts as checker or radio - * - a [[LabelTag]] to display the content of the menu entry - * - a `span` element that display the keyboard shortcut of the entry - * - * @class SimpleMenuEntryTag - * @extends {MenuEntryTag} - */ - class SimpleMenuEntryTag extends MenuEntryTag { - /** - *Creates an instance of SimpleMenuEntryTag. - * @memberof SimpleMenuEntryTag - */ - constructor(); - /** - * Reset some properties to default value - * - * @protected - * @memberof SimpleMenuEntryTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @memberof SimpleMenuEntryTag - */ - protected calibrate(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof SimpleMenuEntryTag - */ - protected reload(d?: any): void; - /** - * Setter: Turn on/off the checker feature of the menu entry - * - * Getter: Check whether the checker feature is enabled on this menu entry - * - * @memberof SimpleMenuEntryTag - */ - set switch(v: boolean); - get switch(): boolean; - /** - * Setter: Turn on/off the radio feature of the menu entry - * - * Getter: Check whether the radio feature is enabled - * - * @memberof SimpleMenuEntryTag - */ - set radio(v: boolean); - get radio(): boolean; - /** - * Setter: - * - * Toggle the switch on the menu entry, this setter - * only works when the `checker` or `radio` feature is - * enabled - * - * Getter: - * - * Check whether the switch is turned on - * - * @memberof SimpleMenuEntryTag - */ - set checked(v: boolean); - get checked(): boolean; - /** - * Set the label icon using a VFS path - * - * @memberof SimpleMenuEntryTag - */ - set icon(v: string); - /** - * Set the label CSS icon class - * - * @memberof SimpleMenuEntryTag - */ - set iconclass(v: string); - /** - * Set the label text - * - * @memberof SimpleMenuEntryTag - */ - set text(v: string); - /** - * Set the keyboard shortcut text - * - * @memberof SimpleMenuEntryTag - */ - set shortcut(v: string); - /** - * Uncheck all sub-menu items of the current menu entry - * that have the radio feature enabled - * - * @returns {void} - * @memberof SimpleMenuEntryTag - */ - protected reset_radio(): void; - /** - * Mount the current tag - * - * @protected - * @memberof SimpleMenuEntryTag - */ - protected mount(): void; - /** - * Trigger the onmenuselect and onchildselect events - * - * @protected - * @param {JQuery.ClickEvent} e Mouse click event - * @returns {void} - * @memberof SimpleMenuEntryTag - */ - protected select(e: JQuery.ClickEvent): void; - /** - * Inner item layout of the menu entry - * - * @returns - * @memberof SimpleMenuEntryTag - */ - itemlayout(): ({ - el: string; - ref: string; - class?: undefined; - } | { - el: string; - class: string; - ref: string; - })[]; - } - /** - * A menu tag contains a collection of menu entries in which each - * entry maybe a leaf entry or may contain a submenu - * - * @export - * @class MenuTag - * @extends {AFXTag} - */ - class MenuTag extends AFXTag { - /** - * Reference to the parent menu entry of the current value. - * This value is `undefined` in case of the current menu is - * the root menu - * - * @type {MenuEntryTag} - * @memberof MenuTag - */ - parent: MenuEntryTag; - /** - * Reference to the root menu - * - * @type {MenuTag} - * @memberof MenuTag - */ - root: MenuTag; - /** - * The `pid` of the application that attached to this menu. - * This value is optional - * - * @type {number} - * @memberof MenuTag - */ - pid?: number; - /** - * placeholder for menu select event handle - * - * @private - * @type {TagEventCallback} - * @memberof MenuTag - */ - private _onmenuselect; - /** - * Menu data placeholder - * - * @private - * @type {GenericObject[]} - * @memberof MenuTag - */ - private _items; - /** - *Creates an instance of MenuTag. - * @memberof MenuTag - */ - constructor(); - /** - * Reset some properties to default value - * - * @protected - * @memberof MenuTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @memberof MenuTag - */ - protected calibrate(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof MenuTag - */ - protected reload(d?: any): void; - /** - * Setter: Set the menu items data - * - * Getter: Get menu items data - * - * @memberof MenuTag - */ - set items(data: GenericObject[]); - get items(): GenericObject[]; - /** - * Setter: Set whether the current menu is a context menu - * - * Getter: Check whether the current menu is a context menu - * - * @memberof MenuTag - */ - set context(v: boolean); - get context(): boolean; - /** - * Set menu select event handle - * - * @memberof MenuTag - */ - set onmenuselect(v: TagEventCallback); - /** - * Setter: - * - * Set the default tag name of the menu item. - * If the tag is not specified in an item data, - * this value will be used - * - * Getter: - * - * Get the default menu entry tag name - * - * @memberof MenuTag - */ - set contentag(v: string); - get contentag(): string; - /** - * Get the reference to the function that triggers - * the menu select event - * - * @readonly - * @type {TagEventCallback} - * @memberof MenuTag - */ - get onmenuitemselect(): TagEventCallback; - /** - * This function triggers the menu select event - * - * @private - * @param {TagEventType} e - * @memberof MenuTag - */ - private handleselect; - /** - * Show the current menu. This function is called - * only if the current menu is a context menu - * - * @param {JQuery.MouseEventBase} e JQuery mouse event - * @returns {void} - * @memberof MenuTag - */ - show(e: JQuery.MouseEventBase): void; - /** - * Test whether the current menu is the root menu - * - * @private - * @returns {boolean} - * @memberof MenuTag - */ - private is_root; - /** - * Mount the menu tag and bind some basic events - * - * @protected - * @returns {void} - * @memberof MenuTag - */ - protected mount(): void; - /** - * Add a menu entry to the beginning of the current - * menu - * - * @param {GenericObject} item menu entry data - * @memberof MenuTag - */ - unshift(item: GenericObject): void; - /** - * Delete a menu entry - * - * @param {MenuEntryTag} item reference to the DOM element of an menu entry - * @memberof MenuTag - */ - delete(item: MenuEntryTag): void; - /** - * Add an menu entry to the beginning or end of the menu - * - * @param {GenericObject} item menu entry data - * @param {boolean} flag indicates whether the entry should be added to the beginning of the menu - * @returns {MenuEntryTag} - * @memberof MenuTag - */ - push(item: GenericObject, flag: boolean): MenuEntryTag; - /** - * Menu tag layout definition - * - * @returns - * @memberof MenuTag - */ - layout(): { - el: string; - ref: string; - children: ({ - el: string; - class: string; - ref?: undefined; - } | { - el: string; - ref: string; - class?: undefined; - })[]; - }[]; - } - } - } -} -/// -declare namespace OS { - namespace GUI { - namespace tag { - /** - * menu event data type definition - */ - type StackMenuEventData = TagEventDataType; - /** - * The layout of a simple stack menu item - * - * @export - * @class SimpleStackMenuItemTag - * @extends {ListViewItemTag} - */ - class SimpleStackMenuItemTag extends ListViewItemTag { - /** - *Creates an instance of SimpleStackMenuItemTag. - * @memberof SimpleStackMenuItemTag - */ - constructor(); - /** - * Reset some property to default - * - * @protected - * @memberof SimpleStackMenuItemTag - */ - protected init(): void; - /** - * Mount the current tag - * - * @protected - * @memberof SimpleStackMenuItemTag - */ - protected mount(): void; - /** - * Setter: Turn on/off the checker feature of the menu entry - * - * Getter: Check whether the checker feature is enabled on this menu entry - * - * @memberof SimpleStackMenuItemTag - */ - set switch(v: boolean); - get switch(): boolean; - /** - * Setter: select/unselect the current item - * - * Getter: Check whether the current item is selected - * - * @memberof SimpleStackMenuItemTag - */ - set selected(v: boolean); - get selected(): boolean; - /** - * Setter: Turn on/off the radio feature of the menu entry - * - * Getter: Check whether the radio feature is enabled - * - * @memberof SimpleStackMenuItemTag - */ - set radio(v: boolean); - get radio(): boolean; - /** - * Setter: - * - * Toggle the switch on the menu entry, this setter - * only works when the `checker` or `radio` feature is - * enabled - * - * Getter: - * - * Check whether the switch is turned on - * - * @memberof SimpleStackMenuItemTag - */ - set checked(v: boolean); - get checked(): boolean; - /** - * Set the keyboard shortcut text - * - * @memberof SimpleStackMenuItemTag - */ - set shortcut(v: string); - /** - * Do nothing - * - * @protected - * @memberof SimpleStackMenuItemTag - */ - protected calibrate(): void; - /** - * Refresh the inner label when the item data - * is changed - * - * @protected - * @returns {void} - * @memberof SimpleStackMenuItemTag - */ - protected ondatachange(): void; - /** - * Re-render the list item - * - * @protected - * @memberof SimpleStackMenuItemTag - */ - protected reload(): void; - /** - * List item custom layout definition - * - * @protected - * @returns {TagLayoutType} - * @memberof SimpleStackMenuItemTag - */ - protected itemlayout(): TagLayoutType; - } - /** - * A stack menu is a multilevel menu that - * uses a single list view to navigate all menu levels - * instead of using a traditional cascade style menu - * - * @export - * @class StackMenuTag - * @extends {AFXTag} - */ - class StackMenuTag extends AFXTag { - /** - * Data stack, the list always displays the - * element on the top of the stack - * - * @type {GenericObject[][]} - * @memberof StackMenuTag - */ - private stack; - /** - * Update the current tag, do nothing - * - * @protected - * @param {*} [d] - * @memberof StackMenuTag - */ - protected reload(d?: any): void; - /** - * Placeholder of tab select event handle - * - * @private - * @type {TagEventCallback} - * @memberof StackMenuTag - */ - private _onmenuselect; - /** - * Stack menu constructor - * - * @memberof StackMenuTag - */ - constructor(); - /** - * Reset to default some property value - * - * @protected - * @memberof StackMenuTag - */ - protected init(): void; - /** - * Recalcutate the menu coordinate in case of - * context menu - * - * @protected - * @memberof StackMenuTag - */ - protected calibrate(): void; - /** - * Reset the menu to its initial state - * - * @memberof StackMenuTag - */ - reset(): void; - /** - * Mount the menu and bind some basic events - * - * @protected - * @memberof StackMenuTag - */ - protected mount(): void; - /** - * Setter: set current selected item index - * - * Getter: Get current selected item index - * - * @memberof StackMenuTag - */ - set selected(i: number | number[]); - get selected(): number | number[]; - /** - * Setter: Set whether the current menu is a context menu - * - * Getter: Check whether the current menu is a context menu - * - * @memberof StackMenuTag - */ - set context(v: boolean); - get context(): boolean; - /** - * Get the latest selected item - * - * @readonly - * @type {ListViewItemTag} - * @memberof StackMenuTag - */ - get selectedItem(): ListViewItemTag; - /** - * Get all the selected items - * - * @readonly - * @type {ListViewItemTag[]} - * @memberof StackMenuTag - */ - get selectedItems(): ListViewItemTag[]; - /** - * The following setter/getter are keep for backward compatible - * with the MenuTag interface - * - * Setter: Set the menu data - * - * Getter: Get the menu data - * - * @deprecated - * @memberof StackMenuTag - */ - set items(v: GenericObject[]); - get items(): GenericObject[]; - /** - * Setter: Set the menu data - * - * Getter: Get the menu data - * - * @memberof StackMenuTag - */ - set nodes(v: GenericObject[]); - get nodes(): GenericObject[]; - /** - * Set the `menu entry select` event handle - * - * @memberof StackMenuTag - */ - set onmenuselect(v: TagEventCallback); - /** - * Hide the current menu. This function is called - * only if the current menu is context menu - * - * @memberof StackMenuTag - */ - hide(): void; - /** - * Show the current menu. This function is called - * only if the current menu is a context menu - * - * @param {JQuery.MouseEventBase} e JQuery mouse event - * @returns {void} - * @memberof StackMenuTag - */ - show(e?: JQuery.MouseEventBase): void; - /** - * Tag layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof StackMenuTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A slider or track bar is a graphical control element with which - * a user may set a value by moving an indicator, usually horizontally - * - * @class SliderTag - * @extends {AFXTag} - */ - class SliderTag extends AFXTag { - /** - * Slider max value placeholder - * - * @private - * @type {number} - * @memberof SliderTag - */ - private _max; - /** - * Current slider value placeholder - * - * @private - * @type {number} - * @memberof SliderTag - */ - private _value; - /** - * Placeholder of the on change event handle - * - * @private - * @type {TagEventCallback} - * @memberof SliderTag - */ - private _onchange; - /** - * Placeholder of the on changing event handle - * - * @private - * @type {TagEventCallback} - * @memberof SliderTag - */ - private _onchanging; - /** - * Creates an instance of SliderTag. - * @memberof SliderTag - */ - constructor(); - /** - * Init the default value of the slider: - * - `max`: 100 - * - `value`: 0 - * - * @protected - * @memberof SliderTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof SliderTag - */ - protected reload(d?: any): void; - /** - * Set value change event handle. - * This handle will be triggered when the - * slider indicator is released - * - * @memberof SliderTag - */ - set onvaluechange(f: TagEventCallback); - /** - * Set value changing event handle. - * This handle is triggered when moving the - * slider indicator - * - * @memberof SliderTag - */ - set onvaluechanging(f: TagEventCallback); - /** - * Setter/Getter: set and get precision reading - * - * @memberof SliderTag - */ - set precision(v: boolean); - get precision(): boolean; - /** - * Setter: Enable/disable the slider - * - * Getter: Check whether the slider is enabled - * - * @memberof SliderTag - */ - set enable(v: boolean); - get enable(): boolean; - /** - * Setter: Set the slider value - * - * Getter: Get the current slider value - * - * @memberof SliderTag - */ - set value(v: number); - get value(): number; - /** - * Setter: Set the maximum value of the slider - * - * Getter: Get the maximum value of the slider - * - * @memberof SliderTag - */ - set max(v: number); - get max(): number; - /** - * Mount the tag and bind some basic events - * - * @protected - * @memberof SliderTag - */ - protected mount(): void; - /** - * Calibrate the slide based on its value and max value - * - * @memberof SliderTag - */ - calibrate(): void; - /** - * enable dragging on the slider indicator - * - * @private - * @memberof SliderTag - */ - private enable_dragging; - /** - * Layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof SliderTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * An overlay tag is a layout tag that alway stay on top of - * the virtual desktop environment. Tile layout elements ([[VBoxTag]], [[HboxTag]]) - * can be used inside this tag to compose elements - * - * @export - * @class OverlayTag - * @extends {AFXTag} - */ - class OverlayTag extends AFXTag { - /** - * Tag width placeholder - * - * @private - * @type {string} - * @memberof OverlayTag - */ - private _width; - /** - * Tag height place holder - * - * @private - * @type {string} - * @memberof OverlayTag - */ - private _height; - /** - *Creates an instance of OverlayTag. - * @memberof OverlayTag - */ - constructor(); - /** - * Put the tag on top of the virtual desktop environment - * - * @protected - * @memberof OverlayTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof OverlayTag - */ - protected reload(d?: any): void; - /** - * Setter: - * - * Set the width of the tag, the tag width should be in form of: - * `100px` of `80%` - * - * Getter: - * - * Get the tag width - * - * @memberof OverlayTag - */ - set width(v: string); - get width(): string; - /** - * Setter: - * - * Set the tag height, the tag height should be in form of: - * `100px` of `80%` - * - * Getter: - * - * Get the tag height - * - * @memberof OverlayTag - */ - set height(v: string); - get height(): string; - /** - * Calibrate the element when mounting - * - * @protected - * @returns {void} - * @memberof OverlayTag - */ - protected mount(): void; - /** - * Calibrate the width and height of the tag - * - * @returns {void} - * @memberof OverlayTag - */ - calibrate(): void; - /** - * Layout definition of the tag - * - * @protected - * @returns {TagLayoutType[]} - * @memberof OverlayTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A stack pannel allows to navigate back and forth between pannels - * (container widget). Each container widget in the stack should be - * composed inside a [[HBoxTag]] - * - * - * @export - * @class StackPanelTag - * @extends {AFXTag} - */ - class StackPanelTag extends TabContainerTag { - private _current_pannel_index; - /** - * Mount the tag and bind basic events - * - * @protected - * @memberof StackPanelTag - */ - protected mount(): void; - /** - * Set the tab select event handle - * - * @memberof StackPanelTag - */ - set ontabselect(f: TagEventCallback); - /** - * Navigate to the next panel - * - * @memberof StackPanelTag - */ - navigateNext(): void; - /** - * Navigate back to the previous panel - * - * @memberof StackPanelTag - */ - navigateBack(): void; - /** - * Navigate to a custom panel - * - * @memberof StackPanelTag - */ - private navigate; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Meta tag that represents the virtual desktop environment. - * In near future, we may have multiple virtual desktop environments. - * Each desktop environment has a simple file manager and a window - * manager that render the window in a specific order. - * - * @export - * @class DesktopTag - * @extends {FloatListTag} - */ - class DesktopTag extends FloatListTag { - /** - * internal handle to the desktop file location - * - * @private - * @type {API.VFS.BaseFileHandle} - * @memberof DesktopTag - */ - private file; - /** - * local observer that detect if a new child element is - * added or removed - * - * @private - * @type {MutationObserver} - * @memberof DesktopTag - */ - private observer; - /** - * Internal list of the current opened window - * - * @private - * @type {Set} - * @memberof DesktopTag - */ - private window_list; - /** - * Creates an instance of DesktopTag. - * @memberof DesktopTag - */ - constructor(); - /** - * Mount the virtual desktop to the DOM tree - * - * @protected - * @memberof DesktopTag - */ - protected mount(): void; - /** - * Display all files and folders in the specific desktop location - * - * @return {*} {Promise} - * @memberof DesktopTag - */ - refresh(): Promise; - /** - * Remove this element from its parent - * - * @memberof DesktopTag - */ - remove(): void; - /** - * Active a window above all other windows - * - * @private - * @param {WindowTag} win - * @memberof DesktopTag - */ - private selectWindow; - /** - * Render all windows in order from bottom to top - * - * @private - * @memberof DesktopTag - */ - private render; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Toast notification tag - * - * @export - * @class ToastNotificationTag - * @extends {AFXTag} - */ - class ToastNotificationTag extends AFXTag { - /** - *Creates an instance of ToastNotificationTag. - * @memberof ToastNotificationTag - */ - constructor(); - /** - * Mount the tag - * - * @protected - * @memberof ToastNotificationTag - */ - protected mount(): void; - /** - * Init the tag before mounting - * - * @protected - * @memberof ToastNotificationTag - */ - protected init(): void; - /** - * Re-calibrate tag - * - * @protected - * @memberof ToastNotificationTag - */ - protected calibrate(): void; - /** - * Update the current tag, do nothing in this tag - * - * @param {*} [d] - * @memberof ToastNotificationTag - */ - reload(d?: any): void; - /** - * Tag layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof ToastNotificationTag - */ - protected layout(): TagLayoutType[]; - } - /** - * This tag manage all notification UI on the desktop - * - * @export - * @class NotificationTag - * @extends {AFXTag} - */ - class NotificationTag extends AFXTag { - /** - *Creates an instance of NotificationTag. - * @memberof NotificationTag - */ - constructor(); - /** - * Mount the tag - * - * @protected - * @memberof NotificationTag - */ - protected mount(): void; - /** - * Init the tag before mounting - * - * @protected - * @memberof NotificationTag - */ - protected init(): void; - /** - * Push anotification to a specific location - * - * @memberof NotificationTag - */ - push(tag: AFXTag, loc?: ANCHOR): void; - /** - * Re-calibrate tag - * - * @protected - * @memberof NotificationTag - */ - protected calibrate(): void; - /** - * Update the current tag, do nothing in this tag - * - * @param {*} [d] - * @memberof NotificationTag - */ - reload(d?: any): void; - /** - * Tag layout definition - * - * @protected - * @returns {TagLayoutType[]} - * @memberof NotificationTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A float list is a list of items in which each - * item can be moved (drag and drop) freely - * - * @export - * @class FloatListTag - * @extends {ListViewTag} - */ - class FloatListTag extends ListViewTag { - /** - * Update the current tag, do nothing - * - * @protected - * @param {*} [d] - * @memberof FloatListTag - */ - protected reload(d?: any): void; - /** - * Variable that hold the onready callback of - * the tag. This callback will be called after - * the tag is mounted - * - * @private - * @memberof FloatListTag - */ - private _onready; - /** - *Creates an instance of FloatListTag. - * @memberof FloatListTag - */ - constructor(); - /** - * set the onready callback function to the tag. - * This callback will be called after - * the tag is mounted - * - * @memberof FloatListTag - */ - set onready(v: (e: FloatListTag) => void); - /** - * Disable the dropdown option in this list - * - * @memberof FloatListTag - */ - set dropdown(v: boolean); - /** - * Disable the list buttons configuration in this - * list - * - * @memberof FloatListTag - */ - set buttons(v: GenericObject[]); - /** - * Disable the `showlist` behavior in this list - * - * @protected - * @param {*} e - * @memberof FloatListTag - */ - protected showlist(e: any): void; - /** - * Disable the `dropoff` behavior in this list - * - * @protected - * @param {*} e - * @memberof FloatListTag - */ - protected dropoff(e: any): void; - /** - * Function called when the data of the list - * is changed - * - * @protected - * @memberof FloatListTag - */ - protected ondatachange(): void; - /** - * Mount the list to the DOM tree - * - * @protected - * @returns {void} - * @memberof FloatListTag - */ - protected mount(): void; - /** - * Push an element to the list - * - * @param {GenericObject} v an element data - * @returns - * @memberof FloatListTag - */ - push(v: GenericObject): ListViewItemTag; - /** - * Calibrate the view of the list - * - * @memberof FloatListTag - */ - calibrate(): void; - } - } - } -} -declare namespace OS { - namespace GUI { - /** - * - * Interface for an application dock item - * - * @export - * @interface AppDockItemType - */ - interface AppDockItemType { - /** - * Reference to the application process represented - * by the dock item - * - * @type {application.BaseApplication} - * @memberof AppDockItemType - */ - app?: application.BaseApplication; - /** - * Reference to the DOM element of - * the owner dock item - * - * @type {AFXTag} - * @memberof AppDockItemType - */ - domel?: AFXTag; - [propName: string]: any; - } - namespace tag { - /** - * This class define the AntOS system application dock tag - * - * @export - * @class AppDockTag - * @extends {AFXTag} - */ - class AppDockTag extends AFXTag { - /** - * Cache of touch event - * - * @private - * @meberof AppDockTag - */ - private _previous_touch; - /** - * Items data of the dock - * - * @private - * @type {AppDockItemType[]} - * @memberof AppDockTag - */ - private _items; - /** - * Reference to the currently select application - * process in the dock - * - * @private - * @type {AppDockItemType} - * @memberof AppDockTag - */ - private _selectedItem; - /** - *Creates an instance of AppDockTag. - * @memberof AppDockTag - */ - constructor(); - /** - * Implementation of the abstract function: Update the current tag. - * It do nothing for this tag - * - * @protected - * @param {*} [d] - * @memberof AppDockTag - */ - protected reload(d?: any): void; - /** - * Init the tag before mounting - * - * @protected - * @memberof AppDockTag - */ - protected init(): void; - /** - * The tag layout, it is empty on creation but elements will - * be added automatically to it in operation - * - * @protected - * @returns {TagLayoutType[]} - * @memberof AppDockTag - */ - protected layout(): TagLayoutType[]; - /** - * getter to get the dock items - * - * @readonly - * @type {AppDockItemType[]} - * @memberof AppDockTag - */ - get items(): AppDockItemType[]; - /** - * Setter: - * - * set the selected application in the dock - * this will trigger two event: - * - `focus`: on the selected application - * - `blur`: on all other applications on the dock - * - * Getter: - * - * Get the current selected application - * on the dock - * - * @memberof AppDockTag - */ - set selectedApp(v: application.BaseApplication); - get selectedApp(): application.BaseApplication; - /** - * Get selected item of the dock - * - * @readonly - * @type {AppDockItemType} - * @memberof AppDockTag - */ - get selectedItem(): AppDockItemType; - /** - * Add a button to the dock - * - * @private - * @param {string} [name] associated application name - * @param {AppDockItemType} [item] dock item - * @param {boolean} [pinned] the button is pinned to the dock ? - * @memberof AppDockTag - */ - private add_button; - private update_button; - /** - * When a new application process is created, this function - * will be called to add new application entry to the dock. - * The added application will becomes the current selected - * application - * - * @param {AppDockItemType} item an application dock item entry - * @memberof AppDockTag - */ - addapp(item: AppDockItemType): void; - /** - * Handle the application selection action - * - * @private - * @returns {Promise} - * @memberof AppDockTag - */ - private handleAppSelect; - /** - * Delete and application entry from the dock. - * This function will be called when an application - * is exit - * - * @param {BaseApplication} a the application to be removed from the dock - * @memberof AppDockTag - */ - removeapp(a: application.BaseApplication): void; - /** - * Mount the current dock tag - * - * @protected - * @memberof AppDockTag - */ - protected mount(): void; - /** - * refresh the pinned application list - * - * @private - * @memberof AppDockTag - */ - private refresh_pinned_app; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * Tag that define system calendar widget - * - * @export - * @class CalendarTag - * @extends {AFXTag} - */ - class CalendarTag extends AFXTag { - /** - * The current selected day - * - * @private - * @type {number} - * @memberof CalendarTag - */ - private _day; - /** - * The current selected month - * - * @private - * @type {number} - * @memberof CalendarTag - */ - private _month; - /** - * The current selected year - * - * @private - * @type {number} - * @memberof CalendarTag - */ - private _year; - /** - * The current selected date object - * - * @private - * @type {Date} - * @memberof CalendarTag - */ - private _selectedDate; - /** - * placeholder for date select event callback - * - * @private - * @type {TagEventCallback} - * @memberof CalendarTag - */ - private _ondateselect; - /** - *Creates an instance of CalendarTag. - * @memberof CalendarTag - */ - constructor(); - /** - * Init the tag before mounting - * - * @protected - * @memberof CalendarTag - */ - protected init(): void; - /** - * Update the current tag, doing nothing in this tag - * - * @protected - * @param {*} [d] any data object - * @memberof CalendarTag - */ - protected reload(d?: any): void; - /** - * Get the current selected date in the widget - * - * @readonly - * @type {Date} - * @memberof CalendarTag - */ - get selectedDate(): Date; - /** - * Set the date select event callback handle for the widget - * - * @memberof CalendarTag - */ - set ondateselect(v: TagEventCallback); - /** - * Mount the current widget to the DOM tree - * - * @protected - * @memberof CalendarTag - */ - protected mount(): void; - /** - * This function triggers the date select event - * - * @private - * @param {TagEventType} e AFX tag event data [[TagEventType]] - * @returns {void} - * @memberof CalendarTag - */ - private dateselect; - /** - * Calibrate the layout of the tag - * - * @protected - * @memberof CalendarTag - */ - protected calibrate(): void; - /** - * Display the previous month of the current month - * - * @private - * @memberof CalendarTag - */ - private prevmonth; - /** - * Display the next month of the current month - * - * @private - * @returns - * @memberof CalendarTag - */ - private nextmonth; - /** - * Visualize the calendar base on input date - * - * @private - * @param {Date} date - * @memberof CalendarTag - */ - private calendar; - /** - * Layout definition of the widget - * - * @protected - * @returns {TagLayoutType[]} - * @memberof CalendarTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare namespace OS { - namespace GUI { - namespace tag { - /** - * A WindowTag represents a virtual window element - * used by AntOS applications and dialogs. - * - * @export - * @class WindowTag - * @extends {AFXTag} - */ - class WindowTag extends AFXTag { - /** - * The element ID of the virtual desktop element - * - * @type {string} - * @memberof WindowTag - */ - desktop: string; - /** - * Window width placeholder - * - * @private - * @type {number} - * @memberof WindowTag - */ - private _width; - /** - * Window height placeholder - * - * @private - * @type {number} - * @memberof WindowTag - */ - private _height; - /** - * Placeholder indicates whether the current window is shown - * - * @private - * @type {boolean} - * @memberof WindowTag - */ - private _shown; - /** - * Placeholder indicates whether the current window is maximized - * - * @private - * @type {boolean} - * @memberof WindowTag - */ - private _isMaxi; - /** - * This placeholder stores the latest offset of the current window. - * - * @private - * @type {GenericObject} - * @memberof WindowTag - */ - private _history; - /** - * This placeholder store the callback for the menu open event - * - * @private - * @type {(el: StackMenuTag) => void} - * @memberof WindowTag - */ - private _onmenuopen; - /** - * This placeholder stores the offset of the virtual desktop element - * - * @private - * @type {GenericObject} - * @memberof WindowTag - */ - private _desktop_pos; - /** - * Creates an instance of WindowTag. - * @memberof WindowTag - */ - constructor(); - /** - * blur overlay: If active the window overlay will be shown - * on inactive (blur event) - * - * Setter: Enable the switch - * - * Getter: Check whether the switch is enabled - * - * @memberof WindowTag - */ - set blur_overlay(v: boolean); - get blur_overlay(): boolean; - /** - * Setter: set menu open event handler - * - * @memberof WindowTag - */ - set onmenuopen(f: (el: StackMenuTag) => void); - /** - * Init window tag - * - `shown`: false - * - `isMaxi`: false - * - `minimizable`: false - * - `resizable`: true - * - `apptitle`: Untitled - * - * @protected - * @memberof WindowTag - */ - protected init(): void; - /** - * Do nothing - * - * @protected - * @memberof WindowTag - */ - protected calibrate(): void; - /** - * Do nothing - * - * @protected - * @param {*} [d] - * @memberof WindowTag - */ - protected reload(d?: any): void; - /** - * Setter: Set the window width - * - * Getter: Get the window width - * - * @memberof WindowTag - */ - set width(v: number); - get width(): number; - /** - * Setter: Set the window height - * - * Getter: Get the window height - * - * @memberof WindowTag - */ - set height(v: number); - get height(): number; - /** - * Set the application menu content - * - * @memberof WindowTag - */ - set menu(v: GenericObject[]); - /** - * Setter: enable/disable window minimizable - * - * getter: Check whether the window is minimizable - * - * @memberof WindowTag - */ - set minimizable(v: boolean); - get minimizable(): boolean; - /** - * Setter: enable/disable widow resizable - * - * Getter: Check whether the current window is resizable - * - * @memberof WindowTag - */ - set resizable(v: boolean); - get resizable(): boolean; - /** - * Setter: Set the window title - * - * Getter: Get window title - * - * @memberof WindowTag - */ - set apptitle(v: string | FormattedString); - get apptitle(): string | FormattedString; - /** - * Get the notification tag - * - * @memberof WindowTag - */ - get notification(): NotificationTag; - /** - * Resize all the children of the window based on its width and height - * - * @private - * @memberof WindowTag - */ - private resize; - /** - * Mount the window tag and bind basic events - * - * @protected - * @returns {void} - * @memberof WindowTag - */ - protected mount(): void; - /** - * Set the window size - * - * @private - * @param {GenericObject} o format: `{ w: window_width, h: window_height }` - * @returns {void} - * @memberof WindowTag - */ - private setsize; - /** - * Enable to drag window on the virtual desktop - * - * @private - * @memberof WindowTag - */ - private enable_dragging; - /** - * Enable window resize, this only works if the window - * is resizable - * - * @private - * @memberof WindowTag - */ - private enable_resize; - /** - * Maximize the window or restore its previous width, height, - * and position - * - * @private - * @returns {void} - * @memberof WindowTag - */ - private toggle_window; - /** - * Layout definition of the window tag - * - * @protected - * @returns {TagLayoutType[]} - * @memberof WindowTag - */ - protected layout(): TagLayoutType[]; - } - } - } -} -declare type VFSFileHandleClass = { - new (...args: any[]): OS.API.VFS.BaseFileHandle; -}; -interface String { - /** - * Convert a string to VFS file handle. - * - * This function will create a file handle object from the string - * with the help of [[VFS.findHandles]] - * - * @returns {OS.API.VFS.BaseFileHandle} - * @memberof String - */ - asFileHandle(): OS.API.VFS.BaseFileHandle; -} -declare namespace OS { - namespace API { - /** - * User permission data type - * - * @export - * @interface UserPermissionType - */ - interface UserPermissionType { - read: boolean; - write: boolean; - exec: boolean; - } - /** - * VFS file meta-data data type - * - * @export - * @interface FileInfoType - */ - interface FileInfoType { - /** - * File mime type - * - * @type {string} - * @memberof FileInfoType - */ - mime: string; - /** - * File size - * - * @type {number} - * @memberof FileInfoType - */ - size: number; - /** - * File name - * - * @type {string} - * @memberof FileInfoType - */ - name: string; - /** - * File path - * - * @type {string} - * @memberof FileInfoType - */ - path: string; - /** - * File type: - * - `file` - * - `dir` - * - `app` - * - * @type {string} - * @memberof FileInfoType - */ - type: string; - /** - * File permission - * - * @type {{ - * group: UserPermissionType; - * owner: UserPermissionType; - * other: UserPermissionType; - * }} - * @memberof FileInfoType - */ - perm?: { - /** - * Group permission - * - * @type {UserPermissionType} - */ - group: UserPermissionType; - /** - * Owner permission - * - * @type {UserPermissionType} - */ - owner: UserPermissionType; - /** - * Other permission - * - * @type {UserPermissionType} - */ - other: UserPermissionType; - }; - /** - * Creation time - * - * @type {string} - * @memberof FileInfoType - */ - ctime?: string; - /** - * Modification time - * - * @type {string} - * @memberof FileInfoType - */ - mtime?: string; - /** - * Group id - * - * @type {number} - * @memberof FileInfoType - */ - gid?: number; - /** - * User id - * - * @type {number} - * @memberof FileInfoType - */ - uid?: number; - [propName: string]: any; - } - /** - * This namespace is dedicated to all APIs related to - * AntOS Virtual File System (VFS) - */ - namespace VFS { - /** - * Placeholder stores VFS file protocol patterns and its attached file handle class. - * - */ - const handles: GenericObject; - /** - * Register a protocol to a handle class - * - * @export - * @param {string} protos VFS protocol pattern - * @param {VFSFileHandleClass} cls handle class - */ - function register(protos: string, cls: VFSFileHandleClass): void; - /** - * Load custom VFS handles if the package vfsx available - * - * @export - * @param {boolean} [force] force load the file - * @return {*} {Promise} - */ - function loadVFSX(force?: boolean): Promise; - /** - * Looking for a attached file handle class of a string protocol - * - * When converting a string to file handle, the system will look - * for a protocol pattern in the string, if the protocol found, - * its attached handle class (found in [[VFS.handles]]) will be - * used to initialize a file handle object from the string - * - * ```typescript - * "home://data/test.txt".asFileHandle() // -> an instance of RemoteFileHandle - * ``` - * @export - * @param {string} proto protocol string - * @returns {VFSFileHandleClass[]} - */ - function findHandles(proto: string): VFSFileHandleClass[]; - /** - * Abstract prototype of all all VFS file handle definition. - * - * This prototype provides a standardized interface to access - * to different underlay file systems such as remote file, - * cloud file (Dropbox, Google drive, etc.), URL or memory-based file - * - * @export - * @abstract - * @class BaseFileHandle - */ - abstract class BaseFileHandle { - /** - * Flag indicates whether the file is dirty - * - * @type {boolean} - * @memberof BaseFileHandle - */ - dirty: boolean; - /** - * Once read, file content will be cached in this placeholder - * - * @private - * @type {*} - * @memberof BaseFileHandle - */ - private _cache; - /** - * Flag indicated whether the file meta-data is loaded - * - * @type {boolean} - * @memberof BaseFileHandle - */ - ready: boolean; - /** - * File path - * - * @type {string} - * @memberof BaseFileHandle - */ - path: string; - /** - * File protocol e.g: - * - `os://` - * - `home://` - * - * @type {string} - * @memberof BaseFileHandle - */ - protocol: string; - /** - * List of path segments - * - * @type {string[]} - * @memberof BaseFileHandle - */ - genealogy: string[]; - /** - * File base name - * - * @type {string} - * @memberof BaseFileHandle - */ - basename: string; - /** - * Once loaded, [[ready]] will be set to true and - * file meta-data will be stored in this place holder - * - * @type {FileInfoType} - * @memberof BaseFileHandle - */ - info: FileInfoType; - /** - * File extension - * - * @type {string} - * @memberof BaseFileHandle - */ - ext: string; - /** - * - * File type - * @type {string} - * @memberof BaseFileHandle - */ - type: string; - /** - *Creates an instance of BaseFileHandle. - * @param {string} path file path - * @memberof BaseFileHandle - */ - constructor(path: string); - /** - * Set a file path to the current file handle - * - * @param {string} p - * @returns {void} - * @memberof BaseFileHandle - */ - setPath(p: string): void; - /** - * Getter: Get the file basename - * Setter: set the file name - * - * @returns {string} - * @memberof BaseFileHandle - */ - get filename(): string; - set filename(v: string); - /** - * Getter: Get the file cache - * Setter: set the file cache - * - * @returns {any} - * @memberof BaseFileHandle - */ - get cache(): any; - set cache(v: any); - /** - * Set data to the file cache - * - * @param {*} v data object - * @returns {BaseFileHandle} - * @memberof BaseFileHandle - */ - setCache(v: any): BaseFileHandle; - /** - * Return the object itself - * - * @returns {BaseFileHandle} - * @memberof BaseFileHandle - */ - asFileHandle(): BaseFileHandle; - /** - * Check whether the current file is the root of the file tree - * - * @returns {boolean} - * @memberof BaseFileHandle - */ - isRoot(): boolean; - /** - * Check whether the current file is a hidden file - * - * @returns {boolean} - * @memberof BaseFileHandle - */ - isHidden(): boolean; - /** - * Get hash number of the current file path - * - * @returns {number} - * @memberof BaseFileHandle - */ - hash(): number; - /** - * Convert the current file cache to Base64 - * - * @protected - * @param {string} t type of the file cache: - * - `object` - * - `mime type` - * @returns {(Promise)} promise on the converted data - * @memberof BaseFileHandle - */ - protected b64(t: string): Promise; - /** - * Get the parent file handle of the current file - * - * @returns {BaseFileHandle} - * @memberof BaseFileHandle - */ - parent(): BaseFileHandle; - /** - * Load the file meta-data before performing - * any task - * - * @returns {Promise} a promise on file meta-data - * @memberof BaseFileHandle - */ - onready(): Promise; - /** - * Public read operation - * - * This function calls the [[_rd]] function to perform the operation. - * - * If the current file is a directory, then the operation - * will return the meta-data of all files inside of the directory. - * Otherwise, file content will be returned - * - * @param {any} formal t data type - * - jsonp: the response is an json object - * - script: the response is a javascript code - * - xml, html: the response is a XML/HTML object - * - text: plain text - * - binary - * - other user case may be user specific data - * - * @returns {Promise} a promise on the file content - * @memberof BaseFileHandle - */ - read(t?: any): Promise; - /** - * Write the file cache to the actual file - * - * This function calls the [[_wr]] function to perform the operation - * - * @param {string} t data type - * - `base64` - * - `object` - * - `mime type` - * - * @returns {Promise} promise on the operation result - * @memberof BaseFileHandle - */ - write(t: string): Promise; - /** - * Sub-directory creation - * - * This function calls the [[_mk]] function to perform the operation - * - * @param {string} d sub directory name - * @returns {Promise} promise on the operation result - * @memberof BaseFileHandle - */ - mk(d: string): Promise; - /** - * Delete the file - * - * This function calls the [[_rm]] function to perform the operation - * @param {any} d user data - * @returns {Promise} promise on the operation result - * @memberof BaseFileHandle - */ - remove(data?: any): Promise; - /** - * Upload a file to the current directory - * - * Only work when the current file is a directory - * - * This function calls the [[_up]] function to perform the operation - * - * @returns {Promise} promise on the operation result - * @memberof BaseFileHandle - */ - upload(): Promise; - /** - * Share the file by publish it. - * - * Only work with file - * - * This function calls the [[_pub]] function to perform the operation - * - * @returns {Promise} promise on operation result - * @memberof BaseFileHandle - */ - publish(): Promise; - /** - * Download the file. - * - * Only work with file - * - * This function calls the [[_down]] function to perform the operation - * - * @returns {Promise} Promise on the operation result - * @memberof BaseFileHandle - */ - download(): Promise; - /** - * Move the current file to another location - * - * This function calls the [[_mv]] function to perform the operation - * - * @param {string} d destination location - * @returns {Promise} promise on the operation result - * @memberof BaseFileHandle - */ - move(d: string): Promise; - /** - * Execute the current file. - * - * This action depends on each file protocol - * - * This function calls the [[_exec]] function to perform the operation - * - * @returns {Promise} - * @memberof BaseFileHandle - */ - execute(): Promise; - /** - * Get an accessible link to the file - * that can be accessed from the browser - * - * @returns {string} - * @memberof BaseFileHandle - */ - getlink(): string; - /** - * Helper function returns a promise on unsupported action - * - * @param {string} t action name - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected unsupported(t: string): Promise; - /** - * trigger cache changed event - * - * This function triggered when the file cached changed - * - * @protected - * @memberof BaseFileHandle - */ - protected _cache_changed(): void; - /** - * Low level protocol-specific read operation - * - * This function should be overridden on the file handle class - * that supports the operation - * - * @protected - * @param {any} t data type, see [[read]] - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _rd(t: any): Promise; - /** - * Low level protocol-specific write operation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @protected - * @param {string} t data type, see [[write]] - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _wr(t: string): Promise; - /** - * Low level protocol-specific sub-directory creation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @protected - * @param {string} d sub directory name - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _mk(d: string): Promise; - /** - * Low level protocol-specific delete operation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @param {*} [d] any user data - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _rm(d: any): Promise; - /** - * Low level protocol-specific move operation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @protected - * @param {string} d - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _mv(d: string): Promise; - /** - * Low level protocol-specific upload operation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _up(): Promise; - /** - * Low level protocol-specific download operation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _down(): Promise; - /** - * Low level protocol-specific execute operation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _exec(): Promise; - /** - * Low level protocol-specific share operation - * - * This function should be overridden by the file handle class - * that supports the operation - * - * @returns {Promise} - * @memberof BaseFileHandle - */ - protected _pub(): Promise; - /** - * Read the current file meta-data - * - * should be implemented by subclasses - * - * @abstract - * @returns {Promise} - * @memberof BaseFileHandle - */ - abstract meta(): Promise; - } - /** - * Remote file handle allows to perform file operation - * on AntOS remote server files. Its protocol is defined - * by the following pattern: - * - * ``` - * ^(home|desktop|os|Untitled)$ - * ``` - * - * @class RemoteFileHandle - * @extends {BaseFileHandle} - */ - class RemoteFileHandle extends BaseFileHandle { - /** - *Creates an instance of RemoteFileHandle. - * @param {string} path file path - * @memberof RemoteFileHandle - */ - constructor(path: string); - /** - * Read remote file meta-data - * - * @returns {Promise} - * @memberof RemoteFileHandle - */ - meta(): Promise; - /** - * Remote file access link - * - * @returns {string} - * @memberof RemoteFileHandle - */ - getlink(): string; - /** - * Read remote file content. - * - * If the current file is a directory, then the operation - * will return the meta-data of all files inside of the directory. - * Otherwise, file content will be returned - * - * @protected - * @param {string} t data type see [[read]] - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _rd(t: string): Promise; - /** - * Write file cache to the remote file - * - * @protected - * @param {string} t data type see [[write]] - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _wr(t: string): Promise; - /** - * Create sub directory - * - * Only work on directory file handle - * - * @protected - * @param {string} d sub directory name - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _mk(d: string): Promise; - /** - * Delete file/folder - * - * @protected - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _rm(): Promise; - /** - * Move file/folder - * - * @protected - * @param {string} d - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _mv(d: string): Promise; - /** - * Upload a file - * - * Only work with directory file handle - * - * @protected - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _up(): Promise; - /** - * Download a file - * - * only work with file - * - * @protected - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _down(): Promise; - /** - * Publish a file - * - * @protected - * @returns {Promise} - * @memberof RemoteFileHandle - */ - protected _pub(): Promise; - } - /** - * Package file is remote file ([[RemoteFileHandle]]) located either in - * the local user packages location or system packages - * location, it should be in the following format: - * - * ``` - * pkg://PKG_NAME/path/to/file - * - * ``` - * - * The system will locale the package name PKG_NAME either in the system domain - * or in user domain and return the correct path to the package - * - * @export - * @class PackageFileHandle - * @extends {RemoteFileHandle} - */ - class PackageFileHandle extends RemoteFileHandle { - /** - *Creates an instance of PackageFileHandle. - * @param {string} pkg_path package path in string - * @memberof PackageFileHandle - */ - constructor(pkg_path: string); - } - /** - * Application file is an AntOS special file allowing to - * refer to an application as a regular file. Its protocol - * pattern is defined as: - * - * ```typescript - * "^app$" // e.g. app://Setting - * ``` - * - * @class ApplicationHandle - * @extends {BaseFileHandle} - */ - class ApplicationHandle extends BaseFileHandle { - /** - *Creates an instance of ApplicationHandle. - * @param {string} path file path - * @memberof ApplicationHandle - */ - constructor(path: string); - /** - * Read application meta-data - * - * @returns {Promise} - * @memberof ApplicationHandle - */ - meta(): Promise; - /** - * If the current file is root (e.g. `app://`), the operation - * will return all system packages meta-data. - * - * Otherwise, an error will be thrown - * - * @protected - * @param {string} t - * @returns {Promise} - * @memberof ApplicationHandle - */ - protected _rd(t: string): Promise; - } - /** - * A buffer file handle represents a virtual file that is stored - * on the system memory. Its protocol pattern is defined as: - * - * ```typescript - * "^mem$" // e.g. mem://test.txt - * ``` - * - * @class BufferFileHandle - * @extends {BaseFileHandle} - */ - class BufferFileHandle extends BaseFileHandle { - /** - *Creates an instance of BufferFileHandle. - * @param {string} path file path - * @param {string} mime file mime-type - * @param {*} data file data - * @memberof BufferFileHandle - */ - constructor(path: string, mime: string, data: any); - /** - * init the mem file tree if necessary - */ - private init_file_tree; - /** - * cache changed handle - */ - protected _cache_changed(): void; - /** - * Read the file meta-data - * - * @returns {Promise} - * @memberof BufferFileHandle - */ - meta(): Promise; - /** - * Load the file meta-data before performing - * any task - * - * @returns {Promise} a promise on file meta-data - * @memberof BufferFileHandle - */ - onready(): Promise; - /** - * Read file content stored in the file cached - * - * @protected - * @param {string} t data type see [[read]] - * @returns {Promise} - * @memberof BufferFileHandle - */ - protected _rd(t: string): Promise; - /** - * Write data to the file cache - * - * @protected - * @param {string} t data type, see [[write]] - * @returns {Promise} - * @memberof BufferFileHandle - */ - protected _wr(t: string): Promise; - /** - * Create sub directory - * - * Only work on directory file handle - * - * @protected - * @param {string} d sub directory name - * @returns {Promise} - * @memberof BufferFileHandle - */ - protected _mk(d: string): Promise; - /** - * Delete file/folder - * - * @protected - * @returns {Promise} - * @memberof BufferFileHandle - */ - protected _rm(): Promise; - setPath(p: string): void; - private updatePath; - /** - * Move file/folder - * - * @protected - * @param {string} d - * @returns {Promise} - * @memberof BufferFileHandle - */ - protected _mv(d: string): Promise; - /** - * Download the buffer file - * - * @protected - * @returns {Promise} - * @memberof BufferFileHandle - */ - protected _down(): Promise; - } - /** - * URL file handle represents a HTTP/HTTPs link url - * as an AntOS VFS file handle. Its protocol is defined as - * - * ``` - * ^(http|https|ftp)$ - * ``` - * - * @class URLFileHandle - * @extends {BaseFileHandle} - */ - class URLFileHandle extends BaseFileHandle { - /** - *Creates an instance of URLFileHandle. - * @param {string} path - * @memberof URLFileHandle - */ - constructor(path: string); - /** - * Read file meta-data - * - * @returns {Promise} - * @memberof URLFileHandle - */ - meta(): Promise; - /** - * Read URL content - * - * @protected - * @param {string} t data type see [[read]] - * @returns {Promise} - * @memberof URLFileHandle - */ - protected _rd(t: string): Promise; - } - /** - * Shared file handle represents all AntOS shared file. - * Its protocol is defined as: - * - * ``` - * ^shared$ - * ``` - * - * @class SharedFileHandle - * @extends {API.VFS.BaseFileHandle} - */ - class SharedFileHandle extends API.VFS.BaseFileHandle { - /** - *Creates an instance of SharedFileHandle. - * @param {string} path file path - * @memberof SharedFileHandle - */ - constructor(path: string); - /** - * Read file meta-data - * - * @returns {Promise} - * @memberof SharedFileHandle - */ - meta(): Promise; - /** - * Read file content - * - * @protected - * @param {string} t data type, see [[read]] - * @returns {Promise} - * @memberof SharedFileHandle - */ - protected _rd(t: string): Promise; - /** - * write data to shared file - * - * @protected - * @param {string} t data type, see [[write]] - * @returns {Promise} - * @memberof SharedFileHandle - */ - protected _wr(t: string): Promise; - /** - * Un-publish the file - * - * @protected - * @returns {Promise} - * @memberof SharedFileHandle - */ - protected _rm(): Promise; - /** - * Download shared file - * - * @protected - * @returns {Promise} - * @memberof SharedFileHandle - */ - protected _down(): Promise; - /** - * Un publish the file - * - * @protected - * @returns {Promise} - * @memberof SharedFileHandle - */ - protected _pub(): Promise; - } - /**Utilities global functions */ - /** - * Read a file content from a zip archive - * - * The content type should be: - * - base64 : the result will be a string, the binary in a base64 form. - * - text (or string): the result will be an unicode string. - * - binarystring: the result will be a string in “binary” form, using 1 byte per char (2 bytes). - * - array: the result will be an Array of bytes (numbers between 0 and 255). - * - uint8array : the result will be a Uint8Array. This requires a compatible browser. - * - arraybuffer : the result will be a ArrayBuffer. This requires a compatible browser. - * - blob : the result will be a Blob. This requires a compatible browser. * - * If file_name is not specified, the first file_name in the zip archive will be read - * @export - * @param {string} file zip file - * @param {string} type content type to read - * @param {string} [file_name] the file should be read from the zip archive - * @return {*} {Promise} - */ - function readFileFromZip(file: string, type: string, file_name?: string): Promise; - /** - * Cat all files to a single out-put - * - * @export - * @param {string[]} list list of VFS files - * @param {string} data input data string that will be cat to the files content - * @param {string} join_by join on files content by this string - * @return {*} {Promise} - */ - function cat(list: string[], data: string, join_by?: string): Promise; - /** - * Read all files content on the list - * - * @export - * @param {string[]} list list of VFS files - * @param {GenericObject[]} contents content array - * @return {void} - */ - function read_files(list: string[]): Promise[]>; - /** - * Copy files to a folder - * - * @export - * @param {string[]} files list of files - * @param {string} to destination folder - * @return {*} {Promise} - */ - function copy(files: string[], to: string): Promise; - /** - * Create a zip archive from a folder - * - * @export - * @param {string} src source file/folder - * @param {string} dest destination archive - * @return {*} {Promise} - */ - function mkar(src: string, dest: string): Promise; - /** - * Create a list of directories - * - * @export - * @param {string[]} list of directories to be created - * @param {boolen} sync sync/async of directory creation - * @return {*} {Promise} - */ - function mkdirAll(list: string[], sync?: boolean): Promise; - /** - * - * - * @export Extract a zip fle - * @param {string} zfile zip file to extract - * @param {(zip:any) => Promise} [dest_callback] a callback to get extraction destination - * @return {*} {Promise} - */ - function extractZip(zfile: string | API.VFS.BaseFileHandle, dest_callback: (zip: any) => Promise): Promise; - /** - * Make files from a set of template files - * - * @export - * @param {Array} list mapping paths between templates files and created files - * @param {string} path files destination - * @param {(data: string) => string} callback: pre-processing files content before writing to destination files - * @return {*} {Promise} - */ - function mktpl(list: Array, path: string, callback: (data: string) => string): Promise; - } - } -} -declare namespace OS { - /** - * This namespace is dedicated to everything related to the - * global system settings - */ - namespace setting { - /** - * User setting type definition - * - * @export - * @interface UserSettingType - */ - interface UserSettingType { - /** - * User full name - * - * @type {string} - * @memberof UserSettingType - */ - name: string; - /** - * User name - * - * @type {string} - * @memberof UserSettingType - */ - username: string; - /** - * User id - * - * @type {number} - * @memberof UserSettingType - */ - id: number; - /** - * User groups - * - * @type {{ [index: number]: string }} - * @memberof UserSettingType - */ - group?: { - [index: number]: string; - }; - [propName: string]: any; - } - /** - * Virtual desktop setting data type - * - * @export - * @interface DesktopSettingType - */ - interface DesktopSettingType { - /** - * Desktop VFS path - * - * @type {string} - * @memberof DesktopSettingType - */ - path: string; - /** - * Desktop menu, can be added automatically by applications - * - * @type {GUI.BasicItemType[]} - * @memberof DesktopSettingType - */ - menu: GUI.BasicItemType[]; - /** - * Show desktop hidden files - * - * @type {boolean} - * @memberof DesktopSettingType - */ - showhidden: boolean; - [propName: string]: any; - } - /** - * Wallpaper setting data type - * - * @export - * @interface WPSettingType - */ - interface WPSettingType { - /** - * Repeat wallpaper: - * - `repeat` - * - `repeat-x` - * - `repeat-y` - * - `no-repeat` - * - * @type {string} - * @memberof WPSettingType - */ - repeat: string; - /** - * Wallpaper size - * - `contain` - * - `cover` - * - `auto` - * - * @type {string} - * @memberof WPSettingType - */ - size: string; - /** - * VFS path to the wallpaper image - * - * @type {string} - * @memberof WPSettingType - */ - url: string; - } - /** - * Theme setting data type - * - * @export - * @interface ThemeSettingType - */ - interface ThemeSettingType { - /** - * Theme name, this value is used for looking - * theme file in system asset - * - * @type {string} - * @memberof ThemeSettingType - */ - name: string; - /** - * Theme user-friendly text - * - * @type {string} - * @memberof ThemeSettingType - */ - text: string; - } - /** - * Appearance setting data type - * - * @export - * @interface AppearanceSettingType - */ - interface AppearanceSettingType { - /** - * Current theme name - * - * @type {string} - * @memberof AppearanceSettingType - */ - theme: string; - /** - * All themes available in the system - * - * @type {ThemeSettingType[]} - * @memberof AppearanceSettingType - */ - themes: ThemeSettingType[]; - /** - * Current wallpaper setting - * - * @type {WPSettingType} - * @memberof AppearanceSettingType - */ - wp: WPSettingType; - /** - * All wallpapers available in the system - * - * @type {string[]} - * @memberof AppearanceSettingType - */ - wps: string[]; - } - /** - * VFS Mount points setting data type - * - * @export - * @interface VFSMountPointSettingType - */ - interface VFSMountPointSettingType { - /** - * Path to the mount point - * - * @type {string} - * @memberof VFSMountPointSettingType - */ - path: string; - /** - * User friendly mount point name - * - * @type {string} - * @memberof VFSMountPointSettingType - */ - text: string; - [propName: string]: any; - } - /** - * VFS setting data type - * - * @export - * @interface VFSSettingType - */ - interface VFSSettingType { - /** - * mount points setting - * - * @type {VFSMountPointSettingType[]} - * @memberof VFSSettingType - */ - mountpoints: VFSMountPointSettingType[]; - [propName: string]: any; - } - /** - * Global system setting data type - * - * @export - * @interface SystemSettingType - */ - interface SystemSettingType { - /** - * System error report URL - * - * @type {string} - * @memberof SystemSettingType - */ - error_report: string; - /** - * Current system locale e.g. `en_GB` - * - * @type {string} - * @memberof SystemSettingType - */ - locale: string; - /** - * System menus - * - * @type {API.PackageMetaType[]} - * @memberof API.PackageMetaType - */ - menu: API.PackageMetaType[]; - /** - * Packages meta-data - * - * @type {{ [index: string]: API.PackageMetaType }} - * @memberof SystemSettingType - */ - packages: { - [index: string]: API.PackageMetaType; - }; - /** - * Path to the installed packages - * - * @type {{ - * user: string; - * system: string; - * }} - * @memberof SystemSettingType - */ - pkgpaths: { - /** - * User specific packages install location - * - * @type {string} - */ - user: string; - /** - * System packages install location - * - * @type {string} - */ - system: string; - }; - /** - * Package repositories setting. - * This configuration is used by [[MarketPlace]] - * for package management - * - * @type {{ - * text: string; - * url: string; - * }[]} - * @memberof SystemSettingType - */ - repositories: { - /** - * Repository name - * - * @type {string} - */ - text: string; - /** - * Repository uri - * - * @type {string} - */ - url: string; - }[]; - /** - * Startup applications and services - * - * @type {{ - * apps: string[]; - * services: string[]; - * }} - * @memberof SystemSettingType - */ - startup: { - /** - * List of application names - * - * @type {string[]} - */ - apps: string[]; - /** - * List of service names - * - * @type {string[]} - */ - services: string[]; - /** - * List of pinned applications - * - * @type {string[]} - */ - pinned: string[]; - }; - } - /** - * User settings - */ - var user: UserSettingType; - /** - * Application settings - */ - var applications: GenericObject; - /** - * Desktop settings - */ - var desktop: DesktopSettingType; - /** - * Appearance settings - */ - var appearance: AppearanceSettingType; - /** - * VFS settings - */ - var VFS: VFSSettingType; - /** - * System settings - */ - var system: SystemSettingType; - } - /** - * Reset the system settings to default values - * - * @export - */ - function resetSetting(): void; - /** - * Apply the input parameter object to system settings. - * This object could be an object loaded from - * setting JSON file saved on the server. - * - * @export - * @param {*} conf - */ - function systemSetting(conf: any): void; -} -/// -declare namespace OS { - namespace application { - /** - * Services are processes that run in the background and - * are waken up in certain circumstances such as by global - * events or user interactions. - * - * Each service takes an entry in the system tray menu - * located on the system panel. This menu entry is used - * to access to service visual contents such as: options, - * task performing based on user interaction, etc. - * - * Services are singleton processes, there is only - * one process of a service at a time - * - * @export - * @abstract - * @class BaseService - * @extends {BaseModel} - */ - abstract class BaseService extends BaseModel { - /** - * The service icon shown in the system tray - * - * @type {string} - * @memberof BaseService - */ - icon: string; - /** - * CSS class of the service icon shown in the system tray - * - * @type {string} - * @memberof BaseService - */ - iconclass: string; - /** - * Text of the service shown in the system tray - * - * @type {string | FormattedString} - * @memberof BaseService - */ - text: string | FormattedString; - /** - * Reference to the menu entry DOM element attached - * to the service - * - * @type {HTMLElement} - * @memberof BaseService - */ - domel: HTMLElement; - /** - * Reference to the timer that periodically executes the callback - * defined in [[watch]]. - * - * @private - * @type {number} - * @memberof BaseService - */ - private timer; - /** - * Placeholder for service select callback - * - * @memberof BaseService - */ - onmenuselect: (d: OS.GUI.TagEventType) => void; - /** - *Creates an instance of BaseService. - * @param {string} name service class name - * @param {AppArgumentsType[]} args service arguments - * @memberof BaseService - */ - constructor(name: string, args: AppArgumentsType[]); - /** - * Do nothing - * - * @memberof BaseService - */ - hide(): void; - /** - * Init the service before attaching it to - * the system tray: event subscribe, scheme - * loading. - * - * Should be implemented by all subclasses - * - * @abstract - * @memberof BaseService - */ - abstract init(): void; - /** - * Refresh the service menu entry in the - * system tray - * - * @memberof BaseService - */ - update(): void; - /** - * Get the service meta-data - * - * @returns {API.PackageMetaType} - * @memberof BaseService - */ - meta(): API.PackageMetaType; - /** - * Set the callback that will be called periodically - * after a period of time. - * - * Each service should only have at most one watcher - * - * @protected - * @param {number} t period time in seconds - * @param {() => void} f callback function - * @returns {number} - * @memberof BaseService - */ - protected watch(t: number, f: () => void): number; - /** - * This function is called when the service - * is exited - * - * @protected - * @param {BaseEvent} evt exit event - * @returns - * @memberof BaseService - */ - protected onexit(evt: BaseEvent): JQuery; - /** - * Do nothing - * - * @memberof BaseService - */ - main(): void; - /** - * Do nothing - * - * @memberof BaseService - */ - show(): void; - /** - * Awake the service, this function is usually called when - * the system tray menu entry attached to the service is - * selected. - * - * This function should be implemented by all subclasses - * - * @abstract - * @param {GUI.TagEventType} e - * @memberof BaseService - */ - abstract awake(e: GUI.TagEventType): void; - /** - * Do nothing - * - * @protected - * @param {BaseEvent} evt - * @memberof BaseService - */ - protected cleanup(evt: BaseEvent): void; - } - } -} -declare namespace OS { - namespace API { - /** - * Data type exchanged via - * the global Announcement interface - * - * @export - * @interface AnnouncementDataType - */ - interface AnnouncementDataType { - /** - * message string - * - * @type {string| FormattedString} - * @memberof AppAnnouncementDataType - */ - message: string | FormattedString; - /** - * Process ID - * - * @type {number} - * @memberof AppAnnouncementDataType - */ - id: number; - /** - * App name - * - * @type {string | FormattedString} - * @memberof AppAnnouncementDataType - */ - name: string | FormattedString; - /** - * Icon file - * - * @type {string} - * @memberof AppAnnouncementDataType - */ - icon?: string; - /** - * App icon class - * - * @type {string} - * @memberof AppAnnouncementDataType - */ - iconclass?: string; - /** - * User specific data - * - * @type {*} - * @memberof AppAnnouncementDataType - */ - u_data?: T; - } - /** - * Observable entry type definition - * - * @export - * @interface ObservableEntryType - */ - interface ObservableEntryType { - /** - * A Set of callbacks that should be called only once. - * These callbacks will be removed after the first - * occurrence of the corresponding event - * - * @memberof ObservableEntryType - */ - one: Set<(d: any) => void>; - /** - * A Set of callbacks that should be called - * every time the corresponding event is triggered - * - * @memberof ObservableEntryType - */ - many: Set<(d: any) => void>; - } - /** - * Announcement listener type definition - * - * @export - * @interface AnnouncerListenerType - */ - interface AnnouncerListenerType { - /** - * The event name - * - * @type {string} - */ - e: string; - /** - * The event callback - * - */ - f: (d: any) => void; - } - /** - * This class is the based class used in AntOS event - * announcement system. - * It implements the observer pattern using simple - * subscribe/publish mechanism - * @export - * @class Announcer - */ - class Announcer { - /** - * The observable object that stores event name - * and its corresponding callback in [[ObservableEntryType]] - * - * @type {GenericObject} - * @memberof Announcer - */ - observable: GenericObject; - /** - * Enable/disable the announcer - * - * @type {boolean} - * @memberof Announcer - */ - enable: boolean; - /** - *Creates an instance of Announcer. - * @memberof Announcer - */ - constructor(); - /** - * Disable the announcer, when this function is called - * all events and their callbacks will be removed - * - * @returns - * @memberof Announcer - */ - disable(): boolean; - /** - * Subscribe to an event, the callback will be called - * every time the corresponding event is trigged - * - * @param {string} evtName event name - * @param {(d: any) => void} callback The corresponding callback - * @returns {void} - * @memberof Announcer - */ - on(evtName: string, callback: (d: any) => void): void; - /** - * Subscribe to an event, the callback will - * be called only once and then removed from the announcer - * - * @param {string} evtName event name - * @param {(d: any) => void} callback the corresponding callback - * @returns {void} - * @memberof Announcer - */ - one(evtName: string, callback: (d: any) => void): void; - /** - * Unsubscribe the callback from an event - * - * @param {string} evtName event name - * @param {(d: any) => void} [callback] the callback to be unsubscribed. - * When the `callback` is `*`, all callbacks related to `evtName` will be - * removed - * @memberof Announcer - */ - off(evtName: string, callback?: (d: any) => void): void; - /** - * Trigger an event - * - * @param {string} evtName event name - * @param {*} data data object that will be send to all related callback - * @returns {void} - * @memberof Announcer - */ - trigger(evtName: string, data: any): void; - } - } - /** - * This namespace defines every thing related to the system announcement. - * - * The system announcement provides a global way to communicate between - * processes (applications/services) using the subscribe/publish - * mechanism - */ - namespace announcer { - /** - * The global announcer object that manages global events - * and callbacks - */ - var observable: API.Announcer; - /** - * This variable is used to allocate the `id` of all messages - * passing between publishers and subscribers in the - * system announcement - */ - var quota: 0; - /** - * Placeholder of all global events listeners - */ - var listeners: Map; - /** - * Subscribe to a global event - * - * @export - * @param {string} e event name - * @param {(d: API.AnnouncementDataType) => void} f event callback - * @param {GUI.BaseModel} a the process (Application/service) related to the callback - */ - function on(e: string, f: (d: API.AnnouncementDataType) => void, a?: BaseModel): void; - /** - * Subscribe to a global event once - * - * @export - * @param {string} e event name - * @param {(d: API.AnnouncementDataType) => void} f event callback - */ - function one(e: string, f: (d: API.AnnouncementDataType) => void): void; - /** - * Trigger a global event - * - * @export - * @param {string} e event name - * @param {*} d data passing to all related callback - */ - function trigger(e: string, d: any): void; - /** - * Report system fail. This will trigger the global `fail` - * event - * - * @export - * @param {(string | FormattedString)} m message string - * @param {Error} e error to be reported - */ - function osfail(m: string | FormattedString, e: Error): void; - /** - * Report system error. This will trigger the global `error` - * event - * - * @export - * @param {(string | FormattedString)} m message string - * @param {Error} e error to be reported - */ - function oserror(m: string | FormattedString, e: Error): void; - /** - * Trigger system notification (`info` event) - * - * @export - * @param {(string | FormattedString)} m notification message - */ - function osinfo(m: string | FormattedString): void; - /** - * - * - * @export - * @param {string} e event name - * @param {(string| FormattedString)} m event message - * @param {*} [d] user data - */ - function ostrigger(e: string, m: string | FormattedString, d?: any): void; - /** - * Unregister a process (application/service) from - * the global announcement system - * - * @export - * @param {GUI.BaseModel} app reference to the process - * @returns {void} - */ - function unregister(app: BaseModel): void; - /** - * Allocate message id - * - * @export - * @returns {number} - */ - function getMID(): number; - } -} -declare namespace OS { - namespace API { - /** - * Simple Virtual Database (VDB) application API. - * - * This API abstracts and provides a standard way to - * connect to a server-side relational database (e.g. sqlite). - * - * Each user when connected has their own database previously - * created. All VDB operations related to that user will be - * performed on this database. - * - * The creation of user database need to be managed by the server-side API. - * The VDB API assumes that the database already exist. All operations - * is performed in tables level - * - * @export - * @class DB - */ - class DB { - /** - * A table name on the user's database - * - * @private - * @type {string} - * @memberof DB - */ - private table; - /** - *Creates an instance of DB. - * @param {string} table table name - * @memberof DB - */ - constructor(table: string); - /** - * Save data to the current table. The input - * data must conform to the table record format. - * - * On the server side, if the table doest not - * exist yet, it should be created automatically - * by inferring the data structure of the input - * object - * - * @param {GenericObject} d data object represents a current table record - * @returns {Promise} - * @memberof DB - */ - save(d: GenericObject): Promise; - /** - * delete record(s) from the current table by - * a conditional object - * - * @param {*} c conditional object, c can be: - * - * * a `number`: the operation will delete the record with `id = c` - * * a `string`: The SQL string condition that selects record to delete - * * a conditional object represents a SQL condition statement as an object, - * example: `pid = 10 AND cid = 2` is represented by: - * - * ```typescript - * { - * exp: { - * "and": { - * pid: 10, - * cid: 2 - * } - * } - * ``` - * - * @returns {Promise} - * @memberof DB - */ - delete(c: GenericObject | number | string): Promise; - /** - * Get a record in the table by its primary key - * - * @param {number} id the primary key value - * @returns {Promise>} Promise on returned record data - * @memberof DB - */ - get(id: number): Promise>; - /** - * Find records by a condition - * - * @param {GenericObject} cond conditional object - * - * a conditional object represents a SQL condition statement as an object, - * example: `pid = 10 AND cid = 2 ORDER BY date DESC` is represented by: - * - * ```typescript - * { - * exp: { - * "and": { - * pid: 10, - * cid: 2 - * } - * }, - * order: { - * date: "DESC" - * } - * } - * ``` - * @returns {Promise[]>} - * @memberof DB - */ - find(cond: GenericObject): Promise[]>; - } - } -} -declare namespace OS { - /** - * This namespace dedicated to all operations related to system - * process management - */ - namespace PM { - /** - * A process is either an instance of an application or a service - */ - type ProcessType = application.BaseApplication | application.BaseService; - /** - * Alias to all classes that extends [[BaseModel]] - */ - type ModelTypeClass = { - new (args: AppArgumentsType[]): T; - }; - /** - * Process id allocator, when a new process is created, the value of - * this variable is increased - */ - var pidalloc: number; - /** - * All running processes is stored in this variables - */ - /** - * Current active process ID - */ - var pidactive: number; - var processes: GenericObject; - /** - * Create a new process of application or service - * - * @export - * @param {string} app class name string - * @param {ProcessTypeClass} cls prototype class - * @param {GUI.AppArgumentsType[]} [args] process arguments - * @returns {Promise} a promise on the created process - */ - function createProcess(app: string, cls: ModelTypeClass, args?: AppArgumentsType[]): Promise; - /** - * Get the reference to a process using its id - * - * @export - * @param {number} pid - * @returns {BaseModel} - */ - function appByPid(pid: number): BaseModel; - /** - * Kill a process - * - * @export - * @param {OS.GUI.BaseModel} app reference to the process - * @returns {void} - */ - function kill(app: BaseModel): void; - /** - * Kill all process of an application or service - * - * @export - * @param {string} app process class name - * @param {boolean} force force exit all process - * @returns {void} - */ - function killAll(app: string, force: boolean): void; - /** - * Get the current active application - * @export - * @returns {BaseModel} - */ - function getActiveApp(): BaseModel; - } -} diff --git a/libantosdk/core/ts/core.d.ts b/libantosdk/core/ts/core.d.ts deleted file mode 100644 index 0b18dda..0000000 --- a/libantosdk/core/ts/core.d.ts +++ /dev/null @@ -1,27299 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - - - -/// - - -///////////////////////////// -/// DOM APIs -///////////////////////////// - -interface Account { - displayName: string; - id: string; - imageURL?: string; - name?: string; - rpDisplayName: string; -} - -interface AddEventListenerOptions extends EventListenerOptions { - once?: boolean; - passive?: boolean; -} - -interface AesCbcParams extends Algorithm { - iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; -} - -interface AesCtrParams extends Algorithm { - counter: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - additionalData?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; - iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; - tagLength?: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface Algorithm { - name: string; -} - -interface AnalyserOptions extends AudioNodeOptions { - fftSize?: number; - maxDecibels?: number; - minDecibels?: number; - smoothingTimeConstant?: number; -} - -interface AnimationEventInit extends EventInit { - animationName?: string; - elapsedTime?: number; - pseudoElement?: string; -} - -interface AnimationPlaybackEventInit extends EventInit { - currentTime?: number | null; - timelineTime?: number | null; -} - -interface AssertionOptions { - allowList?: ScopedCredentialDescriptor[]; - extensions?: WebAuthnExtensions; - rpId?: string; - timeoutSeconds?: number; -} - -interface AssignedNodesOptions { - flatten?: boolean; -} - -interface AudioBufferOptions { - length: number; - numberOfChannels?: number; - sampleRate: number; -} - -interface AudioBufferSourceOptions { - buffer?: AudioBuffer | null; - detune?: number; - loop?: boolean; - loopEnd?: number; - loopStart?: number; - playbackRate?: number; -} - -interface AudioContextInfo { - currentTime?: number; - sampleRate?: number; -} - -interface AudioContextOptions { - latencyHint?: AudioContextLatencyCategory | number; - sampleRate?: number; -} - -interface AudioNodeOptions { - channelCount?: number; - channelCountMode?: ChannelCountMode; - channelInterpretation?: ChannelInterpretation; -} - -interface AudioParamDescriptor { - automationRate?: AutomationRate; - defaultValue?: number; - maxValue?: number; - minValue?: number; - name: string; -} - -interface AudioProcessingEventInit extends EventInit { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; -} - -interface AudioTimestamp { - contextTime?: number; - performanceTime?: number; -} - -interface AudioWorkletNodeOptions extends AudioNodeOptions { - numberOfInputs?: number; - numberOfOutputs?: number; - outputChannelCount?: number[]; - parameterData?: Record; - processorOptions?: any; -} - -interface AuthenticationExtensionsClientInputs { - appid?: string; - appidExclude?: string; - credProps?: boolean; - uvm?: boolean; -} - -interface AuthenticationExtensionsClientOutputs { - appid?: boolean; - credProps?: CredentialPropertiesOutput; - uvm?: UvmEntries; -} - -interface AuthenticatorSelectionCriteria { - authenticatorAttachment?: AuthenticatorAttachment; - requireResidentKey?: boolean; - residentKey?: ResidentKeyRequirement; - userVerification?: UserVerificationRequirement; -} - -interface BiquadFilterOptions extends AudioNodeOptions { - Q?: number; - detune?: number; - frequency?: number; - gain?: number; - type?: BiquadFilterType; -} - -interface BlobPropertyBag { - endings?: EndingType; - type?: string; -} - -interface ByteLengthChunk { - byteLength?: number; -} - -interface CacheQueryOptions { - ignoreMethod?: boolean; - ignoreSearch?: boolean; - ignoreVary?: boolean; -} - -interface CanvasRenderingContext2DSettings { - alpha?: boolean; - desynchronized?: boolean; -} - -interface ChannelMergerOptions extends AudioNodeOptions { - numberOfInputs?: number; -} - -interface ChannelSplitterOptions extends AudioNodeOptions { - numberOfOutputs?: number; -} - -interface ClientData { - challenge: string; - extensions?: WebAuthnExtensions; - hashAlg: string | Algorithm; - origin: string; - rpId: string; - tokenBinding?: string; -} - -interface ClientQueryOptions { - includeUncontrolled?: boolean; - type?: ClientTypes; -} - -interface ClipboardEventInit extends EventInit { - clipboardData?: DataTransfer | null; -} - -interface CloseEventInit extends EventInit { - code?: number; - reason?: string; - wasClean?: boolean; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ComputedEffectTiming extends EffectTiming { - activeDuration?: number; - currentIteration?: number | null; - endTime?: number; - localTime?: number | null; - progress?: number | null; -} - -interface ComputedKeyframe { - composite: CompositeOperationOrAuto; - computedOffset: number; - easing: string; - offset: number | null; - [property: string]: string | number | null | undefined; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstantSourceOptions { - offset?: number; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainULongRange extends ULongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: VideoFacingModeEnum | VideoFacingModeEnum[]; - ideal?: VideoFacingModeEnum | VideoFacingModeEnum[]; -} - -interface ConvolverOptions extends AudioNodeOptions { - buffer?: AudioBuffer | null; - disableNormalization?: boolean; -} - -interface CredentialCreationOptions { - publicKey?: PublicKeyCredentialCreationOptions; - signal?: AbortSignal; -} - -interface CredentialPropertiesOutput { - rk?: boolean; -} - -interface CredentialRequestOptions { - mediation?: CredentialMediationRequirement; - publicKey?: PublicKeyCredentialRequestOptions; - signal?: AbortSignal; -} - -interface CustomEventInit extends EventInit { - detail?: T; -} - -interface DOMMatrix2DInit { - a?: number; - b?: number; - c?: number; - d?: number; - e?: number; - f?: number; - m11?: number; - m12?: number; - m21?: number; - m22?: number; - m41?: number; - m42?: number; -} - -interface DOMMatrixInit extends DOMMatrix2DInit { - is2D?: boolean; - m13?: number; - m14?: number; - m23?: number; - m24?: number; - m31?: number; - m32?: number; - m33?: number; - m34?: number; - m43?: number; - m44?: number; -} - -interface DOMPointInit { - w?: number; - x?: number; - y?: number; - z?: number; -} - -interface DOMQuadInit { - p1?: DOMPointInit; - p2?: DOMPointInit; - p3?: DOMPointInit; - p4?: DOMPointInit; -} - -interface DOMRectInit { - height?: number; - width?: number; - x?: number; - y?: number; -} - -interface DelayOptions extends AudioNodeOptions { - delayTime?: number; - maxDelayTime?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceMotionEventAccelerationInit { - x?: number | null; - y?: number | null; - z?: number | null; -} - -interface DeviceMotionEventInit extends EventInit { - acceleration?: DeviceMotionEventAccelerationInit; - accelerationIncludingGravity?: DeviceMotionEventAccelerationInit; - interval?: number; - rotationRate?: DeviceMotionEventRotationRateInit; -} - -interface DeviceMotionEventRotationRateInit { - alpha?: number | null; - beta?: number | null; - gamma?: number | null; -} - -interface DeviceOrientationEventInit extends EventInit { - absolute?: boolean; - alpha?: number | null; - beta?: number | null; - gamma?: number | null; -} - -interface DevicePermissionDescriptor extends PermissionDescriptor { - deviceId?: string; - name: "camera" | "microphone" | "speaker"; -} - -interface DocumentTimelineOptions { - originTime?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface DragEventInit extends MouseEventInit { - dataTransfer?: DataTransfer | null; -} - -interface DynamicsCompressorOptions extends AudioNodeOptions { - attack?: number; - knee?: number; - ratio?: number; - release?: number; - threshold?: number; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - namedCurve: NamedCurve; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: NamedCurve; -} - -interface EcKeyImportParams extends Algorithm { - namedCurve: NamedCurve; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface EcdsaParams extends Algorithm { - hash: HashAlgorithmIdentifier; -} - -interface EffectTiming { - delay?: number; - direction?: PlaybackDirection; - duration?: number | string; - easing?: string; - endDelay?: number; - fill?: FillMode; - iterationStart?: number; - iterations?: number; -} - -interface ElementCreationOptions { - is?: string; -} - -interface ElementDefinitionOptions { - extends?: string; -} - -interface ErrorEventInit extends EventInit { - colno?: number; - error?: any; - filename?: string; - lineno?: number; - message?: string; -} - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} - -interface EventListenerOptions { - capture?: boolean; -} - -interface EventModifierInit extends UIEventInit { - altKey?: boolean; - ctrlKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; - shiftKey?: boolean; -} - -interface EventSourceInit { - withCredentials?: boolean; -} - -interface ExceptionInformation { - domain?: string | null; -} - -interface FilePropertyBag extends BlobPropertyBag { - lastModified?: number; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget | null; -} - -interface FocusNavigationEventInit extends EventInit { - navigationReason?: string | null; - originHeight?: number; - originLeft?: number; - originTop?: number; - originWidth?: number; -} - -interface FocusNavigationOrigin { - originHeight?: number; - originLeft?: number; - originTop?: number; - originWidth?: number; -} - -interface FocusOptions { - preventScroll?: boolean; -} - -interface FullscreenOptions { - navigationUI?: FullscreenNavigationUI; -} - -interface GainOptions extends AudioNodeOptions { - gain?: number; -} - -interface GamepadEventInit extends EventInit { - gamepad: Gamepad; -} - -interface GetNotificationOptions { - tag?: string; -} - -interface GetRootNodeOptions { - composed?: boolean; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface HkdfParams extends Algorithm { - hash: HashAlgorithmIdentifier; - info: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; - salt: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; -} - -interface HmacImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: KeyAlgorithm; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: string | string[] | null; -} - -interface IDBVersionChangeEventInit extends EventInit { - newVersion?: number | null; - oldVersion?: number; -} - -interface IIRFilterOptions extends AudioNodeOptions { - feedback: number[]; - feedforward: number[]; -} - -interface ImageBitmapOptions { - colorSpaceConversion?: ColorSpaceConversion; - imageOrientation?: ImageOrientation; - premultiplyAlpha?: PremultiplyAlpha; - resizeHeight?: number; - resizeQuality?: ResizeQuality; - resizeWidth?: number; -} - -interface ImageBitmapRenderingContextSettings { - alpha?: boolean; -} - -interface ImageEncodeOptions { - quality?: number; - type?: string; -} - -interface ImportMeta { - url: string; -} - -interface InputEventInit extends UIEventInit { - data?: string | null; - inputType?: string; - isComposing?: boolean; -} - -interface IntersectionObserverEntryInit { - boundingClientRect: DOMRectInit; - intersectionRatio: number; - intersectionRect: DOMRectInit; - isIntersecting: boolean; - rootBounds: DOMRectInit | null; - target: Element; - time: number; -} - -interface IntersectionObserverInit { - root?: Element | Document | null; - rootMargin?: string; - threshold?: number | number[]; -} - -interface JsonWebKey { - alg?: string; - crv?: string; - d?: string; - dp?: string; - dq?: string; - e?: string; - ext?: boolean; - k?: string; - key_ops?: string[]; - kty?: string; - n?: string; - oth?: RsaOtherPrimesInfo[]; - p?: string; - q?: string; - qi?: string; - use?: string; - x?: string; - y?: string; -} - -interface KeyAlgorithm { - name: string; -} - -interface KeyboardEventInit extends EventModifierInit { - /** @deprecated */ - charCode?: number; - code?: string; - isComposing?: boolean; - key?: string; - /** @deprecated */ - keyCode?: number; - location?: number; - repeat?: boolean; -} - -interface Keyframe { - composite?: CompositeOperationOrAuto; - easing?: string; - offset?: number | null; - [property: string]: string | number | null | undefined; -} - -interface KeyframeAnimationOptions extends KeyframeEffectOptions { - id?: string; -} - -interface KeyframeEffectOptions extends EffectTiming { - composite?: CompositeOperation; - iterationComposite?: IterationCompositeOperation; -} - -interface MediaElementAudioSourceOptions { - mediaElement: HTMLMediaElement; -} - -interface MediaEncryptedEventInit extends EventInit { - initData?: ArrayBuffer | null; - initDataType?: string; -} - -interface MediaKeyMessageEventInit extends EventInit { - message: ArrayBuffer; - messageType: MediaKeyMessageType; -} - -interface MediaKeySystemConfiguration { - audioCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: MediaKeysRequirement; - initDataTypes?: string[]; - label?: string; - persistentState?: MediaKeysRequirement; - sessionTypes?: string[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaQueryListEventInit extends EventInit { - matches?: boolean; - media?: string; -} - -interface MediaStreamAudioSourceOptions { - mediaStream: MediaStream; -} - -interface MediaStreamConstraints { - audio?: boolean | MediaTrackConstraints; - peerIdentity?: string; - video?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError | null; -} - -interface MediaStreamEventInit extends EventInit { - stream?: MediaStream; -} - -interface MediaStreamTrackAudioSourceOptions { - mediaStreamTrack: MediaStreamTrack; -} - -interface MediaStreamTrackEventInit extends EventInit { - track: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - aspectRatio?: DoubleRange; - autoGainControl?: boolean[]; - channelCount?: ULongRange; - deviceId?: string; - echoCancellation?: boolean[]; - facingMode?: string[]; - frameRate?: DoubleRange; - groupId?: string; - height?: ULongRange; - latency?: DoubleRange; - noiseSuppression?: boolean[]; - resizeMode?: string[]; - sampleRate?: ULongRange; - sampleSize?: ULongRange; - width?: ULongRange; -} - -interface MediaTrackConstraintSet { - aspectRatio?: ConstrainDouble; - autoGainControl?: ConstrainBoolean; - channelCount?: ConstrainULong; - deviceId?: ConstrainDOMString; - echoCancellation?: ConstrainBoolean; - facingMode?: ConstrainDOMString; - frameRate?: ConstrainDouble; - groupId?: ConstrainDOMString; - height?: ConstrainULong; - latency?: ConstrainDouble; - noiseSuppression?: ConstrainBoolean; - resizeMode?: ConstrainDOMString; - sampleRate?: ConstrainULong; - sampleSize?: ConstrainULong; - width?: ConstrainULong; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - aspectRatio?: number; - autoGainControl?: boolean; - channelCount?: number; - deviceId?: string; - echoCancellation?: boolean; - facingMode?: string; - frameRate?: number; - groupId?: string; - height?: number; - latency?: number; - noiseSuppression?: boolean; - resizeMode?: string; - sampleRate?: number; - sampleSize?: number; - width?: number; -} - -interface MediaTrackSupportedConstraints { - aspectRatio?: boolean; - autoGainControl?: boolean; - channelCount?: boolean; - deviceId?: boolean; - echoCancellation?: boolean; - facingMode?: boolean; - frameRate?: boolean; - groupId?: boolean; - height?: boolean; - latency?: boolean; - noiseSuppression?: boolean; - resizeMode?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - width?: boolean; -} - -interface MessageEventInit extends EventInit { - data?: T; - lastEventId?: string; - origin?: string; - ports?: MessagePort[]; - source?: MessageEventSource | null; -} - -interface MidiPermissionDescriptor extends PermissionDescriptor { - name: "midi"; - sysex?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - button?: number; - buttons?: number; - clientX?: number; - clientY?: number; - movementX?: number; - movementY?: number; - relatedTarget?: EventTarget | null; - screenX?: number; - screenY?: number; -} - -interface MultiCacheQueryOptions extends CacheQueryOptions { - cacheName?: string; -} - -interface MutationObserverInit { - /** - * Set to a list of attribute local names (without namespace) if not all attribute mutations need to be observed and attributes is true or omitted. - */ - attributeFilter?: string[]; - /** - * Set to true if attributes is true or omitted and target's attribute value before the mutation needs to be recorded. - */ - attributeOldValue?: boolean; - /** - * Set to true if mutations to target's attributes are to be observed. Can be omitted if attributeOldValue or attributeFilter is specified. - */ - attributes?: boolean; - /** - * Set to true if mutations to target's data are to be observed. Can be omitted if characterDataOldValue is specified. - */ - characterData?: boolean; - /** - * Set to true if characterData is set to true or omitted and target's data before the mutation needs to be recorded. - */ - characterDataOldValue?: boolean; - /** - * Set to true if mutations to target's children are to be observed. - */ - childList?: boolean; - /** - * Set to true if mutations to not just target, but also target's descendants are to be observed. - */ - subtree?: boolean; -} - -interface NavigationPreloadState { - enabled?: boolean; - headerValue?: string; -} - -interface NotificationAction { - action: string; - icon?: string; - title: string; -} - -interface NotificationOptions { - actions?: NotificationAction[]; - badge?: string; - body?: string; - data?: any; - dir?: NotificationDirection; - icon?: string; - image?: string; - lang?: string; - renotify?: boolean; - requireInteraction?: boolean; - silent?: boolean; - tag?: string; - timestamp?: number; - vibrate?: VibratePattern; -} - -interface OfflineAudioCompletionEventInit extends EventInit { - renderedBuffer: AudioBuffer; -} - -interface OfflineAudioContextOptions { - length: number; - numberOfChannels?: number; - sampleRate: number; -} - -interface OptionalEffectTiming { - delay?: number; - direction?: PlaybackDirection; - duration?: number | string; - easing?: string; - endDelay?: number; - fill?: FillMode; - iterationStart?: number; - iterations?: number; -} - -interface OscillatorOptions extends AudioNodeOptions { - detune?: number; - frequency?: number; - periodicWave?: PeriodicWave; - type?: OscillatorType; -} - -interface PageTransitionEventInit extends EventInit { - persisted?: boolean; -} - -interface PannerOptions extends AudioNodeOptions { - coneInnerAngle?: number; - coneOuterAngle?: number; - coneOuterGain?: number; - distanceModel?: DistanceModelType; - maxDistance?: number; - orientationX?: number; - orientationY?: number; - orientationZ?: number; - panningModel?: PanningModelType; - positionX?: number; - positionY?: number; - positionZ?: number; - refDistance?: number; - rolloffFactor?: number; -} - -interface PaymentCurrencyAmount { - currency: string; - currencySystem?: string; - value: string; -} - -interface PaymentDetailsBase { - displayItems?: PaymentItem[]; - modifiers?: PaymentDetailsModifier[]; - shippingOptions?: PaymentShippingOption[]; -} - -interface PaymentDetailsInit extends PaymentDetailsBase { - id?: string; - total: PaymentItem; -} - -interface PaymentDetailsModifier { - additionalDisplayItems?: PaymentItem[]; - data?: any; - supportedMethods: string | string[]; - total?: PaymentItem; -} - -interface PaymentDetailsUpdate extends PaymentDetailsBase { - error?: string; - total?: PaymentItem; -} - -interface PaymentItem { - amount: PaymentCurrencyAmount; - label: string; - pending?: boolean; -} - -interface PaymentMethodData { - data?: any; - supportedMethods: string | string[]; -} - -interface PaymentOptions { - requestPayerEmail?: boolean; - requestPayerName?: boolean; - requestPayerPhone?: boolean; - requestShipping?: boolean; - shippingType?: string; -} - -interface PaymentRequestUpdateEventInit extends EventInit { -} - -interface PaymentShippingOption { - amount: PaymentCurrencyAmount; - id: string; - label: string; - selected?: boolean; -} - -interface Pbkdf2Params extends Algorithm { - hash: HashAlgorithmIdentifier; - iterations: number; - salt: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; -} - -interface PerformanceObserverInit { - buffered?: boolean; - entryTypes?: string[]; - type?: string; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PeriodicWaveOptions extends PeriodicWaveConstraints { - imag?: number[] | Float32Array; - real?: number[] | Float32Array; -} - -interface PermissionDescriptor { - name: PermissionName; -} - -interface PointerEventInit extends MouseEventInit { - coalescedEvents?: PointerEvent[]; - height?: number; - isPrimary?: boolean; - pointerId?: number; - pointerType?: string; - predictedEvents?: PointerEvent[]; - pressure?: number; - tangentialPressure?: number; - tiltX?: number; - tiltY?: number; - twist?: number; - width?: number; -} - -interface PopStateEventInit extends EventInit { - state?: any; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - maximumAge?: number; - timeout?: number; -} - -interface PostMessageOptions { - transfer?: any[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface PromiseRejectionEventInit extends EventInit { - promise: Promise; - reason?: any; -} - -interface PropertyIndexedKeyframes { - composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[]; - easing?: string | string[]; - offset?: number | (number | null)[]; - [property: string]: string | string[] | number | null | (number | null)[] | undefined; -} - -interface PublicKeyCredentialCreationOptions { - attestation?: AttestationConveyancePreference; - authenticatorSelection?: AuthenticatorSelectionCriteria; - challenge: BufferSource; - excludeCredentials?: PublicKeyCredentialDescriptor[]; - extensions?: AuthenticationExtensionsClientInputs; - pubKeyCredParams: PublicKeyCredentialParameters[]; - rp: PublicKeyCredentialRpEntity; - timeout?: number; - user: PublicKeyCredentialUserEntity; -} - -interface PublicKeyCredentialDescriptor { - id: BufferSource; - transports?: AuthenticatorTransport[]; - type: PublicKeyCredentialType; -} - -interface PublicKeyCredentialEntity { - name: string; -} - -interface PublicKeyCredentialParameters { - alg: COSEAlgorithmIdentifier; - type: PublicKeyCredentialType; -} - -interface PublicKeyCredentialRequestOptions { - allowCredentials?: PublicKeyCredentialDescriptor[]; - challenge: BufferSource; - extensions?: AuthenticationExtensionsClientInputs; - rpId?: string; - timeout?: number; - userVerification?: UserVerificationRequirement; -} - -interface PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity { - id?: string; -} - -interface PublicKeyCredentialUserEntity extends PublicKeyCredentialEntity { - displayName: string; - id: BufferSource; -} - -interface PushPermissionDescriptor extends PermissionDescriptor { - name: "push"; - userVisibleOnly?: boolean; -} - -interface PushSubscriptionJSON { - endpoint?: string; - expirationTime?: number | null; - keys?: Record; -} - -interface PushSubscriptionOptionsInit { - applicationServerKey?: BufferSource | string | null; - userVisibleOnly?: boolean; -} - -interface QueuingStrategy { - highWaterMark?: number; - size?: QueuingStrategySize; -} - -interface QueuingStrategyInit { - /** - * Creates a new ByteLengthQueuingStrategy with the provided high water mark. - * - * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. - */ - highWaterMark: number; -} - -interface RTCAnswerOptions extends RTCOfferAnswerOptions { -} - -interface RTCCertificateExpiration { - expires?: number; -} - -interface RTCConfiguration { - bundlePolicy?: RTCBundlePolicy; - certificates?: RTCCertificate[]; - iceCandidatePoolSize?: number; - iceServers?: RTCIceServer[]; - iceTransportPolicy?: RTCIceTransportPolicy; - peerIdentity?: string; - rtcpMuxPolicy?: RTCRtcpMuxPolicy; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone: string; -} - -interface RTCDataChannelEventInit extends EventInit { - channel: RTCDataChannel; -} - -interface RTCDataChannelInit { - id?: number; - maxPacketLifeTime?: number; - maxRetransmits?: number; - negotiated?: boolean; - ordered?: boolean; - priority?: RTCPriorityType; - protocol?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - fingerprints?: RTCDtlsFingerprint[]; - role?: RTCDtlsRole; -} - -interface RTCErrorEventInit extends EventInit { - error: RTCError; -} - -interface RTCErrorInit { - errorDetail: RTCErrorDetailType; - httpRequestStatusCode?: number; - receivedAlert?: number; - sctpCauseCode?: number; - sdpLineNumber?: number; - sentAlert?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - addressSourceUrl?: string; - candidateType?: RTCStatsIceCandidateType; - ipAddress?: string; - portNumber?: number; - priority?: number; - transport?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidateDictionary { - foundation?: string; - ip?: string; - msMTurnSessionId?: string; - port?: number; - priority?: number; - protocol?: RTCIceProtocol; - relatedAddress?: string; - relatedPort?: number; - tcpType?: RTCIceTcpCandidateType; - type?: RTCIceCandidateType; -} - -interface RTCIceCandidateInit { - candidate?: string; - sdpMLineIndex?: number | null; - sdpMid?: string | null; - usernameFragment?: string | null; -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - availableIncomingBitrate?: number; - availableOutgoingBitrate?: number; - bytesDiscardedOnSend?: number; - bytesReceived?: number; - bytesSent?: number; - circuitBreakerTriggerCount?: number; - consentExpiredTimestamp?: number; - consentRequestsSent?: number; - currentRoundTripTime?: number; - currentRtt?: number; - firstRequestTimestamp?: number; - lastPacketReceivedTimestamp?: number; - lastPacketSentTimestamp?: number; - lastRequestTimestamp?: number; - lastResponseTimestamp?: number; - localCandidateId?: string; - nominated?: boolean; - packetsDiscardedOnSend?: number; - packetsReceived?: number; - packetsSent?: number; - priority?: number; - remoteCandidateId?: string; - requestsReceived?: number; - requestsSent?: number; - responsesReceived?: number; - responsesSent?: number; - retransmissionsReceived?: number; - retransmissionsSent?: number; - state?: RTCStatsIceCandidatePairState; - totalRoundTripTime?: number; - totalRtt?: number; - transportId?: string; -} - -interface RTCIceGatherOptions { - gatherPolicy?: RTCIceGatherPolicy; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - password?: string; - usernameFragment?: string; -} - -interface RTCIceServer { - credential?: string | RTCOAuthCredential; - credentialType?: RTCIceCredentialType; - urls: string | string[]; - username?: string; -} - -interface RTCIdentityProviderOptions { - peerIdentity?: string; - protocol?: string; - usernameHint?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - bytesReceived?: number; - fractionLost?: number; - jitter?: number; - packetsLost?: number; - packetsReceived?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; - frameHeight?: number; - frameWidth?: number; - framesCorrupted?: number; - framesDecoded?: number; - framesDropped?: number; - framesPerSecond?: number; - framesReceived?: number; - framesSent?: number; - remoteSource?: boolean; - ssrcIds?: string[]; - trackIdentifier?: string; -} - -interface RTCOAuthCredential { - accessToken: string; - macKey: string; -} - -interface RTCOfferAnswerOptions { - voiceActivityDetection?: boolean; -} - -interface RTCOfferOptions extends RTCOfferAnswerOptions { - iceRestart?: boolean; - offerToReceiveAudio?: boolean; - offerToReceiveVideo?: boolean; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - bytesSent?: number; - packetsSent?: number; - roundTripTime?: number; - targetBitrate?: number; -} - -interface RTCPeerConnectionIceErrorEventInit extends EventInit { - errorCode: number; - hostCandidate?: string; - statusText?: string; - url?: string; -} - -interface RTCPeerConnectionIceEventInit extends EventInit { - candidate?: RTCIceCandidate | null; - url?: string | null; -} - -interface RTCRTPStreamStats extends RTCStats { - associateStatsId?: string; - codecId?: string; - firCount?: number; - isRemote?: boolean; - mediaTrackId?: string; - mediaType?: string; - nackCount?: number; - pliCount?: number; - sliCount?: number; - ssrc?: string; - transportId?: string; -} - -interface RTCRtcpFeedback { - parameter?: string; - type?: string; -} - -interface RTCRtcpParameters { - cname?: string; - reducedSize?: boolean; -} - -interface RTCRtpCapabilities { - codecs: RTCRtpCodecCapability[]; - headerExtensions: RTCRtpHeaderExtensionCapability[]; -} - -interface RTCRtpCodecCapability { - channels?: number; - clockRate: number; - mimeType: string; - sdpFmtpLine?: string; -} - -interface RTCRtpCodecParameters { - channels?: number; - clockRate: number; - mimeType: string; - payloadType: number; - sdpFmtpLine?: string; -} - -interface RTCRtpCodingParameters { - rid?: string; -} - -interface RTCRtpContributingSource { - audioLevel?: number; - rtpTimestamp: number; - source: number; - timestamp: number; -} - -interface RTCRtpDecodingParameters extends RTCRtpCodingParameters { -} - -interface RTCRtpEncodingParameters extends RTCRtpCodingParameters { - active?: boolean; - codecPayloadType?: number; - dtx?: RTCDtxStatus; - maxBitrate?: number; - maxFramerate?: number; - ptime?: number; - scaleResolutionDownBy?: number; -} - -interface RTCRtpFecParameters { - mechanism?: string; - ssrc?: number; -} - -interface RTCRtpHeaderExtension { - kind?: string; - preferredEncrypt?: boolean; - preferredId?: number; - uri?: string; -} - -interface RTCRtpHeaderExtensionCapability { - uri?: string; -} - -interface RTCRtpHeaderExtensionParameters { - encrypted?: boolean; - id: number; - uri: string; -} - -interface RTCRtpParameters { - codecs: RTCRtpCodecParameters[]; - headerExtensions: RTCRtpHeaderExtensionParameters[]; - rtcp: RTCRtcpParameters; -} - -interface RTCRtpReceiveParameters extends RTCRtpParameters { - encodings: RTCRtpDecodingParameters[]; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpSendParameters extends RTCRtpParameters { - degradationPreference?: RTCDegradationPreference; - encodings: RTCRtpEncodingParameters[]; - priority?: RTCPriorityType; - transactionId: string; -} - -interface RTCRtpSynchronizationSource extends RTCRtpContributingSource { - voiceActivityFlag?: boolean; -} - -interface RTCRtpTransceiverInit { - direction?: RTCRtpTransceiverDirection; - sendEncodings?: RTCRtpEncodingParameters[]; - streams?: MediaStream[]; -} - -interface RTCRtpUnhandled { - muxId?: string; - payloadType?: number; - ssrc?: number; -} - -interface RTCSessionDescriptionInit { - sdp?: string; - type?: RTCSdpType; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiLength?: number; - mkiValue?: number; -} - -interface RTCSrtpSdesParameters { - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; - tag?: number; -} - -interface RTCSsrcRange { - max?: number; - min?: number; -} - -interface RTCStats { - id?: string; - timestamp?: number; - type?: RTCStatsType; -} - -interface RTCStatsEventInit extends EventInit { - report: RTCStatsReport; -} - -interface RTCStatsReport { -} - -interface RTCTrackEventInit extends EventInit { - receiver: RTCRtpReceiver; - streams?: MediaStream[]; - track: MediaStreamTrack; - transceiver: RTCRtpTransceiver; -} - -interface RTCTransportStats extends RTCStats { - bytesReceived?: number; - bytesSent?: number; - dtlsCipher?: string; - dtlsState?: RTCDtlsTransportState; - iceRole?: RTCIceRole; - localCertificateId?: string; - packetsReceived?: number; - packetsSent?: number; - remoteCertificateId?: string; - rtcpTransportStatsId?: string; - selectedCandidatePairChanges?: number; - selectedCandidatePairId?: string; - srtpCipher?: string; - tlsGroup?: string; - tlsVersion?: string; -} - -interface ReadableStreamDefaultReadDoneResult { - done: true; - value?: undefined; -} - -interface ReadableStreamDefaultReadValueResult { - done: false; - value: T; -} - -interface ReadableWritablePair { - readable: ReadableStream; - /** - * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. - * - * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. - */ - writable: WritableStream; -} - -interface RegistrationOptions { - scope?: string; - type?: WorkerType; - updateViaCache?: ServiceWorkerUpdateViaCache; -} - -interface RequestInit { - /** - * A BodyInit object or null to set request's body. - */ - body?: BodyInit | null; - /** - * A string indicating how the request will interact with the browser's cache to set request's cache. - */ - cache?: RequestCache; - /** - * A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. - */ - credentials?: RequestCredentials; - /** - * A Headers object, an object literal, or an array of two-item arrays to set request's headers. - */ - headers?: HeadersInit; - /** - * A cryptographic hash of the resource to be fetched by request. Sets request's integrity. - */ - integrity?: string; - /** - * A boolean to set request's keepalive. - */ - keepalive?: boolean; - /** - * A string to set request's method. - */ - method?: string; - /** - * A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. - */ - mode?: RequestMode; - /** - * A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. - */ - redirect?: RequestRedirect; - /** - * A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. - */ - referrer?: string; - /** - * A referrer policy to set request's referrerPolicy. - */ - referrerPolicy?: ReferrerPolicy; - /** - * An AbortSignal to set request's signal. - */ - signal?: AbortSignal | null; - /** - * Can only be null. Used to disassociate request from any Window. - */ - window?: any; -} - -interface ResizeObserverOptions { - box?: ResizeObserverBoxOptions; -} - -interface ResponseInit { - headers?: HeadersInit; - status?: number; - statusText?: string; -} - -interface RsaHashedImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: KeyAlgorithm; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: HashAlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: BigInteger; -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: BigInteger; -} - -interface RsaOaepParams extends Algorithm { - label?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; -} - -interface RsaOtherPrimesInfo { - d?: string; - r?: string; - t?: string; -} - -interface RsaPssParams extends Algorithm { - saltLength: number; -} - -interface SVGBoundingBoxOptions { - clipped?: boolean; - fill?: boolean; - markers?: boolean; - stroke?: boolean; -} - -interface ScopedCredentialDescriptor { - id: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null; - transports?: Transport[]; - type: ScopedCredentialType; -} - -interface ScopedCredentialOptions { - excludeList?: ScopedCredentialDescriptor[]; - extensions?: WebAuthnExtensions; - rpId?: string; - timeoutSeconds?: number; -} - -interface ScopedCredentialParameters { - algorithm: string | Algorithm; - type: ScopedCredentialType; -} - -interface ScrollIntoViewOptions extends ScrollOptions { - block?: ScrollLogicalPosition; - inline?: ScrollLogicalPosition; -} - -interface ScrollOptions { - behavior?: ScrollBehavior; -} - -interface ScrollToOptions extends ScrollOptions { - left?: number; - top?: number; -} - -interface SecurityPolicyViolationEventInit extends EventInit { - blockedURI?: string; - columnNumber?: number; - documentURI?: string; - effectiveDirective?: string; - lineNumber?: number; - originalPolicy?: string; - referrer?: string; - sourceFile?: string; - statusCode?: number; - violatedDirective?: string; -} - -interface ServiceWorkerMessageEventInit extends EventInit { - data?: any; - lastEventId?: string; - origin?: string; - ports?: MessagePort[] | null; - source?: ServiceWorker | MessagePort | null; -} - -interface ShadowRootInit { - delegatesFocus?: boolean; - mode: ShadowRootMode; -} - -interface ShareData { - text?: string; - title?: string; - url?: string; -} - -interface SpeechRecognitionErrorEventInit extends EventInit { - error: SpeechRecognitionErrorCode; - message?: string; -} - -interface SpeechRecognitionEventInit extends EventInit { - resultIndex?: number; - results: SpeechRecognitionResultList; -} - -interface SpeechSynthesisErrorEventInit extends SpeechSynthesisEventInit { - error: SpeechSynthesisErrorCode; -} - -interface SpeechSynthesisEventInit extends EventInit { - charIndex?: number; - charLength?: number; - elapsedTime?: number; - name?: string; - utterance: SpeechSynthesisUtterance; -} - -interface StaticRangeInit { - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; -} - -interface StereoPannerOptions extends AudioNodeOptions { - pan?: number; -} - -interface StorageEstimate { - quota?: number; - usage?: number; -} - -interface StorageEventInit extends EventInit { - key?: string | null; - newValue?: string | null; - oldValue?: string | null; - storageArea?: Storage | null; - url?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - detailURI?: string | null; - explanationString?: string | null; - siteName?: string | null; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface StreamPipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - /** - * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. - * - * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. - * - * Errors and closures of the source and destination streams propagate as follows: - * - * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. - * - * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. - * - * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. - * - * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. - * - * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. - */ - preventClose?: boolean; - signal?: AbortSignal; -} - -interface TextDecodeOptions { - stream?: boolean; -} - -interface TextDecoderOptions { - fatal?: boolean; - ignoreBOM?: boolean; -} - -interface TextEncoderEncodeIntoResult { - read?: number; - written?: number; -} - -interface TouchEventInit extends EventModifierInit { - changedTouches?: Touch[]; - targetTouches?: Touch[]; - touches?: Touch[]; -} - -interface TouchInit { - altitudeAngle?: number; - azimuthAngle?: number; - clientX?: number; - clientY?: number; - force?: number; - identifier: number; - pageX?: number; - pageY?: number; - radiusX?: number; - radiusY?: number; - rotationAngle?: number; - screenX?: number; - screenY?: number; - target: EventTarget; - touchType?: TouchType; -} - -interface TrackEventInit extends EventInit { - track?: TextTrack | null; -} - -interface Transformer { - flush?: TransformerFlushCallback; - readableType?: undefined; - start?: TransformerStartCallback; - transform?: TransformerTransformCallback; - writableType?: undefined; -} - -interface TransitionEventInit extends EventInit { - elapsedTime?: number; - propertyName?: string; - pseudoElement?: string; -} - -interface UIEventInit extends EventInit { - detail?: number; - view?: Window | null; -} - -interface ULongRange { - max?: number; - min?: number; -} - -interface UnderlyingSink { - abort?: UnderlyingSinkAbortCallback; - close?: UnderlyingSinkCloseCallback; - start?: UnderlyingSinkStartCallback; - type?: undefined; - write?: UnderlyingSinkWriteCallback; -} - -interface UnderlyingSource { - cancel?: UnderlyingSourceCancelCallback; - pull?: UnderlyingSourcePullCallback; - start?: UnderlyingSourceStartCallback; - type?: undefined; -} - -interface VRDisplayEventInit extends EventInit { - display: VRDisplay; - reason?: VRDisplayEventReason; -} - -interface VRLayer { - leftBounds?: number[] | Float32Array | null; - rightBounds?: number[] | Float32Array | null; - source?: HTMLCanvasElement | null; -} - -interface VRStageParameters { - sittingToStandingTransform?: Float32Array; - sizeX?: number; - sizeY?: number; -} - -interface WaveShaperOptions extends AudioNodeOptions { - curve?: number[] | Float32Array; - oversample?: OverSampleType; -} - -interface WebAuthnExtensions { -} - -interface WebGLContextAttributes { - alpha?: boolean; - antialias?: boolean; - depth?: boolean; - desynchronized?: boolean; - failIfMajorPerformanceCaveat?: boolean; - powerPreference?: WebGLPowerPreference; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; - stencil?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaMode?: number; - deltaX?: number; - deltaY?: number; - deltaZ?: number; -} - -interface WorkerOptions { - credentials?: RequestCredentials; - name?: string; - type?: WorkerType; -} - -interface WorkletOptions { - credentials?: RequestCredentials; -} - -interface EventListener { - (evt: Event): void; -} - -type XPathNSResolver = ((prefix: string | null) => string | null) | { lookupNamespaceURI(prefix: string | null): string | null; }; - -/** The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. */ -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void; - drawElementsInstancedANGLE(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, primcount: GLsizei): void; - vertexAttribDivisorANGLE(index: GLuint, divisor: GLuint): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: GLenum; -} - -/** A controller object that allows you to abort one or more DOM requests as and when desired. */ -interface AbortController { - /** - * Returns the AbortSignal object associated with this object. - */ - readonly signal: AbortSignal; - /** - * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. - */ - abort(): void; -} - -declare var AbortController: { - prototype: AbortController; - new(): AbortController; -}; - -interface AbortSignalEventMap { - "abort": Event; -} - -/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ -interface AbortSignal extends EventTarget { - /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. - */ - readonly aborted: boolean; - onabort: ((this: AbortSignal, ev: Event) => any) | null; - addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var AbortSignal: { - prototype: AbortSignal; - new(): AbortSignal; -}; - -interface AbstractRange { - /** - * Returns true if range is collapsed, and false otherwise. - */ - readonly collapsed: boolean; - /** - * Returns range's end node. - */ - readonly endContainer: Node; - /** - * Returns range's end offset. - */ - readonly endOffset: number; - /** - * Returns range's start node. - */ - readonly startContainer: Node; - /** - * Returns range's start offset. - */ - readonly startOffset: number; -} - -declare var AbstractRange: { - prototype: AbstractRange; - new(): AbstractRange; -}; - -interface AbstractWorkerEventMap { - "error": ErrorEvent; -} - -interface AbstractWorker { - onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null; - addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -interface AesCfbParams extends Algorithm { - iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -/** A node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */ -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(context: BaseAudioContext, options?: AnalyserOptions): AnalyserNode; -}; - -interface Animatable { - animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation; - getAnimations(): Animation[]; -} - -interface AnimationEventMap { - "cancel": AnimationPlaybackEvent; - "finish": AnimationPlaybackEvent; -} - -interface Animation extends EventTarget { - currentTime: number | null; - effect: AnimationEffect | null; - readonly finished: Promise; - id: string; - oncancel: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; - onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; - readonly pending: boolean; - readonly playState: AnimationPlayState; - playbackRate: number; - readonly ready: Promise; - startTime: number | null; - timeline: AnimationTimeline | null; - cancel(): void; - finish(): void; - pause(): void; - play(): void; - reverse(): void; - updatePlaybackRate(playbackRate: number): void; - addEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var Animation: { - prototype: Animation; - new(effect?: AnimationEffect | null, timeline?: AnimationTimeline | null): Animation; -}; - -interface AnimationEffect { - getComputedTiming(): ComputedEffectTiming; - getTiming(): EffectTiming; - updateTiming(timing?: OptionalEffectTiming): void; -} - -declare var AnimationEffect: { - prototype: AnimationEffect; - new(): AnimationEffect; -}; - -/** Events providing information related to animations. */ -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - readonly pseudoElement: string; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(type: string, animationEventInitDict?: AnimationEventInit): AnimationEvent; -}; - -interface AnimationFrameProvider { - cancelAnimationFrame(handle: number): void; - requestAnimationFrame(callback: FrameRequestCallback): number; -} - -interface AnimationPlaybackEvent extends Event { - readonly currentTime: number | null; - readonly timelineTime: number | null; -} - -declare var AnimationPlaybackEvent: { - prototype: AnimationPlaybackEvent; - new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent; -}; - -interface AnimationTimeline { - readonly currentTime: number | null; -} - -declare var AnimationTimeline: { - prototype: AnimationTimeline; - new(): AnimationTimeline; -}; - -interface ApplicationCacheEventMap { - "cached": Event; - "checking": Event; - "downloading": Event; - "error": Event; - "noupdate": Event; - "obsolete": Event; - "progress": ProgressEvent; - "updateready": Event; -} - -interface ApplicationCache extends EventTarget { - /** @deprecated */ - oncached: ((this: ApplicationCache, ev: Event) => any) | null; - /** @deprecated */ - onchecking: ((this: ApplicationCache, ev: Event) => any) | null; - /** @deprecated */ - ondownloading: ((this: ApplicationCache, ev: Event) => any) | null; - /** @deprecated */ - onerror: ((this: ApplicationCache, ev: Event) => any) | null; - /** @deprecated */ - onnoupdate: ((this: ApplicationCache, ev: Event) => any) | null; - /** @deprecated */ - onobsolete: ((this: ApplicationCache, ev: Event) => any) | null; - /** @deprecated */ - onprogress: ((this: ApplicationCache, ev: ProgressEvent) => any) | null; - /** @deprecated */ - onupdateready: ((this: ApplicationCache, ev: Event) => any) | null; - /** @deprecated */ - readonly status: number; - /** @deprecated */ - abort(): void; - /** @deprecated */ - swapCache(): void; - /** @deprecated */ - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -}; - -/** A DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */ -interface Attr extends Node { - readonly localName: string; - readonly name: string; - readonly namespaceURI: string | null; - readonly ownerDocument: Document; - readonly ownerElement: Element | null; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -}; - -/** A short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. */ -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, bufferOffset?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, bufferOffset?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(options: AudioBufferOptions): AudioBuffer; -}; - -/** An AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */ -interface AudioBufferSourceNode extends AudioScheduledSourceNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(context: BaseAudioContext, options?: AudioBufferSourceOptions): AudioBufferSourceNode; -}; - -/** An audio-processing graph built from audio modules linked together, each represented by an AudioNode. */ -interface AudioContext extends BaseAudioContext { - readonly baseLatency: number; - readonly outputLatency: number; - close(): Promise; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamDestination(): MediaStreamAudioDestinationNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createMediaStreamTrackSource(mediaStreamTrack: MediaStreamTrack): MediaStreamTrackAudioSourceNode; - getOutputTimestamp(): AudioTimestamp; - resume(): Promise; - suspend(): Promise; - addEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var AudioContext: { - prototype: AudioContext; - new(contextOptions?: AudioContextOptions): AudioContext; -}; - -/** AudioDestinationNode has no output (as it is the output, no more AudioNode can be linked after it in the audio graph) and one input. The number of channels in the input must be between 0 and the maxChannelCount value or an exception is raised. */ -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -}; - -/** The position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */ -interface AudioListener { - readonly forwardX: AudioParam; - readonly forwardY: AudioParam; - readonly forwardZ: AudioParam; - readonly positionX: AudioParam; - readonly positionY: AudioParam; - readonly positionZ: AudioParam; - readonly upX: AudioParam; - readonly upY: AudioParam; - readonly upZ: AudioParam; - /** @deprecated */ - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - /** @deprecated */ - setPosition(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -}; - -/** A generic interface for representing an audio processing module. Examples include: */ -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: ChannelCountMode; - channelInterpretation: ChannelInterpretation; - readonly context: BaseAudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode; - connect(destinationParam: AudioParam, output?: number): void; - disconnect(): void; - disconnect(output: number): void; - disconnect(destinationNode: AudioNode): void; - disconnect(destinationNode: AudioNode, output: number): void; - disconnect(destinationNode: AudioNode, output: number, input: number): void; - disconnect(destinationParam: AudioParam): void; - disconnect(destinationParam: AudioParam, output: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -}; - -/** The Web Audio API's AudioParam interface represents an audio-related parameter, usually a parameter of an AudioNode (such as GainNode.gain). */ -interface AudioParam { - automationRate: AutomationRate; - readonly defaultValue: number; - readonly maxValue: number; - readonly minValue: number; - value: number; - cancelAndHoldAtTime(cancelTime: number): AudioParam; - cancelScheduledValues(cancelTime: number): AudioParam; - exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; - linearRampToValueAtTime(value: number, endTime: number): AudioParam; - setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; - setValueAtTime(value: number, startTime: number): AudioParam; - setValueCurveAtTime(values: number[] | Float32Array, startTime: number, duration: number): AudioParam; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -}; - -interface AudioParamMap { - forEach(callbackfn: (value: AudioParam, key: string, parent: AudioParamMap) => void, thisArg?: any): void; -} - -declare var AudioParamMap: { - prototype: AudioParamMap; - new(): AudioParamMap; -}; - -/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. - * @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet. - */ -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(type: string, eventInitDict: AudioProcessingEventInit): AudioProcessingEvent; -}; - -interface AudioScheduledSourceNodeEventMap { - "ended": Event; -} - -interface AudioScheduledSourceNode extends AudioNode { - onended: ((this: AudioScheduledSourceNode, ev: Event) => any) | null; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var AudioScheduledSourceNode: { - prototype: AudioScheduledSourceNode; - new(): AudioScheduledSourceNode; -}; - -interface AudioWorklet extends Worklet { -} - -declare var AudioWorklet: { - prototype: AudioWorklet; - new(): AudioWorklet; -}; - -interface AudioWorkletNodeEventMap { - "processorerror": Event; -} - -interface AudioWorkletNode extends AudioNode { - onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any) | null; - readonly parameters: AudioParamMap; - readonly port: MessagePort; - addEventListener(type: K, listener: (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var AudioWorkletNode: { - prototype: AudioWorkletNode; - new(context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode; -}; - -interface AuthenticatorAssertionResponse extends AuthenticatorResponse { - readonly authenticatorData: ArrayBuffer; - readonly signature: ArrayBuffer; - readonly userHandle: ArrayBuffer | null; -} - -declare var AuthenticatorAssertionResponse: { - prototype: AuthenticatorAssertionResponse; - new(): AuthenticatorAssertionResponse; -}; - -interface AuthenticatorAttestationResponse extends AuthenticatorResponse { - readonly attestationObject: ArrayBuffer; -} - -declare var AuthenticatorAttestationResponse: { - prototype: AuthenticatorAttestationResponse; - new(): AuthenticatorAttestationResponse; -}; - -interface AuthenticatorResponse { - readonly clientDataJSON: ArrayBuffer; -} - -declare var AuthenticatorResponse: { - prototype: AuthenticatorResponse; - new(): AuthenticatorResponse; -}; - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -}; - -interface BaseAudioContextEventMap { - "statechange": Event; -} - -interface BaseAudioContext extends EventTarget { - readonly audioWorklet: AudioWorklet; - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null; - readonly sampleRate: number; - readonly state: AudioContextState; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConstantSource(): ConstantSourceNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: number[] | Float32Array, imag: number[] | Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback | null, errorCallback?: DecodeErrorCallback | null): Promise; - addEventListener(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var BaseAudioContext: { - prototype: BaseAudioContext; - new(): BaseAudioContext; -}; - -/** The beforeunload event is fired when the window, the document and its resources are about to be unloaded. */ -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -}; - -interface BhxBrowser { - readonly lastError: DOMException; - checkMatchesGlobExpression(pattern: string, value: string): boolean; - checkMatchesUriExpression(pattern: string, value: string): boolean; - clearLastError(): void; - currentWindowId(): number; - fireExtensionApiTelemetry(functionName: string, isSucceeded: boolean, isSupported: boolean, errorString: string): void; - genericFunction(functionId: number, destination: any, parameters?: string, callbackId?: number): void; - genericSynchronousFunction(functionId: number, parameters?: string): string; - getExtensionId(): string; - getThisAddress(): any; - registerGenericFunctionCallbackHandler(callbackHandler: Function): void; - registerGenericListenerHandler(eventHandler: Function): void; - setLastError(parameters: string): void; - webPlatformGenericFunction(destination: any, parameters?: string, callbackId?: number): void; -} - -declare var BhxBrowser: { - prototype: BhxBrowser; - new(): BhxBrowser; -}; - -/** A simple low-order filter, and is created using the AudioContext.createBiquadFilter() method. It is an AudioNode that can represent different kinds of filters, tone control devices, and graphic equalizers. */ -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: BiquadFilterType; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(context: BaseAudioContext, options?: BiquadFilterOptions): BiquadFilterNode; -}; - -/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */ -interface Blob { - readonly size: number; - readonly type: string; - arrayBuffer(): Promise; - slice(start?: number, end?: number, contentType?: string): Blob; - stream(): ReadableStream; - text(): Promise; -} - -declare var Blob: { - prototype: Blob; - new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob; -}; - -interface Body { - readonly body: ReadableStream | null; - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - blob(): Promise; - formData(): Promise; - json(): Promise; - text(): Promise; -} - -interface BroadcastChannelEventMap { - "message": MessageEvent; - "messageerror": MessageEvent; -} - -interface BroadcastChannel extends EventTarget { - /** - * Returns the channel name (as passed to the constructor). - */ - readonly name: string; - onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; - onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; - /** - * Closes the BroadcastChannel object, opening it up to garbage collection. - */ - close(): void; - /** - * Sends the given message to other BroadcastChannel objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays. - */ - postMessage(message: any): void; - addEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var BroadcastChannel: { - prototype: BroadcastChannel; - new(name: string): BroadcastChannel; -}; - -/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ -interface ByteLengthQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; -} - -declare var ByteLengthQueuingStrategy: { - prototype: ByteLengthQueuingStrategy; - new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; -}; - -/** A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */ -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -}; - -/** A single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. */ -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -}; - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -}; - -/** Any CSS at-rule that contains other rules nested within it. */ -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index?: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -}; - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -}; - -/** An object representing a set of style for a given keyframe. It corresponds to the contains of a single keyframe of a @keyframes at-rule. It implements the CSSRule interface with a type value of 8 (CSSRule.KEYFRAME_RULE). */ -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -}; - -/** An object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). */ -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(select: string): void; - findRule(select: string): CSSKeyframeRule | null; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -}; - -/** A single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). */ -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -}; - -/** An object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). */ -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -}; - -/** CSSPageRule is an interface representing a single CSS @page rule. It implements the CSSRule interface with a type value of 6 (CSSRule.PAGE_RULE). */ -interface CSSPageRule extends CSSGroupingRule { - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -}; - -/** A single CSS rule. There are several types of rules, listed in the Type constants section below. */ -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule | null; - readonly parentStyleSheet: CSSStyleSheet | null; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; -}; - -/** A CSSRuleList is an (indirect-modify only) array-like object containing an ordered collection of CSSRule objects. */ -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule | null; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -}; - -/** An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. */ -interface CSSStyleDeclaration { - alignContent: string; - alignItems: string; - alignSelf: string; - alignmentBaseline: string; - all: string; - animation: string; - animationDelay: string; - animationDirection: string; - animationDuration: string; - animationFillMode: string; - animationIterationCount: string; - animationName: string; - animationPlayState: string; - animationTimingFunction: string; - backfaceVisibility: string; - background: string; - backgroundAttachment: string; - backgroundClip: string; - backgroundColor: string; - backgroundImage: string; - backgroundOrigin: string; - backgroundPosition: string; - backgroundPositionX: string; - backgroundPositionY: string; - backgroundRepeat: string; - backgroundSize: string; - baselineShift: string; - blockSize: string; - border: string; - borderBlockEnd: string; - borderBlockEndColor: string; - borderBlockEndStyle: string; - borderBlockEndWidth: string; - borderBlockStart: string; - borderBlockStartColor: string; - borderBlockStartStyle: string; - borderBlockStartWidth: string; - borderBottom: string; - borderBottomColor: string; - borderBottomLeftRadius: string; - borderBottomRightRadius: string; - borderBottomStyle: string; - borderBottomWidth: string; - borderCollapse: string; - borderColor: string; - borderImage: string; - borderImageOutset: string; - borderImageRepeat: string; - borderImageSlice: string; - borderImageSource: string; - borderImageWidth: string; - borderInlineEnd: string; - borderInlineEndColor: string; - borderInlineEndStyle: string; - borderInlineEndWidth: string; - borderInlineStart: string; - borderInlineStartColor: string; - borderInlineStartStyle: string; - borderInlineStartWidth: string; - borderLeft: string; - borderLeftColor: string; - borderLeftStyle: string; - borderLeftWidth: string; - borderRadius: string; - borderRight: string; - borderRightColor: string; - borderRightStyle: string; - borderRightWidth: string; - borderSpacing: string; - borderStyle: string; - borderTop: string; - borderTopColor: string; - borderTopLeftRadius: string; - borderTopRightRadius: string; - borderTopStyle: string; - borderTopWidth: string; - borderWidth: string; - bottom: string; - boxShadow: string; - boxSizing: string; - breakAfter: string; - breakBefore: string; - breakInside: string; - captionSide: string; - caretColor: string; - clear: string; - clip: string; - clipPath: string; - clipRule: string; - color: string; - colorInterpolation: string; - colorInterpolationFilters: string; - columnCount: string; - columnFill: string; - columnGap: string; - columnRule: string; - columnRuleColor: string; - columnRuleStyle: string; - columnRuleWidth: string; - columnSpan: string; - columnWidth: string; - columns: string; - content: string; - counterIncrement: string; - counterReset: string; - cssFloat: string; - cssText: string; - cursor: string; - direction: string; - display: string; - dominantBaseline: string; - emptyCells: string; - fill: string; - fillOpacity: string; - fillRule: string; - filter: string; - flex: string; - flexBasis: string; - flexDirection: string; - flexFlow: string; - flexGrow: string; - flexShrink: string; - flexWrap: string; - float: string; - floodColor: string; - floodOpacity: string; - font: string; - fontFamily: string; - fontFeatureSettings: string; - fontKerning: string; - fontSize: string; - fontSizeAdjust: string; - fontStretch: string; - fontStyle: string; - fontSynthesis: string; - fontVariant: string; - fontVariantCaps: string; - fontVariantEastAsian: string; - fontVariantLigatures: string; - fontVariantNumeric: string; - fontVariantPosition: string; - fontWeight: string; - gap: string; - glyphOrientationVertical: string; - grid: string; - gridArea: string; - gridAutoColumns: string; - gridAutoFlow: string; - gridAutoRows: string; - gridColumn: string; - gridColumnEnd: string; - gridColumnGap: string; - gridColumnStart: string; - gridGap: string; - gridRow: string; - gridRowEnd: string; - gridRowGap: string; - gridRowStart: string; - gridTemplate: string; - gridTemplateAreas: string; - gridTemplateColumns: string; - gridTemplateRows: string; - height: string; - hyphens: string; - imageOrientation: string; - imageRendering: string; - inlineSize: string; - justifyContent: string; - justifyItems: string; - justifySelf: string; - left: string; - readonly length: number; - letterSpacing: string; - lightingColor: string; - lineBreak: string; - lineHeight: string; - listStyle: string; - listStyleImage: string; - listStylePosition: string; - listStyleType: string; - margin: string; - marginBlockEnd: string; - marginBlockStart: string; - marginBottom: string; - marginInlineEnd: string; - marginInlineStart: string; - marginLeft: string; - marginRight: string; - marginTop: string; - marker: string; - markerEnd: string; - markerMid: string; - markerStart: string; - mask: string; - maskComposite: string; - maskImage: string; - maskPosition: string; - maskRepeat: string; - maskSize: string; - maskType: string; - maxBlockSize: string; - maxHeight: string; - maxInlineSize: string; - maxWidth: string; - minBlockSize: string; - minHeight: string; - minInlineSize: string; - minWidth: string; - objectFit: string; - objectPosition: string; - opacity: string; - order: string; - orphans: string; - outline: string; - outlineColor: string; - outlineOffset: string; - outlineStyle: string; - outlineWidth: string; - overflow: string; - overflowAnchor: string; - overflowWrap: string; - overflowX: string; - overflowY: string; - overscrollBehavior: string; - overscrollBehaviorBlock: string; - overscrollBehaviorInline: string; - overscrollBehaviorX: string; - overscrollBehaviorY: string; - padding: string; - paddingBlockEnd: string; - paddingBlockStart: string; - paddingBottom: string; - paddingInlineEnd: string; - paddingInlineStart: string; - paddingLeft: string; - paddingRight: string; - paddingTop: string; - pageBreakAfter: string; - pageBreakBefore: string; - pageBreakInside: string; - paintOrder: string; - readonly parentRule: CSSRule | null; - perspective: string; - perspectiveOrigin: string; - placeContent: string; - placeItems: string; - placeSelf: string; - pointerEvents: string; - position: string; - quotes: string; - resize: string; - right: string; - rotate: string; - rowGap: string; - rubyAlign: string; - rubyPosition: string; - scale: string; - scrollBehavior: string; - shapeRendering: string; - stopColor: string; - stopOpacity: string; - stroke: string; - strokeDasharray: string; - strokeDashoffset: string; - strokeLinecap: string; - strokeLinejoin: string; - strokeMiterlimit: string; - strokeOpacity: string; - strokeWidth: string; - tabSize: string; - tableLayout: string; - textAlign: string; - textAlignLast: string; - textAnchor: string; - textCombineUpright: string; - textDecoration: string; - textDecorationColor: string; - textDecorationLine: string; - textDecorationStyle: string; - textEmphasis: string; - textEmphasisColor: string; - textEmphasisPosition: string; - textEmphasisStyle: string; - textIndent: string; - textJustify: string; - textOrientation: string; - textOverflow: string; - textRendering: string; - textShadow: string; - textTransform: string; - textUnderlinePosition: string; - top: string; - touchAction: string; - transform: string; - transformBox: string; - transformOrigin: string; - transformStyle: string; - transition: string; - transitionDelay: string; - transitionDuration: string; - transitionProperty: string; - transitionTimingFunction: string; - translate: string; - unicodeBidi: string; - userSelect: string; - verticalAlign: string; - visibility: string; - /** @deprecated */ - webkitAlignContent: string; - /** @deprecated */ - webkitAlignItems: string; - /** @deprecated */ - webkitAlignSelf: string; - /** @deprecated */ - webkitAnimation: string; - /** @deprecated */ - webkitAnimationDelay: string; - /** @deprecated */ - webkitAnimationDirection: string; - /** @deprecated */ - webkitAnimationDuration: string; - /** @deprecated */ - webkitAnimationFillMode: string; - /** @deprecated */ - webkitAnimationIterationCount: string; - /** @deprecated */ - webkitAnimationName: string; - /** @deprecated */ - webkitAnimationPlayState: string; - /** @deprecated */ - webkitAnimationTimingFunction: string; - /** @deprecated */ - webkitAppearance: string; - /** @deprecated */ - webkitBackfaceVisibility: string; - /** @deprecated */ - webkitBackgroundClip: string; - /** @deprecated */ - webkitBackgroundOrigin: string; - /** @deprecated */ - webkitBackgroundSize: string; - /** @deprecated */ - webkitBorderBottomLeftRadius: string; - /** @deprecated */ - webkitBorderBottomRightRadius: string; - /** @deprecated */ - webkitBorderRadius: string; - /** @deprecated */ - webkitBorderTopLeftRadius: string; - /** @deprecated */ - webkitBorderTopRightRadius: string; - /** @deprecated */ - webkitBoxAlign: string; - /** @deprecated */ - webkitBoxFlex: string; - /** @deprecated */ - webkitBoxOrdinalGroup: string; - /** @deprecated */ - webkitBoxOrient: string; - /** @deprecated */ - webkitBoxPack: string; - /** @deprecated */ - webkitBoxShadow: string; - /** @deprecated */ - webkitBoxSizing: string; - /** @deprecated */ - webkitFilter: string; - /** @deprecated */ - webkitFlex: string; - /** @deprecated */ - webkitFlexBasis: string; - /** @deprecated */ - webkitFlexDirection: string; - /** @deprecated */ - webkitFlexFlow: string; - /** @deprecated */ - webkitFlexGrow: string; - /** @deprecated */ - webkitFlexShrink: string; - /** @deprecated */ - webkitFlexWrap: string; - /** @deprecated */ - webkitJustifyContent: string; - webkitLineClamp: string; - /** @deprecated */ - webkitMask: string; - /** @deprecated */ - webkitMaskBoxImage: string; - /** @deprecated */ - webkitMaskBoxImageOutset: string; - /** @deprecated */ - webkitMaskBoxImageRepeat: string; - /** @deprecated */ - webkitMaskBoxImageSlice: string; - /** @deprecated */ - webkitMaskBoxImageSource: string; - /** @deprecated */ - webkitMaskBoxImageWidth: string; - /** @deprecated */ - webkitMaskClip: string; - /** @deprecated */ - webkitMaskComposite: string; - /** @deprecated */ - webkitMaskImage: string; - /** @deprecated */ - webkitMaskOrigin: string; - /** @deprecated */ - webkitMaskPosition: string; - /** @deprecated */ - webkitMaskRepeat: string; - /** @deprecated */ - webkitMaskSize: string; - /** @deprecated */ - webkitOrder: string; - /** @deprecated */ - webkitPerspective: string; - /** @deprecated */ - webkitPerspectiveOrigin: string; - webkitTapHighlightColor: string; - /** @deprecated */ - webkitTextFillColor: string; - /** @deprecated */ - webkitTextSizeAdjust: string; - /** @deprecated */ - webkitTextStroke: string; - /** @deprecated */ - webkitTextStrokeColor: string; - /** @deprecated */ - webkitTextStrokeWidth: string; - /** @deprecated */ - webkitTransform: string; - /** @deprecated */ - webkitTransformOrigin: string; - /** @deprecated */ - webkitTransformStyle: string; - /** @deprecated */ - webkitTransition: string; - /** @deprecated */ - webkitTransitionDelay: string; - /** @deprecated */ - webkitTransitionDuration: string; - /** @deprecated */ - webkitTransitionProperty: string; - /** @deprecated */ - webkitTransitionTimingFunction: string; - /** @deprecated */ - webkitUserSelect: string; - whiteSpace: string; - widows: string; - width: string; - willChange: string; - wordBreak: string; - wordSpacing: string; - wordWrap: string; - writingMode: string; - zIndex: string; - /** @deprecated */ - zoom: string; - getPropertyPriority(property: string): string; - getPropertyValue(property: string): string; - item(index: number): string; - removeProperty(property: string): string; - setProperty(property: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -}; - -/** CSSStyleRule represents a single CSS style rule. It implements the CSSRule interface with a type value of 1 (CSSRule.STYLE_RULE). */ -interface CSSStyleRule extends CSSRule { - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -}; - -/** A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. */ -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - readonly ownerRule: CSSRule | null; - readonly rules: CSSRuleList; - addRule(selector?: string, style?: string, index?: number): number; - deleteRule(index: number): void; - insertRule(rule: string, index?: number): number; - removeRule(index?: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -}; - -/** An object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). */ -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -}; - -/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */ -interface Cache { - add(request: RequestInfo): Promise; - addAll(requests: RequestInfo[]): Promise; - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - keys(request?: RequestInfo, options?: CacheQueryOptions): Promise>; - match(request: RequestInfo, options?: CacheQueryOptions): Promise; - matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise>; - put(request: RequestInfo, response: Response): Promise; -} - -declare var Cache: { - prototype: Cache; - new(): Cache; -}; - -/** The storage for Cache objects. */ -interface CacheStorage { - delete(cacheName: string): Promise; - has(cacheName: string): Promise; - keys(): Promise; - match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise; - open(cacheName: string): Promise; -} - -declare var CacheStorage: { - prototype: CacheStorage; - new(): CacheStorage; -}; - -interface CanvasCompositing { - globalAlpha: number; - globalCompositeOperation: string; -} - -interface CanvasDrawImage { - drawImage(image: CanvasImageSource, dx: number, dy: number): void; - drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void; - drawImage(image: CanvasImageSource, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void; -} - -interface CanvasDrawPath { - beginPath(): void; - clip(fillRule?: CanvasFillRule): void; - clip(path: Path2D, fillRule?: CanvasFillRule): void; - fill(fillRule?: CanvasFillRule): void; - fill(path: Path2D, fillRule?: CanvasFillRule): void; - isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; - isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean; - isPointInStroke(x: number, y: number): boolean; - isPointInStroke(path: Path2D, x: number, y: number): boolean; - stroke(): void; - stroke(path: Path2D): void; -} - -interface CanvasFillStrokeStyles { - fillStyle: string | CanvasGradient | CanvasPattern; - strokeStyle: string | CanvasGradient | CanvasPattern; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; -} - -interface CanvasFilters { - filter: string; -} - -/** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */ -interface CanvasGradient { - /** - * Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end. - * - * Throws an "IndexSizeError" DOMException if the offset is out of range. Throws a "SyntaxError" DOMException if the color cannot be parsed. - */ - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -}; - -interface CanvasImageData { - createImageData(sw: number, sh: number): ImageData; - createImageData(imagedata: ImageData): ImageData; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - putImageData(imagedata: ImageData, dx: number, dy: number): void; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void; -} - -interface CanvasImageSmoothing { - imageSmoothingEnabled: boolean; - imageSmoothingQuality: ImageSmoothingQuality; -} - -interface CanvasPath { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface CanvasPathDrawingStyles { - lineCap: CanvasLineCap; - lineDashOffset: number; - lineJoin: CanvasLineJoin; - lineWidth: number; - miterLimit: number; - getLineDash(): number[]; - setLineDash(segments: number[]): void; -} - -/** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */ -interface CanvasPattern { - /** - * Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation. - */ - setTransform(transform?: DOMMatrix2DInit): void; -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -}; - -interface CanvasRect { - clearRect(x: number, y: number, w: number, h: number): void; - fillRect(x: number, y: number, w: number, h: number): void; - strokeRect(x: number, y: number, w: number, h: number): void; -} - -/** The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a element. It is used for drawing shapes, text, images, and other objects. */ -interface CanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface { - readonly canvas: HTMLCanvasElement; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -}; - -interface CanvasShadowStyles { - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; -} - -interface CanvasState { - restore(): void; - save(): void; -} - -interface CanvasText { - fillText(text: string, x: number, y: number, maxWidth?: number): void; - measureText(text: string): TextMetrics; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; -} - -interface CanvasTextDrawingStyles { - direction: CanvasDirection; - font: string; - textAlign: CanvasTextAlign; - textBaseline: CanvasTextBaseline; -} - -interface CanvasTransform { - getTransform(): DOMMatrix; - resetTransform(): void; - rotate(angle: number): void; - scale(x: number, y: number): void; - setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void; - setTransform(transform?: DOMMatrix2DInit): void; - transform(a: number, b: number, c: number, d: number, e: number, f: number): void; - translate(x: number, y: number): void; -} - -interface CanvasUserInterface { - drawFocusIfNeeded(element: Element): void; - drawFocusIfNeeded(path: Path2D, element: Element): void; - scrollPathIntoView(): void; - scrollPathIntoView(path: Path2D): void; -} - -interface CaretPosition { - readonly offset: number; - readonly offsetNode: Node; - getClientRect(): DOMRect | null; -} - -declare var CaretPosition: { - prototype: CaretPosition; - new(): CaretPosition; -}; - -/** The ChannelMergerNode interface, often used in conjunction with its opposite, ChannelSplitterNode, reunites different mono inputs into a single output. Each input is used to fill a channel of the output. This is useful for accessing each channels separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. */ -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(context: BaseAudioContext, options?: ChannelMergerOptions): ChannelMergerNode; -}; - -/** The ChannelSplitterNode interface, often used in conjunction with its opposite, ChannelMergerNode, separates the different channels of an audio source into a set of mono outputs. This is useful for accessing each channel separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. */ -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(context: BaseAudioContext, options?: ChannelSplitterOptions): ChannelSplitterNode; -}; - -/** The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren't any object of type CharacterData: it is implemented by other interfaces, like Text, Comment, or ProcessingInstruction which aren't abstract. */ -interface CharacterData extends Node, ChildNode, NonDocumentTypeChildNode { - data: string; - readonly length: number; - readonly ownerDocument: Document; - appendData(data: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, data: string): void; - replaceData(offset: number, count: number, data: string): void; - substringData(offset: number, count: number): string; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -}; - -interface ChildNode extends Node { - /** - * Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes. - * - * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. - */ - after(...nodes: (Node | string)[]): void; - /** - * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes. - * - * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. - */ - before(...nodes: (Node | string)[]): void; - /** - * Removes node. - */ - remove(): void; - /** - * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes. - * - * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. - */ - replaceWith(...nodes: (Node | string)[]): void; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -}; - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -}; - -interface Clipboard extends EventTarget { - readText(): Promise; - writeText(data: string): Promise; -} - -declare var Clipboard: { - prototype: Clipboard; - new(): Clipboard; -}; - -/** Events providing information related to modification of the clipboard, that is cut, copy, and paste events. */ -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer | null; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -}; - -/** A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. */ -interface CloseEvent extends Event { - /** - * Returns the WebSocket connection close code provided by the server. - */ - readonly code: number; - /** - * Returns the WebSocket connection close reason provided by the server. - */ - readonly reason: string; - /** - * Returns true if the connection closed cleanly; false otherwise. - */ - readonly wasClean: boolean; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(type: string, eventInitDict?: CloseEventInit): CloseEvent; -}; - -/** Textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. */ -interface Comment extends CharacterData { -} - -declare var Comment: { - prototype: Comment; - new(data?: string): Comment; -}; - -/** The DOM CompositionEvent represents events that occur due to the user indirectly entering text. */ -interface CompositionEvent extends UIEvent { - readonly data: string; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(type: string, eventInitDict?: CompositionEventInit): CompositionEvent; -}; - -interface ConcatParams extends Algorithm { - algorithmId: Uint8Array; - hash?: string | Algorithm; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - privateInfo?: Uint8Array; - publicInfo?: Uint8Array; -} - -interface ConstantSourceNode extends AudioScheduledSourceNode { - readonly offset: AudioParam; - addEventListener(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var ConstantSourceNode: { - prototype: ConstantSourceNode; - new(context: BaseAudioContext, options?: ConstantSourceOptions): ConstantSourceNode; -}; - -/** An AudioNode that performs a Linear Convolution on a given AudioBuffer, often used to achieve a reverb effect. A ConvolverNode always has exactly one input and one output. */ -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(context: BaseAudioContext, options?: ConvolverOptions): ConvolverNode; -}; - -/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ -interface CountQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; -} - -declare var CountQueuingStrategy: { - prototype: CountQueuingStrategy; - new(init: QueuingStrategyInit): CountQueuingStrategy; -}; - -interface Credential { - readonly id: string; - readonly type: string; -} - -declare var Credential: { - prototype: Credential; - new(): Credential; -}; - -interface CredentialsContainer { - create(options?: CredentialCreationOptions): Promise; - get(options?: CredentialRequestOptions): Promise; - preventSilentAccess(): Promise; - store(credential: Credential): Promise; -} - -declare var CredentialsContainer: { - prototype: CredentialsContainer; - new(): CredentialsContainer; -}; - -/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ -interface Crypto { - readonly subtle: SubtleCrypto; - getRandomValues(array: T): T; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -}; - -/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */ -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: KeyType; - readonly usages: KeyUsage[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -}; - -/** The CryptoKeyPair dictionary of the Web Crypto API represents a key pair for an asymmetric cryptography algorithm, also known as a public-key algorithm. */ -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -}; - -interface CustomElementRegistry { - define(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void; - get(name: string): any; - upgrade(root: Node): void; - whenDefined(name: string): Promise; -} - -declare var CustomElementRegistry: { - prototype: CustomElementRegistry; - new(): CustomElementRegistry; -}; - -interface CustomEvent extends Event { - /** - * Returns any custom data event was created with. Typically used for synthetic events. - */ - readonly detail: T; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -}; - -/** An error object that contains an error name. */ -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -}; - -/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */ -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(message?: string, name?: string): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -}; - -/** An object providing methods which are not dependent on any particular document. Such an object is returned by the Document.implementation property. */ -interface DOMImplementation { - createDocument(namespace: string | null, qualifiedName: string | null, doctype?: DocumentType | null): XMLDocument; - createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; - createHTMLDocument(title?: string): Document; - /** @deprecated */ - hasFeature(...args: any[]): true; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -}; - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOMMatrix extends DOMMatrixReadOnly { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - invertSelf(): DOMMatrix; - multiplySelf(other?: DOMMatrixInit): DOMMatrix; - preMultiplySelf(other?: DOMMatrixInit): DOMMatrix; - rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; - rotateFromVectorSelf(x?: number, y?: number): DOMMatrix; - rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; - scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; - scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; - setMatrixValue(transformList: string): DOMMatrix; - skewXSelf(sx?: number): DOMMatrix; - skewYSelf(sy?: number): DOMMatrix; - translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix; -} - -declare var DOMMatrix: { - prototype: DOMMatrix; - new(init?: string | number[]): DOMMatrix; - fromFloat32Array(array32: Float32Array): DOMMatrix; - fromFloat64Array(array64: Float64Array): DOMMatrix; - fromMatrix(other?: DOMMatrixInit): DOMMatrix; -}; - -type SVGMatrix = DOMMatrix; -declare var SVGMatrix: typeof DOMMatrix; - -type WebKitCSSMatrix = DOMMatrix; -declare var WebKitCSSMatrix: typeof DOMMatrix; - -interface DOMMatrixReadOnly { - readonly a: number; - readonly b: number; - readonly c: number; - readonly d: number; - readonly e: number; - readonly f: number; - readonly is2D: boolean; - readonly isIdentity: boolean; - readonly m11: number; - readonly m12: number; - readonly m13: number; - readonly m14: number; - readonly m21: number; - readonly m22: number; - readonly m23: number; - readonly m24: number; - readonly m31: number; - readonly m32: number; - readonly m33: number; - readonly m34: number; - readonly m41: number; - readonly m42: number; - readonly m43: number; - readonly m44: number; - flipX(): DOMMatrix; - flipY(): DOMMatrix; - inverse(): DOMMatrix; - multiply(other?: DOMMatrixInit): DOMMatrix; - rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; - rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; - rotateFromVector(x?: number, y?: number): DOMMatrix; - scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; - scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; - /** @deprecated */ - scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix; - skewX(sx?: number): DOMMatrix; - skewY(sy?: number): DOMMatrix; - toFloat32Array(): Float32Array; - toFloat64Array(): Float64Array; - toJSON(): any; - transformPoint(point?: DOMPointInit): DOMPoint; - translate(tx?: number, ty?: number, tz?: number): DOMMatrix; - toString(): string; -} - -declare var DOMMatrixReadOnly: { - prototype: DOMMatrixReadOnly; - new(init?: string | number[]): DOMMatrixReadOnly; - fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; - fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; - fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly; - toString(): string; -}; - -/** Provides the ability to parse XML or HTML source code from a string into a DOM Document. */ -interface DOMParser { - /** - * Parses string using either the HTML or XML parser, according to type, and returns the resulting Document. type can be "text/html" (which will invoke the HTML parser), or any of "text/xml", "application/xml", "application/xhtml+xml", or "image/svg+xml" (which will invoke the XML parser). - * - * For the XML parser, if string cannot be parsed, then the returned Document will contain elements describing the resulting error. - * - * Note that script elements are not evaluated during parsing, and the resulting document's encoding will always be UTF-8. - * - * Values other than the above for type will cause a TypeError exception to be thrown. - */ - parseFromString(string: string, type: DOMParserSupportedType): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -}; - -interface DOMPoint extends DOMPointReadOnly { - w: number; - x: number; - y: number; - z: number; -} - -declare var DOMPoint: { - prototype: DOMPoint; - new(x?: number, y?: number, z?: number, w?: number): DOMPoint; - fromPoint(other?: DOMPointInit): DOMPoint; -}; - -type SVGPoint = DOMPoint; -declare var SVGPoint: typeof DOMPoint; - -interface DOMPointReadOnly { - readonly w: number; - readonly x: number; - readonly y: number; - readonly z: number; - matrixTransform(matrix?: DOMMatrixInit): DOMPoint; - toJSON(): any; -} - -declare var DOMPointReadOnly: { - prototype: DOMPointReadOnly; - new(x?: number, y?: number, z?: number, w?: number): DOMPointReadOnly; - fromPoint(other?: DOMPointInit): DOMPointReadOnly; -}; - -interface DOMQuad { - readonly p1: DOMPoint; - readonly p2: DOMPoint; - readonly p3: DOMPoint; - readonly p4: DOMPoint; - getBounds(): DOMRect; - toJSON(): any; -} - -declare var DOMQuad: { - prototype: DOMQuad; - new(p1?: DOMPointInit, p2?: DOMPointInit, p3?: DOMPointInit, p4?: DOMPointInit): DOMQuad; - fromQuad(other?: DOMQuadInit): DOMQuad; - fromRect(other?: DOMRectInit): DOMQuad; -}; - -interface DOMRect extends DOMRectReadOnly { - height: number; - width: number; - x: number; - y: number; -} - -declare var DOMRect: { - prototype: DOMRect; - new(x?: number, y?: number, width?: number, height?: number): DOMRect; - fromRect(other?: DOMRectInit): DOMRect; -}; - -type SVGRect = DOMRect; -declare var SVGRect: typeof DOMRect; - -interface DOMRectList { - readonly length: number; - item(index: number): DOMRect | null; - [index: number]: DOMRect; -} - -declare var DOMRectList: { - prototype: DOMRectList; - new(): DOMRectList; -}; - -interface DOMRectReadOnly { - readonly bottom: number; - readonly height: number; - readonly left: number; - readonly right: number; - readonly top: number; - readonly width: number; - readonly x: number; - readonly y: number; - toJSON(): any; -} - -declare var DOMRectReadOnly: { - prototype: DOMRectReadOnly; - new(x?: number, y?: number, width?: number, height?: number): DOMRectReadOnly; - fromRect(other?: DOMRectInit): DOMRectReadOnly; -}; - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -}; - -/** A type returned by some APIs which contains a list of DOMString (strings). */ -interface DOMStringList { - /** - * Returns the number of strings in strings. - */ - readonly length: number; - /** - * Returns true if strings contains string, and false otherwise. - */ - contains(string: string): boolean; - /** - * Returns the string with index index from strings. - */ - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -}; - -/** Used by the dataset HTML attribute to represent data for custom attributes added to elements. */ -interface DOMStringMap { - [name: string]: string | undefined; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -}; - -/** A set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive. */ -interface DOMTokenList { - /** - * Returns the number of tokens. - */ - readonly length: number; - /** - * Returns the associated set as string. - * - * Can be set, to change the associated attribute. - */ - value: string; - toString(): string; - /** - * Adds all arguments passed, except those already present. - * - * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. - * - * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. - */ - add(...tokens: string[]): void; - /** - * Returns true if token is present, and false otherwise. - */ - contains(token: string): boolean; - /** - * Returns the token with index index. - */ - item(index: number): string | null; - /** - * Removes arguments passed, if they are present. - * - * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. - * - * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. - */ - remove(...tokens: string[]): void; - /** - * Replaces token with newToken. - * - * Returns true if token was replaced with newToken, and false otherwise. - * - * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. - * - * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. - */ - replace(oldToken: string, newToken: string): void; - /** - * Returns true if token is in the associated attribute's supported tokens. Returns false otherwise. - * - * Throws a TypeError if the associated attribute has no supported tokens defined. - */ - supports(token: string): boolean; - /** - * If force is not given, "toggles" token, removing it if it's present and adding it if it's not present. If force is true, adds token (same as add()). If force is false, removes token (same as remove()). - * - * Returns true if token is now present, and false otherwise. - * - * Throws a "SyntaxError" DOMException if token is empty. - * - * Throws an "InvalidCharacterError" DOMException if token contains any spaces. - */ - toggle(token: string, force?: boolean): boolean; - forEach(callbackfn: (value: string, key: number, parent: DOMTokenList) => void, thisArg?: any): void; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -}; - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; - addEventListener(type: K, listener: (this: DataCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: DataCue, ev: TextTrackCueEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -}; - -/** Used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API. */ -interface DataTransfer { - /** - * Returns the kind of operation that is currently selected. If the kind of operation isn't one of those that is allowed by the effectAllowed attribute, then the operation will fail. - * - * Can be set, to change the selected operation. - * - * The possible values are "none", "copy", "link", and "move". - */ - dropEffect: "none" | "copy" | "link" | "move"; - /** - * Returns the kinds of operations that are to be allowed. - * - * Can be set (during the dragstart event), to change the allowed operations. - * - * The possible values are "none", "copy", "copyLink", "copyMove", "link", "linkMove", "move", "all", and "uninitialized", - */ - effectAllowed: "none" | "copy" | "copyLink" | "copyMove" | "link" | "linkMove" | "move" | "all" | "uninitialized"; - /** - * Returns a FileList of the files being dragged, if any. - */ - readonly files: FileList; - /** - * Returns a DataTransferItemList object, with the drag data. - */ - readonly items: DataTransferItemList; - /** - * Returns a frozen array listing the formats that were set in the dragstart event. In addition, if any files are being dragged, then one of the types will be the string "Files". - */ - readonly types: ReadonlyArray; - /** - * Removes the data of the specified formats. Removes all data if the argument is omitted. - */ - clearData(format?: string): void; - /** - * Returns the specified data. If there is no such data, returns the empty string. - */ - getData(format: string): string; - /** - * Adds the specified data. - */ - setData(format: string, data: string): void; - /** - * Uses the given element to update the drag feedback, replacing any previously specified feedback. - */ - setDragImage(image: Element, x: number, y: number): void; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -}; - -/** One drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object. */ -interface DataTransferItem { - /** - * Returns the drag data item kind, one of: "string", "file". - */ - readonly kind: string; - /** - * Returns the drag data item type string. - */ - readonly type: string; - /** - * Returns a File object, if the drag data item kind is File. - */ - getAsFile(): File | null; - /** - * Invokes the callback with the string data as the argument, if the drag data item kind is text. - */ - getAsString(callback: FunctionStringCallback | null): void; - webkitGetAsEntry(): any; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -}; - -/** A list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a dataTransfer property and that property is a DataTransferItemList. */ -interface DataTransferItemList { - /** - * Returns the number of items in the drag data store. - */ - readonly length: number; - /** - * Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be provided also. - */ - add(data: string, type: string): DataTransferItem | null; - add(data: File): DataTransferItem | null; - /** - * Removes all the entries in the drag data store. - */ - clear(): void; - item(index: number): DataTransferItem; - /** - * Removes the indexth entry in the drag data store. - */ - remove(index: number): void; - [name: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -}; - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: MSWebViewPermissionType; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -}; - -/** A delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. */ -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(context: BaseAudioContext, options?: DelayOptions): DelayNode; -}; - -/** Provides information about the amount of acceleration the device is experiencing along all three axes. */ -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -}; - -/** The DeviceLightEvent provides web developers with information from photo sensors or similiar detectors about ambient light levels near the device. For example this may be useful to adjust the screen's brightness based on the current ambient light level in order to save energy or provide better readability. */ -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(typeArg: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -}; - -/** The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. */ -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceMotionEventAcceleration | null; - readonly accelerationIncludingGravity: DeviceMotionEventAcceleration | null; - readonly interval: number; - readonly rotationRate: DeviceMotionEventRotationRate | null; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; - requestPermission(): Promise; -}; - -interface DeviceMotionEventAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -interface DeviceMotionEventRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -/** The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. */ -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(type: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent; - requestPermission(): Promise; -}; - -/** Provides information about the rate at which the device is rotating around all three axes. */ -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -}; - -interface DhImportKeyParams extends Algorithm { - generator: Uint8Array; - prime: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - generator: Uint8Array; - prime: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhKeyGenParams extends Algorithm { - generator: Uint8Array; - prime: Uint8Array; -} - -interface DocumentEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap { - "fullscreenchange": Event; - "fullscreenerror": Event; - "pointerlockchange": Event; - "pointerlockerror": Event; - "readystatechange": Event; - "visibilitychange": Event; -} - -/** Any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. */ -interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShadowRoot, GlobalEventHandlers, NonElementParentNode, ParentNode, XPathEvaluatorBase { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Sets or gets the color of all active links in the document. - */ - /** @deprecated */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - /** @deprecated */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - /** @deprecated */ - readonly anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - /** @deprecated */ - readonly applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - /** @deprecated */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - /** - * Returns document's encoding. - */ - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - readonly charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - /** - * Returns document's content type. - */ - readonly contentType: string; - /** - * Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned. - * - * Can be set, to add a new cookie to the element's set of HTTP cookies. - * - * If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute), a "SecurityError" DOMException will be thrown on getting and setting. - */ - cookie: string; - /** - * Returns the script element, or the SVG script element, that is currently executing, as long as the element represents a classic script. In the case of reentrant script execution, returns the one that most recently started executing amongst those that have not yet finished executing. - * - * Returns null if the Document is not currently executing a script or SVG script element (e.g., because the running script is an event handler, or a timeout), or if the currently executing script or SVG script element represents a module script. - */ - readonly currentScript: HTMLOrSVGScriptElement | null; - readonly defaultView: (WindowProxy & typeof globalThis) | null; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType | null; - /** - * Gets a reference to the root node of the document. - */ - readonly documentElement: HTMLElement; - /** - * Returns document's URL. - */ - readonly documentURI: string; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - readonly embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - /** @deprecated */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - readonly forms: HTMLCollectionOf; - /** @deprecated */ - readonly fullscreen: boolean; - /** - * Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise. - */ - readonly fullscreenEnabled: boolean; - /** - * Returns the head element. - */ - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - readonly images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - /** @deprecated */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - readonly links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - location: Location; - onfullscreenchange: ((this: Document, ev: Event) => any) | null; - onfullscreenerror: ((this: Document, ev: Event) => any) | null; - onpointerlockchange: ((this: Document, ev: Event) => any) | null; - onpointerlockerror: ((this: Document, ev: Event) => any) | null; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: ((this: Document, ev: Event) => any) | null; - onvisibilitychange: ((this: Document, ev: Event) => any) | null; - readonly ownerDocument: null; - /** - * Return an HTMLCollection of the embed elements in the Document. - */ - readonly plugins: HTMLCollectionOf; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: DocumentReadyState; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Retrieves a collection of all script objects in the document. - */ - readonly scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - readonly timeline: DocumentTimeline; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: VisibilityState; - /** - * Sets or gets the color of the links that the user has visited. - */ - /** @deprecated */ - vlinkColor: string; - /** - * Moves node from another document and returns it. - * - * If node is a document, throws a "NotSupportedError" DOMException or, if node is a shadow root, throws a "HierarchyRequestError" DOMException. - */ - adoptNode(source: T): T; - /** @deprecated */ - captureEvents(): void; - caretPositionFromPoint(x: number, y: number): CaretPosition | null; - /** @deprecated */ - caretRangeFromPoint(x: number, y: number): Range; - /** @deprecated */ - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(localName: string): Attr; - createAttributeNS(namespace: string | null, qualifiedName: string): Attr; - /** - * Returns a CDATASection node whose data is data. - */ - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; - /** @deprecated */ - createElement(tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; - createElement(tagName: string, options?: ElementCreationOptions): HTMLElement; - /** - * Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName. - * - * If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown. - * - * If one of the following conditions is true a "NamespaceError" DOMException will be thrown: - * - * localName does not match the QName production. - * Namespace prefix is not null and namespace is the empty string. - * Namespace prefix is "xml" and namespace is not the XML namespace. - * qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. - * namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns". - * - * When supplied, options's is can be used to create a customized built-in element. - */ - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement; - createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element; - createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element; - createEvent(eventInterface: "AnimationEvent"): AnimationEvent; - createEvent(eventInterface: "AnimationPlaybackEvent"): AnimationPlaybackEvent; - createEvent(eventInterface: "AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface: "BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface: "ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface: "CloseEvent"): CloseEvent; - createEvent(eventInterface: "CompositionEvent"): CompositionEvent; - createEvent(eventInterface: "CustomEvent"): CustomEvent; - createEvent(eventInterface: "DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface: "DragEvent"): DragEvent; - createEvent(eventInterface: "ErrorEvent"): ErrorEvent; - createEvent(eventInterface: "Event"): Event; - createEvent(eventInterface: "Events"): Event; - createEvent(eventInterface: "FocusEvent"): FocusEvent; - createEvent(eventInterface: "FocusNavigationEvent"): FocusNavigationEvent; - createEvent(eventInterface: "GamepadEvent"): GamepadEvent; - createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface: "InputEvent"): InputEvent; - createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface: "ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface: "MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface: "MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface: "MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface: "MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent; - createEvent(eventInterface: "MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface: "MediaStreamEvent"): MediaStreamEvent; - createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface: "MessageEvent"): MessageEvent; - createEvent(eventInterface: "MouseEvent"): MouseEvent; - createEvent(eventInterface: "MouseEvents"): MouseEvent; - createEvent(eventInterface: "MutationEvent"): MutationEvent; - createEvent(eventInterface: "MutationEvents"): MutationEvent; - createEvent(eventInterface: "OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface: "OverflowEvent"): OverflowEvent; - createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface: "PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; - createEvent(eventInterface: "PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface: "PointerEvent"): PointerEvent; - createEvent(eventInterface: "PopStateEvent"): PopStateEvent; - createEvent(eventInterface: "ProgressEvent"): ProgressEvent; - createEvent(eventInterface: "PromiseRejectionEvent"): PromiseRejectionEvent; - createEvent(eventInterface: "RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface: "RTCDataChannelEvent"): RTCDataChannelEvent; - createEvent(eventInterface: "RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface: "RTCErrorEvent"): RTCErrorEvent; - createEvent(eventInterface: "RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface: "RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface: "RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface: "RTCPeerConnectionIceErrorEvent"): RTCPeerConnectionIceErrorEvent; - createEvent(eventInterface: "RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; - createEvent(eventInterface: "RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface: "RTCStatsEvent"): RTCStatsEvent; - createEvent(eventInterface: "RTCTrackEvent"): RTCTrackEvent; - createEvent(eventInterface: "SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent; - createEvent(eventInterface: "ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent; - createEvent(eventInterface: "SpeechRecognitionErrorEvent"): SpeechRecognitionErrorEvent; - createEvent(eventInterface: "SpeechRecognitionEvent"): SpeechRecognitionEvent; - createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent; - createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent; - createEvent(eventInterface: "StorageEvent"): StorageEvent; - createEvent(eventInterface: "TextEvent"): TextEvent; - createEvent(eventInterface: "TouchEvent"): TouchEvent; - createEvent(eventInterface: "TrackEvent"): TrackEvent; - createEvent(eventInterface: "TransitionEvent"): TransitionEvent; - createEvent(eventInterface: "UIEvent"): UIEvent; - createEvent(eventInterface: "UIEvents"): UIEvent; - createEvent(eventInterface: "VRDisplayEvent"): VRDisplayEvent; - createEvent(eventInterface: "VRDisplayEvent "): VRDisplayEvent ; - createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface: "WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator; - /** - * Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown. - */ - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker; - /** @deprecated */ - createTreeWalker(root: Node, whatToShow: number, filter: NodeFilter | null, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element | null; - elementsFromPoint(x: number, y: number): Element[]; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: string): boolean; - /** - * Stops document's fullscreen element from being displayed fullscreen and resolves promise when done. - */ - exitFullscreen(): Promise; - exitPointerLock(): void; - getAnimations(): Animation[]; - /** - * Returns a reference to the first object with the specified value of the ID attribute. - * @param elementId String that specifies the ID value. - */ - getElementById(elementId: string): HTMLElement | null; - /** - * Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. - */ - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(qualifiedName: K): HTMLCollectionOf; - getElementsByTagName(qualifiedName: K): HTMLCollectionOf; - getElementsByTagName(qualifiedName: string): HTMLCollectionOf; - /** - * If namespace and localName are "*" returns a HTMLCollection of all descendant elements. - * - * If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName. - * - * If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace. - * - * Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName. - */ - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection | null; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - /** - * Returns a copy of node. If deep is true, the copy also includes the node's descendants. - * - * If node is a document or a shadow root, throws a "NotSupportedError" DOMException. - */ - importNode(importedNode: T, deep: boolean): T; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - /** @deprecated */ - releaseEvents(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...text: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...text: string[]): void; - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var Document: { - prototype: Document; - new(): Document; -}; - -interface DocumentAndElementEventHandlersEventMap { - "copy": ClipboardEvent; - "cut": ClipboardEvent; - "paste": ClipboardEvent; -} - -interface DocumentAndElementEventHandlers { - oncopy: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null; - oncut: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null; - onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null; - addEventListener(type: K, listener: (this: DocumentAndElementEventHandlers, ev: DocumentAndElementEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: DocumentAndElementEventHandlers, ev: DocumentAndElementEventHandlersEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -interface DocumentEvent { - createEvent(eventInterface: "AnimationEvent"): AnimationEvent; - createEvent(eventInterface: "AnimationPlaybackEvent"): AnimationPlaybackEvent; - createEvent(eventInterface: "AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface: "BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface: "ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface: "CloseEvent"): CloseEvent; - createEvent(eventInterface: "CompositionEvent"): CompositionEvent; - createEvent(eventInterface: "CustomEvent"): CustomEvent; - createEvent(eventInterface: "DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface: "DragEvent"): DragEvent; - createEvent(eventInterface: "ErrorEvent"): ErrorEvent; - createEvent(eventInterface: "Event"): Event; - createEvent(eventInterface: "Events"): Event; - createEvent(eventInterface: "FocusEvent"): FocusEvent; - createEvent(eventInterface: "FocusNavigationEvent"): FocusNavigationEvent; - createEvent(eventInterface: "GamepadEvent"): GamepadEvent; - createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface: "InputEvent"): InputEvent; - createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface: "ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface: "MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface: "MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface: "MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface: "MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent; - createEvent(eventInterface: "MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface: "MediaStreamEvent"): MediaStreamEvent; - createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface: "MessageEvent"): MessageEvent; - createEvent(eventInterface: "MouseEvent"): MouseEvent; - createEvent(eventInterface: "MouseEvents"): MouseEvent; - createEvent(eventInterface: "MutationEvent"): MutationEvent; - createEvent(eventInterface: "MutationEvents"): MutationEvent; - createEvent(eventInterface: "OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface: "OverflowEvent"): OverflowEvent; - createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface: "PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; - createEvent(eventInterface: "PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface: "PointerEvent"): PointerEvent; - createEvent(eventInterface: "PopStateEvent"): PopStateEvent; - createEvent(eventInterface: "ProgressEvent"): ProgressEvent; - createEvent(eventInterface: "PromiseRejectionEvent"): PromiseRejectionEvent; - createEvent(eventInterface: "RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface: "RTCDataChannelEvent"): RTCDataChannelEvent; - createEvent(eventInterface: "RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface: "RTCErrorEvent"): RTCErrorEvent; - createEvent(eventInterface: "RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface: "RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface: "RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface: "RTCPeerConnectionIceErrorEvent"): RTCPeerConnectionIceErrorEvent; - createEvent(eventInterface: "RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; - createEvent(eventInterface: "RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface: "RTCStatsEvent"): RTCStatsEvent; - createEvent(eventInterface: "RTCTrackEvent"): RTCTrackEvent; - createEvent(eventInterface: "SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent; - createEvent(eventInterface: "ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent; - createEvent(eventInterface: "SpeechRecognitionErrorEvent"): SpeechRecognitionErrorEvent; - createEvent(eventInterface: "SpeechRecognitionEvent"): SpeechRecognitionEvent; - createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent; - createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent; - createEvent(eventInterface: "StorageEvent"): StorageEvent; - createEvent(eventInterface: "TextEvent"): TextEvent; - createEvent(eventInterface: "TouchEvent"): TouchEvent; - createEvent(eventInterface: "TrackEvent"): TrackEvent; - createEvent(eventInterface: "TransitionEvent"): TransitionEvent; - createEvent(eventInterface: "UIEvent"): UIEvent; - createEvent(eventInterface: "UIEvents"): UIEvent; - createEvent(eventInterface: "VRDisplayEvent"): VRDisplayEvent; - createEvent(eventInterface: "VRDisplayEvent "): VRDisplayEvent ; - createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface: "WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -/** A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. */ -interface DocumentFragment extends Node, NonElementParentNode, ParentNode { - readonly ownerDocument: Document; - getElementById(elementId: string): HTMLElement | null; -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -}; - -interface DocumentOrShadowRoot { - readonly activeElement: Element | null; - /** - * Returns document's fullscreen element. - */ - readonly fullscreenElement: Element | null; - readonly pointerLockElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - caretPositionFromPoint(x: number, y: number): CaretPosition | null; - /** @deprecated */ - caretRangeFromPoint(x: number, y: number): Range; - elementFromPoint(x: number, y: number): Element | null; - elementsFromPoint(x: number, y: number): Element[]; - getSelection(): Selection | null; -} - -interface DocumentTimeline extends AnimationTimeline { -} - -declare var DocumentTimeline: { - prototype: DocumentTimeline; - new(options?: DocumentTimelineOptions): DocumentTimeline; -}; - -/** A Node containing a doctype. */ -interface DocumentType extends Node, ChildNode { - readonly name: string; - readonly ownerDocument: Document; - readonly publicId: string; - readonly systemId: string; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -}; - -/** A DOM event that represents a drag and drop interaction. The user initiates a drag by placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location (such as another DOM element). Applications are free to interpret a drag and drop interaction in an application-specific way. */ -interface DragEvent extends MouseEvent { - /** - * Returns the DataTransfer object for the event. - */ - readonly dataTransfer: DataTransfer | null; -} - -declare var DragEvent: { - prototype: DragEvent; - new(type: string, eventInitDict?: DragEventInit): DragEvent; -}; - -/** Inherits properties from its parent, AudioNode. */ -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: number; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(context: BaseAudioContext, options?: DynamicsCompressorOptions): DynamicsCompressorNode; -}; - -interface EXT_blend_minmax { - readonly MAX_EXT: GLenum; - readonly MIN_EXT: GLenum; -} - -/** The EXT_frag_depth extension is part of the WebGL API and enables to set a depth value of a fragment from within the fragment shader. */ -interface EXT_frag_depth { -} - -interface EXT_sRGB { - readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: GLenum; - readonly SRGB8_ALPHA8_EXT: GLenum; - readonly SRGB_ALPHA_EXT: GLenum; - readonly SRGB_EXT: GLenum; -} - -interface EXT_shader_texture_lod { -} - -/** The EXT_texture_filter_anisotropic extension is part of the WebGL API and exposes two constants for anisotropic filtering (AF). */ -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: GLenum; - readonly TEXTURE_MAX_ANISOTROPY_EXT: GLenum; -} - -interface ElementEventMap { - "fullscreenchange": Event; - "fullscreenerror": Event; -} - -/** Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. */ -interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTypeChildNode, ParentNode, Slottable { - readonly attributes: NamedNodeMap; - /** - * Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. - */ - readonly classList: DOMTokenList; - /** - * Returns the value of element's class content attribute. Can be set to change it. - */ - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - /** - * Returns the value of element's id content attribute. Can be set to change it. - */ - id: string; - /** - * Returns the local name. - */ - readonly localName: string; - /** - * Returns the namespace. - */ - readonly namespaceURI: string | null; - onfullscreenchange: ((this: Element, ev: Event) => any) | null; - onfullscreenerror: ((this: Element, ev: Event) => any) | null; - outerHTML: string; - readonly ownerDocument: Document; - /** - * Returns the namespace prefix. - */ - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - /** - * Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. - */ - readonly shadowRoot: ShadowRoot | null; - /** - * Returns the value of element's slot content attribute. Can be set to change it. - */ - slot: string; - /** - * Returns the HTML-uppercased qualified name. - */ - readonly tagName: string; - /** - * Creates a shadow root for element and returns it. - */ - attachShadow(init: ShadowRootInit): ShadowRoot; - /** - * Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. - */ - closest(selector: K): HTMLElementTagNameMap[K] | null; - closest(selector: K): SVGElementTagNameMap[K] | null; - closest(selector: string): E | null; - /** - * Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise. - */ - getAttribute(qualifiedName: string): string | null; - /** - * Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise. - */ - getAttributeNS(namespace: string | null, localName: string): string | null; - /** - * Returns the qualified names of all element's attributes. Can contain duplicates. - */ - getAttributeNames(): string[]; - getAttributeNode(qualifiedName: string): Attr | null; - getAttributeNodeNS(namespace: string | null, localName: string): Attr | null; - getBoundingClientRect(): DOMRect; - getClientRects(): DOMRectList; - /** - * Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. - */ - getElementsByClassName(classNames: string): HTMLCollectionOf; - getElementsByTagName(qualifiedName: K): HTMLCollectionOf; - getElementsByTagName(qualifiedName: K): HTMLCollectionOf; - getElementsByTagName(qualifiedName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns true if element has an attribute whose qualified name is qualifiedName, and false otherwise. - */ - hasAttribute(qualifiedName: string): boolean; - /** - * Returns true if element has an attribute whose namespace is namespace and local name is localName. - */ - hasAttributeNS(namespace: string | null, localName: string): boolean; - /** - * Returns true if element has attributes, and false otherwise. - */ - hasAttributes(): boolean; - hasPointerCapture(pointerId: number): boolean; - insertAdjacentElement(position: InsertPosition, insertedElement: Element): Element | null; - insertAdjacentHTML(where: InsertPosition, html: string): void; - insertAdjacentText(where: InsertPosition, text: string): void; - /** - * Returns true if matching selectors against element's root yields element, and false otherwise. - */ - matches(selectors: string): boolean; - msGetRegionContent(): any; - releasePointerCapture(pointerId: number): void; - /** - * Removes element's first attribute whose qualified name is qualifiedName. - */ - removeAttribute(qualifiedName: string): void; - /** - * Removes element's attribute whose namespace is namespace and local name is localName. - */ - removeAttributeNS(namespace: string | null, localName: string): void; - removeAttributeNode(attr: Attr): Attr; - /** - * Displays element fullscreen and resolves promise when done. - * - * When supplied, options's navigationUI member indicates whether showing navigation UI while in fullscreen is preferred or not. If set to "show", navigation simplicity is preferred over screen space, and if set to "hide", more screen space is preferred. User agents are always free to honor user preference over the application's. The default value "auto" indicates no application preference. - */ - requestFullscreen(options?: FullscreenOptions): Promise; - 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; - /** - * Sets the value of element's first attribute whose qualified name is qualifiedName to value. - */ - setAttribute(qualifiedName: string, value: string): void; - /** - * Sets the value of element's attribute whose namespace is namespace and local name is localName to value. - */ - setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void; - setAttributeNode(attr: Attr): Attr | null; - setAttributeNodeNS(attr: Attr): Attr | null; - setPointerCapture(pointerId: number): void; - /** - * If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName. - * - * Returns true if qualifiedName is now present, and false otherwise. - */ - toggleAttribute(qualifiedName: string, force?: boolean): boolean; - webkitMatchesSelector(selectors: string): boolean; - addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var Element: { - prototype: Element; - new(): Element; -}; - -interface ElementCSSInlineStyle { - readonly style: CSSStyleDeclaration; -} - -interface ElementContentEditable { - contentEditable: string; - enterKeyHint: string; - inputMode: string; - readonly isContentEditable: boolean; -} - -/** Events providing information related to errors in scripts or in files. */ -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent; -}; - -/** An event which takes place in the DOM. */ -interface Event { - /** - * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. - */ - readonly bubbles: boolean; - cancelBubble: boolean; - /** - * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. - */ - readonly cancelable: boolean; - /** - * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. - */ - readonly composed: boolean; - /** - * Returns the object whose event listener's callback is currently being invoked. - */ - readonly currentTarget: EventTarget | null; - /** - * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. - */ - readonly defaultPrevented: boolean; - /** - * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. - */ - readonly eventPhase: number; - /** - * Returns true if event was dispatched by the user agent, and false otherwise. - */ - readonly isTrusted: boolean; - returnValue: boolean; - /** @deprecated */ - readonly srcElement: EventTarget | null; - /** - * Returns the object to which event is dispatched (its target). - */ - readonly target: EventTarget | null; - /** - * Returns the event's timestamp as the number of milliseconds measured relative to the time origin. - */ - readonly timeStamp: number; - /** - * Returns the type of event, e.g. "click", "hashchange", or "submit". - */ - readonly type: string; - /** - * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. - */ - composedPath(): EventTarget[]; - initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; - /** - * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. - */ - preventDefault(): void; - /** - * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. - */ - stopImmediatePropagation(): void; - /** - * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. - */ - stopPropagation(): void; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; - readonly NONE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; - readonly NONE: number; -}; - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface EventSourceEventMap { - "error": Event; - "message": MessageEvent; - "open": Event; -} - -interface EventSource extends EventTarget { - onerror: ((this: EventSource, ev: Event) => any) | null; - onmessage: ((this: EventSource, ev: MessageEvent) => any) | null; - onopen: ((this: EventSource, ev: Event) => any) | null; - /** - * Returns the state of this EventSource object's connection. It can have the values described below. - */ - readonly readyState: number; - /** - * Returns the URL providing the event stream. - */ - readonly url: string; - /** - * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. - */ - readonly withCredentials: boolean; - /** - * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. - */ - close(): void; - readonly CLOSED: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var EventSource: { - prototype: EventSource; - new(url: string, eventSourceInitDict?: EventSourceInit): EventSource; - readonly CLOSED: number; - readonly CONNECTING: number; - readonly OPEN: number; -}; - -/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */ -interface EventTarget { - /** - * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. - * - * The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. - * - * When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. - * - * When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners. - * - * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. - * - * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. - */ - addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; - /** - * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. - */ - dispatchEvent(event: Event): boolean; - /** - * Removes the event listener in target's event listener list with the same type, callback, and options. - */ - removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -}; - -interface ExtensionScriptApis { - extensionIdToShortId(extensionId: string): number; - fireExtensionApiTelemetry(functionName: string, isSucceeded: boolean, isSupported: boolean, errorString: string): void; - genericFunction(routerAddress: any, parameters?: string, callbackId?: number): void; - genericSynchronousFunction(functionId: number, parameters?: string): string; - genericWebRuntimeCallout(to: any, from: any, payload: string): void; - getExtensionId(): string; - registerGenericFunctionCallbackHandler(callbackHandler: Function): void; - registerGenericPersistentCallbackHandler(callbackHandler: Function): void; - registerWebRuntimeCallbackHandler(handler: Function): any; -} - -declare var ExtensionScriptApis: { - prototype: ExtensionScriptApis; - new(): ExtensionScriptApis; -}; - -interface External { - /** @deprecated */ - AddSearchProvider(): void; - /** @deprecated */ - IsSearchProviderInstalled(): void; -} - -declare var External: { - prototype: External; - new(): External; -}; - -/** Provides information about files and allows JavaScript in a web page to access their content. */ -interface File extends Blob { - readonly lastModified: number; - readonly name: string; -} - -declare var File: { - prototype: File; - new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; -}; - -/** An object of this type is returned by the files property of the HTML element; this lets you access the list of files selected with the element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage. */ -interface FileList { - readonly length: number; - item(index: number): File | null; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -}; - -interface FileReaderEventMap { - "abort": ProgressEvent; - "error": ProgressEvent; - "load": ProgressEvent; - "loadend": ProgressEvent; - "loadstart": ProgressEvent; - "progress": ProgressEvent; -} - -/** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */ -interface FileReader extends EventTarget { - readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; - readonly readyState: number; - readonly result: string | ArrayBuffer | null; - abort(): void; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: number; - addEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: number; -}; - -/** Focus-related events like focus, blur, focusin, or focusout. */ -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget | null; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(type: string, eventInitDict?: FocusEventInit): FocusEvent; -}; - -interface FocusNavigationEvent extends Event { - readonly navigationReason: NavigationReason; - readonly originHeight: number; - readonly originLeft: number; - readonly originTop: number; - readonly originWidth: number; - requestFocus(): void; -} - -declare var FocusNavigationEvent: { - prototype: FocusNavigationEvent; - new(type: string, eventInitDict?: FocusNavigationEventInit): FocusNavigationEvent; -}; - -/** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */ -interface FormData { - append(name: string, value: string | Blob, fileName?: string): void; - delete(name: string): void; - get(name: string): FormDataEntryValue | null; - getAll(name: string): FormDataEntryValue[]; - has(name: string): boolean; - set(name: string, value: string | Blob, fileName?: string): void; - forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void; -} - -declare var FormData: { - prototype: FormData; - new(form?: HTMLFormElement): FormData; -}; - -/** A change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input and one output, both with the same number of channels. */ -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(context: BaseAudioContext, options?: GainOptions): GainNode; -}; - -/** This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. */ -interface Gamepad { - readonly axes: ReadonlyArray; - readonly buttons: ReadonlyArray; - readonly connected: boolean; - readonly hand: GamepadHand; - readonly hapticActuators: ReadonlyArray; - readonly id: string; - readonly index: number; - readonly mapping: GamepadMappingType; - readonly pose: GamepadPose | null; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -}; - -/** An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. */ -interface GamepadButton { - readonly pressed: boolean; - readonly touched: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -}; - -/** This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. */ -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(type: string, eventInitDict: GamepadEventInit): GamepadEvent; -}; - -/** This Gamepad API interface represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. */ -interface GamepadHapticActuator { - readonly type: GamepadHapticActuatorType; - pulse(value: number, duration: number): Promise; -} - -declare var GamepadHapticActuator: { - prototype: GamepadHapticActuator; - new(): GamepadHapticActuator; -}; - -/** This Gamepad API interface represents the pose of a WebVR controller at a given timestamp (which includes orientation, position, velocity, and acceleration information.) */ -interface GamepadPose { - readonly angularAcceleration: Float32Array | null; - readonly angularVelocity: Float32Array | null; - readonly hasOrientation: boolean; - readonly hasPosition: boolean; - readonly linearAcceleration: Float32Array | null; - readonly linearVelocity: Float32Array | null; - readonly orientation: Float32Array | null; - readonly position: Float32Array | null; -} - -declare var GamepadPose: { - prototype: GamepadPose; - new(): GamepadPose; -}; - -interface GenericTransformStream { - readonly readable: ReadableStream; - readonly writable: WritableStream; -} - -/** An object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location. */ -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -}; - -interface GeolocationCoordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var GeolocationCoordinates: { - prototype: GeolocationCoordinates; - new(): GeolocationCoordinates; -}; - -interface GeolocationPosition { - readonly coords: GeolocationCoordinates; - readonly timestamp: number; -} - -declare var GeolocationPosition: { - prototype: GeolocationPosition; - new(): GeolocationPosition; -}; - -interface GeolocationPositionError { - readonly code: number; - readonly message: string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var GeolocationPositionError: { - prototype: GeolocationPositionError; - new(): GeolocationPositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -}; - -interface GlobalEventHandlersEventMap { - "abort": UIEvent; - "animationcancel": AnimationEvent; - "animationend": AnimationEvent; - "animationiteration": AnimationEvent; - "animationstart": AnimationEvent; - "auxclick": MouseEvent; - "beforeinput": InputEvent; - "blur": FocusEvent; - "cancel": Event; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "close": Event; - "compositionend": CompositionEvent; - "compositionstart": CompositionEvent; - "compositionupdate": CompositionEvent; - "contextmenu": MouseEvent; - "cuechange": Event; - "dblclick": MouseEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragexit": Event; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": Event; - "error": ErrorEvent; - "focus": FocusEvent; - "focusin": FocusEvent; - "focusout": FocusEvent; - "gotpointercapture": PointerEvent; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "lostpointercapture": PointerEvent; - "mousedown": MouseEvent; - "mouseenter": MouseEvent; - "mouseleave": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "pause": Event; - "play": Event; - "playing": Event; - "pointercancel": PointerEvent; - "pointerdown": PointerEvent; - "pointerenter": PointerEvent; - "pointerleave": PointerEvent; - "pointermove": PointerEvent; - "pointerout": PointerEvent; - "pointerover": PointerEvent; - "pointerup": PointerEvent; - "progress": ProgressEvent; - "ratechange": Event; - "reset": Event; - "resize": UIEvent; - "scroll": Event; - "securitypolicyviolation": SecurityPolicyViolationEvent; - "seeked": Event; - "seeking": Event; - "select": Event; - "selectionchange": Event; - "selectstart": Event; - "stalled": Event; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "toggle": Event; - "touchcancel": TouchEvent; - "touchend": TouchEvent; - "touchmove": TouchEvent; - "touchstart": TouchEvent; - "transitioncancel": TransitionEvent; - "transitionend": TransitionEvent; - "transitionrun": TransitionEvent; - "transitionstart": TransitionEvent; - "volumechange": Event; - "waiting": Event; - "wheel": WheelEvent; -} - -interface GlobalEventHandlers { - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - 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: MouseEvent) => any) | null; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; - oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; - oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - ondragexit: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: OnErrorEventHandler; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; - ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; - oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null; - oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; - onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - 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; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null; - onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null; - onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null; - onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null; - onsubmit: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - 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; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null; - onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null; - addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -interface HTMLAllCollection { - /** - * Returns the number of elements in the collection. - */ - readonly length: number; - /** - * Returns the item with index index from the collection (determined by tree order). - */ - item(nameOrIndex?: string): HTMLCollection | Element | null; - /** - * Returns the item with ID or name name from the collection. - * - * If there are multiple matching items, then an HTMLCollection object containing all those elements is returned. - * - * Only button, form, iframe, input, map, meta, object, select, and textarea elements can have a name for the purpose of this method; their name is given by the value of their name attribute. - */ - namedItem(name: string): HTMLCollection | Element | null; - [index: number]: Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -}; - -/** Hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. */ -interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils { - /** - * Sets or retrieves the character set used to encode the object. - */ - /** @deprecated */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - /** @deprecated */ - coords: string; - download: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the shape of the object. - */ - /** @deprecated */ - name: string; - ping: string; - referrerPolicy: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - readonly relList: DOMTokenList; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - /** @deprecated */ - rev: string; - /** - * Sets or retrieves the shape of the object. - */ - /** @deprecated */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - addEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -}; - -interface HTMLAppletElement extends HTMLElement { - /** @deprecated */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - /** @deprecated */ - alt: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - /** @deprecated */ - archive: string; - /** @deprecated */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - /** @deprecated */ - codeBase: string; - readonly form: HTMLFormElement | null; - /** - * Sets or retrieves the height of the object. - */ - /** @deprecated */ - height: string; - /** @deprecated */ - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - /** @deprecated */ - name: string; - /** @deprecated */ - object: string; - /** @deprecated */ - vspace: number; - /** @deprecated */ - width: string; - addEventListener(type: K, listener: (this: HTMLAppletElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: HTMLAppletElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -}; - -/** Provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of elements. */ -interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - /** @deprecated */ - noHref: boolean; - ping: string; - referrerPolicy: string; - rel: string; - readonly relList: DOMTokenList; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; - removeEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -}; - -/** Provides access to the properties of