claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
46 lines • 1.51 kB
TypeScript
import { Node } from '@tiptap/core';
export interface PollOption {
id: string;
text: string;
votes: number;
voters: string[];
}
export interface PollData {
id: string;
question: string;
options: PollOption[];
allowMultiple: boolean;
anonymous: boolean;
deadline?: string;
createdBy: string;
createdAt: string;
totalVotes: number;
status: 'active' | 'closed' | 'draft';
}
export interface PollOptions {
HTMLAttributes: Record<string, any>;
onVote: (pollId: string, optionId: string, userId: string) => Promise<void>;
onUnvote: (pollId: string, optionId: string, userId: string) => Promise<void>;
onPollCreate: (pollData: Omit<PollData, 'id' | 'createdAt' | 'totalVotes'>) => Promise<string>;
onPollUpdate: (pollId: string, updates: Partial<PollData>) => Promise<void>;
getCurrentUserId: () => string;
canVote: (pollId: string, userId: string) => boolean;
canEdit: (pollId: string, userId: string) => boolean;
}
declare module '@tiptap/core' {
interface Commands<ReturnType> {
poll: {
/**
* Insert a poll
*/
insertPoll: (pollData: Partial<PollData>) => ReturnType;
/**
* Update a poll
*/
updatePoll: (pollId: string, updates: Partial<PollData>) => ReturnType;
};
}
}
export declare const PollExtension: Node<PollOptions, any>;
export default PollExtension;
//# sourceMappingURL=PollExtension.d.ts.map