UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

19 lines (18 loc) 1.02 kB
import { TextSchema, type TextSchemaOptions } from "./TextSchema.js"; /** * Define a valid color hex string, e.g `#00CCFF` * * Ensures value is a string, enforces that the string is a valid Color. * Checks Color scheme against a whitelist (always), and checks Color domain against a whitelist (optional). * `null` is also a valid value if this field is not required. * * Colors are limited to 512 characters (this can be changed with `max`), but generally these won't be data: URIs so this is a reasonable limit. */ export declare class ColorSchema extends TextSchema { constructor({ title, value, ...options }: Omit<TextSchemaOptions, "type" | "min" | "max" | "multiline" | "match">); sanitize(insaneString: string): string; } /** Valid color hex string, e.g. `#00CCFF` (required because empty string is invalid). */ export declare const COLOR: ColorSchema; /** Valid color hex string, e.g. `#00CCFF`, or `null` */ export declare const OPTIONAL_COLOR: import("./OptionalSchema.js").OptionalSchema<string>;