,
41 | nextElement: ClassicElement,
42 | container: Element,
43 | callback?: (component: ClassicComponent
) => any): ClassicComponent
;
44 | function unstable_renderSubtreeIntoContainer
(
45 | parentComponent: Component,
46 | nextElement: ReactElement,
47 | container: Element,
48 | callback?: (component: Component
) => any): Component
;
49 | }
50 |
51 | namespace __DOMServer {
52 | function renderToString(element: ReactElement): string;
53 | function renderToStaticMarkup(element: ReactElement): string;
54 | var version: string;
55 | }
56 | }
57 |
58 | declare module "react-dom" {
59 | import DOM = __React.__DOM;
60 | export = DOM;
61 | }
62 |
63 | declare module "react-dom/server" {
64 | import DOMServer = __React.__DOMServer;
65 | export = DOMServer;
66 | }
67 |
--------------------------------------------------------------------------------
/modules/typings/packages/bootstrap.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Bootstrap 2.2
2 | // Project: http://twitter.github.com/bootstrap/
3 | // Definitions by: Boris Yankov
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 |
7 | ///
8 |
9 | interface ModalOptions {
10 | backdrop?: boolean;
11 | keyboard?: boolean;
12 | show?: boolean;
13 | remote?: string;
14 | }
15 |
16 | interface ModalOptionsBackdropString {
17 | backdrop?: string; // for "static"
18 | keyboard?: boolean;
19 | show?: boolean;
20 | remote?: string;
21 | }
22 |
23 | interface ScrollSpyOptions {
24 | offset?: number;
25 | }
26 |
27 | interface TooltipOptions {
28 | animation?: boolean;
29 | html?: boolean;
30 | placement?: any;
31 | selector?: string;
32 | title?: any;
33 | trigger?: string;
34 | delay?: any;
35 | container?: any;
36 | }
37 |
38 | interface PopoverOptions {
39 | animation?: boolean;
40 | html?: boolean;
41 | placement?: any;
42 | selector?: string;
43 | trigger?: string;
44 | title?: any;
45 | content?: any;
46 | delay?: any;
47 | container?: any;
48 | }
49 |
50 | interface CollapseOptions {
51 | parent?: any;
52 | toggle?: boolean;
53 | }
54 |
55 | interface CarouselOptions {
56 | interval?: number;
57 | pause?: string;
58 | }
59 |
60 | interface TypeaheadOptions {
61 | source?: any;
62 | items?: number;
63 | minLength?: number;
64 | matcher?: (item: any) => boolean;
65 | sorter?: (items: any[]) => any[];
66 | updater?: (item: any) => any;
67 | highlighter?: (item: any) => string;
68 | }
69 |
70 | interface AffixOptions {
71 | offset?: any;
72 | }
73 |
74 | interface JQuery {
75 | modal(options?: ModalOptions): JQuery;
76 | modal(options?: ModalOptionsBackdropString): JQuery;
77 | modal(command: string): JQuery;
78 |
79 | dropdown(): JQuery;
80 | dropdown(command: string): JQuery;
81 |
82 | scrollspy(command: string): JQuery;
83 | scrollspy(options?: ScrollSpyOptions): JQuery;
84 |
85 | tab(): JQuery;
86 | tab(command: string): JQuery;
87 |
88 | tooltip(options?: TooltipOptions): JQuery;
89 | tooltip(command: string): JQuery;
90 |
91 | popover(options?: PopoverOptions): JQuery;
92 | popover(command: string): JQuery;
93 |
94 | alert(): JQuery;
95 | alert(command: string): JQuery;
96 |
97 | button(): JQuery;
98 | button(command: string): JQuery;
99 |
100 | collapse(options?: CollapseOptions): JQuery;
101 | collapse(command: string): JQuery;
102 |
103 | carousel(options?: CarouselOptions): JQuery;
104 | carousel(command: string): JQuery;
105 |
106 | typeahead(options?: TypeaheadOptions): JQuery;
107 |
108 | affix(options?: AffixOptions): JQuery;
109 | }
110 |
111 | declare module "bootstrap" {
112 | }
113 |
--------------------------------------------------------------------------------
/modules/Mantra/client/modules/core/actions/tests/posts.js:
--------------------------------------------------------------------------------
1 | const { describe, it } = global;
2 | import {expect} from 'chai';
3 | import {spy, stub} from 'sinon';
4 | import actions from '../posts';
5 |
6 | describe('actions.posts', () => {
7 | describe('create', () => {
8 | it('should reject if title is not there', () => {
9 | const LocalState = {set: spy()};
10 | actions.create({LocalState}, null, 'content');
11 | const args = LocalState.set.args[0];
12 |
13 | expect(args[0]).to.be.equal('SAVING_ERROR');
14 | expect(args[1]).to.match(/required/);
15 | });
16 |
17 | it('should reject if content is not there', () => {
18 | const LocalState = {set: spy()};
19 | actions.create({LocalState}, 'title', null);
20 | const args = LocalState.set.args[0];
21 |
22 | expect(args[0]).to.be.equal('SAVING_ERROR');
23 | expect(args[1]).to.match(/required/);
24 | });
25 |
26 | it('should clear older LocalState for SAVING_ERROR', () => {
27 | const Meteor = {uuid: spy(), call: spy()};
28 | const LocalState = {set: spy()};
29 | const FlowRouter = {go: spy()};
30 |
31 | actions.create({LocalState, Meteor, FlowRouter}, 't', 'c');
32 | expect(LocalState.set.args[0]).to.deep.equal([ 'SAVING_ERROR', null ]);
33 | });
34 |
35 | it('should call Meteor.call to save the post', () => {
36 | const Meteor = {uuid: () => 'id', call: spy()};
37 | const LocalState = {set: spy()};
38 | const FlowRouter = {go: spy()};
39 |
40 | actions.create({LocalState, Meteor, FlowRouter}, 't', 'c');
41 | const methodArgs = Meteor.call.args[0];
42 |
43 | expect(methodArgs.slice(0, 4)).to.deep.equal([
44 | 'posts.create', 'id', 't', 'c'
45 | ]);
46 | expect(methodArgs[4]).to.be.a('function');
47 | });
48 |
49 | it('should redirect user to the post', () => {
50 | const id = 'dsds';
51 | const Meteor = {uuid: () => id, call: stub()};
52 | const LocalState = {set: spy()};
53 | const FlowRouter = {go: spy()};
54 | Meteor.call.callsArg(4);
55 |
56 | actions.create({Meteor, LocalState, FlowRouter}, 't', 'c');
57 | expect(FlowRouter.go.args[0][0]).to.be.equal(`/post/${id}`);
58 | });
59 |
60 | describe('after Meteor.call', () => {
61 | describe('if there is error', () => {
62 | it('should set SAVING_ERROR with the error message', () => {
63 | const Meteor = {uuid: () => 'id', call: stub()};
64 | const LocalState = {set: spy()};
65 | const FlowRouter = {go: spy()};
66 | const err = {message: 'Oops'};
67 | Meteor.call.callsArgWith(4, err);
68 |
69 | actions.create({Meteor, LocalState, FlowRouter}, 't', 'c');
70 | expect(LocalState.set.args[1]).to.deep.equal([ 'SAVING_ERROR', err.message ]);
71 | });
72 | });
73 | });
74 | });
75 |
76 | describe('clearErrors', () => {
77 | it('should clear SAVING_ERROR local state', () => {
78 | const LocalState = {set: spy()};
79 | actions.clearErrors({LocalState});
80 | expect(LocalState.set.callCount).to.be.equal(1);
81 | expect(LocalState.set.args[0]).to.deep.equal([ 'SAVING_ERROR', null ]);
82 | });
83 | });
84 | });
85 |
--------------------------------------------------------------------------------
/modules/MantraTS/client/modules/core/actions/tests/posts.js:
--------------------------------------------------------------------------------
1 | const { describe, it } = global;
2 | import {expect} from 'chai';
3 | import {spy, stub} from 'sinon';
4 | import actions from '../posts';
5 |
6 | describe('actions.posts', () => {
7 | describe('create', () => {
8 | it('should reject if title is not there', () => {
9 | const LocalState = {set: spy()};
10 | actions.create({LocalState}, null, 'content');
11 | const args = LocalState.set.args[0];
12 |
13 | expect(args[0]).to.be.equal('SAVING_ERROR');
14 | expect(args[1]).to.match(/required/);
15 | });
16 |
17 | it('should reject if content is not there', () => {
18 | const LocalState = {set: spy()};
19 | actions.create({LocalState}, 'title', null);
20 | const args = LocalState.set.args[0];
21 |
22 | expect(args[0]).to.be.equal('SAVING_ERROR');
23 | expect(args[1]).to.match(/required/);
24 | });
25 |
26 | it('should clear older LocalState for SAVING_ERROR', () => {
27 | const Meteor = {uuid: spy(), call: spy()};
28 | const LocalState = {set: spy()};
29 | const FlowRouter = {go: spy()};
30 |
31 | actions.create({LocalState, Meteor, FlowRouter}, 't', 'c');
32 | expect(LocalState.set.args[0]).to.deep.equal([ 'SAVING_ERROR', null ]);
33 | });
34 |
35 | it('should call Meteor.call to save the post', () => {
36 | const Meteor = {uuid: () => 'id', call: spy()};
37 | const LocalState = {set: spy()};
38 | const FlowRouter = {go: spy()};
39 |
40 | actions.create({LocalState, Meteor, FlowRouter}, 't', 'c');
41 | const methodArgs = Meteor.call.args[0];
42 |
43 | expect(methodArgs.slice(0, 4)).to.deep.equal([
44 | 'posts.create', 'id', 't', 'c'
45 | ]);
46 | expect(methodArgs[4]).to.be.a('function');
47 | });
48 |
49 | it('should redirect user to the post', () => {
50 | const id = 'dsds';
51 | const Meteor = {uuid: () => id, call: stub()};
52 | const LocalState = {set: spy()};
53 | const FlowRouter = {go: spy()};
54 | Meteor.call.callsArg(4);
55 |
56 | actions.create({Meteor, LocalState, FlowRouter}, 't', 'c');
57 | expect(FlowRouter.go.args[0][0]).to.be.equal(`/post/${id}`);
58 | });
59 |
60 | describe('after Meteor.call', () => {
61 | describe('if there is error', () => {
62 | it('should set SAVING_ERROR with the error message', () => {
63 | const Meteor = {uuid: () => 'id', call: stub()};
64 | const LocalState = {set: spy()};
65 | const FlowRouter = {go: spy()};
66 | const err = {message: 'Oops'};
67 | Meteor.call.callsArgWith(4, err);
68 |
69 | actions.create({Meteor, LocalState, FlowRouter}, 't', 'c');
70 | expect(LocalState.set.args[1]).to.deep.equal([ 'SAVING_ERROR', err.message ]);
71 | });
72 | });
73 | });
74 | });
75 |
76 | describe('clearErrors', () => {
77 | it('should clear SAVING_ERROR local state', () => {
78 | const LocalState = {set: spy()};
79 | actions.clearErrors({LocalState});
80 | expect(LocalState.set.callCount).to.be.equal(1);
81 | expect(LocalState.set.args[0]).to.deep.equal([ 'SAVING_ERROR', null ]);
82 | });
83 | });
84 | });
85 |
--------------------------------------------------------------------------------
/modules/typings/packages/ironrouter.d.ts:
--------------------------------------------------------------------------------
1 | // Definitions for the iron-router smart package
2 | //
3 | // https://atmosphere.meteor.com/package/iron-router
4 | // https://github.com/EventedMind/iron-router
5 |
6 | declare module Router {
7 |
8 | interface TemplateConfig {
9 | to?: string;
10 | waitOn?: boolean;
11 | data?: boolean;
12 | }
13 |
14 | interface TemplateConfigDico {[id:string]:TemplateConfig}
15 |
16 | interface GlobalConfig {
17 | load?: Function;
18 | autoRender?: boolean;
19 | layoutTemplate?: string;
20 | notFoundTemplate?: string;
21 | loadingTemplate?: string;
22 | waitOn?: any;
23 | }
24 |
25 | interface MapConfig {
26 | path?:string;
27 | // by default template is the route name, this field is the override
28 | template?:string;
29 | layoutTemplate?: string;
30 | yieldTemplates?: TemplateConfigDico;
31 | // can be a Function or an object literal {}
32 | data?: any;
33 | // waitOn can be a subscription handle, an array of subscription handles or a function that returns a subscription handle
34 | // or array of subscription handles. A subscription handle is what gets returned when you call Meteor.subscribe
35 | waitOn?: any;
36 | loadingTemplate?:string;
37 | notFoundTemplate?: string;
38 | controller?: RouteController;
39 | action?: Function;
40 |
41 | // The before and after hooks can be Functions or an array of Functions
42 | before?: any;
43 | after?: any;
44 | load?: Function;
45 | unload?: Function;
46 | reactive?: boolean;
47 | }
48 |
49 | interface HookOptions {
50 | except?: string[];
51 | }
52 |
53 | interface HookOptionsDico {[id:string]:HookOptions}
54 |
55 | // Deprecated: for old "Router" smart package
56 | export function page():void;
57 | export function add(route:Object):void;
58 | export function to(path:string, ...args:any[]):void;
59 | export function filters(filtersMap:Object): any;
60 | export function filter(filterName:string, options?:Object): any;
61 |
62 | // These are for Iron-Router
63 | export function configure(config:GlobalConfig): any;
64 | export function plugin(name: string, ...params: any[]): void;
65 | export function map(func:Function):void;
66 | export function route(name:string, handler?: any, routeParams?:MapConfig): void;
67 | export function path(route:string, params?:Object):string;
68 | export function url(route:string):string;
69 | export function go(route:string, params?:Object):void;
70 | export function before(func: Function, options?: HookOptionsDico): void;
71 | export function after(func: Function, options?: HookOptionsDico): void;
72 | export function load(func: Function, options?: HookOptionsDico): void;
73 | export function unload(func: Function, options?: HookOptionsDico): void;
74 | export function render(template?: string, options?: TemplateConfigDico): void;
75 | export function wait(): void;
76 | export function stop(): void;
77 | export function redirect(route:string): void;
78 | export function current(): any;
79 | export function insert(options: any): any;
80 | export function start(): void;
81 |
82 | export function onRun(hook?: any, func?: Function, params?: any): void;
83 | export function onBeforeAction(hook?: any, func?: Function, params?: any): void;
84 | export function onBeforeAction(hook?: any, params?: any): void;
85 | export function onAfterAction(hook?: any, func?: Function, params?: any): void;
86 | export function onStop(hook?: any, params?: any): void;
87 | export function onData(hook?: any, params?: any): void;
88 | export function waitOn(hook?: string, func?: Function, params?: any): void;
89 |
90 | export var routes: Object;
91 | export var params: any;
92 |
93 | }
94 |
95 | interface RouteController {
96 | render(route:string): void;
97 | extend(routeParams: Router.MapConfig): RouteController;
98 | }
99 |
100 |
101 | declare var RouteController: RouteController;
102 |
103 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "target": "es6",
5 | "declaration": false,
6 | "noImplicitAny": true,
7 | "removeComments": false,
8 | "noLib": false,
9 | "preserveConstEnums": true,
10 | "outDir": ".dist",
11 | "suppressImplicitAnyIndexErrors": true,
12 | "jsx": "preserve",
13 | "experimentalDecorators": true,
14 | "sourceMap": true
15 | },
16 | "awesomeTypescriptLoaderOptions": {
17 | "doTypeCheck": true,
18 | "useBabel": false,
19 | "emitRequireType": true,
20 | "forkChecker": true
21 | },
22 | "filesGlob": [
23 | "modules/**/*.ts",
24 | "modules/**/*.tsx"
25 | ],
26 | "files": [
27 | "modules/MantraTS/client/configs/context.ts",
28 | "modules/MantraTS/client/modules/comments/actions/comments.ts",
29 | "modules/MantraTS/client/modules/comments/actions/index.ts",
30 | "modules/MantraTS/client/modules/comments/configs/method_stubs/comments.ts",
31 | "modules/MantraTS/client/modules/comments/configs/method_stubs/index.ts",
32 | "modules/MantraTS/client/modules/comments/containers/comment_list.ts",
33 | "modules/MantraTS/client/modules/comments/containers/create_comment.ts",
34 | "modules/MantraTS/client/modules/comments/index.ts",
35 | "modules/MantraTS/client/modules/core/actions/index.ts",
36 | "modules/MantraTS/client/modules/core/actions/posts.ts",
37 | "modules/MantraTS/client/modules/core/configs/method_stubs/index.ts",
38 | "modules/MantraTS/client/modules/core/configs/method_stubs/posts.ts",
39 | "modules/MantraTS/client/modules/core/containers/newpost.ts",
40 | "modules/MantraTS/client/modules/core/containers/post.ts",
41 | "modules/MantraTS/client/modules/core/containers/postlist.ts",
42 | "modules/MantraTS/client/modules/core/index.ts",
43 | "modules/MantraTS/common/collections.ts",
44 | "modules/MantraTS/server/configs/initial_adds.ts",
45 | "modules/MantraTS/server/main.ts",
46 | "modules/MantraTS/server/methods/posts.ts",
47 | "modules/MantraTS/server/publications/posts.ts",
48 | "modules/TodoAppTS/collections/Tasks.ts",
49 | "modules/TodoAppTS/server/todo-subscriptions.ts",
50 | "modules/TodoAppTS/todo-methods.ts",
51 | "modules/typings/meteor/mantra.d.ts",
52 | "modules/typings/meteor/meteor-extras.d.ts",
53 | "modules/typings/meteor/meteor.d.ts",
54 | "modules/typings/meteor/node-fibers.d.ts",
55 | "modules/typings/meteor/node.d.ts",
56 | "modules/typings/packages.d.ts",
57 | "modules/typings/packages/accounts.d.ts",
58 | "modules/typings/packages/ace.d.ts",
59 | "modules/typings/packages/backbone.d.ts",
60 | "modules/typings/packages/bootstrap.d.ts",
61 | "modules/typings/packages/collection2.d.ts",
62 | "modules/typings/packages/collectionfs.d.ts",
63 | "modules/typings/packages/d3.d.ts",
64 | "modules/typings/packages/errors.d.ts",
65 | "modules/typings/packages/flash-messages.d.ts",
66 | "modules/typings/packages/flowRouter.d.ts",
67 | "modules/typings/packages/google-maps-smart-package.d.ts",
68 | "modules/typings/packages/google.maps.d.ts",
69 | "modules/typings/packages/ironrouter.d.ts",
70 | "modules/typings/packages/jquery.d.ts",
71 | "modules/typings/packages/kineticjs.d.ts",
72 | "modules/typings/packages/lodash.d.ts",
73 | "modules/typings/packages/marked.d.ts",
74 | "modules/typings/packages/messageFormat.d.ts",
75 | "modules/typings/packages/meteor-typescript-utils.d.ts",
76 | "modules/typings/packages/moment-node.d.ts",
77 | "modules/typings/packages/moment.d.ts",
78 | "modules/typings/packages/paginated-subscription.d.ts",
79 | "modules/typings/packages/pickadate.d.ts",
80 | "modules/typings/packages/roles.d.ts",
81 | "modules/typings/packages/semanticui.d.ts",
82 | "modules/typings/packages/smallPackages.d.ts",
83 | "modules/typings/packages/subsManager.d.ts",
84 | "modules/typings/packages/t9n.d.ts",
85 | "modules/typings/packages/tomiUploads.d.ts",
86 | "modules/typings/packages/underscore.d.ts",
87 | "modules/typings/packages/underscore.string.d.ts",
88 | "modules/typings/typings/react/react-addons-create-fragment.d.ts",
89 | "modules/typings/typings/react/react-addons-css-transition-group.d.ts",
90 | "modules/typings/typings/react/react-addons-linked-state-mixin.d.ts",
91 | "modules/typings/typings/react/react-addons-perf.d.ts",
92 | "modules/typings/typings/react/react-addons-pure-render-mixin.d.ts",
93 | "modules/typings/typings/react/react-addons-test-utils.d.ts",
94 | "modules/typings/typings/react/react-addons-transition-group.d.ts",
95 | "modules/typings/typings/react/react-addons-update.d.ts",
96 | "modules/typings/typings/react/react-dom.d.ts",
97 | "modules/typings/typings/react/react-global.d.ts",
98 | "modules/typings/typings/react/react.d.ts",
99 | "modules/MantraTS/client/modules/comments/components/comment_list.tsx",
100 | "modules/MantraTS/client/modules/comments/components/create_comment.tsx",
101 | "modules/MantraTS/client/modules/core/components/layout.main.tsx",
102 | "modules/MantraTS/client/modules/core/components/navigations.tsx",
103 | "modules/MantraTS/client/modules/core/components/newpost.tsx",
104 | "modules/MantraTS/client/modules/core/components/post.tsx",
105 | "modules/MantraTS/client/modules/core/components/postlist.tsx",
106 | "modules/MantraTS/client/modules/core/routes.tsx",
107 | "modules/TodoAppTS/client/components/TodoHeader.tsx",
108 | "modules/TodoAppTS/client/components/TodoItem.tsx",
109 | "modules/TodoAppTS/client/components/TodoList.tsx",
110 | "modules/TodoAppTS/client/routes.tsx",
111 | "modules/TodoAppTS/client/TodoApp.tsx",
112 | "modules/TodoAppTS/client/TodoMain.tsx",
113 | "modules/TodoAppTS/MyHeader.tsx"
114 | ],
115 | "atom": {
116 | "rewriteTsconfig": true
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/modules/typings/packages/collectionfs.d.ts:
--------------------------------------------------------------------------------
1 | /// Definitions for the collectionFS smart package
2 | ///
3 | /// https://atmosphere.meteor.com/package/collectionFS
4 | /// https://github.com/CollectionFS/Meteor-CollectionFS
5 |
6 | declare function CollectionFS(name:string, options?: CollectionFS.CollectionFSOptions): void;
7 |
8 | interface CollectionFS {
9 | ObjectID(hexString?: any): Object;
10 | find(selector?: any, options?: any): Mongo.Cursor;
11 | findOne(selector?:any, options?:any):T;
12 | insert(doc:T, callback?:Function):string;
13 | update(selector: any, modifier: any, options?: {multi?: boolean; upsert?: boolean;}, callback?:Function): number;
14 | upsert(selector: any, modifier: any, options?: {multi?: boolean;}, callback?:Function): {numberAffected?: number; insertedId?: string;}
15 | remove(selector: any, callback?:Function):number;
16 | allow(options:Mongo.AllowDenyOptions): boolean;
17 | deny(options:Mongo.AllowDenyOptions): boolean;
18 | fileHandlers(handlers: CollectionFS.FileHandlers): void;
19 | filter(options: CollectionFS.FilterOptions): void;
20 | fileIsAllowed(options: any): boolean;
21 | events(events:any): void;
22 | dispatch(...args: string[]): void;
23 |
24 | // Client API
25 | storeFile(file: File, metadata?: {}): string;
26 | storeFiles(files: File[], metadata: {}, callback?: (file: File, fileID: string) => void): {}[];
27 | retrieveBlob(fileId: string, callback: (fileItem: CollectionFS.FileItem) => void):any;
28 | acceptDrops(templateName: string, selector: string, metadata?: {}, callback?: (file: File, fileID: string) => void): void;
29 |
30 | // Server API
31 | storeBuffer(fileName: string, buffer: IBuffer, options: CollectionFS.StoreBufferOptions): string;
32 | retrieveBuffer(fileId: string): IBuffer;
33 | }
34 |
35 | declare module CollectionFS{
36 | interface FileHandlers {
37 | [id: string]: (options: CollectionFS.FileHandlerOptions) => any;
38 | }
39 |
40 | interface CollectionFSOptions {
41 | autopublish:boolean;
42 | maxFileHandlers: number;
43 | }
44 |
45 | interface FilterOptions {
46 | allow?: {
47 | extensions?: string[];
48 | contentTypes?: string[];
49 | };
50 | deny?: {
51 | extensions?: string[];
52 | contentTypes?: string[];
53 | };
54 | maxSize?: number;
55 | }
56 |
57 | interface FileItem {
58 | _id: string;
59 | countChunks: number;
60 | length: number;
61 | file?: any;
62 | blob?: IBuffer;
63 | }
64 |
65 | interface StoreBufferOptions {
66 | contentType?: string;
67 | owner?: string;
68 | noProgress?: boolean;
69 | metaData?: {};
70 | encoding?: string;
71 | }
72 |
73 | interface FileRecord {
74 | chunkSize?: number; // Default 256kb ~ 262.144 bytes
75 | uploadDate?: number; // Client set date
76 | handledAt?: number; // datetime set by Server when handled
77 | fileHandler?:{}; // fileHandler supplied data if any
78 | md5?: any; // Not yet implemented
79 | complete?: boolean; // countChunks == numChunks
80 | currentChunk?: number; // Used to coordinate clients
81 | owner?: string;
82 | countChunks?: number; // Expected number of chunks
83 | numChunks?: number; // number of chunks in database
84 | filename?: string; // Original filename
85 | length?: string; // Issue in Meteor
86 | contentType?: string;
87 | encoding?: string; // Default 'utf-8'
88 | metadata?: {}
89 | }
90 |
91 | interface FileHandlerOptions {
92 | blob: IBuffer; // Type of node.js Buffer()
93 | fileRecord: FileRecord;
94 | destination: (extension?:string) => {serverFilename: Destination};
95 | sumFailes: number;
96 | }
97 |
98 | interface Destination {
99 | serverFilename: string;
100 | fileDate: {
101 | url: string;
102 | extension: string;
103 | }
104 | }
105 | }
106 |
107 | //Copied from node.d.ts since node.d.ts was giving me compile errors for overloading some signatures
108 | interface IBuffer extends NodeBuffer {
109 | new (str: string, encoding?: string): NodeBuffer;
110 | new (size: number): NodeBuffer;
111 | new (array: any[]): NodeBuffer;
112 | prototype: NodeBuffer;
113 | isBuffer(obj: any): boolean;
114 | byteLength(string: string, encoding?: string): number;
115 | concat (list: NodeBuffer[], totalLength?: number): NodeBuffer;
116 | }
117 |
118 | //Code below this point is for the devel branch that should be compatible with Meteor 0.8.x
119 | declare module FS {
120 | function Collection(name:string, options?: FS.CollectionOptions):any;
121 |
122 | interface Collection {
123 | ObjectID(hexString?: any): Object;
124 | find(selector?: any, options?:any): Mongo.Cursor;
125 | findOne(selector?:any, options?:any):T;
126 | insert(doc:T, callback?:Function):string;
127 | update(selector: any, modifier: any, options?: {multi?: boolean; upsert?: boolean;}, callback?:Function): number;
128 | upsert(selector: any, modifier: any, options?: {multi?: boolean;}, callback?:Function): {numberAffected?: number; insertedId?: string;}
129 | remove(selector: any, callback?:Function):number;
130 | allow(options:Mongo.AllowDenyOptions): boolean;
131 | deny(options:Mongo.AllowDenyOptions): boolean;
132 | fileHandlers(handlers: CollectionFS.FileHandlers): void;
133 | filter(options: CollectionFS.FilterOptions): void;
134 | fileIsAllowed(options: any): boolean;
135 | events(events:any): void;
136 | dispatch(...args: string[]): void;
137 |
138 | // Client API
139 | storeFile(file: File, metadata?: {}): string;
140 | storeFiles(files: File[], metadata: {}, callback?: (file: File, fileID: string) => void): {}[];
141 | retrieveBlob(fileId: string, callback: (fileItem: CollectionFS.FileItem) => void):any;
142 | acceptDrops(templateName: string, selector: string, metadata?: {}, callback?: (file: File, fileID: string) => void): void;
143 |
144 | // Server API
145 | storeBuffer(fileName: string, buffer: IBuffer, options: CollectionFS.StoreBufferOptions): string;
146 | retrieveBuffer(fileId: string): IBuffer;
147 | }
148 |
149 | interface CollectionOptions {
150 | autopublish:boolean;
151 | maxFileHandlers: number;
152 | }
153 |
154 | interface Store {
155 | FileSystem(name: string, options?: {path: string;}):any;
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/modules/typings/typings/react/react-addons-test-utils.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for React v0.14 (react-addons-test-utils)
2 | // Project: http://facebook.github.io/react/
3 | // Definitions by: Asana , AssureSign , Microsoft
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | ///
7 |
8 | declare namespace __React {
9 | interface SyntheticEventData {
10 | altKey?: boolean;
11 | button?: number;
12 | buttons?: number;
13 | clientX?: number;
14 | clientY?: number;
15 | changedTouches?: TouchList;
16 | charCode?: boolean;
17 | clipboardData?: DataTransfer;
18 | ctrlKey?: boolean;
19 | deltaMode?: number;
20 | deltaX?: number;
21 | deltaY?: number;
22 | deltaZ?: number;
23 | detail?: number;
24 | getModifierState?(key: string): boolean;
25 | key?: string;
26 | keyCode?: number;
27 | locale?: string;
28 | location?: number;
29 | metaKey?: boolean;
30 | pageX?: number;
31 | pageY?: number;
32 | relatedTarget?: EventTarget;
33 | repeat?: boolean;
34 | screenX?: number;
35 | screenY?: number;
36 | shiftKey?: boolean;
37 | targetTouches?: TouchList;
38 | touches?: TouchList;
39 | view?: AbstractView;
40 | which?: number;
41 | }
42 |
43 | interface EventSimulator {
44 | (element: Element, eventData?: SyntheticEventData): void;
45 | (component: Component, eventData?: SyntheticEventData): void;
46 | }
47 |
48 | interface MockedComponentClass {
49 | new(): any;
50 | }
51 |
52 | class ShallowRenderer {
53 | getRenderOutput>(): E;
54 | getRenderOutput(): ReactElement;
55 | render(element: ReactElement, context?: any): void;
56 | unmount(): void;
57 | }
58 |
59 | namespace __Addons {
60 | namespace TestUtils {
61 | namespace Simulate {
62 | export var blur: EventSimulator;
63 | export var change: EventSimulator;
64 | export var click: EventSimulator;
65 | export var cut: EventSimulator;
66 | export var doubleClick: EventSimulator;
67 | export var drag: EventSimulator;
68 | export var dragEnd: EventSimulator;
69 | export var dragEnter: EventSimulator;
70 | export var dragExit: EventSimulator;
71 | export var dragLeave: EventSimulator;
72 | export var dragOver: EventSimulator;
73 | export var dragStart: EventSimulator;
74 | export var drop: EventSimulator;
75 | export var focus: EventSimulator;
76 | export var input: EventSimulator;
77 | export var keyDown: EventSimulator;
78 | export var keyPress: EventSimulator;
79 | export var keyUp: EventSimulator;
80 | export var mouseDown: EventSimulator;
81 | export var mouseEnter: EventSimulator;
82 | export var mouseLeave: EventSimulator;
83 | export var mouseMove: EventSimulator;
84 | export var mouseOut: EventSimulator;
85 | export var mouseOver: EventSimulator;
86 | export var mouseUp: EventSimulator;
87 | export var paste: EventSimulator;
88 | export var scroll: EventSimulator;
89 | export var submit: EventSimulator;
90 | export var touchCancel: EventSimulator;
91 | export var touchEnd: EventSimulator;
92 | export var touchMove: EventSimulator;
93 | export var touchStart: EventSimulator;
94 | export var wheel: EventSimulator;
95 | }
96 |
97 | export function renderIntoDocument(
98 | element: DOMElement): Element;
99 | export function renderIntoDocument(
100 | element: ReactElement
): Component
;
101 | export function renderIntoDocument>(
102 | element: ReactElement): C;
103 |
104 | export function mockComponent(
105 | mocked: MockedComponentClass, mockTagName?: string): typeof TestUtils;
106 |
107 | export function isElementOfType(
108 | element: ReactElement, type: ReactType): boolean;
109 | export function isDOMComponent(instance: ReactInstance): boolean;
110 | export function isCompositeComponent(instance: ReactInstance): boolean;
111 | export function isCompositeComponentWithType(
112 | instance: ReactInstance,
113 | type: ComponentClass): boolean;
114 |
115 | export function findAllInRenderedTree(
116 | root: Component,
117 | fn: (i: ReactInstance) => boolean): ReactInstance[];
118 |
119 | export function scryRenderedDOMComponentsWithClass(
120 | root: Component,
121 | className: string): Element[];
122 | export function findRenderedDOMComponentWithClass(
123 | root: Component,
124 | className: string): Element;
125 |
126 | export function scryRenderedDOMComponentsWithTag(
127 | root: Component,
128 | tagName: string): Element[];
129 | export function findRenderedDOMComponentWithTag(
130 | root: Component,
131 | tagName: string): Element;
132 |
133 | export function scryRenderedComponentsWithType(
134 | root: Component,
135 | type: ComponentClass): Component
[];
136 | export function scryRenderedComponentsWithType>(
137 | root: Component,
138 | type: ComponentClass): C[];
139 |
140 | export function findRenderedComponentWithType(
141 | root: Component,
142 | type: ComponentClass): Component
;
143 | export function findRenderedComponentWithType>(
144 | root: Component,
145 | type: ComponentClass): C;
146 |
147 | export function createRenderer(): ShallowRenderer;
148 | }
149 | }
150 | }
151 |
152 | declare module "react-addons-test-utils" {
153 | import TestUtils = __React.__Addons.TestUtils;
154 | export = TestUtils;
155 | }
156 |
--------------------------------------------------------------------------------
/modules/typings/packages/backbone.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Backbone 1.0.0
2 | // Project: http://backbonejs.org/
3 | // Definitions by: Boris Yankov , Natan Vivo
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | ///
7 | ///
8 |
9 | declare module Backbone {
10 |
11 | interface AddOptions extends Silenceable {
12 | at?: number;
13 | }
14 |
15 | interface HistoryOptions extends Silenceable {
16 | pushState?: boolean;
17 | root?: string;
18 | }
19 |
20 | interface NavigateOptions {
21 | trigger?: boolean;
22 | }
23 |
24 | interface RouterOptions {
25 | routes: any;
26 | }
27 |
28 | interface Silenceable {
29 | silent?: boolean;
30 | }
31 |
32 | interface Validable {
33 | validate?: boolean;
34 | }
35 |
36 | interface Waitable {
37 | wait?: boolean;
38 | }
39 |
40 | interface Parseable {
41 | parse?: any;
42 | }
43 |
44 | interface PersistenceOptions {
45 | url?: string;
46 | beforeSend?: (jqxhr: JQueryXHR) => void;
47 | success?: (modelOrCollection?: any, response?: any, options?: any) => void;
48 | error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void;
49 | }
50 |
51 | interface ModelSetOptions extends Silenceable, Validable {
52 | }
53 |
54 | interface ModelFetchOptions extends PersistenceOptions, ModelSetOptions, Parseable {
55 | }
56 |
57 | interface ModelSaveOptions extends Silenceable, Waitable, Validable, Parseable, PersistenceOptions {
58 | patch?: boolean;
59 | }
60 |
61 | interface ModelDestroyOptions extends Waitable, PersistenceOptions {
62 | }
63 |
64 | interface CollectionFetchOptions extends PersistenceOptions, Parseable {
65 | reset?: boolean;
66 | }
67 |
68 | class Events {
69 | on(eventName: string, callback?: Function, context?: any): any;
70 | off(eventName?: string, callback?: Function, context?: any): any;
71 | trigger(eventName: string, ...args: any[]): any;
72 | bind(eventName: string, callback: Function, context?: any): any;
73 | unbind(eventName?: string, callback?: Function, context?: any): any;
74 |
75 | once(events: string, callback: Function, context?: any): any;
76 | listenTo(object: any, events: string, callback: Function): any;
77 | listenToOnce(object: any, events: string, callback: Function): any;
78 | stopListening(object?: any, events?: string, callback?: Function): any;
79 | }
80 |
81 | class ModelBase extends Events {
82 | url: any;
83 | parse(response: any, options?: any): any;
84 | toJSON(options?: any): any;
85 | sync(...arg: any[]): JQueryXHR;
86 | }
87 |
88 | class Model extends ModelBase {
89 |
90 | /**
91 | * Do not use, prefer TypeScript's extend functionality.
92 | **/
93 | private static extend(properties: any, classProperties?: any): any;
94 |
95 | attributes: any;
96 | changed: any[];
97 | cid: string;
98 | collection: Collection;
99 |
100 | /**
101 | * Default attributes for the model. It can be an object hash or a method returning an object hash.
102 | * For assigning an object hash, do it like this: this.defaults = { attribute: value, ... };
103 | * That works only if you set it in the constructor or the initialize method.
104 | **/
105 | defaults(): any;
106 | id: any;
107 | idAttribute: string;
108 | validationError: any;
109 | urlRoot: any;
110 |
111 | constructor(attributes?: any, options?: any);
112 | initialize(attributes?: any, options?: any): void;
113 |
114 | fetch(options?: ModelFetchOptions): JQueryXHR;
115 |
116 | /**
117 | * For strongly-typed access to attributes, use the `get` method only privately in public getter properties.
118 | * @example
119 | * get name(): string {
120 | * return super.get("name");
121 | * }
122 | **/
123 | /*private*/ get(attributeName: string): any;
124 |
125 | /**
126 | * For strongly-typed assignment of attributes, use the `set` method only privately in public setter properties.
127 | * @example
128 | * set name(value: string) {
129 | * super.set("name", value);
130 | * }
131 | **/
132 | /*private*/ set(attributeName: string, value: any, options?: ModelSetOptions): Model;
133 | set(obj: any, options?: ModelSetOptions): Model;
134 |
135 | change(): any;
136 | changedAttributes(attributes?: any): any[];
137 | clear(options?: Silenceable): any;
138 | clone(): Model;
139 | destroy(options?: ModelDestroyOptions): any;
140 | escape(attribute: string): string;
141 | has(attribute: string): boolean;
142 | hasChanged(attribute?: string): boolean;
143 | isNew(): boolean;
144 | isValid(options?:any): boolean;
145 | previous(attribute: string): any;
146 | previousAttributes(): any[];
147 | save(attributes?: any, options?: ModelSaveOptions): any;
148 | unset(attribute: string, options?: Silenceable): Model;
149 | validate(attributes: any, options?: any): any;
150 |
151 | private _validate(attrs: any, options: any): boolean;
152 |
153 | // mixins from underscore
154 |
155 | keys(): string[];
156 | values(): any[];
157 | pairs(): any[];
158 | invert(): any;
159 | pick(keys: string[]): any;
160 | pick(...keys: string[]): any;
161 | omit(keys: string[]): any;
162 | omit(...keys: string[]): any;
163 | }
164 |
165 | class Collection extends ModelBase {
166 |
167 | /**
168 | * Do not use, prefer TypeScript's extend functionality.
169 | **/
170 | private static extend(properties: any, classProperties?: any): any;
171 |
172 | // TODO: this really has to be typeof TModel
173 | //model: typeof TModel;
174 | model: { new(): TModel; }; // workaround
175 | models: TModel[];
176 | length: number;
177 |
178 | constructor(models?: TModel[], options?: any);
179 | initialize(models?: TModel[], options?: any): void;
180 |
181 | fetch(options?: CollectionFetchOptions): JQueryXHR;
182 |
183 | comparator(element: TModel): number;
184 | comparator(compare: TModel, to?: TModel): number;
185 |
186 | add(model: TModel, options?: AddOptions): Collection;
187 | add(models: TModel[], options?: AddOptions): Collection;
188 | at(index: number): TModel;
189 | /**
190 | * Get a model from a collection, specified by an id, a cid, or by passing in a model.
191 | **/
192 | get(id: number): TModel;
193 | get(id: string): TModel;
194 | get(id: Model): TModel;
195 | create(attributes: any, options?: ModelSaveOptions): TModel;
196 | pluck(attribute: string): any[];
197 | push(model: TModel, options?: AddOptions): TModel;
198 | pop(options?: Silenceable): TModel;
199 | remove(model: TModel, options?: Silenceable): TModel;
200 | remove(models: TModel[], options?: Silenceable): TModel[];
201 | reset(models?: TModel[], options?: Silenceable): TModel[];
202 | set(models?: TModel[], options?: Silenceable): TModel[];
203 | shift(options?: Silenceable): TModel;
204 | sort(options?: Silenceable): Collection;
205 | unshift(model: TModel, options?: AddOptions): TModel;
206 | where(properies: any): TModel[];
207 | findWhere(properties: any): TModel;
208 |
209 | private _prepareModel(attrs?: any, options?: any): any;
210 | private _removeReference(model: TModel): void;
211 | private _onModelEvent(event: string, model: TModel, collection: Collection, options: any): void;
212 |
213 | // mixins from underscore
214 |
215 | all(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
216 | any(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
217 | collect(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[];
218 | chain(): any;
219 | contains(value: any): boolean;
220 | countBy(iterator: (element: TModel, index: number) => any): _.Dictionary;
221 | countBy(attribute: string): _.Dictionary;
222 | detect(iterator: (item: any) => boolean, context?: any): any; // ???
223 | drop(): TModel;
224 | drop(n: number): TModel[];
225 | each(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
226 | every(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
227 | filter(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[];
228 | find(iterator: (element: TModel, index: number) => boolean, context?: any): TModel;
229 | first(): TModel;
230 | first(n: number): TModel[];
231 | foldl(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
232 | forEach(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
233 | groupBy(iterator: (element: TModel, index: number) => string, context?: any): _.Dictionary;
234 | groupBy(attribute: string, context?: any): _.Dictionary;
235 | include(value: any): boolean;
236 | indexOf(element: TModel, isSorted?: boolean): number;
237 | initial(): TModel;
238 | initial(n: number): TModel[];
239 | inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
240 | isEmpty(object: any): boolean;
241 | invoke(methodName: string, args?: any[]): any;
242 | last(): TModel;
243 | last(n: number): TModel[];
244 | lastIndexOf(element: TModel, fromIndex?: number): number;
245 | map(iterator: (element: TModel, index: number, context?: any) => any, context?: any): any[];
246 | max(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
247 | min(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
248 | reduce(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
249 | select(iterator: any, context?: any): any[];
250 | size(): number;
251 | shuffle(): any[];
252 | some(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
253 | sortBy(iterator: (element: TModel, index: number) => number, context?: any): TModel[];
254 | sortBy(attribute: string, context?: any): TModel[];
255 | sortedIndex(element: TModel, iterator?: (element: TModel, index: number) => number): number;
256 | reduceRight(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any[];
257 | reject(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[];
258 | rest(): TModel;
259 | rest(n: number): TModel[];
260 | tail(): TModel;
261 | tail(n: number): TModel[];
262 | toArray(): any[];
263 | without(...values: any[]): TModel[];
264 | }
265 |
266 | class Router extends Events {
267 |
268 | /**
269 | * Do not use, prefer TypeScript's extend functionality.
270 | **/
271 | private static extend(properties: any, classProperties?: any): any;
272 |
273 | /**
274 | * Routes hash or a method returning the routes hash that maps URLs with parameters to methods on your Router.
275 | * For assigning routes as object hash, do it like this: this.routes = { "route": callback, ... };
276 | * That works only if you set it in the constructor or the initialize method.
277 | **/
278 | routes: any;
279 |
280 | constructor(options?: RouterOptions);
281 | initialize(options?: RouterOptions): void;
282 | route(route: string, name: string, callback?: Function): Router;
283 | route(route: RegExp, name: string, callback?: Function): Router;
284 | navigate(fragment: string, options?: NavigateOptions): Router;
285 | navigate(fragment: string, trigger?: boolean): Router;
286 |
287 | private _bindRoutes(): void;
288 | private _routeToRegExp(route: string): RegExp;
289 | private _extractParameters(route: RegExp, fragment: string): string[];
290 | }
291 |
292 | var history: History;
293 |
294 | class History extends Events {
295 |
296 | handlers: any[];
297 | interval: number;
298 |
299 | start(options?: HistoryOptions): boolean;
300 |
301 | getHash(window?: Window): string;
302 | getFragment(fragment?: string, forcePushState?: boolean): string;
303 | stop(): void;
304 | route(route: string, callback: Function): number;
305 | checkUrl(e?: any): void;
306 | loadUrl(fragmentOverride: string): boolean;
307 | navigate(fragment: string, options?: any): boolean;
308 | started: boolean;
309 | options: any;
310 |
311 | private _updateHash(location: Location, fragment: string, replace: boolean): void;
312 | }
313 |
314 | interface ViewOptions {
315 | model?: TModel;
316 | collection?: Backbone.Collection;
317 | el?: any;
318 | id?: string;
319 | className?: string;
320 | tagName?: string;
321 | attributes?: {[id: string]: any};
322 | }
323 |
324 | class View extends Events {
325 |
326 | /**
327 | * Do not use, prefer TypeScript's extend functionality.
328 | **/
329 | private static extend(properties: any, classProperties?: any): any;
330 |
331 | constructor(options?: ViewOptions);
332 | initialize(options?: ViewOptions): void;
333 |
334 | /**
335 | * Events hash or a method returning the events hash that maps events/selectors to methods on your View.
336 | * For assigning events as object hash, do it like this: this.events = { "event:selector": callback, ... };
337 | * That works only if you set it in the constructor or the initialize method.
338 | **/
339 | events(): any;
340 |
341 | $(selector: string): JQuery;
342 | model: TModel;
343 | collection: Collection;
344 | //template: (json, options?) => string;
345 | setElement(element: HTMLElement, delegate?: boolean): View;
346 | setElement(element: JQuery, delegate?: boolean): View;
347 | id: string;
348 | cid: string;
349 | className: string;
350 | tagName: string;
351 |
352 | el: any;
353 | $el: JQuery;
354 | setElement(element: any): View;
355 | attributes: any;
356 | $(selector: any): JQuery;
357 | render(): View;
358 | remove(): View;
359 | make(tagName: any, attributes?: any, content?: any): any;
360 | delegateEvents(events?: any): any;
361 | undelegateEvents(): any;
362 |
363 | _ensureElement(): void;
364 | }
365 |
366 | // SYNC
367 | function sync(method: string, model: Model, options?: JQueryAjaxSettings): any;
368 | function ajax(options?: JQueryAjaxSettings): JQueryXHR;
369 | var emulateHTTP: boolean;
370 | var emulateJSON: boolean;
371 |
372 | // Utility
373 | function noConflict(): typeof Backbone;
374 | var $: JQueryStatic;
375 | }
376 |
377 | declare module "backbone" {
378 | export = Backbone;
379 | }
380 |
--------------------------------------------------------------------------------
/modules/typings/packages/moment-node.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Moment.js 2.8.0
2 | // Project: https://github.com/timrwood/moment
3 | // Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | declare module moment {
7 |
8 | interface MomentInput {
9 |
10 | years?: number;
11 | y?: number;
12 |
13 | months?: number;
14 | M?: number;
15 |
16 | weeks?: number;
17 | w?: number;
18 |
19 | days?: number;
20 | d?: number;
21 |
22 | hours?: number;
23 | h?: number;
24 |
25 | minutes?: number;
26 | m?: number;
27 |
28 | seconds?: number;
29 | s?: number;
30 |
31 | milliseconds?: number;
32 | ms?: number;
33 |
34 | }
35 |
36 | interface Duration {
37 |
38 | humanize(withSuffix?: boolean): string;
39 |
40 | as(units: string): number;
41 |
42 | milliseconds(): number;
43 | asMilliseconds(): number;
44 |
45 | seconds(): number;
46 | asSeconds(): number;
47 |
48 | minutes(): number;
49 | asMinutes(): number;
50 |
51 | hours(): number;
52 | asHours(): number;
53 |
54 | days(): number;
55 | asDays(): number;
56 |
57 | months(): number;
58 | asMonths(): number;
59 |
60 | years(): number;
61 | asYears(): number;
62 |
63 | add(n: number, p: string): Duration;
64 | add(n: number): Duration;
65 | add(d: Duration): Duration;
66 |
67 | subtract(n: number, p: string): Duration;
68 | subtract(n: number): Duration;
69 | subtract(d: Duration): Duration;
70 |
71 | toISOString(): string;
72 |
73 | }
74 |
75 | interface Moment {
76 |
77 | format(format: string): string;
78 | format(): string;
79 |
80 | fromNow(withoutSuffix?: boolean): string;
81 |
82 | startOf(unitOfTime: string): Moment;
83 | endOf(unitOfTime: string): Moment;
84 |
85 | /**
86 | * Mutates the original moment by adding time. (deprecated in 2.8.0)
87 | *
88 | * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
89 | * @param amount the amount you want to add
90 | */
91 | add(unitOfTime: string, amount: number): Moment;
92 | /**
93 | * Mutates the original moment by adding time.
94 | *
95 | * @param amount the amount you want to add
96 | * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
97 | */
98 | add(amount: number, unitOfTime: string): Moment;
99 | /**
100 | * Mutates the original moment by adding time. Note that the order of arguments can be flipped.
101 | *
102 | * @param amount the amount you want to add
103 | * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
104 | */
105 | add(amount: string, unitOfTime: string): Moment;
106 | /**
107 | * Mutates the original moment by adding time.
108 | *
109 | * @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
110 | */
111 | add(objectLiteral: MomentInput): Moment;
112 | /**
113 | * Mutates the original moment by adding time.
114 | *
115 | * @param duration a length of time
116 | */
117 | add(duration: Duration): Moment;
118 |
119 | /**
120 | * Mutates the original moment by subtracting time. (deprecated in 2.8.0)
121 | *
122 | * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
123 | * @param amount the amount you want to subtract
124 | */
125 | subtract(unitOfTime: string, amount: number): Moment;
126 | /**
127 | * Mutates the original moment by subtracting time.
128 | *
129 | * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
130 | * @param amount the amount you want to subtract
131 | */
132 | subtract(amount: number, unitOfTime: string): Moment;
133 | /**
134 | * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped.
135 | *
136 | * @param amount the amount you want to add
137 | * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
138 | */
139 | subtract(amount: string, unitOfTime: string): Moment;
140 | /**
141 | * Mutates the original moment by subtracting time.
142 | *
143 | * @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
144 | */
145 | subtract(objectLiteral: MomentInput): Moment;
146 | /**
147 | * Mutates the original moment by subtracting time.
148 | *
149 | * @param duration a length of time
150 | */
151 | subtract(duration: Duration): Moment;
152 |
153 | calendar(): string;
154 | calendar(start: Moment): string;
155 |
156 | clone(): Moment;
157 |
158 | /**
159 | * @return Unix timestamp, or milliseconds since the epoch.
160 | */
161 | valueOf(): number;
162 |
163 | local(): Moment; // current date/time in local mode
164 |
165 | utc(): Moment; // current date/time in UTC mode
166 |
167 | isValid(): boolean;
168 |
169 | year(y: number): Moment;
170 | year(): number;
171 | quarter(): number;
172 | quarter(q: number): Moment;
173 | month(M: number): Moment;
174 | month(M: string): Moment;
175 | month(): number;
176 | day(d: number): Moment;
177 | day(d: string): Moment;
178 | day(): number;
179 | date(d: number): Moment;
180 | date(): number;
181 | hour(h: number): Moment;
182 | hour(): number;
183 | hours(h: number): Moment;
184 | hours(): number;
185 | minute(m: number): Moment;
186 | minute(): number;
187 | minutes(m: number): Moment;
188 | minutes(): number;
189 | second(s: number): Moment;
190 | second(): number;
191 | seconds(s: number): Moment;
192 | seconds(): number;
193 | millisecond(ms: number): Moment;
194 | millisecond(): number;
195 | milliseconds(ms: number): Moment;
196 | milliseconds(): number;
197 | weekday(): number;
198 | weekday(d: number): Moment;
199 | isoWeekday(): number;
200 | isoWeekday(d: number): Moment;
201 | weekYear(): number;
202 | weekYear(d: number): Moment;
203 | isoWeekYear(): number;
204 | isoWeekYear(d: number): Moment;
205 | week(): number;
206 | week(d: number): Moment;
207 | weeks(): number;
208 | weeks(d: number): Moment;
209 | isoWeek(): number;
210 | isoWeek(d: number): Moment;
211 | isoWeeks(): number;
212 | isoWeeks(d: number): Moment;
213 | weeksInYear(): number;
214 | isoWeeksInYear(): number;
215 | dayOfYear(): number;
216 | dayOfYear(d: number): Moment;
217 |
218 | from(f: Moment): string;
219 | from(f: Moment, suffix: boolean): string;
220 | from(d: Date): string;
221 | from(s: string): string;
222 | from(date: number[]): string;
223 |
224 | diff(b: Moment): number;
225 | diff(b: Moment, unitOfTime: string): number;
226 | diff(b: Moment, unitOfTime: string, round: boolean): number;
227 |
228 | toArray(): number[];
229 | toDate(): Date;
230 | toISOString(): string;
231 | toJSON(): string;
232 | unix(): number;
233 |
234 | isLeapYear(): boolean;
235 | zone(): number;
236 | zone(b: number): Moment;
237 | zone(b: string): Moment;
238 | utcOffset(): number;
239 | utcOffset(b: number): Moment;
240 | utcOffset(b: string): Moment;
241 | daysInMonth(): number;
242 | isDST(): boolean;
243 |
244 | isBefore(): boolean;
245 | isBefore(b: Moment): boolean;
246 | isBefore(b: string): boolean;
247 | isBefore(b: Number): boolean;
248 | isBefore(b: Date): boolean;
249 | isBefore(b: number[]): boolean;
250 | isBefore(b: Moment, granularity: string): boolean;
251 | isBefore(b: String, granularity: string): boolean;
252 | isBefore(b: Number, granularity: string): boolean;
253 | isBefore(b: Date, granularity: string): boolean;
254 | isBefore(b: number[], granularity: string): boolean;
255 |
256 | isAfter(): boolean;
257 | isAfter(b: Moment): boolean;
258 | isAfter(b: string): boolean;
259 | isAfter(b: Number): boolean;
260 | isAfter(b: Date): boolean;
261 | isAfter(b: number[]): boolean;
262 | isAfter(b: Moment, granularity: string): boolean;
263 | isAfter(b: String, granularity: string): boolean;
264 | isAfter(b: Number, granularity: string): boolean;
265 | isAfter(b: Date, granularity: string): boolean;
266 | isAfter(b: number[], granularity: string): boolean;
267 |
268 | isSame(b: Moment): boolean;
269 | isSame(b: string): boolean;
270 | isSame(b: Number): boolean;
271 | isSame(b: Date): boolean;
272 | isSame(b: number[]): boolean;
273 | isSame(b: Moment, granularity: string): boolean;
274 | isSame(b: String, granularity: string): boolean;
275 | isSame(b: Number, granularity: string): boolean;
276 | isSame(b: Date, granularity: string): boolean;
277 | isSame(b: number[], granularity: string): boolean;
278 |
279 | // Deprecated as of 2.8.0.
280 | lang(language: string): Moment;
281 | lang(reset: boolean): Moment;
282 | lang(): MomentLanguage;
283 |
284 | locale(language: string): Moment;
285 | locale(reset: boolean): Moment;
286 | locale(): string;
287 |
288 | localeData(language: string): Moment;
289 | localeData(reset: boolean): Moment;
290 | localeData(): MomentLanguage;
291 |
292 | // Deprecated as of 2.7.0.
293 | max(date: Date): Moment;
294 | max(date: number): Moment;
295 | max(date: any[]): Moment;
296 | max(date: string): Moment;
297 | max(date: string, format: string): Moment;
298 | max(clone: Moment): Moment;
299 |
300 | // Deprecated as of 2.7.0.
301 | min(date: Date): Moment;
302 | min(date: number): Moment;
303 | min(date: any[]): Moment;
304 | min(date: string): Moment;
305 | min(date: string, format: string): Moment;
306 | min(clone: Moment): Moment;
307 |
308 | get(unit: string): number;
309 | set(unit: string, value: number): Moment;
310 |
311 | }
312 |
313 | interface MomentCalendar {
314 |
315 | lastDay: any;
316 | sameDay: any;
317 | nextDay: any;
318 | lastWeek: any;
319 | nextWeek: any;
320 | sameElse: any;
321 |
322 | }
323 |
324 | interface BaseMomentLanguage {
325 | months ?: any;
326 | monthsShort ?: any;
327 | weekdays ?: any;
328 | weekdaysShort ?: any;
329 | weekdaysMin ?: any;
330 | relativeTime ?: MomentRelativeTime;
331 | meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string;
332 | calendar ?: MomentCalendar;
333 | ordinal ?: (num: number) => string;
334 | }
335 |
336 | interface MomentLanguage extends BaseMomentLanguage {
337 | longDateFormat?: MomentLongDateFormat;
338 | }
339 |
340 | interface MomentLanguageData extends BaseMomentLanguage {
341 | /**
342 | * @param formatType should be L, LL, LLL, LLLL.
343 | */
344 | longDateFormat(formatType: string): string;
345 | }
346 |
347 | interface MomentLongDateFormat {
348 |
349 | L: string;
350 | LL: string;
351 | LLL: string;
352 | LLLL: string;
353 | LT: string;
354 | l?: string;
355 | ll?: string;
356 | lll?: string;
357 | llll?: string;
358 | lt?: string;
359 |
360 | }
361 |
362 | interface MomentRelativeTime {
363 |
364 | future: any;
365 | past: any;
366 | s: any;
367 | m: any;
368 | mm: any;
369 | h: any;
370 | hh: any;
371 | d: any;
372 | dd: any;
373 | M: any;
374 | MM: any;
375 | y: any;
376 | yy: any;
377 |
378 | }
379 |
380 | interface MomentStatic {
381 |
382 | version: string;
383 |
384 | (): Moment;
385 | (date: number): Moment;
386 | (date: number[]): Moment;
387 | (date: string, format?: string, strict?: boolean): Moment;
388 | (date: string, format?: string, language?: string, strict?: boolean): Moment;
389 | (date: string, formats: string[], strict?: boolean): Moment;
390 | (date: string, formats: string[], language?: string, strict?: boolean): Moment;
391 | (date: string, specialFormat: () => void, strict?: boolean): Moment;
392 | (date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment;
393 | (date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment;
394 | (date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment;
395 | (date: Date): Moment;
396 | (date: Moment): Moment;
397 | (date: Object): Moment;
398 |
399 | utc(): Moment;
400 | utc(date: number): Moment;
401 | utc(date: number[]): Moment;
402 | utc(date: string, format?: string, strict?: boolean): Moment;
403 | utc(date: string, format?: string, language?: string, strict?: boolean): Moment;
404 | utc(date: string, formats: string[], strict?: boolean): Moment;
405 | utc(date: string, formats: string[], language?: string, strict?: boolean): Moment;
406 | utc(date: Date): Moment;
407 | utc(date: Moment): Moment;
408 | utc(date: Object): Moment;
409 |
410 | unix(timestamp: number): Moment;
411 |
412 | invalid(parsingFlags?: Object): Moment;
413 | isMoment(): boolean;
414 | isMoment(m: any): boolean;
415 | isDuration(): boolean;
416 | isDuration(d: any): boolean;
417 |
418 | // Deprecated in 2.8.0.
419 | lang(language?: string): string;
420 | lang(language?: string, definition?: MomentLanguage): string;
421 |
422 | locale(language?: string): string;
423 | locale(language?: string[]): string;
424 | locale(language?: string, definition?: MomentLanguage): string;
425 |
426 | localeData(language?: string): MomentLanguageData;
427 |
428 | longDateFormat: any;
429 | relativeTime: any;
430 | meridiem: (hour: number, minute: number, isLowercase: boolean) => string;
431 | calendar: any;
432 | ordinal: (num: number) => string;
433 |
434 | duration(milliseconds: Number): Duration;
435 | duration(num: Number, unitOfTime: string): Duration;
436 | duration(input: MomentInput): Duration;
437 | duration(object: any): Duration;
438 | duration(): Duration;
439 |
440 | parseZone(date: string): Moment;
441 |
442 | months(): string[];
443 | months(index: number): string;
444 | months(format: string): string[];
445 | months(format: string, index: number): string;
446 | monthsShort(): string[];
447 | monthsShort(index: number): string;
448 | monthsShort(format: string): string[];
449 | monthsShort(format: string, index: number): string;
450 |
451 | weekdays(): string[];
452 | weekdays(index: number): string;
453 | weekdays(format: string): string[];
454 | weekdays(format: string, index: number): string;
455 | weekdaysShort(): string[];
456 | weekdaysShort(index: number): string;
457 | weekdaysShort(format: string): string[];
458 | weekdaysShort(format: string, index: number): string;
459 | weekdaysMin(): string[];
460 | weekdaysMin(index: number): string;
461 | weekdaysMin(format: string): string[];
462 | weekdaysMin(format: string, index: number): string;
463 |
464 | min(moments: Moment[]): Moment;
465 | max(moments: Moment[]): Moment;
466 |
467 | normalizeUnits(unit: string): string;
468 | relativeTimeThreshold(threshold: string, limit: number): void;
469 |
470 | /**
471 | * Constant used to enable explicit ISO_8601 format parsing.
472 | */
473 | ISO_8601(): void;
474 |
475 | }
476 |
477 | }
478 |
479 | declare module 'moment' {
480 | var moment: moment.MomentStatic;
481 | //export = moment;
482 | export default moment;
483 | }
484 |
--------------------------------------------------------------------------------
/modules/typings/packages/kineticjs.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for KineticJS
2 | // Project: http://kineticjs.com/
3 | // Definitions by: Basarat Ali Syed , Ralph de Ruijter
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | declare module Kinetic {
7 |
8 | var Node: {
9 | new (config: ObjectOptionsConfig): INode;
10 | }
11 |
12 | interface INode {
13 | cache(cacheConfig?: any): INode;
14 | clone(attrs: any): INode;
15 | destroy(): void;
16 | draw(): INode;
17 | drawBuffer(): any;
18 | drawScene(): any;
19 | getAbsoluteOpacity(): number;
20 | getAbsolutePosition(): Vector2d;
21 | getAbsoluteTransform(): any;
22 | getAbsoluteZIndex(): number;
23 | getAttrs(): any;
24 | getDragBounds(): any;
25 | getDragConstraint(): any;
26 | getDraggable(): boolean;
27 | getLayer(): any;
28 | getLevel(): number;
29 | getListening(): any;
30 | getName(): string;
31 | getOffset(): Vector2d;
32 | getOpacity(): number;
33 | getParent(): any;
34 | getPosition(): Vector2d;
35 | getRotation(): number;
36 | getRotationDeg(): number;
37 | getScale(): Vector2d;
38 | getScaleX(): number;
39 | getScaleY(): number;
40 | getSize(): ISize;
41 | getStage(): IStage;
42 | getTransform(): any;
43 | getZIndex(): number;
44 | hide(): void;
45 | isDraggable(): boolean;
46 | isDragging(): boolean;
47 | isListening(): boolean;
48 | move(change:{x: number; y: number}): void;
49 | moveDown(): void;
50 | moveTo(newContainer: IContainer): void;
51 | moveToBottom(): void;
52 | moveToTop(): void;
53 | moveUp(): void;
54 | name(): string;
55 | name(name: string): void;
56 | remove(): any;
57 | rotate(theta: number): void;
58 | rotateDeg(deg: number): void;
59 |
60 | // Events
61 | on(typesStr: string, handler: (data: any) => any): void;
62 | off(typesStr: string): void;
63 | fire(typeStr: string, event?: any, bubble?: boolean): any;
64 |
65 | setAbsolutePosition(pos: Vector2d): void;
66 | setAttrs(config: any): void;
67 | setDefaultAttrs(config: any): void;
68 | setDragBounds(bounds: any): void;
69 |
70 | setDragConstraint(constraint: string): void;
71 | setDraggable(draggable: boolean): void;
72 | setListening(listening: boolean): void;
73 | setOffset(offset: Vector2d): any;
74 | setOpacity(opacity: any): void;
75 | setPosition(position: Vector2d): void;
76 | setRotation(theta: number): void;
77 | setRotationDeg(rotDeg: number): void;
78 | setScale(scale: Vector2d): void;
79 | setScaleX(scale: number): void;
80 | setScaleY(scale: number): void;
81 | setSize(size: ISize): any;
82 | setZIndex(zIndex: number): void;
83 | show(): void;
84 | simulate(eventType: string): void;
85 | toDataURL(config: any): void;
86 | transitionTo(config: any): void;
87 |
88 | // Width / Height
89 | width(): number;
90 | width(width: number): void;
91 | getWidth(): any;
92 | setWidth(width: number): void;
93 | height(): number;
94 | height(height: number): void;
95 | getHeight(): any;
96 | setHeight(height: number): any;
97 |
98 | // id
99 | id(): string;
100 | id(id: string): void;
101 | getId(): string;
102 | setId(id: string): void;
103 |
104 | // Position
105 | x(): number;
106 | x(x: number): void;
107 | y(): number;
108 | y(y: number): void;
109 | getX(): number;
110 | setX(x: number): void;
111 | getY(): number;
112 | setY(y: number): void;
113 | }
114 |
115 | var Container: {
116 | new (config: any): IContainer;
117 | }
118 |
119 | interface IContainer extends INode {
120 | add(child: INode): any;
121 | clone(attrs: any): IContainer;
122 | destroyChildren(): IContainer;
123 | find(selector: string): any;
124 | get(selector: any): any;
125 | getChildren(): INode[];
126 | getIntersections(point: any): any;
127 | isAncestorOf(node: any): any;
128 | removeChildren(): any;
129 | }
130 |
131 | var Stage: {
132 | new (config: StageConfig): IStage;
133 | }
134 |
135 | interface IStage extends IContainer {
136 | add(layer: ILayer): any;
137 | clear(): any;
138 | getContainer(): HTMLElement;
139 | getContent(): HTMLElement;
140 | getDOM(): HTMLElement;
141 | getHeight(): number;
142 | getIntersection(pos: any): any;
143 | getMousePosition(evt?: Event): any;
144 | getPointerPosition(): Vector2d;
145 | getStage(): IStage;
146 | getTouchPosition(evt?: Event): any;
147 | getUserPosition(evt?: Event): any;
148 | getWidth(): number;
149 | load(JSON: any): any;
150 | reset(): any;
151 | setHeight(height: number): any;
152 | setWidth(width: number): any;
153 | toDataURL(config: any): any;
154 | toImage(config: any, callback: () => any): any;
155 | toJSON(): any;
156 | }
157 |
158 | var Layer: {
159 | new (config?: LayerConfig): ILayer;
160 | }
161 |
162 | interface ILayer extends IContainer {
163 | afterDraw(handler: () => any): any;
164 | beforeDraw(handler: () => any): any;
165 | clear(): any;
166 | getCanvas(): ICanvas;
167 | getClearBeforeDraw(): any;
168 | getContext(): CanvasRenderingContext2D;
169 | remove(): any;
170 | setClearBeforeDraw(clearBeforeDraw: boolean): any;
171 | toDataURL(config: any): any;
172 | }
173 |
174 | interface ICanvas {
175 | _canvas: HTMLCanvasElement;
176 |
177 | getPixelRatio(): number;
178 |
179 | height: number;
180 | setPixelRatio(pixelRatio: number): any;
181 | width: number;
182 | }
183 |
184 | var Shape: {
185 | new (config: any): IShape;
186 | }
187 |
188 | interface IShape extends INode {
189 | applyLineJoin(): void;
190 | drawImage(): void;
191 | fill(): void;
192 | fillText(text: string): void;
193 | getCanvas(): ICanvas;
194 | getContext(): any;
195 | getDrawFunc(): any;
196 | getFill(): string;
197 | getLineJoin(): any;
198 | getShadow(): any;
199 | getStroke(): any;
200 | getStrokeWidth(): number;
201 | intersects(point: any): boolean;
202 | setDrawFunc(drawFunc: () => any): any;
203 | setFill(fill: string): any;
204 | setLineJoin(): any;
205 | setShadow(config: any): any;
206 | setSize(size: ISize): any;
207 | setStroke(stroke: string): any;
208 | setStrokeWidth(strokeWidth: number): any;
209 | stroke(): any;
210 | strokeText(text: string): any;
211 | }
212 |
213 | var Rect: {
214 | new (config: RectConfig): IRect;
215 | }
216 |
217 | interface IRect extends IShape {
218 | getCornerRadius(): number;
219 | getHeight(): number;
220 | getWidth(): number;
221 | setCornerRadius(radius: number): any;
222 | setHeight(height: number): any;
223 | setWidth(width: number): any;
224 | }
225 |
226 | var Circle: {
227 | new (config: CircleConfig): ICircle;
228 |
229 | }
230 |
231 | interface ICircle extends IShape {
232 | getRadius(): number;
233 | setRadius(radius: number): any;
234 | }
235 |
236 | var Ellipse: {
237 | new (config: CircleConfig): IEllipse;
238 | }
239 |
240 | interface IEllipse extends IShape {
241 | getRadius(): number;
242 | setRadius(radius: number): any;
243 | }
244 |
245 | var Group: {
246 | new (config?: ObjectOptionsConfig): IGroup;
247 | }
248 |
249 | interface IGroup extends IContainer {
250 | }
251 |
252 | var Collection: {
253 | new (): ICollection;
254 | }
255 |
256 | interface ICollection {
257 | apply(method: Function, val: any): any;
258 | each(func: () => any): any;
259 | }
260 |
261 | var Image: {
262 | new (config?: ImageConfig): IImage;
263 | }
264 |
265 | interface IImageAnimation {
266 | [index: string]: { frames: HTMLImageElement[], currentFrame: number }
267 | }
268 |
269 | interface IImage extends IShape {
270 | // TODO: very dirty
271 | anims: IImageAnimation;
272 | image: Function;
273 |
274 | applyFilter(config: any): any;
275 | clearImageBuffer(): any;
276 | createImageBuffer(callback: () => any): any;
277 | getCrop(): any;
278 | getFilter(): any;
279 | getHeight(): number;
280 | getImage(): IImage;
281 | getWidth(): number;
282 | setCrop(config: CropConfig): any;
283 | setFilter(config: any): any;
284 | setHeight(height: number): any;
285 | setImage(image: IImage): any;
286 | setWidth(width: number): any;
287 | }
288 |
289 | var Line: {
290 | new (config: LineConfig): ILine;
291 | }
292 |
293 | interface ILine extends IShape {
294 | getDashArray(): any;
295 | getLineCap(): any;
296 | getPoints(): any;
297 | setDashArray(dashArray: any): any;
298 | setLineCap(lineCap: string): any;
299 | setPoints(can: any[]): any;
300 | }
301 |
302 | var Path: {
303 | new (config: PathConfig): IPath;
304 | parsePathData(data: string): any;
305 | }
306 | interface IPath extends IShape {
307 | getData(): string;
308 | setData(SVG: string): any;
309 | }
310 |
311 | var RegularPolygon: {
312 | new (config: RegularPolygonConfig): IRegularPolygon;
313 | }
314 |
315 | interface IRegularPolygon extends IShape {
316 | getRadius(): number;
317 | getSides(): number;
318 | setRadius(radius: number): any;
319 | setSides(sides: number): any;
320 | }
321 |
322 | var Sprite: {
323 | new (config: SpriteConfig): ISprite;
324 | }
325 | interface ISprite extends IShape {
326 | afterFrame(index: number, func: () => any): any;
327 | getAnimation(): string;
328 | getAnimations(): any;
329 | getIndex(): number;
330 | setAnimation(anim: string): any;
331 | setAnimations(animations: any): any;
332 | setIndex(index: number): any;
333 | start(): any;
334 | stop(): any;
335 | }
336 |
337 | var Star: {
338 | new (config: StarConfig): IStar;
339 | }
340 | interface IStar extends IShape {
341 | getInnerRadius(): number;
342 | getNumPoints(): number;
343 | getOuterRadius(): number;
344 | setInnerRadius(radius: number): any;
345 | setNumPoints(points: number): any;
346 | setOuterRadius(radius: number): any;
347 | }
348 |
349 | var Text: {
350 | new (config: TextConfig): IText;
351 | }
352 | interface IText extends IShape {
353 | getAlign(): string;
354 | getBoxHeight(): number;
355 | getBoxWidth(): number;
356 | getFontFamily(): string;
357 | getFontSize(): number;
358 | getFontStyle(): string;
359 | getHeight(): number;
360 | getLineHeight(): number;
361 | getPadding(): number;
362 | getShadow(): any;
363 | getText(): string;
364 | getTextFill(): any;
365 | getTextHeight(): number;
366 | getTextStroke(): any;
367 | getTextStrokeWidth(): number;
368 | getTextWidth(): number;
369 | getWidth(): number;
370 | setAlign(align: string): any;
371 | setFontFamily(fontFamily: string): any;
372 | setFontSize(fontSize: number): any;
373 | setFontStroke(textStroke: any): any;
374 | setFontStyle(fontStyle: string): any;
375 | setHeight(height: number): any;
376 | setLineHeight(lineHeight: number): any;
377 | setPadding(padding: number): any;
378 | setShadow(config: any): any;
379 | setText(text: string): any;
380 | setTextFill(textFill: any): any;
381 | setTextStrokeWidth(textStrokeWidth: number): any;
382 | setWidth(width: number): any;
383 | }
384 |
385 | var TextPath: {
386 | new (config: any): ITextPath;
387 | }
388 | interface ITextPath extends IShape {
389 | getFontFamily(): string;
390 | getFontSize(): number;
391 | getFontStyle(): string;
392 | getText(): string;
393 | getTextFill(): any;
394 | getTextHeight(): number;
395 | getTextStroke(): any;
396 | getTextStrokeWidth(): number;
397 | getTextWidth(): number;
398 | setFontFamily(fontFamily: string): any;
399 | setFontSize(fontSize: number): any;
400 | setFontStroke(textStroke: any): any;
401 | setFontStyle(fontStyle: string): any;
402 | setText(text: string): any;
403 | setTextFill(textFill: any): any;
404 | setTextStrokeWidth(textStrokeWidth: number): any;
405 | }
406 |
407 | var Animation: {
408 | new (...args: any[]): IAnimation;
409 | }
410 | interface IAnimation extends IContainer {
411 | start(): any;
412 | stop(): any;
413 | }
414 |
415 | interface CropConfig {
416 | x: number;
417 | y: number;
418 | width: number;
419 | height: number;
420 | }
421 |
422 | interface StageConfig extends ObjectOptionsConfig {
423 | container: string;
424 | width: number;
425 | height: number;
426 | }
427 |
428 | interface LayerConfig extends ObjectOptionsConfig {
429 | clearBeforeDraw?: boolean;
430 | }
431 |
432 | //shape configs class
433 | interface RectConfig extends DrawOptionsConfig, ObjectOptionsConfig {
434 | width?: number;
435 | height?: number;
436 | cornerRadius?: number;
437 | }
438 |
439 | interface CircleConfig extends DrawOptionsConfig, ObjectOptionsConfig {
440 | radius: number;
441 | }
442 |
443 | interface ImageConfig extends DrawOptionsConfig, ObjectOptionsConfig {
444 | image: any;
445 | width?: number;
446 | height?: number;
447 | crop?: any;
448 | }
449 |
450 | interface SpriteConfig extends DrawOptionsConfig, ObjectOptionsConfig {
451 | image: any;
452 | animations?: any;
453 | animation?: any;
454 | frameRate?: number;
455 | }
456 |
457 | interface TextConfig extends DrawOptionsConfig, ObjectOptionsConfig {
458 | text: string;
459 | fontSize?: number;
460 | fontFamily?: string;
461 | fontStyle?: string;
462 | textFill?: any;
463 | textStroke?: any;
464 | textStrokeWidth?: number;
465 | align?: string;
466 | padding?: string;
467 | width?: number;
468 | height?: number;
469 | lineHeight?: number;
470 | cornerRadius?: number;
471 | }
472 |
473 | interface LineConfig extends DrawOptionsConfig, ObjectOptionsConfig {
474 | points: any;
475 | lineCap?: string;
476 | dash?: number[];
477 | }
478 |
479 | interface RegularPolygonConfig extends DrawOptionsConfig, ObjectOptionsConfig {
480 | sides: number;
481 | radius: number;
482 | }
483 |
484 | interface PathConfig extends DrawOptionsConfig, ObjectOptionsConfig {
485 | data: string;
486 | }
487 |
488 | interface StarConfig extends DrawOptionsConfig, ObjectOptionsConfig {
489 | numPoints: number;
490 | outerRadius: number;
491 | innerRadius: number;
492 | }
493 |
494 | interface CustomConfig extends DrawOptionsConfig, ObjectOptionsConfig {
495 | drawFunc: () => any;
496 | }
497 |
498 | interface DrawOptionsConfig {
499 | fill?: string;
500 | stroke?: string;
501 | strokeWidth?: number;
502 | lineJoin?: string;
503 | shadow?: any;
504 | }
505 |
506 | interface Vector2d {
507 | x: number;
508 | y: number;
509 | }
510 |
511 | interface ObjectOptionsConfig {
512 | x?: number;
513 | y?: number;
514 | visible?: boolean;
515 | listening?: boolean;
516 | id?: string;
517 | name?: string;
518 | opacity?: any;
519 | scale?: Vector2d;
520 | rotation?: number;
521 | rotationDeg?: number;
522 | offset?: Vector2d;
523 | draggable?: boolean;
524 | dragConstraint?: string;
525 | dragBounds?: any;
526 | dragBoundFunc?: (pos: Vector2d) => Vector2d;
527 | width?: number;
528 | height?: number;
529 | }
530 |
531 | interface ISize {
532 | width: number;
533 | height: number;
534 | }
535 | }
536 |
537 | declare module "kinetic" {
538 | export default Kinetic;
539 | }
540 |
--------------------------------------------------------------------------------