import * as React from 'react';
// Core types for the confirmation system
export type ConfirmableProps
= {
dispose: () => void;
resolve: (value: R | PromiseLike) => void;
reject: (reason?: any) => void;
/** Register a callback to control show state from outside */
registerSetShow?: (setShow: (show: boolean) => void) => void;
} & P;
export type ConfirmDialogProps = {
/** Dismiss dialog without resolving the promise. */
dismiss: () => void;
/** Resolve the promise with the given value. */
proceed: (value: R) => void;
/** Reject the promise with the given value. */
cancel: (value?: any) => void;
/** Indicates if the dialog should be shown aka. someone is waiting for a promise. */
show: boolean;
} & P;
export type ConfirmDialog
= React.ComponentType>;
export type ConfirmableDialog = React.ComponentType>;
// Mounter types (public)
export type Mounter = {
mount: (component: React.ComponentType, props: any, mountNode?: HTMLElement) => string;
unmount: (key: string) => void;
};
export type TreeMounter = {
options: {
setMountedCallback: (callback: (components: any) => void) => void;
mountNode?: Element | DocumentFragment | HTMLElement;
};
} & Mounter;
// Context-aware confirmation system
export interface ConfirmationContext {
/**
* Creates a confirmation function for a given component
* @param component - The confirmable component
* @param unmountDelay - Delay before unmounting the component (default: 1000ms)
* @returns Confirmation function that returns a Promise
*/
createConfirmation: (
component: ConfirmableDialog
,
unmountDelay?: number
) => (props: P) => Promise;
/**
* React component that must be rendered in your app to display confirmations
* Place this component at the root level of your app or where you want confirmations to appear
*/
ConfirmationRoot: React.ComponentType;
}
// Force declaration file emission for this module
// This value is never imported by runtime code; it only ensures dist/types.d.ts exists.
export const __types_marker = 0 as const;