/** * vapor-chamber - Directive plugin (opt-in, 0KB when not imported) * * The rules this file keeps (the history is in CHANGELOG.md and the * whitepaper's Vue 3.6 alignment log, appendix B): * - THE NAME CARRIES THE SELECTOR: `vc-command`, `vc-payload`, * `vc-optimistic`. Vue's directive argument is a parameter slot (a getter * in compiled Vapor, #15490), so nothing here reads it - see * {@link vcCommandVapor}. * - `vcCommandVapor` is the function shape `withVaporDirectives` calls, over * the same `buildHandler` as the vDOM hooks. * - Direct listeners, one per element, per Document; `.delegate` opts in to * delegation, as Vue's compiled `@click` does (#15127). * - Event modifiers are honoured (.stop/.prevent/.self/.left/.middle/.right/ * .capture/.once/.passive). * - `buildHandler()` skips dispatch on a disabled, aria-disabled or * in-flight element. Vue skips only a `disabled` node, and only in its * delegated handler (#14948). The other two are this directive's rule. * - TEARDOWN IS KEYED TO WHAT WAS MOUNTED, never to the current binding. See * the `beforeUnmount` note in the plugin below. * * Provides a Vue plugin that installs three directives for declarative command * dispatch directly in templates, combining dispatch + loading + error * handling without any * * * // or app-wide, on the typed app from 'vapor-chamber/vapor': * // createVaporChamberApp(App).directive('vc-command', vcCommandVapor) */ export function vcCommandVapor( el: Element, value?: () => unknown, _argument?: () => unknown, modifiers?: Record, ): (() => void) | undefined { // `value` IS OPTIONAL, because `