claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
131 lines • 4.33 kB
TypeScript
export type TableSortDirection = 'asc' | 'desc' | null;
export interface TableColumn<T = any> {
key: string;
label: string;
sortable?: boolean;
filterable?: boolean;
width?: string | number;
minWidth?: string | number;
maxWidth?: string | number;
align?: 'left' | 'center' | 'right';
render?: (value: any, row: T, index: number) => string | any;
headerRender?: () => string | any;
className?: string;
headerClassName?: string;
schema?: 'staging' | 'catalog' | 'pages' | 'core';
entityType?: 'block' | 'concept' | 'object' | 'person' | 'place' | 'project' | 'task' | 'area' | 'goal' | 'note' | 'journal';
vectorSimilarity?: boolean;
relationshipStrength?: boolean;
inlineEditable?: boolean;
semanticFilter?: boolean;
}
export interface TableSort {
column: string;
direction: TableSortDirection;
}
export interface TableFilter {
column: string;
value: string;
operator?: 'contains' | 'equals' | 'startsWith' | 'endsWith';
}
export interface TablePagination {
page: number;
pageSize: number;
total: number;
}
export interface TableSelection<T = any> {
selectedRows: Set<string | number>;
selectAll: boolean;
getRowId: (row: T, index: number) => string | number;
}
export type TableSize = 'sm' | 'md' | 'lg';
export type TableVariant = 'default' | 'striped' | 'bordered';
export interface MaterialViewEntity {
id: string;
type: 'block' | 'concept' | 'object' | 'person' | 'place' | 'project' | 'task' | 'area' | 'goal' | 'note' | 'journal';
schema: 'staging' | 'catalog' | 'pages' | 'core';
label: string;
content?: string;
metadata?: Record<string, any>;
vectorSimilarity?: number;
relationshipStrength?: number;
relationships?: MaterialViewRelationship[];
lastModified?: Date;
createdBy?: string;
tags?: string[];
}
export interface MaterialViewRelationship {
id: string;
type: 'TAGGED_WITH' | 'LINKS_TO' | 'RELATED_TO' | 'PART_OF' | 'ASSIGNED_TO';
targetId: string;
targetType: string;
strength: number;
metadata?: Record<string, any>;
}
export interface CrossSchemaQuery {
schemas: ('staging' | 'catalog' | 'pages' | 'core')[];
entityTypes?: string[];
vectorQuery?: {
embedding: number[];
threshold: number;
limit: number;
};
semanticFilter?: {
concepts: string[];
relationships: string[];
strength: number;
};
fullTextSearch?: {
query: string;
fields: string[];
};
}
export interface BulkOperation {
type: 'update' | 'delete' | 'tag' | 'relate' | 'move';
entityIds: string[];
payload?: Record<string, any>;
targetSchema?: 'staging' | 'catalog' | 'pages' | 'core';
relationshipType?: 'TAGGED_WITH' | 'LINKS_TO' | 'RELATED_TO' | 'PART_OF' | 'ASSIGNED_TO';
}
export interface InlineEditConfig {
enabled: boolean;
fields: string[];
onSave?: (entityId: string, field: string, value: any) => Promise<void>;
onCancel?: (entityId: string, field: string) => void;
validation?: Record<string, (value: any) => string | null>;
}
export interface SemanticFilterConfig {
concepts: string[];
relationships: string[];
minStrength: number;
maxStrength: number;
entityTypes: string[];
schemas: string[];
}
export interface TableProps<T = any> {
data: T[];
columns: TableColumn<T>[];
variant?: TableVariant;
size?: TableSize;
sortable?: boolean;
filterable?: boolean;
selectable?: boolean;
pagination?: Partial<TablePagination>;
loading?: boolean;
emptyMessage?: string;
loadingMessage?: string;
stickyHeader?: boolean;
maxHeight?: string | number;
className?: string;
'data-testid'?: string;
materialView?: boolean;
crossSchemaQuery?: CrossSchemaQuery;
bulkOperations?: BulkOperation[];
inlineEdit?: InlineEditConfig;
semanticFilter?: SemanticFilterConfig;
onCrossSchemaQuery?: (query: CrossSchemaQuery) => Promise<MaterialViewEntity[]>;
onBulkOperation?: (operation: BulkOperation) => Promise<void>;
onInlineEdit?: (entityId: string, field: string, value: any) => Promise<void>;
onSemanticFilter?: (filter: SemanticFilterConfig) => Promise<MaterialViewEntity[]>;
}
//# sourceMappingURL=types.d.ts.map