Files
ipal-kit/dist/modules/accessibility/state.d.ts
T

38 lines
1.7 KiB
TypeScript

/**
* Accessibility preferences state. Each option maps to a data-attribute on
* <html> (e.g. data-a11y-contrast="high"); the PROJECT's CSS reacts to those
* attributes. The plugin sets the attributes and persists the choice — it does
* NOT ship styles, so it never fights the project's design.
*/
export type A11yState = {
/** Larger cursor. */
bigCursor: boolean;
/** 'default' | 'high' (high contrast) | 'inverted' (dark-on-light flip). */
contrast: 'default' | 'high' | 'inverted';
/** Grayscale filter on the whole page. */
grayscale: boolean;
/** Line spacing: 0 = default, 1..2 = looser. */
lineHeight: 0 | 1 | 2;
/** Readable font (project maps this to a dyslexia-friendly / simple font). */
readableFont: boolean;
/** Stop animations / transitions (prefers-reduced-motion equivalent). */
reduceMotion: boolean;
/** Text size step: 0 = default, 1..3 = larger. */
textSize: 0 | 1 | 2 | 3;
/** Underline all links (WCAG: don't rely on color alone). */
underlineLinks: boolean;
};
export declare const A11Y_DEFAULT: A11yState;
export declare const A11Y_COOKIE = "a11y-prefs";
export declare const A11Y_COOKIE_MAX_AGE: number;
/** Serialize for the cookie (compact). */
export declare function serializeA11y(state: A11yState): string;
/** Parse from the cookie; falls back to defaults on any bad value. */
export declare function parseA11y(raw: null | string | undefined): A11yState;
/**
* Maps state → data-attributes to set on <html>. Returns { attr: value|null };
* null means remove the attribute (option is at default). The project's CSS
* targets these, e.g. `[data-a11y-contrast="high"] { … }`.
*/
export declare function a11yAttributes(state: A11yState): Record<string, null | string>;