@nice2dev/ui-communication 1.3.13 → 1.3.14
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui-communication",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.14",
|
|
4
4
|
"description": "NiceCommunication — full-spectrum communication suite: chat bubble, messenger, voice/video calls, multi-party conference, and Teams-style workspace. Provider-agnostic RTC transport.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react-dom": ">=17.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@nice2dev/ui": "^1.3.
|
|
38
|
+
"@nice2dev/ui": "^1.3.14",
|
|
39
39
|
"@testing-library/jest-dom": "^7.0.1",
|
|
40
40
|
"@testing-library/react": "^16.3.3",
|
|
41
41
|
"@types/react": "^19.2.18",
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { CollaborationConfig } from './yjs-integration';
|
|
2
|
-
/**
|
|
3
|
-
* @file Collaborative DataGrid with CRDT
|
|
4
|
-
* @description Real-time collaborative data grid editing
|
|
5
|
-
*/
|
|
6
|
-
import * as Y from 'yjs';
|
|
7
|
-
export interface CollaborativeDataGridConfig<T> extends CollaborationConfig {
|
|
8
|
-
/** Initial rows data */
|
|
9
|
-
initialData?: T[];
|
|
10
|
-
/** Column definitions */
|
|
11
|
-
columns: CollaborativeColumnDef<T>[];
|
|
12
|
-
/** Row ID field */
|
|
13
|
-
rowIdField: keyof T;
|
|
14
|
-
}
|
|
15
|
-
export interface CollaborativeColumnDef<T> {
|
|
16
|
-
field: keyof T;
|
|
17
|
-
header: string;
|
|
18
|
-
editable?: boolean;
|
|
19
|
-
width?: number;
|
|
20
|
-
type?: 'text' | 'number' | 'boolean' | 'date' | 'select';
|
|
21
|
-
options?: {
|
|
22
|
-
value: string;
|
|
23
|
-
label: string;
|
|
24
|
-
}[];
|
|
25
|
-
}
|
|
26
|
-
export interface CellEdit<T> {
|
|
27
|
-
rowId: string;
|
|
28
|
-
field: keyof T;
|
|
29
|
-
value: unknown;
|
|
30
|
-
userId: string;
|
|
31
|
-
timestamp: number;
|
|
32
|
-
}
|
|
33
|
-
export interface ActiveEdit {
|
|
34
|
-
rowId: string;
|
|
35
|
-
field: string;
|
|
36
|
-
user: {
|
|
37
|
-
id: string;
|
|
38
|
-
name: string;
|
|
39
|
-
color: string;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Hook for collaborative DataGrid editing
|
|
44
|
-
*/
|
|
45
|
-
export declare function useCollaborativeDataGrid<T extends Record<string, unknown>>(config: CollaborativeDataGridConfig<T>): {
|
|
46
|
-
rows: T[];
|
|
47
|
-
columns: CollaborativeColumnDef<T>[];
|
|
48
|
-
collaborators: import('./yjs-integration').CollaborationUser[];
|
|
49
|
-
isConnected: boolean;
|
|
50
|
-
isSynced: boolean;
|
|
51
|
-
activeEdits: ActiveEdit[];
|
|
52
|
-
startCellEdit: (rowId: string, field: keyof T) => void;
|
|
53
|
-
endCellEdit: () => void;
|
|
54
|
-
updateCell: (rowIndex: number, field: keyof T, value: unknown) => void;
|
|
55
|
-
addRow: (row: T) => void;
|
|
56
|
-
removeRow: (rowIndex: number) => void;
|
|
57
|
-
isCellLocked: (rowId: string, field: keyof T) => ActiveEdit | undefined;
|
|
58
|
-
getRowById: (id: string) => {
|
|
59
|
-
row: T;
|
|
60
|
-
index: number;
|
|
61
|
-
} | undefined;
|
|
62
|
-
};
|
|
63
|
-
export interface ConflictResolution<T> {
|
|
64
|
-
strategy: 'lastWriteWins' | 'firstWriteWins' | 'merge' | 'custom';
|
|
65
|
-
mergeFunction?: (local: T, remote: T) => T;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Hook for conflict resolution in collaborative editing
|
|
69
|
-
*/
|
|
70
|
-
export declare function useConflictResolution<T>(resolution: ConflictResolution<T>): {
|
|
71
|
-
resolve: (local: T, remote: T, timestamp: {
|
|
72
|
-
local: number;
|
|
73
|
-
remote: number;
|
|
74
|
-
}) => T;
|
|
75
|
-
};
|
|
76
|
-
export interface ChangeHistoryEntry<T> {
|
|
77
|
-
id: string;
|
|
78
|
-
type: 'insert' | 'update' | 'delete';
|
|
79
|
-
rowId: string;
|
|
80
|
-
field?: keyof T;
|
|
81
|
-
oldValue?: unknown;
|
|
82
|
-
newValue?: unknown;
|
|
83
|
-
user: {
|
|
84
|
-
id: string;
|
|
85
|
-
name: string;
|
|
86
|
-
};
|
|
87
|
-
timestamp: number;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Hook for tracking change history
|
|
91
|
-
*/
|
|
92
|
-
export declare function useChangeHistory<T>(ydoc: Y.Doc | null, rowIdField: keyof T): {
|
|
93
|
-
history: ChangeHistoryEntry<T>[];
|
|
94
|
-
clearHistory: () => void;
|
|
95
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { CollaborationConfig, CollaborationUser } from './yjs-integration';
|
|
2
|
-
export interface CollaborativeFormConfig<T extends Record<string, unknown>> extends CollaborationConfig {
|
|
3
|
-
/** Initial form values */
|
|
4
|
-
initialValues?: Partial<T>;
|
|
5
|
-
/** Field validation rules */
|
|
6
|
-
validation?: FormValidation<T>;
|
|
7
|
-
/** Debounce delay for syncing (ms) */
|
|
8
|
-
syncDelay?: number;
|
|
9
|
-
}
|
|
10
|
-
export type FormValidation<T> = {
|
|
11
|
-
[K in keyof T]?: (value: T[K], formValues: Partial<T>) => string | undefined;
|
|
12
|
-
};
|
|
13
|
-
export interface FieldFocus {
|
|
14
|
-
fieldName: string;
|
|
15
|
-
user: CollaborationUser;
|
|
16
|
-
}
|
|
17
|
-
export interface FormState<T> {
|
|
18
|
-
values: Partial<T>;
|
|
19
|
-
errors: Partial<Record<keyof T, string>>;
|
|
20
|
-
touched: Partial<Record<keyof T, boolean>>;
|
|
21
|
-
isDirty: boolean;
|
|
22
|
-
isValid: boolean;
|
|
23
|
-
focusedFields: FieldFocus[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Hook for collaborative form editing
|
|
27
|
-
*/
|
|
28
|
-
export declare function useCollaborativeForm<T extends Record<string, unknown>>(config: CollaborativeFormConfig<T>): {
|
|
29
|
-
values: Partial<T>;
|
|
30
|
-
errors: Partial<Record<keyof T, string>>;
|
|
31
|
-
touched: Partial<Record<keyof T, boolean>>;
|
|
32
|
-
isDirty: boolean;
|
|
33
|
-
isValid: boolean;
|
|
34
|
-
focusedFields: FieldFocus[];
|
|
35
|
-
collaborators: CollaborationUser[];
|
|
36
|
-
isConnected: boolean;
|
|
37
|
-
isSynced: boolean;
|
|
38
|
-
setFieldValue: <K extends keyof T>(fieldName: K, value: T[K]) => void;
|
|
39
|
-
setFieldTouched: (fieldName: keyof T, isTouched?: boolean) => void;
|
|
40
|
-
handleFieldFocus: (fieldName: keyof T) => void;
|
|
41
|
-
handleFieldBlur: (fieldName: keyof T) => void;
|
|
42
|
-
isFieldFocused: (fieldName: keyof T) => FieldFocus | undefined;
|
|
43
|
-
validateField: (fieldName: keyof T, value: T[typeof fieldName]) => string | undefined;
|
|
44
|
-
validateForm: () => boolean;
|
|
45
|
-
resetForm: () => void;
|
|
46
|
-
handleSubmit: (onSubmit: (values: Partial<T>) => void | Promise<void>) => (e?: React.FormEvent) => Promise<void>;
|
|
47
|
-
};
|
|
48
|
-
export interface CollaborativeFieldProps {
|
|
49
|
-
name: string;
|
|
50
|
-
focusedBy?: FieldFocus;
|
|
51
|
-
children: React.ReactNode;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Wrapper component showing collaborative field state
|
|
55
|
-
*/
|
|
56
|
-
export declare function CollaborativeFieldWrapper({ name: _name, focusedBy, children, }: CollaborativeFieldProps): import("react").JSX.Element;
|
|
57
|
-
/**
|
|
58
|
-
* Convenience hook for individual form field
|
|
59
|
-
*/
|
|
60
|
-
export declare function useCollaborativeField<T extends Record<string, unknown>, K extends keyof T>(form: ReturnType<typeof useCollaborativeForm<T>>, fieldName: K): {
|
|
61
|
-
value: Partial<T>[K];
|
|
62
|
-
error: Partial<Record<keyof T, string>>[K] | undefined;
|
|
63
|
-
touched: Partial<Record<keyof T, boolean>>[K];
|
|
64
|
-
focusedBy: FieldFocus | undefined;
|
|
65
|
-
onChange: (newValue: T[K]) => void;
|
|
66
|
-
onFocus: () => void;
|
|
67
|
-
onBlur: () => void;
|
|
68
|
-
inputProps: {
|
|
69
|
-
value: string | NonNullable<Partial<T>[K]>;
|
|
70
|
-
onFocus: () => void;
|
|
71
|
-
onBlur: () => void;
|
|
72
|
-
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Nice2Dev Real-time Collaboration - Yjs/CRDT Integration
|
|
3
|
-
* @description Real-time collaborative editing using Yjs CRDTs
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
import * as Y from 'yjs';
|
|
7
|
-
export interface CollaborationConfig {
|
|
8
|
-
/** Document ID */
|
|
9
|
-
documentId: string;
|
|
10
|
-
/** User information */
|
|
11
|
-
user: CollaborationUser;
|
|
12
|
-
/** Server URL for WebSocket */
|
|
13
|
-
serverUrl?: string;
|
|
14
|
-
/** Enable WebRTC for peer-to-peer */
|
|
15
|
-
useWebRTC?: boolean;
|
|
16
|
-
/** Enable offline persistence */
|
|
17
|
-
persistence?: boolean;
|
|
18
|
-
/** Awareness features */
|
|
19
|
-
awareness?: AwarenessConfig;
|
|
20
|
-
}
|
|
21
|
-
export interface CollaborationUser {
|
|
22
|
-
id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
color: string;
|
|
25
|
-
avatar?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface AwarenessConfig {
|
|
28
|
-
/** Update interval in ms */
|
|
29
|
-
updateInterval?: number;
|
|
30
|
-
/** Show cursors */
|
|
31
|
-
showCursors?: boolean;
|
|
32
|
-
/** Show selections */
|
|
33
|
-
showSelections?: boolean;
|
|
34
|
-
/** Show user presence */
|
|
35
|
-
showPresence?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface AwarenessState {
|
|
38
|
-
user: CollaborationUser;
|
|
39
|
-
cursor?: {
|
|
40
|
-
x: number;
|
|
41
|
-
y: number;
|
|
42
|
-
};
|
|
43
|
-
selection?: {
|
|
44
|
-
start: number;
|
|
45
|
-
end: number;
|
|
46
|
-
};
|
|
47
|
-
field?: string;
|
|
48
|
-
lastActive: number;
|
|
49
|
-
}
|
|
50
|
-
export interface CollaborationState {
|
|
51
|
-
isConnected: boolean;
|
|
52
|
-
isSynced: boolean;
|
|
53
|
-
users: CollaborationUser[];
|
|
54
|
-
awareness: Map<number, AwarenessState>;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Main collaboration hook - creates and manages a Yjs document
|
|
58
|
-
*/
|
|
59
|
-
export declare function useCollaboration(config: CollaborationConfig): {
|
|
60
|
-
ydoc: Y.Doc | null;
|
|
61
|
-
state: CollaborationState;
|
|
62
|
-
updateAwareness: (update: Partial<AwarenessState>) => void;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Hook for collaborative text editing
|
|
66
|
-
*/
|
|
67
|
-
export declare function useCollaborativeText(ydoc: Y.Doc | null, fieldName: string): {
|
|
68
|
-
value: string;
|
|
69
|
-
insert: (index: number, text: string) => void;
|
|
70
|
-
delete: (index: number, length: number) => void;
|
|
71
|
-
replace: (newValue: string) => void;
|
|
72
|
-
ytext: Y.Text | null;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Hook for collaborative arrays (e.g., table rows, list items)
|
|
76
|
-
*/
|
|
77
|
-
export declare function useCollaborativeArray<T>(ydoc: Y.Doc | null, arrayName: string): {
|
|
78
|
-
items: T[];
|
|
79
|
-
push: (...newItems: T[]) => void;
|
|
80
|
-
insert: (index: number, ...newItems: T[]) => void;
|
|
81
|
-
delete: (index: number, length?: number) => void;
|
|
82
|
-
update: (index: number, value: T) => void;
|
|
83
|
-
move: (fromIndex: number, toIndex: number) => void;
|
|
84
|
-
yarray: Y.Array<T> | null;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Hook for collaborative maps (e.g., form fields)
|
|
88
|
-
*/
|
|
89
|
-
export declare function useCollaborativeMap<T extends Record<string, unknown>>(ydoc: Y.Doc | null, mapName: string): {
|
|
90
|
-
data: Partial<T>;
|
|
91
|
-
set: <K extends keyof T>(key: K, value: T[K]) => void;
|
|
92
|
-
get: <K extends keyof T>(key: K) => T[K] | undefined;
|
|
93
|
-
delete: (key: keyof T) => void;
|
|
94
|
-
setMultiple: (updates: Partial<T>) => void;
|
|
95
|
-
ymap: Y.Map<unknown> | null;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Hook for tracking and displaying user cursors
|
|
99
|
-
*/
|
|
100
|
-
export declare function useCursorTracking(updateAwareness: (update: Partial<AwarenessState>) => void, enabled?: boolean): void;
|
|
101
|
-
/**
|
|
102
|
-
* Hook for tracking text selection
|
|
103
|
-
*/
|
|
104
|
-
export declare function useSelectionTracking(updateAwareness: (update: Partial<AwarenessState>) => void, fieldName: string, enabled?: boolean): void;
|
|
105
|
-
/**
|
|
106
|
-
* Hook for collaborative undo/redo
|
|
107
|
-
*/
|
|
108
|
-
export declare function useCollaborativeHistory(ydoc: Y.Doc | null): {
|
|
109
|
-
undo: () => void;
|
|
110
|
-
redo: () => void;
|
|
111
|
-
canUndo: boolean;
|
|
112
|
-
canRedo: boolean;
|
|
113
|
-
};
|
|
114
|
-
export interface PresenceAvatarsProps {
|
|
115
|
-
users: CollaborationUser[];
|
|
116
|
-
maxDisplay?: number;
|
|
117
|
-
size?: 'sm' | 'md' | 'lg';
|
|
118
|
-
className?: string;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Component displaying active collaborators
|
|
122
|
-
*/
|
|
123
|
-
export declare function PresenceAvatars({ users, maxDisplay, size, className, }: PresenceAvatarsProps): import("react").JSX.Element;
|
|
124
|
-
export interface CursorOverlayProps {
|
|
125
|
-
awareness: Map<number, AwarenessState>;
|
|
126
|
-
localClientId: number;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Component displaying other users' cursors
|
|
130
|
-
*/
|
|
131
|
-
export declare function CursorOverlay({ awareness, localClientId }: CursorOverlayProps): import("react").JSX.Element;
|
|
132
|
-
export * from 'yjs';
|
|
133
|
-
export { WebsocketProvider } from 'y-websocket';
|
|
134
|
-
export { WebrtcProvider } from 'y-webrtc';
|
|
135
|
-
export { IndexeddbPersistence } from 'y-indexeddb';
|
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Nice2Dev Communication Controls
|
|
3
|
-
* @description Video conferencing, screen sharing, whiteboard, chat
|
|
4
|
-
*/
|
|
5
|
-
export interface VideoConferenceConfig {
|
|
6
|
-
/** Room ID */
|
|
7
|
-
roomId: string;
|
|
8
|
-
/** User info */
|
|
9
|
-
user: {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
avatar?: string;
|
|
13
|
-
};
|
|
14
|
-
/** ICE servers for WebRTC */
|
|
15
|
-
iceServers?: RTCIceServer[];
|
|
16
|
-
/** Signaling server URL */
|
|
17
|
-
signalingUrl: string;
|
|
18
|
-
/** Enable audio */
|
|
19
|
-
audio?: boolean;
|
|
20
|
-
/** Enable video */
|
|
21
|
-
video?: boolean;
|
|
22
|
-
/** Max participants */
|
|
23
|
-
maxParticipants?: number;
|
|
24
|
-
}
|
|
25
|
-
export interface Participant {
|
|
26
|
-
id: string;
|
|
27
|
-
name: string;
|
|
28
|
-
avatar?: string;
|
|
29
|
-
stream?: MediaStream;
|
|
30
|
-
audioEnabled: boolean;
|
|
31
|
-
videoEnabled: boolean;
|
|
32
|
-
isScreenSharing: boolean;
|
|
33
|
-
isSpeaking: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface VideoConferenceState {
|
|
36
|
-
isConnected: boolean;
|
|
37
|
-
participants: Participant[];
|
|
38
|
-
localStream: MediaStream | null;
|
|
39
|
-
screenStream: MediaStream | null;
|
|
40
|
-
audioEnabled: boolean;
|
|
41
|
-
videoEnabled: boolean;
|
|
42
|
-
isScreenSharing: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Hook for video conferencing
|
|
46
|
-
*/
|
|
47
|
-
export declare function useVideoConference(_config: VideoConferenceConfig): {
|
|
48
|
-
state: VideoConferenceState;
|
|
49
|
-
join: () => Promise<void>;
|
|
50
|
-
leave: () => void;
|
|
51
|
-
toggleAudio: () => void;
|
|
52
|
-
toggleVideo: () => void;
|
|
53
|
-
startScreenShare: () => Promise<void>;
|
|
54
|
-
stopScreenShare: () => void;
|
|
55
|
-
onParticipantJoined: (_callback: (participant: Participant) => void) => void;
|
|
56
|
-
onParticipantLeft: (_callback: (participantId: string) => void) => void;
|
|
57
|
-
onStreamUpdated: (_callback: (participantId: string, stream: MediaStream) => void) => void;
|
|
58
|
-
};
|
|
59
|
-
export interface ScreenShareConfig {
|
|
60
|
-
/** Enable audio capture */
|
|
61
|
-
withAudio?: boolean;
|
|
62
|
-
/** Video quality */
|
|
63
|
-
quality?: 'low' | 'medium' | 'high' | 'hd';
|
|
64
|
-
/** Preferred display surface */
|
|
65
|
-
displaySurface?: 'monitor' | 'window' | 'application' | 'browser';
|
|
66
|
-
}
|
|
67
|
-
export interface ScreenAnnotation {
|
|
68
|
-
id: string;
|
|
69
|
-
type: 'drawing' | 'text' | 'arrow' | 'rectangle' | 'highlight';
|
|
70
|
-
data: unknown;
|
|
71
|
-
color: string;
|
|
72
|
-
userId: string;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Hook for screen sharing with annotation
|
|
76
|
-
*/
|
|
77
|
-
export declare function useScreenShare(_config?: ScreenShareConfig): {
|
|
78
|
-
stream: MediaStream | null;
|
|
79
|
-
isSharing: boolean;
|
|
80
|
-
annotations: ScreenAnnotation[];
|
|
81
|
-
startSharing: () => Promise<{
|
|
82
|
-
stream: MediaStream | null;
|
|
83
|
-
}>;
|
|
84
|
-
stopSharing: () => void;
|
|
85
|
-
addAnnotation: (_annotation: Omit<ScreenAnnotation, "id">) => void;
|
|
86
|
-
removeAnnotation: (_id: string) => void;
|
|
87
|
-
clearAnnotations: () => void;
|
|
88
|
-
enableRemoteControl: () => void;
|
|
89
|
-
disableRemoteControl: () => void;
|
|
90
|
-
};
|
|
91
|
-
export interface WhiteboardConfig {
|
|
92
|
-
/** Board ID for collaboration */
|
|
93
|
-
boardId: string;
|
|
94
|
-
/** User info */
|
|
95
|
-
user: {
|
|
96
|
-
id: string;
|
|
97
|
-
name: string;
|
|
98
|
-
color: string;
|
|
99
|
-
};
|
|
100
|
-
/** Collaboration server URL */
|
|
101
|
-
serverUrl?: string;
|
|
102
|
-
/** Board dimensions */
|
|
103
|
-
width?: number;
|
|
104
|
-
height?: number;
|
|
105
|
-
}
|
|
106
|
-
export interface WhiteboardElement {
|
|
107
|
-
id: string;
|
|
108
|
-
type: 'path' | 'rectangle' | 'ellipse' | 'line' | 'arrow' | 'text' | 'image' | 'sticky';
|
|
109
|
-
x: number;
|
|
110
|
-
y: number;
|
|
111
|
-
width?: number;
|
|
112
|
-
height?: number;
|
|
113
|
-
points?: {
|
|
114
|
-
x: number;
|
|
115
|
-
y: number;
|
|
116
|
-
}[];
|
|
117
|
-
fill?: string;
|
|
118
|
-
stroke?: string;
|
|
119
|
-
strokeWidth?: number;
|
|
120
|
-
text?: string;
|
|
121
|
-
fontSize?: number;
|
|
122
|
-
imageUrl?: string;
|
|
123
|
-
rotation?: number;
|
|
124
|
-
opacity?: number;
|
|
125
|
-
locked?: boolean;
|
|
126
|
-
userId: string;
|
|
127
|
-
}
|
|
128
|
-
export interface WhiteboardTool {
|
|
129
|
-
type: 'select' | 'pen' | 'highlighter' | 'eraser' | 'rectangle' | 'ellipse' | 'line' | 'arrow' | 'text' | 'sticky' | 'image' | 'pan' | 'laser';
|
|
130
|
-
color?: string;
|
|
131
|
-
strokeWidth?: number;
|
|
132
|
-
fontSize?: number;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Hook for collaborative whiteboard
|
|
136
|
-
*/
|
|
137
|
-
export declare function useWhiteboard(_config: WhiteboardConfig): {
|
|
138
|
-
elements: WhiteboardElement[];
|
|
139
|
-
selectedIds: string[];
|
|
140
|
-
currentTool: WhiteboardTool;
|
|
141
|
-
zoom: number;
|
|
142
|
-
pan: {
|
|
143
|
-
x: number;
|
|
144
|
-
y: number;
|
|
145
|
-
};
|
|
146
|
-
collaborators: {
|
|
147
|
-
id: string;
|
|
148
|
-
name: string;
|
|
149
|
-
color: string;
|
|
150
|
-
cursor?: {
|
|
151
|
-
x: number;
|
|
152
|
-
y: number;
|
|
153
|
-
};
|
|
154
|
-
}[];
|
|
155
|
-
addElement: (_element: Omit<WhiteboardElement, "id" | "userId">) => void;
|
|
156
|
-
updateElement: (_id: string, _updates: Partial<WhiteboardElement>) => void;
|
|
157
|
-
deleteElements: (_ids: string[]) => void;
|
|
158
|
-
selectElements: (_ids: string[]) => void;
|
|
159
|
-
setTool: (_tool: WhiteboardTool) => void;
|
|
160
|
-
setZoom: (_zoom: number) => void;
|
|
161
|
-
setPan: (_pan: {
|
|
162
|
-
x: number;
|
|
163
|
-
y: number;
|
|
164
|
-
}) => void;
|
|
165
|
-
undo: () => void;
|
|
166
|
-
redo: () => void;
|
|
167
|
-
canUndo: boolean;
|
|
168
|
-
canRedo: boolean;
|
|
169
|
-
exportAsImage: () => Promise<string>;
|
|
170
|
-
exportAsSvg: () => string;
|
|
171
|
-
exportAsJson: () => object;
|
|
172
|
-
importFromJson: (_data: object) => void;
|
|
173
|
-
};
|
|
174
|
-
export interface ChatRoomConfig {
|
|
175
|
-
/** Room ID */
|
|
176
|
-
roomId: string;
|
|
177
|
-
/** User info */
|
|
178
|
-
user: {
|
|
179
|
-
id: string;
|
|
180
|
-
name: string;
|
|
181
|
-
avatar?: string;
|
|
182
|
-
};
|
|
183
|
-
/** Server URL */
|
|
184
|
-
serverUrl: string;
|
|
185
|
-
/** Enable file sharing */
|
|
186
|
-
enableFiles?: boolean;
|
|
187
|
-
/** Enable threads */
|
|
188
|
-
enableThreads?: boolean;
|
|
189
|
-
/** Enable reactions */
|
|
190
|
-
enableReactions?: boolean;
|
|
191
|
-
}
|
|
192
|
-
export interface ChatMessage {
|
|
193
|
-
id: string;
|
|
194
|
-
content: string;
|
|
195
|
-
type: 'text' | 'file' | 'image' | 'system';
|
|
196
|
-
userId: string;
|
|
197
|
-
userName: string;
|
|
198
|
-
userAvatar?: string;
|
|
199
|
-
timestamp: Date;
|
|
200
|
-
threadId?: string;
|
|
201
|
-
replyTo?: string;
|
|
202
|
-
reactions?: {
|
|
203
|
-
emoji: string;
|
|
204
|
-
userIds: string[];
|
|
205
|
-
}[];
|
|
206
|
-
file?: {
|
|
207
|
-
name: string;
|
|
208
|
-
url: string;
|
|
209
|
-
size: number;
|
|
210
|
-
type: string;
|
|
211
|
-
};
|
|
212
|
-
edited?: boolean;
|
|
213
|
-
deleted?: boolean;
|
|
214
|
-
}
|
|
215
|
-
export interface ChatThread {
|
|
216
|
-
id: string;
|
|
217
|
-
parentMessageId: string;
|
|
218
|
-
messages: ChatMessage[];
|
|
219
|
-
participantIds: string[];
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Hook for chat room
|
|
223
|
-
*/
|
|
224
|
-
export declare function useChatRoom(_config: ChatRoomConfig): {
|
|
225
|
-
messages: ChatMessage[];
|
|
226
|
-
threads: ChatThread[];
|
|
227
|
-
participants: {
|
|
228
|
-
id: string;
|
|
229
|
-
name: string;
|
|
230
|
-
avatar?: string;
|
|
231
|
-
isOnline: boolean;
|
|
232
|
-
}[];
|
|
233
|
-
isTyping: {
|
|
234
|
-
userId: string;
|
|
235
|
-
userName: string;
|
|
236
|
-
}[];
|
|
237
|
-
unreadCount: number;
|
|
238
|
-
sendMessage: (_content: string, _options?: {
|
|
239
|
-
threadId?: string;
|
|
240
|
-
replyTo?: string;
|
|
241
|
-
}) => Promise<void>;
|
|
242
|
-
editMessage: (_messageId: string, _content: string) => Promise<void>;
|
|
243
|
-
deleteMessage: (_messageId: string) => Promise<void>;
|
|
244
|
-
addReaction: (_messageId: string, _emoji: string) => Promise<void>;
|
|
245
|
-
removeReaction: (_messageId: string, _emoji: string) => Promise<void>;
|
|
246
|
-
uploadFile: (_file: File) => Promise<{
|
|
247
|
-
url: string;
|
|
248
|
-
}>;
|
|
249
|
-
setTyping: (_isTyping: boolean) => void;
|
|
250
|
-
markAsRead: () => void;
|
|
251
|
-
startThread: (_messageId: string) => void;
|
|
252
|
-
closeThread: () => void;
|
|
253
|
-
onNewMessage: (_callback: (message: ChatMessage) => void) => () => void;
|
|
254
|
-
onMessageEdited: (_callback: (message: ChatMessage) => void) => () => void;
|
|
255
|
-
onMessageDeleted: (_callback: (messageId: string) => void) => () => void;
|
|
256
|
-
onTypingChange: (_callback: (typing: {
|
|
257
|
-
userId: string;
|
|
258
|
-
userName: string;
|
|
259
|
-
}[]) => void) => () => void;
|
|
260
|
-
};
|
|
261
|
-
export interface NotificationHubConfig {
|
|
262
|
-
/** User ID */
|
|
263
|
-
userId: string;
|
|
264
|
-
/** API base URL */
|
|
265
|
-
apiUrl: string;
|
|
266
|
-
/** Enable push notifications */
|
|
267
|
-
enablePush?: boolean;
|
|
268
|
-
/** Enable in-app notifications */
|
|
269
|
-
enableInApp?: boolean;
|
|
270
|
-
/** Notification preferences */
|
|
271
|
-
preferences?: NotificationPreferences;
|
|
272
|
-
}
|
|
273
|
-
export interface NotificationPreferences {
|
|
274
|
-
email: boolean;
|
|
275
|
-
push: boolean;
|
|
276
|
-
inApp: boolean;
|
|
277
|
-
channels: {
|
|
278
|
-
[channel: string]: {
|
|
279
|
-
email: boolean;
|
|
280
|
-
push: boolean;
|
|
281
|
-
inApp: boolean;
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
export interface Notification {
|
|
286
|
-
id: string;
|
|
287
|
-
type: string;
|
|
288
|
-
channel: string;
|
|
289
|
-
title: string;
|
|
290
|
-
body: string;
|
|
291
|
-
data?: Record<string, unknown>;
|
|
292
|
-
read: boolean;
|
|
293
|
-
timestamp: Date;
|
|
294
|
-
expiresAt?: Date;
|
|
295
|
-
actionUrl?: string;
|
|
296
|
-
imageUrl?: string;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Hook for unified notification hub
|
|
300
|
-
*/
|
|
301
|
-
export declare function useNotificationHub(_config: NotificationHubConfig): {
|
|
302
|
-
notifications: Notification[];
|
|
303
|
-
unreadCount: number;
|
|
304
|
-
preferences: NotificationPreferences;
|
|
305
|
-
markAsRead: (_notificationId: string) => Promise<void>;
|
|
306
|
-
markAllAsRead: () => Promise<void>;
|
|
307
|
-
deleteNotification: (_notificationId: string) => Promise<void>;
|
|
308
|
-
clearAll: () => Promise<void>;
|
|
309
|
-
updatePreferences: (_preferences: Partial<NotificationPreferences>) => Promise<void>;
|
|
310
|
-
requestPushPermission: () => Promise<boolean>;
|
|
311
|
-
subscribeToPush: () => Promise<void>;
|
|
312
|
-
unsubscribeFromPush: () => Promise<void>;
|
|
313
|
-
subscribe: () => () => void;
|
|
314
|
-
onNotification: (_callback: (notification: Notification) => void) => () => void;
|
|
315
|
-
};
|
|
316
|
-
export interface CommentConfig {
|
|
317
|
-
/** Entity type (e.g., 'document', 'task', 'cell') */
|
|
318
|
-
entityType: string;
|
|
319
|
-
/** Entity ID */
|
|
320
|
-
entityId: string;
|
|
321
|
-
/** User info */
|
|
322
|
-
user: {
|
|
323
|
-
id: string;
|
|
324
|
-
name: string;
|
|
325
|
-
avatar?: string;
|
|
326
|
-
};
|
|
327
|
-
/** API URL */
|
|
328
|
-
apiUrl: string;
|
|
329
|
-
}
|
|
330
|
-
export interface Comment {
|
|
331
|
-
id: string;
|
|
332
|
-
content: string;
|
|
333
|
-
userId: string;
|
|
334
|
-
userName: string;
|
|
335
|
-
userAvatar?: string;
|
|
336
|
-
timestamp: Date;
|
|
337
|
-
edited?: boolean;
|
|
338
|
-
resolved?: boolean;
|
|
339
|
-
position?: {
|
|
340
|
-
startOffset?: number;
|
|
341
|
-
endOffset?: number;
|
|
342
|
-
x?: number;
|
|
343
|
-
y?: number;
|
|
344
|
-
page?: number;
|
|
345
|
-
};
|
|
346
|
-
replies?: Comment[];
|
|
347
|
-
mentions?: string[];
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Hook for commenting/annotation system
|
|
351
|
-
*/
|
|
352
|
-
export declare function useComments(_config: CommentConfig): {
|
|
353
|
-
comments: Comment[];
|
|
354
|
-
activeCommentId: string | null;
|
|
355
|
-
addComment: (_content: string, _position?: Comment["position"]) => Promise<void>;
|
|
356
|
-
editComment: (_commentId: string, _content: string) => Promise<void>;
|
|
357
|
-
deleteComment: (_commentId: string) => Promise<void>;
|
|
358
|
-
replyToComment: (_commentId: string, _content: string) => Promise<void>;
|
|
359
|
-
resolveComment: (_commentId: string) => Promise<void>;
|
|
360
|
-
unresolveComment: (_commentId: string) => Promise<void>;
|
|
361
|
-
setActiveComment: (_commentId: string | null) => void;
|
|
362
|
-
searchUsers: (_query: string) => Promise<{
|
|
363
|
-
id: string;
|
|
364
|
-
name: string;
|
|
365
|
-
}[]>;
|
|
366
|
-
onCommentAdded: (_callback: (comment: Comment) => void) => () => void;
|
|
367
|
-
onCommentUpdated: (_callback: (comment: Comment) => void) => () => void;
|
|
368
|
-
onCommentDeleted: (_callback: (commentId: string) => void) => () => void;
|
|
369
|
-
};
|