├── Model.ts ├── tsconfig.json ├── tsd.json ├── styles.css ├── .gitignore ├── TodoListComponent.ts ├── TodoApp.ts ├── Validators.ts ├── index.html └── TodoService.ts /Model.ts: -------------------------------------------------------------------------------- 1 | export interface Todo { 2 | id: number; 3 | name: string; 4 | state: TodoState; 5 | } 6 | 7 | export enum TodoState { 8 | Active = 1, 9 | Complete = 2 10 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "declaration": true, 5 | "module": "system", 6 | "sourceMap": true, 7 | "experimentalDecorators": true 8 | } 9 | } -------------------------------------------------------------------------------- /tsd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4", 3 | "repo": "borisyankov/DefinitelyTyped", 4 | "ref": "master", 5 | "path": "typings", 6 | "bundle": "typings/tsd.d.ts", 7 | "installed": { 8 | "jquery/jquery.d.ts": { 9 | "commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | .text-strikethrough { 2 | text-decoration: line-through; 3 | } 4 | 5 | .text-giant { 6 | font-size: 200%; 7 | } 8 | 9 | .completed-indicator { 10 | color: lawngreen 11 | } 12 | 13 | .todo-item .completed { 14 | display: none; 15 | } 16 | 17 | .todo-item.completed .completed { 18 | display: block; 19 | } 20 | 21 | .todo-item.completed .incomplete { 22 | display: none; 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Commenting this out is preferred by some people, see 24 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 25 | node_modules 26 | 27 | # Users Environment Variables 28 | .lock-wscript 29 | 30 | .DS_Store 31 | 32 | *.css 33 | 34 | .vscode 35 | 36 | *.js 37 | *.d.ts 38 | *.js.map 39 | 40 | typings/ -------------------------------------------------------------------------------- /TodoListComponent.ts: -------------------------------------------------------------------------------- 1 | import { Todo, TodoState } from './Model'; 2 | import '//code.jquery.com/jquery-1.12.1.min.js'; 3 | 4 | export default class TodoListComponent { 5 | 6 | private $el: JQuery; 7 | 8 | constructor(el: HTMLElement) { 9 | this.$el = $(el); 10 | } 11 | 12 | render(todos) { 13 | 14 | this.$el.html(''); 15 | 16 | if (!todos.length) { 17 | this.$el.html( 18 | "