90 lines
2.6 KiB
TypeScript
90 lines
2.6 KiB
TypeScript
export declare const IS_BROWSER: boolean;
|
|
export declare const WINDOW: {};
|
|
export declare const IS_TOUCH_DEVICE: boolean;
|
|
export declare const HAS_POINTER_EVENT: boolean;
|
|
/**
|
|
* Transform the given string from camelCase to kebab-case
|
|
* @param {string} value - The value to transform.
|
|
* @returns {string} The transformed value.
|
|
*/
|
|
export declare function toParamCase(value: any): any;
|
|
/**
|
|
* Get data from the given element.
|
|
* @param {Element} element - The target element.
|
|
* @param {string} name - The data key to get.
|
|
* @returns {string} The data value.
|
|
*/
|
|
export declare function getData(element: any, name: any): any;
|
|
export declare function toggleClass(node: HTMLElement, className: string): void;
|
|
/**
|
|
* Get a pointer from an event object.
|
|
* @param {Object} event - The target event object.
|
|
* @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
|
|
* @returns {Object} The result pointer contains start and/or end point coordinates.
|
|
*/
|
|
export declare function getPointer({ pageX, pageY }: {
|
|
pageX: any;
|
|
pageY: any;
|
|
}, endOnly?: any): {
|
|
endX: any;
|
|
endY: any;
|
|
} | {
|
|
endX: any;
|
|
endY: any;
|
|
startX: any;
|
|
startY: any;
|
|
};
|
|
/**
|
|
* Get the offset base on the document.
|
|
* @param {Element} element - The target element.
|
|
* @returns {Object} The offset data.
|
|
*/
|
|
export declare function getOffset(element: any): {
|
|
left: any;
|
|
top: any;
|
|
};
|
|
/**
|
|
* Get transforms base on the given object.
|
|
* @param {Object} obj - The target object.
|
|
* @returns {string} A string contains transform values.
|
|
*/
|
|
export declare function getTransforms({ rotate, scaleX, scaleY, translateX, translateY, }: {
|
|
rotate?: number;
|
|
scaleX?: number;
|
|
scaleY?: number;
|
|
translateX?: number;
|
|
translateY?: number;
|
|
}): {
|
|
WebkitTransform: string;
|
|
msTransform: string;
|
|
transform: string;
|
|
};
|
|
/**
|
|
* copy from https://github.com/steelsojka/lodash-decorators/blob/master/src/mixin.ts
|
|
* Mixins an object into the classes prototype.
|
|
* @export
|
|
* @param {...Object[]} srcs
|
|
* @returns {ClassDecorator}
|
|
* @example
|
|
*
|
|
* const myMixin = {
|
|
* blorg: () => 'blorg!'
|
|
* }
|
|
*
|
|
* @Mixin(myMixin)
|
|
* class MyClass {}
|
|
*
|
|
* const myClass = new MyClass();
|
|
*
|
|
* myClass.blorg(); // => 'blorg!'
|
|
*/
|
|
export declare function Mixin(...srcs: Object[]): ClassDecorator;
|
|
/**
|
|
* Dispatch event on the target element.
|
|
* @param {Element} element - The event target.
|
|
* @param {string} type - The event type(s).
|
|
* @param {Object} data - The additional event data.
|
|
* @returns {boolean} Indicate if the event is default prevented or not.
|
|
*/
|
|
export declare function dispatchEvent(element: any, type: any, data?: any): any;
|