feat: update wonder-commonlib,wonder-frp dts file; add wonder.js dts file (#14873)

* feat: update wonder-commonlib,wonder-frp dts file
feat: add wonder.js dts file

* fix: change module to "commonjs"

* fix: try pass ci
This commit is contained in:
YYC 2017-03-10 15:36:37 +08:00 committed by Mohamed Hegazy
parent ddef2004bc
commit 99197751bd
7 changed files with 3902 additions and 758 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for wonder-commonlib 0.1.1
// Type definitions for wonder-commonlib 0.2.0
// Project: https://github.com/yyc-git/Wonder-CommonLib
// Definitions by: YYC <https://github.com/yyc-git>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -6,96 +6,31 @@
/// <reference types="node" />
declare module wdCb {
class JudgeUtils {
static isArray(arr: any): boolean;
static isArrayExactly(arr: any): boolean;
static isNumber(num: any): boolean;
static isNumberExactly(num: any): boolean;
static isString(str: any): boolean;
static isStringExactly(str: any): boolean;
static isBoolean(bool: any): boolean;
static isDom(obj: any): boolean;
static isObject(obj: any): boolean;
static isDirectObject(obj: any): boolean;
static isHostMethod(object: any, property: any): boolean;
static isNodeJs(): boolean;
static isFunction(func: any): boolean;
}
// Generated by dts-bundle v0.7.2
declare module 'wonder-commonlib/dist/es2015' {
export { Collection } from "wonder-commonlib/dist/es2015/Collection";
export { $BREAK, $REMOVE } from "wonder-commonlib/dist/es2015/global/Const";
export { root } from "wonder-commonlib/dist/es2015/global/Variable";
export { Hash } from "wonder-commonlib/dist/es2015/Hash";
export { List } from "wonder-commonlib/dist/es2015/List";
export { Log } from "wonder-commonlib/dist/es2015/Log";
export { Queue } from "wonder-commonlib/dist/es2015/Queue";
export { Stack } from "wonder-commonlib/dist/es2015/Stack";
export { AjaxUtils } from "wonder-commonlib/dist/es2015/utils/AjaxUtils";
export { ArrayUtils } from "wonder-commonlib/dist/es2015/utils/ArrayUtils";
export { ConvertUtils } from "wonder-commonlib/dist/es2015/utils/ConvertUtils";
export { DomQuery } from "wonder-commonlib/dist/es2015/utils/DomQuery";
export { EventUtils } from "wonder-commonlib/dist/es2015/utils/EventUtils";
export { ExtendUtils } from "wonder-commonlib/dist/es2015/utils/ExtendUtils";
export { FunctionUtils } from "wonder-commonlib/dist/es2015/utils/FunctionUtils";
export { JudgeUtils } from "wonder-commonlib/dist/es2015/utils/JudgeUtils";
export { PathUtils } from "wonder-commonlib/dist/es2015/utils/PathUtils";
}
declare var global:NodeJS.Global,window:Window;
declare module wdCb {
var root: any;
}
declare module wdCb {
}
declare module wdCb {
const $BREAK: {
break: boolean;
};
const $REMOVE: any;
}
declare module wdCb {
class Log {
static info: {
INVALID_PARAM: string;
helperFunc: (...args: any[]) => string;
assertion: (...args: any[]) => any;
FUNC_INVALID: (...args: any[]) => any;
FUNC_MUST: (...args: any[]) => any;
FUNC_MUST_BE: (...args: any[]) => any;
FUNC_MUST_NOT_BE: (...args: any[]) => any;
FUNC_SHOULD: (...args: any[]) => any;
FUNC_SHOULD_NOT: (...args: any[]) => any;
FUNC_SUPPORT: (...args: any[]) => any;
FUNC_NOT_SUPPORT: (...args: any[]) => any;
FUNC_MUST_DEFINE: (...args: any[]) => any;
FUNC_MUST_NOT_DEFINE: (...args: any[]) => any;
FUNC_UNKNOW: (...args: any[]) => any;
FUNC_EXPECT: (...args: any[]) => any;
FUNC_UNEXPECT: (...args: any[]) => any;
FUNC_EXIST: (...args: any[]) => any;
FUNC_NOT_EXIST: (...args: any[]) => any;
FUNC_ONLY: (...args: any[]) => any;
FUNC_CAN_NOT: (...args: any[]) => any;
};
static log(...messages: any[]): void;
static assert(cond: any, ...messages: any[]): void;
static error(cond: any, ...message: any[]): any;
static warn(...message: any[]): void;
private static _exec(consoleMethod, args, sliceBegin?);
}
}
declare module wdCb {
class List<T> {
protected children: Array<T>;
getCount(): number;
hasChild(child: any): boolean;
hasChildWithFunc(func: Function): boolean;
getChildren(): T[];
getChild(index: number): T;
addChild(child: T): this;
addChildren(arg: Array<T> | List<T> | any): this;
setChildren(children: Array<T>): this;
unShiftChild(child: T): void;
removeAllChildren(): this;
forEach(func: Function, context?: any): this;
toArray(): T[];
protected copyChildren(): T[];
protected removeChildHelper(arg: any): Array<T>;
private _forEach(arr, func, context?);
private _removeChild(arr, func);
}
}
declare module wdCb {
class Collection<T> extends List<T> {
declare module 'wonder-commonlib/dist/es2015/Collection' {
import { List } from "wonder-commonlib/dist/es2015/List";
export class Collection<T> extends List<T> {
static create<T>(children?: any[]): Collection<T>;
constructor(children?: Array<T>);
clone(): any;
@ -109,17 +44,28 @@ declare module wdCb {
sort(func: (a: T, b: T) => any, isSortSelf?: boolean): Collection<T>;
map(func: (value: T, index: number) => any): Collection<any>;
removeRepeatItems(): Collection<T>;
hasRepeatItems(): false;
hasRepeatItems(): boolean;
}
}
declare module wdCb {
class Hash<T> {
declare module 'wonder-commonlib/dist/es2015/global/Const' {
export const $BREAK: {
break: boolean;
};
export const $REMOVE: any;
}
declare module 'wonder-commonlib/dist/es2015/global/Variable' {
export var root: any;
}
declare module 'wonder-commonlib/dist/es2015/Hash' {
import { Collection } from "wonder-commonlib/dist/es2015/Collection";
export class Hash<T> {
static create<T>(children?: {}): Hash<T>;
constructor(children?: {
[s: string]: T;
});
private _children;
getChildren(): {
[s: string]: T;
};
@ -151,8 +97,60 @@ declare module wdCb {
}
}
declare module wdCb {
class Queue<T> extends List<T> {
declare module 'wonder-commonlib/dist/es2015/List' {
export class List<T> {
protected children: Array<T>;
getCount(): number;
hasChild(child: any): boolean;
hasChildWithFunc(func: Function): boolean;
getChildren(): T[];
getChild(index: number): T;
addChild(child: T): this;
addChildren(arg: Array<T> | List<T> | any): this;
setChildren(children: Array<T>): this;
unShiftChild(child: T): void;
removeAllChildren(): this;
forEach(func: Function, context?: any): this;
toArray(): T[];
protected copyChildren(): T[];
protected removeChildHelper(arg: any): Array<T>;
}
}
declare module 'wonder-commonlib/dist/es2015/Log' {
export class Log {
static info: {
INVALID_PARAM: string;
helperFunc: (...args: any[]) => string;
assertion: (...args: any[]) => any;
FUNC_INVALID: (...args: any[]) => any;
FUNC_MUST: (...args: any[]) => any;
FUNC_MUST_BE: (...args: any[]) => any;
FUNC_MUST_NOT_BE: (...args: any[]) => any;
FUNC_SHOULD: (...args: any[]) => any;
FUNC_SHOULD_NOT: (...args: any[]) => any;
FUNC_SUPPORT: (...args: any[]) => any;
FUNC_NOT_SUPPORT: (...args: any[]) => any;
FUNC_MUST_DEFINE: (...args: any[]) => any;
FUNC_MUST_NOT_DEFINE: (...args: any[]) => any;
FUNC_UNKNOW: (...args: any[]) => any;
FUNC_EXPECT: (...args: any[]) => any;
FUNC_UNEXPECT: (...args: any[]) => any;
FUNC_EXIST: (...args: any[]) => any;
FUNC_NOT_EXIST: (...args: any[]) => any;
FUNC_ONLY: (...args: any[]) => any;
FUNC_CAN_NOT: (...args: any[]) => any;
};
static log(...messages: any[]): void;
static assert(cond: any, ...messages: any[]): void;
static error(cond: any, ...message: any[]): any;
static warn(...message: any[]): void;
}
}
declare module 'wonder-commonlib/dist/es2015/Queue' {
import { List } from "wonder-commonlib/dist/es2015/List";
export class Queue<T> extends List<T> {
static create<T>(children?: any[]): Queue<T>;
constructor(children?: Array<T>);
readonly front: T;
@ -163,8 +161,10 @@ declare module wdCb {
}
}
declare module wdCb {
class Stack<T> extends List<T> {
declare module 'wonder-commonlib/dist/es2015/Stack' {
import { List } from "wonder-commonlib/dist/es2015/List";
import { Collection } from "wonder-commonlib/dist/es2015/Collection";
export class Stack<T> extends List<T> {
static create<T>(children?: any[]): Stack<T>;
constructor(children?: Array<T>);
readonly top: T;
@ -182,71 +182,33 @@ declare module wdCb {
sort(func: (a: T, b: T) => any, isSortSelf?: boolean): Collection<T>;
map(func: (value: T, index: number) => any): Collection<any>;
removeRepeatItems(): Collection<T>;
hasRepeatItems(): false;
hasRepeatItems(): boolean;
}
}
declare module wdCb {
class AjaxUtils {
declare module 'wonder-commonlib/dist/es2015/utils/AjaxUtils' {
export class AjaxUtils {
static ajax(conf: any): void;
private static _createAjax(error);
private static _isLocalFile(status);
private static _isSoundFile(dataType);
}
}
declare module wdCb {
class ArrayUtils {
declare module 'wonder-commonlib/dist/es2015/utils/ArrayUtils' {
export class ArrayUtils {
static removeRepeatItems(arr: Array<any>, isEqual?: (a: any, b: any) => boolean): any[];
static contain(arr: Array<any>, ele: any): boolean;
}
}
declare module wdCb {
class ConvertUtils {
declare module 'wonder-commonlib/dist/es2015/utils/ConvertUtils' {
export class ConvertUtils {
static toString(obj: any): string;
private static _convertCodeToString(fn);
}
}
declare module wdCb {
class EventUtils {
static bindEvent(context: any, func: any): (event: any) => any;
static addEvent(dom: any, eventName: any, handler: any): void;
static removeEvent(dom: any, eventName: any, handler: any): void;
}
}
declare module wdCb {
class ExtendUtils {
static extendDeep(parent: any, child?: any, filter?: (val: any, i: any) => boolean): any;
static extend(destination: any, source: any): any;
static copyPublicAttri(source: any): {};
}
}
declare module wdCb {
class PathUtils {
static basename(path: string, ext?: string): string;
static changeExtname(pathStr: string, extname: string): string;
static changeBasename(pathStr: string, basename: string, isSameExt?: boolean): string;
static extname(path: string): string;
static dirname(path: string): string;
private static _splitPath(fileName);
}
}
declare module wdCb {
class FunctionUtils {
static bind(object: any, func: Function): () => any;
}
}
declare module wdCb {
class DomQuery {
declare module 'wonder-commonlib/dist/es2015/utils/DomQuery' {
export class DomQuery {
static create(eleStr: string): any;
static create(dom: HTMLElement): any;
private _doms;
constructor(eleStr: string);
constructor(dom: HTMLElement);
get(index: any): HTMLElement;
@ -258,14 +220,56 @@ declare module wdCb {
attr(name: string): any;
attr(name: string, value: string): any;
text(str?: string): string;
private _isDomEleStr(eleStr);
private _buildDom(eleStr);
private _buildDom(dom);
private _createElement(eleStr);
}
}
declare module "wonder-commonlib" {
export = wdCb;
declare module 'wonder-commonlib/dist/es2015/utils/EventUtils' {
export class EventUtils {
static bindEvent(context: any, func: any): (event: any) => any;
static addEvent(dom: any, eventName: any, handler: any): void;
static removeEvent(dom: any, eventName: any, handler: any): void;
}
}
declare module 'wonder-commonlib/dist/es2015/utils/ExtendUtils' {
export class ExtendUtils {
static extendDeep(parent: any, child?: any, filter?: (val: any, i: any) => boolean): any;
static extend(destination: any, source: any): any;
static copyPublicAttri(source: any): {};
}
}
declare module 'wonder-commonlib/dist/es2015/utils/FunctionUtils' {
export class FunctionUtils {
static bind(object: any, func: Function): () => any;
}
}
declare module 'wonder-commonlib/dist/es2015/utils/JudgeUtils' {
export class JudgeUtils {
static isArray(arr: any): boolean;
static isArrayExactly(arr: any): boolean;
static isNumber(num: any): boolean;
static isNumberExactly(num: any): boolean;
static isString(str: any): boolean;
static isStringExactly(str: any): boolean;
static isBoolean(bool: any): boolean;
static isDom(obj: any): boolean;
static isObject(obj: any): boolean;
static isDirectObject(obj: any): boolean;
static isHostMethod(object: any, property: any): boolean;
static isNodeJs(): boolean;
static isFunction(func: any): boolean;
}
}
declare module 'wonder-commonlib/dist/es2015/utils/PathUtils' {
export class PathUtils {
static basename(path: string, ext?: string): string;
static changeExtname(pathStr: string, extname: string): string;
static changeBasename(pathStr: string, basename: string, isSameExt?: boolean): string;
static extname(path: string): string;
static dirname(path: string): string;
}
}

View File

@ -1,6 +1,6 @@
import wdCb = require("wonder-commonlib");
import {Collection} from "wonder-commonlib/dist/es2015/Collection";
var list = wdCb.Collection.create();
var list = Collection.create();
list.addChild(1);

1366
wonder-frp/index.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import wdFrp = require("wonder-frp");
import {fromArray} from "wonder-frp/dist/es2015/global/Operator";
wdFrp.fromArray([1,2,3])
fromArray([1,2,3])
.subscribe(function(){
});

2955
wonder.js/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

23
wonder.js/tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"wonder.js-tests.ts"
]
}

View File

@ -0,0 +1,4 @@
import {Director} from "wonder.js/dist/es2015/core/Director";
console.log(Director.getInstance());