From 4d97d190610d089e288d221ce5a4e9779470bea0 Mon Sep 17 00:00:00 2001 From: Dmitriy Shekhovtsov Date: Mon, 19 Oct 2015 16:18:35 +0300 Subject: [PATCH 1/8] chore(dependencies): updated to latest and made immutable --- .gitignore | 1 + package.json | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 82756e3..d53c195 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ build/Release ehthumbs.db Icon? Thumbs.db +.idea # Node Files # node_modules diff --git a/package.json b/package.json index f3d0ccb..3caa896 100644 --- a/package.json +++ b/package.json @@ -21,32 +21,32 @@ }, "homepage": "https://github.com/auth0/angular2-authentication-sample", "dependencies": { - "angular2": "2.0.0-alpha.30", - "raw-loader": "^0.5.1", - "reflect-metadata": "^0.1.0", - "rtts_assert": "2.0.0-alpha.29", - "rx": "^2.5.3", - "zone.js": "^0.5.0", - "bootstrap": "~3.3.4", - "jwt-decode": "~1.1.0", - "whatwg-fetch": "~0.7.0", - "when": "~3.7.3" + "angular2": "2.0.0-alpha.44", + "raw-loader": "0.5.1", + "reflect-metadata": "0.1.2", + "rtts_assert": "2.0.0-alpha.37", + "rx": "4.0.6", + "zone.js": "0.5.8", + "bootstrap": "3.3.5", + "jwt-decode": "1.4.0", + "whatwg-fetch": "0.10.0", + "when": "3.7.3" }, "devDependencies": { - "css-loader": "^0.14.4", - "xtend": "^4.0.0", - "loader-utils": "^0.2.9", - "exports-loader": "^0.6.2", - "expose-loader": "^0.7.0", - "file-loader": "^0.8.1", - "html-webpack-plugin": "^1.4.0", - "imports-loader": "^0.6.3", - "json-loader": "^0.5.1", - "style-loader": "^0.12.2", - "typescript": "^1.5.0-beta", - "typescript-simple-loader": "^0.1.2", - "url-loader": "^0.5.5", - "webpack": "^1.9.6", - "webpack-dev-server": "^1.8.2" + "css-loader": "0.20.1", + "xtend": "4.0.0", + "loader-utils": "0.2.11", + "exports-loader": "0.6.2", + "expose-loader": "0.7.0", + "file-loader": "0.8.4", + "html-webpack-plugin": "1.6.2", + "imports-loader": "0.6.5", + "json-loader": "0.5.3", + "style-loader": "0.12.4", + "typescript": "1.6.2", + "typescript-simple-loader": "0.3.8", + "url-loader": "0.5.6", + "webpack": "1.12.2", + "webpack-dev-server": "1.12.1" } } From fc56f85f040f71b2e6466f23469c68363a84fd00 Mon Sep 17 00:00:00 2001 From: Dmitriy Shekhovtsov Date: Mon, 19 Oct 2015 17:51:46 +0300 Subject: [PATCH 2/8] chore(start): updated ng2 0.44 --- package.json | 8 +- src/app/LoggedInOutlet.ts | 28 +- src/app/app.ts | 9 +- src/home/home.ts | 56 +- src/index.ts | 16 +- src/login/login.ts | 14 +- src/signup/signup.ts | 15 +- tsconfig.json | 14 +- tsd.json | 21 - typings/_custom/custom.d.ts | 1 - typings/_custom/ng2.d.ts | 1004 ----- typings/angular2/angular2.d.ts | 4625 ------------------------ typings/es6-promise/es6-promise.d.ts | 73 - typings/rx/rx-lite.d.ts | 644 ---- typings/rx/rx.d.ts | 67 - typings/tsd.d.ts | 5 - typings/whatwg-fetch/whatwg-fetch.d.ts | 2 +- webpack.config.js | 11 +- 18 files changed, 79 insertions(+), 6534 deletions(-) delete mode 100644 tsd.json delete mode 100644 typings/_custom/ng2.d.ts delete mode 100644 typings/angular2/angular2.d.ts delete mode 100644 typings/es6-promise/es6-promise.d.ts delete mode 100644 typings/rx/rx-lite.d.ts delete mode 100644 typings/rx/rx.d.ts diff --git a/package.json b/package.json index 3caa896..3e6f3f0 100644 --- a/package.json +++ b/package.json @@ -34,19 +34,19 @@ }, "devDependencies": { "css-loader": "0.20.1", - "xtend": "4.0.0", - "loader-utils": "0.2.11", "exports-loader": "0.6.2", "expose-loader": "0.7.0", "file-loader": "0.8.4", "html-webpack-plugin": "1.6.2", "imports-loader": "0.6.5", "json-loader": "0.5.3", + "loader-utils": "0.2.11", "style-loader": "0.12.4", + "ts-loader": "0.5.6", "typescript": "1.6.2", - "typescript-simple-loader": "0.3.8", "url-loader": "0.5.6", "webpack": "1.12.2", - "webpack-dev-server": "1.12.1" + "webpack-dev-server": "1.12.1", + "xtend": "4.0.0" } } diff --git a/src/app/LoggedInOutlet.ts b/src/app/LoggedInOutlet.ts index 590a326..46cc165 100644 --- a/src/app/LoggedInOutlet.ts +++ b/src/app/LoggedInOutlet.ts @@ -1,28 +1,30 @@ import {Directive, Attribute, ElementRef, DynamicComponentLoader} from 'angular2/angular2'; -import {Router, RouterOutlet} from 'angular2/router'; -import {Injector} from 'angular2/di'; +import {Router, RouterOutlet, ComponentInstruction} from 'angular2/router'; import {Login} from '../login/login'; @Directive({ selector: 'router-outlet' }) export class LoggedInRouterOutlet extends RouterOutlet { - publicRoutes: any - constructor(public _elementRef: ElementRef, public _loader: DynamicComponentLoader, - public _parentRouter: Router, @Attribute('name') nameAttr: string) { - super(_elementRef, _loader, _parentRouter, nameAttr); + publicRoutes:any; + private parentRouter:Router; - this.publicRoutes = { - '/login': true, - '/signup': true - }; + constructor(_elementRef:ElementRef, _loader:DynamicComponentLoader, + _parentRouter:Router, @Attribute('name') nameAttr:string) { + super(_elementRef, _loader, _parentRouter, nameAttr); + this.parentRouter = _parentRouter; + this.publicRoutes = { + '/login': true, + '/signup': true + }; } - activate(instruction) { - var url = this._parentRouter.lastNavigationAttempt; + activate(instruction: ComponentInstruction) { + var url = this.parentRouter.lastNavigationAttempt; if (!this.publicRoutes[url] && !localStorage.getItem('jwt')) { - instruction.component = Login; + // todo: redirect to Login + //instruction.component = Login; } return super.activate(instruction); } diff --git a/src/app/app.ts b/src/app/app.ts index f28ea01..33ed910 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,7 +1,6 @@ -/// - import {View, Component} from 'angular2/angular2'; import {Location, RouteConfig, RouterLink, Router} from 'angular2/router'; + import {LoggedInRouterOutlet} from './LoggedInOutlet'; import {Home} from '../home/home'; import {Login} from '../login/login'; @@ -19,9 +18,9 @@ let template = require('./app.html'); }) @RouteConfig([ { path: '/', redirectTo: '/home' }, - { path: '/home', as: 'home', component: Home }, - { path: '/login', as: 'login', component: Login }, - { path: '/signup', as: 'signup', component: Signup } + { path: '/home', as: 'Home', component: Home }, + { path: '/login', as: 'Login', component: Login }, + { path: '/signup', as: 'Signup', component: Signup } ]) export class App { constructor(public router: Router) { diff --git a/src/home/home.ts b/src/home/home.ts index a10ffea..e790783 100644 --- a/src/home/home.ts +++ b/src/home/home.ts @@ -1,11 +1,9 @@ -/// +import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2'; +import { Router } from 'angular2/router'; -import {Component, View} from 'angular2/angular2'; -import {coreDirectives} from 'angular2/directives'; import {status, text} from '../utils/fetch' -import { Router} from 'angular2/router'; -let styles = require('./home.css'); +let styles = require('./home.css'); let template = require('./home.html'); @@ -13,24 +11,24 @@ let template = require('./home.html'); selector: 'home' }) @View({ - styles: [ styles ], + directives: [CORE_DIRECTIVES], template: template, - directives: [ coreDirectives ] + styles: [styles] }) export class Home { - jwt: string; - decodedJwt: string; - response: string; - api: string; + jwt:string; + decodedJwt:string; + response:string; + api:string; - constructor(public router: Router) { + constructor(public router:Router) { this.jwt = localStorage.getItem('jwt'); this.decodedJwt = this.jwt && window.jwt_decode(this.jwt); } logout() { localStorage.removeItem('jwt'); - this.router.parent.navigate('/login'); + this.router.parent.navigate(['/login']); } callAnonymousApi() { @@ -40,25 +38,25 @@ export class Home { callSecuredApi() { this._callApi('Secured', 'http://localhost:3001/api/protected/random-quote'); } + _callApi(type, url) { this.response = null; this.api = type; window.fetch(url, { - method: 'GET', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'bearer ' + this.jwt - } - }) - .then(status) - .then(text) - .then((response) => { - this.response = response; - }) - .catch((error) => { - this.response = error.message; - }); + method: 'GET', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': 'bearer ' + this.jwt + } + }) + .then(status) + .then(text) + .then((response) => { + this.response = response; + }) + .catch((error) => { + this.response = error.message; + }); } - } diff --git a/src/index.ts b/src/index.ts index fc05dba..00eaa03 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,14 @@ -/// - -import { bootstrap } from 'angular2/angular2'; -import { bind } from 'angular2/di'; -import { routerInjectables } from 'angular2/router'; -import { formInjectables } from 'angular2/forms'; -import { httpInjectables } from 'angular2/http'; +import { bootstrap, FORM_PROVIDERS } from 'angular2/angular2'; +import { ROUTER_PROVIDERS } from 'angular2/router'; +import { HTTP_PROVIDERS } from 'angular2/http'; import { App } from './app/app'; bootstrap( App, [ - formInjectables, - routerInjectables, - httpInjectables + FORM_PROVIDERS, + ROUTER_PROVIDERS, + HTTP_PROVIDERS ] ); diff --git a/src/login/login.ts b/src/login/login.ts index 9bfd200..5f170be 100644 --- a/src/login/login.ts +++ b/src/login/login.ts @@ -1,21 +1,17 @@ -/// - import {Component, View} from 'angular2/angular2'; -import {status, json} from '../utils/fetch' import { Router, RouterLink } from 'angular2/router'; - +import {status, json} from '../utils/fetch' let styles = require('./login.css'); let template = require('./login.html'); - @Component({ selector: 'login' }) @View({ - styles: [ styles ], + directives: [RouterLink], template: template, - directives: [RouterLink] + styles: [ styles ] }) export class Login { constructor(public router: Router) { @@ -37,7 +33,7 @@ export class Login { .then(json) .then((response) => { localStorage.setItem('jwt', response.id_token); - this.router.parent.navigate('/home'); + this.router.parent.navigate(['/home']); }) .catch((error) => { alert(error.message); @@ -47,6 +43,6 @@ export class Login { signup(event) { event.preventDefault(); - this.router.parent.navigate('/signup'); + this.router.parent.navigate(['/signup']); } } diff --git a/src/signup/signup.ts b/src/signup/signup.ts index a4f0f27..6fb66d4 100644 --- a/src/signup/signup.ts +++ b/src/signup/signup.ts @@ -1,7 +1,4 @@ -/// - -import {coreDirectives} from 'angular2/directives'; -import {Component, View} from 'angular2/angular2'; +import {CORE_DIRECTIVES, Component, View} from 'angular2/angular2'; import {status, json} from '../utils/fetch'; import { Router, RouterLink } from 'angular2/router'; @@ -12,9 +9,9 @@ let template = require('./signup.html'); selector: 'signup' }) @View({ - directives: [ RouterLink, coreDirectives ], - styles: [ styles ], - template: template + directives: [ RouterLink, CORE_DIRECTIVES ], + template: template, + styles: [ styles ] }) export class Signup { constructor(public router: Router) { @@ -36,7 +33,7 @@ export class Signup { .then(json) .then((response) => { localStorage.setItem('jwt', response.id_token); - this.router.navigate('/home'); + this.router.navigate(['/home']); }) .catch((error) => { alert(error.message); @@ -46,7 +43,7 @@ export class Signup { login(event) { event.preventDefault(); - this.router.parent.navigate('/login'); + this.router.parent.navigate(['/login']); } } diff --git a/tsconfig.json b/tsconfig.json index bbe0232..c9fa060 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,20 +3,20 @@ "compilerOptions": { "target": "es5", "module": "commonjs", - "declaration": false, + "declaration": true, "noImplicitAny": false, - "removeComments": true, + "removeComments": false, "noLib": false, "emitDecoratorMetadata": true, + "experimentalDecorators": true, "sourceMap": true, "listFiles": true, "outDir": "dist" }, + "exclude": [ + "node_modules" + ], "files": [ - "node_modules/typescript/bin/dom.d.ts", - "src/custom_typings/ng2.d.ts", - "typings/tsd.d.ts", - "src/components/app.ts", - "src/bootstrap.ts" + "src/index.ts" ] } diff --git a/tsd.json b/tsd.json deleted file mode 100644 index f9029ed..0000000 --- a/tsd.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "typings", - "bundle": "typings/tsd.d.ts", - "installed": { - "angular2/angular2.d.ts": { - "commit": "2a5858c16563634453533009242b8e0b18521370" - }, - "rx/rx.d.ts": { - "commit": "8c7444882a2bc2ab87387f8f736a7d97e89b9c90" - }, - "rx/rx-lite.d.ts": { - "commit": "8c7444882a2bc2ab87387f8f736a7d97e89b9c90" - }, - "es6-promise/es6-promise.d.ts": { - "commit": "8c7444882a2bc2ab87387f8f736a7d97e89b9c90" - } - } -} diff --git a/typings/_custom/custom.d.ts b/typings/_custom/custom.d.ts index a1ad680..42be85c 100644 --- a/typings/_custom/custom.d.ts +++ b/typings/_custom/custom.d.ts @@ -1,4 +1,3 @@ /// -/// /// /// diff --git a/typings/_custom/ng2.d.ts b/typings/_custom/ng2.d.ts deleted file mode 100644 index 7a4e30a..0000000 --- a/typings/_custom/ng2.d.ts +++ /dev/null @@ -1,1004 +0,0 @@ -declare var zone: any; -declare var Zone: any; - -declare module "angular2/annotations" { - var Component: any; - var View: any; - var Directive: any; - var Query: any; -} - -declare module "angular2/src/http/backends/browser_xhr" { - class BrowserXhr { - constructor(); - build(): any; - } -} -declare module "angular2/http" { - import {BrowserXhr} from "angular2/src/http/backends/browser_xhr" - class Http { - _backend: any; - _defaultOptions: any; - constructor(_backend?: any, _defaultOptions?: any); - request(url: string, options?: any): any; - get(url: string, options?: any): any; - post(url: string, body: any, options?: any): any; - put(url: string, body: any, options?: any): any; - delete(url: string, options?: any): any; - patch(url: string, body: any, options?: any): any; - head(url: string, options?: any): any; - } - class HttpFactory {} - class ResponseOptions {} - class XHRBackend { - private _browserXHR: BrowserXhr; - private _baseResponseOptions: ResponseOptions; - constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions) - createConnection(request: any): any; - } - class ConnectionBackend { - constructor(req: any, browserXHR: any, baseResponseOptions?: any) - } - class RequestOptions {} - class BaseRequestOptions {} - class BaseResponseOptions {} - class MockBackend { - constructor(browserXHR: any, baseResponseOptions: any) - } - var httpInjectables: Array; -} - - -declare module "angular2/mock" { -} - -declare module "angular2/src/core/life_cycle/life_cycle" { - class LifeCycle { - constructor(...args) - tick(): any; - } -} - -declare module "angular2/src/render/dom/compiler/view_loader" { - class ViewLoader {} -} - -declare module "angular2/src/render/dom/compiler/style_url_resolver" { - class StyleUrlResolver {} -} - -declare module "angular2/src/render/dom/compiler/style_inliner" { - class StyleInliner {} -} - -declare module "angular2/src/core/compiler/view_resolver" { - class ViewResolver { - resolve(appComponent: any): any - } -} - -declare module "angular2/src/services/app_root_url" { - class AppRootUrl {} -} - -declare module "angular2/src/core/compiler/view_listener" { - class AppViewListener {} -} - -declare module "angular2/src/render/dom/compiler/template_loader" { - class TemplateLoader { - - } -} - -declare module "angular2/src/core/compiler/template_resolver" { - class TemplateResolver { - - } -} - -declare module "angular2/src/render/xhr_impl" { - class XHRImpl {} -} - -declare module "angular2/src/services/xhr_impl" { - class XHRImpl { - - } -} - -declare module "angular2/src/render/dom/events/key_events" { - class KeyEventsPlugin { - static getEventFullKey: any - getEventFullKey: any - } -} -declare module "angular2/src/render/dom/events/hammer_gestures" { - class HammerGesturesPlugin { - - } -} -declare module "angular2/src/core/compiler/component_url_mapper" { - class ComponentUrlMapper { - - } -} -declare module "angular2/src/services/url_resolver" { - class UrlResolver { - - } - -} -declare module "angular2/src/render/dom/shadow_dom/style_inliner" { - class StyleInliner{} - -} -declare module "angular2/src/core/compiler/dynamic_component_loader" { - class ComponentRef { - constructor(newLocation: any, component: any, dispose: any) - location: any - instance: any - dispose: any - } - class DynamicComponentLoader { - loadAsRoot(appComponentType: any, bindings: any, injector: any): any - } -} -declare module "angular2/src/core/testability/testability" { - class TestabilityRegistry { - - } - class Testability { - - } -} -declare module "angular2/src/core/compiler/view_pool" { - class AppViewPool { - - } - var APP_VIEW_POOL_CAPACITY: any -} -declare module "angular2/src/core/compiler/view_manager" { - class AppViewManager { - - } - -} -declare module "angular2/src/core/compiler/view_manager_utils" { - class AppViewManagerUtils { - - } -} -declare module "angular2/src/core/compiler/proto_view_factory" { - class ProtoViewFactory { - - } -} -declare module "angular2/src/render/dom/compiler/compiler" { - class DefaultDomCompiler { - - } -} -declare module "angular2/src/core/compiler/view_ref" { - var internalView:any -} - -declare module "angular2/src/reflection/reflection" { - var reflector:any - class Reflector { - - } -} -declare module "angular2/src/reflection/reflection_capabilities" { - class ReflectionCapabilities { - - } -} - -declare module "angular2/src/render/dom/view/proto_view" { - class DomProtoView { - rootBindingOffset: any; - element: any; - isTemplateElement(): any - elementBinders(): any - } - -} - -declare module "angular2/src/render/dom/view/view_container" { - class DomViewContainer{} -} - -declare module "angular2/src/render/dom/util" { - var NG_BINDING_CLASS_SELECTOR: any; - var NG_BINDING_CLASS: any ; -} - - -declare module "angular2/src/render/dom/dom_renderer" { - class DomRenderer { - _moveViewNodesIntoParent(): any - _createGlobalEventListener(): any - _createEventListener(): any - } - var DOCUMENT_TOKEN: any; -} - -declare module "angular2/src/render/api" { - class RenderCompiler { - - } - class Renderer { - - } - class RenderViewRef { - - } - class RenderProtoViewRef { - - } - -} -declare module "angular2/src/render/dom/shadow_dom/content_tag" { - function Content(element: any, contentTagSelector:any): void; -} -declare module "angular2/src/render/dom/view/view" { - class DomViewRef { - - } - class DomView { - viewContainers(): any - } - function resolveInternalDomView(viewRef: any): any; -} -declare module "angular2/src/render/dom/shadow_dom/shadow_dom_strategy" { - class ShadowDomStrategy { - prepareShadowRoot(element: any): any - constructLightDom(lightDomView: any, el: any): any - } -} - -declare module "angular2/src/render/dom/events/event_manager" { - class EventManager { - constructor(...args) - addEventListener(element: any, eventName: string, handler: Function): any - addGlobalEventListener(target: string, eventName: string, handler: Function): any - } - class DomEventsPlugin { - - } -} - -declare module "zone.js" { - var zone: any; - var Zone: any; -} - -declare module "rtts_assert/rtts_assert" { - var assert: any; -} - -declare module "angular2/directives" { - function NgSwitch(): void; - function NgSwitchWhen(): void; - function NgSwitchDefault(): void; - function NgNonBindable(): void; - function NgIf(): void; - function NgFor(): void; - - var formDirectives: any; - var coreDirectives: any; - -} - -declare module "angular2/src/change_detection/pipes/pipe" { - class PipeFactory { - } -} - -declare module "angular2/src/change_detection/change_detection" { - var async: any; -} - -declare module "angular2/pipes" { - class ObservablePipe { - constructor(ref: any) - _subscription: any; - _observable: any; - _updateLatestValue(value: any): any; - _subscribe(obs: any): any; - } -} - -declare module "angular2/change_detection" { - interface PipeFactory {} - class Pipe {} - class NullPipeFactory {} - class PipeRegistry { - constructor(pipes: any) - } - var defaultPipeRegistry: any; - var defaultPipes: any; - class Parser { - - } - class Lexer { - - } - class ChangeDetection { - - } - class DynamicChangeDetection { - - } - class PreGeneratedChangeDetection { - static isSupported(): boolean; - } - class JitChangeDetection { - static isSupported(): boolean; - } -} - -declare module "angular2/src/core/zone/ng_zone" { - class NgZone { - constructor(config: any) - initCallbacks(config: any): any - run(context: any): any - } -} - - -declare module "angular2/src/core/compiler/element_ref" { - class ElementRef { - constructor(host: any, location?: any) - nativeElement: any; - } -} - -declare module "angular2/src/core/exception_handler" { - class ExceptionHandler { - - } -} - -declare module "angular2/src/render/xhr" { - class XHR { - - } -} - -declare module "angular2/src/core/application_tokens" { - var appComponentRefToken: any; - var appComponentTypeToken: any; -} - -declare module "angular2/src/core/compiler/compiler" { - class Compiler { - - } - class CompilerCache { - - } -} - -declare module "angular2/forms" { - var formDirectives: any; - var formInjectables: any; - class FormBuilder { - group(config: any): any - array(): any - } - class Validators { - static required(): any - } - class ControlGroup { - value: any - controls: any - include(): any - exclude(): any - } - class Control { - valueChanges(): any - } - class ControlArray { - push(): any - removeAt(): any - } - - class NgControlName { - - } - class NgControlGroup { - - } - class NgFormControl { - - } - class NgModel { - - } - class NgFormModel { - - } - class NgForm { - - } - class NgSelectOption { - - } - class NgRequiredValidator { - - } - class NgControl { - control: any; - valueAccessor: any; - } - -} - -declare module "angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy" { - class EmulatedUnscopedShadowDomStrategy { - styleHost: any; - constructor(styleHost: any); - hasNativeContentElement(): boolean; - prepareShadowRoot(el: any): any; - constructLightDom(lightDomView: any, el: any): any; - processStyleElement(hostComponentId: string, templateUrl: string, styleEl: any): void; - - } -} - -declare module "angular2/core" { - class ElementRef { - constructor(host: any, location?: any) - nativeElement: any; - } - class QueryList { - onChange(callback: any): void; - } - class DirectiveResolver { - resolve(appComponent: any): any - } -} - -declare module "angular2/render" { - class ShadowDomStrategy { - hasNativeContentElement(): boolean; - prepareShadowRoot(el: any): any; - constructLightDom(lightDomView: any, el: any): any; - processStyleElement(hostComponentId: string, templateUrl: string, styleElement: any): void; - processElement(hostComponentId: string, elementComponentId: string, element: any): void; - } - class NativeShadowDomStrategy extends ShadowDomStrategy { - prepareShadowRoot(el: any): any; - } - class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy { - styleHost: any; - constructor(styleHost: any); - hasNativeContentElement(): boolean; - prepareShadowRoot(el: any): any; - constructLightDom(lightDomView: any, el: any): any; - processStyleElement(hostComponentId: string, templateUrl: string, styleEl: any): void; - - } - class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy { - constructor(styleHost: any); - processStyleElement(hostComponentId: string, templateUrl: string, styleEl: any): void; - _moveToStyleHost(styleEl: any): void; - processElement(hostComponentId: string, elementComponentId: string, element: any): void; - - } - class Renderer { -/** - * Creates a root host view that includes the given element. - * @param {RenderProtoViewRef} hostProtoViewRef a RenderProtoViewRef of type - * ProtoViewDto.HOST_VIEW_TYPE - * @param {any} hostElementSelector css selector for the host element (will be queried against the - * main document) - * @return {RenderViewRef} the created view - */ - createRootHostView(hostProtoViewRef: any, hostElementSelector: string): any; - /** - * Creates a regular view out of the given ProtoView - */ - createView(protoViewRef: any): any; - /** - * Destroys the given view after it has been dehydrated and detached - */ - destroyView(viewRef: any): void; - /** - * Attaches a componentView into the given hostView at the given element - */ - attachComponentView(location: any, componentViewRef: any): void; - /** - * Detaches a componentView into the given hostView at the given element - */ - detachComponentView(location: any, componentViewRef: any): void; - /** - * Attaches a view into a ViewContainer (in the given parentView at the given element) at the - * given index. - */ - attachViewInContainer(location: any, atIndex: number, viewRef: any): void; - /** - * Detaches a view into a ViewContainer (in the given parentView at the given element) at the - * given index. - */ - detachViewInContainer(location: any, atIndex: number, viewRef: any): void; - /** - * Hydrates a view after it has been attached. Hydration/dehydration is used for reusing views - * inside of the view pool. - */ - hydrateView(viewRef: any): void; - /** - * Dehydrates a view after it has been attached. Hydration/dehydration is used for reusing views - * inside of the view pool. - */ - dehydrateView(viewRef: any): void; - /** - * Returns the native element at the given location. - * Attention: In a WebWorker scenario, this should always return null! - */ - getNativeElementSync(location: any): any; - /** - * Sets a property on an element. - */ - setElementProperty(location: any, propertyName: string, propertyValue: any): void; - /** - * Sets an attribute on an element. - */ - setElementAttribute(location: any, attributeName: string, attributeValue: string): void; - /** - * Sets a class on an element. - */ - setElementClass(location: any, className: string, isAdd: boolean): void; - /** - * Sets a style on an element. - */ - setElementStyle(location: any, styleName: string, styleValue: string): void; - /** - * Calls a method on an element. - */ - invokeElementMethod(location: any, methodName: string, args: List): void; - /** - * Sets the value of a text node. - */ - setText(viewRef: any, textNodeIndex: number, text: string): void; - /** - * Sets the dispatcher for all events of the given view - */ - setEventDispatcher(viewRef: any, dispatcher: any): void; - } -} - -declare module "angular2/src/render/dom/shadow_dom/style_url_resolver" { - class StyleUrlResolver { - - } -} - -declare module "angular2/src/facade/async" { - class ObservableWrapper { - static callNext(next:any): any; - static subscribe(observer:any): any; - } - class Promise { - then(pro:any): any; - all(all:any): any; - } - class PromiseWrapper { - static completer(): any; - static all(all: any): any; - static then(pro:any, sucess?: any, failure?: any): any; - static wrap(pro:any): any; - } -} - -declare module "angular2/src/facade/collection" { - var List: Array; - var Map: any; - var ListWrapper: any; - var MapWrapper: any; - var StringMapWrapper: any; -} - -declare module "angular2/src/facade/browser" { - var __esModule: boolean; - var win: any; - var window: any; - var document: any; - var location: any; - var gc: () => void; - var Event: any; - var MouseEvent: any; - var KeyboardEvent: any; -} - -declare module "angular2/src/facade/lang" { - var int: any; - var Type: Function; - var assertionsEnabled: any; - function isPresent(bool: any): boolean; - function isBlank(bool: any): boolean; - function isString(bool: any): boolean; - class BaseException { - - } - class RegExpWrapper { - - } - class NumberWrapper { - - } - class StringWrapper { - static toLowerCase(str: string): string; - static toUpperCase(str: string): string; - } - function print(str: any):any; - function stringify(str: any):any; -} - -declare module "angular2/src/core/compiler/directive_resolver" { - class DirectiveResolver { - resolve(appComponent: any): any - } -} - -declare module "angular2/router" { - class Instruction { - - } - class Router { - lastNavigationAttempt: string; - navigate(url: string): any; - config(config: any): any; - deactivate(): any; - activate(instruction: Instruction): any; - recognize(url: string): Instruction; - recognize(url: string): Instruction; - renavigate(): any; - generate(name:string, params:any): string; - subscribe(onNext: Function): void; - parent: any - } - class LocationStrategy {} - class HashLocationStrategy {} - class HTML5LocationStrategy {} - class RouterOutlet { - _elementRef: any; - _loader: any; - _parentRouter: any; - constructor(_elementRef: any, _loader: any, _parentRouter: any, nameAttr?: string) - activate(instruction: any): any - } - class Location { - path(): string; - go(url: string): void; - forward(): void; - back(): void - subscribe(onNext: any, onThrow?: any, onReturn?: any): void; - } - var RouterLink: any; - var RouteParams: any; - var routerInjectables: any; - var RouteConfigAnnotation: any; - var RouteConfig: any; - var routerDirectives: any; -} - - -declare module "angular2/src/dom/browser_adapter" { - class BrowserDomAdapter { - static makeCurrent(): void; - logError(error: any): void; - attrToPropMap: any; - query(selector: string): any; - querySelector(el: any, selector: string): Node; - querySelectorAll(el: any, selector: string): List; - on(el: any, evt: any, listener: any): void; - onAndCancel(el: any, evt: any, listener: any): Function; - dispatchEvent(el: any, evt: any): void; - createMouseEvent(eventType: string): MouseEvent; - createEvent(eventType: any): Event; - getInnerHTML(el: any): any; - getOuterHTML(el: any): any; - nodeName(node: Node): string; - nodeValue(node: Node): string; - type(node: HTMLInputElement): string; - content(node: Node): Node; - firstChild(el: any): Node; - nextSibling(el: any): Node; - parentElement(el: any): any; - childNodes(el: any): List; - childNodesAsList(el: any): List; - clearNodes(el: any): void; - appendChild(el: any, node: any): void; - removeChild(el: any, node: any): void; - replaceChild(el: Node, newChild: any, oldChild: any): void; - remove(el: any): any; - insertBefore(el: any, node: any): void; - insertAllBefore(el: any, nodes: any): void; - insertAfter(el: any, node: any): void; - setInnerHTML(el: any, value: any): void; - getText(el: any): any; - setText(el: any, value: string): void; - getValue(el: any): any; - setValue(el: any, value: string): void; - getChecked(el: any): any; - setChecked(el: any, value: boolean): void; - createTemplate(html: any): HTMLElement; - createElement(tagName: any, doc?: Document): HTMLElement; - createTextNode(text: string, doc?: Document): Text; - createScriptTag(attrName: string, attrValue: string, doc?: Document): HTMLScriptElement; - createStyleElement(css: string, doc?: Document): HTMLStyleElement; - createShadowRoot(el: HTMLElement): DocumentFragment; - getShadowRoot(el: HTMLElement): DocumentFragment; - getHost(el: HTMLElement): HTMLElement; - clone(node: Node): Node; - hasProperty(element: any, name: string): boolean; - getElementsByClassName(element: any, name: string): any; - getElementsByTagName(element: any, name: string): any; - classList(element: any): List; - addClass(element: any, classname: string): void; - removeClass(element: any, classname: string): void; - hasClass(element: any, classname: string): any; - setStyle(element: any, stylename: string, stylevalue: string): void; - removeStyle(element: any, stylename: string): void; - getStyle(element: any, stylename: string): any; - tagName(element: any): string; - attributeMap(element: any): any; - hasAttribute(element: any, attribute: string): any; - getAttribute(element: any, attribute: string): any; - setAttribute(element: any, name: string, value: string): void; - removeAttribute(element: any, attribute: string): any; - templateAwareRoot(el: any): any; - createHtmlDocument(): Document; - defaultDoc(): Document; - getBoundingClientRect(el: any): any; - getTitle(): string; - setTitle(newTitle: string): void; - elementMatches(n: any, selector: string): boolean; - isTemplateElement(el: any): boolean; - isTextNode(node: Node): boolean; - isCommentNode(node: Node): boolean; - isElementNode(node: Node): boolean; - hasShadowRoot(node: any): boolean; - isShadowRoot(node: any): boolean; - importIntoDoc(node: Node): Node; - isPageRule(rule: any): boolean; - isStyleRule(rule: any): boolean; - isMediaRule(rule: any): boolean; - isKeyframesRule(rule: any): boolean; - getHref(el: Element): string; - getEventKey(event: any): string; - getGlobalEventTarget(target: string): EventTarget; - getHistory(): History; - getLocation(): Location; - getBaseHref(): any; - } -} - -declare module "angular2/src/dom/dom_adapter" { - class DomAdapter { - static makeCurrent(): void; - logError(error: any): void; - attrToPropMap: any; - query(selector: string): any; - querySelector(el: any, selector: string): Node; - querySelectorAll(el: any, selector: string): List; - on(el: any, evt: any, listener: any): void; - onAndCancel(el: any, evt: any, listener: any): Function; - dispatchEvent(el: any, evt: any): void; - createMouseEvent(eventType: string): MouseEvent; - createEvent(eventType: any): Event; - getInnerHTML(el: any): any; - getOuterHTML(el: any): any; - nodeName(node: Node): string; - nodeValue(node: Node): string; - type(node: HTMLInputElement): string; - content(node: Node): Node; - firstChild(el: any): Node; - nextSibling(el: any): Node; - parentElement(el: any): any; - childNodes(el: any): List; - childNodesAsList(el: any): List; - clearNodes(el: any): void; - appendChild(el: any, node: any): void; - removeChild(el: any, node: any): void; - replaceChild(el: Node, newChild: any, oldChild: any): void; - remove(el: any): any; - insertBefore(el: any, node: any): void; - insertAllBefore(el: any, nodes: any): void; - insertAfter(el: any, node: any): void; - setInnerHTML(el: any, value: any): void; - getText(el: any): any; - setText(el: any, value: string): void; - getValue(el: any): any; - setValue(el: any, value: string): void; - getChecked(el: any): any; - setChecked(el: any, value: boolean): void; - createTemplate(html: any): HTMLElement; - createElement(tagName: any, doc?: Document): HTMLElement; - createTextNode(text: string, doc?: Document): Text; - createScriptTag(attrName: string, attrValue: string, doc?: Document): HTMLScriptElement; - createStyleElement(css: string, doc?: Document): HTMLStyleElement; - createShadowRoot(el: HTMLElement): DocumentFragment; - getShadowRoot(el: HTMLElement): DocumentFragment; - getHost(el: HTMLElement): HTMLElement; - clone(node: Node): Node; - hasProperty(element: any, name: string): boolean; - getElementsByClassName(element: any, name: string): any; - getElementsByTagName(element: any, name: string): any; - classList(element: any): List; - addClass(element: any, classname: string): void; - removeClass(element: any, classname: string): void; - hasClass(element: any, classname: string): any; - setStyle(element: any, stylename: string, stylevalue: string): void; - removeStyle(element: any, stylename: string): void; - getStyle(element: any, stylename: string): any; - tagName(element: any): string; - attributeMap(element: any): any; - hasAttribute(element: any, attribute: string): any; - getAttribute(element: any, attribute: string): any; - setAttribute(element: any, name: string, value: string): void; - removeAttribute(element: any, attribute: string): any; - templateAwareRoot(el: any): any; - createHtmlDocument(): Document; - defaultDoc(): Document; - getBoundingClientRect(el: any): any; - getTitle(): string; - setTitle(newTitle: string): void; - elementMatches(n: any, selector: string): boolean; - isTemplateElement(el: any): boolean; - isTextNode(node: Node): boolean; - isCommentNode(node: Node): boolean; - isElementNode(node: Node): boolean; - hasShadowRoot(node: any): boolean; - isShadowRoot(node: any): boolean; - importIntoDoc(node: Node): Node; - isPageRule(rule: any): boolean; - isStyleRule(rule: any): boolean; - isMediaRule(rule: any): boolean; - isKeyframesRule(rule: any): boolean; - getHref(el: Element): string; - getEventKey(event: any): string; - getGlobalEventTarget(target: string): EventTarget; - getHistory(): History; - getLocation(): Location; - getBaseHref(): any; - } - var DOM: DomAdapter; -} -declare module "angular2/src/dom/parse5_adapter" { - class Parse5DomAdapter { - static makeCurrent(): void; - logError(error: any): void; - attrToPropMap: any; - query(selector: string): any; - querySelector(el: any, selector: string): Node; - querySelectorAll(el: any, selector: string): List; - on(el: any, evt: any, listener: any): void; - onAndCancel(el: any, evt: any, listener: any): Function; - dispatchEvent(el: any, evt: any): void; - createMouseEvent(eventType: string): MouseEvent; - createEvent(eventType: any): Event; - getInnerHTML(el: any): any; - getOuterHTML(el: any): any; - nodeName(node: Node): string; - nodeValue(node: Node): string; - type(node: HTMLInputElement): string; - content(node: Node): Node; - firstChild(el: any): Node; - nextSibling(el: any): Node; - parentElement(el: any): any; - childNodes(el: any): List; - childNodesAsList(el: any): List; - clearNodes(el: any): void; - appendChild(el: any, node: any): void; - removeChild(el: any, node: any): void; - replaceChild(el: Node, newChild: any, oldChild: any): void; - remove(el: any): any; - insertBefore(el: any, node: any): void; - insertAllBefore(el: any, nodes: any): void; - insertAfter(el: any, node: any): void; - setInnerHTML(el: any, value: any): void; - getText(el: any): any; - setText(el: any, value: string): void; - getValue(el: any): any; - setValue(el: any, value: string): void; - getChecked(el: any): any; - setChecked(el: any, value: boolean): void; - createTemplate(html: any): HTMLElement; - createElement(tagName: any, doc?: Document): HTMLElement; - createTextNode(text: string, doc?: Document): Text; - createScriptTag(attrName: string, attrValue: string, doc?: Document): HTMLScriptElement; - createStyleElement(css: string, doc?: Document): HTMLStyleElement; - createShadowRoot(el: HTMLElement): DocumentFragment; - getShadowRoot(el: HTMLElement): DocumentFragment; - getHost(el: HTMLElement): HTMLElement; - clone(node: Node): Node; - hasProperty(element: any, name: string): boolean; - getElementsByClassName(element: any, name: string): any; - getElementsByTagName(element: any, name: string): any; - classList(element: any): List; - addClass(element: any, classname: string): void; - removeClass(element: any, classname: string): void; - hasClass(element: any, classname: string): any; - setStyle(element: any, stylename: string, stylevalue: string): void; - removeStyle(element: any, stylename: string): void; - getStyle(element: any, stylename: string): any; - tagName(element: any): string; - attributeMap(element: any): any; - hasAttribute(element: any, attribute: string): any; - getAttribute(element: any, attribute: string): any; - setAttribute(element: any, name: string, value: string): void; - removeAttribute(element: any, attribute: string): any; - templateAwareRoot(el: any): any; - createHtmlDocument(): Document; - defaultDoc(): Document; - getBoundingClientRect(el: any): any; - getTitle(): string; - setTitle(newTitle: string): void; - elementMatches(n: any, selector: string): boolean; - isTemplateElement(el: any): boolean; - isTextNode(node: Node): boolean; - isCommentNode(node: Node): boolean; - isElementNode(node: Node): boolean; - hasShadowRoot(node: any): boolean; - isShadowRoot(node: any): boolean; - importIntoDoc(node: Node): Node; - isPageRule(rule: any): boolean; - isStyleRule(rule: any): boolean; - isMediaRule(rule: any): boolean; - isKeyframesRule(rule: any): boolean; - getHref(el: Element): string; - getEventKey(event: any): string; - getGlobalEventTarget(target: string): EventTarget; - getHistory(): History; - getLocation(): Location; - getBaseHref(): any; - } -} - - - -declare module "angular2/src/di/binding" { - class Binding { - - } -} - -declare module "angular2/di" { - class Binding {} - function bind(token: any): any; - class Injector { - resolveAndCreateChild(bindings: [any]): Injector; - static resolveAndCreate(bindings: any): any; - static fromResolvedBindings(bindings: any): any; - asyncGet(di: any):any - get(di: any):any - } - var Inject: any; - var Injectable: any; - var Dependency: any; - var Optional: any; - - var ResolvedBinding: any; - var Key: any; - var KeyRegistry: any; - var TypeLiteral: any; - var NoBindingError: any; - var AbstractBindingError: any; - var AsyncBindingError: any; - var CyclicDependencyError: any; - var InstantiationError: any; - var InvalidBindingError: any; - var NoAnnotationError: any; - var OpaqueToken: any; - var ___esModule: any; - var InjectAnnotation: any; - var InjectPromiseAnnotation: any; - var InjectLazyAnnotation: any; - var OptionalAnnotation: any; - var InjectableAnnotation: any; - var DependencyAnnotation: any; -} diff --git a/typings/angular2/angular2.d.ts b/typings/angular2/angular2.d.ts deleted file mode 100644 index a4af962..0000000 --- a/typings/angular2/angular2.d.ts +++ /dev/null @@ -1,4625 +0,0 @@ -// Type definitions for Angular v2.0.0-alpha.26 -// Project: http://angular.io/ -// Definitions by: angular team -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -// *********************************************************** -// This file is generated by the Angular build process. -// Please do not create manual edits or send pull requests -// modifying this file. -// *********************************************************** - -// Angular depends transitively on these libraries. -// If you don't have them installed you can run -// $ tsd query es6-promise rx rx-lite --action install --save -/// -/// - -interface List extends Array {} -interface Map {} -interface StringMap {} -interface Type {} - -declare module "angular2/angular2" { - type SetterFn = typeof Function; - type int = number; - - // See https://github.com/Microsoft/TypeScript/issues/1168 - class BaseException /* extends Error */ { - message: any; - stack: any; - toString(): string; - } -} - - -declare module "angular2/angular2" { - class AbstractChangeDetector extends ChangeDetector { - addChild(cd: ChangeDetector): any; - addShadowDomChild(cd: ChangeDetector): any; - callOnAllChangesDone(): any; - checkNoChanges(): any; - detectChanges(): any; - detectChangesInRecords(throwOnChange: boolean): any; - lightDomChildren: List; - markAsCheckOnce(): any; - markPathToRootAsCheckOnce(): any; - mode: string; - parent: ChangeDetector; - ref: ChangeDetectorRef; - remove(): any; - removeChild(cd: ChangeDetector): any; - removeShadowDomChild(cd: ChangeDetector): any; - shadowDomChildren: List; - } - - class ProtoRecord { - args: List; - bindingRecord: BindingRecord; - contextIndex: number; - directiveIndex: DirectiveIndex; - expressionAsString: string; - fixedArgs: List; - funcOrValue: any; - isLifeCycleRecord(): boolean; - isPipeRecord(): boolean; - isPureFunction(): boolean; - lastInBinding: boolean; - lastInDirective: boolean; - mode: number; - name: string; - selfIndex: number; - } - - class LifecycleEvent { - name: string; - } - - interface FormDirective { - addControl(dir: ControlDirective): void; - addControlGroup(dir: ControlGroupDirective): void; - getControl(dir: ControlDirective): Control; - removeControl(dir: ControlDirective): void; - removeControlGroup(dir: ControlGroupDirective): void; - updateModel(dir: ControlDirective, value: any): void; - } - - - /** - * A directive that contains a group of [ControlDirective]. - * - * @exportedAs angular2/forms - */ - class ControlContainerDirective { - formDirective: FormDirective; - name: string; - path: List; - } - - - /** - * A marker annotation that marks a class as available to `Injector` for creation. Used by tooling - * for generating constructor stubs. - * - * ``` - * class NeedsService { - * constructor(svc:UsefulService) {} - * } - * - * @Injectable - * class UsefulService {} - * ``` - * @exportedAs angular2/di_annotations - */ - class Injectable { - } - - - /** - * Injectable Objects that contains a live list of child directives in the light Dom of a directive. - * The directives are kept in depth-first pre-order traversal of the DOM. - * - * In the future this class will implement an Observable interface. - * For now it uses a plain list of observable callbacks. - * - * @exportedAs angular2/view - */ - class BaseQueryList { - add(obj: any): any; - fireCallbacks(): any; - onChange(callback: any): any; - removeCallback(callback: any): any; - reset(newList: any): any; - } - - class AppProtoView { - bindElement(parent: ElementBinder, distanceToParent: int, protoElementInjector: ProtoElementInjector, componentDirective?: DirectiveBinding): ElementBinder; - - /** - * Adds an event binding for the last created ElementBinder via bindElement. - * - * If the directive index is a positive integer, the event is evaluated in the context of - * the given directive. - * - * If the directive index is -1, the event is evaluated in the context of the enclosing view. - * - * @param {string} eventName - * @param {AST} expression - * @param {int} directiveIndex The directive index in the binder or -1 when the event is not bound - * to a directive - */ - bindEvent(eventBindings: List, boundElementIndex: number, directiveIndex?: int): void; - elementBinders: List; - protoChangeDetector: ProtoChangeDetector; - protoLocals: Map; - render: RenderProtoViewRef; - variableBindings: Map; - } - - - /** - * Const of making objects: http://jsperf.com/instantiate-size-of-object - */ - class AppView implements ChangeDispatcher, EventDispatcher { - callAction(elementIndex: number, actionExpression: string, action: Object): any; - changeDetector: ChangeDetector; - componentChildViews: List; - - /** - * The context against which data-binding expressions in this view are evaluated against. - * This is always a component instance. - */ - context: any; - dispatchEvent(elementIndex: number, eventName: string, locals: Map): boolean; - elementInjectors: List; - freeHostViews: List; - getDetectorFor(directive: DirectiveIndex): any; - getDirectiveFor(directive: DirectiveIndex): any; - hydrated(): boolean; - init(changeDetector: ChangeDetector, elementInjectors: List, rootElementInjectors: List, preBuiltObjects: List, componentChildViews: List): any; - - /** - * Variables, local to this view, that can be used in binding expressions (in addition to the - * context). This is used for thing like `