/** * @lasmind/website-accessibility: the LasMind accessibility menu for any website. * Same features as the LasMind website menu and the LasMind Vision * extension, from @lasmind/website-accessibility-core. No framework needed. */ import { type A11ySettings } from "@lasmind/website-accessibility-core"; import { ensurePanelStyles } from "@lasmind/website-accessibility-core/panel"; import { VERSION } from "./version"; export type { A11ySettings } from "@lasmind/website-accessibility-core"; export { VERSION }; /** Re-exported for 0.2.0/0.2.1 workarounds; the widget now adds its own styles, so calling it is a no-op. */ export { ensurePanelStyles }; export type WidgetOptions = { /** * localStorage key for settings. Default is the shared "lasmind-a11y-settings" * (the old "lasmind-a11y-widget" is still read once). A custom key is used * as is, with no migration. */ storageKey?: string; /** Corner for the floating button. Default "right". */ side?: "left" | "right"; /** Where the widget is added. Default document.body. */ container?: HTMLElement; /** Show the "Powered by LasMind" link. Default true. */ showCredit?: boolean; /** * Check lasmind.com at most once a day for a newer version of this package. Off by default. * A newer version is logged to the browser console, and shown in the menu on localhost only; * visitors never see it. The request carries no settings or personal data. */ updateCheck?: boolean; /** * "floating" (default): the button is fixed in a bottom corner. * "inline": the button is a normal element inside `container` (for example a header toolbar). * The panel always opens as a fixed side drawer. */ placement?: "floating" | "inline"; /** Button size: "md" (default, 52px) or "sm" (36px, fits a toolbar). Override with --lm-a11y-trigger-size. */ size?: "sm" | "md"; /** * Set false to hide the built-in button and open the panel from your own button with * handle.toggle() / open() / close(). Focus returns to whatever element opened the panel. */ trigger?: boolean; /** Accessible label for the built-in button. Default "Accessibility options". */ label?: string; /** * Where "Take the colour check" goes. Default: the free LasMind colour vision check, * https://lasmind.com/tools/color-blind-test (opens in a new tab). An http(s) URL opens * in a new tab; a path such as "/eye-test" opens on your own site. */ checkUrl?: string; /** * Called when a visitor starts the colour check. Call event.preventDefault() (or return * false to keep the default) to handle it yourself, for example with client-side routing. */ onOpenCheck?: (event: Event) => boolean | void; }; export type WidgetHandle = { open(): void; close(): void; /** Opens when closed, closes when open. */ toggle(): void; isOpen(): boolean; /** The element the widget added (the shadow host), for advanced styling or tests. */ readonly element: HTMLElement; /** * The body-level shadow host that holds the menu drawer. It is always a child of * document.body, separate from `container`, so ancestors with transform, filter, * backdrop-filter, contain or will-change cannot clip the fixed drawer. */ readonly portal: HTMLElement; getSettings(): A11ySettings; setSettings(patch: Partial): void; destroy(): void; }; export declare function init(options?: WidgetOptions): WidgetHandle; /** `` */ export declare class LasmindA11yElement extends HTMLElement { private handle; connectedCallback(): void; /** The widget handle (open, close, toggle, isOpen ...), once connected. */ get widget(): WidgetHandle | null; disconnectedCallback(): void; } export declare function defineElement(name?: string): void;