CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-ionic--vue-router

Vue Router integration for @ionic/vue with Ionic-specific navigation features

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

types.mddocs/

Types and Interfaces

Complete TypeScript type definitions for all router functionality including route information, navigation parameters, and view management.

Core Types

Router Options

Configuration options for creating an Ionic Vue Router.

interface IonicVueRouterOptions extends RouterOptions {
  /** 
   * Optional prefix for tab-based routes. When set, routes starting with this prefix
   * will be treated as tab routes for navigation context
   */
  tabsPrefix?: string;
}

Route Actions and Directions

Type definitions for navigation actions and directions.

/**
 * Type of router action being performed
 */
type RouteAction = "push" | "pop" | "replace";

/**
 * Direction of navigation for animations and transitions
 */
type RouteDirection = "forward" | "back" | "root" | "none";

Route Information

RouteInfo Interface

Comprehensive information about a route including navigation context.

interface RouteInfo {
  /** Unique identifier for the route instance */
  id?: string;
  
  /** Type of navigation action that brought us to this route */
  routerAction?: RouteAction;
  
  /** Direction of navigation for animations */
  routerDirection?: RouteDirection;
  
  /** Custom animation builder for transitions */
  routerAnimation?: AnimationBuilder;
  
  /** Current route pathname */
  pathname?: string;
  
  /** Query string parameters */
  search?: string;
  
  /** Route parameters object */
  params?: { [k: string]: any };
  
  /** 
   * The previous route you were on if you were to navigate backwards 
   * in a linear manner (i.e., browser back button)
   */
  lastPathname?: string;
  
  /** Last pathname of the previous route */
  prevRouteLastPathname?: string;
  
  /** 
   * The route that pushed the current route, used to determine if a route 
   * can swipe to go back to a previous route
   */
  pushedByRoute?: string;
  
  /** Tab context for the route */
  tab?: string;
  
  /** Position in browser history */
  position?: number;
  
  /** History delta for navigation */
  delta?: number;
}

Route Parameters

Parameters for programmatic navigation.

interface RouteParams {
  /** Type of navigation action to perform */
  routerAction: RouteAction;
  
  /** Direction of navigation */
  routerDirection: RouteDirection;
  
  /** Optional custom animation builder */
  routerAnimation?: AnimationBuilder;
  
  /** Optional tab context */
  tab?: string;
  
  /** Optional route identifier */
  id?: string;
}

External Navigation Options

Options for external navigation calls.

interface ExternalNavigationOptions {
  /** Route path to navigate to */
  routerLink: string;
  
  /** Optional navigation direction */
  routerDirection?: RouteDirection;
  
  /** Optional custom animation */
  routerAnimation?: AnimationBuilder;
  
  /** Optional navigation action */
  routerAction?: RouteAction;
}

Navigation Information

Information about current navigation state.

interface NavigationInformation {
  /** Current navigation action */
  action?: RouteAction;
  
  /** Current navigation direction */
  direction?: RouteDirection;
  
  /** History delta for the navigation */
  delta?: number;
}

View Management Types

ViewItem Interface

Represents a view in the navigation stack with component data.

interface ViewItem {
  /** Unique identifier for the view */
  id: string;
  
  /** Pathname for the view */
  pathname: string;
  
  /** Outlet identifier for the view */
  outletId: number;
  
  /** Matched route from Vue Router */
  matchedRoute: RouteLocationMatched;
  
  /** Optional ion-page HTML element */
  ionPageElement?: HTMLElement;
  
  /** Vue component instance */
  vueComponent: any;
  
  /** Whether this is an Ionic route */
  ionRoute: boolean;
  
  /** Whether the view should be mounted */
  mount: boolean;
  
  /** Whether this is an exact route match */
  exact: boolean;
  
  /** Optional callback for view registration */
  registerCallback?: () => void;
  
  /** Vue component reference */
  vueComponentRef: Ref;
  
  /** Route parameters */
  params?: { [k: string]: any };
  
  /** Vue component data cache */
  vueComponentData: VueComponentData;
  
  /** Optional animation for the view */
  routerAnimation?: AnimationBuilder;
}

View Stacks

Collection of view stacks keyed by outlet ID.

interface ViewStacks {
  [k: string]: ViewItem[];
}

Vue Component Data

Cached data for Vue components in views.

interface VueComponentData {
  /**
   * The cached result of the props function for a particular view instance
   */
  propsFunctionResult?: any;
}

Import Types

These types are re-exported from dependencies for convenience:

// From @ionic/vue
type AnimationBuilder = (baseEl: any, opts?: any) => Animation;

// From vue
type Ref<T = any> = { value: T };

// From vue-router  
type RouteLocationRaw = string | RouteLocationNamedRaw | RouteLocationPathRaw;
type RouteLocationMatched = RouteRecordNormalized & { components?: Record<string, Component> };
type RouterOptions = { history: RouterHistory; routes: RouteRecordRaw[]; [key: string]: any };
type RouterHistory = { base: string; location: string; [key: string]: any };

Note: These dependency types are used by @ionic/vue-router but are not directly exported. Import them from their respective packages:

import type { RouteLocationRaw, RouterOptions } from 'vue-router';
import type { AnimationBuilder } from '@ionic/vue';
import type { Ref } from 'vue';

docs

index.md

navigation-management.md

router-creation.md

types.md

view-stacks.md

tile.json