├── .meteor ├── .gitignore ├── release ├── platforms ├── .id ├── .finished-upgraders ├── packages └── versions ├── .gitignore ├── README.md ├── modules ├── Mantra │ ├── client │ │ ├── modules │ │ │ ├── core │ │ │ │ ├── actions │ │ │ │ │ ├── index.js │ │ │ │ │ ├── posts.js │ │ │ │ │ └── tests │ │ │ │ │ │ └── posts.js │ │ │ │ ├── configs │ │ │ │ │ └── method_stubs │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── posts.js │ │ │ │ ├── index.js │ │ │ │ ├── components │ │ │ │ │ ├── navigations.jsx │ │ │ │ │ ├── postlist.jsx │ │ │ │ │ ├── post.jsx │ │ │ │ │ ├── layout.main.jsx │ │ │ │ │ ├── tests │ │ │ │ │ │ ├── layout.main.js │ │ │ │ │ │ ├── navigations.js │ │ │ │ │ │ ├── post.js │ │ │ │ │ │ ├── postlist.js │ │ │ │ │ │ └── newpost.js │ │ │ │ │ ├── newpost.jsx │ │ │ │ │ └── style.css │ │ │ │ ├── containers │ │ │ │ │ ├── postlist.js │ │ │ │ │ ├── newpost.js │ │ │ │ │ ├── tests │ │ │ │ │ │ ├── newpost.js │ │ │ │ │ │ ├── postlist.js │ │ │ │ │ │ └── post.js │ │ │ │ │ └── post.js │ │ │ │ └── routes.jsx │ │ │ └── comments │ │ │ │ ├── configs │ │ │ │ └── method_stubs │ │ │ │ │ ├── index.js │ │ │ │ │ └── comments.js │ │ │ │ ├── index.js │ │ │ │ ├── actions │ │ │ │ ├── index.js │ │ │ │ └── comments.js │ │ │ │ ├── components │ │ │ │ ├── style.css │ │ │ │ ├── comment_list.jsx │ │ │ │ └── create_comment.jsx │ │ │ │ └── containers │ │ │ │ ├── comment_list.js │ │ │ │ └── create_comment.js │ │ ├── main.js │ │ └── configs │ │ │ └── context.js │ ├── lib │ │ └── collections.js │ └── server │ │ ├── main.js │ │ ├── configs │ │ └── initial_adds.js │ │ ├── publications │ │ └── posts.js │ │ └── methods │ │ └── posts.js ├── MantraTS │ ├── client │ │ ├── modules │ │ │ ├── core │ │ │ │ ├── actions │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── posts.ts │ │ │ │ │ └── tests │ │ │ │ │ │ └── posts.js │ │ │ │ ├── configs │ │ │ │ │ └── method_stubs │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ └── posts.ts │ │ │ │ ├── components │ │ │ │ │ ├── navigations.tsx │ │ │ │ │ ├── postlist.tsx │ │ │ │ │ ├── post.tsx │ │ │ │ │ ├── layout.main.tsx │ │ │ │ │ ├── tests │ │ │ │ │ │ ├── layout.main.js │ │ │ │ │ │ ├── navigations.js │ │ │ │ │ │ ├── post.js │ │ │ │ │ │ ├── postlist.js │ │ │ │ │ │ └── newpost.js │ │ │ │ │ ├── style.css │ │ │ │ │ └── newpost.tsx │ │ │ │ ├── index.ts │ │ │ │ ├── containers │ │ │ │ │ ├── postlist.ts │ │ │ │ │ ├── newpost.ts │ │ │ │ │ ├── tests │ │ │ │ │ │ ├── newpost.js │ │ │ │ │ │ ├── postlist.js │ │ │ │ │ │ └── post.js │ │ │ │ │ └── post.ts │ │ │ │ └── routes.tsx │ │ │ └── comments │ │ │ │ ├── actions │ │ │ │ ├── index.ts │ │ │ │ └── comments.ts │ │ │ │ ├── index.ts │ │ │ │ ├── configs │ │ │ │ └── method_stubs │ │ │ │ │ ├── index.ts │ │ │ │ │ └── comments.ts │ │ │ │ ├── components │ │ │ │ ├── style.css │ │ │ │ ├── comment_list.tsx │ │ │ │ └── create_comment.tsx │ │ │ │ └── containers │ │ │ │ ├── comment_list.ts │ │ │ │ └── create_comment.ts │ │ ├── main.js │ │ └── configs │ │ │ └── context.ts │ ├── server │ │ ├── main.ts │ │ ├── configs │ │ │ └── initial_adds.ts │ │ ├── publications │ │ │ └── posts.ts │ │ └── methods │ │ │ └── posts.ts │ └── common │ │ └── collections.ts ├── typings │ ├── packages │ │ ├── accounts.d.ts │ │ ├── subsManager.d.ts │ │ ├── marked.d.ts │ │ ├── t9n.d.ts │ │ ├── errors.d.ts │ │ ├── collection2.d.ts │ │ ├── google-maps-smart-package.d.ts │ │ ├── paginated-subscription.d.ts │ │ ├── moment.d.ts │ │ ├── messageFormat.d.ts │ │ ├── tomiUploads.d.ts │ │ ├── semanticui.d.ts │ │ ├── roles.d.ts │ │ ├── flash-messages.d.ts │ │ ├── flowRouter.d.ts │ │ ├── smallPackages.d.ts │ │ ├── meteor-typescript-utils.d.ts │ │ ├── bootstrap.d.ts │ │ ├── ironrouter.d.ts │ │ ├── collectionfs.d.ts │ │ ├── backbone.d.ts │ │ ├── moment-node.d.ts │ │ └── kineticjs.d.ts │ ├── meteor │ │ ├── meteor-extras.d.ts │ │ ├── mantra.d.ts │ │ └── node-fibers.d.ts │ ├── typings │ │ └── react │ │ │ ├── react-addons-create-fragment.d.ts │ │ │ ├── react-addons-pure-render-mixin.d.ts │ │ │ ├── react-addons-transition-group.d.ts │ │ │ ├── react-global.d.ts │ │ │ ├── react-addons-linked-state-mixin.d.ts │ │ │ ├── react-addons-update.d.ts │ │ │ ├── react-addons-css-transition-group.d.ts │ │ │ ├── react-addons-perf.d.ts │ │ │ ├── react-dom.d.ts │ │ │ └── react-addons-test-utils.d.ts │ └── packages.d.ts └── TodoAppTS │ ├── client │ ├── img │ │ ├── check.png │ │ └── scratched-texture.jpg │ ├── routes.tsx │ ├── components │ │ ├── TodoList.tsx │ │ ├── TodoItem.tsx │ │ └── TodoHeader.tsx │ ├── TodoApp.tsx │ ├── TodoMain.tsx │ └── css │ │ └── TodoApp.import.css │ ├── collections │ └── Tasks.ts │ ├── server │ └── todo-subscriptions.ts │ ├── MyHeader.tsx │ └── todo-methods.ts ├── main.html ├── entry ├── client │ ├── meteor.startup.js │ ├── entry.js │ ├── webpack.conf.js │ └── semantic.js ├── server │ ├── entry.js │ └── webpack.conf.js └── webpack.conf.js ├── webpack.packages.json ├── tslint.json └── tsconfig.json /.meteor/.gitignore: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /.meteor/release: -------------------------------------------------------------------------------- 1 | METEOR@1.2.1 2 | -------------------------------------------------------------------------------- /.meteor/platforms: -------------------------------------------------------------------------------- 1 | server 2 | browser 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | modules.zip 4 | .dist 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Important 2 | 3 | Repository moved to https://github.com/mantrajs/kickstart-mantrajs-webpack-typescript 4 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/actions/index.js: -------------------------------------------------------------------------------- 1 | import posts from './posts'; 2 | 3 | export default { 4 | posts 5 | }; 6 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/actions/index.ts: -------------------------------------------------------------------------------- 1 | import posts from './posts'; 2 | 3 | export default { 4 | posts 5 | }; 6 | -------------------------------------------------------------------------------- /modules/typings/packages/accounts.d.ts: -------------------------------------------------------------------------------- 1 | declare class AccountsTemplates { 2 | static configure(options: Object) : void; 3 | } 4 | -------------------------------------------------------------------------------- /modules/typings/packages/subsManager.d.ts: -------------------------------------------------------------------------------- 1 | declare class SubsManager { 2 | subscribe(route: string, ...params: any[]) : any; 3 | } 4 | -------------------------------------------------------------------------------- /main.html: -------------------------------------------------------------------------------- 1 | 2 | Kickstart Flowrouter 3 | 4 | 5 | -------------------------------------------------------------------------------- /modules/typings/packages/marked.d.ts: -------------------------------------------------------------------------------- 1 | declare function marked(text : string) : string; 2 | 3 | declare module "marked" { 4 | export default marked; 5 | } 6 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/img/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomitrescak/Meteor-Boilerplate-Webpack-Mantra-Typescript/HEAD/modules/TodoAppTS/client/img/check.png -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/configs/method_stubs/index.js: -------------------------------------------------------------------------------- 1 | import posts from './posts'; 2 | 3 | export default function (context) { 4 | posts(context); 5 | } 6 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/img/scratched-texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomitrescak/Meteor-Boilerplate-Webpack-Mantra-Typescript/HEAD/modules/TodoAppTS/client/img/scratched-texture.jpg -------------------------------------------------------------------------------- /modules/Mantra/lib/collections.js: -------------------------------------------------------------------------------- 1 | //import {Mongo} from 'meteor/mongo'; 2 | 3 | export const Posts = new Mongo.Collection('posts'); 4 | export const Comments = new Mongo.Collection('comments'); 5 | -------------------------------------------------------------------------------- /entry/client/meteor.startup.js: -------------------------------------------------------------------------------- 1 | // This file is sent directly to Meteor without going through Webpack 2 | // You can initialize anything you need before your app start here 3 | 4 | FlowRouter.wait(); 5 | -------------------------------------------------------------------------------- /modules/typings/packages/t9n.d.ts: -------------------------------------------------------------------------------- 1 | // Definitions for the T9n smart package 2 | // 3 | // https://github.com/tmeasday/meteor-errors 4 | 5 | declare module T9n { 6 | function get(text:string): string; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /entry/server/entry.js: -------------------------------------------------------------------------------- 1 | //import 'TodoAppTS/todo-methods'; 2 | //import 'TodoAppTS/server/todo-subscriptions' 3 | 4 | //import 'Mantra/server/main'; 5 | 6 | //import 'Mantra-Modules/server/main'; 7 | import 'MantraTS/server/main'; 8 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/configs/method_stubs/index.ts: -------------------------------------------------------------------------------- 1 | import posts from './posts'; 2 | 3 | import { IContext } from "../../../../configs/context"; 4 | 5 | export default function (context: IContext) { 6 | posts(context); 7 | } 8 | -------------------------------------------------------------------------------- /modules/typings/packages/errors.d.ts: -------------------------------------------------------------------------------- 1 | // Definitions for the errors smart package 2 | // 3 | // https://github.com/tmeasday/meteor-errors 4 | 5 | declare var Errors: { 6 | throw(message:string): void; 7 | clearSeen(): void; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/configs/method_stubs/index.js: -------------------------------------------------------------------------------- 1 | import comments from './comments'; 2 | 3 | // XXX: Here we can auto generate this file based on the method stubs 4 | export default function (context) { 5 | comments(context); 6 | } 7 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/index.js: -------------------------------------------------------------------------------- 1 | import methodStubs from './configs/method_stubs'; 2 | import actions from './actions'; 3 | 4 | export default { 5 | actions, 6 | load(context) { 7 | methodStubs(context); 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /modules/Mantra/server/main.js: -------------------------------------------------------------------------------- 1 | import addInitialData from './configs/initial_adds.js'; 2 | 3 | addInitialData(); 4 | 5 | // import publications 6 | 7 | import "./publications/posts"; 8 | 9 | // import methods 10 | 11 | import "./methods/posts"; 12 | -------------------------------------------------------------------------------- /modules/MantraTS/server/main.ts: -------------------------------------------------------------------------------- 1 | import addInitialData from './configs/initial_adds'; 2 | 3 | addInitialData(); 4 | 5 | // import publications 6 | 7 | import "./publications/posts"; 8 | 9 | // import methods 10 | 11 | import "./methods/posts"; 12 | -------------------------------------------------------------------------------- /modules/typings/packages/collection2.d.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | declare module Mongo { 3 | interface Collection { 4 | attachSchema(schema : any) : void; 5 | } 6 | } 7 | 8 | declare class SimpleSchema { 9 | constructor(schema : any); 10 | } 11 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/routes.tsx: -------------------------------------------------------------------------------- 1 | import TodoApp from "./TodoApp"; 2 | import TodoMain from "./TodoMain"; 3 | 4 | FlowRouter.route("/todo", { 5 | action() { 6 | ReactLayout.render(TodoApp, { 7 | children: 8 | }); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/actions/index.js: -------------------------------------------------------------------------------- 1 | import comments from './comments'; 2 | 3 | // XXX: Here, we can automatically generate this file based on the 4 | // actions inside this directory. 5 | const actions = { 6 | comments 7 | }; 8 | 9 | export default actions; 10 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/actions/index.ts: -------------------------------------------------------------------------------- 1 | import comments from './comments'; 2 | 3 | // XXX: Here, we can automatically generate this file based on the 4 | // actions inside this directory. 5 | const actions = { 6 | comments 7 | }; 8 | 9 | export default actions; 10 | -------------------------------------------------------------------------------- /modules/TodoAppTS/collections/Tasks.ts: -------------------------------------------------------------------------------- 1 | interface ITasks { 2 | private?: boolean; 3 | owner: string; 4 | text: string; 5 | createdAt: Date; 6 | username: string; 7 | } 8 | 9 | const Tasks = new Mongo.Collection('tasks'); 10 | 11 | export default Tasks; 12 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/index.js: -------------------------------------------------------------------------------- 1 | import methodStubs from './configs/method_stubs'; 2 | import actions from './actions'; 3 | import routes from './routes.jsx'; 4 | 5 | export default { 6 | routes, 7 | actions, 8 | load(context) { 9 | methodStubs(context); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/navigations.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Navigations = () => ( 4 |
5 | Navigations: 6 | Home | 7 | New Post 8 |
9 | ); 10 | 11 | export default Navigations; 12 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/navigations.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Navigations = () => ( 4 |
5 | Navigations: 6 | Home | 7 | New Post 8 |
9 | ); 10 | 11 | export default Navigations; 12 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/index.ts: -------------------------------------------------------------------------------- 1 | import methodStubs from './configs/method_stubs'; 2 | import actions from './actions'; 3 | 4 | import { IContext } from "../../configs/context"; 5 | 6 | export default { 7 | actions, 8 | load(context: IContext) { 9 | methodStubs(context); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/configs/method_stubs/index.ts: -------------------------------------------------------------------------------- 1 | import comments from './comments'; 2 | 3 | import { IContext } from "../../../../configs/context"; 4 | 5 | // XXX: Here we can auto generate this file based on the method stubs 6 | export default function (context: IContext) { 7 | comments(context); 8 | } 9 | -------------------------------------------------------------------------------- /modules/typings/meteor/meteor-extras.d.ts: -------------------------------------------------------------------------------- 1 | declare class ReactiveDict { 2 | get(key: string): any; 3 | set(key: string, value: any): void; 4 | } 5 | 6 | declare module "react-mixin" { 7 | const ReactMixin: any; 8 | export default ReactMixin; 9 | } 10 | 11 | declare module Meteor { 12 | export function uuid(): string; 13 | } 14 | -------------------------------------------------------------------------------- /.meteor/.id: -------------------------------------------------------------------------------- 1 | # This file contains a token that is unique to your project. 2 | # Check it into your repository along with the rest of this directory. 3 | # It can be used for purposes such as: 4 | # - ensuring you don't accidentally deploy one app on top of another 5 | # - providing package authors with aggregated statistics 6 | 7 | 1ucvcmg10aaymhkyordh 8 | -------------------------------------------------------------------------------- /modules/typings/packages/google-maps-smart-package.d.ts: -------------------------------------------------------------------------------- 1 | /// Definitions for the googlemaps smart package 2 | /// 3 | /// https://atmosphere.meteor.com/package/googlemaps 4 | /// https://github.com/drewjw81/meteor-googlemaps 5 | 6 | 7 | declare module GoogleMaps { 8 | function init(parameters: {[id: string]: any}, callback: () => void): void; 9 | } 10 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/index.ts: -------------------------------------------------------------------------------- 1 | import methodStubs from './configs/method_stubs'; 2 | import actions from './actions'; 3 | import routes from './routes'; 4 | 5 | import { IContext } from "../../configs/context"; 6 | 7 | export default { 8 | routes, 9 | actions, 10 | load(context: IContext) { 11 | methodStubs(context); 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/components/style.css: -------------------------------------------------------------------------------- 1 | .comments { 2 | font-size: 13px; 3 | } 4 | 5 | .comments textarea { 6 | width: 250px; 7 | outline: 0; 8 | border: 1px solid #ddd; 9 | padding: 5px 5px; 10 | } 11 | 12 | .comments .comment-list { 13 | margin-top: 15px; 14 | } 15 | 16 | .comments .error { 17 | color: red; 18 | padding: 5px 0; 19 | } 20 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/components/style.css: -------------------------------------------------------------------------------- 1 | .comments { 2 | font-size: 13px; 3 | } 4 | 5 | .comments textarea { 6 | width: 250px; 7 | outline: 0; 8 | border: 1px solid #ddd; 9 | padding: 5px 5px; 10 | } 11 | 12 | .comments .comment-list { 13 | margin-top: 15px; 14 | } 15 | 16 | .comments .error { 17 | color: red; 18 | padding: 5px 0; 19 | } 20 | -------------------------------------------------------------------------------- /entry/client/entry.js: -------------------------------------------------------------------------------- 1 | // Methods for optimistic updates 2 | import 'TodoAppTS/todo-methods'; 3 | 4 | import './semantic'; 5 | //import './routes'; 6 | 7 | import 'MantraTS/client/main'; 8 | 9 | FlowRouter.initialize(); 10 | 11 | //import 'Mantra/client/main'; 12 | //import 'MantraTS/client/main'; 13 | 14 | Accounts.ui.config({ 15 | passwordSignupFields: 'USERNAME_ONLY' 16 | }); 17 | -------------------------------------------------------------------------------- /modules/Mantra/server/configs/initial_adds.js: -------------------------------------------------------------------------------- 1 | import {Posts} from 'Mantra-Modules/lib/collections'; 2 | 3 | export default function () { 4 | if (!Posts.findOne()) { 5 | for (let lc = 1; lc <= 5; lc++) { 6 | const title = `This is the post title: ${lc}`; 7 | const content = `Post ${lc}'s content is great!`; 8 | Posts.insert({title, content}); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /modules/MantraTS/server/configs/initial_adds.ts: -------------------------------------------------------------------------------- 1 | import {Posts} from '../../common/collections'; 2 | 3 | export default function () { 4 | if (!Posts.findOne()) { 5 | for (let lc = 1; lc <= 5; lc++) { 6 | const title = `This is the post title: ${lc}`; 7 | const content = `Post ${lc}'s content is great!`; 8 | Posts.insert({title, content}); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/postlist.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const PostList = ({posts}) => ( 4 |
5 |
    6 | {posts.map(post => ( 7 |
  • 8 | {post.title} 9 |
  • 10 | ))} 11 |
12 |
13 | ); 14 | 15 | export default PostList; 16 | -------------------------------------------------------------------------------- /modules/TodoAppTS/server/todo-subscriptions.ts: -------------------------------------------------------------------------------- 1 | import Tasks from '../collections/Tasks'; 2 | 3 | // This code only runs on the server 4 | Meteor.publish('tasks', function () { 5 | return Tasks.find({ 6 | $or: [ 7 | { private: {$ne: true} }, 8 | { owner: this.userId } 9 | ] 10 | }); 11 | }); 12 | 13 | Meteor.publish('alltasks', function () { 14 | return Tasks.find(); 15 | }); 16 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/configs/method_stubs/comments.js: -------------------------------------------------------------------------------- 1 | export default function ({Collections, Meteor}) { 2 | Meteor.methods({ 3 | 'posts.createComment'(_id, postId, text) { 4 | const saving = true; 5 | const createdAt = new Date(); 6 | const author = 'Me'; 7 | Collections.Comments.insert({ 8 | _id, postId, text, saving, createdAt, author 9 | }); 10 | } 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /.meteor/.finished-upgraders: -------------------------------------------------------------------------------- 1 | # This file contains information which helps Meteor properly upgrade your 2 | # app when you run 'meteor update'. You should check it into version control 3 | # with your project. 4 | 5 | notices-for-0.9.0 6 | notices-for-0.9.1 7 | 0.9.4-platform-file 8 | notices-for-facebook-graph-api-2 9 | 1.2.0-standard-minifiers-package 10 | 1.2.0-meteor-platform-split 11 | 1.2.0-cordova-changes 12 | 1.2.0-breaking-changes 13 | -------------------------------------------------------------------------------- /modules/Mantra/client/main.js: -------------------------------------------------------------------------------- 1 | import {createApp} from 'mantra-core'; 2 | import initContext from './configs/context'; 3 | 4 | // modules 5 | import coreModule from './modules/core'; 6 | import commentsModule from './modules/comments'; 7 | 8 | // init context 9 | const context = initContext(); 10 | 11 | // create app 12 | const app = createApp(context); 13 | app.loadModule(coreModule); 14 | app.loadModule(commentsModule); 15 | app.init(); 16 | -------------------------------------------------------------------------------- /modules/MantraTS/client/main.js: -------------------------------------------------------------------------------- 1 | import {createApp} from 'mantra-core'; 2 | import initContext from './configs/context'; 3 | 4 | // modules 5 | import coreModule from './modules/core'; 6 | import commentsModule from './modules/comments'; 7 | 8 | // init context 9 | const context = initContext(); 10 | 11 | // create app 12 | const app = createApp(context); 13 | app.loadModule(coreModule); 14 | app.loadModule(commentsModule); 15 | app.init(); 16 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/components/TodoList.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TodoItem from './TodoItem'; 3 | 4 | interface Props { 5 | isRequired?: boolean, 6 | tasks: any 7 | } 8 | 9 | export default class TodoList extends React.Component { 10 | 11 | render() { 12 | return ( 13 |
    14 | {this.props.tasks.map((task: any) => )} 15 |
16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/postlist.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { IPosts } from "../../../../common/collections"; 4 | 5 | const PostList = ({posts}) => ( 6 |
7 |
    8 | {posts.map((post: IPosts) => ( 9 |
  • 10 | {post.title} 11 |
  • 12 | ))} 13 |
14 |
15 | ); 16 | 17 | export default PostList; 18 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/post.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CommentList from "../../comments/components/comment_list"; 3 | 4 | const Post = ({post}) => ( 5 |
6 | {post.saving ?

Saving...

: null} 7 |

{post.title}

8 |

9 | {post.content} 10 |

11 |
12 |

Comments

13 | 14 |
15 |
16 | ); 17 | 18 | export default Post; 19 | -------------------------------------------------------------------------------- /modules/Mantra/client/configs/context.js: -------------------------------------------------------------------------------- 1 | import * as Collections from 'Mantra-Modules/lib/collections'; 2 | //import {Meteor} from 'meteor/meteor'; 3 | //import {FlowRouter} from 'meteor/kadira:flow-router'; 4 | //import {ReactiveDict} from 'meteor/reactive-dict'; 5 | //import {Tracker} from 'meteor/tracker'; 6 | 7 | export default function () { 8 | return { 9 | Meteor, 10 | FlowRouter, 11 | Collections, 12 | LocalState: new ReactiveDict(), 13 | Tracker 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /modules/typings/packages/paginated-subscription.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | https://github.com/tmeasday/meteor-paginated-subscription 3 | */ 4 | declare module Meteor { 5 | 6 | /********************************************* 7 | * For "paginated-subscription smart package * 8 | *********************************************/ 9 | function subscribeWithPagination(collection:string, limit:number):{ 10 | loaded(): number; 11 | limit(): number; 12 | ready(): boolean; 13 | loadNextPage(): void; 14 | }; 15 | 16 | } -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/post.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CommentList from 'Mantra-Modules/client/modules/comments/containers/comment_list.js'; 3 | 4 | const Post = ({post}) => ( 5 |
6 | {post.saving ?

Saving...

: null} 7 |

{post.title}

8 |

9 | {post.content} 10 |

11 |
12 |

Comments

13 | 14 |
15 |
16 | ); 17 | 18 | export default Post; 19 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/configs/method_stubs/comments.ts: -------------------------------------------------------------------------------- 1 | import {IContext } from "../../../../configs/context"; 2 | 3 | export default function ({Collections, Meteor}: IContext) { 4 | Meteor.methods({ 5 | 'posts.createComment'(_id: string, postId: string, text: string) { 6 | const saving = true; 7 | const createdAt = new Date(); 8 | const author = 'Me'; 9 | Collections.Comments.insert({ 10 | _id, postId, text, saving, createdAt, author 11 | }); 12 | } 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /modules/typings/packages/moment.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 | /// 7 | 8 | declare var moment: moment.MomentStatic; 9 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/layout.main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Navigations from './navigations.jsx'; 3 | 4 | const Layout = ({content = () => null }) => ( 5 |
6 |
7 |

Mantra Voice

8 | 9 |
10 | 11 |
12 | {content()} 13 |
14 | 15 |
16 | Built with Mantra & Meteor. 17 |
18 |
19 | ); 20 | 21 | export default Layout; 22 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/containers/postlist.js: -------------------------------------------------------------------------------- 1 | import PostList from '../components/postlist.jsx'; 2 | import {useDeps, composeWithTracker, composeAll} from 'mantra-core'; 3 | 4 | export const composer = ({context}, onData) => { 5 | const {Meteor, Collections} = context(); 6 | if (Meteor.subscribe('posts.list').ready()) { 7 | const posts = Collections.Posts.find().fetch(); 8 | onData(null, {posts}); 9 | } 10 | }; 11 | 12 | export default composeAll( 13 | composeWithTracker(composer), 14 | useDeps() 15 | )(PostList); 16 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/layout.main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Navigations from './navigations'; 3 | 4 | const Layout = ({content = (): void => null }) => ( 5 |
6 |
7 |

Mantra Voice

8 | 9 |
10 | 11 |
12 | {content()} 13 |
14 | 15 |
16 | Built with Mantra & Meteor. 17 |
18 |
19 | ); 20 | 21 | export default Layout; 22 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/TodoApp.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | //import "./css/TodoApp.import.css"; 3 | 4 | interface Prop { 5 | children: any 6 | } 7 | 8 | export default class TodoApp extends React.Component { 9 | // static propTypes = { 10 | // children: React.PropTypes.any.isRequired 11 | // } 12 | 13 | componentWillMount() { 14 | require('./css/TodoApp.import.css'); 15 | } 16 | 17 | render() { 18 | return ( 19 |
20 | {this.props.children} 21 |
22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/configs/method_stubs/posts.js: -------------------------------------------------------------------------------- 1 | //import {check} from 'meteor/check'; 2 | 3 | export default function ({Meteor, Collections}) { 4 | Meteor.methods({ 5 | 'posts.create'(_id, title, content) { 6 | check(_id, String); 7 | check(title, String); 8 | check(content, String); 9 | 10 | const createdAt = new Date(); 11 | const post = { 12 | _id, title, content, createdAt, 13 | saving: true 14 | }; 15 | 16 | Collections.Posts.insert(post); 17 | } 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/configs/method_stubs/posts.ts: -------------------------------------------------------------------------------- 1 | //import {check} from 'meteor/check'; 2 | 3 | export default function ({Meteor, Collections}) { 4 | Meteor.methods({ 5 | 'posts.create'(_id: string, title: string, content: string) { 6 | check(_id, String); 7 | check(title, String); 8 | check(content, String); 9 | 10 | const createdAt = new Date(); 11 | const post = { 12 | _id, title, content, createdAt, 13 | saving: true 14 | }; 15 | 16 | Collections.Posts.insert(post); 17 | } 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /modules/MantraTS/common/collections.ts: -------------------------------------------------------------------------------- 1 | //import {Mongo} from 'meteor/mongo'; 2 | 3 | export interface IPosts { 4 | _id: string; 5 | title: string; 6 | saving: string; 7 | content: string; 8 | } 9 | 10 | export interface IComments { 11 | _id: string; 12 | author: string; 13 | text: string; 14 | saving: boolean; 15 | } 16 | 17 | export interface ICollections { 18 | Posts: Mongo.Collection, 19 | Comments: Mongo.Collection 20 | } 21 | 22 | export const Posts = new Mongo.Collection('posts'); 23 | export const Comments = new Mongo.Collection('comments'); 24 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/containers/postlist.ts: -------------------------------------------------------------------------------- 1 | import PostList from '../components/postlist'; 2 | import {useDeps, composeWithTracker, composeAll, IKomposer, IKomposerData} from 'mantra-core'; 3 | 4 | export const composer: IKomposer = ({context}, onData: IKomposerData) => { 5 | const {Meteor, Collections} = context(); 6 | if (Meteor.subscribe('posts.list').ready()) { 7 | const posts = Collections.Posts.find().fetch(); 8 | onData(null, {posts}); 9 | } 10 | return null; 11 | }; 12 | 13 | export default composeAll( 14 | composeWithTracker(composer), 15 | useDeps() 16 | )(PostList); 17 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/actions/comments.js: -------------------------------------------------------------------------------- 1 | export default { 2 | create({Meteor, LocalState}, postId, text) { 3 | LocalState.set('CREATE_COMMENT_ERROR', null); 4 | if (!text) { 5 | LocalState.set('CREATE_COMMENT_ERROR', 'Comment text is required.'); 6 | return; 7 | } 8 | 9 | const id = Meteor.uuid(); 10 | Meteor.call('posts.createComment', id, postId, text, (err) => { 11 | if (err) { 12 | alert(`Post creating failed: ${err.message}`); 13 | } 14 | }); 15 | }, 16 | 17 | clearErrors({LocalState}) { 18 | return LocalState.set('CREATE_COMMENT_ERROR', null); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/actions/comments.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | create({Meteor, LocalState}, postId: string, text: string) { 3 | LocalState.set('CREATE_COMMENT_ERROR', null); 4 | if (!text) { 5 | LocalState.set('CREATE_COMMENT_ERROR', 'Comment text is required.'); 6 | return; 7 | } 8 | 9 | const id = Meteor.uuid(); 10 | Meteor.call('posts.createComment', id, postId, text, (err: any) => { 11 | if (err) { 12 | alert(`Post creating failed: ${err.message}`); 13 | } 14 | }); 15 | }, 16 | 17 | clearErrors({LocalState}) { 18 | return LocalState.set('CREATE_COMMENT_ERROR', null); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-addons-create-fragment.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-create-fragment) 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 | namespace __Addons { 10 | export function createFragment(object: { [key: string]: ReactNode }): ReactFragment; 11 | } 12 | } 13 | 14 | declare module "react-addons-create-fragment" { 15 | export = __React.__Addons.createFragment; 16 | } 17 | -------------------------------------------------------------------------------- /modules/MantraTS/client/configs/context.ts: -------------------------------------------------------------------------------- 1 | import * as Collections from '../../common/collections'; 2 | //import {Meteor} from 'meteor/meteor'; 3 | //import {FlowRouter} from 'meteor/kadira:flow-router'; 4 | //import {ReactiveDict} from 'meteor/reactive-dict'; 5 | //import {Tracker} from 'meteor/tracker'; 6 | 7 | export interface IContext { 8 | Meteor: typeof Meteor, 9 | FlowRouter: typeof FlowRouter, 10 | Collections: Collections.ICollections, 11 | LocalState: ReactiveDict, 12 | Tracker: typeof Tracker 13 | } 14 | 15 | export default function () { 16 | return { 17 | Meteor, 18 | FlowRouter, 19 | Collections, 20 | LocalState: new ReactiveDict(), 21 | Tracker 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/components/comment_list.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CreateComment from '../containers/create_comment.js'; 3 | 4 | const CommentList = ({comments, postId}) => ( 5 |
6 |
7 | 8 |
9 |
10 | {comments.length === 0 ?

No Comments Yet!

: null} 11 | {comments.map(comment => ( 12 |
13 | {comment.author}: {comment.text} 14 | {comment.saving ? '...' : null} 15 |
16 | ))} 17 |
18 |
19 | ); 20 | 21 | export default CommentList; 22 | -------------------------------------------------------------------------------- /modules/typings/packages/messageFormat.d.ts: -------------------------------------------------------------------------------- 1 | declare module msgfmt { 2 | var extractLogLevel : string; 3 | function init(language:string, options?: any): void; 4 | function setLocale(language: string): void; 5 | } 6 | 7 | declare module mfPkg { 8 | export var router : any; 9 | export var lang : string; 10 | export var native : string; 11 | 12 | interface Configuration { 13 | flowLayout?: string; 14 | flowTemplate?: string; 15 | flowRouterTrigger?: Function; 16 | flowMiddleware?: Function; 17 | ironRouteChange?: Function; 18 | 19 | } 20 | 21 | export function configureUI(config: Configuration) : void; 22 | } 23 | 24 | declare function mf(key: string, params?: any, translation?: string) : string; 25 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/containers/comment_list.js: -------------------------------------------------------------------------------- 1 | import { 2 | useDeps, composeWithTracker, composeAll 3 | } from 'mantra-core'; 4 | import Component from '../components/comment_list.jsx'; 5 | 6 | export const composer = ({context, clearErrors, postId}, onData) => { 7 | const {Meteor, Collections} = context(); 8 | if (Meteor.subscribe('posts.comments', postId).ready()) { 9 | const options = { 10 | sort: {createdAt: -1} 11 | }; 12 | const comments = Collections.Comments.find({postId}, options).fetch(); 13 | onData(null, {comments}); 14 | } else { 15 | onData(); 16 | } 17 | }; 18 | 19 | export default composeAll( 20 | composeWithTracker(composer), 21 | useDeps() 22 | )(Component); 23 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/tests/layout.main.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import MainLayout from '../layout.main.jsx'; 5 | import Navigations from '../navigations.jsx'; 6 | 7 | describe('components.layouts.main', () => { 8 | it('should contain navigations', () => { 9 | const el = shallow(); 10 | expect(el.contains()).to.be.equal(true); 11 | }); 12 | 13 | it('should render childrens', () => { 14 | const Comp = () => (

Hello

); 15 | const el = shallow( 16 | ()}/> 17 | ); 18 | 19 | expect(el.contains()).to.be.equal(true); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/comments/containers/create_comment.js: -------------------------------------------------------------------------------- 1 | import { 2 | useDeps, composeWithTracker, composeAll 3 | } from 'mantra-core'; 4 | import Component from '../components/create_comment.jsx'; 5 | 6 | export const composer = ({context, clearErrors}, onData) => { 7 | const {LocalState} = context(); 8 | const error = LocalState.get('CREATE_COMMENT_ERROR'); 9 | onData(null, {error}); 10 | 11 | return clearErrors; 12 | }; 13 | 14 | export const depsMapper = (context, actions) => ({ 15 | create: actions.comments.create, 16 | clearErrors: actions.comments.clearErrors, 17 | context: () => context 18 | }); 19 | 20 | export default composeAll( 21 | composeWithTracker(composer), 22 | useDeps(depsMapper) 23 | )(Component); 24 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/containers/newpost.js: -------------------------------------------------------------------------------- 1 | import NewPost from '../components/newpost.jsx'; 2 | import {useDeps, composeWithTracker, composeAll} from 'mantra-core'; 3 | 4 | export const composer = ({context, clearErrors}, onData) => { 5 | const {LocalState} = context(); 6 | const error = LocalState.get('SAVING_ERROR'); 7 | onData(null, {error}); 8 | 9 | // clearErrors when unmounting the component 10 | return clearErrors; 11 | }; 12 | 13 | export const depsMapper = (context, actions) => ({ 14 | create: actions.posts.create, 15 | clearErrors: actions.posts.clearErrors, 16 | context: () => context 17 | }); 18 | 19 | export default composeAll( 20 | composeWithTracker(composer), 21 | useDeps(depsMapper) 22 | )(NewPost); 23 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/tests/layout.main.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import MainLayout from '../layout.main.jsx'; 5 | import Navigations from '../navigations.jsx'; 6 | 7 | describe('components.layouts.main', () => { 8 | it('should contain navigations', () => { 9 | const el = shallow(); 10 | expect(el.contains()).to.be.equal(true); 11 | }); 12 | 13 | it('should render childrens', () => { 14 | const Comp = () => (

Hello

); 15 | const el = shallow( 16 | ()}/> 17 | ); 18 | 19 | expect(el.contains()).to.be.equal(true); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /modules/typings/packages/tomiUploads.d.ts: -------------------------------------------------------------------------------- 1 | declare module Tomi.Uploads { 2 | interface FileInfo { 3 | name: string; 4 | path: string; 5 | size: number; 6 | type: string; 7 | validate(): boolean; 8 | safeName(): string; 9 | } 10 | } 11 | 12 | interface UploaderStatic { 13 | finished(index: number, file: Tomi.Uploads.FileInfo, templateContext: any): void; 14 | } 15 | 16 | declare var Uploader: UploaderStatic; 17 | 18 | interface UploadServerStatic { 19 | 20 | init(config: { 21 | tmpDir?: string, 22 | uploadDir?: string, 23 | checkCreateDirectories?: boolean, 24 | getFileName?: Function 25 | }) : void; 26 | 27 | delete(file: string): void; 28 | } 29 | 30 | declare var UploadServer : UploadServerStatic; 31 | 32 | // declare var process : any; 33 | -------------------------------------------------------------------------------- /modules/Mantra/server/publications/posts.js: -------------------------------------------------------------------------------- 1 | import {Posts, Comments} from 'Mantra-Modules/lib/collections'; 2 | //import {Meteor} from 'meteor/meteor'; 3 | //import {check} from 'meteor/check'; 4 | 5 | Meteor.publish('posts.list', function () { 6 | const selector = {}; 7 | const options = { 8 | fields: {_id: 1, title: 1}, 9 | sort: {createdAt: -1}, 10 | limit: 10 11 | }; 12 | 13 | return Posts.find(selector, options); 14 | }); 15 | 16 | Meteor.publish('posts.single', function (postId) { 17 | check(postId, String); 18 | const selector = {_id: postId}; 19 | return Posts.find(selector); 20 | }); 21 | 22 | Meteor.publish('posts.comments', function (postId) { 23 | check(postId, String); 24 | const selector = {postId}; 25 | return Comments.find(selector); 26 | }); 27 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/actions/posts.js: -------------------------------------------------------------------------------- 1 | export default { 2 | create({Meteor, LocalState, FlowRouter}, title, content) { 3 | if (!title || !content) { 4 | return LocalState.set('SAVING_ERROR', 'Title & Content are required!'); 5 | } 6 | 7 | LocalState.set('SAVING_ERROR', null); 8 | 9 | const id = Meteor.uuid(); 10 | // There is a method stub for this in the config/method_stubs 11 | // That's how we are doing latency compensation 12 | Meteor.call('posts.create', id, title, content, (err) => { 13 | if (err) { 14 | return LocalState.set('SAVING_ERROR', err.message); 15 | } 16 | }); 17 | FlowRouter.go(`/post/${id}`); 18 | }, 19 | 20 | clearErrors({LocalState}) { 21 | return LocalState.set('SAVING_ERROR', null); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /modules/MantraTS/server/publications/posts.ts: -------------------------------------------------------------------------------- 1 | import {Posts, Comments} from '../../common/collections'; 2 | //import {Meteor} from 'meteor/meteor'; 3 | //import {check} from 'meteor/check'; 4 | 5 | Meteor.publish('posts.list', function () { 6 | const selector = {}; 7 | const options = { 8 | fields: {_id: 1, title: 1}, 9 | sort: {createdAt: -1}, 10 | limit: 10 11 | }; 12 | 13 | return Posts.find(selector, options); 14 | }); 15 | 16 | Meteor.publish('posts.single', function (postId: string): any { 17 | check(postId, String); 18 | const selector = {_id: postId}; 19 | return Posts.find(selector); 20 | }); 21 | 22 | Meteor.publish('posts.comments', function (postId: string): any { 23 | check(postId, String); 24 | const selector = {postId}; 25 | return Comments.find(selector); 26 | }); 27 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-addons-pure-render-mixin.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-pure-render-mixin) 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 PureRenderMixin extends Mixin {} 10 | 11 | namespace __Addons { 12 | export var PureRenderMixin: PureRenderMixin; 13 | } 14 | } 15 | 16 | declare module "react-addons-pure-render-mixin" { 17 | var PureRenderMixin: __React.PureRenderMixin; 18 | type PureRenderMixin = __React.PureRenderMixin; 19 | export = PureRenderMixin; 20 | } 21 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/tests/navigations.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import Navigations from '../navigations.jsx'; 5 | 6 | describe('components.navigations', () => { 7 | it('should contain a link to home', () => { 8 | const el = shallow(); 9 | const homeLink = el.find('a').at(0); 10 | expect(homeLink.text()).to.be.equal('Home'); 11 | expect(homeLink.prop('href')).to.be.equal('/'); 12 | }); 13 | 14 | it('should contain a link to create a new post', () => { 15 | const el = shallow(); 16 | const newPostLink = el.find('a').at(1); 17 | expect(newPostLink.text()).to.be.equal('New Post'); 18 | expect(newPostLink.prop('href')).to.be.equal('/new-post'); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/tests/navigations.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import Navigations from '../navigations.jsx'; 5 | 6 | describe('components.navigations', () => { 7 | it('should contain a link to home', () => { 8 | const el = shallow(); 9 | const homeLink = el.find('a').at(0); 10 | expect(homeLink.text()).to.be.equal('Home'); 11 | expect(homeLink.prop('href')).to.be.equal('/'); 12 | }); 13 | 14 | it('should contain a link to create a new post', () => { 15 | const el = shallow(); 16 | const newPostLink = el.find('a').at(1); 17 | expect(newPostLink.text()).to.be.equal('New Post'); 18 | expect(newPostLink.prop('href')).to.be.equal('/new-post'); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/containers/newpost.ts: -------------------------------------------------------------------------------- 1 | import NewPost from '../components/newpost'; 2 | import {useDeps, composeWithTracker, composeAll, IKomposer, IKomposerData, IDepsMapper} from 'mantra-core'; 3 | 4 | 5 | 6 | export const composer: IKomposer = ({context, clearErrors}, onData: IKomposerData) => { 7 | const {LocalState} = context(); 8 | const error = LocalState.get('SAVING_ERROR'); 9 | onData(null, {error}); 10 | 11 | // clearErrors when unmounting the component 12 | return clearErrors; 13 | }; 14 | 15 | export const depsMapper: IDepsMapper = (context, actions) => ({ 16 | create: actions.posts.create, 17 | clearErrors: actions.posts.clearErrors, 18 | context: () => context 19 | }); 20 | 21 | export default composeAll( 22 | composeWithTracker(composer), 23 | useDeps(depsMapper) 24 | )(NewPost); 25 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/newpost.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class NewPost extends React.Component { 4 | render() { 5 | const {error} = this.props; 6 | return ( 7 |
8 |

Add New Post

9 | {error ?

{error}

: null} 10 | 11 |
12 | 12 |
13 | 14 |
15 | ); 16 | } 17 | 18 | _create() { 19 | const text = this.refs.text.value; 20 | const {create, postId} = this.props; 21 | create(postId, text); 22 | this.refs.text.value = ''; 23 | } 24 | 25 | _renderError(error) { 26 | return ( 27 |
28 | {error} 29 |
30 | ); 31 | } 32 | } 33 | 34 | export default CreateComment; 35 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/components/comment_list.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CreateComment from '../containers/create_comment'; 3 | 4 | import { IComments } from "../../../../common/collections"; 5 | 6 | interface IProps { 7 | comments?: IComments[]; 8 | postId: string; 9 | } 10 | 11 | const CommentList = ({comments, postId}: IProps) => ( 12 |
13 |
14 | 15 |
16 |
17 | {comments.length === 0 ?

No Comments Yet!

: null} 18 | {comments.map((comment: IComments) => ( 19 |
20 | {comment.author}: {comment.text} 21 | {comment.saving ? '...' : null} 22 |
23 | ))} 24 |
25 |
26 | ); 27 | 28 | export default CommentList; 29 | -------------------------------------------------------------------------------- /modules/typings/meteor/mantra.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-mounter' { 2 | export var mount: any; 3 | } 4 | 5 | declare module 'mantra-core' { 6 | interface IKomposer { 7 | (params: Object, onData: Function): Function 8 | } 9 | 10 | interface IKomposerData { 11 | (error?: Object, data?: Object): void 12 | } 13 | 14 | interface IInjectDeps { 15 | (...deps: any[]): IInjectDeps 16 | } 17 | 18 | interface IDepsMapper { 19 | (...deps: any[]): void 20 | } 21 | 22 | export var injectDeps: IInjectDeps; 23 | export function useDeps(depsMapper?: IDepsMapper): any; 24 | 25 | export function compose(): any; 26 | export function composeWithTracker(komposer: IKomposer): any; 27 | export function composeWithPromise(): any; 28 | export function composeWithObservable(): any; 29 | export function composeAll(composeFunction: Function, depsFunction: Function): any; 30 | } 31 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/actions/posts.ts: -------------------------------------------------------------------------------- 1 | import { IContext } from "../../../configs/context"; 2 | 3 | export default { 4 | 5 | create({Meteor, LocalState, FlowRouter}: IContext, title: string, content: string) { 6 | if (!title || !content) { 7 | return LocalState.set('SAVING_ERROR', 'Title & Content are required!'); 8 | } 9 | 10 | LocalState.set('SAVING_ERROR', null); 11 | 12 | const id = Meteor.uuid(); 13 | // There is a method stub for this in the config/method_stubs 14 | // That's how we are doing latency compensation 15 | Meteor.call('posts.create', id, title, content, (err: any) => { 16 | if (err) { 17 | return LocalState.set('SAVING_ERROR', err.message); 18 | } 19 | }); 20 | FlowRouter.go(`/post/${id}`); 21 | }, 22 | 23 | clearErrors({LocalState}) { 24 | return LocalState.set('SAVING_ERROR', null); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/containers/comment_list.ts: -------------------------------------------------------------------------------- 1 | import { 2 | useDeps, composeWithTracker, composeAll 3 | } from 'mantra-core'; 4 | import Component from '../components/comment_list'; 5 | 6 | import { IContext } from "../../../configs/context"; 7 | import { IKomposer, IKomposerData } from "mantra-core"; 8 | 9 | export const composer: IKomposer = ({context, clearErrors, postId}, onData: IKomposerData) => { 10 | const {Meteor, Collections} = context(); 11 | if (Meteor.subscribe('posts.comments', postId).ready()) { 12 | const options = { 13 | sort: {createdAt: -1} 14 | }; 15 | const comments = Collections.Comments.find({postId}, options).fetch(); 16 | onData(null, {comments}); 17 | } else { 18 | onData(); 19 | } 20 | 21 | return clearErrors; 22 | }; 23 | 24 | export default composeAll( 25 | composeWithTracker(composer), 26 | useDeps() 27 | )(Component); 28 | -------------------------------------------------------------------------------- /entry/server/webpack.conf.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | 3 | var babelSettings = { presets: ['react', 'es2015', 'stage-0'] }; 4 | babelSettings.plugins = ['transform-decorators-legacy']; 5 | 6 | module.exports = { 7 | entry: './entry', 8 | module: { 9 | loaders: [ 10 | { test: /\.tsx?$/, loader: 'babel?' + JSON.stringify(babelSettings) + '!ts', exclude: /node_modules|lib/ }, 11 | { test: /\.jsx?$/, loader: 'babel', query: babelSettings, exclude: /node_modules/ }, 12 | { test: /\.css$/, loader: 'null' }, 13 | { test: /\.(png|jpe?g)(\?.*)?$/, loader: 'url?limit=8182' }, 14 | { test: /\.(svg|ttf|woff|eot)(\?.*)?$/, loader: 'file' } 15 | ] 16 | } 17 | }; 18 | 19 | //if (process.env.NODE_ENV !== 'production') { 20 | // var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin; 21 | // module.exports.plugins = [new ForkCheckerPlugin()] 22 | //} 23 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/comments/containers/create_comment.ts: -------------------------------------------------------------------------------- 1 | import { 2 | useDeps, composeWithTracker, composeAll 3 | } from 'mantra-core'; 4 | import Component from '../components/create_comment'; 5 | 6 | import { IKomposer, IKomposerData } from "mantra-core"; 7 | import { IContext } from "../../../configs/context"; 8 | 9 | export const composer: IKomposer = ({context, clearErrors, postId}, onData: IKomposerData) => { 10 | const {LocalState} = context(); 11 | const error = LocalState.get('CREATE_COMMENT_ERROR'); 12 | onData(null, {error}); 13 | 14 | return clearErrors; 15 | }; 16 | 17 | export const depsMapper = (context: IContext, actions: any) => ({ 18 | create: actions.comments.create, 19 | clearErrors: actions.comments.clearErrors, 20 | context: () => context 21 | }); 22 | 23 | export default composeAll( 24 | composeWithTracker(composer), 25 | useDeps(depsMapper) 26 | )(Component); 27 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; 3 | padding: 10px 20px; 4 | } 5 | 6 | header { 7 | border-bottom: 1px solid #EAEAEA; 8 | padding-bottom: 10px; 9 | margin-bottom: 30px; 10 | } 11 | 12 | footer { 13 | margin-top: 50px; 14 | border-top: 1px solid #EAEAEA; 15 | padding-top: 10px; 16 | font-size: 12px; 17 | } 18 | 19 | .postlist li { 20 | margin: 8px 0; 21 | } 22 | 23 | .postlist li a { 24 | text-decoration: none; 25 | } 26 | 27 | .new-post input, 28 | .new-post textarea { 29 | width: 350px; 30 | outline: 0; 31 | margin-bottom: 5px; 32 | border: 1px solid #ddd; 33 | font-size: 13px; 34 | padding: 4px 6px; 35 | } 36 | 37 | .new-post textarea { 38 | height: 200px; 39 | } 40 | 41 | footer { 42 | margin-top: 20px; 43 | border-top: 1px solid #eee; 44 | padding-top: 5px; 45 | } 46 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; 3 | padding: 10px 20px; 4 | } 5 | 6 | header { 7 | border-bottom: 1px solid #EAEAEA; 8 | padding-bottom: 10px; 9 | margin-bottom: 30px; 10 | } 11 | 12 | footer { 13 | margin-top: 50px; 14 | border-top: 1px solid #EAEAEA; 15 | padding-top: 10px; 16 | font-size: 12px; 17 | } 18 | 19 | .postlist li { 20 | margin: 8px 0; 21 | } 22 | 23 | .postlist li a { 24 | text-decoration: none; 25 | } 26 | 27 | .new-post input, 28 | .new-post textarea { 29 | width: 350px; 30 | outline: 0; 31 | margin-bottom: 5px; 32 | border: 1px solid #ddd; 33 | font-size: 13px; 34 | padding: 4px 6px; 35 | } 36 | 37 | .new-post textarea { 38 | height: 200px; 39 | } 40 | 41 | footer { 42 | margin-top: 20px; 43 | border-top: 1px solid #eee; 44 | padding-top: 5px; 45 | } 46 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/containers/post.js: -------------------------------------------------------------------------------- 1 | import Post from '../components/post.jsx'; 2 | import {useDeps, composeWithTracker, composeAll} from 'mantra-core'; 3 | 4 | export const composer = ({context, postId}, onData) => { 5 | const {Meteor, Collections, Tracker} = context(); 6 | 7 | Meteor.subscribe('posts.single', postId, () => { 8 | const post = Collections.Posts.findOne(postId); 9 | onData(null, {post}); 10 | }); 11 | 12 | // support latency compensation 13 | // we don't need to invalidate tracker because of the 14 | // data fetching from the cache. 15 | const postFromCache = Tracker.nonreactive(() => { 16 | return Collections.Posts.findOne(postId); 17 | }); 18 | 19 | if (postFromCache) { 20 | onData(null, {post: postFromCache}); 21 | } else { 22 | onData(); 23 | } 24 | }; 25 | 26 | export default composeAll( 27 | composeWithTracker(composer), 28 | useDeps() 29 | )(Post); 30 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/tests/post.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import Post from '../post.jsx'; 5 | 6 | describe('components.post', () => { 7 | it('should display the post title', () => { 8 | const post = {title: 'Nice One'}; 9 | const el = shallow(); 10 | expect(el.find('h2').text()).to.be.match(/Nice One/); 11 | }); 12 | 13 | it('should display the post content', () => { 14 | const post = {content: 'Nice content'}; 15 | const el = shallow(); 16 | expect(el.find('p').text()).to.be.match(/Nice content/); 17 | }); 18 | 19 | it('should display saving indicator if saving prop is there', () => { 20 | const post = {saving: true}; 21 | const el = shallow(); 22 | expect(el.find('p').first().text()).to.be.match(/saving/i); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/tests/post.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import Post from '../post.jsx'; 5 | 6 | describe('components.post', () => { 7 | it('should display the post title', () => { 8 | const post = {title: 'Nice One'}; 9 | const el = shallow(); 10 | expect(el.find('h2').text()).to.be.match(/Nice One/); 11 | }); 12 | 13 | it('should display the post content', () => { 14 | const post = {content: 'Nice content'}; 15 | const el = shallow(); 16 | expect(el.find('p').text()).to.be.match(/Nice content/); 17 | }); 18 | 19 | it('should display saving indicator if saving prop is there', () => { 20 | const post = {saving: true}; 21 | const el = shallow(); 22 | expect(el.find('p').first().text()).to.be.match(/saving/i); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /modules/typings/packages/roles.d.ts: -------------------------------------------------------------------------------- 1 | // 2 | // Definitions for the roles smart package 3 | // 4 | // https://atmosphere.meteor.com/package/roles 5 | // https://github.com/alanning/meteor-roles 6 | // 7 | // Note: For all definitions below, "users" and "roles" params can be strings or arrays 8 | 9 | /// 10 | 11 | interface RolesDAO { 12 | _id?: string; 13 | name?: string; 14 | } 15 | 16 | declare module Roles { 17 | function createRole(roleName: string): string; 18 | function deleteRole(roleName: string): void; 19 | function addUsersToRoles(users: any, roles: any): void; 20 | function removeUsersFromRoles(users: any, roles: any): void; 21 | function userIsInRole(user: any, roles: any): boolean; //user can be user ID or user object 22 | function getRolesForUser(userId: string): string[]; 23 | function getAllRoles(): Mongo.Cursor; 24 | function getUsersInRole(roleName: string): Mongo.Cursor; 25 | } -------------------------------------------------------------------------------- /entry/webpack.conf.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var path = require('path'); 3 | 4 | module.exports = { 5 | devtool: 'eval', // eval, source-map, eval-source-map 6 | externals: { 7 | // Make sure we use Meteor package for jQuery and react 8 | 'jquery': '$', 9 | 'react': 'React', 10 | 'react-dom': 'ReactDOM', 11 | 'react-addons-transition-group': 'React.addons.TransitionGroup', 12 | 'react-addons-create-fragment': 'React.addons.createFragment', 13 | 'react-addons-pure-render-mixin': 'React.addons.PureRenderMixin', 14 | 'react-addons-update': 'React.addons.update', 15 | 'react-addons-linked-state-mixin': 'React.addons.PureRenderMixin' 16 | }, 17 | devServer: { 18 | // You can change this to your server IP address to access it remotely 19 | host: 'localhost' 20 | }, 21 | resolve: { 22 | root: path.join(__dirname, '..', 'modules'), 23 | extensions: ['', '.js', '.jsx', '.json', '.css', '.ts', '.tsx'] 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/newpost.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | interface INewPostProps { 4 | error: string; 5 | create: (title: string, content: string) => void; 6 | } 7 | 8 | class NewPost extends React.Component { 9 | render() { 10 | const {error} = this.props; 11 | return ( 12 |
13 |

Add New Post

14 | {error ?

{error}

: null} 15 | 16 |
17 | 18 |
19 | 20 |
21 | ); 22 | } 23 | 24 | private create() { 25 | const text = this.refs["text"]["value"]; 26 | const {create, postId} = this.props; 27 | create(postId, text); 28 | this.refs["text"]["value"] = ''; 29 | } 30 | 31 | private renderError(error: any) { 32 | return ( 33 |
34 | {error} 35 |
36 | ); 37 | } 38 | } 39 | 40 | export default CreateComment; 41 | -------------------------------------------------------------------------------- /modules/typings/packages.d.ts: -------------------------------------------------------------------------------- 1 | declare function require(name:string): void; 2 | 3 | declare module "blaze-to-react" { 4 | var something: any; // class AceEditor extends __React.Component<{}, {}> {} 5 | export default something; 6 | } 7 | 8 | // declare module "react-mixin" { 9 | // let something: any; // class AceEditor extends __React.Component<{}, {}> {} 10 | // export default something; 11 | // } 12 | 13 | declare module "react-router" { 14 | let s: any; // class AceEditor extends __React.Component<{}, {}> {} 15 | export let ReactRouter: any; 16 | export let Router: any; 17 | export let Route: any; 18 | export let IndexRoute: any; 19 | export default s; 20 | } 21 | 22 | declare module "react-meteor-data" { 23 | let something: any; // class AceEditor extends __React.Component<{}, {}> {} 24 | export default something; 25 | } 26 | 27 | // declare class SubsManager { 28 | // subscribe(route: string, ...params: any[]) : any; 29 | // } 30 | 31 | declare let ReactRouter: any; 32 | declare let ReactLayout: any; 33 | declare let BlazeToReact: any; 34 | -------------------------------------------------------------------------------- /modules/Mantra/server/methods/posts.js: -------------------------------------------------------------------------------- 1 | import {Posts, Comments} from 'Mantra-Modules/lib/collections'; 2 | //import {Meteor} from 'meteor/meteor'; 3 | //import {check} from 'meteor/check'; 4 | 5 | Meteor.methods({ 6 | 'posts.create'(_id, title, content) { 7 | check(_id, String); 8 | check(title, String); 9 | check(content, String); 10 | 11 | // Show the latency compensations 12 | Meteor._sleepForMs(500); 13 | 14 | // XXX: Do some user authorization 15 | const createdAt = new Date(); 16 | const post = {_id, title, content, createdAt}; 17 | Posts.insert(post); 18 | } 19 | }); 20 | 21 | Meteor.methods({ 22 | 'posts.createComment'(_id, postId, text) { 23 | check(_id, String); 24 | check(postId, String); 25 | check(text, String); 26 | 27 | // Show the latency compensations 28 | Meteor._sleepForMs(500); 29 | 30 | // XXX: Do some user authorization 31 | const createdAt = new Date(); 32 | const author = 'The User'; 33 | const comment = {_id, postId, author, text, createdAt}; 34 | Comments.insert(comment); 35 | } 36 | }); 37 | -------------------------------------------------------------------------------- /modules/MantraTS/server/methods/posts.ts: -------------------------------------------------------------------------------- 1 | import {Posts, Comments} from '../../common/collections'; 2 | //import {Meteor} from 'meteor/meteor'; 3 | //import {check} from 'meteor/check'; 4 | 5 | Meteor.methods({ 6 | 'posts.create'(_id: string, title: string, content: string) { 7 | check(_id, String); 8 | check(title, String); 9 | check(content, String); 10 | 11 | // Show the latency compensations 12 | Meteor._sleepForMs(500); 13 | 14 | // XXX: Do some user authorization 15 | const createdAt = new Date(); 16 | const post = {_id, title, content, createdAt}; 17 | Posts.insert(post); 18 | } 19 | }); 20 | 21 | Meteor.methods({ 22 | 'posts.createComment'(_id: string, postId: string, text: string) { 23 | check(_id, String); 24 | check(postId, String); 25 | check(text, String); 26 | 27 | // Show the latency compensations 28 | Meteor._sleepForMs(500); 29 | 30 | // XXX: Do some user authorization 31 | const createdAt = new Date(); 32 | const author = 'The User'; 33 | const comment = {_id, postId, author, text, createdAt}; 34 | Comments.insert(comment); 35 | } 36 | }); 37 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-global.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (namespace) 2 | // Project: http://facebook.github.io/react/ 3 | // Definitions by: Asana , AssureSign , Microsoft 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | /// 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | /// 14 | /// 15 | /// 16 | 17 | import React = __React; 18 | import ReactDOM = __React.__DOM; 19 | 20 | declare namespace __React { 21 | export import addons = __React.__Addons; 22 | } 23 | 24 | // declare module "react" { 25 | // export default __React; 26 | // } 27 | -------------------------------------------------------------------------------- /.meteor/packages: -------------------------------------------------------------------------------- 1 | # Meteor packages used by this project, one per line. 2 | # Check this file (and the other files in this directory) into your repository. 3 | # 4 | # 'meteor add' and 'meteor remove' will edit this file for you, 5 | # but you can also edit it by hand. 6 | 7 | meteor-base # Packages every Meteor app needs to have 8 | mobile-experience # Packages for a great mobile UX 9 | mongo # The database Meteor supports right now 10 | blaze-html-templates # Compile .html files into Meteor Blaze views 11 | session # Client-side reactive dictionary for your app 12 | jquery # Helpful client-side library 13 | tracker # Meteor's client-side reactive programming library 14 | 15 | standard-minifiers # JS/CSS minifiers run for production mode 16 | es5-shim # ECMAScript 5 compatibility for older browsers. 17 | 18 | webpack:webpack 19 | kadira:flow-router 20 | kadira:react-layout 21 | react-runtime 22 | react-meteor-data 23 | thereactivestack:blazetoreact 24 | accounts-ui 25 | accounts-password 26 | 27 | 28 | reactive-dict 29 | check 30 | meteorhacks:subs-manager 31 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-addons-linked-state-mixin.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-linked-state-mixin) 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 ReactLink { 10 | value: T; 11 | requestChange(newValue: T): void; 12 | } 13 | 14 | interface LinkedStateMixin extends Mixin { 15 | linkState(key: string): ReactLink; 16 | } 17 | 18 | interface HTMLAttributes { 19 | checkedLink?: ReactLink; 20 | valueLink?: ReactLink; 21 | } 22 | 23 | namespace __Addons { 24 | export var LinkedStateMixin: LinkedStateMixin; 25 | } 26 | } 27 | 28 | declare module "react-addons-linked-state-mixin" { 29 | var LinkedStateMixin: __React.LinkedStateMixin; 30 | type LinkedStateMixin = __React.LinkedStateMixin; 31 | export = LinkedStateMixin; 32 | } 33 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-addons-update.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-update) 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 UpdateSpecCommand { 10 | $set?: any; 11 | $merge?: {}; 12 | $apply?(value: any): any; 13 | } 14 | 15 | interface UpdateSpecPath { 16 | [key: string]: UpdateSpec; 17 | } 18 | 19 | type UpdateSpec = UpdateSpecCommand | UpdateSpecPath; 20 | 21 | interface UpdateArraySpec extends UpdateSpecCommand { 22 | $push?: any[]; 23 | $unshift?: any[]; 24 | $splice?: any[][]; 25 | } 26 | 27 | namespace __Addons { 28 | export function update(value: any[], spec: UpdateArraySpec): any[]; 29 | export function update(value: {}, spec: UpdateSpec): any; 30 | } 31 | } 32 | 33 | declare module "react-addons-update" { 34 | export = __React.__Addons.update; 35 | } 36 | -------------------------------------------------------------------------------- /entry/client/webpack.conf.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | 3 | var babelSettings = { presets: ['react', 'es2015', 'stage-0'] }; 4 | babelSettings.plugins = ['transform-decorators-legacy']; 5 | 6 | if (process.env.NODE_ENV !== 'production' && !process.env.IS_MIRROR) { 7 | babelSettings.plugins.push(['react-transform', { 8 | transforms: [{ 9 | transform: 'react-transform-hmr', 10 | imports: ['react'], 11 | locals: ['module'] 12 | }, { 13 | transform: 'react-transform-catch-errors', 14 | imports: ['react', 'redbox-react'] 15 | }] 16 | // redbox-react is breaking the line numbers :-( 17 | // you might want to disable it 18 | }]); 19 | } 20 | 21 | module.exports = { 22 | entry: './entry', 23 | module: { 24 | loaders: [ 25 | { test: /\.tsx?$/, loader: 'babel?' + JSON.stringify(babelSettings) + '!ts', exclude: /node_modules|lib/ }, 26 | { test: /\.jsx?$/, loader: 'babel', query: babelSettings, exclude: /node_modules/ }, 27 | { test: /\.css$/, loader: 'style!css' }, 28 | { test: /\.(png|jpe?g)(\?.*)?$/, loader: 'url?limit=8182' }, 29 | { test: /\.(svg|ttf|woff2?|eot)(\?.*)?$/, loader: 'file' } 30 | ] 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/tests/postlist.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import PostList from '../postlist.jsx'; 5 | 6 | describe('components.postlist', () => { 7 | const posts = [ 8 | {title: 't-one', _id: 'one'}, 9 | {title: 't-two', _id: 'two'}, 10 | ]; 11 | 12 | it('should list given number of items', () => { 13 | const el = shallow(); 14 | expect(el.find('li').length).to.be.equal(posts.length); 15 | }); 16 | 17 | it('should list post title for each item', () => { 18 | const el = shallow(); 19 | const lis = el.find('li'); 20 | lis.forEach((li, index) => { 21 | const aText = li.find('a').first().text(); 22 | expect(aText).to.be.equal(posts[index].title); 23 | }); 24 | }); 25 | 26 | it('shallow list post link for each items', () => { 27 | const el = shallow(); 28 | const lis = el.find('li'); 29 | lis.forEach((li, index) => { 30 | const href = li.find('a').first().prop('href'); 31 | expect(href).to.be.equal(`/post/${posts[index]._id}`); 32 | }); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/tests/postlist.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import PostList from '../postlist.jsx'; 5 | 6 | describe('components.postlist', () => { 7 | const posts = [ 8 | {title: 't-one', _id: 'one'}, 9 | {title: 't-two', _id: 'two'}, 10 | ]; 11 | 12 | it('should list given number of items', () => { 13 | const el = shallow(); 14 | expect(el.find('li').length).to.be.equal(posts.length); 15 | }); 16 | 17 | it('should list post title for each item', () => { 18 | const el = shallow(); 19 | const lis = el.find('li'); 20 | lis.forEach((li, index) => { 21 | const aText = li.find('a').first().text(); 22 | expect(aText).to.be.equal(posts[index].title); 23 | }); 24 | }); 25 | 26 | it('shallow list post link for each items', () => { 27 | const el = shallow(); 28 | const lis = el.find('li'); 29 | lis.forEach((li, index) => { 30 | const href = li.find('a').first().prop('href'); 31 | expect(href).to.be.equal(`/post/${posts[index]._id}`); 32 | }); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/routes.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {mount} from 'react-mounter'; 3 | 4 | //import {FlowRouter} from 'meteor/kadira:flow-router'; 5 | 6 | import MainLayout from './components/layout.main'; 7 | import PostList from './containers/postlist'; 8 | import Post from './containers/post'; 9 | import NewPost from './containers/newpost'; 10 | 11 | import { IInjectDeps } from "mantra-core"; 12 | 13 | export default function (injectDeps: IInjectDeps) { 14 | const MainLayoutCtx = injectDeps(MainLayout); 15 | 16 | // Move these as a module and call this from a main file 17 | FlowRouter.route('/', { 18 | name: 'posts.list', 19 | action() { 20 | mount(MainLayoutCtx, { 21 | content: () => () 22 | }); 23 | } 24 | }); 25 | 26 | FlowRouter.route('/post/:postId', { 27 | name: 'posts.single', 28 | action({postId}) { 29 | mount(MainLayoutCtx, { 30 | content: () => () 31 | }); 32 | } 33 | }); 34 | 35 | FlowRouter.route('/new-post', { 36 | name: 'newpost', 37 | action() { 38 | mount(MainLayoutCtx, { 39 | content: () => () 40 | }); 41 | } 42 | }); 43 | } 44 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/routes.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {mount} from 'react-mounter'; 3 | 4 | //import {FlowRouter} from 'meteor/kadira:flow-router'; 5 | 6 | import MainLayout from 'Mantra-Modules/client/modules/core/components/layout.main.jsx'; 7 | import PostList from 'Mantra-Modules/client/modules/core/containers/postlist'; 8 | import Post from 'Mantra-Modules/client/modules/core/containers/post'; 9 | import NewPost from 'Mantra-Modules/client/modules/core/containers/newpost'; 10 | 11 | export default function (injectDeps) { 12 | const MainLayoutCtx = injectDeps(MainLayout); 13 | 14 | // Move these as a module and call this from a main file 15 | FlowRouter.route('/', { 16 | name: 'posts.list', 17 | action() { 18 | mount(MainLayoutCtx, { 19 | content: () => () 20 | }); 21 | } 22 | }); 23 | 24 | FlowRouter.route('/post/:postId', { 25 | name: 'posts.single', 26 | action({postId}) { 27 | mount(MainLayoutCtx, { 28 | content: () => () 29 | }); 30 | } 31 | }); 32 | 33 | FlowRouter.route('/new-post', { 34 | name: 'newpost', 35 | action() { 36 | mount(MainLayoutCtx, { 37 | content: () => () 38 | }); 39 | } 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/containers/tests/postlist.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {stub, spy} from 'sinon'; 4 | import {composer} from '../postlist'; 5 | 6 | describe('containers.postlist', () => { 7 | describe('composer', () => { 8 | it('should subscribe to posts.list', () => { 9 | const Meteor = {subscribe: stub()}; 10 | Meteor.subscribe.returns({ready: () => false}); 11 | 12 | const context = () => ({Meteor}); 13 | const onData = spy(); 14 | 15 | composer({context}, onData); 16 | expect(Meteor.subscribe.args[0]).to.deep.equal([ 17 | 'posts.list' 18 | ]); 19 | }); 20 | 21 | describe('after subscribed', () => { 22 | it('should fetch data from all posts & pass to onData', () => { 23 | const Meteor = {subscribe: stub()}; 24 | Meteor.subscribe.returns({ready: () => true}); 25 | 26 | const posts = [ {_id: 'aa'} ]; 27 | const Collections = {Posts: {find: stub()}}; 28 | Collections.Posts.find.returns({fetch: () => posts}); 29 | 30 | const context = () => ({Meteor, Collections}); 31 | const onData = spy(); 32 | 33 | composer({context}, onData); 34 | expect(onData.args[0]).to.deep.equal([ null, {posts} ]); 35 | }); 36 | }); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/containers/tests/postlist.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {stub, spy} from 'sinon'; 4 | import {composer} from '../postlist'; 5 | 6 | describe('containers.postlist', () => { 7 | describe('composer', () => { 8 | it('should subscribe to posts.list', () => { 9 | const Meteor = {subscribe: stub()}; 10 | Meteor.subscribe.returns({ready: () => false}); 11 | 12 | const context = () => ({Meteor}); 13 | const onData = spy(); 14 | 15 | composer({context}, onData); 16 | expect(Meteor.subscribe.args[0]).to.deep.equal([ 17 | 'posts.list' 18 | ]); 19 | }); 20 | 21 | describe('after subscribed', () => { 22 | it('should fetch data from all posts & pass to onData', () => { 23 | const Meteor = {subscribe: stub()}; 24 | Meteor.subscribe.returns({ready: () => true}); 25 | 26 | const posts = [ {_id: 'aa'} ]; 27 | const Collections = {Posts: {find: stub()}}; 28 | Collections.Posts.find.returns({fetch: () => posts}); 29 | 30 | const context = () => ({Meteor, Collections}); 31 | const onData = spy(); 32 | 33 | composer({context}, onData); 34 | expect(onData.args[0]).to.deep.equal([ null, {posts} ]); 35 | }); 36 | }); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /modules/typings/meteor/node-fibers.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for node-fibers 2 | // Project: https://github.com/laverdet/node-fibers 3 | // Definitions by: Cary Haynie 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | interface Fiber { 7 | reset: () => any; 8 | run: (param?: any) => any; 9 | throwInto: (ex: any) => any; 10 | } 11 | 12 | declare module "fibers" { 13 | 14 | function Fiber(fn: Function): Fiber; 15 | 16 | module Fiber { 17 | export var current: Fiber; 18 | export function yield(value?: any): any 19 | } 20 | 21 | export = Fiber; 22 | } 23 | 24 | declare module "fibers/future" { 25 | 26 | class Future { 27 | constructor(); 28 | detach(): void; 29 | get(): any; 30 | isResolved (): boolean; 31 | proxy(future: Future): void; 32 | proxyErrors(futureOrList: any): Future; 33 | resolver(): Function; 34 | resolve(fn: Function): void; 35 | resolveSuccess(fn: Function): void; 36 | return(result?: any): void; 37 | throw (error: any): void; 38 | wait (): void; 39 | static wait(future: Future):void; 40 | static wait(future_list: Future[]):void; 41 | static wrap(fn: Function): Future 42 | } 43 | 44 | export = Future; 45 | } 46 | -------------------------------------------------------------------------------- /modules/TodoAppTS/MyHeader.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | //import { CourseMenu, AdminMenu, CommunityMenu, LibraryMenu } from "../application/menus"; 3 | //import BlazeTemplate from "../shared/blaze_template"; 4 | //import { RouterUtils } from "../shared/helpers_client"; 5 | 6 | 7 | export default class TodoHeader extends React.Component<{}, {}> { 8 | render() { 9 | return
12359ee
; 10 | } 11 | } 12 | 13 | // let Header = React.createClass({ 14 | // mixins: [ReactMeteorData], 15 | // 16 | // getMeteorData() { 17 | // return { 18 | // currentUser: Meteor.user() 19 | // }; 20 | // }, 21 | // 22 | // render() { 23 | // return ( 24 | //
25 | // {mf("site.name")} 26 | // Book 27 | //
28 | // { Roles.userIsInRole(Meteor.userId(), "admin") ? : ""} 29 | // 30 | // 31 | // 32 | // {/* Meteor.user() ? : "" */} 33 | //
34 | //
35 | // ); 36 | // } 37 | // }); 38 | 39 | // export default Header; 40 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/components/tests/newpost.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import NewPost from '../newpost.jsx'; 5 | 6 | describe('components.newpost', () => { 7 | it('should show the error if there are any', () => { 8 | const error = 'TheError'; 9 | const el = shallow(); 10 | expect(el.html()).to.match(/TheError/); 11 | }); 12 | 13 | it('should display the create post form', () => { 14 | const el = shallow(); 15 | const title = el.find('input').first(); 16 | const content = el.find('textarea').first(); 17 | const button = el.find('button').first(); 18 | 19 | expect(title.node.ref).to.be.equal('titleRef'); 20 | expect(content.node.ref).to.be.equal('contentRef'); 21 | expect(button.prop('onClick')).to.be.a('function'); 22 | }); 23 | 24 | it('should create a new post when click on the button', done => { 25 | const title = 'the-title'; 26 | const content = 'the-content'; 27 | 28 | const onCreate = (t, c) => { 29 | expect(t).to.be.equal(title); 30 | expect(c).to.be.equal(content); 31 | done(); 32 | }; 33 | 34 | const el = shallow(); 35 | const instance = el.instance(); 36 | 37 | instance.refs = { 38 | titleRef: {value: title}, 39 | contentRef: {value: content} 40 | }; 41 | 42 | el.find('button').simulate('click'); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/components/tests/newpost.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import NewPost from '../newpost.jsx'; 5 | 6 | describe('components.newpost', () => { 7 | it('should show the error if there are any', () => { 8 | const error = 'TheError'; 9 | const el = shallow(); 10 | expect(el.html()).to.match(/TheError/); 11 | }); 12 | 13 | it('should display the create post form', () => { 14 | const el = shallow(); 15 | const title = el.find('input').first(); 16 | const content = el.find('textarea').first(); 17 | const button = el.find('button').first(); 18 | 19 | expect(title.node.ref).to.be.equal('titleRef'); 20 | expect(content.node.ref).to.be.equal('contentRef'); 21 | expect(button.prop('onClick')).to.be.a('function'); 22 | }); 23 | 24 | it('should create a new post when click on the button', done => { 25 | const title = 'the-title'; 26 | const content = 'the-content'; 27 | 28 | const onCreate = (t, c) => { 29 | expect(t).to.be.equal(title); 30 | expect(c).to.be.equal(content); 31 | done(); 32 | }; 33 | 34 | const el = shallow(); 35 | const instance = el.instance(); 36 | 37 | instance.refs = { 38 | titleRef: {value: title}, 39 | contentRef: {value: content} 40 | }; 41 | 42 | el.find('button').simulate('click'); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /modules/TodoAppTS/todo-methods.ts: -------------------------------------------------------------------------------- 1 | import Tasks from './collections/Tasks'; 2 | 3 | Meteor.methods({ 4 | addTask: function (text: string) { 5 | // Make sure the user is logged in before inserting a task 6 | if (! Meteor.userId()) { 7 | throw new Meteor.Error('not-authorized'); 8 | } 9 | 10 | Tasks.insert({ 11 | text: text, 12 | createdAt: new Date(), 13 | owner: Meteor.userId(), 14 | username: Meteor.user().username 15 | }); 16 | }, 17 | deleteTask: function (taskId: string) { 18 | var task = Tasks.findOne(taskId); 19 | if (task.private && task.owner !== Meteor.userId()) { 20 | // If the task is private, make sure only the owner can delete it 21 | throw new Meteor.Error('not-authorized'); 22 | } 23 | 24 | Tasks.remove(taskId); 25 | }, 26 | setChecked: function (taskId: string, setChecked: boolean) { 27 | var task = Tasks.findOne(taskId); 28 | if (task.private && task.owner !== Meteor.userId()) { 29 | // If the task is private, make sure only the owner can check it off 30 | throw new Meteor.Error('not-authorized'); 31 | } 32 | 33 | Tasks.update(taskId, { $set: { checked: setChecked} }); 34 | }, 35 | setPrivate: function (taskId: string, setToPrivate: boolean) { 36 | var task = Tasks.findOne(taskId); 37 | 38 | // Make sure only the task owner can make a task private 39 | if (task.owner !== Meteor.userId()) { 40 | throw new Meteor.Error('not-authorized'); 41 | } 42 | 43 | Tasks.update(taskId, { $set: { private: setToPrivate } }); 44 | } 45 | }); 46 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-addons-css-transition-group.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-css-transition-group) 2 | // Project: http://facebook.github.io/react/ 3 | // Definitions by: Asana , AssureSign , Microsoft 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped 5 | 6 | /// 7 | /// 8 | 9 | declare namespace __React { 10 | interface CSSTransitionGroupTransitionName { 11 | enter: string; 12 | enterActive?: string; 13 | leave: string; 14 | leaveActive?: string; 15 | appear?: string; 16 | appearActive?: string; 17 | } 18 | 19 | interface CSSTransitionGroupProps extends TransitionGroupProps { 20 | transitionName: string | CSSTransitionGroupTransitionName; 21 | transitionAppear?: boolean; 22 | transitionAppearTimeout?: number; 23 | transitionEnter?: boolean; 24 | transitionEnterTimeout?: number; 25 | transitionLeave?: boolean; 26 | transitionLeaveTimeout?: number; 27 | } 28 | 29 | type CSSTransitionGroup = ComponentClass; 30 | 31 | namespace __Addons { 32 | export var CSSTransitionGroup: __React.CSSTransitionGroup; 33 | } 34 | } 35 | 36 | declare module "react-addons-css-transition-group" { 37 | var CSSTransitionGroup: __React.CSSTransitionGroup; 38 | type CSSTransitionGroup = __React.CSSTransitionGroup; 39 | export = CSSTransitionGroup; 40 | } 41 | -------------------------------------------------------------------------------- /modules/typings/packages/flowRouter.d.ts: -------------------------------------------------------------------------------- 1 | interface FlowRouterRouteParameters { 2 | name?: string; 3 | subscriptions?: Function; 4 | action?: Function; 5 | middlewares?: any[]; 6 | triggersEnter?: any[]; 7 | triggersExit?: any[]; 8 | } 9 | 10 | interface FlowRouterRoute { 11 | path: string; 12 | params: Object; 13 | queryParams: Object; 14 | route: { name:string }; 15 | } 16 | 17 | interface FlowRouterGroupParams { 18 | prefix?: string; 19 | action?: Function; 20 | middlewares?: any[]; 21 | subscriptions?: Function; 22 | triggersEnter?: any[]; 23 | triggersExit?: any[]; 24 | } 25 | 26 | interface FlowRouterGroup { 27 | route(routeUrl: string, routeParameters: FlowRouterRouteParameters) : void 28 | } 29 | 30 | interface FlowRouterStatic { 31 | route(routeUrl: string, routeParameters: FlowRouterRouteParameters) : void 32 | notFound : FlowRouterRouteParameters 33 | path(routeName : string, routeParams?: Object, queryParams?: Object) : string; 34 | getParam(paramName : string) : string; 35 | getQueryParam(paramName : string) : string; 36 | go(routeName : string, routeParams?: Object, queryParams?: Object) : string; 37 | setParams(newParams : Object) : void; 38 | setQueryParams(newParams : Object) : void; 39 | getRouteName() : string; 40 | current(): FlowRouterRoute; 41 | watchPathChange(): void; 42 | group(params: FlowRouterGroupParams): FlowRouterGroup; 43 | subsReady(subscription?: string) : boolean; 44 | initialize(): any; 45 | } 46 | 47 | declare var FlowRouter : FlowRouterStatic 48 | 49 | 50 | interface BlazeLayoutStatic { 51 | render(layoutName: string, templates: Object) : void; 52 | } 53 | 54 | declare var BlazeLayout : BlazeLayoutStatic; 55 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/TodoMain.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactMixin from "react-mixin"; 3 | import ReactMeteorData from "react-meteor-data"; 4 | 5 | import TodoHeader from "./components/TodoHeader"; 6 | import TodoList from "./components/TodoList"; 7 | 8 | import Tasks from "../collections/Tasks"; 9 | 10 | interface State { 11 | hideCompleted: boolean; 12 | } 13 | 14 | @ReactMixin.decorate(ReactMeteorData) 15 | export default class TodoMain extends React.Component<{}, State> { 16 | data: any; 17 | 18 | state = { 19 | hideCompleted: false 20 | }; 21 | 22 | getMeteorData() { 23 | Meteor.subscribe("tasks"); 24 | 25 | let taskFilter = { 26 | }; 27 | 28 | if (this.state.hideCompleted) { 29 | taskFilter["checked"] = {$ne: true}; 30 | } 31 | 32 | const tasks = Tasks.find(taskFilter, {sort: {createdAt: -1}}).fetch(); 33 | const incompleteCount = Tasks.find({checked: {$ne: true}}).count(); 34 | 35 | return { 36 | tasks, 37 | incompleteCount, 38 | user: Meteor.user() 39 | }; 40 | } 41 | 42 | handleToggleHideCompleted = (e: any) => { 43 | this.setState({ hideCompleted: e.target.checked }); 44 | }; 45 | 46 | render() { 47 | if (!this.data.tasks) { 48 | // loading 49 | return null; 50 | } 51 | 52 | return ( 53 |
54 | 59 | 60 |
61 | ); 62 | } 63 | }; 64 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/components/TodoItem.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | interface Props { 4 | isRequired?: boolean, 5 | task?: any, 6 | key: any 7 | } 8 | 9 | export default class TodoItem extends React.Component { 10 | 11 | handleChecked(e: any) { 12 | // Set the checked property to the opposite of its current value 13 | Meteor.call('setChecked', this.props.task._id, e.target.checked); 14 | } 15 | 16 | handleDelete() { 17 | Meteor.call('deleteTask', this.props.task._id); 18 | } 19 | 20 | handleSetPrivate() { 21 | Meteor.call('setPrivate', this.props.task._id, !this.props.task.private); 22 | } 23 | 24 | renderTogglePrivate() { 25 | if (Meteor.userId() !== this.props.task.owner) { 26 | return null; 27 | } 28 | 29 | return ( 30 | 33 | ); 34 | } 35 | 36 | render() { 37 | let itemClass = ''; 38 | 39 | if (this.props.task.checked) { 40 | itemClass += 'checked'; 41 | } 42 | 43 | if (this.props.task.private) { 44 | itemClass += ' private'; 45 | } 46 | 47 | return ( 48 |
  • 49 | 50 | 51 | {this.renderTogglePrivate()} 52 | {this.props.task.username} - {this.props.task.text} 53 |
  • 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-addons-perf.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-addons-perf) 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 ComponentPerfContext { 10 | current: string; 11 | owner: string; 12 | } 13 | 14 | interface NumericPerfContext { 15 | [key: string]: number; 16 | } 17 | 18 | interface Measurements { 19 | exclusive: NumericPerfContext; 20 | inclusive: NumericPerfContext; 21 | render: NumericPerfContext; 22 | counts: NumericPerfContext; 23 | writes: NumericPerfContext; 24 | displayNames: { 25 | [key: string]: ComponentPerfContext; 26 | }; 27 | totalTime: number; 28 | } 29 | 30 | namespace __Addons { 31 | namespace Perf { 32 | export function start(): void; 33 | export function stop(): void; 34 | export function printInclusive(measurements: Measurements[]): void; 35 | export function printExclusive(measurements: Measurements[]): void; 36 | export function printWasted(measurements: Measurements[]): void; 37 | export function printDOM(measurements: Measurements[]): void; 38 | export function getLastMeasurements(): Measurements[]; 39 | } 40 | } 41 | } 42 | 43 | declare module "react-addons-perf" { 44 | import Perf = __React.__Addons.Perf; 45 | export = Perf; 46 | } 47 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/components/TodoHeader.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | //import BlazeToReact from "blaze-to-react"; 3 | //import '/client/img/check.png'; 4 | 5 | const LoginButtons = BlazeToReact("loginButtons"); 6 | 7 | interface Props { 8 | hideCompleted: boolean; 9 | toggleHideCompleted: any; 10 | incompleteCount: Function; 11 | } 12 | 13 | export default class TodoHeader extends React.Component { 14 | // static propTypes = { 15 | // hideCompleted: PropTypes.bool, 16 | // toggleHideCompleted: PropTypes.func.isRequired, 17 | // incompleteCount: PropTypes.number.isRequired 18 | // } 19 | 20 | handleSubmit(event: any) { 21 | // Prevent default browser form submit 22 | event.preventDefault(); 23 | 24 | // Get value from form element 25 | var text = event.target.text.value; 26 | 27 | // Insert a task into the collection 28 | Meteor.call("addTask", text); 29 | 30 | // Clear form 31 | event.target.text.value = ""; 32 | } 33 | 34 | render() { 35 | let form: any = null; 36 | 37 | if (Meteor.userId()) { 38 | form = ( 39 |
    40 | 41 |
    42 | ); 43 | } 44 | 45 | return ( 46 |
    47 |

    48 | Todo List ({this.props.incompleteCount}) 49 |

    50 | 51 | 55 | 56 | 57 | 58 | {form} 59 |
    60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "class-name": true, 4 | "comment-format": [true, "check-space"], 5 | "curly": true, 6 | "eofline": true, 7 | "forin": true, 8 | "indent": [true, "spaces"], 9 | "label-position": true, 10 | "label-undefined": true, 11 | "max-line-length": [true, 140], 12 | "member-access": true, 13 | "member-ordering": [true, 14 | "public-before-private", 15 | "static-before-instance", 16 | "variables-before-functions" 17 | ], 18 | "no-arg": true, 19 | "no-bitwise": true, 20 | "no-console": [true, 21 | "debug", 22 | "info", 23 | "time", 24 | "timeEnd", 25 | "trace" 26 | ], 27 | "no-construct": true, 28 | "no-debugger": true, 29 | "no-duplicate-key": true, 30 | "no-duplicate-variable": true, 31 | "no-empty": true, 32 | "no-eval": true, 33 | "no-inferrable-types": true, 34 | "no-shadowed-variable": true, 35 | "no-string-literal": true, 36 | "no-switch-case-fall-through": true, 37 | "no-trailing-comma": true, 38 | "no-trailing-whitespace": true, 39 | "no-unused-expression": true, 40 | "no-unused-variable": true, 41 | "no-unreachable": true, 42 | "no-use-before-declare": true, 43 | "no-var-keyword": true, 44 | "object-literal-sort-keys": true, 45 | "one-line": [true, 46 | "check-open-brace", 47 | "check-catch", 48 | "check-else", 49 | "check-whitespace" 50 | ], 51 | "quotemark": [true, "double", "avoid-escape"], 52 | "radix": true, 53 | "semicolon": true, 54 | "triple-equals": [true, "allow-null-check"], 55 | "typedef-whitespace": [true, { 56 | "call-signature": "nospace", 57 | "index-signature": "nospace", 58 | "parameter": "nospace", 59 | "property-declaration": "nospace", 60 | "variable-declaration": "nospace" 61 | }], 62 | "variable-name": false, 63 | "whitespace": [true, 64 | "check-branch", 65 | "check-decl", 66 | "check-operator", 67 | "check-separator", 68 | "check-type" 69 | ] 70 | } 71 | } -------------------------------------------------------------------------------- /.meteor/versions: -------------------------------------------------------------------------------- 1 | accounts-base@1.2.2 2 | accounts-password@1.1.4 3 | accounts-ui@1.1.6 4 | accounts-ui-unstyled@1.1.8 5 | autoupdate@1.2.4 6 | babel-compiler@5.8.24_1 7 | babel-runtime@0.1.4 8 | base64@1.0.4 9 | binary-heap@1.0.4 10 | blaze@2.1.3 11 | blaze-html-templates@1.0.1 12 | blaze-tools@1.0.4 13 | boilerplate-generator@1.0.4 14 | caching-compiler@1.0.0 15 | caching-html-compiler@1.0.2 16 | callback-hook@1.0.4 17 | check@1.1.0 18 | coffeescript@1.0.11 19 | cosmos:browserify@0.9.3 20 | ddp@1.2.2 21 | ddp-client@1.2.1 22 | ddp-common@1.2.2 23 | ddp-rate-limiter@1.0.0 24 | ddp-server@1.2.2 25 | deps@1.0.9 26 | diff-sequence@1.0.1 27 | ecmascript@0.1.6 28 | ecmascript-runtime@0.2.6 29 | ejson@1.0.7 30 | email@1.0.8 31 | es5-shim@4.1.14 32 | fastclick@1.0.7 33 | geojson-utils@1.0.4 34 | hot-code-push@1.0.0 35 | html-tools@1.0.5 36 | htmljs@1.0.5 37 | http@1.1.1 38 | id-map@1.0.4 39 | jquery@1.11.4 40 | jsx@0.2.3 41 | kadira:flow-router@2.10.0 42 | kadira:react-layout@1.5.3 43 | launch-screen@1.0.4 44 | less@2.5.1 45 | livedata@1.0.15 46 | localstorage@1.0.5 47 | logging@1.0.8 48 | meteor@1.1.10 49 | meteor-base@1.0.1 50 | meteorhacks:subs-manager@1.6.3 51 | minifiers@1.1.7 52 | minimongo@1.0.10 53 | mobile-experience@1.0.1 54 | mobile-status-bar@1.0.6 55 | mongo@1.1.3 56 | mongo-id@1.0.1 57 | npm-bcrypt@0.7.8_2 58 | npm-mongo@1.4.39_1 59 | observe-sequence@1.0.7 60 | ordered-dict@1.0.4 61 | promise@0.5.1 62 | random@1.0.5 63 | rate-limit@1.0.0 64 | react@0.14.3 65 | react-meteor-data@0.2.4 66 | react-runtime@0.14.4 67 | react-runtime-dev@0.14.4 68 | react-runtime-prod@0.14.4 69 | reactive-dict@1.1.3 70 | reactive-var@1.0.6 71 | reload@1.1.4 72 | retry@1.0.4 73 | routepolicy@1.0.6 74 | service-configuration@1.0.5 75 | session@1.1.1 76 | sha@1.0.4 77 | spacebars@1.0.7 78 | spacebars-compiler@1.0.7 79 | srp@1.0.4 80 | standard-minifiers@1.0.2 81 | templating@1.1.5 82 | templating-tools@1.0.0 83 | thereactivestack:blazetoreact@0.1.5 84 | tracker@1.0.9 85 | ui@1.0.8 86 | underscore@1.0.4 87 | url@1.0.5 88 | webapp@1.2.3 89 | webapp-hashing@1.0.5 90 | webpack:npmworkaround@0.1.0 91 | webpack:reload@0.2.0 92 | webpack:webpack@0.4.4 93 | -------------------------------------------------------------------------------- /modules/Mantra/client/modules/core/containers/tests/post.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {stub, spy} from 'sinon'; 4 | import {composer} from '../post'; 5 | 6 | describe('containers.post', () => { 7 | describe('composer', () => { 8 | const Tracker = {nonreactive: cb => cb()}; 9 | const getCollections = (post) => { 10 | const Collections = { 11 | Posts: {findOne: stub()} 12 | }; 13 | Collections.Posts.findOne.returns(post); 14 | return Collections; 15 | }; 16 | 17 | it('should subscribe to the given postId via prop', () => { 18 | const Meteor = {subscribe: stub()}; 19 | Meteor.subscribe.returns({ready: () => false}); 20 | const Collections = getCollections(); 21 | 22 | const context = () => ({Meteor, Tracker, Collections}); 23 | const postId = 'dwd'; 24 | const onData = spy(); 25 | 26 | composer({context, postId}, onData); 27 | const args = Meteor.subscribe.args[0]; 28 | expect(args.slice(0, 2)).to.deep.equal([ 29 | 'posts.single', postId 30 | ]); 31 | }); 32 | 33 | describe('while subscribing', () => { 34 | it('should call just onData()', () => { 35 | const Meteor = {subscribe: stub()}; 36 | const Collections = getCollections(); 37 | 38 | const context = () => ({Meteor, Tracker, Collections}); 39 | const postId = 'dwd'; 40 | const onData = spy(); 41 | 42 | composer({context, postId}, onData); 43 | expect(onData.args[0]).to.deep.equal([]); 44 | }); 45 | }); 46 | 47 | describe('after subscribed', () => { 48 | it('should find the post and send it to onData', () => { 49 | const Meteor = {subscribe: stub()}; 50 | 51 | const post = {_id: 'post'}; 52 | const Collections = getCollections(post); 53 | 54 | const context = () => ({Meteor, Collections, Tracker}); 55 | const postId = 'dwd'; 56 | const onData = spy(); 57 | 58 | composer({context, postId}, onData); 59 | expect(onData.args[0]).to.deep.equal([ null, {post} ]); 60 | }); 61 | }); 62 | }); 63 | }); 64 | -------------------------------------------------------------------------------- /modules/MantraTS/client/modules/core/containers/tests/post.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = global; 2 | import {expect} from 'chai'; 3 | import {stub, spy} from 'sinon'; 4 | import {composer} from '../post'; 5 | 6 | describe('containers.post', () => { 7 | describe('composer', () => { 8 | const Tracker = {nonreactive: cb => cb()}; 9 | const getCollections = (post) => { 10 | const Collections = { 11 | Posts: {findOne: stub()} 12 | }; 13 | Collections.Posts.findOne.returns(post); 14 | return Collections; 15 | }; 16 | 17 | it('should subscribe to the given postId via prop', () => { 18 | const Meteor = {subscribe: stub()}; 19 | Meteor.subscribe.returns({ready: () => false}); 20 | const Collections = getCollections(); 21 | 22 | const context = () => ({Meteor, Tracker, Collections}); 23 | const postId = 'dwd'; 24 | const onData = spy(); 25 | 26 | composer({context, postId}, onData); 27 | const args = Meteor.subscribe.args[0]; 28 | expect(args.slice(0, 2)).to.deep.equal([ 29 | 'posts.single', postId 30 | ]); 31 | }); 32 | 33 | describe('while subscribing', () => { 34 | it('should call just onData()', () => { 35 | const Meteor = {subscribe: stub()}; 36 | const Collections = getCollections(); 37 | 38 | const context = () => ({Meteor, Tracker, Collections}); 39 | const postId = 'dwd'; 40 | const onData = spy(); 41 | 42 | composer({context, postId}, onData); 43 | expect(onData.args[0]).to.deep.equal([]); 44 | }); 45 | }); 46 | 47 | describe('after subscribed', () => { 48 | it('should find the post and send it to onData', () => { 49 | const Meteor = {subscribe: stub()}; 50 | 51 | const post = {_id: 'post'}; 52 | const Collections = getCollections(post); 53 | 54 | const context = () => ({Meteor, Collections, Tracker}); 55 | const postId = 'dwd'; 56 | const onData = spy(); 57 | 58 | composer({context, postId}, onData); 59 | expect(onData.args[0]).to.deep.equal([ null, {post} ]); 60 | }); 61 | }); 62 | }); 63 | }); 64 | -------------------------------------------------------------------------------- /entry/client/semantic.js: -------------------------------------------------------------------------------- 1 | //import 'semantic-ui-css/semantic.css'; 2 | //import 'semantic-ui-css/semantic.js'; 3 | 4 | import 'semantic-ui-css/components/site.css'; 5 | import 'semantic-ui-css/components/site.js'; 6 | 7 | import 'semantic-ui-css/components/accordion.css' 8 | import 'semantic-ui-css/components/api.js' 9 | import 'semantic-ui-css/components/breadcrumb.css'; 10 | import 'semantic-ui-css/components/button.css' 11 | import 'semantic-ui-css/components/checkbox.js'; 12 | import 'semantic-ui-css/components/checkbox.css'; 13 | import 'semantic-ui-css/components/container.css'; 14 | import 'semantic-ui-css/components/dimmer.css'; 15 | import 'semantic-ui-css/components/dimmer.js'; 16 | import 'semantic-ui-css/components/divider.css'; 17 | import 'semantic-ui-css/components/dropdown.css'; 18 | import 'semantic-ui-css/components/dropdown.js'; 19 | import 'semantic-ui-css/components/feed.css'; 20 | import 'semantic-ui-css/components/form.js'; 21 | import 'semantic-ui-css/components/form.css'; 22 | import 'semantic-ui-css/components/grid'; 23 | import 'semantic-ui-css/components/header.css'; 24 | import 'semantic-ui-css/components/icon.css'; 25 | import 'semantic-ui-css/components/input.css'; 26 | import 'semantic-ui-css/components/item.css'; 27 | import 'semantic-ui-css/components/image.css'; 28 | import 'semantic-ui-css/components/label.css'; 29 | import 'semantic-ui-css/components/list.css'; 30 | import 'semantic-ui-css/components/loader.css'; 31 | import 'semantic-ui-css/components/menu.css'; 32 | import 'semantic-ui-css/components/message.css'; 33 | import 'semantic-ui-css/components/modal.js'; 34 | import 'semantic-ui-css/components/modal.css'; 35 | import 'semantic-ui-css/components/popup.css'; 36 | import 'semantic-ui-css/components/popup.js'; 37 | import 'semantic-ui-css/components/progress.css'; 38 | import 'semantic-ui-css/components/reset.css'; 39 | import 'semantic-ui-css/components/segment.css'; 40 | import 'semantic-ui-css/components/search.js'; 41 | import 'semantic-ui-css/components/search.css'; 42 | import 'semantic-ui-css/components/sidebar.css'; 43 | import 'semantic-ui-css/components/tab.css'; 44 | import 'semantic-ui-css/components/tab.js'; 45 | import 'semantic-ui-css/components/table.css'; 46 | import 'semantic-ui-css/components/transition.css'; 47 | import 'semantic-ui-css/components/transition.js'; 48 | -------------------------------------------------------------------------------- /modules/TodoAppTS/client/css/TodoApp.import.css: -------------------------------------------------------------------------------- 1 | /* CSS declarations go here */ 2 | body { 3 | font-family: sans-serif; 4 | background-color: #315481; 5 | background-image: url(../img/scratched-texture.jpg); 6 | background-attachment: fixed; 7 | 8 | position: absolute; 9 | top: 0; 10 | bottom: 0; 11 | left: 0; 12 | right: 0; 13 | 14 | padding: 0; 15 | margin: 0; 16 | 17 | font-size: 14px; 18 | } 19 | 20 | .container { 21 | max-width: 600px; 22 | margin: 0 auto; 23 | min-height: 100%; 24 | background: white; 25 | } 26 | 27 | header { 28 | background: #d2edf4; 29 | background-image: linear-gradient(to bottom, #d0edf5, #e1e5f0 100%); 30 | padding: 20px 15px 15px 15px; 31 | position: relative; 32 | } 33 | 34 | #login-buttons { 35 | display: block; 36 | } 37 | 38 | h1 { 39 | font-size: 1.5em; 40 | margin: 0; 41 | margin-bottom: 10px; 42 | display: inline-block; 43 | margin-right: 1em; 44 | } 45 | 46 | form { 47 | margin-top: 10px; 48 | margin-bottom: -10px; 49 | position: relative; 50 | } 51 | 52 | .new-task input { 53 | box-sizing: border-box; 54 | padding: 10px 0; 55 | background: transparent; 56 | border: none; 57 | width: 100%; 58 | padding-right: 80px; 59 | font-size: 1em; 60 | } 61 | 62 | .new-task input:focus{ 63 | outline: 0; 64 | } 65 | 66 | ul { 67 | margin: 0; 68 | padding: 0; 69 | background: white; 70 | } 71 | 72 | .delete { 73 | float: right; 74 | font-weight: bold; 75 | background: none; 76 | font-size: 1em; 77 | border: none; 78 | position: relative; 79 | } 80 | 81 | li { 82 | position: relative; 83 | list-style: none; 84 | padding: 15px; 85 | border-bottom: #eee solid 1px; 86 | } 87 | 88 | li .text { 89 | margin-left: 10px; 90 | } 91 | 92 | li.checked { 93 | color: #888; 94 | } 95 | 96 | li.checked .text { 97 | text-decoration: line-through; 98 | } 99 | 100 | li.private { 101 | background: #eee; 102 | border-color: #ddd; 103 | } 104 | 105 | header .hide-completed { 106 | float: right; 107 | } 108 | 109 | .toggle-private { 110 | margin-left: 5px; 111 | } 112 | 113 | @media (max-width: 600px) { 114 | li { 115 | padding: 12px 15px; 116 | } 117 | 118 | .search { 119 | width: 150px; 120 | clear: both; 121 | } 122 | 123 | .new-task input { 124 | padding-bottom: 5px; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /modules/typings/packages/smallPackages.d.ts: -------------------------------------------------------------------------------- 1 | declare function mf(code: string): string; 2 | 3 | declare module Modules { 4 | export var Hugo: any; 5 | } 6 | 7 | declare var ReactMeteorData: any; 8 | 9 | declare module Meteor { 10 | interface AsyncCallback { (error: Meteor.Error, result: any): void } 11 | } 12 | 13 | declare module marked { 14 | export function setOptions(options: Object): void; 15 | } 16 | 17 | declare function marked(text : string) : string; 18 | 19 | declare module hljs { 20 | export function highlightAuto(code: string): { value: string }; 21 | } 22 | 23 | // declare module AceEditor { 24 | // export function instance(name: string, options?: any, version?: number): AceAjax.IEditSession; 25 | // export function setUpPaths(version: number): void; 26 | // } 27 | 28 | declare module loopProtect { 29 | export function rewriteLoops(code: string): string; 30 | export function protect(state: any): void; 31 | } 32 | 33 | declare module DiffViewSimple { 34 | export function compare(code1: string, code2: string): string; 35 | export function renderDelta(codeHistory: any, currentStepNumber: number, something: number): string; 36 | } 37 | 38 | declare module DiffView { 39 | export function compare( 40 | previousStep: string, 41 | currentStep: string, 42 | previousText: string, 43 | currentText: string, 44 | something: string, 45 | other: number): string; 46 | } 47 | 48 | declare module PimPam { 49 | export function mimo(): void; 50 | } 51 | 52 | declare class JSZip { 53 | folder(name: string): any; 54 | generate(param: Object): any; 55 | } 56 | 57 | declare module WebApp { 58 | export var connectHandlers: any; 59 | } 60 | 61 | declare function Beautify(text: string): string; 62 | 63 | declare module "js-beautify" { 64 | export default Beautify; 65 | } 66 | 67 | declare module KeyboardJS { 68 | export function on(modifier: string, func: any): void; 69 | } 70 | 71 | declare module "react-ace" { 72 | var AceEditor: any; // class AceEditor extends __React.Component<{}, {}> {} 73 | export default AceEditor; 74 | } 75 | 76 | // declare module swal { 77 | // var some: any; // class AceEditor extends __React.Component<{}, {}> {} 78 | // export default some; 79 | // } 80 | 81 | declare function swal(...any: any[]): void; 82 | 83 | declare module "classnames" { 84 | var classnames: any; // class AceEditor extends __React.Component<{}, {}> {} 85 | export default classnames; 86 | } 87 | -------------------------------------------------------------------------------- /modules/typings/packages/meteor-typescript-utils.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for Meteor Typescript Utils Version 0.1 2 | // Project: https://github.com/dataflows/meteor-typescript-utils 3 | // Definitions by: Marek Rogala 4 | // Definitions: https://github.com/dataflows/meteor-typescript-utils 5 | 6 | /// 7 | /// 8 | /// 9 | /// 10 | 11 | declare module meteorts { 12 | 13 | module MeteorTemplate { 14 | 15 | interface IEventHandler { 16 | (event: Meteor.Event, template: IBlaze): void; 17 | } 18 | 19 | function event(eventMatcher: string): (target: Function, key: string, value: any) => any; 20 | 21 | function helper(target: Function, key: string, value: any): any; 22 | 23 | class Base { 24 | name: string; 25 | context: T; 26 | subscriptions: any; 27 | constructor(name: string, helpers?: Object, events?: any, Bindings?: Object, context?: T); 28 | data: T; 29 | $: JQueryStatic; 30 | autorun(fc: Function) : void; 31 | } 32 | 33 | interface IEventsMap { 34 | [event: string]: IEventHandler; 35 | } 36 | 37 | interface IMeteorTemplate { 38 | name: string; 39 | context: T; 40 | rendered?: () => void; 41 | created?: () => void; 42 | destroyed?: () => void; 43 | } 44 | 45 | interface IBlaze extends Blaze.Template { 46 | data: T; 47 | } 48 | 49 | function register(template: IMeteorTemplate): void; 50 | } 51 | } 52 | 53 | declare module meteorts { 54 | 55 | interface IMeteorCallback { 56 | (error: Meteor.Error, result: Returns): void; 57 | } 58 | 59 | class MeteorMethod { 60 | name: string; 61 | constructor(name: string); 62 | call(args: Args, callback?: IMeteorCallback): void; 63 | apply(args: Args, callback?: IMeteorCallback): void; 64 | } 65 | 66 | module MeteorMethod { 67 | interface Impl { 68 | apply(args: Args): Returns; 69 | } 70 | class BaseMixin { 71 | unblock(): void; 72 | } 73 | function register(method: MeteorMethod, impl: Impl): void; 74 | } 75 | 76 | } 77 | 78 | declare module meteorts { 79 | 80 | class RouteControllerBase { 81 | protected ready: () => boolean; 82 | protected redirect: (route: string) => boolean; 83 | protected render: (name: string) => void; 84 | protected params: RouteParams; 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /modules/typings/typings/react/react-dom.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for React v0.14 (react-dom) 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 | namespace __DOM { 10 | function findDOMNode(instance: ReactInstance): E; 11 | function findDOMNode(instance: ReactInstance): Element; 12 | 13 | function render

    ( 14 | element: DOMElement

    , 15 | container: Element, 16 | callback?: (element: Element) => any): Element; 17 | function render( 18 | element: ClassicElement

    , 19 | container: Element, 20 | callback?: (component: ClassicComponent) => any): ClassicComponent; 21 | function render( 22 | element: ReactElement

    , 23 | container: Element, 24 | callback?: (component: Component) => any): Component; 25 | 26 | function unmountComponentAtNode(container: Element): boolean; 27 | 28 | var version: string; 29 | 30 | function unstable_batchedUpdates(callback: (a: A, b: B) => any, a: A, b: B): void; 31 | function unstable_batchedUpdates(callback: (a: A) => any, a: A): void; 32 | function unstable_batchedUpdates(callback: () => any): void; 33 | 34 | function unstable_renderSubtreeIntoContainer

    ( 35 | parentComponent: Component, 36 | nextElement: DOMElement

    , 37 | container: Element, 38 | callback?: (element: Element) => any): Element; 39 | function unstable_renderSubtreeIntoContainer( 40 | parentComponent: Component, 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 | --------------------------------------------------------------------------------