mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(router): move RouterIntent out of interface
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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';
|
||||
|
||||
6
core/src/components/router/utils/constants.ts
Normal file
6
core/src/components/router/utils/constants.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
export const enum RouterIntent {
|
||||
None = 0,
|
||||
Forward = 1,
|
||||
Back = -1,
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user