import * as react from 'react'; import { ReactNode } from 'react'; import { S as SortMode, W as WhichKeyEngine, a as ShortcutHandler, b as ShortcutOptions, c as WhichKeyState } from '../controller-UD1Fmtsm.js'; export { C as CanonicalKey, d as CheatsheetEntry, e as CheatsheetGroup, f as CheatsheetModel, G as GroupEntry, K as KeyComparator, L as LayerHandle, g as ShortcutEntry, h as ShortcutRegistry, i as WhichKeyCandidate, j as WhichKeyOptions, k as WhichKeySnapshot, l as createWhichKey } from '../controller-UD1Fmtsm.js'; export { Matcher, MatcherOptions, alphabeticalKeysSort, eventToCanonical, isInputTarget, isModifierOnlyEvent, parseKey, parseSequence, resolveSort } from '../engine/index.js'; /** * Props for ``. `timeoutMs`, `helpKey`, and `sortKeys` are * read once when the provider mounts — the engine is created once and lives for * the provider's lifetime, so changing them on a later render has no effect. */ type WhichKeyProviderProps = { /** Subtree that gets access to the engine. */ children?: ReactNode; /** Sequence timeout in milliseconds. Defaults to `500`. */ timeoutMs?: number; /** Key that toggles the cheatsheet. Defaults to `'?'`; `null` disables it. */ helpKey?: string | null; /** Popup and cheatsheet sort order. Defaults to `'registration'`. */ sortKeys?: SortMode; }; /** * Creates the engine once, starts it on mount, and stops it on unmount. Must * wrap any component that calls `useShortcut`, `useShortcutGroup`, or * `useWhichKeyState`, or that renders ``, * ``, or ``. */ declare const WhichKeyProvider: ({ children, timeoutMs, helpKey, sortKeys, }: WhichKeyProviderProps) => react.JSX.Element; /** * The engine created by the nearest ``, or `null` outside one. * An advanced escape hatch — prefer `useShortcut`, `useShortcutGroup`, and * `useWhichKeyState`. */ declare const WhichKeyContext: react.Context; /** * The ambient layer level, `{ level: 0 }` outside any ``. An * advanced escape hatch — prefer nesting ``, which sets this and * activates the layer for you. */ declare const LayerContext: react.Context<{ level: number; }>; /** Props for ``. */ type WhichKeyLayerProps = { /** Subtree whose shortcuts and groups belong to this layer. */ children: ReactNode; /** * When `true`, shortcuts at lower levels become unreachable unless they were * registered with `global: true`. Defaults to `false`, which leaves the layer * additive. */ exclusive?: boolean; }; /** * Scopes every `useShortcut` / `useShortcutGroup` call in its subtree to a * nested keybinding layer, activated on mount and deactivated on unmount. * * The level is derived from React tree depth (`parent.level + 1`), so nesting * these components stacks levels — but two sibling layers under the same parent * share a level and therefore do not isolate from each other. */ declare const WhichKeyLayer: ({ children, exclusive }: WhichKeyLayerProps) => react.JSX.Element; /** * Registers a shortcut for the lifetime of the component, stamped with the * ambient `` level. * * `handler` is held in a ref, so it need not be stable and never causes a * re-registration on its own. Re-registration happens when the engine, `keys`, * or an individual option value changes — a fresh `options` object carrying the * same values does not trigger one. */ declare const useShortcut: (keys: string, handler: ShortcutHandler, options?: ShortcutOptions) => void; /** * Labels a key prefix in the popup and cheatsheet for the lifetime of the * component, stamped with the ambient `` level. */ declare const useShortcutGroup: (prefix: string, options: { description: string; priority?: number; }) => void; /** * Subscribes to the engine's popup state through `useSyncExternalStore` and * returns it in the shape React components render from. * * Server rendering — and any render with no `` above — yields * an empty, invisible state instead of throwing, which is what makes the * renderer components SSR-safe. `what` only names the caller in the * missing-provider warning. */ declare const useWhichKeyState: (what?: string) => WhichKeyState; /** Popup placement: a corner panel (`'vertical'`) or a bottom bar (`'horizontal'`). */ type WhichKeyPopupLayout = 'vertical' | 'horizontal'; /** Props for ``. Out-of-range values are clamped, never rejected. */ type WhichKeyPopupProps = { /** Corner popup or bottom bar. Defaults to `'vertical'`. */ layout?: WhichKeyPopupLayout; /** * Maximum rows in the horizontal grid. Defaults to `5`; other values are * floored to an integer of at least `1`, and a non-finite value falls back to * the default. */ maxRows?: number; /** * Panel background alpha. Defaults to `0.95`; other values are clamped to * `0`-`1`, and a non-finite value falls back to the default. */ backgroundOpacity?: number; }; /** * Renders the pending-sequence popup, listing the keys that can follow what has * been pressed so far. Returns `null` when the popup is not visible — including * during server rendering, so it is SSR-safe and activates after hydration. * * Emits the fixed `wk-*` class names styled by `which-key/styles.css`. */ declare const WhichKeyPopup: ({ layout, maxRows, backgroundOpacity, }?: WhichKeyPopupProps) => react.JSX.Element | null; /** * Full-screen cheatsheet of every active shortcut. Takes no props and renders * `null` while the cheatsheet is closed — and during server rendering, so it is * SSR-safe and activates after hydration. * * While open it traps Tab focus inside the panel, closes on `Escape`, and * restores focus to the previously focused element on close. Emits the fixed * `wk-*` class names styled by `which-key/styles.css`. */ declare const ShortcutCheatsheet: () => react.JSX.Element | null; export { LayerContext, ShortcutCheatsheet, ShortcutHandler, ShortcutOptions, SortMode, WhichKeyContext, WhichKeyEngine, WhichKeyLayer, type WhichKeyLayerProps, WhichKeyPopup, type WhichKeyPopupLayout, type WhichKeyPopupProps, WhichKeyProvider, type WhichKeyProviderProps, WhichKeyState, useShortcut, useShortcutGroup, useWhichKeyState };