@aws/mynah-ui 4.5.5 → 4.6.0

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.
@@ -22,6 +22,7 @@ export interface CardBodyProps {
22
22
  childLocation?: 'above-body' | 'below-body';
23
23
  highlightRangeWithTooltip?: ReferenceTrackerInformation[];
24
24
  useParts?: boolean;
25
+ codeBlockStartIndex?: number;
25
26
  processChildren?: boolean;
26
27
  onLinkClick?: (url: string, e: MouseEvent) => void;
27
28
  onCopiedToClipboard?: OnCopiedToClipboardFunction;
@@ -30,6 +31,8 @@ export interface CardBodyProps {
30
31
  export declare class CardBody {
31
32
  render: ExtendedHTMLElement;
32
33
  props: CardBodyProps;
34
+ nextCodeBlockIndex: number;
35
+ codeBlockStartIndex: number;
33
36
  private highlightRangeTooltip;
34
37
  private highlightRangeTooltipTimeout;
35
38
  constructor(props: CardBodyProps);
@@ -3,7 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- import { ChatItem } from '../../static';
6
+ import { CardRenderDetails, ChatItem } from '../../static';
7
7
  import { CardBody } from '../card/card-body';
8
8
  import { ChatItemTreeViewWrapper } from './chat-item-tree-view-wrapper';
9
9
  import { ChatItemFormItemsWrapper } from './chat-item-form-items';
@@ -15,7 +15,7 @@ export interface ChatItemCardProps {
15
15
  export declare class ChatItemCard {
16
16
  readonly props: ChatItemCardProps;
17
17
  render: ExtendedHTMLElement;
18
- contentBody: CardBody;
18
+ contentBody: CardBody | null;
19
19
  chatAvatar: ExtendedHTMLElement;
20
20
  updateStack: Array<Partial<ChatItem>>;
21
21
  chatFormItems: ChatItemFormItemsWrapper | null;
@@ -36,4 +36,5 @@ export declare class ChatItemCard {
36
36
  private readonly getInsertingTypewriterPartsCss;
37
37
  readonly updateCard: () => void;
38
38
  readonly updateCardStack: (updateWith: Partial<ChatItem>) => void;
39
+ readonly getRenderDetails: () => CardRenderDetails;
39
40
  }
@@ -3,7 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- import { ChatItem } from '../../static';
6
+ import { CardRenderDetails, ChatItem } from '../../static';
7
7
  export interface ChatWrapperProps {
8
8
  onStopChatResponse?: (tabId: string) => void;
9
9
  tabId: string;
@@ -22,6 +22,11 @@ export declare class ChatWrapper {
22
22
  constructor(props: ChatWrapperProps);
23
23
  private readonly insertChatItem;
24
24
  updateLastChatAnswer: (updateWith: Partial<ChatItem>) => void;
25
+ getChatItem: (messageId: string) => {
26
+ chatItem: ChatItem;
27
+ render: ExtendedHTMLElement | HTMLElement;
28
+ renderDetails: CardRenderDetails;
29
+ } | undefined;
25
30
  updateChatAnswerWithMessageId: (messageId: string, updateWith: Partial<ChatItem>) => void;
26
31
  addToPrompt: (textToAdd: string) => void;
27
32
  }
@@ -27,7 +27,7 @@ import 'prismjs/components/prism-scss.min';
27
27
  import 'prismjs/components/prism-less.min';
28
28
  import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
29
29
  import 'prismjs/plugins/keep-markup/prism-keep-markup.js';
30
- import { OnCopiedToClipboardFunction, OnInsertToCursorPositionFunction } from '../static';
30
+ import { CodeSelectionType } from '../static';
31
31
  export declare const highlighters: {
32
32
  start: {
33
33
  markup: string;
@@ -56,12 +56,12 @@ export interface SyntaxHighlighterProps {
56
56
  block?: boolean;
57
57
  startingLineNumber?: number;
58
58
  showCopyOptions?: boolean;
59
- onCopiedToClipboard?: OnCopiedToClipboardFunction;
60
- onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
59
+ index?: number;
60
+ onCopiedToClipboard?: (type?: CodeSelectionType, text?: string, codeBlockIndex?: number) => void;
61
+ onInsertToCursorPosition?: (type?: CodeSelectionType, text?: string, codeBlockIndex?: number) => void;
61
62
  }
62
63
  export declare class SyntaxHighlighter {
63
- private readonly onCopiedToClipboard?;
64
- private readonly onInsertToCursorPosition?;
64
+ private readonly props?;
65
65
  render: ExtendedHTMLElement;
66
66
  constructor(props: SyntaxHighlighterProps);
67
67
  private readonly getSelectedCodeContextMenu;
package/dist/main.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton } from './static';
5
+ import { ExtendedHTMLElement } from './helper/dom';
6
+ import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton, CardRenderDetails } from './static';
6
7
  import './styles/styles.scss';
7
8
  export { ChatItemBodyRenderer, } from './helper/dom';
8
9
  export { AllowedAttributesInCustomRenderer, AllowedTagsInCustomRenderer } from './helper/sanitize';
@@ -31,8 +32,8 @@ export interface MynahUIProps {
31
32
  onTabRemove?: (tabId: string, eventId?: string) => void;
32
33
  onBeforeTabRemove?: (tabId: string, eventId?: string) => boolean;
33
34
  onChatItemEngagement?: (tabId: string, messageId: string, engagement: Engagement) => void;
34
- onCopyCodeToClipboard?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string) => void;
35
- onCodeInsertToCursorPosition?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string) => void;
35
+ onCopyCodeToClipboard?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number) => void;
36
+ onCodeInsertToCursorPosition?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[], eventId?: string, codeBlockIndex?: number, totalCodeBlocks?: number) => void;
36
37
  onSourceLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
37
38
  onLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
38
39
  onInfoLinkClick?: (tabId: string, link: string, mouseEvent?: MouseEvent, eventId?: string) => void;
@@ -47,9 +48,9 @@ export interface MynahUIProps {
47
48
  onTabBarButtonClick?: (tabId: string, buttonId: string, eventId?: string) => void;
48
49
  }
49
50
  export declare class MynahUI {
51
+ render: ExtendedHTMLElement;
50
52
  private lastEventId;
51
53
  private readonly props;
52
- private readonly wrapper;
53
54
  private readonly tabsWrapper;
54
55
  private readonly tabContentsWrapper;
55
56
  private readonly feedbackForm?;
@@ -61,6 +62,7 @@ export declare class MynahUI {
61
62
  addChatItem: (tabId: string, chatItem: ChatItem) => void;
62
63
  updateLastChatAnswer: (tabId: string, updateWith: Partial<ChatItem>) => void;
63
64
  updateChatAnswerWithMessageId: (tabId: string, messageId: string, updateWith: Partial<ChatItem>) => void;
65
+ endMessageStream: (tabId: string, messageId: string, updateWith?: Partial<ChatItem>) => CardRenderDetails;
64
66
  selectTab: (tabId: string, eventId: string) => void;
65
67
  removeTab: (tabId: string, eventId: string) => void;
66
68
  updateStore: (tabId: string | '', data: MynahUIDataModel) => string | undefined;