application-prototype
Version:
Application builder - prototype
1,626 lines (1,616 loc) • 116 kB
TypeScript
declare namespace async {
/**
* @callback AsyncConstructor
* @memberof async
* @returns {async.Async}
*/
type AsyncConstructor = () => async.Async;
}
declare namespace async {
/**
* @class
* @name Async
* @memberof async
*/
class Async {
/**
* return unique index identifier for an operation
* @method index
* @memberof async.Async#
* @returns {string}
*/
index(): string;
/**
* method used for return result for an operation,
* returns `true` if value was accepted.
* if operation already obtained a value
* then value is not accepted and it returns `false`
* @method receive
* @memberof async.Async#
* @param {string} id obtained from {@link async.Async#index}
* @param {any} args
* @returns {boolean}
*/
receive(id: string, args: any): boolean;
/**
* require to wait an additional operation
* @method wait
* @memberof async.Async#
*/
wait(): void;
/**
* require to reserve index {@link async.Async#index} for an additional operation
* @method reserve
* @memberof async.Async#
* @returns {string}
*/
reserve(): string;
/**
* require to run an operation
* @method run
* @memberof async.Async#
* @param {function():void} func function that should be executed
* @param {any[]} args
* @param {object} context
* @returns {string}
*/
run(func: (...params: any[]) => any, args: any[], context: any): string;
/**
* reset operation processing
* @method flush
* @memberof async.Async#
*/
flush(): void;
/**
* return how many operations are processing right now
* @method processing
* @memberof async.Async#
* @returns {number}
*/
processing(): number;
/**
* return operations' responses
* @method responses
* @memberof async.Async#
* @param {boolean} [returnUnknownResponses=false]
* @returns {any[][]}
*/
responses(returnUnknownResponses?: boolean): any[][];
/**
* return all errors found in responses
* @method errors
* @memberof async.Async#
* @returns {Error[]}
*/
errors(): Error[];
/**
* register a callback to be called when processing is done
* @method done
* @memberof async.Async#
* @param {function():void} cb
*/
done(cb: (...params: any[]) => any): void;
}
namespace Async {
/**
* @typedef {object} Operation
* @memberof async.Async
* @property {async.Async.OperationCallback} [0]
* @property {async.Async.OperationArgs} [1]
* @property {async.Async.OperationContext} [2]
* @property {async.Async.OperationCallbackIndex} [3]
*/
type Operation = {
0?: async.Async.OperationCallback;
1?: async.Async.OperationArgs;
2?: async.Async.OperationContext;
3?: async.Async.OperationCallbackIndex;
};
/**
* a function that represents the operation itself, it have as argument `next` callback, by default it is first.
* @typedef {Function} OperationCallback
* @memberof async.Async
*/
type OperationCallback = () => void;
/**
* list if arguments passed to `OperationCallback`.
* @typedef {any[]} OperationArgs
* @memberof async.Async
*/
type OperationArgs = any[];
/**
* context that should be used in `OperationCallback`. Default value is `{}`.
* @typedef {object} OperationContext
* @memberof async.Async
*/
type OperationContext = any;
/**
* index of `next()` callback in list of `OperationCallback`'s arguments. Default value is `0`.
* @typedef {number} OperationCallbackIndex
* @memberof async.Async
*/
type OperationCallbackIndex = number;
/**
* @typedef {async.Async.Operation[]} Operations
* @memberof async.Async
*/
type Operations = async.Async.Operation[];
}
/**
* @callback async.processCallback
* @param {function(Error?): void} next
* @param {any} item
* @param {number} index
* @param {any[]} items
*/
type processCallback = (next: (...params: any[]) => any, item: any, index: number, items: any[]) => void;
/**
* @callback async.doneCallback
* @this async.Async
*/
type doneCallback = () => void;
/**
* @method flow
* @memberof async.
* @param {async.Async.Operations} operations
* @param {async.doneCallback} cb
* @param {number} [timeout=0] timeout between operations
* @returns {async.Async}
*/
function flow(operations: async.Async.Operations, cb: async.doneCallback, timeout?: number): async.Async;
/**
* @method waterfall
* @memberof async.
* @param {async.Async.Operations} operations
* @param {async.doneCallback} cb
* @param {number} [parallel=27] number of operations that can be done in parallel
* @param {number} [timeout=0] timeout between operations
* @returns {async.Async}
*/
function waterfall(operations: async.Async.Operations, cb: async.doneCallback, parallel?: number, timeout?: number): async.Async;
/**
* @method map
* @memberof async.
* @param {any[]} operations
* @param {async.processCallback}
* @param {async.doneCallback} cb
* @param {number} [timeout=0] timeout between operations
* @returns {async.Async}
*/
function map(operations: any[], cb: async.doneCallback, timeout?: number): async.Async;
/**
* @method flow_map
* @memberof async.
* @param {any[]} operations
* @param {async.processCallback}
* @param {async.doneCallback} cb
* @param {number} [timeout=0] timeout between operations
* @returns {async.Async}
*/
function flow_map(operations: any[], cb: async.doneCallback, timeout?: number): async.Async;
/**
* @method waterfall_map
* @memberof async.
* @param {any[]} operations
* @param {async.processCallback}
* @param {async.doneCallback} cb
* @param {number} [parallel=27] number of operations that can be done in parallel
* @param {number} [timeout=0] timeout between operations
* @returns {async.Async}
*/
function waterfall_map(operations: any[], cb: async.doneCallback, parallel?: number, timeout?: number): async.Async;
}
/**
* Module used processing data asynchronous
* @example
* Application.require('async').then(function (asyncOperations) {
* // @TODO
* }, console.error);
* @interface async
* @returns {async.AsyncConstructor}
* @see async.Async
*/
declare interface async {
}
declare namespace BrowserSessionModule {
/**
* @method getItem
* @memberof BrowserSessionModule
* @param {string} key
* @param {boolean} returnResult
* @returns {Promise<any>}
*/
function getItem(key: string, returnResult: boolean): Promise<any>;
/**
* @method setItem
* @memberof BrowserSessionModule
* @param {string} key
* @param {any} val
* @param {boolean} returnResult
* @returns {Promise<any>}
*/
function setItem(key: string, val: any, returnResult: boolean): Promise<any>;
/**
* @method removeItem
* @memberof BrowserSessionModule
* @param {string} key
* @param {boolean} returnResult
* @returns {Promise<any>}
*/
function removeItem(key: string, returnResult: boolean): Promise<any>;
/**
* @method getItems
* @memberof BrowserSessionModule
* @param {string[]} keys
* @returns {Promise<Object<string,any>>}
*/
function getItems(keys: string[]): Promise<{
[key: string]: any;
}>;
/**
* @method setItems
* @memberof BrowserSessionModule
* @param {Object<string,any>} obj
* @returns {Promise<any[]>}
*/
function setItems(obj: {
[key: string]: any;
}): Promise<any[]>;
/**
* @method removeItems
* @memberof BrowserSessionModule
* @param {string[]} keys
* @returns {Promise<any[]>}
*/
function removeItems(keys: string[]): Promise<any[]>;
/**
* @method findItems
* @memberof BrowserSessionModule
* @param {function(any):boolean} filter
* @returns {Promise<Object<string,any>>}
*/
function findItems(filter: (...params: any[]) => any): Promise<{
[key: string]: any;
}>;
/**
* @method clear
* @memberof BrowserSessionModule
* @returns {Promise<any>}
*/
function clear(): Promise<any>;
}
/**
* browserSessionBuilder description
* @interface BrowserSessionModule
* @param {string|object} objectStoreArg name or object of strategyStore
* @param {object} [objectStoreConf]
*/
declare interface BrowserSessionModule {
}
declare namespace ExtensionsPrototype {
/**
* @var {object} fn
* @memberof ExtensionsPrototype
* @property {ExtensionsPrototype.WindowFunctions} window
* @property {ExtensionsPrototype.MouseFunctions} mouse
* @property {(ExtensionsPrototype.getRandId_1|ExtensionsPrototype.getRandId_2)} getRandId
*/
var fn: {
window: ExtensionsPrototype.WindowFunctions;
mouse: ExtensionsPrototype.MouseFunctions;
getRandId: ExtensionsPrototype.getRandId_1 | ExtensionsPrototype.getRandId_2;
};
/**
* @typedef {object} WindowFunctions
* @memberof ExtensionsPrototype
* @property {object} sizeLimit
* @property {ExtensionsPrototype.windowSizeCache} sizeLimit.min
* @property {ExtensionsPrototype.windowSizeCache} sizeLimit.max
* @property {number} [refreshRate=200] how often to recalculate window size
* @property {ExtensionsPrototype.windowSizeActive} sizeActive
* @property {ExtensionsPrototype.windowSize} size
*/
type WindowFunctions = {
sizeLimit: {
min: ExtensionsPrototype.windowSizeCache;
max: ExtensionsPrototype.windowSizeCache;
};
refreshRate?: number;
sizeActive: ExtensionsPrototype.windowSizeActive;
size: ExtensionsPrototype.windowSize;
};
/**
* @typedef {object} MouseFunctions
* @memberof ExtensionsPrototype
* @property {MouseEvent} event
* @property {ExtensionsPrototype.MousePosition} position
* @property {object} config
* @property {boolean} config.tracking
*/
type MouseFunctions = {
event: MouseEvent;
position: ExtensionsPrototype.MousePosition;
config: {
tracking: boolean;
};
};
/**
* @var {object} object
* @property {(ExtensionsPrototype.ObjectExtend_1|ExtensionsPrototype.ObjectExtend_2)} extend
* @memberof ExtensionsPrototype
*/
var object: {
extend: ExtensionsPrototype.ObjectExtend_1 | ExtensionsPrototype.ObjectExtend_2;
};
/**
* @var {object} string
* @memberof ExtensionsPrototype
*/
var string: any;
/**
* @var {any} WindowExtend
* @memberof ExtensionsPrototype
* @example
* window.addEvent(elem, type, handler);
* window.removeEvent(elem, type, handlerId);
*
* window.addEventListener(eventName, function (event) {});
*/
var WindowExtend: any;
/**
* @callback getRandId_1
* @memberof ExtensionsPrototype
* @param {string} prefix
* @param {boolean} minimize
*/
type getRandId_1 = (prefix: string, minimize: boolean) => void;
/**
* @callback getRandId_2
* @memberof ExtensionsPrototype
* @param {boolean} minimize
*/
type getRandId_2 = (minimize: boolean) => void;
/**
* @typedef {object} windowSizeCache
* @memberof ExtensionsPrototype
* @property {number} w
* @property {number} h
*/
type windowSizeCache = {
w: number;
h: number;
};
/**
* @callback windowSizeActive
* @memberof ExtensionsPrototype
* @property {boolean} refreshed
* @returns {ExtensionsPrototype.windowSizeCache}
*/
type windowSizeActive = () => ExtensionsPrototype.windowSizeCache;
/**
* @callback windowSize
* @memberof ExtensionsPrototype
* @property {boolean} refreshed
* @returns {ExtensionsPrototype.windowSizeCache}
*/
type windowSize = () => ExtensionsPrototype.windowSizeCache;
/**
* @typedef {object} MousePositionCache
* @memberof ExtensionsPrototype
* @property {number} x
* @property {number} y
* @property {number} xmax
* @property {number} ymax
*/
type MousePositionCache = {
x: number;
y: number;
xmax: number;
ymax: number;
};
/**
* @callback MousePosition
* @memberof ExtensionsPrototype
* @param {MouseEvent} [eventMouseMove]
* @param {object} [context]
* @param {object} [context.window]
* @param {object} [context.document]
* @returns {ExtensionsPrototype.MousePositionCache}
*/
type MousePosition = (eventMouseMove?: MouseEvent, context?: {
window?: any;
document?: any;
}) => ExtensionsPrototype.MousePositionCache;
/**
* @callback ObjectExtend_1
* @memberof ExtensionsPrototype
* @param {object} object
* @param {object} options
* @param {any} options.value
* @param {boolean} [options.readonly=false]
* @param {boolean} [options.visible=false]
* @param {boolean} [options.config=false]
*/
type ObjectExtend_1 = (object: any, options: {
value: any;
readonly?: boolean;
visible?: boolean;
config?: boolean;
}) => void;
/**
* @callback ObjectExtend_2
* @memberof ExtensionsPrototype
* @param {object} object
* @param {object} options
* @param {function():void} [options.get]
* @param {function(any):void} [options.set]
* @param {boolean} [options.visible=false]
* @param {boolean} [options.config=false]
*/
type ObjectExtend_2 = (object: any, options: {
get?: (...params: any[]) => any;
set?: (...params: any[]) => any;
visible?: boolean;
config?: boolean;
}) => void;
/**
* @memberof ExtensionsPrototype
* @callback Function_runInWorker
* @param {any} result
* @param {Event} ev
* @returns {Worker}
*/
type Function_runInWorker = (result: any, ev: Event) => Worker;
/**
* @var {ExtensionsPrototype.slDOM} _
* @memberof ExtensionsPrototype
*/
var _: ExtensionsPrototype.slDOM;
/**
* @var {ExtensionsPrototype.slDOMSet} __
* @memberof ExtensionsPrototype
*/
var __: ExtensionsPrototype.slDOMSet;
/**
* @class
* @name slDOMSet
* @memberof ExtensionsPrototype
* @param {string} [cssSelector]
*/
class slDOMSet {
constructor(cssSelector?: string);
/**
* @method config
* @memberof ExtensionsPrototype.slDOMSet#
* @param {string} key
* @param {any} value
* @returns {ExtensionsPrototype.slDOMSet}
*/
config(key: string, value: any): ExtensionsPrototype.slDOMSet;
/**
* @method config
* @memberof ExtensionsPrototype.slDOMSet#
* @param {string} key
* @param {any} value
* @returns {ExtensionsPrototype.slDOMSet}
*/
config(key: string, value: any): ExtensionsPrototype.slDOMSet;
/**
* @method unique
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {ExtensionsPrototype.slDOMSet}
*/
unique(): ExtensionsPrototype.slDOMSet;
/**
* @method set
* @memberof ExtensionsPrototype.slDOMSet#
* @param {string} v css selector applied over document
* @returns {ExtensionsPrototype.slDOMSet}
*/
set(v: string): ExtensionsPrototype.slDOMSet;
/**
* @method set
* @memberof ExtensionsPrototype.slDOMSet#
* @param {string} v css selector applied over document
* @returns {ExtensionsPrototype.slDOMSet}
*/
set(v: string): ExtensionsPrototype.slDOMSet;
/**
* @method add
* @memberof ExtensionsPrototype.slDOMSet#
* @param {(NodeList|any)} ...v array of Nodes or HTMLElements
* @returns {ExtensionsPrototype.slDOMSet}
*/
add(): ExtensionsPrototype.slDOMSet;
/**
* @method env
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {ExtensionsPrototype.slDOM_env}
*/
env(): ExtensionsPrototype.slDOM_env;
/**
* @method get
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {(Node[])}
*/
get(): Node[];
/**
* @method get
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {(Node[])}
*/
get(): Node[];
/**
* @method eq
* @memberof ExtensionsPrototype.slDOMSet#
* @param {number} index
* @returns {ExtensionsPrototype.slDOMSet}
*/
eq(index: number): ExtensionsPrototype.slDOMSet;
/**
* @method find
* @memberof ExtensionsPrototype.slDOMSet#
* @param {string} cssSelector
* @returns {ExtensionsPrototype.slDOMSet}
*/
find(cssSelector: string): ExtensionsPrototype.slDOMSet;
/**
* @method filter
* @memberof ExtensionsPrototype.slDOMSet#
* @param {ExtensionsPrototype.slDOMSet.itemHandlerFilter} filterCallback
* @returns {ExtensionsPrototype.slDOMSet}
*/
filter(filterCallback: ExtensionsPrototype.slDOMSet.itemHandlerFilter): ExtensionsPrototype.slDOMSet;
/**
* @method each
* @memberof ExtensionsPrototype.slDOMSet#
* @param {ExtensionsPrototype.slDOMSet.itemHandler} filterCallback
* @returns {ExtensionsPrototype.slDOMSet}
*/
each(filterCallback: ExtensionsPrototype.slDOMSet.itemHandler): ExtensionsPrototype.slDOMSet;
/**
* @method map
* @memberof ExtensionsPrototype.slDOMSet#
* @param {ExtensionsPrototype.slDOMSet.itemHandlerMap} filterCallback
* @returns {ExtensionsPrototype.slDOMSet}
*/
map(filterCallback: ExtensionsPrototype.slDOMSet.itemHandlerMap): ExtensionsPrototype.slDOMSet;
/**
* @method attr
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {NamedNodeMap}
*/
attr(): NamedNodeMap;
/**
* @method attr
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {NamedNodeMap}
*/
attr(): NamedNodeMap;
/**
* @method attr
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {NamedNodeMap}
*/
attr(): NamedNodeMap;
/**
* @method attr
* @memberof ExtensionsPrototype.slDOMSet#
* @returns {NamedNodeMap}
*/
attr(): NamedNodeMap;
}
namespace slDOMSet {
/**
* @callback itemHandler
* @memberof ExtensionsPrototype.slDOMSet
* @param {Node} node
* @param {number} index
* @param {ExtensionsPrototype.slDOMSet} context
* @param {ExtensionsPrototype.slDOM} p
*/
type itemHandler = (node: Node, index: number, context: ExtensionsPrototype.slDOMSet, p: ExtensionsPrototype.slDOM) => void;
/**
* @callback itemHandlerFilter
* @memberof ExtensionsPrototype.slDOMSet
* @param {Node} node
* @param {number} index
* @param {ExtensionsPrototype.slDOMSet} context
* @param {ExtensionsPrototype.slDOM} p
* @returns {boolean}
*/
type itemHandlerFilter = (node: Node, index: number, context: ExtensionsPrototype.slDOMSet, p: ExtensionsPrototype.slDOM) => boolean;
/**
* @callback itemHandlerMap
* @memberof ExtensionsPrototype.slDOMSet
* @param {Node} node
* @param {number} index
* @param {ExtensionsPrototype.slDOMSet} context
* @param {ExtensionsPrototype.slDOM} p
* @returns {Node}
*/
type itemHandlerMap = (node: Node, index: number, context: ExtensionsPrototype.slDOMSet, p: ExtensionsPrototype.slDOM) => Node;
}
/**
* @typedef slDOM_env
* @memberof ExtensionsPrototype
* @property {boolean} gecko
* @property {boolean} old_ie
* @property {boolean} ie_lt8
* @property {boolean} ie_lt9
* @property {boolean} ie_gt10
* @property {boolean} ie
* @property {boolean} webkit
* @property {boolean} qtwebkit
* @property {boolean} chrome
* @property {boolean} opera
* @property {boolean} firefox
* @property {boolean} safari
* @property {boolean} khtml
* @property {boolean} mac_geLion
* @property {boolean} mac_geMountainLion
* @property {boolean} phantom
* @property {boolean} ios
* @property {boolean} mobile
* @property {boolean} mac
* @property {boolean} windows
* @property {Array|null} opera_version
* @property {boolean} flipCtrlCmd
* @property {boolean} captureMiddleClick
* @property {boolean} android
* @property {string|false} android_version
*/
type slDOM_env = {
gecko: boolean;
old_ie: boolean;
ie_lt8: boolean;
ie_lt9: boolean;
ie_gt10: boolean;
ie: boolean;
webkit: boolean;
qtwebkit: boolean;
chrome: boolean;
opera: boolean;
firefox: boolean;
safari: boolean;
khtml: boolean;
mac_geLion: boolean;
mac_geMountainLion: boolean;
phantom: boolean;
ios: boolean;
mobile: boolean;
mac: boolean;
windows: boolean;
opera_version: any[] | null;
flipCtrlCmd: boolean;
captureMiddleClick: boolean;
android: boolean;
android_version: string | false;
};
/**
* @typedef {Object<string,(string|number)>} slDOM_ObjectCSSProperties a list of proprieties mapped in a object, example: { fontSize: "10px", "white-space": "nowrap" }
* @memberof ExtensionsPrototype
*/
type slDOM_ObjectCSSProperties = {
[key: string]: string | number;
};
/**
* @typedef {Object<string,(string|number)>} slDOM_ObjectAttributes a list of proprieties mapped in a object, example: { fontSize: "10px", "white-space": "nowrap" }
* @memberof ExtensionsPrototype
*/
type slDOM_ObjectAttributes = {
[key: string]: string | number;
};
/**
* @typedef {object} slDOM returns a pointer that walks over DOM and applying needed operations
* @memberof ExtensionsPrototype
* @property {ExtensionsPrototype.slDOM_env} env Environment Flags
* @property {function(boolean):HTMLElement} __ if params is `true` then return document otherwise current HTMLElement
* @property {function(object):ExtensionsPrototype.slDOM} a2D apply Css Transforms on elements
* @property {function(number):ExtensionsPrototype.slDOM} opacity ( short form **o** ) change element opacity
* @property {function((HTMLElement|string)):ExtensionsPrototype.slDOM} setE ( short form **e** ) set a HTMLElement or Create Element for slDOM Pointer
* @property {function((string|string[]),string?,number?):ExtensionsPrototype.slDOM|boolean} sClass =slDOMlib.sClass;
* @property {function(...string):slDOM} setArg ( short form **A** ) set Attributes to HTMLElement, arguments order: `[ attribute, value, attribute, value ... ]`
* @property {function(HTMLElement):slDOM} adEto add current HTMLElement to other HTMLElement;
* @property {function(HTMLElement):slDOM} putBfto insert current HTMLElement before other HTMLElement
* @property {function(HTMLElement):slDOM} putAfto insert current HTMLElement after other HTMLElement
* @property {function((HTMLElement|string),string?,function?):slDOM} putBf =slDOMlib.putBf;
* @property {function(HTMLElement):slDOM} putAf =slDOMlib.putAf;
* @property {function((HTMLElement|string),string?,function?):slDOM} addE =slDOMlib.addE;
* @property {function((HTMLElement|string),string?,function?):slDOM} addB =slDOMlib.addB;
* @property {function(string):slDOM} addT ( short form **t** ) add text node to HTMLElement;
* @property {function(number):slDOM} [nextTo=1] ( short form **N** ) moving pointer forward to N neighbors
* @property {function(number):slDOM} [backTo=1] ( short form **B** ) moving pointer backward to N neighbors
* @property {function(number?):slDOM} nUP ( short form is U ) goes up on level in doom
* @property {function(number?):slDOM} nChild ( short form is **C** ) select the *N th* child element
* @property {function(number?):slDOM} getParentN ( short form is **P** ) select the *N th* parent element
* @property {function():slDOM} clearE ( short form is **d** ) remove all childObjects from node
* @property {function():slDOM} delE remove HTMLElement from its Parent
* @property {function(boolean):slDOM} copyE =slDOMlib.copyE;
* @property {function(string):slDOM} getParentTag =slDOMlib.getParentTag;
* @property {function(string,number,boolean,boolean):slDOM} getByTag =slDOMlib.getByTag;
* @property {function(string,number,boolean,boolean):slDOM} getByQuery =slDOMlib.getByQuery;
* @property {function(string):slDOM} getById =slDOMlib.getById;
* @property {function(string,boolean):Array<HTMLElement>} getTags =slDOMlib.getTags;
* @property {function(string,boolean):Array<HTMLElement>} getTagsByQuery =slDOMlib.getTagsByQuery;
* @property {function(string):slDOM} triger ( short form **T** ) trigger / emit an event on HTMLElement
* @property {function(string?):slDOM|HTMLElement|string} getE ( short form **_** ) return HTMLElement ;
* * if argument[0] is ".tag" return HTMLElement's tagname ;
* * if argument[0] is ".html" return HTML Content ;
* * if argument[0] is ".text" return Text Content ;
* * if argument[0] is "-attributeName" return HTMLElement's Attribute ;
* * if argument[0] is "!attributeName" remove HTMLElement's Attribute
* @property {function(ExtensionsPrototype.slDOM_ObjectCSSProperties): slDOM} setStyle ( short form **f** ) setting css proprieties to HTMLElement
* @property {function((ExtensionsPrototype.slDOM_ObjectAttributes | string[])): slDOM} setVar ( short form **V** ) set dot property on HTMLElement
* @property {function(...ExtensionsPrototype.slDOM_ObjectAttributes): slDOM} setObjVar ( short form **v** ) setting attributes to HTMLElement
* @property {function(ExtensionsPrototype.slDOM_ObjectCSSProperties): slDOM} setStyleSPEED ( short form **F** ) setting css proprieties to HTMLElement with normalizing values by adding units
* @property {function(): { x: number, y: number }} pagePXY ( short form **PXY** ) get element position on page
* @property {function(): Boolean} in_e check if HTMLElement is still attached to DOM ( Document Object Manager )
* @property {function(): { w: number, h: number }} g_wh returns width and height of HTMLElement
* @property {function((object | string), boolean, function, object): slDOM} getLIST =slDOMlib.getLIST;
* @property {function(function(HTMLElement, object, slDOM), object): slDOM} toFunction =slDOMlib.toFunction;
* @property {function(): slDOM} removeFromDOM ( short form **free** ) remove elements from DOM
* @property {function(number): slDOM} o ( short form **opacity** ) change element opacity
* @property {function((HTMLElement | string)): slDOM} E ( long form **setE** ) set a HTMLElement or Create Element for slDOM Pointer
* @property {*} c =slDOMlib.sClass;
* @property {function(string): Object} attrs = slDOMlib.attrs;
* @property {*} A =slDOMlib.setArg;
* @property {*} Et =slDOMlib.adEto;
* @property {*} Bt =slDOMlib.putBfto;
* @property {*} At =slDOMlib.putAfto;
* @property {*} pB =slDOMlib.putBf;
* @property {*} pA =slDOMlib.putAf;
* @property {*} e =slDOMlib.addE;
* @property {*} b =slDOMlib.addB;
* @property {*} t =slDOMlib.addT;
* @property {*} N =slDOMlib.nextTo;
* @property {*} B =slDOMlib.backTo;
* @property {*} U =slDOMlib.nUP;
* @property {*} C =slDOMlib.nChild;
* @property {*} P =slDOMlib.getParentN;
* @property {*} d =slDOMlib.clearE;
* @property {*} D =slDOMlib.delE;
* @property {*} X =slDOMlib.copyE;
* @property {*} p =slDOMlib.getParentTag;
* @property {*} S =slDOMlib.getByTag;
* @property {*} Q =slDOMlib.getByQuery;
* @property {*} I =slDOMlib.getById;
* @property {*} s =slDOMlib.getTags;
* @property {*} q =slDOMlib.getTagsByQuery;
* @property {*} T =slDOMlib.triger;
* @property {*} _ =slDOMlib.getE;
* @property {*} $ =slDOMlib.getLIST;
* @property {*} F =slDOMlib.setStyleSPEED;
* @property {*} f =slDOMlib.setStyle;
* @property {*} L =slDOMlib.getLIST;
* @property {*} V =slDOMlib.setVar;
* @property {*} v =slDOMlib.setObjVar;
* @property {*} PXY =slDOMlib.pagePosXY;
* @property {*} i =slDOMlib.in_e;
* @property {*} r =slDOMlib.g_wh;
* @property {*} x =slDOMlib.toFunction;
* @property {function(): slDOM} free = slDOMlib.removeFromDOM;
* @property {function(): Boolean} is_free = slDOMlib.is_free;
* @property {function(): Boolean} is_focused = slDOMlib.is_focused;
* @property {function(): Boolean} is_inview = slDOMlib.elementInViewport;
* @property {function(): Boolean} is_visible = slDOMlib.elementIsVisible;
* @property {*} _normalizeCssValues = slDOMlib._normalizeCssValues;
* @property {*} on = slDOMlib.on;
* @property {*} off = slDOMlib.off;
* @property {function(): Object} eventsCache = slDOMlib.eventsCache;
*/
type slDOM = {
env: ExtensionsPrototype.slDOM_env;
__: (...params: any[]) => any;
a2D: (...params: any[]) => any;
opacity: (...params: any[]) => any;
setE: (...params: any[]) => any;
sClass: (...params: any[]) => any;
setArg: (...params: any[]) => any;
adEto: (...params: any[]) => any;
putBfto: (...params: any[]) => any;
putAfto: (...params: any[]) => any;
putBf: (...params: any[]) => any;
putAf: (...params: any[]) => any;
addE: (...params: any[]) => any;
addB: (...params: any[]) => any;
addT: (...params: any[]) => any;
nextTo?: (...params: any[]) => any;
backTo?: (...params: any[]) => any;
nUP: (...params: any[]) => any;
nChild: (...params: any[]) => any;
getParentN: (...params: any[]) => any;
clearE: (...params: any[]) => any;
delE: (...params: any[]) => any;
copyE: (...params: any[]) => any;
getParentTag: (...params: any[]) => any;
getByTag: (...params: any[]) => any;
getByQuery: (...params: any[]) => any;
getById: (...params: any[]) => any;
getTags: (...params: any[]) => any;
getTagsByQuery: (...params: any[]) => any;
triger: (...params: any[]) => any;
getE: (...params: any[]) => any;
setStyle: (...params: any[]) => any;
setVar: (...params: any[]) => any;
setObjVar: (...params: any[]) => any;
setStyleSPEED: (...params: any[]) => any;
pagePXY: (...params: any[]) => any;
in_e: (...params: any[]) => any;
g_wh: (...params: any[]) => any;
getLIST: (...params: any[]) => any;
toFunction: (...params: any[]) => any;
removeFromDOM: (...params: any[]) => any;
o: (...params: any[]) => any;
E: (...params: any[]) => any;
c: any;
attrs: (...params: any[]) => any;
A: any;
Et: any;
Bt: any;
At: any;
pB: any;
pA: any;
e: any;
b: any;
t: any;
N: any;
B: any;
U: any;
C: any;
P: any;
d: any;
D: any;
X: any;
p: any;
S: any;
Q: any;
I: any;
s: any;
q: any;
T: any;
_: any;
$: any;
F: any;
f: any;
L: any;
V: any;
v: any;
PXY: any;
i: any;
r: any;
x: any;
free: (...params: any[]) => any;
is_free: (...params: any[]) => any;
is_focused: (...params: any[]) => any;
is_inview: (...params: any[]) => any;
is_visible: (...params: any[]) => any;
_normalizeCssValues: any;
on: any;
off: any;
eventsCache: (...params: any[]) => any;
};
}
/**
* @interface ExtensionsPrototype
*/
declare interface ExtensionsPrototype {
}
/**
* @interface HTMLElement
*/
declare interface HTMLElement {
/**
* @memberof HTMLElement#
* @var {Object<string,function>} methods
*/
methods: {
[key: string]: (...params: any[]) => void;
};
/**
* @memberof HTMLElement#
* @var {object} attrdata object for storing custom variables
*/
attrdata: any;
/**
* @memberof HTMLElement#
* @var {object} attrdatastore
*/
attrdatastore: any;
}
declare namespace String {
/**
* @memberof String
* @typedef {object} String_parseUrl_return
* @property {string} original https://www.test.example.com/path/data?request=5#search
* @property {string} origin www.test.example.com
* @property {string} domain www.test.example.com
* @property {string} domain_short test.example.com
* @property {string} pathname /path/data
* @property {string} reqQuery request=5
* @property {string} protocol https
* @property {string} protocoll https://
* @property {Object<string,any>} [get_vars]
* @property {string} url deprecated
* @property {string} url_p deprecated
* @property {string} isIp deprecated
*/
type String_parseUrl_return = {
original: string;
origin: string;
domain: string;
domain_short: string;
pathname: string;
reqQuery: string;
protocol: string;
protocoll: string;
get_vars?: {
[key: string]: any;
};
url: string;
url_p: string;
isIp: string;
};
}
/**
* @interface String
*/
declare interface String {
/**
* similar as PHP subs
* @memberof String#
* @method subs
* @param {number} p
* @param {number} [i]
* @returns {string}
*/
subs(p: number, i?: number): string;
/**
* @memberof String#
* @method toHex
* @param {boolean} utf8
* @returns {string}
*/
toHex(utf8: boolean): string;
/**
* @memberof String#
* @method fromHex
* @returns {string}
*/
fromHex(): string;
/**
* @memberof String#
* @method toHtmlSimple
* @returns {string}
*/
toHtmlSimple(): string;
/**
* @memberof String#
* @method toHtml
* @returns {string}
*/
toHtml(): string;
/**
* @memberof String#
* @method fromHtml
* @returns {string}
*/
fromHtml(): string;
/**
* remove dangerous HTML Tags
* @memberof String#
* @method cleanTags
* @returns {string}
*/
cleanTags(): string;
/**
* @memberof String#
* @method add_Class
* @param {string} className
* @returns {string}
*/
add_Class(className: string): string;
/**
* @memberof String#
* @method del_Class
* @param {string} className
* @returns {string}
*/
del_Class(className: string): string;
/**
* find a class
* @memberof String#
* @method fnd_Class
* @param {string} className
* @returns {boolean}
*/
fnd_Class(className: string): boolean;
/**
* swap letters' case
* @memberof String#
* @method swp_case
* @returns {string}
*/
swp_case(): string;
/**
* uppercase first [k] letters from word
* @memberof String#
* @method ucfirst
* @param {number} [k=1]
* @returns {string}
*/
ucfirst(k?: number): string;
/**
* lowercase first [k] letters from word
* @memberof String#
* @method lcfirst
* @param {number} [k=1]
* @returns {string}
*/
lcfirst(k?: number): string;
/**
* @memberof String#
* @method utf8need
* @returns {string}
*/
utf8need(): string;
/**
* @memberof String#
* @method utf8encode
* @returns {string}
*/
utf8encode(): string;
/**
* @memberof String#
* @method utf8decode
* @returns {string}
*/
utf8decode(): string;
/**
* @memberof String#
* @method toRegexp
* @param {string} [flags]
* @returns {string}
*/
toRegexp(flags?: string): string;
/**
* @memberof String#
* @method escapeHex
* @returns {string}
*/
escapeHex(): string;
/**
* @memberof String#
* @method escape
* @returns {string}
*/
escape(): string;
/**
* @memberof String#
* @method encodeURI
* @returns {string}
*/
encodeURI(): string;
/**
* @memberof String#
* @method unescape
* @returns {string}
*/
unescape(): string;
/**
* @memberof String#
* @method decodeURI
* @returns {string}
*/
decodeURI(): string;
/**
* @memberof String#
* @method parseUrlVars
* @param {boolean} [json=false]
* @param {object} [params]
* @param {boolean} [params.keepOBJ=false]
* @param {boolean} [params.isURL=false]
* @returns {Object<string,any>}
*/
parseUrlVars(json?: boolean, params?: {
keepOBJ?: boolean;
isURL?: boolean;
}): {
[key: string]: any;
};
/**
* @memberof String#
* @method parseUrl
* @param {boolean} [k=false] decode get vars
* @returns {String.String_parseUrl_return}
*/
parseUrl(k?: boolean): String.String_parseUrl_return;
/**
* @memberof String#
* @method match_str
* @param {string} reg_exp
* @param {string} [flags]
* @returns {string[]|null}
*/
match_str(reg_exp: string, flags?: string): string[] | null;
/**
* @memberof String#
* @method sha1
* @returns {string}
*/
sha1(): string;
/**
* @memberof String#
* @method sha256
* @returns {string}
*/
sha256(): string;
/**
* @memberof String#
* @method md5
* @returns {string}
*/
md5(): string;
/**
* @memberof String#
* @method base64encode
* @returns {string}
*/
base64encode(): string;
/**
* @memberof String#
* @method base64decode
* @returns {string}
*/
base64decode(): string;
/**
* @memberof String#
* @method base64encodeBytes
* @returns {Uint8Array}
*/
base64encodeBytes(): Uint8Array;
/**
* @memberof String#
* @method base64encodeBytesArray
* @returns {number[]}
*/
base64encodeBytesArray(): number[];
/**
* @memberof String#
* @method base64decodeBytes
* @returns {Uint8Array}
*/
base64decodeBytes(): Uint8Array;
/**
* @memberof String#
* @method base64decodeBytesArray
* @returns {number[]}
*/
base64decodeBytesArray(): number[];
/**
* @memberof String#
* @method base64encodeClean
* @returns {string}
*/
base64encodeClean(): string;
/**
* @memberof String#
* @method base64decodeClean
* @returns {string}
*/
base64decodeClean(): string;
/**
* @memberof String#
* @method encryptTea
* @param {string} password
* @returns {string}
*/
encryptTea(password: string): string;
/**
* @memberof String#
* @method decryptTea
* @param {string} password
* @returns {string}
*/
decryptTea(password: string): string;
/**
* @memberof String#
* @method encryptAes
* @param {string} password
* @param {128|256|512} [bytes=128]
* @returns {string}
*/
encryptAes(password: string, bytes?: 128 | 256 | 512): string;
/**
* @memberof String#
* @method decryptAes
* @param {string} password
* @param {128|256|512} [bytes=128]
* @returns {string}
*/
decryptAes(password: string, bytes?: 128 | 256 | 512): string;
/**
* "asd asdsdf param:sdd test:data 2 info".buildQuery()
* {_keys: ["_", "param", "test"], _: 'asd asdsdf', param: 'sdd', test: 'data 2 info'}
* @memberof String#
* @method buildQuery
* @returns {Object<string,string>}
*/
buildQuery(): {
[key: string]: string;
};
/**
* "23 test \"composed param\" 234".buildSearchArray()
* ['23', 'test', 'composed param', '234']
* @memberof String#
* @method buildSearchArray
* @returns {string[]}
*/
buildSearchArray(): string[];
/**
* similar as utf8encode
* @memberof String#
* @method utf8
* @returns {string}
*/
utf8(): string;
/**
* similar as utf8decode
* @memberof String#
* @method unicode
* @returns {string}
*/
unicode(): string;
/**
* @memberof String#
* @method toArrayBufferFromUtf8
* @returns {ArrayBuffer}
*/
toArrayBufferFromUtf8(): ArrayBuffer;
/**
* similar as PHP subs
* @memberof String#
* @method subs
* @param {number} p
* @param {number} [i]
* @returns {string}
*/
subs(p: number, i?: number): string;
/**
* @memberof String#
* @method toHex
* @param {boolean} utf8
* @returns {string}
*/
toHex(utf8: boolean): string;
/**
* @memberof String#
* @method fromHex
* @returns {string}
*/
fromHex(): string;
/**
* @memberof String#
* @method toHtmlSimple
* @returns {string}
*/
toHtmlSimple(): string;
/**
* @memberof String#
* @method toHtml
* @returns {string}
*/
toHtml(): string;
/**
* @memberof String#
* @method fromHtml
* @returns {string}
*/
fromHtml(): string;
/**
* remove dangerous HTML Tags
* @memberof String#
* @method cleanTags
* @returns {string}
*/
cleanTags(): string;
/**
* @memberof String#
* @method add_Class
* @param {string} className
* @returns {string}
*/
add_Class(className: string): string;
/**
* @memberof String#
* @method del_Class
* @param {string} className
* @returns {string}
*/
del_Class(className: string): string;
/**
* find a class
* @memberof String#
* @method fnd_Class
* @param {string} className
* @returns {boolean}
*/
fnd_Class(className: string): boolean;
/**
* swap letters' case
* @memberof String#
* @method swp_case
* @returns {string}
*/
swp_case(): string;
/**
* uppercase first [k] letters from word
* @memberof String#
* @method ucfirst
* @param {number} [k=1]
* @returns {string}
*/
ucfirst(k?: number): string;
/**
* lowercase first [k] letters from word
* @memberof String#
* @method lcfirst
* @param {number} [k=1]
* @returns {string}
*/
lcfirst(k?: number): string;
/**
* @memberof String#
* @method utf8need
* @returns {string}
*/
utf8need(): string;
/**
* @memberof String#
* @method utf8encode
* @returns {string}
*/
utf8encode(): string;
/**
* @memberof String#
* @method utf8decode
* @returns {string}
*/
utf8decode(): string;
/**
* similar as utf8encode
* @memberof String#
* @method utf8
* @returns {string}
*/
utf8(): string;
/**
* similar as utf8decode
* @memberof String#
* @method unicode
* @returns {string}
*/
unicode(): string;
/**
* @memberof String#
* @method encryptAes
* @param {string} password
* @param {128|256|512} [bytes=128]
* @returns {string}
*/
encryptAes(password: string, bytes?: 128 | 256 | 512): string;
/**
* @memberof String#
* @method decryptAes
* @param {string} password
* @param {128|256|512} [bytes=128]
* @returns {string}
*/
decryptAes(password: string, bytes?: 128 | 256 | 512): string;
/**
* @memberof String#
* @method encryptTea
* @param {string} password
* @returns {string}
*/
encryptTea(password: string): string;
/**
* @memberof String#
* @method decryptTea
* @param {string} password
* @returns {string}
*/
decryptTea(password: string): string;
/**
* @memberof String#
* @method base64decode
* @returns {string}
*/
base64decode(): string;
/**
* @memberof String#
* @method base64encode
* @returns {string}
*/
base64encode(): string;
/**
* @memberof String#
* @method base64decodeBytes
* @returns {Uint8Array}
*/
base64decodeBytes(): Uint8Array;
/**
* @memberof String#
* @method base64encodeBytes
* @returns {Uint8Array}
*/
base64encodeBytes(): Uint8Array;
/**
* @memberof String#
* @method base64decodeBytesArray
* @returns {number[]}
*/
base64decodeBytesArray(): number[];
/**
* @memberof String#
* @method base64encodeBytesArray
* @returns {number[]}
*/
base64encodeBytesArray(): number[];
/**
* @memberof String#
* @method base64encodeClean
* @returns {string}
*/
base64encodeClean(): string;
/**
* @memberof String#
* @method base64decodeClean
* @returns {string}
*/
base64decodeClean(): string;
/**
* @memberof String#
* @method encodeURI
* @returns {string}
*/
encodeURI(): string;
/**
* @memberof String#
* @method decodeURI
* @returns {string}
*/
decodeURI(): string;
/**
* @memberof String#
* @method escapeHex
* @returns {string}
*/
escapeHex(): string;
/**
* @memberof String#
* @method escape
* @returns {string}
*/
escape(): string;
/**
* @memberof String#
* @method unescape
* @returns {string}
*/
unescape(): string;
/**
* @memberof String#
* @method sha1
* @returns {string}
*/
sha1(): string;
/**
* @memberof String#
* @method sha256
* @returns {string}
*/
sha256(): string;
/**
* similar as PHP subs
* @memberof String#
* @method subs
* @param {number} p
* @param {number} [i]
* @returns {string}
*/
subs(p: number, i?: number): string;
/**
* @memberof String#
* @method md5
* @returns {string}
*/
md5(): string;
/**
* @memberof String#
* @method markdown
* @returns {string}
*/
markdown(): string;
/**
* @memberof String#
* @method toRegexp
* @param {string} [flags]
* @returns {string}
*/
toRegexp(flags?: string): string;
/**
* @memberof String#
* @method parseUrl
* @param {boolean} [k=false] decode get vars
* @returns {String.String_parseUrl_return}
*/
parseUrl(k?: boolean): String.String_parseUrl_return;
/**
* @memberof String#
* @method match_str
* @param {string} reg_exp
* @param {string} [flags]
* @returns {string[]|null}
*/
match_str(reg_exp: string, flags?: string): string[] | null;
/**
* "asd asdsdf param:sdd test:data 2 info".buildQuery()
* {_keys: ["_", "param", "test"], _: 'asd asdsdf', param: 'sdd', test: 'data 2 info'}
* @memberof String#
* @method buildQuery
* @returns {Object<string,string>}
*/
buildQuery(): {
[key: string]: string;
};
/**
* "23 test \"composed param\" 234".buildSearchArray()
* ['23', 'test', 'composed param', '234']
* @memberof String#
* @method buildSearchArray
* @returns {string[]}
*/
buildSearchArray(): string[];
/**
* @memberof String#
* @method toArrayBufferFromUtf8
* @returns {ArrayBuffer}
*/
toArrayBufferFromUtf8(): ArrayBuffer;
}
/**
* @interface Array
*/
declare interface Array {
/**
* @memberof Array#
* @method min
* @returns {any}
*/
min(): any;
/**
* @memberof Array#
* @method shuffle
* @returns {any[]}
*/
shuffle(): any[];
/**
* @memberof Array#
* @method max
* @returns {any}
*/
max(): any;
/**
* @memberof Array#
* @method move
* @param {number} from
* @param {number} to
* @returns {any[]}
*/
move(from: number, to: number): any[];
/**
* @memberof Array#
* @method inArray
* @param {any} a
* @param {Function} comparat