UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

148 lines 4.5 kB
import { PathComponents, PathPositions, LowHigh, PathType } from '../type'; /** * PathComponentsImpl implements the PathComponents interface * Represents the parsed components of a path with position information */ export declare class PathComponentsImpl implements PathComponents { readonly original: string; readonly normalized: string; readonly positions: PathPositions; readonly identifiers: LowHigh[]; readonly bundleType: PathType; readonly disabled: boolean; readonly component?: string | undefined; constructor(original: string, normalized: string, positions: PathPositions, identifiers: LowHigh[], bundleType: PathType, disabled?: boolean, component?: string | undefined); /** * Create a new PathComponents with updated bundle type */ withBundleType(bundleType: PathType): PathComponents; /** * Create a new PathComponents with disabled flag */ withDisabled(disabled: boolean): PathComponents; /** * Check if this path has any identifiers */ hasIdentifiers(): boolean; /** * Get the first identifier (usually the file extension) */ firstIdentifier(): LowHigh | null; /** * Get the last identifier */ lastIdentifier(): LowHigh | null; /** * Get identifier at specific index */ getIdentifier(index: number): LowHigh | null; /** * Check if this is a content component */ isContentComponent(component: string): boolean; /** * Create a copy of PathComponents */ clone(): PathComponents; /** * Convert to string representation for debugging */ toString(): string; } /** * PathPositionsImpl implements the PathPositions interface */ export declare class PathPositionsImpl implements PathPositions { containerLow: number; containerHigh: number; sectionHigh: number; identifierLanguage: number; constructor(containerLow?: number, containerHigh?: number, sectionHigh?: number, identifierLanguage?: number); /** * Reset all positions to default values */ reset(): void; /** * Check if container positions are set */ hasContainer(): boolean; /** * Check if section position is set */ hasSection(): boolean; /** * Check if language identifier position is set */ hasLanguageIdentifier(): boolean; /** * Create a copy of PathPositions */ clone(): PathPositions; } /** * LowHighImpl implements the LowHigh interface */ export declare class LowHighImpl implements LowHigh { readonly low: number; readonly high: number; constructor(low: number, high: number); /** * Get the length of the range */ length(): number; /** * Check if the range is empty */ isEmpty(): boolean; /** * Check if a position is within this range */ contains(position: number): boolean; /** * Create a substring from the given string using this range */ substring(str: string): string; /** * Convert to string representation */ toString(): string; } /** * Factory functions for creating path components */ export declare class PathComponentsFactory { /** * Create empty PathComponents */ static createEmpty(original?: string, bundleType?: PathType): PathComponents; /** * Create PathComponents from basic information */ static create(original: string, normalized?: string, bundleType?: PathType): PathComponents; /** * Create PathComponents with full information */ static createFull(original: string, normalized: string, positions: PathPositions, identifiers: LowHigh[], bundleType: PathType, disabled?: boolean): PathComponents; } /** * Utility functions for working with path components */ export declare class PathComponentsUtils { /** * Extract string value using LowHigh range */ static extractString(str: string, range: LowHigh): string; /** * Extract multiple string values using LowHigh ranges */ static extractStrings(str: string, ranges: LowHigh[]): string[]; /** * Find identifier index by position */ static findIdentifierIndex(identifiers: LowHigh[], position: number): number; /** * Merge two PathComponents (useful for inheritance scenarios) */ static merge(base: PathComponents, override: Partial<PathComponents>): PathComponents; } //# sourceMappingURL=pathcomponents.d.ts.map