import { MinMax } from './min-max.js'; export type CustomUpdateSetup = { setUp: () => Updater; update: (updater: Updater, text: NamedPartsToResultType) => void; namedParts?: NamedParts; }; export type NamedPartEntry = NamedParts extends string[] ? NamedParts[number] : never; export type NamedPartsToResultType = NamedParts extends string[] ? NamedParts['length'] extends 0 ? string : NamedParts extends never ? string : { [K in NamedPartEntry]: string; } : string; export type RequiredTypingOptions = { callback: (text: NamedPartsToResultType) => void; }; export type NamedPartsTypingOptions = { namedParts: NamedParts; }; export type TypingOptions> = { /** * The delay between typing characters. Can be a number or a MinMax object to randomize the delay. * @default { min: 40, max: 150 } */ perLetterDelay: number | MinMax; /** * The delay between making errors and correcting them. Can be a number or a MinMax object to randomize the delay. * @default { min: 50, max: 100 } */ errorDelay: number | MinMax; /** * The multiplier for how often an error will be made. The value ranges from 0 to n. 0 means no errors, 1 means normal errors, 2 means twice as many errors, etc. Can be a decimal number. * @default 1 */ errorMultiplier: number; /** * If set to true, errors will only be made on letters and numbers. Special characters will always be typed correctly. * @default false */ noSpecialCharErrors: boolean; /** * The locale to use for the keyboard layout. Currently only `en` and `de` are supported, but you can [add your own layouts](https://github.com/LoaderB0T/typed.ts#add-your-own-keyboard-layouts). * @default 'en' */ locale: string; namedPart?: NamedPart; }; export type EraseOptions> = { /** * The delay between erasing characters. Can be a number or a MinMax object to randomize the delay. * @default { min: 150, max: 250 } */ eraseDelay: number | MinMax; namedPart?: NamedPart; }; export type WaitOptions> = { namedPart?: NamedPart; }; export type ClassNameOptions = { /** * The class name to add to the element while typing. More info [here](https://github.com/LoaderB0T/typed.ts#custom-classes). * @default undefined */ className: string; }; export type FullTypingOptions> = TypingOptions & RequiredTypingOptions & EraseOptions & WaitOptions & NamedPartsTypingOptions & NamedPartsTypingOptions; export type PartialTypingOptions> = Partial>; export type ConstructorTypingOptions> = Partial, 'namedPart'>> & RequiredTypingOptions & Partial> & Partial>; export type FactoryTypingOptions = Omit, 'callback' | 'namedParts' | 'namedPart'>; export type SentanceTypingOptions> = Partial> & Partial> & Partial; export type EraseTypingOptions> = Partial>; export type WaitTypingOptions> = Partial>;