🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
104 lines
2.9 KiB
TypeScript
Executable File
104 lines
2.9 KiB
TypeScript
Executable File
/**
|
|
* Core Router implementation for JQHTML v2
|
|
*/
|
|
import type { RouteInfo, RouterState, DispatchOptions, ParsedUrl } from './types';
|
|
export declare class Jqhtml_Router {
|
|
static state: RouterState;
|
|
private static routes;
|
|
private static layouts;
|
|
private static initialized;
|
|
private static ctrl_pressed;
|
|
private static is_expired;
|
|
private static first_url;
|
|
private static current_url;
|
|
private static current_hash;
|
|
private static default_layout;
|
|
private static app;
|
|
private static current_route_info;
|
|
private static current_layout;
|
|
private static current_route;
|
|
private static use_hash_routing;
|
|
private static is_dispatching;
|
|
private static ignore_next_hashchange;
|
|
/**
|
|
* Register a route
|
|
*/
|
|
static register_route(path: string, component_name: string, component_class: any): void;
|
|
/**
|
|
* Register a layout
|
|
*/
|
|
static register_layout(name: string, component_class: any): void;
|
|
/**
|
|
* Parse a URL into components
|
|
*/
|
|
static parse_url(url: string, base?: string): ParsedUrl;
|
|
/**
|
|
* Match a URL to a route and extract parameters
|
|
*/
|
|
static match_url_to_route(url: string): RouteInfo | null;
|
|
/**
|
|
* Convert object to query string
|
|
*/
|
|
static serialize(params: Record<string, any>): string;
|
|
/**
|
|
* Parse query string to object
|
|
*/
|
|
static deserialize(search: string): Record<string, any>;
|
|
/**
|
|
* Generate URL for a route with parameters
|
|
*/
|
|
static url(route_name: string, params?: Record<string, any>): string;
|
|
/**
|
|
* Build URL from pattern and parameters
|
|
*/
|
|
static build_url(pattern: string, params: Record<string, any>): string;
|
|
/**
|
|
* Get current URL
|
|
*/
|
|
static get_current_url(): string;
|
|
/**
|
|
* Get current hash
|
|
*/
|
|
static get_current_hash(): string;
|
|
/**
|
|
* Check if in development mode
|
|
*/
|
|
private static is_dev;
|
|
/**
|
|
* Get all registered routes (for debugging)
|
|
*/
|
|
static get_routes(): Array<{
|
|
path: string;
|
|
component_name: string;
|
|
}>;
|
|
/**
|
|
* Set the default layout name
|
|
*/
|
|
static set_default_layout(layout_name: string): void;
|
|
/**
|
|
* Set the SPA app instance
|
|
*/
|
|
static set_app(app: any): void;
|
|
/**
|
|
* Initialize the router
|
|
* Sets up browser event handlers
|
|
*/
|
|
static init(): Promise<void>;
|
|
/**
|
|
* Setup browser integration for link interception and history
|
|
*/
|
|
private static setup_browser_integration;
|
|
/**
|
|
* Main dispatch method - handles navigation
|
|
*/
|
|
static dispatch(url: string, options?: DispatchOptions): Promise<void>;
|
|
/**
|
|
* Navigate and replace current history entry
|
|
*/
|
|
static redirect(url: string): void;
|
|
/**
|
|
* Navigate and replace current history entry
|
|
*/
|
|
static replace(url: string): void;
|
|
}
|
|
//# sourceMappingURL=router.d.ts.map
|