claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
287 lines • 8.09 kB
TypeScript
export type ViewType = 'list' | 'gallery' | 'kanban' | 'calendar' | 'gantt' | 'table' | 'peopleNetwork' | 'locationsMap' | 'conceptsHierarchy';
export interface DatabaseViewConfig {
id?: string;
source: DataSource;
defaultView?: ViewType;
views: ViewConfigurations;
filters?: FilterConfig[];
sorting?: SortConfig;
pageId?: string;
storeAsBlock?: boolean;
showStatusBar?: boolean;
lastUpdated?: string;
metadata?: Record<string, any>;
}
export type DataSource = string | {
type: 'query';
query: string;
params?: Record<string, any>;
} | {
type: 'api';
endpoint: string;
method?: 'GET' | 'POST';
headers?: Record<string, string>;
refresh?: () => void;
};
export interface ViewConfigurations {
list?: ListViewConfig;
gallery?: GalleryViewConfig;
kanban?: KanbanViewConfig;
calendar?: CalendarViewConfig;
gantt?: GanttViewConfig;
table?: TableViewConfig;
peopleNetwork?: NetworkViewConfig;
locationsMap?: MapViewConfig;
conceptsHierarchy?: HierarchyViewConfig;
}
export interface BaseViewConfig {
columns?: ColumnConfig[];
selectable?: boolean;
allowAdd?: boolean;
allowDelete?: boolean;
allowEdit?: boolean;
props?: Record<string, any>;
}
export interface ListViewConfig extends BaseViewConfig {
itemTemplate?: string;
groupBy?: string;
showCheckbox?: boolean;
expandable?: boolean;
}
export interface GalleryViewConfig extends BaseViewConfig {
columns?: number;
cardTemplate?: string | ((item: any) => string);
imageField?: string;
titleField?: string;
descriptionField?: string;
onItemClick?: (item: any) => void;
}
export interface KanbanViewConfig extends BaseViewConfig {
columns: KanbanColumn[];
groupBy: string;
cardTemplate?: string;
allowDragDrop?: boolean;
swimlanes?: string;
}
export interface KanbanColumn {
id: string;
title: string;
color?: string;
limit?: number;
collapsed?: boolean;
}
export interface CalendarViewConfig extends BaseViewConfig {
dateField: string;
endDateField?: string;
titleField?: string;
colorField?: string;
onEventClick?: (event: any) => void;
view?: 'month' | 'week' | 'day' | 'agenda';
}
export interface GanttViewConfig extends BaseViewConfig {
startField: string;
endField: string;
titleField?: string;
progressField?: string;
dependenciesField?: string;
resourceField?: string;
onTaskClick?: (task: any) => void;
}
export interface TableViewConfig extends BaseViewConfig {
columns: TableColumnConfig[];
rowHeight?: 'compact' | 'normal' | 'comfortable';
stickyHeader?: boolean;
virtualized?: boolean;
onRowClick?: (row: any) => void;
}
export interface NetworkViewConfig extends BaseViewConfig {
nodeField?: string;
edgeField?: string;
layout?: 'force' | 'circular' | 'hierarchical';
onNodeClick?: (node: any) => void;
onEdgeClick?: (edge: any) => void;
}
export interface MapViewConfig extends BaseViewConfig {
latField?: string;
lngField?: string;
markerTemplate?: string;
clusterMarkers?: boolean;
onMarkerClick?: (item: any) => void;
}
export interface HierarchyViewConfig extends BaseViewConfig {
parentField?: string;
childrenField?: string;
collapsed?: boolean;
onNodeClick?: (node: any) => void;
}
export interface ColumnConfig {
key: string;
label?: string;
type?: ColumnType;
width?: string | number;
sortable?: boolean;
filterable?: boolean;
editable?: boolean;
visible?: boolean;
format?: (value: any) => string;
validator?: (value: any) => boolean | string;
options?: SelectOption[];
component?: any;
}
export interface TableColumnConfig extends ColumnConfig {
fixed?: 'left' | 'right';
resizable?: boolean;
minWidth?: number;
maxWidth?: number;
aggregate?: 'sum' | 'avg' | 'min' | 'max' | 'count';
}
export type ColumnType = 'text' | 'number' | 'date' | 'datetime' | 'boolean' | 'select' | 'multiselect' | 'tags' | 'user' | 'url' | 'email' | 'phone' | 'currency' | 'percent' | 'rating' | 'progress' | 'json' | 'markdown' | 'custom';
export interface SelectOption {
value: any;
label: string;
color?: string;
icon?: string;
}
export interface FilterConfig {
field: string;
operator: FilterOperator;
value: any;
label?: string;
groupLogic?: 'AND' | 'OR';
}
export type FilterOperator = 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | 'greater_than' | 'less_than' | 'greater_than_or_equal' | 'less_than_or_equal' | 'between' | 'in' | 'not_in' | 'is_null' | 'is_not_null' | 'is_empty' | 'is_not_empty' | 'before' | 'after' | 'on' | 'custom';
export interface SortConfig {
field: string;
direction: 'asc' | 'desc';
priority?: number;
nullsFirst?: boolean;
}
export interface EventPayload {
action: string;
entity_type: string;
entity_id?: string;
payload: any;
source: string;
metadata?: Record<string, any>;
timestamp?: string;
}
export interface CustomFunction {
(data: any, ...args: any[]): any;
}
export interface DataChangeEvent {
type: 'add' | 'update' | 'delete';
data: any;
field?: string;
oldValue?: any;
newValue?: any;
}
export interface ViewState {
view: ViewType;
filters: FilterConfig[];
sorting: SortConfig | null;
selection: Set<string>;
expandedRows: Set<string>;
scrollPosition: {
x: number;
y: number;
};
columnWidths: Record<string, number>;
hiddenColumns: Set<string>;
}
export interface ADHDMetrics {
urgency_score?: number;
cognitive_load?: number;
task_complexity?: number;
executive_function_demand?: number;
focus_duration?: number;
break_needed?: boolean;
hyperfocus_risk?: boolean;
}
export interface PlankaMetadata {
card_id?: string;
board_id?: string;
list_id?: string;
position?: number;
labels?: string[];
members?: string[];
due_date?: string;
attachments?: number;
comments?: number;
activities?: number;
}
export interface BrainMapEntity {
id: string;
type: 'task' | 'project' | 'note' | 'resource' | 'person' | 'location' | 'concept';
title?: string;
description?: string;
status?: string;
priority?: number;
created_at: string;
updated_at: string;
metadata?: Record<string, any>;
tags?: string[];
relationships?: EntityRelationship[];
adhd_metrics?: ADHDMetrics;
planka_metadata?: PlankaMetadata;
}
export interface EntityRelationship {
type: string;
target_id: string;
target_type: string;
metadata?: Record<string, any>;
}
export interface PaginationConfig {
enabled: boolean;
pageSize: number;
currentPage: number;
totalItems?: number;
totalPages?: number;
pageSizeOptions?: number[];
}
export interface ExportConfig {
format: 'csv' | 'excel' | 'json' | 'pdf';
columns?: string[];
filename?: string;
includeHeaders?: boolean;
dateFormat?: string;
}
export interface CollaborationConfig {
enabled: boolean;
userId: string;
userName?: string;
userColor?: string;
showCursors?: boolean;
showSelections?: boolean;
showPresence?: boolean;
}
export interface AuditEntry {
id: string;
action: string;
entity_type: string;
entity_id: string;
user_id: string;
timestamp: string;
changes?: Record<string, {
old: any;
new: any;
}>;
metadata?: Record<string, any>;
}
export interface AccessibilityConfig {
announceChanges?: boolean;
keyboardNavigation?: boolean;
screenReaderMode?: boolean;
highContrast?: boolean;
focusIndicator?: boolean;
reducedMotion?: boolean;
}
export interface ThemeConfig {
mode?: 'light' | 'dark' | 'auto';
primaryColor?: string;
accentColor?: string;
fontFamily?: string;
fontSize?: string;
spacing?: string;
borderRadius?: string;
}
//# sourceMappingURL=types.d.ts.map