claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
129 lines • 4.85 kB
TypeScript
export type PresenceState = 'online' | 'away' | 'busy' | 'offline' | 'typing';
export type PresenceSize = 'xs' | 'sm' | 'md' | 'lg';
export interface PresencePrivacySettings {
showStatus?: boolean;
showTyping?: boolean;
showLastSeen?: boolean;
allowStatusInference?: boolean;
}
export interface WebSocketConfig {
url?: string;
userId?: string;
roomId?: string;
enableReconnect?: boolean;
reconnectDelay?: number;
maxReconnectAttempts?: number;
}
export interface PresenceUpdate {
userId: string;
status: PresenceState;
isTyping: boolean;
timestamp: number;
metadata?: Record<string, any>;
}
type $$ComponentProps = {
status?: PresenceState;
isTyping?: boolean;
userName?: string;
size?: PresenceSize;
showTooltip?: boolean;
tooltipContent?: string;
showAnimation?: boolean;
batchUpdates?: boolean;
updateDelay?: number;
privacy?: PresencePrivacySettings;
customColor?: string;
customIcon?: string;
wsConfig?: WebSocketConfig;
className?: string;
children?: import('svelte').Snippet;
};
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
$$bindings?: Bindings;
} & Exports;
(internal: unknown, props: Props & {
$$events?: Events;
$$slots?: Slots;
}): Exports & {
$set?: any;
$on?: any;
};
z_$$bindings?: Bindings;
}
/**
* PresenceIndicator
*
* Enhanced presence indicator component with real-time status updates,
* animated typing indicators, and WebSocket integration points.
*
* Features:
* - Multiple presence states (online, away, busy, offline, typing)
* - Animated typing indicators with user identification
* - Customizable colors and icons for different presence states
* - Integration with existing Tooltip component
* - WebSocket integration points for real-time updates
* - Batch presence updates for performance optimization
* - Privacy controls for presence visibility settings
* - ADHD-friendly design with clear visual hierarchy
*
* @prop {PresenceState} status - Current presence status
* @prop {boolean} [isTyping=false] - Whether user is currently typing
* @prop {string} [userName=''] - User name for typing indicator
* @prop {string} [size='md'] - Size variant (xs, sm, md, lg)
* @prop {boolean} [showTooltip=true] - Whether to show tooltip on hover
* @prop {string} [tooltipContent=''] - Custom tooltip content
* @prop {boolean} [showAnimation=true] - Whether to show animations
* @prop {boolean} [batchUpdates=false] - Enable batch update mode
* @prop {number} [updateDelay=100] - Delay for batch updates (ms)
* @prop {PresencePrivacySettings} [privacy] - Privacy visibility settings
* @prop {string} [customColor] - Custom color override
* @prop {string} [customIcon] - Custom icon override
* @prop {WebSocketConfig} [wsConfig] - WebSocket configuration
* @prop {string} [className] - Additional CSS classes
*
* @event presence-changed - Fired when presence status changes
* @event typing-started - Fired when typing animation starts
* @event typing-stopped - Fired when typing animation stops
* @event visibility-changed - Fired when privacy settings change
* @event ws-connected - Fired when WebSocket connects
* @event ws-disconnected - Fired when WebSocket disconnects
* @event ws-error - Fired when WebSocket error occurs
*/
declare const PresenceIndicator: $$__sveltets_2_IsomorphicComponent<$$ComponentProps, {
'presence-changed': CustomEvent<PresenceUpdate>;
'typing-started': CustomEvent<{
userName: string;
timestamp: number;
}>;
'typing-stopped': CustomEvent<{
userName: string;
timestamp: number;
}>;
'visibility-changed': CustomEvent<PresencePrivacySettings>;
'ws-connected': CustomEvent<{
url: string;
userId: string;
}>;
'ws-disconnected': CustomEvent<{
reason: string;
}>;
'ws-error': CustomEvent<{
error: Error | Event;
}>;
} & {
[evt: string]: CustomEvent<any>;
}, {}, {
updateStatus: (newStatus: PresenceState) => void;
updateTyping: (typing: boolean) => void;
updatePrivacy: (newPrivacy: Partial<PresencePrivacySettings>) => void;
forceUpdate: () => void;
getConnectionState: () => {
isConnected: boolean;
reconnectAttempts: number;
lastUpdate: number;
};
}, "size" | "status" | "isTyping">;
type PresenceIndicator = InstanceType<typeof PresenceIndicator>;
export default PresenceIndicator;
//# sourceMappingURL=PresenceIndicator.svelte.d.ts.map