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.
62 lines • 2.47 kB
text/typescript
export default TinyHtmlObject;
/**
* TinyHtmlObject is a lightweight helper class for managing <object> elements.
* It allows configuring attributes such as `data`, `type`, `form`, `height`, `width`, and `name`
* with built-in validation.
*
* @example
* const object = new TinyHtmlObject({
* data: 'document.pdf',
* type: 'application/pdf',
* width: 800,
* height: 600
* });
*
* @extends TinyHtmlTemplate<HTMLObjectElement>
*/
declare class TinyHtmlObject extends TinyHtmlTemplate<HTMLObjectElement> {
/**
* Creates a new TinyHtmlObject instance.
*
* @param {Object} config - Configuration object.
* @param {string} [config.data=""] - The URL of the resource to embed.
* @param {string} [config.type=""] - The MIME type of the resource.
* @param {string} [config.form] - The ID of a <form> element in the same document.
* @param {number} [config.height] - Height of the displayed resource, in CSS pixels (positive integer).
* @param {number} [config.width] - Width of the displayed resource, in CSS pixels (positive integer).
* @param {string} [config.name] - Name of the browsing context or control.
* @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes.
* @param {string} [config.mainClass=""] - Main CSS class.
*
* @throws {Error} If neither `data` nor `type` is provided.
* @throws {TypeError} If any attribute is of the wrong type.
*/
constructor({ data, type, form, height, width, name, tags, mainClass }?: {
data?: string | undefined;
type?: string | undefined;
form?: string | undefined;
height?: number | undefined;
width?: number | undefined;
name?: string | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @param {string} data */
set elData(data: string);
/** @returns {string|null} */
get elData(): string | null;
/** @param {string} type */
set type(type: string);
/** @returns {string|null} */
get type(): string | null;
/** @param {string} form */
set form(form: string);
/** @returns {string|null} */
get form(): string | null;
/** @param {string} name */
set name(name: string);
/** @returns {string|null} */
get name(): string | null;
}
import TinyHtmlTemplate from '../TinyHtmlTemplate.mjs';
//# sourceMappingURL=TinyHtmlObject.d.mts.map