/** * Unsaved-changes guard for editors that get torn down or navigated away from. One * registry closes the gap: editors report dirtiness via {@link useRegisterDirty}; the * enclosing {@link DirtyGuardBoundary} arms {@link useNavigationGuard} from that * registry, so a route navigation confirms through a shared dialog and a full-page * unload raises the native prompt. {@link GuardedTabs} adds a tab-switch confirm on * top of the same boundary — `Tabs` unmount inactive panels, so a switch away from a * dirty editor is held behind the confirm too. The dialog is one shared * {@link ConfirmDialog} driven by a pending-promise resolver, so the guard's * `Promise` handler and the tab switch both settle against it. */ import { type ReactNode } from 'react'; import type { TabItem } from './tabs'; /** * Boundary that guards navigation away from a region holding a dirty editor. Editors * inside it arm the guard through {@link useRegisterDirty}; while any is dirty a route * navigation (a route-token/plugin navigate, an {@link AppLink}, or a browser * back/forward) confirms through the shared discard dialog, and a full-page unload * raises the native prompt. Use this directly to guard a dirty editor that is a plain * page section (no tabs); {@link GuardedTabs} wraps this same boundary to additionally * guard tab switches. */ export declare function DirtyGuardBoundary({ children }: { readonly children: ReactNode; }): ReactNode; /** * Report an editor's dirty state to the enclosing {@link DirtyGuardBoundary} (which * {@link GuardedTabs} also provides). A no-op outside a boundary (an editor rendered * standalone, e.g. in isolation tests) so the hook is always safe to call. */ export declare function useRegisterDirty(dirty: boolean): void; /** * A drop-in replacement for {@link Tabs} that guards a switch away from a dirty * editor. Wraps the tabs in a {@link DirtyGuardBoundary}, so an editor rendered in * any panel can arm the guard through {@link useRegisterDirty}. */ export declare function GuardedTabs({ items, defaultValue, }: { readonly items: readonly TabItem[]; readonly defaultValue?: string; }): ReactNode; //# sourceMappingURL=dirty-guard.d.ts.map