diff --git a/core/src/components/nav/nav.tsx b/core/src/components/nav/nav.tsx index 7552bc11b6..192c745367 100644 --- a/core/src/components/nav/nav.tsx +++ b/core/src/components/nav/nav.tsx @@ -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({ diff --git a/core/src/components/router/router.tsx b/core/src/components/router/router.tsx index 769b398779..3155db25cb 100644 --- a/core/src/components/router/router.tsx +++ b/core/src/components/router/router.tsx @@ -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'; diff --git a/core/src/components/router/utils/constants.ts b/core/src/components/router/utils/constants.ts new file mode 100644 index 0000000000..75de3b7d3e --- /dev/null +++ b/core/src/components/router/utils/constants.ts @@ -0,0 +1,6 @@ + +export const enum RouterIntent { + None = 0, + Forward = 1, + Back = -1, +} diff --git a/core/src/components/router/utils/dom.ts b/core/src/components/router/utils/dom.ts index 15c1309dc1..e878412471 100644 --- a/core/src/components/router/utils/dom.ts +++ b/core/src/components/router/utils/dom.ts @@ -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 { try { diff --git a/core/src/components/router/utils/interface.ts b/core/src/components/router/utils/interface.ts index aebeb2f2cf..01c41d58a0 100644 --- a/core/src/components/router/utils/interface.ts +++ b/core/src/components/router/utils/interface.ts @@ -1,6 +1,7 @@ +import * as c from './constants'; export interface NavOutlet { - setRouteId(id: string, data: any, direction: RouterIntent): Promise; + setRouteId(id: string, data: any, direction: c.RouterIntent): Promise; 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[]; diff --git a/core/src/components/router/utils/path.ts b/core/src/components/router/utils/path.ts index fea0cb492a..ca6537dc6f 100644 --- a/core/src/components/router/utils/path.ts +++ b/core/src/components/router/utils/path.ts @@ -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