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.38 kB
export default TinyHtmlEmbed; /** * TinyHtmlEmbed is a helper class for creating and managing <embed> elements, * typically used to embed external interactive content or media such as PDFs or plugins. * * Supported attributes: * - `src`: The URL of the resource being embedded. * - `type`: The MIME type used to select the plug-in to instantiate. * - `width`: Display width in CSS pixels (absolute value, no percentages). * - `height`: Display height in CSS pixels (absolute value, no percentages). * * @example * const embed = new TinyHtmlEmbed({ * src: '/docs/sample.pdf', * type: 'application/pdf', * width: 800, * height: 600, * }); * * @extends TinyHtmlTemplate<HTMLEmbedElement> */ declare class TinyHtmlEmbed extends TinyHtmlTemplate<HTMLEmbedElement> { /** * Creates a new TinyHtmlEmbed instance. * * @param {Object} [config={}] - Configuration object. * @param {string} [config.src=""] - The resource URL to embed. * @param {string} [config.type=""] - The MIME type of the resource (e.g. "application/pdf"). * @param {number|string} [config.width] - Width in CSS pixels. Must be an absolute value (no percentages). * @param {number|string} [config.height] - Height in CSS pixels. Must be an absolute value (no percentages). * @param {string|string[]|Set<string>} [config.tags=[]] - CSS classes to apply. * @param {string} [config.mainClass=""] - Main CSS class. * * @throws {TypeError} If `src` is not a string. * @throws {TypeError} If `type` is not a string. * @throws {TypeError} If `width` is not a number or string. * @throws {TypeError} If `height` is not a number or string. */ constructor({ src, type, width, height, tags, mainClass }?: { src?: string | undefined; type?: string | undefined; width?: string | number | undefined; height?: string | number | undefined; tags?: string | string[] | Set<string> | undefined; mainClass?: string | undefined; }); /** @param {string} src */ set src(src: string); /** @returns {string|null} */ get src(): string | null; /** @param {string} type */ set type(type: string); /** @returns {string|null} */ get type(): string | null; } import TinyHtmlTemplate from './TinyHtmlTemplate.mjs'; //# sourceMappingURL=TinyHtmlEmbed.d.mts.map