UNPKG

@wroud/navigation

Version:

A flexible, pattern-matching navigation system for JavaScript applications with built-in routing, browser integration, and navigation state management

52 lines 1.68 kB
import type { NodeType } from "./types.js"; /** * TrieNode represents a node in the pattern matching trie */ export declare class TrieNode { readonly type: NodeType; readonly name: string; readonly children: Map<string, TrieNode>; paramChild: TrieNode | null; wildcardChild: TrieNode | null; /** Type of the parameter for param/wildcard nodes */ paramType: string; isEndOfPattern: boolean; pattern: string | null; parent: TrieNode | null; constructor(type?: NodeType, name?: string, parent?: TrieNode | null, paramType?: string); /** * Mark this node as the end of a pattern */ markAsPatternEnd(pattern: string): this; /** * Get a static child node by segment name */ getStaticChild(segment: string): TrieNode | undefined; /** * Check if this node has a static child for the given segment */ hasStaticChild(segment: string): boolean; /** * Add a static child node for the given segment */ addStaticChild(segment: string): TrieNode; /** * Get or create a parameter child node * * @param paramName Parameter name * @param paramType Declared parameter type */ getOrCreateParamChild(paramName: string, paramType: string): TrieNode; /** * Get or create a wildcard child node * * @param wildcardName Parameter name for the wildcard * @param paramType Declared parameter type */ getOrCreateWildcardChild(wildcardName: string, paramType: string): TrieNode; /** * Find all patterns that are ancestors of this node */ findAncestorPatterns(): string[]; } //# sourceMappingURL=TrieNode.d.ts.map