ngx-dynamic-hooks
Version:
Automatically insert live Angular components into a dynamic string of content (based on their selector or any pattern of your choice) and render the result in the DOM.
99 lines (98 loc) • 3.59 kB
TypeScript
import * as i0 from "@angular/core";
/**
* A service that provides various functions for en- and decoding data type strings in order to make them
* meaningfully parseable by regex
*/
export declare class DataTypeEncoder {
/**
* Finds all substrings in a piece of text and replaces all special characters within with @@@...@@@-placeholders.
*
* @param text - The text to parse for substrings
*/
encodeSubstrings(text: string): string;
/**
* Encodes all special characters that might be confused as code syntax in a piece of string
*
* @param text - The text to encode
*/
encodeStringSpecialChars(text: string): string;
/**
* Decodes the special characters again
*
* @param text - The text to decode
*/
decodeStringSpecialChars(text: string): string;
/**
* Finds all subfunctions in a piece of text and replaces their round brackets with @@@...@@@-placeholders.
*
* @param text - The text to parse for substrings
*/
encodeSubfunctions(text: string): string;
/**
* Encodes all round brackets with harmless placeholders
*
* @param text - The text to encode
*/
encodeFunctionBrackets(text: string): string;
/**
* Decodes all round brackets again
*
* @param text - The text to decode
*/
decodeFunctionBrackets(text: string): string;
/**
* Finds all subbrackets in a piece of text and replaces their brackets with @@@...@@@-placeholders.
*
* @param text - The text to parse for substrings
*/
encodeVariableSubbrackets(text: string): string;
/**
* Encodes all brackets with harmless placeholders
*
* @param text - The text to encode
*/
encodeVariableBrackets(text: string): string;
/**
* Decodes all brackets again
*
* @param text - The text to encode
*/
decodeVariableBrackets(text: string): string;
/**
* Transforms a context var (that is already encoded for substrings, subfunctions and subbrackets) into a string placeholder
* by encoding the context var syntax itself. This is so that can be safely parsed by JSON.parse() as a string and also so it
* won't be misinterpreted by other regexes looking for JSON syntax (especially arrays b/c of context-var []-property-brackets)
*
* @param contextVar - The context var to transform
*/
transformContextVarIntoPlacerholder(contextVar: string): string;
/**
* Transforms a context var placeholder back into the actual context var
*
* @param contextVar - The placeholder context var
*/
transformPlaceholderIntoContextVar(contextVar: string): string;
/**
* Takes a piece of text as well as array of TextSegments and encodes them with the help of an encodingFunction
* The encoded text is then automatically assembled and returned.
*
* @param text - The text in question
* @param specialTextSegments - The segments in the text to encode
* @param encodingFunction - The encoding function to use
*/
private encodeTextSegments;
/**
* Strips all escaping backslashes from a piece of text
*
* @param text - The text in question
*/
stripSlashes(text: string): string;
/**
* Escapes all double quotes in a piece of text
*
* @param text - The text in question
*/
escapeDoubleQuotes(text: string): string;
static ɵfac: i0.ɵɵFactoryDeclaration<DataTypeEncoder, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DataTypeEncoder>;
}