@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
54 lines (53 loc) • 2.11 kB
TypeScript
import { ESLBaseElement } from '../../esl-base-element/core';
export declare class ESLRandomText extends ESLBaseElement {
static readonly is = "esl-random-text";
static readonly observedAttributes: string[];
/** Last used word index in dictionary */
protected static pointer: number;
/** Words dictionary to use in random text generation. */
static DICTIONARY: string[];
/** Number of words in sentence */
static readonly WORDS_PER_SENTENCE = 10;
/** Number of words in paragraph */
static readonly WORDS_PER_PARAGRAPH = 100;
/** Choose words randomly from {@link DICTIONARY} rather than sequentially */
shuffle: boolean;
/** Maximum number of paragraphs in generated text */
paragraphs: number;
/** Maximum number of words in paragraph */
wordsPerParagraph: number;
/** Redraws random text content */
refresh(): void;
protected connectedCallback(): void;
protected disconnectedCallback(): void;
protected attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
/**
* Generates a dummy word.
* @param random - choose word randomly from {@link DICTIONARY} rather than sequentially
*/
protected static generateWord(random?: boolean): string;
/**
* Builds a dummy text
* @param words - number of words in text
* @param shuffle - shuffle words randomly
*/
protected static buildText(words: number, shuffle?: boolean): string;
/**
* Generates a dummy text.
* @param words - number of words in text
* @param shuffle - shuffle words randomly
*/
static generateText(words: number, shuffle?: boolean): string;
/**
* Generates a dummy text.
* @param words - number of words in text
* @param wordsPerParagraph - number of words in paragraph
* @param shuffle - shuffle words randomly
*/
static generateTextHTML(words?: number, wordsPerParagraph?: number, shuffle?: boolean): string;
}
declare global {
export interface HTMLElementTagNameMap {
'esl-random-text': ESLRandomText;
}
}