chore(router): move RouterIntent out of interface

This commit is contained in:
Adam Bradley
2018-06-08 10:16:02 -05:00
parent 51c2aa69a2
commit 0f4ed8162a
6 changed files with 14 additions and 11 deletions

View File

@@ -3,9 +3,10 @@ import { ViewLifecycle } from '../..';
import {
Animation, ComponentProps, Config, FrameworkDelegate, GestureDetail, Mode,
NavComponent, NavOptions, NavOutlet, NavResult, QueueController, RouteID,
RouteWrite, RouterIntent, TransitionDoneFn, TransitionInstruction } from '../../interface';
RouteWrite, TransitionDoneFn, TransitionInstruction } from '../../interface';
import { assert } from '../../utils/helpers';
import { TransitionOptions, lifecycle, transition } from '../../utils/transition';
import { RouterIntent } from '../router/utils/constants';
import { ViewController, ViewState, convertToViews, matches } from './view-controller';
@Component({

View File

@@ -1,6 +1,7 @@
import { Component, Element, Event, EventEmitter, Listen, Method, Prop } from '@stencil/core';
import { Config, QueueController, RouteChain, RouterDirection, RouterEventDetail, RouterIntent } from '../../interface';
import { Config, QueueController, RouteChain, RouterDirection, RouterEventDetail } from '../../interface';
import { debounce } from '../../utils/helpers';
import { RouterIntent } from './utils/constants';
import { printRedirects, printRoutes } from './utils/debug';
import { readNavState, waitUntilNavNode, writeNavState } from './utils/dom';
import { routeRedirect, routerIDsToChain, routerPathToChain } from './utils/matching';

View File

@@ -0,0 +1,6 @@
export const enum RouterIntent {
None = 0,
Forward = 1,
Back = -1,
}

View File

@@ -1,5 +1,5 @@
import { NavOutletElement, RouteChain, RouteID } from '../../../interface';
import { RouterIntent } from './interface';
import { RouterIntent } from './constants';
export async function writeNavState(root: HTMLElement | undefined, chain: RouteChain, intent: RouterIntent, index: number, changed = false): Promise<boolean> {
try {

View File

@@ -1,6 +1,7 @@
import * as c from './constants';
export interface NavOutlet {
setRouteId(id: string, data: any, direction: RouterIntent): Promise<RouteWrite>;
setRouteId(id: string, data: any, direction: c.RouterIntent): Promise<RouteWrite>;
getRouteId(): RouteID|undefined;
}
@@ -12,12 +13,6 @@ export interface RouterEventDetail {
export type RouterDirection = 'forward' | 'back' | 'root';
export const enum RouterIntent {
None = 0,
Forward = 1,
Back = -1,
}
export interface RouteRedirect {
from: string[];
to?: string[];

View File

@@ -1,5 +1,5 @@
import { RouteChain } from '../../../interface';
import { RouterIntent } from './interface';
import { RouterIntent } from './constants';
export function generatePath(segments: string[]): string {
const path = segments