import LiveState, { LiveStateConfig } from "./LiveState"; export declare type ConnectOptions = LiveStateConfig & { properties?: Array; attributes?: Array; events?: { send?: Array; receive?: Array; }; }; /** * This will will connect a live state instance to an element. It will: * * - set a `liveState` property on the element * - call `connect` on the LiveState instance * - connect properties and attributes * - call `sendEvent` and `receiveEvent` for each specified event */ export declare const connectElement: (liveStateOrEl: LiveState | HTMLElement, elOrOptions: HTMLElement | ConnectOptions, options?: ConnectOptions) => void; /** * A property name or an object with a `name` and `path` property. The `name` * property will be used as the property name on the element, and the `path` * property will be used to look up the value on the state. The path should be * a json pointer. */ export declare type LiveStateProperty = string | { name: string; path: string; }; /** Listens to `livestate-change` events on the LiveState instance passed in, and updates the property on the element with value of the propery on the state. */ export declare const connectProperty: (liveState: LiveState, el: HTMLElement, property: LiveStateProperty) => void; /** Listens to `livestate-change` events on the LiveState instance passed in, and sets the attributeon the element with value of the same name on the state. */ export declare const connectAtttribute: (liveState: LiveState, el: HTMLElement, attr: string) => void; /** * Listens to the specified event on the LiveState instance and when received, * redispatches it on the element */ export declare const receiveEvent: (liveState: LiveState, el: HTMLElement, eventName: string) => void; /** * Listens to the specified event on the element, and when received, * redispatches it on the liveState instance. */ export declare const sendEvent: (liveState: LiveState, el: HTMLElement, eventName: string) => void; export default connectElement;