/**
* vapor-chamber — IIFE variant: FULL
*
* Exposes the full vapor-chamber API as `window.VaporChamber`. For sites that
* want every feature in a single `
*
*
*/
import { createCommandBus, createAsyncCommandBus, type CommandBusOptions } from './command-bus';
import { logger, validator, history, debounce, throttle, authGuard, optimistic, retry, persist, sync } from './plugins';
import { createHttpBridge, createWsBridge, createSseBridge, type HttpBridgeOptions } from './transports';
import { defineVaporCustomElement, defineVaporComponent, defineVaporAsyncComponent, defineVaporCommand, useVaporAsyncCommand, createVaporChamberApp, getVaporInteropPlugin } from './chamber-vapor';
import { useSharedCommandState, useCommand } from './chamber';
import type { AsyncPlugin, Plugin } from './command-bus';
export type CreateAppOptions = {
/**
* An async transport plugin (e.g. createHttpBridge) to install on the bus.
* Commands without a local handler are forwarded through this transport.
*/
transport?: AsyncPlugin;
/**
* Plugins to install on the bus (sync or async).
*/
plugins?: Plugin[];
/**
* Dead-letter mode. Default: 'error'
*/
onMissing?: CommandBusOptions['onMissing'];
};
/**
* createApp — creates a configured command bus, installs transport + plugins.
*
* @example
* const { bus, dispatch } = VaporChamber.createApp({
* transport: VaporChamber.http({ endpoint: '/api/vc' })
* })
* dispatch('cartAdd', { id: 1 }, { quantity: 2 })
*/
declare function createApp(options?: CreateAppOptions): {
bus: ReturnType;
dispatch: ReturnType['dispatch'];
};
export type MountOptions = CreateAppOptions & {
/**
* Initial state object. Not reactive on its own — use with your own
* signal library or Vue's ref() for reactivity.
*/
state?: Record;
};
/**
* mount — attach a command bus island to a specific DOM element.
*
* @example
* VaporChamber.mount('#analytics-island', {
* transport: VaporChamber.http({ endpoint: '/api/vc' }),
* state: { period: 'week', metrics: [] }
* })
*/
declare function mount(selector: string, options?: MountOptions): {
bus: ReturnType;
dispatch: ReturnType['dispatch'];
state: Record;
el: Element | null;
};
/**
* connect — one-line setup mirroring the CORE variant's API. Equivalent to
* `createApp({ transport: createHttpBridge({ csrf: true, ...opts }) })`.
* Available in every variant so the same call site works regardless of which
* IIFE bundle is loaded.
*/
declare function connect(options: HttpBridgeOptions & {
plugins?: Plugin[];
onMissing?: CommandBusOptions['onMissing'];
}): {
bus: ReturnType;
dispatch: ReturnType["dispatch"];
};
/**
* defineWidget — one-line custom-element registration mirroring the ELEMENTS
* variant's API. Returns `false` if Vue 3.6+ Vapor is not detected.
*/
declare function defineWidget(tagName: string, options: any, extraOptions?: any): boolean;
/**
* emitDOMEvent — bridge Vue's component emit() to a real DOM CustomEvent so
* host pages can `addEventListener` on the widget tag. See ELEMENTS variant
* for the full doc + attribution.
*/
declare function emitDOMEvent(el: Element, eventName: string, detail?: any, options?: {
bubbles?: boolean;
composed?: boolean;
cancelable?: boolean;
}): boolean;
declare const VaporChamber: {
readonly createCommandBus: typeof createCommandBus;
readonly createAsyncCommandBus: typeof createAsyncCommandBus;
readonly createApp: typeof createApp;
readonly connect: typeof connect;
readonly mount: typeof mount;
readonly defineWidget: typeof defineWidget;
readonly emitDOMEvent: typeof emitDOMEvent;
/** HTTP fetch transport. Alias for createHttpBridge(). */
readonly http: typeof createHttpBridge;
/** WebSocket transport. Alias for createWsBridge(). */
readonly ws: typeof createWsBridge;
/** Server-sent events bridge. Alias for createSseBridge(). */
readonly sse: typeof createSseBridge;
readonly logger: typeof logger;
readonly validator: typeof validator;
readonly history: typeof history;
readonly debounce: typeof debounce;
readonly throttle: typeof throttle;
readonly authGuard: typeof authGuard;
readonly optimistic: typeof optimistic;
readonly retry: typeof retry;
readonly persist: typeof persist;
readonly sync: typeof sync;
readonly defineVaporCustomElement: typeof defineVaporCustomElement;
readonly defineVaporComponent: typeof defineVaporComponent;
readonly defineVaporAsyncComponent: typeof defineVaporAsyncComponent;
readonly defineVaporCommand: typeof defineVaporCommand;
readonly useCommand: typeof useCommand;
readonly useVaporAsyncCommand: typeof useVaporAsyncCommand;
readonly useSharedCommandState: typeof useSharedCommandState;
readonly createVaporChamberApp: typeof createVaporChamberApp;
readonly getVaporInteropPlugin: typeof getVaporInteropPlugin;
};
export default VaporChamber;
//# sourceMappingURL=iife.d.ts.map