UNPKG

xloss

Version:

Frontend web package built with TypeScript

86 lines (85 loc) 2.91 kB
/** * XLoss - Utility for creating custom elements with hidden content * Anti-scraping mechanism that renders content via CSS ::before pseudo-elements */ import { RootCSSVars } from "./helpers"; export declare const globalCSSVars: RootCSSVars; export declare const htmlElements: string[]; export declare const cssClass: string[]; export declare const cssProperties: Array<Record<string, string>>; export declare const allXelements: string[]; export declare const allXContent: string[]; /** * Returns the current state of all XLoss elements and content * @returns Object containing all tracked XLoss data */ export declare function getActualX(): { htmlElements: string[]; cssClass: string[]; cssProperties: Record<string, string>[]; allXelements: string[]; allXContent: string[]; }; /** * Add a single CSS variable to the global root * @param name - Variable name (without --) * @param value - Variable value */ export declare function addCSSVar(name: string, value: string): void; /** * Add multiple CSS variables to the global root * @param variables - Object with variable names and values */ export declare function addCSSVars(variables: Record<string, string>): void; /** * Update an existing CSS variable * @param name - Variable name * @param value - New value */ export declare function updateCSSVar(name: string, value: string): void; /** * Remove a CSS variable * @param name - Variable name to remove */ export declare function removeCSSVar(name: string): void; /** * Get all current CSS variables * @returns Object with all CSS variables */ export declare function getAllCSSVars(): Record<string, string>; /** * Check if a CSS variable exists * @param name - Variable name to check * @returns Boolean indicating if the variable exists */ export declare function hasCSSVar(name: string): boolean; /** * Clear all CSS variables */ export declare function clearAllCSSVars(): void; /** * Creates a custom element with content rendered via CSS ::before pseudo-element * * @param content - Text content to display in the ::before pseudo-element * @param cssPropertiesStr - CSS properties string to apply to the element * @param moreContent - Additional HTML content to add inside the element * @param id - Optional target element ID (defaults to "body") * @returns Object containing all tracked XLoss data */ export declare function XLoss(content: string, cssPropertiesStr: string, moreContent: string, id?: string): Promise<{ htmlElements: string[]; cssClass: string[]; cssProperties: Record<string, string>[]; allXelements: string[]; allXContent: string[]; }>; declare const _default: { XLoss: typeof XLoss; getActualX: typeof getActualX; htmlElements: string[]; cssClass: string[]; cssProperties: Record<string, string>[]; allXelements: string[]; allXContent: string[]; }; export default _default;