UNPKG

tiny-essentials

Version:

Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.

57 lines 2.35 kB
export default TinyHtmlStyle; /** * TinyHtmlStyle is a lightweight helper class for managing <style> elements. * It provides a simple API to configure attributes like `media`, `nonce`, * `blocking`, and `title`, while extending TinyHtmlTemplate for DOM operations. * * @example * const style = new TinyHtmlStyle({ * media: 'screen and (max-width: 600px)', * blocking: 'render', * }); * style.content = 'body { background: pink; }'; * * @extends TinyHtmlTemplate<HTMLStyleElement> */ declare class TinyHtmlStyle extends TinyHtmlTemplate<HTMLStyleElement> { /** * Creates a new TinyHtmlStyle instance. * @param {Object} config - Configuration object. * @param {string} [config.blocking] - Space-separated list of blocking tokens (currently only `"render"` is valid). * @param {string} [config.media="all"] - Media query that the stylesheet applies to. Defaults to `"all"`. * @param {string} [config.nonce] - Cryptographic nonce used in Content-Security-Policy for inline styles. * @param {string} [config.title] - Specifies an alternate style sheet set. * @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes. * @param {string} [config.mainClass=""] - Main CSS class to apply. */ constructor({ blocking, media, nonce, title, tags, mainClass }?: { blocking?: string | undefined; media?: string | undefined; nonce?: string | undefined; title?: string | undefined; tags?: string | string[] | Set<string> | undefined; mainClass?: string | undefined; }); /** @param {string} blocking */ set blocking(blocking: string); /** @returns {string|null} */ get blocking(): string | null; /** @param {string} media */ set media(media: string); /** @returns {string|null} */ get media(): string | null; /** @param {string} nonce */ set nonce(nonce: string); /** @returns {string|null} */ get nonce(): string | null; /** @param {string} title */ set title(title: string); /** @returns {string|null} */ get title(): string | null; /** @param {string} cssText */ set content(cssText: string); /** @returns {string} */ get content(): string; } import TinyHtmlTemplate from './TinyHtmlTemplate.mjs'; //# sourceMappingURL=TinyHtmlStyle.d.mts.map