import { type PresenceOpts, type PresenceResponse, type RoomSchemaShape, InstantCoreDatabase, InstantSchemaDef } from '@instantdb/core'; import type { Accessor } from 'solid-js'; export type PresenceHandle = PresenceResponse & { publishPresence: (data: Partial) => void; }; export type TypingIndicatorOpts = { timeout?: number | null; stopOnEnter?: boolean; writeOnly?: boolean; }; export type TypingIndicatorHandle = { active: Accessor; setActive(active: boolean): void; inputProps: { onKeyDown: (e: KeyboardEvent) => void; onBlur: () => void; }; }; export declare const defaultActivityStopTimeout = 1000; /** * Listen for broadcasted events given a room and topic. * * @see https://instantdb.com/docs/presence-and-topics * @example * function App({ roomId }) { * const room = db.room('chats', roomId); * db.rooms.useTopicEffect(room, 'emoji', (message, peer) => { * console.log(peer.name, 'sent', message); * }); * // ... * } */ export declare function useTopicEffect(room: InstantSolidRoom, topic: TopicType, onEvent: (event: RoomSchema[RoomType]['topics'][TopicType], peer: RoomSchema[RoomType]['presence']) => any): void; /** * Broadcast an event to a room. * * @see https://instantdb.com/docs/presence-and-topics * @example * function App({ roomId }) { * const room = db.room('chat', roomId); * const publishTopic = db.rooms.usePublishTopic(room, "emoji"); * * return ( * * ); * } * */ export declare function usePublishTopic(room: InstantSolidRoom, topic: TopicType): (data: RoomSchema[RoomType]['topics'][TopicType]) => void; /** * Listen for peer's presence data in a room, and publish the current user's presence. * * @see https://instantdb.com/docs/presence-and-topics * @example * function App({ roomId }) { * const presence = db.rooms.usePresence(room, { keys: ["name", "avatar"] }); * // presence().peers, presence().isLoading, presence().publishPresence * } */ export declare function usePresence(room: InstantSolidRoom, opts?: PresenceOpts): Accessor>; /** * Publishes presence data to a room * * @see https://instantdb.com/docs/presence-and-topics * @example * function App({ roomId, nickname }) { * const room = db.room('chat', roomId); * db.rooms.useSyncPresence(room, { nickname }); * } */ export declare function useSyncPresence(room: InstantSolidRoom, data: Partial, deps?: any[]): void; /** * Manage typing indicator state * * @see https://instantdb.com/docs/presence-and-topics * @example * function App({ roomId }) { * const room = db.room('chat', roomId); * const typing = db.rooms.useTypingIndicator(room, "chat-input"); * // typing.active(), typing.setActive(bool), typing.inputProps * } */ export declare function useTypingIndicator(room: InstantSolidRoom, inputName: string, opts?: TypingIndicatorOpts): TypingIndicatorHandle; export declare const rooms: { useTopicEffect: typeof useTopicEffect; usePublishTopic: typeof usePublishTopic; usePresence: typeof usePresence; useSyncPresence: typeof useSyncPresence; useTypingIndicator: typeof useTypingIndicator; }; export declare class InstantSolidRoom, RoomSchema extends RoomSchemaShape, RoomType extends keyof RoomSchema> { core: InstantCoreDatabase; type: RoomType; id: string; constructor(core: InstantCoreDatabase, type: RoomType, id: string); } //# sourceMappingURL=InstantSolidRoom.d.ts.map