import type { HapticEvent, PatternChar } from "../types"; /** Set of characters that are valid in a pattern notation string. */ export declare const PATTERN_CHARS: ReadonlySet; /** * Recursively validates that every character in a string literal type is a `PatternChar`. * Resolves to `true` for valid strings and `false` for strings containing invalid chars. */ type IsValidPattern = S extends "" ? true : S extends `${PatternChar}${infer Rest}` ? IsValidPattern : false; /** * Use as a constraint on the `pattern()` argument to get compile-time errors for * string literals that contain invalid characters. * * - Widened `string` (runtime variable) → passes through unchanged (runtime validates) * - String literal with valid chars only → passes through unchanged * - String literal with an invalid char → resolves to `never`, causing a type error * * @example * type A = AssertValidPattern<'oO.O'>; // 'oO.O' ✓ * type B = AssertValidPattern<'oXO'>; // never ✗ compile error * type C = AssertValidPattern; // string ✓ (runtime validates) */ export type AssertValidPattern = string extends S ? S : IsValidPattern extends true ? S : never; /** * Convert a pattern notation string into an array of HapticEvents. * * Allowed characters: * o — soft transient (intensity 0.4, sharpness 0.4) * O — strong transient (intensity 1.0, sharpness 0.8) * . — 150 ms gap (total O.O = 250 ms) * - — 400 ms gap (total O-O = 500 ms) * = — 1000 ms gap (total O=O = 1100 ms) * * Consecutive haptic events (e.g. `OOO`) are spaced 100 ms apart so the * hardware can render each as a distinct pulse. To add extra spacing between * events, insert gap characters (`.`, `-`, `=`). * * Throws a `TypeError` at runtime if the string contains any character outside this set. * Produces a **compile-time error** when a string literal contains invalid characters. * * @example * pattern('oO.O'); // ✓ * pattern('oXO'); // ✗ TypeScript error: Argument of type 'string' is not assignable to parameter of type 'never' */ export declare function pattern(notation: S & AssertValidPattern): HapticEvent[]; export {}; //# sourceMappingURL=pattern.d.ts.map