@aws/mynah-ui 4.13.0 → 4.14.1
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/components/card/card-body.d.ts +3 -2
- package/dist/components/chat-item/chat-item-card-content.d.ts +4 -3
- package/dist/components/chat-item/chat-item-card.d.ts +7 -0
- package/dist/components/chat-item/chat-wrapper.d.ts +2 -0
- package/dist/components/chat-item/prompt-input/prompt-text-input.d.ts +2 -0
- package/dist/components/icon.d.ts +4 -1
- package/dist/components/syntax-highlighter.d.ts +4 -4
- package/dist/helper/chat-item.d.ts +1 -0
- package/dist/helper/dom.d.ts +5 -0
- package/dist/main.d.ts +11 -3
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +26 -13
- package/docs/CONFIG.md +39 -0
- package/docs/DATAMODEL.md +103 -35
- package/docs/PROPERTIES.md +54 -2
- package/docs/img/data-model/chatItems/codeBlockActions.png +0 -0
- package/docs/img/data-model/chatItems/codeInsertAndCopyButtonsThroughConfig.png +0 -0
- package/docs/img/data-model/chatItems/footer.png +0 -0
- package/docs/img/data-model/chatItems/footer2.png +0 -0
- package/package.json +1 -1
- package/postinstall.js +4 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
-
import {
|
|
6
|
+
import { CodeBlockActions, OnCodeBlockActionFunction, OnCopiedToClipboardFunction, ReferenceTrackerInformation } from '../../static';
|
|
7
7
|
import '../../styles/components/card/_card.scss';
|
|
8
8
|
export declare const highlightersWithTooltip: {
|
|
9
9
|
start: {
|
|
@@ -22,13 +22,14 @@ export interface CardBodyProps {
|
|
|
22
22
|
children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
|
|
23
23
|
childLocation?: 'above-body' | 'below-body';
|
|
24
24
|
highlightRangeWithTooltip?: ReferenceTrackerInformation[];
|
|
25
|
+
codeBlockActions?: CodeBlockActions;
|
|
25
26
|
useParts?: boolean;
|
|
26
27
|
codeBlockStartIndex?: number;
|
|
27
28
|
processChildren?: boolean;
|
|
28
29
|
classNames?: string[];
|
|
29
30
|
onLinkClick?: (url: string, e: MouseEvent) => void;
|
|
30
31
|
onCopiedToClipboard?: OnCopiedToClipboardFunction;
|
|
31
|
-
|
|
32
|
+
onCodeBlockAction?: OnCodeBlockActionFunction;
|
|
32
33
|
}
|
|
33
34
|
export declare class CardBody {
|
|
34
35
|
render: ExtendedHTMLElement;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
|
|
6
|
-
import { CardRenderDetails,
|
|
6
|
+
import { CardRenderDetails, CodeBlockActions, OnCodeBlockActionFunction, OnCopiedToClipboardFunction, ReferenceTrackerInformation } from '../../static';
|
|
7
7
|
import { CardBody } from '../card/card-body';
|
|
8
8
|
export interface ChatItemCardContentProps {
|
|
9
9
|
body?: string;
|
|
@@ -11,10 +11,11 @@ export interface ChatItemCardContentProps {
|
|
|
11
11
|
classNames?: string[];
|
|
12
12
|
codeReference?: ReferenceTrackerInformation[];
|
|
13
13
|
onAnimationStateChange?: (isAnimating: boolean) => void;
|
|
14
|
-
|
|
14
|
+
contentProperties?: {
|
|
15
|
+
codeBlockActions?: CodeBlockActions;
|
|
15
16
|
onLinkClick?: (url: string, e: MouseEvent) => void;
|
|
16
17
|
onCopiedToClipboard?: OnCopiedToClipboardFunction;
|
|
17
|
-
|
|
18
|
+
onCodeBlockAction?: OnCodeBlockActionFunction;
|
|
18
19
|
};
|
|
19
20
|
children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
|
|
20
21
|
}
|
|
@@ -7,6 +7,8 @@ import { CardRenderDetails, ChatItem } from '../../static';
|
|
|
7
7
|
export interface ChatItemCardProps {
|
|
8
8
|
tabId: string;
|
|
9
9
|
chatItem: ChatItem;
|
|
10
|
+
inline?: boolean;
|
|
11
|
+
small?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export declare class ChatItemCard {
|
|
12
14
|
readonly props: ChatItemCardProps;
|
|
@@ -14,6 +16,7 @@ export declare class ChatItemCard {
|
|
|
14
16
|
private readonly card;
|
|
15
17
|
private readonly updateStack;
|
|
16
18
|
private readonly initialSpinner;
|
|
19
|
+
private cardFooter;
|
|
17
20
|
private cardIcon;
|
|
18
21
|
private contentBody;
|
|
19
22
|
private chatAvatar;
|
|
@@ -23,13 +26,17 @@ export declare class ChatItemCard {
|
|
|
23
26
|
private fileTreeWrapper;
|
|
24
27
|
private followUps;
|
|
25
28
|
private votes;
|
|
29
|
+
private footer;
|
|
26
30
|
constructor(props: ChatItemCardProps);
|
|
31
|
+
private readonly getCardFooter;
|
|
27
32
|
private readonly generateCard;
|
|
28
33
|
private readonly getCardClasses;
|
|
29
34
|
private readonly updateCardContent;
|
|
30
35
|
private readonly getChatAvatar;
|
|
36
|
+
private readonly canShowAvatar;
|
|
31
37
|
private readonly checkCardSnap;
|
|
32
38
|
readonly updateCard: () => void;
|
|
33
39
|
readonly updateCardStack: (updateWith: Partial<ChatItem>) => void;
|
|
34
40
|
readonly getRenderDetails: () => CardRenderDetails;
|
|
41
|
+
readonly cleanFollowupsAndRemoveIfEmpty: () => boolean;
|
|
35
42
|
}
|
|
@@ -23,9 +23,11 @@ export declare class ChatWrapper {
|
|
|
23
23
|
private allRenderedChatItems;
|
|
24
24
|
render: ExtendedHTMLElement;
|
|
25
25
|
constructor(props: ChatWrapperProps);
|
|
26
|
+
private readonly removeEmptyCardsAndFollowups;
|
|
26
27
|
private readonly insertChatItem;
|
|
27
28
|
private readonly checkLastAnswerStreamChange;
|
|
28
29
|
updateLastChatAnswer: (updateWith: Partial<ChatItem>) => void;
|
|
30
|
+
getLastStreamingMessageId: () => string | null;
|
|
29
31
|
getChatItem: (messageId: string) => {
|
|
30
32
|
chatItem: ChatItem;
|
|
31
33
|
render: ExtendedHTMLElement | HTMLElement;
|
|
@@ -2,6 +2,7 @@ import { ExtendedHTMLElement } from '../../../helper/dom';
|
|
|
2
2
|
export interface PromptTextInputProps {
|
|
3
3
|
tabId: string;
|
|
4
4
|
initMaxLength: number;
|
|
5
|
+
contextReplacement?: boolean;
|
|
5
6
|
onKeydown: (e: KeyboardEvent) => void;
|
|
6
7
|
onInput?: (e: KeyboardEvent) => void;
|
|
7
8
|
}
|
|
@@ -14,6 +15,7 @@ export declare class PromptTextInput {
|
|
|
14
15
|
private keydownSupport;
|
|
15
16
|
constructor(props: PromptTextInputProps);
|
|
16
17
|
private readonly updatePromptTextInputSizer;
|
|
18
|
+
readonly setContextReplacement: (contextReplacement: boolean) => void;
|
|
17
19
|
readonly getCursorPos: () => number;
|
|
18
20
|
readonly getWordAndIndexOnCursorPos: () => {
|
|
19
21
|
wordStartIndex: number;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
6
|
import '../styles/components/_icon.scss';
|
|
7
7
|
export declare enum MynahIcons {
|
|
8
|
-
|
|
8
|
+
Q = "q",
|
|
9
9
|
MENU = "menu",
|
|
10
10
|
MINUS = "minus",
|
|
11
11
|
SEARCH = "search",
|
|
@@ -15,6 +15,8 @@ export declare enum MynahIcons {
|
|
|
15
15
|
TABS = "tabs",
|
|
16
16
|
CHAT = "chat",
|
|
17
17
|
LINK = "link",
|
|
18
|
+
FOLDER = "folder",
|
|
19
|
+
FILE = "file",
|
|
18
20
|
DOC = "doc",
|
|
19
21
|
EXTERNAL = "external",
|
|
20
22
|
CANCEL = "cancel",
|
|
@@ -22,6 +24,7 @@ export declare enum MynahIcons {
|
|
|
22
24
|
CALENDAR = "calendar",
|
|
23
25
|
COMMENT = "comment",
|
|
24
26
|
MEGAPHONE = "megaphone",
|
|
27
|
+
MAGIC = "magic",
|
|
25
28
|
NOTIFICATION = "notification",
|
|
26
29
|
EYE = "eye",
|
|
27
30
|
ELLIPSIS = "ellipsis",
|
|
@@ -29,7 +29,7 @@ import 'prismjs/components/prism-less.min';
|
|
|
29
29
|
import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
|
|
30
30
|
import 'prismjs/plugins/keep-markup/prism-keep-markup.js';
|
|
31
31
|
import 'prismjs/plugins/diff-highlight/prism-diff-highlight.min';
|
|
32
|
-
import { CodeSelectionType } from '../static';
|
|
32
|
+
import { CodeBlockActions, CodeSelectionType, OnCodeBlockActionFunction } from '../static';
|
|
33
33
|
import '../styles/components/_syntax-highlighter.scss';
|
|
34
34
|
export declare const highlighters: {
|
|
35
35
|
start: {
|
|
@@ -58,10 +58,10 @@ export interface SyntaxHighlighterProps {
|
|
|
58
58
|
showLineNumbers?: boolean;
|
|
59
59
|
block?: boolean;
|
|
60
60
|
startingLineNumber?: number;
|
|
61
|
-
showCopyOptions?: boolean;
|
|
62
61
|
index?: number;
|
|
62
|
+
codeBlockActions?: CodeBlockActions;
|
|
63
63
|
onCopiedToClipboard?: (type?: CodeSelectionType, text?: string, codeBlockIndex?: number) => void;
|
|
64
|
-
|
|
64
|
+
onCodeBlockAction?: OnCodeBlockActionFunction;
|
|
65
65
|
}
|
|
66
66
|
export declare class SyntaxHighlighter {
|
|
67
67
|
private readonly props?;
|
|
@@ -70,5 +70,5 @@ export declare class SyntaxHighlighter {
|
|
|
70
70
|
constructor(props: SyntaxHighlighterProps);
|
|
71
71
|
private readonly getSelectedCodeContextMenu;
|
|
72
72
|
private readonly getSelectedCode;
|
|
73
|
-
private readonly
|
|
73
|
+
private readonly onCopiedToClipboard;
|
|
74
74
|
}
|
package/dist/helper/dom.d.ts
CHANGED
|
@@ -47,9 +47,14 @@ export interface ExtendedHTMLElement extends HTMLInputElement {
|
|
|
47
47
|
}
|
|
48
48
|
export declare class DomBuilder {
|
|
49
49
|
private static instance;
|
|
50
|
+
private rootFocus;
|
|
50
51
|
root: ExtendedHTMLElement;
|
|
51
52
|
private portals;
|
|
52
53
|
private constructor();
|
|
54
|
+
private readonly attachRootFocusListeners;
|
|
55
|
+
private readonly onRootFocus;
|
|
56
|
+
private readonly onRootBlur;
|
|
57
|
+
readonly setFocusToRoot: () => void;
|
|
53
58
|
static getInstance(rootSelector?: string): DomBuilder;
|
|
54
59
|
setRoot: (rootSelector?: string) => void;
|
|
55
60
|
addClass: (this: ExtendedHTMLElement, className: string) => ExtendedHTMLElement;
|
package/dist/main.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface MynahUIProps {
|
|
|
24
24
|
config?: Partial<ConfigModel>;
|
|
25
25
|
onShowMoreWebResultsClick?: (tabId: string, messageId: string, eventId?: string) => void;
|
|
26
26
|
onReady?: () => void;
|
|
27
|
+
onFocusStateChanged?: (focusState: boolean) => void;
|
|
27
28
|
onVote?: (tabId: string, messageId: string, vote: RelevancyVoteType, eventId?: string) => void;
|
|
28
29
|
onStopChatResponse?: (tabId: string, eventId?: string) => void;
|
|
29
30
|
onResetStore?: (tabId: string) => void;
|
|
@@ -43,8 +44,15 @@ export interface MynahUIProps {
|
|
|
43
44
|
*/
|
|
44
45
|
onBeforeTabRemove?: (tabId: string, eventId?: string) => boolean;
|
|
45
46
|
onChatItemEngagement?: (tabId: string, messageId: string, engagement: Engagement) => void;
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
onCodeBlockActionClicked?: (tabId: string, messageId: string, actionId: string, data?: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number) => void;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated since version 4.14.0. It will be only used for keyboard, context menu copy actions, not for button actions after version 5.x.x. Use {@link onCodeBlockActionClicked} instead
|
|
50
|
+
*/
|
|
51
|
+
onCopyCodeToClipboard?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number, data?: any) => void;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated since version 4.14.0. Will be dropped after version 5.x.x. Use {@link onCodeBlockActionClicked} instead
|
|
54
|
+
*/
|
|
55
|
+
onCodeInsertToCursorPosition?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number, data?: any) => void;
|
|
48
56
|
onSourceLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
|
|
49
57
|
onLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
|
|
50
58
|
onInfoLinkClick?: (tabId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
|
|
@@ -78,7 +86,7 @@ export declare class MynahUI {
|
|
|
78
86
|
/**
|
|
79
87
|
* Adds a new item to the chat window
|
|
80
88
|
* @param tabId Corresponding tab ID.
|
|
81
|
-
* @param answer
|
|
89
|
+
* @param answer ChatItem object.
|
|
82
90
|
*/
|
|
83
91
|
addChatItem: (tabId: string, chatItem: ChatItem) => void;
|
|
84
92
|
/**
|