chore: adds the build dir to use with 'npm install'
This commit is contained in:
parent
c179b5033b
commit
5bdc6ecec8
|
@ -0,0 +1 @@
|
||||||
|
# vladivostok
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { Type } from '@angular/core';
|
||||||
|
export declare type RouterConfig = Route[];
|
||||||
|
export interface Route {
|
||||||
|
index?: boolean;
|
||||||
|
path?: string;
|
||||||
|
component: Type | string;
|
||||||
|
outlet?: string;
|
||||||
|
children?: Route[];
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgVHlwZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5leHBvcnQgdHlwZSBSb3V0ZXJDb25maWcgPSBSb3V0ZVtdO1xuXG5leHBvcnQgaW50ZXJmYWNlIFJvdXRlIHtcbiAgaW5kZXg/OiBib29sZWFuO1xuICBwYXRoPzogc3RyaW5nO1xuICBjb21wb25lbnQ6IFR5cGUgfCBzdHJpbmc7XG4gIG91dGxldD86IHN0cmluZztcbiAgY2hpbGRyZW4/OiBSb3V0ZVtdO1xufSJdfQ==
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { UrlTree } from './url_tree';
|
||||||
|
import { ActivatedRoute } from './router_state';
|
||||||
|
import { Params } from './shared';
|
||||||
|
export declare function createUrlTree(route: ActivatedRoute, urlTree: UrlTree, commands: any[], queryParameters: Params | undefined, fragment: string | undefined): UrlTree;
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,13 @@
|
||||||
|
import { Router } from '../router';
|
||||||
|
import { ActivatedRoute } from '../router_state';
|
||||||
|
export declare class RouterLink {
|
||||||
|
private router;
|
||||||
|
private route;
|
||||||
|
target: string;
|
||||||
|
private commands;
|
||||||
|
href: string;
|
||||||
|
constructor(router: Router, route: ActivatedRoute);
|
||||||
|
routerLink: any[] | string;
|
||||||
|
onClick(): boolean;
|
||||||
|
private updateTargetUrlAndHref();
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||||
|
};
|
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||||
|
};
|
||||||
|
import { Directive, HostListener, HostBinding, Input } from '@angular/core';
|
||||||
|
import { Router } from '../router';
|
||||||
|
import { ActivatedRoute } from '../router_state';
|
||||||
|
export let RouterLink = class RouterLink {
|
||||||
|
constructor(router, route) {
|
||||||
|
this.router = router;
|
||||||
|
this.route = route;
|
||||||
|
this.commands = [];
|
||||||
|
}
|
||||||
|
set routerLink(data) {
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
this.commands = data;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.commands = [data];
|
||||||
|
}
|
||||||
|
this.updateTargetUrlAndHref();
|
||||||
|
}
|
||||||
|
onClick() {
|
||||||
|
if (!(typeof this.target === "string") || this.target == '_self') {
|
||||||
|
this.router.navigate(this.commands, { relativeTo: this.route });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
updateTargetUrlAndHref() {
|
||||||
|
const tree = this.router.createUrlTree(this.commands, { relativeTo: this.route });
|
||||||
|
if (tree) {
|
||||||
|
this.href = this.router.serializeUrl(tree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
__decorate([
|
||||||
|
Input(),
|
||||||
|
__metadata('design:type', String)
|
||||||
|
], RouterLink.prototype, "target", void 0);
|
||||||
|
__decorate([
|
||||||
|
HostBinding(),
|
||||||
|
__metadata('design:type', String)
|
||||||
|
], RouterLink.prototype, "href", void 0);
|
||||||
|
__decorate([
|
||||||
|
Input(),
|
||||||
|
__metadata('design:type', Object),
|
||||||
|
__metadata('design:paramtypes', [Object])
|
||||||
|
], RouterLink.prototype, "routerLink", null);
|
||||||
|
__decorate([
|
||||||
|
HostListener("click"),
|
||||||
|
__metadata('design:type', Function),
|
||||||
|
__metadata('design:paramtypes', []),
|
||||||
|
__metadata('design:returntype', Boolean)
|
||||||
|
], RouterLink.prototype, "onClick", null);
|
||||||
|
RouterLink = __decorate([
|
||||||
|
Directive({ selector: '[routerLink]' }),
|
||||||
|
__metadata('design:paramtypes', [Router, ActivatedRoute])
|
||||||
|
], RouterLink);
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX2xpbmsuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvZGlyZWN0aXZlcy9yb3V0ZXJfbGluay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7T0FBTyxFQUNMLFNBQVMsRUFDVCxZQUFZLEVBQ1osV0FBVyxFQUNYLEtBQUssRUFDTixNQUFNLGVBQWU7T0FDZixFQUFDLE1BQU0sRUFBQyxNQUFNLFdBQVc7T0FDekIsRUFBQyxjQUFjLEVBQUMsTUFBTSxpQkFBaUI7QUE0QjlDO0lBT0UsWUFBb0IsTUFBYyxFQUFVLEtBQXFCO1FBQTdDLFdBQU0sR0FBTixN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aXMuY29tbWFuZHMsIHtyZWxhdGl2ZVRvOiB0aGlzLnJvdXRlfSk7XG4gICAgaWYgKHRyZWUpIHtcbiAgICAgIHRoaXMuaHJlZiA9IHRoaXMucm91dGVyLnNlcmlhbGl6ZVVybCh0cmVlKTtcbiAgICB9XG4gIH1cbn1cbiJdfQ==
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ViewContainerRef, ComponentFactory, ResolvedReflectiveProvider } from '@angular/core';
|
||||||
|
import { RouterOutletMap } from '../router_outlet_map';
|
||||||
|
export declare class RouterOutlet {
|
||||||
|
private location;
|
||||||
|
private activated;
|
||||||
|
outletMap: RouterOutletMap;
|
||||||
|
constructor(parentOutletMap: RouterOutletMap, location: ViewContainerRef, name: string);
|
||||||
|
readonly isActivated: boolean;
|
||||||
|
deactivate(): void;
|
||||||
|
activate(factory: ComponentFactory<any>, providers: ResolvedReflectiveProvider[], outletMap: RouterOutletMap): void;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||||
|
};
|
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||||
|
};
|
||||||
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||||
|
return function (target, key) { decorator(target, key, paramIndex); }
|
||||||
|
};
|
||||||
|
import { Directive, ViewContainerRef, Attribute, ReflectiveInjector } from '@angular/core';
|
||||||
|
import { RouterOutletMap } from '../router_outlet_map';
|
||||||
|
import { PRIMARY_OUTLET } from '../shared';
|
||||||
|
export let RouterOutlet = class RouterOutlet {
|
||||||
|
constructor(parentOutletMap, location, name) {
|
||||||
|
this.location = location;
|
||||||
|
parentOutletMap.registerOutlet(name ? name : PRIMARY_OUTLET, this);
|
||||||
|
}
|
||||||
|
get isActivated() { return !!this.activated; }
|
||||||
|
deactivate() {
|
||||||
|
if (this.activated) {
|
||||||
|
this.activated.destroy();
|
||||||
|
this.activated = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activate(factory, providers, outletMap) {
|
||||||
|
this.outletMap = outletMap;
|
||||||
|
let inj = ReflectiveInjector.fromResolvedProviders(providers, this.location.parentInjector);
|
||||||
|
this.activated = this.location.createComponent(factory, this.location.length, inj, []);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RouterOutlet = __decorate([
|
||||||
|
Directive({ selector: 'router-outlet' }),
|
||||||
|
__param(2, Attribute('name')),
|
||||||
|
__metadata('design:paramtypes', [RouterOutletMap, ViewContainerRef, String])
|
||||||
|
], RouterOutlet);
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX291dGxldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9kaXJlY3RpdmVzL3JvdXRlcl9vdXRsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O09BQU8sRUFBQyxTQUFTLEVBQUUsZ0JBQWdCLEVBQUUsU0FBUyxFQUE4RCxrQkFBa0IsRUFBQyxNQUFNLGVBQWU7T0FDN0ksRUFBQyxlQUFlLEVBQUMsTUFBTSxzQkFBc0I7T0FDN0MsRUFBQyxjQUFjLEVBQUMsTUFBTSxXQUFXO0FBR3hDO0lBSUUsWUFBWSxlQUErQixFQUFVLFFBQXlCLEVBQy9DLElBQVc7U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udEZhY3Rvcnk8YW55PiwgcHJvdmlkZXJzOiBSZXNvbHZlZFJlZmxlY3RpdmVQcm92aWRlcltdLFxuICAgICAgICAgICBvdXRsZXRNYXA6IFJvdXRlck91dGxldE1hcCk6IHZvaWQge1xuICAgIHRoaXMub3V0bGV0TWFwID0gb3V0bGV0TWFwO1xuICAgIGxldCBpbmogPSBSZWZsZWN0aXZlSW5qZWN0b3IuZnJvbVJlc29sdmVkUHJvdmlkZXJzKHByb3ZpZGVycywgdGhpcy5sb2NhdGlvbi5wYXJlbnRJbmplY3Rvcik7XG4gICAgdGhpcy5hY3RpdmF0ZWQgPSB0aGlzLmxvY2F0aW9uLmNyZWF0ZUNvbXBvbmVudChmYWN0b3J5LCB0aGlzLmxvY2F0aW9uLmxlbmd0aCwgaW5qLCBbXSk7XG4gIH1cbn1cbiJdfQ==
|
|
@ -0,0 +1,7 @@
|
||||||
|
export { Router } from './router';
|
||||||
|
export { UrlSerializer, DefaultUrlSerializer } from './url_serializer';
|
||||||
|
export { RouterState, ActivatedRoute } from './router_state';
|
||||||
|
export { RouterOutletMap } from './router_outlet_map';
|
||||||
|
import { RouterOutlet } from './directives/router_outlet';
|
||||||
|
import { RouterLink } from './directives/router_link';
|
||||||
|
export declare const ROUTER_DIRECTIVES: (typeof RouterOutlet | typeof RouterLink)[];
|
|
@ -0,0 +1,8 @@
|
||||||
|
export { Router } from './router';
|
||||||
|
export { UrlSerializer, DefaultUrlSerializer } from './url_serializer';
|
||||||
|
export { RouterState, ActivatedRoute } from './router_state';
|
||||||
|
export { RouterOutletMap } from './router_outlet_map';
|
||||||
|
import { RouterOutlet } from './directives/router_outlet';
|
||||||
|
import { RouterLink } from './directives/router_link';
|
||||||
|
export const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink];
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8u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import { RouterState } from './router_state';
|
||||||
|
import { RouterConfig } from './config';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
export declare function recognize(config: RouterConfig, url: UrlTree, existingState: RouterState): Observable<RouterState>;
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,40 @@
|
||||||
|
import { ComponentResolver } from '@angular/core';
|
||||||
|
import { Location } from '@angular/common';
|
||||||
|
import { UrlSerializer } from './url_serializer';
|
||||||
|
import { RouterOutletMap } from './router_outlet_map';
|
||||||
|
import { UrlTree } from './url_tree';
|
||||||
|
import { Params } from './shared';
|
||||||
|
import { RouterState, ActivatedRoute } from './router_state';
|
||||||
|
import { RouterConfig } from './config';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import 'rxjs/add/operator/map';
|
||||||
|
import 'rxjs/add/operator/mergeMap';
|
||||||
|
import 'rxjs/add/operator/toPromise';
|
||||||
|
export interface NavigationExtras {
|
||||||
|
relativeTo?: ActivatedRoute;
|
||||||
|
queryParameters?: Params;
|
||||||
|
fragment?: string;
|
||||||
|
}
|
||||||
|
export declare class Router {
|
||||||
|
private rootComponent;
|
||||||
|
private resolver;
|
||||||
|
private urlSerializer;
|
||||||
|
private outletMap;
|
||||||
|
private location;
|
||||||
|
private currentUrlTree;
|
||||||
|
private currentRouterState;
|
||||||
|
private config;
|
||||||
|
private locationSubscription;
|
||||||
|
constructor(rootComponent: Object, resolver: ComponentResolver, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location);
|
||||||
|
readonly routerState: RouterState;
|
||||||
|
readonly urlTree: UrlTree;
|
||||||
|
navigateByUrl(url: string): Observable<void>;
|
||||||
|
resetConfig(config: RouterConfig): void;
|
||||||
|
dispose(): void;
|
||||||
|
createUrlTree(commands: any[], {relativeTo, queryParameters, fragment}?: NavigationExtras): UrlTree;
|
||||||
|
navigate(commands: any[], extras?: NavigationExtras): Observable<void>;
|
||||||
|
serializeUrl(url: UrlTree): string;
|
||||||
|
parseUrl(url: string): UrlTree;
|
||||||
|
private setUpLocationChangeListener();
|
||||||
|
private runNavigate(url, pop?);
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,7 @@
|
||||||
|
import { RouterOutlet } from './directives/router_outlet';
|
||||||
|
export declare class RouterOutletMap {
|
||||||
|
_outlets: {
|
||||||
|
[name: string]: RouterOutlet;
|
||||||
|
};
|
||||||
|
registerOutlet(name: string, outlet: RouterOutlet): void;
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
export class RouterOutletMap {
|
||||||
|
constructor() {
|
||||||
|
this._outlets = {};
|
||||||
|
}
|
||||||
|
registerOutlet(name, outlet) { this._outlets[name] = outlet; }
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX291dGxldF9tYXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcm91dGVyX291dGxldF9tYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0E7SUFBQTtRQUVFLGFBQVEsR0FBbUMsRUFBRSxDQUFDO0lBRWhELENBQUM7SUFEQyxjQUFjLENBQUMsSUFBWSxFQUFFLE1BQW9CLElBQVUsSUFBSSxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsR0FBRyxNQUFNLENBQUMsQ0FBQyxDQUFDO0FBQzVGLENBQUM7QUFBQSIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFJvdXRlck91dGxldCB9IGZyb20gJy4vZGlyZWN0aXZlcy9yb3V0ZXJfb3V0bGV0JztcblxuLyoqXG4gKiBAaW50ZXJuYWxcbiAqL1xuZXhwb3J0IGNsYXNzIFJvdXRlck91dGxldE1hcCB7XG4gIC8qKiBAaW50ZXJuYWwgKi9cbiAgX291dGxldHM6IHtbbmFtZTogc3RyaW5nXTogUm91dGVyT3V0bGV0fSA9IHt9O1xuICByZWdpc3Rlck91dGxldChuYW1lOiBzdHJpbmcsIG91dGxldDogUm91dGVyT3V0bGV0KTogdm9pZCB7IHRoaXMuX291dGxldHNbbmFtZV0gPSBvdXRsZXQ7IH1cbn1cbiJdfQ==
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
|
import { UrlSegment } from './url_tree';
|
||||||
|
import { Params } from './shared';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { Type } from '@angular/core';
|
||||||
|
export declare class RouterState extends Tree<ActivatedRoute> {
|
||||||
|
queryParams: Observable<Params>;
|
||||||
|
fragment: Observable<string>;
|
||||||
|
constructor(root: TreeNode<ActivatedRoute>, queryParams: Observable<Params>, fragment: Observable<string>);
|
||||||
|
}
|
||||||
|
export declare function createEmptyState(rootComponent: Type): RouterState;
|
||||||
|
export declare class ActivatedRoute {
|
||||||
|
urlSegments: Observable<UrlSegment[]>;
|
||||||
|
params: Observable<Params>;
|
||||||
|
outlet: string;
|
||||||
|
component: Type | string;
|
||||||
|
constructor(urlSegments: Observable<UrlSegment[]>, params: Observable<Params>, outlet: string, component: Type | string);
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
|
import { UrlSegment } from './url_tree';
|
||||||
|
import { PRIMARY_OUTLET } from './shared';
|
||||||
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||||
|
export class RouterState extends Tree {
|
||||||
|
constructor(root, queryParams, fragment) {
|
||||||
|
super(root);
|
||||||
|
this.queryParams = queryParams;
|
||||||
|
this.fragment = fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function createEmptyState(rootComponent) {
|
||||||
|
const emptyUrl = new BehaviorSubject([new UrlSegment("", {}, PRIMARY_OUTLET)]);
|
||||||
|
const emptyParams = new BehaviorSubject({});
|
||||||
|
const emptyQueryParams = new BehaviorSubject({});
|
||||||
|
const fragment = new BehaviorSubject("");
|
||||||
|
const activated = new ActivatedRoute(emptyUrl, emptyParams, PRIMARY_OUTLET, rootComponent);
|
||||||
|
return new RouterState(new TreeNode(activated, []), emptyQueryParams, fragment);
|
||||||
|
}
|
||||||
|
export class ActivatedRoute {
|
||||||
|
constructor(urlSegments, params, outlet, component) {
|
||||||
|
this.urlSegments = urlSegments;
|
||||||
|
this.params = params;
|
||||||
|
this.outlet = outlet;
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX3N0YXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3JvdXRlcl9zdGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiT0FBTyxFQUFFLElBQUksRUFBRSxRQUFRLEVBQUUsTUFBTSxjQUFjO09BQ3RDLEVBQUUsVUFBVSxFQUFFLE1BQU0sWUFBWTtPQUNoQyxFQUFVLGNBQWMsRUFBRSxNQUFNLFVBQVU7T0FFMUMsRUFBRSxlQUFlLEVBQUUsTUFBTSxzQkFBc0I7QUFrQnRELGlDQUFpQyxJQUFJO0lBQ25DLFlBQVksSUFBOEIsRUFBUyxXQUErQixFQUFTLFFBQTRCO1FBQ3JILE1BQU0sSUFBSSxDQUFDLENBQUM7UUFEcUMsZ0JBQVcsR0FBWCxXQUFXLENBQW9CO1FBQVMsYUFBUSxHQUFSLFFBQVEsQ0FBb0I7SUFFdkgsQ0FBQztBQUNILENBQUM7QUFFRCxpQ0FBaUMsYUFBbUI7SUFDbEQsTUFBTSxRQUFRLEdBQUcsSUFBSSxlQUFlLENBQUMsQ0FBQyxJQUFJLFVBQVUsQ0FBQyxFQUFFLEVBQUUsRUFBRSxFQUFFLGNBQWMsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUMvRSxNQUFNLFdBQVcsR0FBRyxJQUFJLGVBQWUsQ0FBQyxFQUFFLENBQUMsQ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=
|
|
@ -0,0 +1,4 @@
|
||||||
|
export declare const PRIMARY_OUTLET: string;
|
||||||
|
export declare type Params = {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
|
@ -0,0 +1,2 @@
|
||||||
|
export const PRIMARY_OUTLET = "PRIMARY_OUTLET";
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NoYXJlZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQSxPQUFPLE1BQU0sY0FBYyxHQUFXLGdCQUFnQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBOYW1lIG9mIHRoZSBwcmltYXJ5IG91dGxldC5cbiAqIEB0eXBlIHtzdHJpbmd9XG4gKi9cbmV4cG9ydCBjb25zdCBQUklNQVJZX09VVExFVDogc3RyaW5nID0gXCJQUklNQVJZX09VVExFVFwiO1xuXG4vKipcbiAqIEEgY29sbGVjdGlvbiBvZiBwYXJhbWV0ZXJzLlxuICovXG5leHBvcnQgdHlwZSBQYXJhbXMgPSB7IFtrZXk6IHN0cmluZ106IHN0cmluZyB9O1xuIl19
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { UrlTree, UrlSegment } from './url_tree';
|
||||||
|
export declare abstract class UrlSerializer {
|
||||||
|
abstract parse(url: string): UrlTree;
|
||||||
|
abstract serialize(tree: UrlTree): string;
|
||||||
|
}
|
||||||
|
export declare class DefaultUrlSerializer implements UrlSerializer {
|
||||||
|
parse(url: string): UrlTree;
|
||||||
|
serialize(tree: UrlTree): string;
|
||||||
|
}
|
||||||
|
export declare function serializeSegment(segment: UrlSegment): string;
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,23 @@
|
||||||
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
|
export declare function createEmptyUrlTree(): UrlTree;
|
||||||
|
export declare class UrlTree extends Tree<UrlSegment> {
|
||||||
|
queryParameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
fragment: string | null;
|
||||||
|
constructor(root: TreeNode<UrlSegment>, queryParameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
}, fragment: string | null);
|
||||||
|
}
|
||||||
|
export declare class UrlSegment {
|
||||||
|
path: string;
|
||||||
|
parameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
outlet: string;
|
||||||
|
constructor(path: string, parameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
}, outlet: string);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
export declare function equalUrlSegments(a: UrlSegment[], b: UrlSegment[]): boolean;
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
|
import { shallowEqual } from './utils/collection';
|
||||||
|
import { PRIMARY_OUTLET } from './shared';
|
||||||
|
export function createEmptyUrlTree() {
|
||||||
|
return new UrlTree(new TreeNode(new UrlSegment("", {}, PRIMARY_OUTLET), []), {}, null);
|
||||||
|
}
|
||||||
|
export class UrlTree extends Tree {
|
||||||
|
constructor(root, queryParameters, fragment) {
|
||||||
|
super(root);
|
||||||
|
this.queryParameters = queryParameters;
|
||||||
|
this.fragment = fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class UrlSegment {
|
||||||
|
constructor(path, parameters, outlet) {
|
||||||
|
this.path = path;
|
||||||
|
this.parameters = parameters;
|
||||||
|
this.outlet = outlet;
|
||||||
|
}
|
||||||
|
toString() {
|
||||||
|
const params = [];
|
||||||
|
for (let prop in this.parameters) {
|
||||||
|
if (this.parameters.hasOwnProperty(prop)) {
|
||||||
|
params.push(`${prop}=${this.parameters[prop]}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const paramsString = params.length > 0 ? `(${params.join(',')})` : '';
|
||||||
|
const outlet = this.outlet === PRIMARY_OUTLET ? '' : `${this.outlet}:`;
|
||||||
|
return `${outlet}${this.path}${paramsString}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function equalUrlSegments(a, b) {
|
||||||
|
if (a.length !== b.length)
|
||||||
|
return false;
|
||||||
|
for (let i = 0; i < a.length; ++i) {
|
||||||
|
if (a[i].path !== b[i].path)
|
||||||
|
return false;
|
||||||
|
if (!shallowEqual(a[i].parameters, b[i].parameters))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXJsX3RyZWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXJsX3RyZWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ik9BQU8sRUFBRSxJQUFJLEVBQUUsUUFBUSxFQUFFLE1BQU0sY0FBYztPQUN0QyxFQUFFLFlBQVksRUFBRSxNQUFNLG9CQUFvQjtPQUMxQyxFQUFFLGNBQWMsRUFBRSxNQUFNLFVBQVU7QUFFekM7SUFDRSxNQUFNLENBQUMsSUFBSSxPQUFPLENBQUMsSUFBSSxRQUFRLENBQWEsSUFBSSxVQUFVLENBQUMsRUFBRSxFQUFFLEVBQUUsRUFBRSxjQUFjLENBQUMsRUFBRSxFQUFFLENBQUMsRUFBRSxFQUFFLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDckcsQ0FBQztBQUtELDZCQUE2QixJQUFJO0lBQy9CLFlBQVksSUFBMEIsRUFBUyxlQUF3QyxFQUFTLFFBQXVCO1FBQ3JILE1BQU0sSUFBSSxDQUFDLENBQUM7UUFEaUMsb0JBQWUsR0FBZixlQUFlLENBQXlCO1FBQVMsYUFBUSxHQUFSLFFBQVEsQ0FBZTtJQUV2SCxDQUFDO0FBQ0gsQ0FBQztBQUVEO0lBQ0UsWUFBbUIsSUFBWSxFQUFTLFVBQW1DLEVBQVMsTUFBYztRQUEvRSxTQUFJLEdBQUosSU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xuICBmb3IgKGxldCBpID0gMDsgaSA8IGEubGVuZ3RoOyArK2kpIHtcbiAgICBpZiAoYVtpXS5wYXRoICE9PSBiW2ldLnBhdGgpIHJldHVybiBmYWxzZTtcbiAgICBpZiAoIXNoYWxsb3dFcXVhbChhW2ldLnBhcmFtZXRlcnMsIGJbaV0ucGFyYW1ldGVycykpIHJldHVybiBmYWxzZTtcbiAgfVxuICByZXR1cm4gdHJ1ZTtcbn1cbiJdfQ==
|
|
@ -0,0 +1,17 @@
|
||||||
|
export declare function shallowEqual(a: {
|
||||||
|
[x: string]: any;
|
||||||
|
}, b: {
|
||||||
|
[x: string]: any;
|
||||||
|
}): boolean;
|
||||||
|
export declare function flatten<T>(a: T[][]): T[];
|
||||||
|
export declare function first<T>(a: T[]): T | null;
|
||||||
|
export declare function merge<V>(m1: {
|
||||||
|
[key: string]: V;
|
||||||
|
}, m2: {
|
||||||
|
[key: string]: V;
|
||||||
|
}): {
|
||||||
|
[key: string]: V;
|
||||||
|
};
|
||||||
|
export declare function forEach<K, V>(map: {
|
||||||
|
[key: string]: V;
|
||||||
|
}, callback: Function): void;
|
|
@ -0,0 +1,49 @@
|
||||||
|
export function shallowEqual(a, b) {
|
||||||
|
var k1 = Object.keys(a);
|
||||||
|
var k2 = Object.keys(b);
|
||||||
|
if (k1.length != k2.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var key;
|
||||||
|
for (var i = 0; i < k1.length; i++) {
|
||||||
|
key = k1[i];
|
||||||
|
if (a[key] !== b[key]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
export function flatten(a) {
|
||||||
|
const target = [];
|
||||||
|
for (let i = 0; i < a.length; ++i) {
|
||||||
|
for (let j = 0; j < a[i].length; ++j) {
|
||||||
|
target.push(a[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
export function first(a) {
|
||||||
|
return a.length > 0 ? a[0] : null;
|
||||||
|
}
|
||||||
|
export function merge(m1, m2) {
|
||||||
|
var m = {};
|
||||||
|
for (var attr in m1) {
|
||||||
|
if (m1.hasOwnProperty(attr)) {
|
||||||
|
m[attr] = m1[attr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var attr in m2) {
|
||||||
|
if (m2.hasOwnProperty(attr)) {
|
||||||
|
m[attr] = m2[attr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
export function forEach(map, callback) {
|
||||||
|
for (var prop in map) {
|
||||||
|
if (map.hasOwnProperty(prop)) {
|
||||||
|
callback(map[prop], prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy91dGlscy9jb2xsZWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZCQUE2QixDQUFtQixFQUFFLENBQW1CO0lBQ25FLElBQUksRUFBRSxHQUFHLE1BQU0sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDeEIsSUFBSSxFQUFFLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN4QixFQUFFLENBQUMsQ0FBQyxFQUFFLENBQUMsTUFBTSxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO1FBQzNCLE1BQU0sQ0FBQyxLQUFLLENBQUM7SUFDZixDQUFDO0lBQ0QsSUFBSSxHQUFHLENBQUM7SUFDUixHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUFFLEVB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pIHtcbiAgICAgIG1bYXR0cl0gPSBtMlthdHRyXTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gbTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGZvckVhY2g8SywgVj4obWFwOiB7W2tleTogc3RyaW5nXTogVn0sIGNhbGxiYWNrOiAvKihWLCBLKSA9PiB2b2lkKi8gRnVuY3Rpb24pOiB2b2lkIHtcbiAgZm9yICh2YXIgcHJvcCBpbiBtYXApIHtcbiAgICBpZiAobWFwLmhhc093blByb3BlcnR5KHByb3ApKSB7XG4gICAgICBjYWxsYmFjayhtYXBbcHJvcF0sIHByb3ApO1xuICAgIH1cbiAgfVxufSJdfQ==
|
|
@ -0,0 +1,17 @@
|
||||||
|
export declare class Tree<T> {
|
||||||
|
_root: TreeNode<T>;
|
||||||
|
constructor(root: TreeNode<T>);
|
||||||
|
readonly root: T;
|
||||||
|
parent(t: T): T | null;
|
||||||
|
children(t: T): T[];
|
||||||
|
firstChild(t: T): T | null;
|
||||||
|
siblings(t: T): T[];
|
||||||
|
pathFromRoot(t: T): T[];
|
||||||
|
contains(tree: Tree<T>): boolean;
|
||||||
|
}
|
||||||
|
export declare function rootNode<T>(tree: Tree<T>): TreeNode<T>;
|
||||||
|
export declare class TreeNode<T> {
|
||||||
|
value: T;
|
||||||
|
children: TreeNode<T>[];
|
||||||
|
constructor(value: T, children: TreeNode<T>[]);
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,68 @@
|
||||||
|
{
|
||||||
|
"name": "vladivostok",
|
||||||
|
"version": "0.9.1",
|
||||||
|
"description": "",
|
||||||
|
"main": "./build/src/index.js",
|
||||||
|
"jsnext:main": "./build/es6/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"karma": "karma start",
|
||||||
|
"test": "npm run build; karma start",
|
||||||
|
"build_watch": "rm -rf dist; tsc -w",
|
||||||
|
"build": "rm -rf dist; tsc",
|
||||||
|
"build_npm": "rm -rf dist && tsc -p tsconfig.publish.es5.json && tsc -p tsconfig.publish.es6.json",
|
||||||
|
"postbuild_npm": "cp package.json README.md dist/ && npm run rewrite_npm_package",
|
||||||
|
"rewrite_npm_package": "node --harmony_destructuring tools/rewrite-published-package.js",
|
||||||
|
"build_bundle": "cp -r src router && tsc typings/index.d.ts src/router.ts --rootDir . --module system -t es5 --outFile dist/bundles/router.js --moduleResolution node --emitDecoratorMetadata --experimentalDecorators"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"angular2",
|
||||||
|
"angular",
|
||||||
|
"router"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/angular/vladivostok.git"
|
||||||
|
},
|
||||||
|
"author": "vsavkin",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/angular/vladivostok/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/angular/vladivostok#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"es6-module-loader": "^0.17.10",
|
||||||
|
"es6-shim": "^0.35.0",
|
||||||
|
"gulp": "^3.9.0",
|
||||||
|
"gulp-jasmine": "^2.2.1",
|
||||||
|
"gulp-typescript": "^2.10.0",
|
||||||
|
"http-server": "^0.8.5",
|
||||||
|
"jasmine": "^2.4.1",
|
||||||
|
"jasmine-core": "^2.4.1",
|
||||||
|
"json": "^9.0.3",
|
||||||
|
"karma": "^0.13.19",
|
||||||
|
"karma-chrome-launcher": "^0.2.2",
|
||||||
|
"karma-firefox-launcher": "^0.1.7",
|
||||||
|
"karma-jasmine": "^0.3.6",
|
||||||
|
"karma-systemjs": "^0.10.0",
|
||||||
|
"karma-sourcemap-loader": "~0.3",
|
||||||
|
"parse5": "^1.3.2",
|
||||||
|
"protractor": "3.0.0",
|
||||||
|
"reflect-metadata": "0.1.2",
|
||||||
|
"systemjs": "^0.19.16",
|
||||||
|
"systemjs-builder": "^0.15.7",
|
||||||
|
"traceur": "0.0.96",
|
||||||
|
"tsd": "^0.6.5",
|
||||||
|
"typescript": "^1.9.0-dev.20160409",
|
||||||
|
"typings": "^1.0.4",
|
||||||
|
"zone.js": "^0.6.6"
|
||||||
|
},
|
||||||
|
"typings": "router.d.ts",
|
||||||
|
"peerDependencies": {
|
||||||
|
"@angular/common": "2.0.0-rc.1",
|
||||||
|
"@angular/compiler": "2.0.0-rc.1",
|
||||||
|
"@angular/core": "2.0.0-rc.1",
|
||||||
|
"@angular/platform-browser": "2.0.0-rc.1",
|
||||||
|
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
|
||||||
|
"rxjs": "5.0.0-beta.6"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { Type } from '@angular/core';
|
||||||
|
export declare type RouterConfig = Route[];
|
||||||
|
export interface Route {
|
||||||
|
index?: boolean;
|
||||||
|
path?: string;
|
||||||
|
component: Type | string;
|
||||||
|
outlet?: string;
|
||||||
|
children?: Route[];
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgVHlwZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5leHBvcnQgdHlwZSBSb3V0ZXJDb25maWcgPSBSb3V0ZVtdO1xuXG5leHBvcnQgaW50ZXJmYWNlIFJvdXRlIHtcbiAgaW5kZXg/OiBib29sZWFuO1xuICBwYXRoPzogc3RyaW5nO1xuICBjb21wb25lbnQ6IFR5cGUgfCBzdHJpbmc7XG4gIG91dGxldD86IHN0cmluZztcbiAgY2hpbGRyZW4/OiBSb3V0ZVtdO1xufSJdfQ==
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { UrlTree } from './url_tree';
|
||||||
|
import { ActivatedRoute } from './router_state';
|
||||||
|
import { Params } from './shared';
|
||||||
|
export declare function createUrlTree(route: ActivatedRoute, urlTree: UrlTree, commands: any[], queryParameters: Params | undefined, fragment: string | undefined): UrlTree;
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,13 @@
|
||||||
|
import { Router } from '../router';
|
||||||
|
import { ActivatedRoute } from '../router_state';
|
||||||
|
export declare class RouterLink {
|
||||||
|
private router;
|
||||||
|
private route;
|
||||||
|
target: string;
|
||||||
|
private commands;
|
||||||
|
href: string;
|
||||||
|
constructor(router: Router, route: ActivatedRoute);
|
||||||
|
routerLink: any[] | string;
|
||||||
|
onClick(): boolean;
|
||||||
|
private updateTargetUrlAndHref();
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
"use strict";
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||||
|
};
|
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||||
|
};
|
||||||
|
var core_1 = require('@angular/core');
|
||||||
|
var router_1 = require('../router');
|
||||||
|
var router_state_1 = require('../router_state');
|
||||||
|
var RouterLink = (function () {
|
||||||
|
function RouterLink(router, route) {
|
||||||
|
this.router = router;
|
||||||
|
this.route = route;
|
||||||
|
this.commands = [];
|
||||||
|
}
|
||||||
|
Object.defineProperty(RouterLink.prototype, "routerLink", {
|
||||||
|
set: function (data) {
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
this.commands = data;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.commands = [data];
|
||||||
|
}
|
||||||
|
this.updateTargetUrlAndHref();
|
||||||
|
},
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
RouterLink.prototype.onClick = function () {
|
||||||
|
if (!(typeof this.target === "string") || this.target == '_self') {
|
||||||
|
this.router.navigate(this.commands, { relativeTo: this.route });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
RouterLink.prototype.updateTargetUrlAndHref = function () {
|
||||||
|
var tree = this.router.createUrlTree(this.commands, { relativeTo: this.route });
|
||||||
|
if (tree) {
|
||||||
|
this.href = this.router.serializeUrl(tree);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', String)
|
||||||
|
], RouterLink.prototype, "target", void 0);
|
||||||
|
__decorate([
|
||||||
|
core_1.HostBinding(),
|
||||||
|
__metadata('design:type', String)
|
||||||
|
], RouterLink.prototype, "href", void 0);
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', Object),
|
||||||
|
__metadata('design:paramtypes', [Object])
|
||||||
|
], RouterLink.prototype, "routerLink", null);
|
||||||
|
__decorate([
|
||||||
|
core_1.HostListener("click"),
|
||||||
|
__metadata('design:type', Function),
|
||||||
|
__metadata('design:paramtypes', []),
|
||||||
|
__metadata('design:returntype', Boolean)
|
||||||
|
], RouterLink.prototype, "onClick", null);
|
||||||
|
RouterLink = __decorate([
|
||||||
|
core_1.Directive({ selector: '[routerLink]' }),
|
||||||
|
__metadata('design:paramtypes', [router_1.Router, router_state_1.ActivatedRoute])
|
||||||
|
], RouterLink);
|
||||||
|
return RouterLink;
|
||||||
|
}());
|
||||||
|
exports.RouterLink = RouterLink;
|
||||||
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sZWFuIHtcbiAgICAvLyBJZiBubyB0YXJnZXQsIG9yIGlmIHRhcmdldCBpcyBfc2VsZiwgcHJldmVudCBkZWZhdWx0IGJyb3dzZXIgYmVoYXZpb3JcbiAgICBpZiAoISh0eXBlb2YgdGhpcy50YXJnZXQgPT09IFwic3RyaW5nXCIpIHx8IHRoaXMudGFyZ2V0ID09ICdfc2VsZicpIHtcbiAgICAgIHRoaXMucm91dGVyLm5hdmlnYXRlKHRoaXMuY29tbWFuZHMsIHtyZWxhdGl2ZVRvOiB0aGlzLnJvdXRlfSk7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICAgIHJldHVybiB0cnVlO1xuICB9XG5cbiAgcHJpdmF0ZSB1cGRhdGVUYXJnZXRVcmxBbmRIcmVmKCk6IHZvaWQge1xuICAgIGNvbnN0IHRyZWUgPSB0aGlzLnJvdXRlci5jcmVhdGVVcmxUcmVlKHRoaXMuY29tbWFuZHMsIHtyZWxhdGl2ZVRvOiB0aGlzLnJvdXRlfSk7XG4gICAgaWYgKHRyZWUpIHtcbiAgICAgIHRoaXMuaHJlZiA9IHRoaXMucm91dGVyLnNlcmlhbGl6ZVVybCh0cmVlKTtcbiAgICB9XG4gIH1cbn1cbiJdfQ==
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ViewContainerRef, ComponentFactory, ResolvedReflectiveProvider } from '@angular/core';
|
||||||
|
import { RouterOutletMap } from '../router_outlet_map';
|
||||||
|
export declare class RouterOutlet {
|
||||||
|
private location;
|
||||||
|
private activated;
|
||||||
|
outletMap: RouterOutletMap;
|
||||||
|
constructor(parentOutletMap: RouterOutletMap, location: ViewContainerRef, name: string);
|
||||||
|
readonly isActivated: boolean;
|
||||||
|
deactivate(): void;
|
||||||
|
activate(factory: ComponentFactory<any>, providers: ResolvedReflectiveProvider[], outletMap: RouterOutletMap): void;
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
"use strict";
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||||
|
};
|
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||||
|
};
|
||||||
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||||
|
return function (target, key) { decorator(target, key, paramIndex); }
|
||||||
|
};
|
||||||
|
var core_1 = require('@angular/core');
|
||||||
|
var router_outlet_map_1 = require('../router_outlet_map');
|
||||||
|
var shared_1 = require('../shared');
|
||||||
|
var RouterOutlet = (function () {
|
||||||
|
function RouterOutlet(parentOutletMap, location, name) {
|
||||||
|
this.location = location;
|
||||||
|
parentOutletMap.registerOutlet(name ? name : shared_1.PRIMARY_OUTLET, this);
|
||||||
|
}
|
||||||
|
Object.defineProperty(RouterOutlet.prototype, "isActivated", {
|
||||||
|
get: function () { return !!this.activated; },
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
RouterOutlet.prototype.deactivate = function () {
|
||||||
|
if (this.activated) {
|
||||||
|
this.activated.destroy();
|
||||||
|
this.activated = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RouterOutlet.prototype.activate = function (factory, providers, outletMap) {
|
||||||
|
this.outletMap = outletMap;
|
||||||
|
var inj = core_1.ReflectiveInjector.fromResolvedProviders(providers, this.location.parentInjector);
|
||||||
|
this.activated = this.location.createComponent(factory, this.location.length, inj, []);
|
||||||
|
};
|
||||||
|
RouterOutlet = __decorate([
|
||||||
|
core_1.Directive({ selector: 'router-outlet' }),
|
||||||
|
__param(2, core_1.Attribute('name')),
|
||||||
|
__metadata('design:paramtypes', [router_outlet_map_1.RouterOutletMap, core_1.ViewContainerRef, String])
|
||||||
|
], RouterOutlet);
|
||||||
|
return RouterOutlet;
|
||||||
|
}());
|
||||||
|
exports.RouterOutlet = RouterOutlet;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX291dGxldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9kaXJlY3RpdmVzL3JvdXRlcl9vdXRsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUFBLHFCQUFxSSxlQUFlLENBQUMsQ0FBQTtBQUNySixrQ0FBOEIsc0JBQXNCLENBQUMsQ0FBQTtBQUNyRCx1QkFBNkIsV0FBVyxDQUFDLENBQUE7QUFHekM7SUFJRSxzQkFBWSxlQUErQixFQUFVLFFBQXlCLEVBQy9DLElBQVc7UUFEVyxhQUFRLEdBQVIsUUFBUSxDQUFpQjtRQUU1RSxlQUFlLENBQUMsY0FBYyxDQUFDLElBQUksR0FBRyxJQUFJLEdBQUcsdUJBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNyRSxDQUFDO0lBRUQsc0JBQUkscUNBQVc7YUFBZixjQUE2QixNQUFNLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDOzs7T0FBQTtJQUV2RCxpQ0FBVSxHQUFWO1FBQ0UsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7WUFDbkIsSUFBSSxDQUFDLFNBQVMsQ0FBQyxPQUFPLEVBQUUsQ0FBQztZQUN6QixJQUFJLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQztRQUN4QixDQUFDO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dGVDb21wb25lbnQoZmFjdG9yeSwgdGhpcy5sb2NhdGlvbi5sZW5ndGgsIGluaiwgW10pO1xuICB9XG59XG4iXX0=
|
|
@ -0,0 +1,7 @@
|
||||||
|
export { Router } from './router';
|
||||||
|
export { UrlSerializer, DefaultUrlSerializer } from './url_serializer';
|
||||||
|
export { RouterState, ActivatedRoute } from './router_state';
|
||||||
|
export { RouterOutletMap } from './router_outlet_map';
|
||||||
|
import { RouterOutlet } from './directives/router_outlet';
|
||||||
|
import { RouterLink } from './directives/router_link';
|
||||||
|
export declare const ROUTER_DIRECTIVES: (typeof RouterOutlet | typeof RouterLink)[];
|
|
@ -0,0 +1,15 @@
|
||||||
|
"use strict";
|
||||||
|
var router_1 = require('./router');
|
||||||
|
exports.Router = router_1.Router;
|
||||||
|
var url_serializer_1 = require('./url_serializer');
|
||||||
|
exports.UrlSerializer = url_serializer_1.UrlSerializer;
|
||||||
|
exports.DefaultUrlSerializer = url_serializer_1.DefaultUrlSerializer;
|
||||||
|
var router_state_1 = require('./router_state');
|
||||||
|
exports.RouterState = router_state_1.RouterState;
|
||||||
|
exports.ActivatedRoute = router_state_1.ActivatedRoute;
|
||||||
|
var router_outlet_map_1 = require('./router_outlet_map');
|
||||||
|
exports.RouterOutletMap = router_outlet_map_1.RouterOutletMap;
|
||||||
|
var router_outlet_1 = require('./directives/router_outlet');
|
||||||
|
var router_link_1 = require('./directives/router_link');
|
||||||
|
exports.ROUTER_DIRECTIVES = [router_outlet_1.RouterOutlet, router_link_1.RouterLink];
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHVCQUF1QixVQUFVLENBQUM7QUFBekIsaUNBQXlCO0FBQ2xDLCtCQUFvRCxrQkFBa0IsQ0FBQztBQUE5RCx1REFBYTtBQUFFLHFFQUErQztBQUN2RSw2QkFBNEMsZ0JBQWdCLENBQUM7QUFBcEQsaURBQVc7QUFBRSx1REFBdUM7QUFDN0Qsa0NBQWdDLHFCQUFxQixDQUFDO0FBQTdDLDhEQUE2QztBQUV0RCw4QkFBNkIsNEJBQTRCLENBQUMsQ0FBQTtBQUMxRCw0QkFBMkIsMEJBQTBCLENBQUMsQ0FBQTtBQUV6Qyx5QkFBaUIsR0FBRyxDQUFDLDRCQUFZLEVBQUUsd0JBQVUsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgUm91dGVyIH0gZnJvbSAnLi9yb3V0ZXInO1xuZXhwb3J0IHsgVXJsU2VyaWFsaXplciwgRGVmYXVsdFVybFNlcmlhbGl6ZXIgfSBmcm9tICcuL3VybF9zZXJpYWxpemVyJztcbmV4cG9ydCB7IFJvdXRlclN0YXRlLCBBY3RpdmF0ZWRSb3V0ZSB9IGZyb20gJy4vcm91dGVyX3N0YXRlJztcbmV4cG9ydCB7IFJvdXRlck91dGxldE1hcCB9IGZyb20gJy4vcm91dGVyX291dGxldF9tYXAnO1xuXG5pbXBvcnQgeyBSb3V0ZXJPdXRsZXQgfSBmcm9tICcuL2RpcmVjdGl2ZXMvcm91dGVyX291dGxldCc7XG5pbXBvcnQgeyBSb3V0ZXJMaW5rIH0gZnJvbSAnLi9kaXJlY3RpdmVzL3JvdXRlcl9saW5rJztcblxuZXhwb3J0IGNvbnN0IFJPVVRFUl9ESVJFQ1RJVkVTID0gW1JvdXRlck91dGxldCwgUm91dGVyTGlua107Il19
|
|
@ -0,0 +1,5 @@
|
||||||
|
import { UrlTree } from './url_tree';
|
||||||
|
import { RouterState } from './router_state';
|
||||||
|
import { RouterConfig } from './config';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
export declare function recognize(config: RouterConfig, url: UrlTree, existingState: RouterState): Observable<RouterState>;
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,40 @@
|
||||||
|
import { ComponentResolver } from '@angular/core';
|
||||||
|
import { Location } from '@angular/common';
|
||||||
|
import { UrlSerializer } from './url_serializer';
|
||||||
|
import { RouterOutletMap } from './router_outlet_map';
|
||||||
|
import { UrlTree } from './url_tree';
|
||||||
|
import { Params } from './shared';
|
||||||
|
import { RouterState, ActivatedRoute } from './router_state';
|
||||||
|
import { RouterConfig } from './config';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import 'rxjs/add/operator/map';
|
||||||
|
import 'rxjs/add/operator/mergeMap';
|
||||||
|
import 'rxjs/add/operator/toPromise';
|
||||||
|
export interface NavigationExtras {
|
||||||
|
relativeTo?: ActivatedRoute;
|
||||||
|
queryParameters?: Params;
|
||||||
|
fragment?: string;
|
||||||
|
}
|
||||||
|
export declare class Router {
|
||||||
|
private rootComponent;
|
||||||
|
private resolver;
|
||||||
|
private urlSerializer;
|
||||||
|
private outletMap;
|
||||||
|
private location;
|
||||||
|
private currentUrlTree;
|
||||||
|
private currentRouterState;
|
||||||
|
private config;
|
||||||
|
private locationSubscription;
|
||||||
|
constructor(rootComponent: Object, resolver: ComponentResolver, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location);
|
||||||
|
readonly routerState: RouterState;
|
||||||
|
readonly urlTree: UrlTree;
|
||||||
|
navigateByUrl(url: string): Observable<void>;
|
||||||
|
resetConfig(config: RouterConfig): void;
|
||||||
|
dispose(): void;
|
||||||
|
createUrlTree(commands: any[], {relativeTo, queryParameters, fragment}?: NavigationExtras): UrlTree;
|
||||||
|
navigate(commands: any[], extras?: NavigationExtras): Observable<void>;
|
||||||
|
serializeUrl(url: UrlTree): string;
|
||||||
|
parseUrl(url: string): UrlTree;
|
||||||
|
private setUpLocationChangeListener();
|
||||||
|
private runNavigate(url, pop?);
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,7 @@
|
||||||
|
import { RouterOutlet } from './directives/router_outlet';
|
||||||
|
export declare class RouterOutletMap {
|
||||||
|
_outlets: {
|
||||||
|
[name: string]: RouterOutlet;
|
||||||
|
};
|
||||||
|
registerOutlet(name: string, outlet: RouterOutlet): void;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
"use strict";
|
||||||
|
var RouterOutletMap = (function () {
|
||||||
|
function RouterOutletMap() {
|
||||||
|
this._outlets = {};
|
||||||
|
}
|
||||||
|
RouterOutletMap.prototype.registerOutlet = function (name, outlet) { this._outlets[name] = outlet; };
|
||||||
|
return RouterOutletMap;
|
||||||
|
}());
|
||||||
|
exports.RouterOutletMap = RouterOutletMap;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX291dGxldF9tYXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcm91dGVyX291dGxldF9tYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUtBO0lBQUE7UUFFRSxhQUFRLEdBQW1DLEVBQUUsQ0FBQztJQUVoRCxDQUFDO0lBREMsd0NBQWMsR0FBZCxVQUFlLElBQVksRUFBRSxNQUFvQixJQUFVLElBQUksQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLEdBQUcsTUFBTSxDQUFDLENBQUMsQ0FBQztJQUM1RixzQkFBQztBQUFELENBQUMsQUFKRCxJQUlDO0FBSlksdUJBQWUsa0JBSTNCLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBSb3V0ZXJPdXRsZXQgfSBmcm9tICcuL2RpcmVjdGl2ZXMvcm91dGVyX291dGxldCc7XG5cbi8qKlxuICogQGludGVybmFsXG4gKi9cbmV4cG9ydCBjbGFzcyBSb3V0ZXJPdXRsZXRNYXAge1xuICAvKiogQGludGVybmFsICovXG4gIF9vdXRsZXRzOiB7W25hbWU6IHN0cmluZ106IFJvdXRlck91dGxldH0gPSB7fTtcbiAgcmVnaXN0ZXJPdXRsZXQobmFtZTogc3RyaW5nLCBvdXRsZXQ6IFJvdXRlck91dGxldCk6IHZvaWQgeyB0aGlzLl9vdXRsZXRzW25hbWVdID0gb3V0bGV0OyB9XG59XG4iXX0=
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
|
import { UrlSegment } from './url_tree';
|
||||||
|
import { Params } from './shared';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { Type } from '@angular/core';
|
||||||
|
export declare class RouterState extends Tree<ActivatedRoute> {
|
||||||
|
queryParams: Observable<Params>;
|
||||||
|
fragment: Observable<string>;
|
||||||
|
constructor(root: TreeNode<ActivatedRoute>, queryParams: Observable<Params>, fragment: Observable<string>);
|
||||||
|
}
|
||||||
|
export declare function createEmptyState(rootComponent: Type): RouterState;
|
||||||
|
export declare class ActivatedRoute {
|
||||||
|
urlSegments: Observable<UrlSegment[]>;
|
||||||
|
params: Observable<Params>;
|
||||||
|
outlet: string;
|
||||||
|
component: Type | string;
|
||||||
|
constructor(urlSegments: Observable<UrlSegment[]>, params: Observable<Params>, outlet: string, component: Type | string);
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
"use strict";
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
var tree_1 = require('./utils/tree');
|
||||||
|
var url_tree_1 = require('./url_tree');
|
||||||
|
var shared_1 = require('./shared');
|
||||||
|
var BehaviorSubject_1 = require('rxjs/BehaviorSubject');
|
||||||
|
var RouterState = (function (_super) {
|
||||||
|
__extends(RouterState, _super);
|
||||||
|
function RouterState(root, queryParams, fragment) {
|
||||||
|
_super.call(this, root);
|
||||||
|
this.queryParams = queryParams;
|
||||||
|
this.fragment = fragment;
|
||||||
|
}
|
||||||
|
return RouterState;
|
||||||
|
}(tree_1.Tree));
|
||||||
|
exports.RouterState = RouterState;
|
||||||
|
function createEmptyState(rootComponent) {
|
||||||
|
var emptyUrl = new BehaviorSubject_1.BehaviorSubject([new url_tree_1.UrlSegment("", {}, shared_1.PRIMARY_OUTLET)]);
|
||||||
|
var emptyParams = new BehaviorSubject_1.BehaviorSubject({});
|
||||||
|
var emptyQueryParams = new BehaviorSubject_1.BehaviorSubject({});
|
||||||
|
var fragment = new BehaviorSubject_1.BehaviorSubject("");
|
||||||
|
var activated = new ActivatedRoute(emptyUrl, emptyParams, shared_1.PRIMARY_OUTLET, rootComponent);
|
||||||
|
return new RouterState(new tree_1.TreeNode(activated, []), emptyQueryParams, fragment);
|
||||||
|
}
|
||||||
|
exports.createEmptyState = createEmptyState;
|
||||||
|
var ActivatedRoute = (function () {
|
||||||
|
function ActivatedRoute(urlSegments, params, outlet, component) {
|
||||||
|
this.urlSegments = urlSegments;
|
||||||
|
this.params = params;
|
||||||
|
this.outlet = outlet;
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
return ActivatedRoute;
|
||||||
|
}());
|
||||||
|
exports.ActivatedRoute = ActivatedRoute;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX3N0YXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3JvdXRlcl9zdGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxxQkFBK0IsY0FBYyxDQUFDLENBQUE7QUFDOUMseUJBQTJCLFlBQVksQ0FBQyxDQUFBO0FBQ3hDLHVCQUF1QyxVQUFVLENBQUMsQ0FBQTtBQUVsRCxnQ0FBZ0Msc0JBQXNCLENBQUMsQ0FBQTtBQWtCdkQ7SUFBaUMsK0JBQW9CO0lBQ25ELHFCQUFZLElBQThCLEVBQVMsV0FBK0IsRUFBUyxRQUE0Qj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lxuICpcbiAqICMjIyBVc2FnZVxuICpcbiAqIGBgYFxuICogY2xhc3MgTXlDb21wb25lbnQge1xuICogICBjb25zdHJ1Y3Rvcihyb3V0ZTogQWN0aXZhdGVkUm91dGUpIHtcbiAqICAgICBjb25zdCBpZDogT2JzZXJ2YWJsZTxzdHJpbmc+ID0gcm91dGUucGFyYW1zLm1hcChwID0+IHAuaWQpO1xuICogICB9XG4gKiB9XG4gKiBgYGBcbiAqL1xuZXhwb3J0IGNsYXNzIEFjdGl2YXRlZFJvdXRlIHtcbiAgY29uc3RydWN0b3IocHVibGljIHVybFNlZ21lbnRzOiBPYnNlcnZhYmxlPFVybFNlZ21lbnRbXT4sXG4gICAgICAgICAgICAgIHB1YmxpYyBwYXJhbXM6IE9ic2VydmFibGU8UGFyYW1zPixcbiAgICAgICAgICAgICAgcHVibGljIG91dGxldDogc3RyaW5nLFxuICAgICAgICAgICAgICBwdWJsaWMgY29tcG9uZW50OiBUeXBlIHwgc3RyaW5nKSB7fVxufSJdfQ==
|
|
@ -0,0 +1,4 @@
|
||||||
|
export declare const PRIMARY_OUTLET: string;
|
||||||
|
export declare type Params = {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
|
@ -0,0 +1,3 @@
|
||||||
|
"use strict";
|
||||||
|
exports.PRIMARY_OUTLET = "PRIMARY_OUTLET";
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NoYXJlZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBSWEsc0JBQWMsR0FBVyxnQkFBZ0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogTmFtZSBvZiB0aGUgcHJpbWFyeSBvdXRsZXQuXG4gKiBAdHlwZSB7c3RyaW5nfVxuICovXG5leHBvcnQgY29uc3QgUFJJTUFSWV9PVVRMRVQ6IHN0cmluZyA9IFwiUFJJTUFSWV9PVVRMRVRcIjtcblxuLyoqXG4gKiBBIGNvbGxlY3Rpb24gb2YgcGFyYW1ldGVycy5cbiAqL1xuZXhwb3J0IHR5cGUgUGFyYW1zID0geyBba2V5OiBzdHJpbmddOiBzdHJpbmcgfTtcbiJdfQ==
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { UrlTree, UrlSegment } from './url_tree';
|
||||||
|
export declare abstract class UrlSerializer {
|
||||||
|
abstract parse(url: string): UrlTree;
|
||||||
|
abstract serialize(tree: UrlTree): string;
|
||||||
|
}
|
||||||
|
export declare class DefaultUrlSerializer implements UrlSerializer {
|
||||||
|
parse(url: string): UrlTree;
|
||||||
|
serialize(tree: UrlTree): string;
|
||||||
|
}
|
||||||
|
export declare function serializeSegment(segment: UrlSegment): string;
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,23 @@
|
||||||
|
import { Tree, TreeNode } from './utils/tree';
|
||||||
|
export declare function createEmptyUrlTree(): UrlTree;
|
||||||
|
export declare class UrlTree extends Tree<UrlSegment> {
|
||||||
|
queryParameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
fragment: string | null;
|
||||||
|
constructor(root: TreeNode<UrlSegment>, queryParameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
}, fragment: string | null);
|
||||||
|
}
|
||||||
|
export declare class UrlSegment {
|
||||||
|
path: string;
|
||||||
|
parameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
outlet: string;
|
||||||
|
constructor(path: string, parameters: {
|
||||||
|
[key: string]: string;
|
||||||
|
}, outlet: string);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
export declare function equalUrlSegments(a: UrlSegment[], b: UrlSegment[]): boolean;
|
|
@ -0,0 +1,56 @@
|
||||||
|
"use strict";
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
var tree_1 = require('./utils/tree');
|
||||||
|
var collection_1 = require('./utils/collection');
|
||||||
|
var shared_1 = require('./shared');
|
||||||
|
function createEmptyUrlTree() {
|
||||||
|
return new UrlTree(new tree_1.TreeNode(new UrlSegment("", {}, shared_1.PRIMARY_OUTLET), []), {}, null);
|
||||||
|
}
|
||||||
|
exports.createEmptyUrlTree = createEmptyUrlTree;
|
||||||
|
var UrlTree = (function (_super) {
|
||||||
|
__extends(UrlTree, _super);
|
||||||
|
function UrlTree(root, queryParameters, fragment) {
|
||||||
|
_super.call(this, root);
|
||||||
|
this.queryParameters = queryParameters;
|
||||||
|
this.fragment = fragment;
|
||||||
|
}
|
||||||
|
return UrlTree;
|
||||||
|
}(tree_1.Tree));
|
||||||
|
exports.UrlTree = UrlTree;
|
||||||
|
var UrlSegment = (function () {
|
||||||
|
function UrlSegment(path, parameters, outlet) {
|
||||||
|
this.path = path;
|
||||||
|
this.parameters = parameters;
|
||||||
|
this.outlet = outlet;
|
||||||
|
}
|
||||||
|
UrlSegment.prototype.toString = function () {
|
||||||
|
var params = [];
|
||||||
|
for (var prop in this.parameters) {
|
||||||
|
if (this.parameters.hasOwnProperty(prop)) {
|
||||||
|
params.push(prop + "=" + this.parameters[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var paramsString = params.length > 0 ? "(" + params.join(',') + ")" : '';
|
||||||
|
var outlet = this.outlet === shared_1.PRIMARY_OUTLET ? '' : this.outlet + ":";
|
||||||
|
return "" + outlet + this.path + paramsString;
|
||||||
|
};
|
||||||
|
return UrlSegment;
|
||||||
|
}());
|
||||||
|
exports.UrlSegment = UrlSegment;
|
||||||
|
function equalUrlSegments(a, b) {
|
||||||
|
if (a.length !== b.length)
|
||||||
|
return false;
|
||||||
|
for (var i = 0; i < a.length; ++i) {
|
||||||
|
if (a[i].path !== b[i].path)
|
||||||
|
return false;
|
||||||
|
if (!collection_1.shallowEqual(a[i].parameters, b[i].parameters))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
exports.equalUrlSegments = equalUrlSegments;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXJsX3RyZWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXJsX3RyZWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEscUJBQStCLGNBQWMsQ0FBQyxDQUFBO0FBQzlDLDJCQUE2QixvQkFBb0IsQ0FBQyxDQUFBO0FBQ2xELHVCQUErQixVQUFVLENBQUMsQ0FBQTtBQUUxQztJQUNFLE1BQU0sQ0FBQyxJQUFJLE9BQU8sQ0FBQyxJQUFJLGVBQVEsQ0FBYSxJQUFJLFVBQVUsQ0FBQyxFQUFFLEVBQUUsRUFBRSxFQUFFLHVCQUFjLENBQUMsRUFBRSxFQUFFLENBQUMsRUFBRSxFQUFFLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDckcsQ0FBQztBQUZlLDBCQUFrQixxQkFFakMsQ0FBQTtBQUtEO0lBQTZCLDJCQUFnQjtJQUMzQyxpQkFBWSxJQUEwQixFQUFTLGVBQXdDLEVBQVMsUUFBdUI7UUFDckgsa0JBQU0sSUFBSSxDQUFDLENBQUM7UUFEaUMsb0JBQWUsR0FBZixlQUFlLENBQXlCO1FBQVMsYUFBUSxHQUFSLFFBQVEsQ0FBZTtJQUV2SCxDQUFDO0lBQ0gsY0FBQztBQUFELENBQUMsQUFKRCxDQUE2QixXQUFJLEdBSWhDO0FBSlksZUFBTyxVQUluQixDQUFBO0FBRUQ7SUFDRSxvQkFBbUIsSUFBWSxFQUFTLFVBQW1DLEVBQVMsTUFBYztRQUEvRSxTQUFJLEdBQUosSUFBSSxDQUFRO1FBQVMsZUFBVSxHQ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CAhPT0gYi5sZW5ndGgpIHJldHVybiBmYWxzZTtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBhLmxlbmd0aDsgKytpKSB7XG4gICAgaWYgKGFbaV0ucGF0aCAhPT0gYltpXS5wYXRoKSByZXR1cm4gZmFsc2U7XG4gICAgaWYgKCFzaGFsbG93RXF1YWwoYVtpXS5wYXJhbWV0ZXJzLCBiW2ldLnBhcmFtZXRlcnMpKSByZXR1cm4gZmFsc2U7XG4gIH1cbiAgcmV0dXJuIHRydWU7XG59XG4iXX0=
|
|
@ -0,0 +1,17 @@
|
||||||
|
export declare function shallowEqual(a: {
|
||||||
|
[x: string]: any;
|
||||||
|
}, b: {
|
||||||
|
[x: string]: any;
|
||||||
|
}): boolean;
|
||||||
|
export declare function flatten<T>(a: T[][]): T[];
|
||||||
|
export declare function first<T>(a: T[]): T | null;
|
||||||
|
export declare function merge<V>(m1: {
|
||||||
|
[key: string]: V;
|
||||||
|
}, m2: {
|
||||||
|
[key: string]: V;
|
||||||
|
}): {
|
||||||
|
[key: string]: V;
|
||||||
|
};
|
||||||
|
export declare function forEach<K, V>(map: {
|
||||||
|
[key: string]: V;
|
||||||
|
}, callback: Function): void;
|
|
@ -0,0 +1,55 @@
|
||||||
|
"use strict";
|
||||||
|
function shallowEqual(a, b) {
|
||||||
|
var k1 = Object.keys(a);
|
||||||
|
var k2 = Object.keys(b);
|
||||||
|
if (k1.length != k2.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var key;
|
||||||
|
for (var i = 0; i < k1.length; i++) {
|
||||||
|
key = k1[i];
|
||||||
|
if (a[key] !== b[key]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
exports.shallowEqual = shallowEqual;
|
||||||
|
function flatten(a) {
|
||||||
|
var target = [];
|
||||||
|
for (var i = 0; i < a.length; ++i) {
|
||||||
|
for (var j = 0; j < a[i].length; ++j) {
|
||||||
|
target.push(a[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
exports.flatten = flatten;
|
||||||
|
function first(a) {
|
||||||
|
return a.length > 0 ? a[0] : null;
|
||||||
|
}
|
||||||
|
exports.first = first;
|
||||||
|
function merge(m1, m2) {
|
||||||
|
var m = {};
|
||||||
|
for (var attr in m1) {
|
||||||
|
if (m1.hasOwnProperty(attr)) {
|
||||||
|
m[attr] = m1[attr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var attr in m2) {
|
||||||
|
if (m2.hasOwnProperty(attr)) {
|
||||||
|
m[attr] = m2[attr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
exports.merge = merge;
|
||||||
|
function forEach(map, callback) {
|
||||||
|
for (var prop in map) {
|
||||||
|
if (map.hasOwnProperty(prop)) {
|
||||||
|
callback(map[prop], prop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.forEach = forEach;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy91dGlscy9jb2xsZWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxzQkFBNkIsQ0FBbUIsRUFBRSxDQUFtQjtJQUNuRSxJQUFJLEVBQUUsR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ3hCLElBQUksRUFBRSxHQUFHLE1BQU0sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDeEIsRUFBRSxDQUFDLENBQUMsRUFBRSxDQUFDLE1BQU0sSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQztRQUMzQixNQUFNLENBQUMsS0FBSyxDQUFDO0lBQ2Ys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BzdHJpbmddOiBWfSwgbTI6IHtba2V5OiBzdHJpbmddOiBWfSk6IHtba2V5OiBzdHJpbmddOiBWfSB7XG4gIHZhciBtOiB7W2tleTogc3RyaW5nXTogVn0gPSB7fTtcblxuICBmb3IgKHZhciBhdHRyIGluIG0xKSB7XG4gICAgaWYgKG0xLmhhc093blByb3BlcnR5KGF0dHIpKSB7XG4gICAgICBtW2F0dHJdID0gbTFbYXR0cl07XG4gICAgfVxuICB9XG5cbiAgZm9yICh2YXIgYXR0ciBpbiBtMikge1xuICAgIGlmIChtMi5oYXNPd25Qcm9wZXJ0eShhdHRyKSkge1xuICAgICAgbVthdHRyXSA9IG0yW2F0dHJdO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiBtO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gZm9yRWFjaDxLLCBWPihtYXA6IHtba2V5OiBzdHJpbmddOiBWfSwgY2FsbGJhY2s6IC8qKFYsIEspID0+IHZvaWQqLyBGdW5jdGlvbik6IHZvaWQge1xuICBmb3IgKHZhciBwcm9wIGluIG1hcCkge1xuICAgIGlmIChtYXAuaGFzT3duUHJvcGVydHkocHJvcCkpIHtcbiAgICAgIGNhbGxiYWNrKG1hcFtwcm9wXSwgcHJvcCk7XG4gICAgfVxuICB9XG59Il19
|
|
@ -0,0 +1,17 @@
|
||||||
|
export declare class Tree<T> {
|
||||||
|
_root: TreeNode<T>;
|
||||||
|
constructor(root: TreeNode<T>);
|
||||||
|
readonly root: T;
|
||||||
|
parent(t: T): T | null;
|
||||||
|
children(t: T): T[];
|
||||||
|
firstChild(t: T): T | null;
|
||||||
|
siblings(t: T): T[];
|
||||||
|
pathFromRoot(t: T): T[];
|
||||||
|
contains(tree: Tree<T>): boolean;
|
||||||
|
}
|
||||||
|
export declare function rootNode<T>(tree: Tree<T>): TreeNode<T>;
|
||||||
|
export declare class TreeNode<T> {
|
||||||
|
value: T;
|
||||||
|
children: TreeNode<T>[];
|
||||||
|
constructor(value: T, children: TreeNode<T>[]);
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -2,8 +2,8 @@
|
||||||
"name": "vladivostok",
|
"name": "vladivostok",
|
||||||
"version": "0.9.1",
|
"version": "0.9.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./dist/src/index.js",
|
"main": "./build/src/index.js",
|
||||||
"jsnext:main": "./dist/es6/index.js",
|
"jsnext:main": "./build/es6/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"karma": "karma start",
|
"karma": "karma start",
|
||||||
"test": "npm run build; karma start",
|
"test": "npm run build; karma start",
|
||||||
|
@ -64,5 +64,5 @@
|
||||||
"typings": "^1.0.4",
|
"typings": "^1.0.4",
|
||||||
"zone.js": "^0.6.6"
|
"zone.js": "^0.6.6"
|
||||||
},
|
},
|
||||||
"typings": "dist/router.d.ts"
|
"typings": "build/src/index.d.ts"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue