Modal System
createModalSystem() owns an isolated registry and modal stack.
open(name, input, options?)
Opens a modal and returns its typed outcome:
The promise settles at close intent. Exit animation continues visually without delaying application code.
cancel(reason?)
Cancels the top modal. The default reason is programmatic.
cancelAll(reason?)
Cancels the entire stack from top to bottom:
Every pending operation settles exactly once.
Policies
Set a policy on a modal definition:
stackis the default and adds a new modal above the current one.replacecancels the active modal with reasonreplaced, then opens the new modal.singletonreturns the existing in-flight promise when the same modal is already active.
Systems do not share state. Create a fresh system for isolated tests or server requests.
