Открыть меню
Переключить меню настроек
Открыть персональное меню
Вы не представились системе
Ваш IP-адрес будет виден всем, если вы внесёте какие-либо изменения.

Winerr.js/Файл типизации 0.3.6

Материал из YastreWiki
import * as puppeteer from "puppeteer";
export type ButtonTypes = 'DEFAULT' | 'RECOMMENDED' | 'DISABLED';
export declare const ButtonTypeValues: Record<ButtonTypes, number>;
export type SystemTypes = 'Windows_1_0' | 'Windows_3_1' | 'Windows_95' | 'Windows_98' | 'Windows_2000' | 'Windows_WH' | 'Windows_XP' | 'Windows_LH4093' | 'Windows_Vista' | 'Windows_7' | 'Windows_8' | 'Windows_10' | 'Windows_11';
export declare const SystemTypeValues: Record<SystemTypes, string>;
interface FormattedButton {
    /**
     * Name of the button.
     * @type {string}
     */
    name: string;
    /**
     * If true - the button is disabled.
     * @type {boolean}
     */
    disabled: boolean;
    /**
     * If true - the button is recommended.
     * @type {boolean}
     */
    rec: boolean;
}
/**
 * Parameters of some button.
 * @interface ButtonOptions
 */
interface Button {
    /**
     * Type of the button.
     * @type {number}
     */
    type: ButtonTypes | 0 | 1 | 2;
    /**
     * Text of the button.
     * @type {string}
     */
    text: string;
    /**
     * Converts the button to a format suitable for the Winerr.
     * @returns {FormattedButton}
     * @type {FormattedButton}
     */
    toFormat(): FormattedButton;
}
/**
 * A handy (or not so handy) button builder!
 * @class ButtonBuilder
 */
export declare class ButtonBuilder {
    private button;
    constructor();
    /**
     * Sets the button text.
     * @param {string} text - Text of the button. Use ButtonTypes enum.
     * @returns {ButtonBuilder}
     */
    setText(text: string): ButtonBuilder;
    /**
     * Sets the button type. Use ButtonTypes enum.
     * @param {number} type - Type of the button.
     * @returns {ButtonBuilder}
     */
    setType(type: ButtonTypes): ButtonBuilder;
    /**
     * Returns the button object.
     * @returns {Button}
     */
    build(): Button;
}
interface ErrorOptions {
    /**
     * System type for the error.
     * Use SystemTypes enum.
     * @type {SystemTypes}
     */
    system: SystemTypes;
    /**
     * Title of the error.
     * @type {string}
     */
    title: string;
    /**
     * Text of the error.
     * @type {string}
     */
    text: string;
    /**
     * Icon number for the error.
     * @type {number}
     */
    icon: number;
    /**
     * If true - the cross will be INACTIVE.
     * @type {boolean}
     */
    cross: boolean;
    /**
     * Array of buttons for the error.
     * Use ButtonBuilder to create buttons,
     * and toFormat() method to convert them to the
     * format suitable for Winerr.
     * @type {Button[]}
     */
    buttons?: [Button?, Button?, Button?];
    /**
     * Color of the frame (Windows 8 only).
     * @type {string}
     */
    frameColor?: string;
    /**
     * Color of the primary text (Windows 95 - 2000 only).
     * @type {string}
     */
    primaryColor?: string;
    /**
     * Color of the secondary text (Windows 95 - 2000 only).
     * @type {string}
     */
    secondaryColor?: string;
    /**
     * If not specified or false - create() returns buffer, if toBase64 is true - returns base64 string (starts with "data:image/png;base64,")
     * @type {boolean}
     */
    toBase64: boolean;
    /**
     * If specified saves to the selected file (overrides toBase64)
     * @type {string}
     */
    path?: string;
}
/**
 * Parameters for initializing the Winerr class.
 * @interface WinerrOptions
 */
interface WinerrOptions {
    /**
     * Base URL for Winerr.
     * Default is https://shikoshib.ru/tools/winerr
     * @type {string}
     */
    baseURL?: string;
    /**
     * Puppeteer browser instance that will be used by Winerr to create errors.
     * @type {puppeteer.Browser}
     */
    browser: puppeteer.Browser;
    /**
     * If true, enables detailed logging to the console.
     * @type {boolean}
     */
    debug?: boolean;
}
/**
 * Allows generating errors using Winerr with the official Winerr or a compatible server directly from the code.
 * @class Winerr
 */
export declare class Winerr {
    baseURL?: string;
    browser: puppeteer.Browser;
    debug: boolean;
    /**
     * Creates an instance of the Winerr class.
     */
    constructor(options: WinerrOptions);
    /**
     * image method for creating error images.
     */
    image: {
        parent: Winerr;
        /**
         * Creates an error image.
         * @param {ErrorOptions} options - Options for the error image.
         * @returns {Promise<string | Buffer | void>} Returns a base64 string or a buffer of the error image.
         */
        create(options: ErrorOptions): Promise<string | Buffer | boolean | void>;
    };
}
export {};