UNPKG

@osaedasia/oresume

Version:

A user-friendly library for generating complete Single Page Applications (SPAs)

43 lines (42 loc) 1.96 kB
import { Pattern } from "../../types/Pattern"; /** * Interface representing a pattern service for handling and transforming HTML content and attributes markers. * Provides methods for pattern creation, matching, and processing within HTML context. */ export interface IPatternService { /** * @returns {RegExp} A regular expression for matching pattern markers in content. */ getPatternRegex(): RegExp; /** * @returns {RegExp} A regular expression for matching pattern markers in attribute values. */ getAttributeValueRegex(): RegExp; /** * Generates a pattern marker string using the specified index. * @param {number} index - The numeric identifier for the pattern marker. * @returns {string} The generated pattern marker string. */ createPatternMarker(index: number): string; /** * Creates a Pattern object that can be either a FunctionPattern or ObserverPattern. * @param {number} index - The numeric identifier for the pattern. * @param {unknown} value - The value to be associated with the pattern. * @returns {Pattern|null} A Pattern object if creation succeeds, null otherwise. */ createPatternObject(index: number, value: unknown): Pattern | null; /** * Processes pattern matches found in HTML attributes. * @param {RegExpMatchArray} match - The regular expression match results. * @param {Pattern} pattern - The pattern object for processing. * @returns {string} The processed attribute value. */ handleAttributeMatch(match: RegExpMatchArray, pattern: Pattern): string; /** * Processes pattern matches found in HTML content. * @param {RegExpMatchArray} match - The regular expression match results. * @param {Pattern} pattern - The pattern object for processing. * @returns {string} The processed content value. */ handleContentMatch(match: RegExpMatchArray, pattern: Pattern): string; }