@cdevhub/ngx-chat 1.0.7 → 1.0.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/package.json
CHANGED
|
@@ -1560,10 +1560,12 @@ interface ChatSendEvent {
|
|
|
1560
1560
|
readonly replyTo?: string;
|
|
1561
1561
|
/** Optional metadata to include with the message */
|
|
1562
1562
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
1563
|
+
/** Optional timestamp for message ordering (defaults to now if not provided) */
|
|
1564
|
+
readonly timestamp?: Date;
|
|
1563
1565
|
}
|
|
1564
1566
|
/**
|
|
1565
1567
|
* Reference to a pending attachment for send events.
|
|
1566
|
-
*
|
|
1568
|
+
* Contains the File object for the parent to upload.
|
|
1567
1569
|
*/
|
|
1568
1570
|
interface PendingAttachmentRef {
|
|
1569
1571
|
/** Unique identifier for this pending attachment */
|
|
@@ -1574,6 +1576,8 @@ interface PendingAttachmentRef {
|
|
|
1574
1576
|
readonly mimeType: string;
|
|
1575
1577
|
/** File size in bytes */
|
|
1576
1578
|
readonly size: number;
|
|
1579
|
+
/** The original File object for upload */
|
|
1580
|
+
readonly file: File;
|
|
1577
1581
|
}
|
|
1578
1582
|
/**
|
|
1579
1583
|
* Event emitted when the user's typing state changes.
|
|
@@ -1859,6 +1863,16 @@ declare class ChatComponent {
|
|
|
1859
1863
|
readonly theme?: ChatTheme | undefined;
|
|
1860
1864
|
readonly direction?: ChatDirection | undefined;
|
|
1861
1865
|
} | undefined>;
|
|
1866
|
+
/**
|
|
1867
|
+
* Whether there are more messages to load.
|
|
1868
|
+
* When true, enables "load more" functionality at scroll top.
|
|
1869
|
+
*/
|
|
1870
|
+
readonly hasMore: _angular_core.InputSignal<boolean>;
|
|
1871
|
+
/**
|
|
1872
|
+
* Whether more messages are currently being loaded.
|
|
1873
|
+
* Shows loading indicator and prevents duplicate load requests.
|
|
1874
|
+
*/
|
|
1875
|
+
readonly loadingMore: _angular_core.InputSignal<boolean>;
|
|
1862
1876
|
/**
|
|
1863
1877
|
* Emitted when the user sends a message.
|
|
1864
1878
|
* Parent should add the message to state and send to server.
|
|
@@ -1964,7 +1978,7 @@ declare class ChatComponent {
|
|
|
1964
1978
|
*/
|
|
1965
1979
|
onTyping(event: ChatTypingEvent): void;
|
|
1966
1980
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatComponent, never>;
|
|
1967
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatComponent, "ngx-chat", never, { "messages": { "alias": "messages"; "required": false; "isSignal": true; }; "isTyping": { "alias": "isTyping"; "required": false; "isSignal": true; }; "typingLabel": { "alias": "typingLabel"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; }, { "send": "send"; "typing": "typing"; "action": "action"; "retry": "retry"; "loadMore": "loadMore"; "attachmentClick": "attachmentClick"; }, ["headerContent"], never, true, never>;
|
|
1981
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatComponent, "ngx-chat", never, { "messages": { "alias": "messages"; "required": false; "isSignal": true; }; "isTyping": { "alias": "isTyping"; "required": false; "isSignal": true; }; "typingLabel": { "alias": "typingLabel"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; "hasMore": { "alias": "hasMore"; "required": false; "isSignal": true; }; "loadingMore": { "alias": "loadingMore"; "required": false; "isSignal": true; }; }, { "send": "send"; "typing": "typing"; "action": "action"; "retry": "retry"; "loadMore": "loadMore"; "attachmentClick": "attachmentClick"; }, ["headerContent"], never, true, never>;
|
|
1968
1982
|
}
|
|
1969
1983
|
|
|
1970
1984
|
/**
|
|
@@ -2068,6 +2082,7 @@ declare const DEFAULT_GROUPING_THRESHOLD_MS = 60000;
|
|
|
2068
2082
|
* @example
|
|
2069
2083
|
* ```typescript
|
|
2070
2084
|
* const group: MessageGroup = {
|
|
2085
|
+
* id: 'group-msg-1',
|
|
2071
2086
|
* senderId: 'self',
|
|
2072
2087
|
* senderName: undefined,
|
|
2073
2088
|
* avatar: '/avatar.png',
|
|
@@ -2077,6 +2092,11 @@ declare const DEFAULT_GROUPING_THRESHOLD_MS = 60000;
|
|
|
2077
2092
|
* ```
|
|
2078
2093
|
*/
|
|
2079
2094
|
interface MessageGroup {
|
|
2095
|
+
/**
|
|
2096
|
+
* Stable unique identifier for this group.
|
|
2097
|
+
* Derived from the first message's ID for consistent tracking.
|
|
2098
|
+
*/
|
|
2099
|
+
readonly id: string;
|
|
2080
2100
|
/** The sender type of all messages in this group */
|
|
2081
2101
|
readonly senderId: ChatMessage['sender'];
|
|
2082
2102
|
/** Display name of the sender (from first message) */
|
|
@@ -2377,10 +2397,8 @@ declare class ChatMessagesComponent implements OnDestroy {
|
|
|
2377
2397
|
private readonly loadMoreDebounced;
|
|
2378
2398
|
/** Timestamp formatter cache */
|
|
2379
2399
|
private timestampFormatter;
|
|
2380
|
-
/** ResizeObserver for measuring message heights in virtual scroll mode */
|
|
2400
|
+
/** Native ResizeObserver for measuring message heights in virtual scroll mode */
|
|
2381
2401
|
private resizeObserver;
|
|
2382
|
-
/** Map of message IDs to their indices for height measurement */
|
|
2383
|
-
private readonly messageIndexMap;
|
|
2384
2402
|
/**
|
|
2385
2403
|
* Merged configuration from input and global config.
|
|
2386
2404
|
*/
|
|
@@ -2423,6 +2441,17 @@ declare class ChatMessagesComponent implements OnDestroy {
|
|
|
2423
2441
|
* Start index of visible messages (for track by and height measurement).
|
|
2424
2442
|
*/
|
|
2425
2443
|
readonly visibleStartIndex: _angular_core.Signal<number>;
|
|
2444
|
+
/**
|
|
2445
|
+
* Computed map of message IDs to their indices.
|
|
2446
|
+
* Used for height measurement in virtual scroll mode.
|
|
2447
|
+
* Uses computed() instead of effect() to avoid anti-pattern.
|
|
2448
|
+
*/
|
|
2449
|
+
private readonly messageIndexMap;
|
|
2450
|
+
/**
|
|
2451
|
+
* Tracks the previous message count to detect changes.
|
|
2452
|
+
* Used to sync virtual scroll service only when needed.
|
|
2453
|
+
*/
|
|
2454
|
+
private lastSyncedMessageCount;
|
|
2426
2455
|
constructor();
|
|
2427
2456
|
/**
|
|
2428
2457
|
* Handles scroll events from the scrollbar.
|
|
@@ -2432,6 +2461,7 @@ declare class ChatMessagesComponent implements OnDestroy {
|
|
|
2432
2461
|
onScroll(event: Event): void;
|
|
2433
2462
|
/**
|
|
2434
2463
|
* Programmatically scrolls to the bottom of the message list.
|
|
2464
|
+
* Uses requestAnimationFrame to ensure DOM is fully updated before scrolling.
|
|
2435
2465
|
*/
|
|
2436
2466
|
scrollToBottom(): void;
|
|
2437
2467
|
/**
|
|
@@ -2766,6 +2796,7 @@ declare class ChatMessageBubbleComponent {
|
|
|
2766
2796
|
*/
|
|
2767
2797
|
declare class ChatSenderComponent {
|
|
2768
2798
|
private readonly configService;
|
|
2799
|
+
private readonly attachmentService;
|
|
2769
2800
|
private readonly destroyRef;
|
|
2770
2801
|
/**
|
|
2771
2802
|
* Reference to the textarea element for auto-resize and focus management.
|
|
@@ -2927,7 +2958,11 @@ declare class ChatSenderComponent {
|
|
|
2927
2958
|
/**
|
|
2928
2959
|
* Pending attachments to be sent with the message.
|
|
2929
2960
|
*/
|
|
2930
|
-
readonly pendingAttachments: _angular_core.WritableSignal<
|
|
2961
|
+
readonly pendingAttachments: _angular_core.WritableSignal<PendingAttachment[]>;
|
|
2962
|
+
/**
|
|
2963
|
+
* Attachment validation error message.
|
|
2964
|
+
*/
|
|
2965
|
+
readonly attachmentError: _angular_core.WritableSignal<string | null>;
|
|
2931
2966
|
/**
|
|
2932
2967
|
* Whether the user is currently typing.
|
|
2933
2968
|
*/
|
|
@@ -3038,7 +3073,16 @@ declare class ChatSenderComponent {
|
|
|
3038
3073
|
/**
|
|
3039
3074
|
* Adds a pending attachment.
|
|
3040
3075
|
*/
|
|
3041
|
-
addAttachment(attachment:
|
|
3076
|
+
addAttachment(attachment: PendingAttachment): void;
|
|
3077
|
+
/**
|
|
3078
|
+
* Handles files selected from the attachment picker.
|
|
3079
|
+
* Validates each file and creates pending attachments.
|
|
3080
|
+
*/
|
|
3081
|
+
onFilesSelected(files: FileList): void;
|
|
3082
|
+
/**
|
|
3083
|
+
* Handles retry request for a failed attachment.
|
|
3084
|
+
*/
|
|
3085
|
+
onRetryAttachment(attachmentId: string): void;
|
|
3042
3086
|
/**
|
|
3043
3087
|
* Removes a pending attachment by ID.
|
|
3044
3088
|
*/
|
|
@@ -4819,6 +4863,91 @@ declare class ChatErrorBoundaryComponent {
|
|
|
4819
4863
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChatErrorBoundaryComponent, "ngx-chat-error-boundary", never, { "fallbackMessage": { "alias": "fallbackMessage"; "required": false; "isSignal": true; }; }, { "retry": "retry"; }, never, ["*"], true, never>;
|
|
4820
4864
|
}
|
|
4821
4865
|
|
|
4866
|
+
/**
|
|
4867
|
+
* Directive that traps focus within its host element.
|
|
4868
|
+
*
|
|
4869
|
+
* This directive is used for accessibility compliance in modal dialogs,
|
|
4870
|
+
* action panels, and other overlay content where keyboard focus should
|
|
4871
|
+
* be constrained to the interactive elements within.
|
|
4872
|
+
*
|
|
4873
|
+
* Features:
|
|
4874
|
+
* - Traps Tab/Shift+Tab navigation within the element
|
|
4875
|
+
* - Auto-focuses the first focusable element when enabled
|
|
4876
|
+
* - Restores focus to the previously focused element on destroy
|
|
4877
|
+
* - Supports deferred focus for async content
|
|
4878
|
+
*
|
|
4879
|
+
* @example Basic usage
|
|
4880
|
+
* ```html
|
|
4881
|
+
* <div ngxChatFocusTrap>
|
|
4882
|
+
* <button>First</button>
|
|
4883
|
+
* <button>Second</button>
|
|
4884
|
+
* <button>Third</button>
|
|
4885
|
+
* </div>
|
|
4886
|
+
* ```
|
|
4887
|
+
*
|
|
4888
|
+
* @example Conditional focus trap
|
|
4889
|
+
* ```html
|
|
4890
|
+
* <div [ngxChatFocusTrap]="isOpen()">
|
|
4891
|
+
* <button>Close</button>
|
|
4892
|
+
* <div>Modal content</div>
|
|
4893
|
+
* </div>
|
|
4894
|
+
* ```
|
|
4895
|
+
*
|
|
4896
|
+
* @example With auto-focus disabled
|
|
4897
|
+
* ```html
|
|
4898
|
+
* <div ngxChatFocusTrap [ngxChatFocusTrapAutoFocus]="false">
|
|
4899
|
+
* <button>First</button>
|
|
4900
|
+
* </div>
|
|
4901
|
+
* ```
|
|
4902
|
+
*/
|
|
4903
|
+
declare class ChatFocusTrapDirective implements OnDestroy {
|
|
4904
|
+
private readonly elementRef;
|
|
4905
|
+
private readonly focusTrapFactory;
|
|
4906
|
+
private readonly injector;
|
|
4907
|
+
/**
|
|
4908
|
+
* Whether the focus trap is enabled.
|
|
4909
|
+
* When false, focus can move freely in and out of the element.
|
|
4910
|
+
*/
|
|
4911
|
+
readonly ngxChatFocusTrap: _angular_core.InputSignal<boolean>;
|
|
4912
|
+
/**
|
|
4913
|
+
* Whether to auto-focus the first tabbable element when the trap is created.
|
|
4914
|
+
*/
|
|
4915
|
+
readonly ngxChatFocusTrapAutoFocus: _angular_core.InputSignal<boolean>;
|
|
4916
|
+
/**
|
|
4917
|
+
* The underlying CDK FocusTrap instance.
|
|
4918
|
+
*/
|
|
4919
|
+
private focusTrap;
|
|
4920
|
+
/**
|
|
4921
|
+
* Element that had focus before the trap was activated.
|
|
4922
|
+
* Used to restore focus on destroy.
|
|
4923
|
+
*/
|
|
4924
|
+
private previouslyFocusedElement;
|
|
4925
|
+
constructor();
|
|
4926
|
+
/**
|
|
4927
|
+
* Initializes the focus trap after render.
|
|
4928
|
+
*/
|
|
4929
|
+
private initializeFocusTrap;
|
|
4930
|
+
/**
|
|
4931
|
+
* Manually focuses the first tabbable element within the trap.
|
|
4932
|
+
*/
|
|
4933
|
+
focusFirstTabbableElement(): void;
|
|
4934
|
+
/**
|
|
4935
|
+
* Manually focuses the last tabbable element within the trap.
|
|
4936
|
+
*/
|
|
4937
|
+
focusLastTabbableElement(): void;
|
|
4938
|
+
/**
|
|
4939
|
+
* Checks if an element is focusable within the trap.
|
|
4940
|
+
*/
|
|
4941
|
+
hasFocusableElements(): boolean;
|
|
4942
|
+
/**
|
|
4943
|
+
* Cleanup on destroy.
|
|
4944
|
+
* Disables the trap and restores focus to the previous element.
|
|
4945
|
+
*/
|
|
4946
|
+
ngOnDestroy(): void;
|
|
4947
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatFocusTrapDirective, never>;
|
|
4948
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ChatFocusTrapDirective, "[ngxChatFocusTrap]", ["ngxChatFocusTrap"], { "ngxChatFocusTrap": { "alias": "ngxChatFocusTrap"; "required": false; "isSignal": true; }; "ngxChatFocusTrapAutoFocus": { "alias": "ngxChatFocusTrapAutoFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
4949
|
+
}
|
|
4950
|
+
|
|
4822
4951
|
/**
|
|
4823
4952
|
* @fileoverview Error constants and factory functions for ngx-chat.
|
|
4824
4953
|
* Provides centralized error definitions and utilities for error handling.
|
|
@@ -5968,6 +6097,187 @@ declare function isSafeUrl(url: string): boolean;
|
|
|
5968
6097
|
*/
|
|
5969
6098
|
declare function validateMessage(content: string, config: ChatValidationConfig): ValidationResult;
|
|
5970
6099
|
|
|
6100
|
+
/**
|
|
6101
|
+
* @fileoverview Attachment utility functions for ngx-chat library.
|
|
6102
|
+
* Pure functions for creating, validating, and transforming attachments.
|
|
6103
|
+
* @module ngx-chat/utils
|
|
6104
|
+
*/
|
|
6105
|
+
|
|
6106
|
+
/**
|
|
6107
|
+
* Determines the attachment type from a MIME type string.
|
|
6108
|
+
*
|
|
6109
|
+
* @param mimeType - The MIME type to check (e.g., 'image/jpeg')
|
|
6110
|
+
* @returns The attachment type, defaults to 'file' for unknown types
|
|
6111
|
+
*
|
|
6112
|
+
* @example
|
|
6113
|
+
* ```typescript
|
|
6114
|
+
* getAttachmentType('image/jpeg'); // 'image'
|
|
6115
|
+
* getAttachmentType('video/mp4'); // 'video'
|
|
6116
|
+
* getAttachmentType('application/pdf'); // 'file'
|
|
6117
|
+
* ```
|
|
6118
|
+
*/
|
|
6119
|
+
declare function getAttachmentType(mimeType: string): AttachmentType;
|
|
6120
|
+
/**
|
|
6121
|
+
* Determines the attachment type from a File object.
|
|
6122
|
+
*
|
|
6123
|
+
* @param file - The File object to check
|
|
6124
|
+
* @returns The attachment type
|
|
6125
|
+
*
|
|
6126
|
+
* @example
|
|
6127
|
+
* ```typescript
|
|
6128
|
+
* const file = new File([''], 'photo.jpg', { type: 'image/jpeg' });
|
|
6129
|
+
* getAttachmentTypeFromFile(file); // 'image'
|
|
6130
|
+
* ```
|
|
6131
|
+
*/
|
|
6132
|
+
declare function getAttachmentTypeFromFile(file: File): AttachmentType;
|
|
6133
|
+
/**
|
|
6134
|
+
* Checks if an attachment type supports preview generation.
|
|
6135
|
+
*
|
|
6136
|
+
* @param type - The attachment type to check
|
|
6137
|
+
* @returns True if previews can be generated
|
|
6138
|
+
*/
|
|
6139
|
+
declare function isPreviewable(type: AttachmentType): boolean;
|
|
6140
|
+
/**
|
|
6141
|
+
* Checks if a file extension supports preview generation.
|
|
6142
|
+
*
|
|
6143
|
+
* @param filename - The filename to check
|
|
6144
|
+
* @returns True if the file extension supports previews
|
|
6145
|
+
*/
|
|
6146
|
+
declare function isPreviewableByExtension(filename: string): boolean;
|
|
6147
|
+
/**
|
|
6148
|
+
* Creates a PendingAttachment from a File object.
|
|
6149
|
+
*
|
|
6150
|
+
* @param file - The File object to create an attachment from
|
|
6151
|
+
* @param options - Optional configuration
|
|
6152
|
+
* @returns A PendingAttachment ready for upload
|
|
6153
|
+
*
|
|
6154
|
+
* @example
|
|
6155
|
+
* ```typescript
|
|
6156
|
+
* const file = new File(['content'], 'document.pdf', { type: 'application/pdf' });
|
|
6157
|
+
* const pending = createPendingAttachment(file);
|
|
6158
|
+
* // { id: 'att-123', file, type: 'file', status: 'pending', progress: 0 }
|
|
6159
|
+
* ```
|
|
6160
|
+
*/
|
|
6161
|
+
declare function createPendingAttachment(file: File, options?: {
|
|
6162
|
+
id?: string;
|
|
6163
|
+
createPreview?: boolean;
|
|
6164
|
+
}): PendingAttachment;
|
|
6165
|
+
/**
|
|
6166
|
+
* Creates a MessageAttachment from upload result data.
|
|
6167
|
+
*
|
|
6168
|
+
* @param data - The attachment data from the server
|
|
6169
|
+
* @returns A MessageAttachment object
|
|
6170
|
+
*/
|
|
6171
|
+
declare function createMessageAttachment(data: {
|
|
6172
|
+
id: string;
|
|
6173
|
+
url: string;
|
|
6174
|
+
name: string;
|
|
6175
|
+
size: number;
|
|
6176
|
+
mimeType: string;
|
|
6177
|
+
thumbnail?: string;
|
|
6178
|
+
dimensions?: {
|
|
6179
|
+
width: number;
|
|
6180
|
+
height: number;
|
|
6181
|
+
};
|
|
6182
|
+
duration?: number;
|
|
6183
|
+
}): MessageAttachment;
|
|
6184
|
+
/**
|
|
6185
|
+
* Validates a file against size and type constraints.
|
|
6186
|
+
*
|
|
6187
|
+
* @param file - The file to validate
|
|
6188
|
+
* @param options - Validation options
|
|
6189
|
+
* @returns Validation result with error message if invalid
|
|
6190
|
+
*
|
|
6191
|
+
* @example
|
|
6192
|
+
* ```typescript
|
|
6193
|
+
* const result = validateAttachment(file, {
|
|
6194
|
+
* maxSize: 5 * 1024 * 1024, // 5MB
|
|
6195
|
+
* allowedTypes: ['image/*', 'application/pdf']
|
|
6196
|
+
* });
|
|
6197
|
+
* if (!result.valid) {
|
|
6198
|
+
* console.error(result.error);
|
|
6199
|
+
* }
|
|
6200
|
+
* ```
|
|
6201
|
+
*/
|
|
6202
|
+
declare function validateAttachment(file: File, options?: {
|
|
6203
|
+
maxSize?: number;
|
|
6204
|
+
allowedTypes?: string[];
|
|
6205
|
+
allowedExtensions?: string[];
|
|
6206
|
+
}): {
|
|
6207
|
+
valid: boolean;
|
|
6208
|
+
error?: string;
|
|
6209
|
+
};
|
|
6210
|
+
/**
|
|
6211
|
+
* Formats a file size in bytes to a human-readable string.
|
|
6212
|
+
*
|
|
6213
|
+
* @param bytes - The size in bytes
|
|
6214
|
+
* @param decimals - Number of decimal places (default: 1)
|
|
6215
|
+
* @returns Formatted string like "1.5 MB"
|
|
6216
|
+
*
|
|
6217
|
+
* @example
|
|
6218
|
+
* ```typescript
|
|
6219
|
+
* formatFileSize(1024); // "1 KB"
|
|
6220
|
+
* formatFileSize(1536); // "1.5 KB"
|
|
6221
|
+
* formatFileSize(1048576); // "1 MB"
|
|
6222
|
+
* formatFileSize(1073741824); // "1 GB"
|
|
6223
|
+
* ```
|
|
6224
|
+
*/
|
|
6225
|
+
declare function formatFileSize(bytes: number, decimals?: number): string;
|
|
6226
|
+
/**
|
|
6227
|
+
* Formats a duration in seconds to a human-readable string.
|
|
6228
|
+
*
|
|
6229
|
+
* @param seconds - The duration in seconds
|
|
6230
|
+
* @returns Formatted string like "1:23" or "1:23:45"
|
|
6231
|
+
*
|
|
6232
|
+
* @example
|
|
6233
|
+
* ```typescript
|
|
6234
|
+
* formatDuration(65); // "1:05"
|
|
6235
|
+
* formatDuration(3665); // "1:01:05"
|
|
6236
|
+
* ```
|
|
6237
|
+
*/
|
|
6238
|
+
declare function formatDuration(seconds: number): string;
|
|
6239
|
+
/**
|
|
6240
|
+
* Extracts the file extension from a filename.
|
|
6241
|
+
*
|
|
6242
|
+
* @param filename - The filename to extract from
|
|
6243
|
+
* @returns Lowercase extension without the dot, or empty string
|
|
6244
|
+
*
|
|
6245
|
+
* @example
|
|
6246
|
+
* ```typescript
|
|
6247
|
+
* getFileExtension('photo.JPG'); // 'jpg'
|
|
6248
|
+
* getFileExtension('document.pdf'); // 'pdf'
|
|
6249
|
+
* getFileExtension('noextension'); // ''
|
|
6250
|
+
* ```
|
|
6251
|
+
*/
|
|
6252
|
+
declare function getFileExtension(filename: string): string;
|
|
6253
|
+
/**
|
|
6254
|
+
* Gets a display-friendly file name, truncating if too long.
|
|
6255
|
+
*
|
|
6256
|
+
* @param filename - The full filename
|
|
6257
|
+
* @param maxLength - Maximum length (default: 30)
|
|
6258
|
+
* @returns Truncated filename with extension preserved
|
|
6259
|
+
*
|
|
6260
|
+
* @example
|
|
6261
|
+
* ```typescript
|
|
6262
|
+
* truncateFileName('very-long-file-name.pdf', 15); // 'very-lo...e.pdf'
|
|
6263
|
+
* ```
|
|
6264
|
+
*/
|
|
6265
|
+
declare function truncateFileName(filename: string, maxLength?: number): string;
|
|
6266
|
+
/**
|
|
6267
|
+
* Revokes a blob URL to free memory.
|
|
6268
|
+
* Safe to call with undefined/null.
|
|
6269
|
+
*
|
|
6270
|
+
* @param url - The blob URL to revoke
|
|
6271
|
+
*/
|
|
6272
|
+
declare function revokePreviewUrl(url: string | undefined): void;
|
|
6273
|
+
/**
|
|
6274
|
+
* Gets the appropriate icon name for an attachment type.
|
|
6275
|
+
*
|
|
6276
|
+
* @param type - The attachment type
|
|
6277
|
+
* @returns Icon identifier
|
|
6278
|
+
*/
|
|
6279
|
+
declare function getAttachmentIcon(type: AttachmentType): string;
|
|
6280
|
+
|
|
5971
6281
|
/**
|
|
5972
6282
|
* Service for accessing and merging chat configuration.
|
|
5973
6283
|
*
|
|
@@ -7031,6 +7341,15 @@ interface VisibleRange {
|
|
|
7031
7341
|
* }
|
|
7032
7342
|
* ```
|
|
7033
7343
|
*/
|
|
7344
|
+
/**
|
|
7345
|
+
* @Injectable without `providedIn` - must be provided at component level.
|
|
7346
|
+
*
|
|
7347
|
+
* This service maintains stateful data (scroll position, item heights, etc.)
|
|
7348
|
+
* that must be scoped to each ChatMessagesComponent instance. If provided
|
|
7349
|
+
* at root level, multiple chat instances would share state, causing bugs.
|
|
7350
|
+
*
|
|
7351
|
+
* @see ChatMessagesComponent which provides this service
|
|
7352
|
+
*/
|
|
7034
7353
|
declare class ChatVirtualScrollService {
|
|
7035
7354
|
private readonly configService;
|
|
7036
7355
|
private readonly config;
|
|
@@ -7222,5 +7541,5 @@ declare const chatAnimations: {
|
|
|
7222
7541
|
readonly fadeInOut: AnimationTriggerMetadata;
|
|
7223
7542
|
};
|
|
7224
7543
|
|
|
7225
|
-
export { AttachmentPickerComponent, AttachmentPreviewComponent, AudioPreviewComponent, ButtonsActionComponent, CHAT_CONFIG, CHAT_CONFIG_OVERRIDES, CHAT_FEATURES, CHAT_I18N, CHAT_I18N_OVERRIDES, ChatA11yService, ChatAttachmentComponent, ChatAttachmentService, ChatComponent, ChatConfigService, ChatDropZoneDirective, ChatErrorBoundaryComponent, ChatErrorRecoveryService, ChatHeaderComponent, ChatHeaderContentDirective, ChatMarkdownComponent, ChatMarkdownService, ChatMessageActionsComponent, ChatMessageBubbleComponent, ChatMessagesComponent, ChatSenderComponent, ChatTypingIndicatorComponent, ChatVirtualScrollService, ConfirmActionComponent, DEFAULT_ATTACHMENT_CONFIG, DEFAULT_BEHAVIOR_CONFIG, DEFAULT_CHAT_CONFIG, DEFAULT_CHAT_I18N, DEFAULT_ERROR_RECOVERY_CONFIG, DEFAULT_GROUPING_THRESHOLD_MS, DEFAULT_KEYBOARD_CONFIG, DEFAULT_MARKDOWN_CONFIG, DEFAULT_VALIDATION_CONFIG, DEFAULT_VIRTUAL_SCROLL_CONFIG, ERROR_CODES, FilePreviewComponent, ImagePreviewComponent, MultiSelectActionComponent, SelectActionComponent, VideoPreviewComponent, allActionsResponded, appendMessageContent, breakLongWords, canRetry, chatAnimations, createButtonsAction, createConfirmAction, createError, createMultiSelectAction, createOtherMessage, createSelectAction, createSelfMessage, createSystemMessage, disableAllActions, errorShake, fadeInOut, findMessage, generateId, getActionById, getErrorMessages, getLastMessage, getMessagesByStatus, getPendingActions, getRetryDelay, getRetryableMessages, groupMessages, incrementRetryCount, isAuthError, isClientError, isNetworkError, isSafeUrl, isUngroupable, messageEnter, provideChat, removeMessage, resetIdCounter, sanitizeContent, shouldGroupMessages, stripInvisibleChars, typingPulse, updateActionResponse, updateMessageContent, updateMessageStatus, validateMessage };
|
|
7544
|
+
export { AttachmentPickerComponent, AttachmentPreviewComponent, AudioPreviewComponent, ButtonsActionComponent, CHAT_CONFIG, CHAT_CONFIG_OVERRIDES, CHAT_FEATURES, CHAT_I18N, CHAT_I18N_OVERRIDES, ChatA11yService, ChatAttachmentComponent, ChatAttachmentService, ChatComponent, ChatConfigService, ChatDropZoneDirective, ChatErrorBoundaryComponent, ChatErrorRecoveryService, ChatFocusTrapDirective, ChatHeaderComponent, ChatHeaderContentDirective, ChatMarkdownComponent, ChatMarkdownService, ChatMessageActionsComponent, ChatMessageBubbleComponent, ChatMessagesComponent, ChatSenderComponent, ChatTypingIndicatorComponent, ChatVirtualScrollService, ConfirmActionComponent, DEFAULT_ATTACHMENT_CONFIG, DEFAULT_BEHAVIOR_CONFIG, DEFAULT_CHAT_CONFIG, DEFAULT_CHAT_I18N, DEFAULT_ERROR_RECOVERY_CONFIG, DEFAULT_GROUPING_THRESHOLD_MS, DEFAULT_KEYBOARD_CONFIG, DEFAULT_MARKDOWN_CONFIG, DEFAULT_VALIDATION_CONFIG, DEFAULT_VIRTUAL_SCROLL_CONFIG, ERROR_CODES, FilePreviewComponent, ImagePreviewComponent, MultiSelectActionComponent, SelectActionComponent, VideoPreviewComponent, allActionsResponded, appendMessageContent, breakLongWords, canRetry, chatAnimations, createButtonsAction, createConfirmAction, createError, createMessageAttachment, createMultiSelectAction, createOtherMessage, createPendingAttachment, createSelectAction, createSelfMessage, createSystemMessage, disableAllActions, errorShake, fadeInOut, findMessage, formatDuration, formatFileSize, generateId, getActionById, getAttachmentIcon, getAttachmentType, getAttachmentTypeFromFile, getErrorMessages, getFileExtension, getLastMessage, getMessagesByStatus, getPendingActions, getRetryDelay, getRetryableMessages, groupMessages, incrementRetryCount, isAuthError, isClientError, isNetworkError, isPreviewable, isPreviewableByExtension, isSafeUrl, isUngroupable, messageEnter, provideChat, removeMessage, resetIdCounter, revokePreviewUrl, sanitizeContent, shouldGroupMessages, stripInvisibleChars, truncateFileName, typingPulse, updateActionResponse, updateMessageContent, updateMessageStatus, validateAttachment, validateMessage };
|
|
7226
7545
|
export type { ActionButton, ActionOption, AttachmentClickEvent, AttachmentCompleteEvent, AttachmentErrorEvent, AttachmentEvent, AttachmentProgressEvent, AttachmentType, AttachmentUploadStatus, ButtonVariant, ButtonsAction, ButtonsActionEvent, ButtonsLayout, ChatAttachmentConfig, ChatBehaviorConfig, ChatConfig, ChatConfigInput, ChatDirection, ChatErrorCode, ChatErrorRecoveryConfig, ChatFeatures, ChatI18n, ChatKeyboardConfig, ChatLoadMoreEvent, ChatMarkdownConfig, ChatMessage, ChatMessageError, ChatMessageStatusEvent, ChatRetryEvent, ChatSendEvent, ChatTheme, ChatTypingEvent, ChatValidationConfig, ChatVirtualScrollConfig, ConfirmAction, ConfirmActionEvent, CreateButtonsActionOptions, CreateConfirmActionOptions, CreateMessageOptions, CreateMultiSelectActionOptions, CreateOtherMessageOptions, CreateSelectActionOptions, DeepPartial, Dimensions, FileValidationResult, MarkdownParseResult, MessageAction, MessageActionEvent, MessageActionType, MessageAttachment, MessageGroup, MessageSender, MessageStatus, MultiSelectAction, MultiSelectActionEvent, PendingAttachment, PendingAttachmentRef, ProvideChatOptions, QueuedMessage, SelectAction, SelectActionEvent, ValidationResult, VisibleRange };
|