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.

67 lines 2.92 kB
export default TinyHtmlColorInput; /** * TinyHtmlColorInput is a helper class for managing `<input type="color">` elements. * It provides strict validation for attributes such as `value`, `alpha`, `autocomplete`, * `list`, `readonly`, `required`, and `colorspace`. * * @example * const colorInput = new TinyHtmlColorInput({ * value: '#ff0000', * alpha: 0.8, * autocomplete: 'on', * required: true * }); */ declare class TinyHtmlColorInput extends TinyHtmlInput { /** * Creates a new TinyHtmlColorInput instance. * @param {Object} config - Configuration object. * @param {string|number} [config.value="#000000"] - Initial color value. * @param {string|number} [config.alpha] - Alpha (transparency) value. * @param {string} [config.placeholder] - Placeholder text. * @param {string} [config.name] - Name of the input. * @param {string} [config.autocomplete] - Autocomplete hint (e.g., "on", "off", "email"). * @param {string} [config.list] - ID of a `<datalist>`. * @param {boolean} [config.readonly=false] - Whether the input is read-only. * @param {boolean} [config.required=false] - Whether the input is required. * @param {string} [config.colorspace] - Colorspace for image inputs (e.g., "sRGB"). * @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes. * @param {string} [config.mainClass=''] - Main CSS class. * @throws {TypeError} If any attribute is of the wrong type. */ constructor({ list, value, name, autocomplete, alpha, readonly, required, placeholder, colorspace, tags, mainClass, }?: { value?: string | number | undefined; alpha?: string | number | undefined; placeholder?: string | undefined; name?: string | undefined; autocomplete?: string | undefined; list?: string | undefined; readonly?: boolean | undefined; required?: boolean | undefined; colorspace?: string | undefined; tags?: string | string[] | Set<string> | undefined; mainClass?: string | undefined; }); /** @param {string|number} value */ set value(value: string | number); /** @returns {string|null} */ get value(): string | null; /** @param {string|number} alpha */ set alpha(alpha: string | number); /** @returns {string|null} */ get alpha(): string | null; /** @param {string} list */ set list(list: string); /** @returns {string|null} */ get list(): string | null; /** @param {string} autocomplete */ set autocomplete(autocomplete: string); /** @returns {string|null} */ get autocomplete(): string | null; /** @param {string} colorspace */ set colorspace(colorspace: string); /** @returns {string|null} */ get colorspace(): string | null; } import TinyHtmlInput from '../TinyHtmlInput.mjs'; //# sourceMappingURL=TinyHtmlColorInput.d.mts.map