-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
executable file
·74 lines (66 loc) · 1.96 KB
/
types.ts
File metadata and controls
executable file
·74 lines (66 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Supported Component Types
export enum ComponentType {
HEADER = 'header',
TEXT = 'text',
TEXT_WITH_IMAGE = 'text_with_image',
CORE_STATS = 'core_stats',
STREAK_STATS = 'streak_stats',
REPO_CARD = 'repo_card',
TECH_STACK = 'tech_stack',
SOCIALS = 'socials',
IMAGE = 'image',
MARKDOWN = 'markdown',
ABOUT_ME = 'about_me',
PROJECT_DEMO = 'project_demo',
HEADING = 'heading',
LIST = 'list',
BREAKER = 'breaker',
BADGE = 'badge',
TABLE = 'table',
DETAILS = 'details',
CODE_BLOCK = 'code_block',
BLOCKQUOTE = 'blockquote',
SVG = 'svg',
LINK = 'link',
IMAGE_LINK = 'image_link',
}
// Global Editor Modes
export type EditorMode = 'builder' | 'preview' | 'source';
// Base interface for all component properties
export interface ComponentProps {
[key: string]: any;
}
// The core data model for a component instance on the canvas
export interface ComponentInstance {
id: string;
type: ComponentType;
props: ComponentProps;
}
// Configuration for the component library (Left Sidebar)
export interface ComponentDefinition {
type: ComponentType;
category: 'basic' | 'advanced';
label: string;
icon: string; // Icon name for display
description: string;
defaultProps: ComponentProps;
}
// Application Store State
export interface AppState {
components: ComponentInstance[];
selectedId: string | null;
editorMode: EditorMode; // Replaced isPreviewMode
githubUsername: string;
// Global Settings
themeMode: 'dark' | 'light';
// Actions
setGithubUsername: (username: string) => void;
addComponent: (type: ComponentType, initialProps?: ComponentProps) => void;
removeComponent: (id: string) => void;
updateComponentProps: (id: string, props: Partial<ComponentProps>) => void;
reorderComponents: (oldIndex: number, newIndex: number) => void;
selectComponent: (id: string | null) => void;
setEditorMode: (mode: EditorMode) => void; // New action
toggleTheme: () => void;
importConfig: (json: string) => void;
}