diff --git a/package.json b/package.json index e0d239594..474af1a29 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "clean": "shx rm -rf lib lib-esm _bundles _doc", "build": "npm run clean && node_modules/.bin/ngc && node_modules/.bin/ngc -p tsconfig.esm.json && webpack", "test": "karma start config/karma.ng2.js", - "docs": "typedoc --tsconfig tsconfig.typedoc.json --readme README.md --name 'ui-router-ng2' --theme node_modules/ui-router-typedoc-themes/bin/default --out _doc --external-aliases internalapi,external --navigation-label-globals ui-router-ng2" + "docs": "typedoc --tsconfig tsconfig.typedoc.json --readme README.md --name 'ui-router-ng2' --theme node_modules/ui-router-typedoc-themes/bin/default --out _doc --internal-aliases internal,coreapi,ng2api --external-aliases internalapi,external --navigation-label-globals ui-router-ng2" }, "homepage": "https://ui-router.github.io/ng2", "contributors": [ @@ -52,8 +52,8 @@ "ui-router-core": "=1.0.1" }, "peerDependencies": { - "@angular/core": "~2.0.0", - "@angular/common": "~2.0.0" + "@angular/core": "^2.0.0", + "@angular/common": "^2.0.0" }, "devDependencies": { "@angular/common": "^2.3.1", diff --git a/src/ng2.ts b/src/ng2.ts index ef6434367..e44188599 100644 --- a/src/ng2.ts +++ b/src/ng2.ts @@ -1,7 +1,15 @@ -/** @module ng2 */ /** for typedoc */ +/** @ng2api @module ng2 */ /** for typedoc */ export * from "ui-router-core"; import "ui-router-core/lib/justjs"; +import 'rxjs/add/observable/of'; +import 'rxjs/add/observable/combineLatest'; +import 'rxjs/add/observable/fromPromise'; +import 'rxjs/add/operator/switchMap'; +import 'rxjs/add/operator/mergeMap'; +import 'rxjs/add/operator/concat'; +import 'rxjs/add/operator/map'; + export * from "./ng2/interface"; export * from "./ng2/lazyLoadNgModule"; export * from "./ng2/rx"; @@ -11,4 +19,3 @@ export * from "./ng2/directives/directives"; export * from "./ng2/statebuilders/views"; export * from "./ng2/uiRouterNgModule"; export * from "./ng2/uiRouterConfig"; - diff --git a/src/ng2/directives/directives.ts b/src/ng2/directives/directives.ts index 954dd9b30..f03c4ac35 100644 --- a/src/ng2/directives/directives.ts +++ b/src/ng2/directives/directives.ts @@ -5,7 +5,9 @@ * - [[UISref]]: A state ref to a target state; navigates when clicked * - [[UISrefActive]]: (and `UISrefActiveEq`) Adds a css class when a UISref's target state (or a child state) is active * - * @preferred @module directives + * @ng2api + * @preferred + * @module directives */ /** */ import {UISref, AnchorUISref} from "./uiSref"; import {UISrefActive} from "./uiSrefActive"; diff --git a/src/ng2/directives/uiSref.ts b/src/ng2/directives/uiSref.ts index 900212c6d..2ff5434f4 100644 --- a/src/ng2/directives/uiSref.ts +++ b/src/ng2/directives/uiSref.ts @@ -1,4 +1,4 @@ -/** @module directives */ /** */ +/** @ng2api @module directives */ /** */ import {UIRouter, UIRouterGlobals} from "ui-router-core"; import {Directive, Inject, Input} from "@angular/core"; import {Optional} from "@angular/core"; @@ -8,7 +8,8 @@ import {UIView, ParentUIViewInject} from "./uiView"; import {extend, Obj} from "ui-router-core"; import {TransitionOptions} from "ui-router-core"; import {Globals} from "ui-router-core"; -import {Subscription, ReplaySubject} from "rxjs/Rx"; +import {ReplaySubject} from 'rxjs/ReplaySubject'; +import {Subscription} from 'rxjs/Subscription'; import {TargetState} from "ui-router-core"; import "../rx"; @@ -30,7 +31,7 @@ export class AnchorUISref { * ### Purpose * * This directive is applied to anchor tags (``) or any other clickable element. It is a state reference (or sref -- - * similar to an href). When clicked, the directive will transition to that state by calling [[StateService.go]], + * similar to an href). When clicked, the directive will transition to that state by calling [[StateService.go]], * and optionally supply state parameter values and transition options. * * When this directive is on an anchor tag, it will also add an `href` attribute to the anchor. @@ -38,9 +39,9 @@ export class AnchorUISref { * ### Selector * * - `[uiSref]`: The directive is created as an attribute on an element, e.g., `` - * + * * ### Inputs - * + * * - `uiSref`: the target state's name, e.g., `uiSref="foostate"`. If a component template uses a relative `uiSref`, * e.g., `uiSref=".child"`, the reference is relative to that component's state. * diff --git a/src/ng2/directives/uiSrefActive.ts b/src/ng2/directives/uiSrefActive.ts index 7ce15dd43..f50ed5ee1 100644 --- a/src/ng2/directives/uiSrefActive.ts +++ b/src/ng2/directives/uiSrefActive.ts @@ -1,7 +1,7 @@ -/** @module directives */ /** */ +/** @ng2api @module directives */ /** */ import {Directive, Input, ElementRef, Host, Renderer} from "@angular/core"; import {UISrefStatus, SrefStatus} from "./uiSrefStatus"; -import {Subscription} from "rxjs/Rx"; +import {Subscription} from "rxjs/Subscription"; /** * A directive that adds a CSS class when its associated `uiSref` link is active. diff --git a/src/ng2/directives/uiSrefStatus.ts b/src/ng2/directives/uiSrefStatus.ts index f390c778a..b0568b2a1 100644 --- a/src/ng2/directives/uiSrefStatus.ts +++ b/src/ng2/directives/uiSrefStatus.ts @@ -1,4 +1,4 @@ -/** @module directives */ /** */ +/** @ng2api @module directives */ /** */ import {Directive, Output, EventEmitter, ContentChildren, QueryList, Inject} from "@angular/core"; import {UISref} from "./uiSref"; import {PathNode} from "ui-router-core"; @@ -9,7 +9,9 @@ import {anyTrueR, tail, unnestR, Predicate} from "ui-router-core"; import {Globals, UIRouterGlobals} from "ui-router-core"; import {Param} from "ui-router-core"; import {PathFactory} from "ui-router-core"; -import {Subscription, Observable, BehaviorSubject} from "rxjs/Rx"; +import {Subscription} from "rxjs/Subscription"; +import {Observable} from "rxjs/Observable"; +import {BehaviorSubject} from "rxjs/BehaviorSubject"; /** @internalapi */ interface TransEvt { evt: string, trans: Transition } diff --git a/src/ng2/directives/uiView.ts b/src/ng2/directives/uiView.ts index f669bd8c9..77aa887b5 100755 --- a/src/ng2/directives/uiView.ts +++ b/src/ng2/directives/uiView.ts @@ -1,4 +1,4 @@ -/** @module directives */ /** */ +/** @ng2api @module directives */ /** */ import { Component, ComponentFactoryResolver, ViewContainerRef, Input, ComponentRef, Type, ReflectiveInjector, ViewChild, Injector, Inject diff --git a/src/ng2/interface.ts b/src/ng2/interface.ts index 60a0cc27c..7f84eda16 100644 --- a/src/ng2/interface.ts +++ b/src/ng2/interface.ts @@ -1,4 +1,4 @@ -/** @module state */ /** */ +/** @ng2api @module state */ /** */ import {StateDeclaration, _ViewDeclaration} from "ui-router-core"; import {Transition} from "ui-router-core"; import {Type, OpaqueToken} from "@angular/core"; diff --git a/src/ng2/lazyLoadNgModule.ts b/src/ng2/lazyLoadNgModule.ts index 384d74f18..41811bc69 100644 --- a/src/ng2/lazyLoadNgModule.ts +++ b/src/ng2/lazyLoadNgModule.ts @@ -1,4 +1,4 @@ -/** @module core */ /** */ +/** @ng2api @module core */ /** */ import {NgModuleFactoryLoader, NgModuleRef, Injector, NgModuleFactory, Type, Compiler} from "@angular/core"; import {Transition, LazyLoadResult, UIRouter, Resolvable, NATIVE_INJECTOR_TOKEN, isString} from "ui-router-core"; import {RootModule, StatesModule, UIROUTER_ROOT_MODULE, UIROUTER_MODULE_TOKEN} from "./uiRouterNgModule"; @@ -105,21 +105,19 @@ export function applyNgModule(transition: Transition, ng2Module: NgModuleRef parentRootModules.indexOf(module) === -1); + let newRootModules: RootModule[] = multiProviderParentChildDelta(parentInjector, injector, UIROUTER_ROOT_MODULE); if (newRootModules.length) { - console.log(rootModules); + console.log(newRootModules); throw new Error('Lazy loaded modules should not contain a UIRouterModule.forRoot() module'); } - let modules: StatesModule[] = injector.get(UIROUTER_MODULE_TOKEN); - modules.forEach(module => applyModuleConfig(uiRouter, injector, module)); + let newModules: RootModule[] = multiProviderParentChildDelta(parentInjector, injector, UIROUTER_MODULE_TOKEN); + newModules.forEach(module => applyModuleConfig(uiRouter, injector, module)); let replacementState = uiRouter.stateRegistry.get(originalName); if (replacementState === originalState) { - throw new Error(`The module that was lazy loaded by activating ${originalName} should also have a ui-router state named '${originalName}'`); + throw new Error(`The Future State named '${originalName}' lazy loaded an NgModule. That NgModule should also have a UIRouterModule.forChild() state named '${originalName}' to replace the Future State, but it did not.`); } // Supply the newly loaded states with the Injector from the lazy loaded NgModule @@ -127,3 +125,19 @@ export function applyNgModule(transition: Transition, ng2Module: NgModuleRef parentVals.indexOf(val) === -1); +} \ No newline at end of file diff --git a/src/ng2/rx.ts b/src/ng2/rx.ts index 82e76547e..61e9a3747 100644 --- a/src/ng2/rx.ts +++ b/src/ng2/rx.ts @@ -1,5 +1,6 @@ /** @module ng2 */ /** */ -import {Observable, ReplaySubject} from "rxjs/Rx"; +import {Observable} from "rxjs/Observable"; +import {ReplaySubject} from "rxjs/ReplaySubject"; import {Transition} from "ui-router-core"; import {UIRouter} from "ui-router-core"; import {StateDeclaration} from "ui-router-core"; diff --git a/src/ng2/uiRouterNgModule.ts b/src/ng2/uiRouterNgModule.ts index 13d1b5b9e..4dff83d06 100644 --- a/src/ng2/uiRouterNgModule.ts +++ b/src/ng2/uiRouterNgModule.ts @@ -1,4 +1,4 @@ -/** @module core */ /** */ +/** @ng2api @module core */ /** */ import {Ng2StateDeclaration} from "./interface"; import {NgModule, OpaqueToken, ModuleWithProviders, ANALYZE_FOR_ENTRY_COMPONENTS, Provider, Type} from "@angular/core"; import {CommonModule} from "@angular/common"; diff --git a/tsconfig.typedoc.json b/tsconfig.typedoc.json index 00e35ad02..d05a082af 100644 --- a/tsconfig.typedoc.json +++ b/tsconfig.typedoc.json @@ -10,41 +10,8 @@ "sourceMap": false }, "files": [ + "src/ng2.ts", "../ui-router-core/src/index.ts", - "../ui-router-core/src/interface.ts", - "../ui-router-core/src/globals.ts", - "../ui-router-core/src/router.ts", - "../ui-router-core/src/common/glob.ts", - "../ui-router-core/src/common/trace.ts", - "../ui-router-core/src/params/module.ts", - "../ui-router-core/src/params/interface.ts", - "../ui-router-core/src/resolve/interface.ts", - "../ui-router-core/src/resolve/resolvable.ts", - "../ui-router-core/src/state/interface.ts", - "../ui-router-core/src/state/module.ts", - "../ui-router-core/src/state/stateObject.ts", - "../ui-router-core/src/state/stateRegistry.ts", - "../ui-router-core/src/state/stateService.ts", - "../ui-router-core/src/state/targetState.ts", - "../ui-router-core/src/transition/module.ts", - "../ui-router-core/src/transition/interface.ts", - "../ui-router-core/src/transition/transition.ts", - "../ui-router-core/src/transition/transitionService.ts", - "../ui-router-core/src/url/module.ts", - "../ui-router-core/src/url/urlMatcher.ts", - "../ui-router-core/src/url/urlMatcherFactory.ts", - "../ui-router-core/src/url/urlRouter.ts", - "../ui-router-core/src/view/module.ts", - "../ui-router-core/src/view/view.ts", - "src/ng2/directives/directives.ts", - "src/ng2/directives/uiSref.ts", - "src/ng2/directives/uiSrefActive.ts", - "src/ng2/directives/uiSrefStatus.ts", - "src/ng2/directives/uiView.ts", - "src/ng2/lazyLoadNgModule.ts", - "src/ng2/uiRouterNgModule.ts", - "src/ng2/interface.ts", - "src/index.ts", "node_modules/typescript/lib/lib.es6.d.ts" ] }