@qwanyx/stack 0.2.6 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +53 -0
- package/dist/auth/index.d.ts +34 -0
- package/dist/client/GraphClient.d.ts +137 -0
- package/dist/client/MailClient.d.ts +114 -0
- package/dist/components/AnimatedCardFlip.d.ts +19 -0
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Detail.d.ts +15 -0
- package/dist/components/Mail.d.ts +53 -0
- package/dist/components/Stack.d.ts +38 -0
- package/dist/hooks/useMutation.d.ts +16 -0
- package/dist/hooks/useQuery.d.ts +18 -0
- package/dist/index.cjs.js +11 -11
- package/dist/index.d.ts +28 -0
- package/dist/index.esm.js +803 -756
- package/dist/operations/index.d.ts +51 -0
- package/dist/types/index.d.ts +225 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations Layer
|
|
3
|
+
* Client-side data manipulation utilities
|
|
4
|
+
*/
|
|
5
|
+
export declare class DataOperations {
|
|
6
|
+
/**
|
|
7
|
+
* Filter array by predicate function
|
|
8
|
+
*/
|
|
9
|
+
static filter<T>(items: T[], predicate: (item: T) => boolean): T[];
|
|
10
|
+
/**
|
|
11
|
+
* Filter by field value
|
|
12
|
+
*/
|
|
13
|
+
static filterBy<T>(items: T[], field: keyof T, value: any): T[];
|
|
14
|
+
/**
|
|
15
|
+
* Filter by multiple fields
|
|
16
|
+
*/
|
|
17
|
+
static filterByFields<T>(items: T[], filters: Partial<T>): T[];
|
|
18
|
+
/**
|
|
19
|
+
* Sort array by field
|
|
20
|
+
*/
|
|
21
|
+
static sort<T>(items: T[], field: keyof T, order?: 'asc' | 'desc'): T[];
|
|
22
|
+
/**
|
|
23
|
+
* Search items by query string in specified fields
|
|
24
|
+
*/
|
|
25
|
+
static search<T>(items: T[], query: string, fields: (keyof T)[]): T[];
|
|
26
|
+
/**
|
|
27
|
+
* Paginate array
|
|
28
|
+
*/
|
|
29
|
+
static paginate<T>(items: T[], page: number, limit: number): {
|
|
30
|
+
data: T[];
|
|
31
|
+
total: number;
|
|
32
|
+
page: number;
|
|
33
|
+
totalPages: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Group items by field value
|
|
37
|
+
*/
|
|
38
|
+
static groupBy<T>(items: T[], field: keyof T): Record<string, T[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Get unique values for a field
|
|
41
|
+
*/
|
|
42
|
+
static unique<T>(items: T[], field: keyof T): any[];
|
|
43
|
+
/**
|
|
44
|
+
* Count items by field value
|
|
45
|
+
*/
|
|
46
|
+
static countBy<T>(items: T[], field: keyof T): Record<string, number>;
|
|
47
|
+
/**
|
|
48
|
+
* Apply multiple operations in sequence
|
|
49
|
+
*/
|
|
50
|
+
static pipe<T>(items: T[], operations: Array<(items: T[]) => T[]>): T[];
|
|
51
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for Qwanyx Stack
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
export interface GraphNode {
|
|
6
|
+
_id: string;
|
|
7
|
+
p?: string | null;
|
|
8
|
+
type: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
editor?: string;
|
|
13
|
+
hidden?: boolean;
|
|
14
|
+
archive?: boolean;
|
|
15
|
+
data?: Record<string, any>;
|
|
16
|
+
created?: string;
|
|
17
|
+
modified?: string;
|
|
18
|
+
creator?: string;
|
|
19
|
+
owner?: string;
|
|
20
|
+
owner_group?: string | null;
|
|
21
|
+
permissions?: number;
|
|
22
|
+
acl?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface GraphEdge {
|
|
25
|
+
source_id: string | null;
|
|
26
|
+
target_id: string;
|
|
27
|
+
edge_type: string;
|
|
28
|
+
data?: Record<string, any>;
|
|
29
|
+
created: number;
|
|
30
|
+
modified?: number;
|
|
31
|
+
}
|
|
32
|
+
export type StackItem = GraphNode;
|
|
33
|
+
export interface StackContext {
|
|
34
|
+
apiUrl?: string;
|
|
35
|
+
systemId?: string;
|
|
36
|
+
onNavigate?: (item: StackItem) => void;
|
|
37
|
+
}
|
|
38
|
+
export interface ViewContext {
|
|
39
|
+
onBack?: () => void;
|
|
40
|
+
onEdit?: () => void;
|
|
41
|
+
onDelete?: () => void;
|
|
42
|
+
onOpenChat?: (nodeId: string) => void;
|
|
43
|
+
apiUrl?: string;
|
|
44
|
+
userId?: string;
|
|
45
|
+
graphClient?: any;
|
|
46
|
+
}
|
|
47
|
+
export type CardRenderer = (item: StackItem, context?: StackContext) => ReactNode;
|
|
48
|
+
export type ViewRenderer = (item: StackItem, context?: ViewContext) => ReactNode;
|
|
49
|
+
export interface EditorProps {
|
|
50
|
+
item?: StackItem;
|
|
51
|
+
graphClient: any;
|
|
52
|
+
onSave: (item: StackItem) => void;
|
|
53
|
+
onCancel: () => void;
|
|
54
|
+
onDelete?: () => void;
|
|
55
|
+
apiUrl?: string;
|
|
56
|
+
systemId?: string;
|
|
57
|
+
}
|
|
58
|
+
export type Editor = React.ComponentType<EditorProps>;
|
|
59
|
+
export interface StackConfig {
|
|
60
|
+
id: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
system_id: string;
|
|
63
|
+
parentId?: string;
|
|
64
|
+
displayMode?: 'children' | 'edges' | 'both';
|
|
65
|
+
maxWidth?: string;
|
|
66
|
+
minWidth?: string;
|
|
67
|
+
cardRenderer?: CardRenderer;
|
|
68
|
+
viewRenderer?: ViewRenderer;
|
|
69
|
+
items?: StackItem[];
|
|
70
|
+
loadItems?: () => Promise<StackItem[]>;
|
|
71
|
+
metadata?: {
|
|
72
|
+
hidden?: boolean;
|
|
73
|
+
archive?: boolean;
|
|
74
|
+
originalNode?: any;
|
|
75
|
+
isSelected?: boolean;
|
|
76
|
+
};
|
|
77
|
+
onNavigate?: (item: StackItem) => void;
|
|
78
|
+
onAdd?: () => void;
|
|
79
|
+
onAddRequest?: (data: any) => Promise<void>;
|
|
80
|
+
systemMessage?: {
|
|
81
|
+
type: 'error' | 'warning' | 'info' | 'success';
|
|
82
|
+
message: string;
|
|
83
|
+
details?: string;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface StackProps {
|
|
87
|
+
config: StackConfig;
|
|
88
|
+
onItemClick?: (item: StackItem) => void;
|
|
89
|
+
onClose?: () => void;
|
|
90
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
91
|
+
style?: React.CSSProperties;
|
|
92
|
+
currentView?: StackItem | null;
|
|
93
|
+
viewNode?: any;
|
|
94
|
+
onCloseView?: () => void;
|
|
95
|
+
onAdd?: () => void;
|
|
96
|
+
theme?: StackTheme;
|
|
97
|
+
apiUrl?: string;
|
|
98
|
+
userId?: string;
|
|
99
|
+
onCreateColumn?: (item: StackItem, direction: 'left' | 'right') => void;
|
|
100
|
+
}
|
|
101
|
+
export interface StackTheme {
|
|
102
|
+
primary?: string;
|
|
103
|
+
surface?: string;
|
|
104
|
+
surfaceHover?: string;
|
|
105
|
+
muted?: string;
|
|
106
|
+
text?: string;
|
|
107
|
+
textMuted?: string;
|
|
108
|
+
success?: string;
|
|
109
|
+
error?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface StackContainerProps {
|
|
112
|
+
stacks: StackConfig[];
|
|
113
|
+
defaultViewMode?: 'side' | 'fullscreen' | 'modal';
|
|
114
|
+
maxStacks?: number;
|
|
115
|
+
stackSpacing?: string;
|
|
116
|
+
containerPadding?: string;
|
|
117
|
+
onStackClose?: (stackId: string) => void;
|
|
118
|
+
onStackOpen?: (config: StackConfig) => void;
|
|
119
|
+
style?: React.CSSProperties;
|
|
120
|
+
}
|
|
121
|
+
export type LayoutMode = 'list' | 'grid' | 'masonry';
|
|
122
|
+
export interface GraphClientConfig {
|
|
123
|
+
baseUrl: string;
|
|
124
|
+
system_id: string;
|
|
125
|
+
}
|
|
126
|
+
export interface APIResponse<T = any> {
|
|
127
|
+
success: boolean;
|
|
128
|
+
data?: T;
|
|
129
|
+
result?: T;
|
|
130
|
+
error?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface ApiConfig {
|
|
133
|
+
baseUrl: string;
|
|
134
|
+
timeout?: number;
|
|
135
|
+
headers?: Record<string, string>;
|
|
136
|
+
}
|
|
137
|
+
export interface ApiResponse<T = any> {
|
|
138
|
+
data: T;
|
|
139
|
+
success: boolean;
|
|
140
|
+
message?: string;
|
|
141
|
+
error?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface PaginationParams {
|
|
144
|
+
page?: number;
|
|
145
|
+
limit?: number;
|
|
146
|
+
offset?: number;
|
|
147
|
+
}
|
|
148
|
+
export interface SortParams {
|
|
149
|
+
sortBy?: string;
|
|
150
|
+
sortOrder?: 'asc' | 'desc';
|
|
151
|
+
}
|
|
152
|
+
export interface FilterParams {
|
|
153
|
+
[key: string]: any;
|
|
154
|
+
}
|
|
155
|
+
export interface QueryParams extends PaginationParams, SortParams, FilterParams {
|
|
156
|
+
}
|
|
157
|
+
export interface PaginatedResponse<T = any> {
|
|
158
|
+
data: T[];
|
|
159
|
+
total: number;
|
|
160
|
+
page: number;
|
|
161
|
+
limit: number;
|
|
162
|
+
totalPages: number;
|
|
163
|
+
}
|
|
164
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
165
|
+
export interface RequestOptions {
|
|
166
|
+
method?: HttpMethod;
|
|
167
|
+
headers?: Record<string, string>;
|
|
168
|
+
body?: any;
|
|
169
|
+
params?: QueryParams;
|
|
170
|
+
}
|
|
171
|
+
export interface MailClientConfig {
|
|
172
|
+
baseUrl: string;
|
|
173
|
+
system_id: string;
|
|
174
|
+
}
|
|
175
|
+
export interface MailServer {
|
|
176
|
+
host: string;
|
|
177
|
+
port: string;
|
|
178
|
+
user: string;
|
|
179
|
+
password: string;
|
|
180
|
+
}
|
|
181
|
+
export interface MailAccount {
|
|
182
|
+
id: string;
|
|
183
|
+
label: string;
|
|
184
|
+
firstName: string;
|
|
185
|
+
lastName: string;
|
|
186
|
+
email: string;
|
|
187
|
+
signature?: string;
|
|
188
|
+
imap: MailServer;
|
|
189
|
+
smtp: MailServer;
|
|
190
|
+
}
|
|
191
|
+
export interface EmailMessage {
|
|
192
|
+
uid: number;
|
|
193
|
+
subject: string;
|
|
194
|
+
from: string;
|
|
195
|
+
date: string;
|
|
196
|
+
seen: boolean;
|
|
197
|
+
}
|
|
198
|
+
export interface MailListResult {
|
|
199
|
+
account: {
|
|
200
|
+
id: string;
|
|
201
|
+
label: string;
|
|
202
|
+
email: string;
|
|
203
|
+
};
|
|
204
|
+
mailbox: {
|
|
205
|
+
name: string;
|
|
206
|
+
total: number;
|
|
207
|
+
};
|
|
208
|
+
messages: EmailMessage[];
|
|
209
|
+
}
|
|
210
|
+
export interface ImapResponse {
|
|
211
|
+
ok: boolean;
|
|
212
|
+
command: string;
|
|
213
|
+
error?: string;
|
|
214
|
+
mailbox?: string;
|
|
215
|
+
exists?: number;
|
|
216
|
+
recent?: number;
|
|
217
|
+
unseen?: number;
|
|
218
|
+
folders?: FolderInfo[];
|
|
219
|
+
uid?: string;
|
|
220
|
+
}
|
|
221
|
+
export interface FolderInfo {
|
|
222
|
+
name: string;
|
|
223
|
+
delimiter: string | null;
|
|
224
|
+
attributes: string;
|
|
225
|
+
}
|
package/package.json
CHANGED