From b4dc28d96f103a878d570b7ea023de728ec40b0d Mon Sep 17 00:00:00 2001 From: gdi2290 Date: Tue, 7 Jul 2015 03:16:50 -0700 Subject: [PATCH] chore: update to alpha 29 --- package.json | 11 +- src/app/LoggedInOutlet.ts | 16 +- src/app/app.html | 3 +- src/app/app.ts | 36 +- src/common/formInjectables.ts | 6 - src/home/home.ts | 9 +- src/index.ts | 9 +- src/login/login.ts | 3 +- src/signup/signup.ts | 11 +- typings/_custom/ng2.d.ts | 887 ++++++++++++++++++++++++++++++---- 10 files changed, 835 insertions(+), 156 deletions(-) delete mode 100644 src/common/formInjectables.ts diff --git a/package.json b/package.json index adc7239..0d197e7 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "angular2-full-app-demo", + "name": "angular2-authentication-sample", "version": "0.0.0", "description": "This is a sample that shows how to add authentication to an Angular 2 (ng2) app", "main": "", @@ -11,17 +11,20 @@ "type": "git", "url": "https://github.com/auth0/angular2-authentication-sample.git" }, - "author": "Martin Gontovnikas (http://gon.to) ", + "contributors": [ + "Martin Gontovnikas (http://gon.to) ", + "PatrickJS " + ], "license": "MIT", "bugs": { "url": "https://github.com/auth0/angular2-authentication-sample/issues" }, "homepage": "https://github.com/auth0/angular2-authentication-sample", "dependencies": { - "angular2": "2.0.0-alpha.26", + "angular2": "2.0.0-alpha.29", "raw-loader": "^0.5.1", "reflect-metadata": "^0.1.0", - "rtts_assert": "2.0.0-alpha.26", + "rtts_assert": "2.0.0-alpha.29", "rx": "^2.5.3", "zone.js": "^0.5.0", "bootstrap": "~3.3.4", diff --git a/src/app/LoggedInOutlet.ts b/src/app/LoggedInOutlet.ts index bfae6b2..590a326 100644 --- a/src/app/LoggedInOutlet.ts +++ b/src/app/LoggedInOutlet.ts @@ -3,22 +3,20 @@ import {Router, RouterOutlet} from 'angular2/router'; import {Injector} from 'angular2/di'; import {Login} from '../login/login'; -@Directive({selector: 'router-outlet'}) +@Directive({ + selector: 'router-outlet' +}) export class LoggedInRouterOutlet extends RouterOutlet { publicRoutes: any - constructor( - elementRef: ElementRef, - _loader: DynamicComponentLoader, - _parentRouter: Router, - _injector: Injector, - @Attribute('name') nameAttr: string) { + constructor(public _elementRef: ElementRef, public _loader: DynamicComponentLoader, + public _parentRouter: Router, @Attribute('name') nameAttr: string) { + super(_elementRef, _loader, _parentRouter, nameAttr); this.publicRoutes = { '/login': true, '/signup': true }; - super(elementRef, _loader, _parentRouter, _injector, nameAttr); } activate(instruction) { @@ -26,6 +24,6 @@ export class LoggedInRouterOutlet extends RouterOutlet { if (!this.publicRoutes[url] && !localStorage.getItem('jwt')) { instruction.component = Login; } - super.activate(instruction); + return super.activate(instruction); } } diff --git a/src/app/app.html b/src/app/app.html index aedcdf3..0680b43 100644 --- a/src/app/app.html +++ b/src/app/app.html @@ -1,2 +1 @@ - - + diff --git a/src/app/app.ts b/src/app/app.ts index df81abf..f28ea01 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,12 +1,11 @@ /// 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'; import {Signup} from '../signup/signup'; -import {RouteConfig, RouterOutlet, RouterLink, Router} from 'angular2/router'; -import {BrowserLocation} from 'angular2/src/router/browser_location'; -import {LoggedInRouterOutlet} from './LoggedInOutlet'; let template = require('./app.html'); @@ -15,33 +14,16 @@ let template = require('./app.html'); selector: 'auth-app' }) @View({ - template:`${template}`, - directives: [LoggedInRouterOutlet] + template: template, + directives: [ LoggedInRouterOutlet ] }) @RouteConfig([ - { path: '/home', as: 'home', component: Home }, - { path: '/login', as: 'login', component: Login }, - { path: '/signup', as: 'signup', component: Signup } + { path: '/', redirectTo: '/home' }, + { path: '/home', as: 'home', component: Home }, + { path: '/login', as: 'login', component: Login }, + { path: '/signup', as: 'signup', component: Signup } ]) export class App { - router: Router; - constructor(router: Router, browserLocation: BrowserLocation) { - // we need to manually go to the correct uri until the router is fixed - this.router = router; - let uri = browserLocation.path(); - if (uri === '' || uri === '/') { - router.navigate('/home'); - } else { - router.navigate(uri); - } - } - - goTo(event, url) { - event.preventDefault(); - this.router.navigate(url).then(() => { - console.log("Router successfully to", url); - }, () => { - console.log("Error going to URL", url); - }); + constructor(public router: Router) { } } diff --git a/src/common/formInjectables.ts b/src/common/formInjectables.ts deleted file mode 100644 index d996d92..0000000 --- a/src/common/formInjectables.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -import {FormBuilder} from 'angular2/forms'; - -export var formInjectables: Array = [ - FormBuilder -]; diff --git a/src/home/home.ts b/src/home/home.ts index 41c11d9..a10ffea 100644 --- a/src/home/home.ts +++ b/src/home/home.ts @@ -13,18 +13,17 @@ let template = require('./home.html'); selector: 'home' }) @View({ - template:`\n${template}`, - directives: [coreDirectives] + styles: [ styles ], + template: template, + directives: [ coreDirectives ] }) export class Home { jwt: string; decodedJwt: string; - router: Router; response: string; api: string; - constructor(router: Router) { - this.router = router; + constructor(public router: Router) { this.jwt = localStorage.getItem('jwt'); this.decodedJwt = this.jwt && window.jwt_decode(this.jwt); } diff --git a/src/index.ts b/src/index.ts index f9fc1eb..fc05dba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ /// -import {routerInjectables} from 'angular2/router'; -import {formInjectables} from './common/formInjectables'; import { bootstrap } from 'angular2/angular2'; import { bind } from 'angular2/di'; -import { PipeRegistry } from 'angular2/change_detection'; +import { routerInjectables } from 'angular2/router'; +import { formInjectables } from 'angular2/forms'; +import { httpInjectables } from 'angular2/http'; import { App } from './app/app'; @@ -12,6 +12,7 @@ bootstrap( App, [ formInjectables, - routerInjectables + routerInjectables, + httpInjectables ] ); diff --git a/src/login/login.ts b/src/login/login.ts index 380f20d..9bfd200 100644 --- a/src/login/login.ts +++ b/src/login/login.ts @@ -13,7 +13,8 @@ let template = require('./login.html'); selector: 'login' }) @View({ - template:`\n${template}`, + styles: [ styles ], + template: template, directives: [RouterLink] }) export class Login { diff --git a/src/signup/signup.ts b/src/signup/signup.ts index b29a48e..a4f0f27 100644 --- a/src/signup/signup.ts +++ b/src/signup/signup.ts @@ -12,15 +12,12 @@ let template = require('./signup.html'); selector: 'signup' }) @View({ - directives: [RouterLink, coreDirectives], - template:`\n${template}` - + directives: [ RouterLink, coreDirectives ], + styles: [ styles ], + template: template }) export class Signup { - router: Router; - - constructor(router: Router) { - this.router = router; + constructor(public router: Router) { } signup(event, username, password) { diff --git a/typings/_custom/ng2.d.ts b/typings/_custom/ng2.d.ts index ac375bf..7a4e30a 100644 --- a/typings/_custom/ng2.d.ts +++ b/typings/_custom/ng2.d.ts @@ -1,49 +1,271 @@ 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/change_detection" { - class Pipe {} - class NullPipeFactory {} - class PipeRegistry { - constructor(pipes: any) +declare module "angular2/src/http/backends/browser_xhr" { + class BrowserXhr { + constructor(); + build(): any; } - class JitChangeDetection {} - class ChangeDetection {} - class DynamicChangeDetection {} - var defaultPipes: 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/src/core/zone/ng_zone" { - class NgZone { - runOutsideAngular(func: Function): any +declare module "angular2/mock" { +} + +declare module "angular2/src/core/life_cycle/life_cycle" { + class LifeCycle { + constructor(...args) + tick(): any; } } -declare module 'angular2/src/services/url_resolver' { - class UrlResolver {} +declare module "angular2/src/render/dom/compiler/view_loader" { + class ViewLoader {} } -declare module "angular2/src/facade/async" { - class Observable {} - class EventEmitter { - next(val:any) - return(val:any) - throw(val:any) +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 } - class PromiseWrapper { +} + +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/dom/shadow_dom/style_url_resolver" { - class StyleUrlResolver {} +declare module "angular2/src/render/xhr_impl" { + class XHRImpl {} } -declare module "angular2/src/core/life_cycle/life_cycle" { - class LifeCycle { - tick(): any; +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 { + } } @@ -52,6 +274,10 @@ declare module "zone.js" { var Zone: any; } +declare module "rtts_assert/rtts_assert" { + var assert: any; +} + declare module "angular2/directives" { function NgSwitch(): void; function NgSwitchWhen(): void; @@ -65,111 +291,398 @@ declare module "angular2/directives" { } +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(controls: any): any; + group(config: any): any + array(): any + } + class Validators { + static required(): any + } + class ControlGroup { + value: any + controls: any + include(): any + exclude(): any } class Control { - constructor(controls: any) - updateValue(value: any) - _valueChanges: any - valueChanges: any + valueChanges(): any } class ControlArray { - removeAt(index: any) - push(item: any) + push(): any + removeAt(): any } - class ControlGroup { - constructor(controls: any) - controls: any; - valueChanges: any; + + class NgControlName { + } - class Validators { - static required: any; + 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 EmulatedScopedShadowDomStrategy { - constructor(styleInliner: any, styleUrlResolver: any, styleHost: any) + 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 EmulatedUnscopedShadowDomStrategy { - constructor(styleUrlResolver: any, styleHost: any) + 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 NativeShadowDomStrategy { - constructor(styleUrlResolver: any) + 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; } - class ShadowDomStrategy {} +} + +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; - const Event: any; - const MouseEvent: any; - const KeyboardEvent: any; + var Event: any; + var MouseEvent: any; + var KeyboardEvent: any; } -declare module "angular2/src/router/browser_location" { - class BrowserLocation { - path(): string +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/router/location" { - class Location { - normalize(url: string): string +declare module "angular2/src/core/compiler/directive_resolver" { + class DirectiveResolver { + resolve(appComponent: any): any } } declare module "angular2/router" { - class Instruction {} + class Instruction { + + } class Router { - _registry: any; - _pipeline: any; - hostComponent: any; - navigating: boolean; lastNavigationAttempt: string; - previousUrl: string; - _currentInstruction: any; - _outlets: any; - _subject: any; - navigate(url: string): Promise; - config(config: any): Promise; - deactivate(): Promise; - activate(instruction: Instruction): Promise; + navigate(url: string): any; + config(config: any): any; + deactivate(): any; + activate(instruction: Instruction): any; recognize(url: string): Instruction; recognize(url: string): Instruction; - renavigate(): Promise; + renavigate(): any; generate(name:string, params:any): string; subscribe(onNext: Function): void; - parent: Router; + parent: any } + class LocationStrategy {} + class HashLocationStrategy {} + class HTML5LocationStrategy {} class RouterOutlet { - constructor(elementRef: any, _loader: any, _parentRouter: any, _injector: any, nameAttr: any) + _elementRef: any; _loader: any; _parentRouter: any; - _injector: any; - _childRouter: any; - _componentRef: any; - _elementRef: any; - _currentInstruction: any; - /** - * Given an instruction, update the contents of this viewport. - */ - activate(instruction: any): any; - deactivate(): any; - canDeactivate(instruction: any): 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; } - class RouteParams {} var RouterLink: any; + var RouteParams: any; var routerInjectables: any; var RouteConfigAnnotation: any; var RouteConfig: any; + var routerDirectives: any; } @@ -264,15 +777,212 @@ declare module "angular2/src/dom/browser_adapter" { } } -declare module "angular2/di" { +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 Binding: any; - var ResolvedBinding: 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; @@ -291,9 +1001,4 @@ declare module "angular2/di" { var OptionalAnnotation: any; var InjectableAnnotation: any; var DependencyAnnotation: any; - var Inject: any; - var InjectPromise: any; - var InjectLazy: any; - var Optional: any; - var Injectable: any; }