@aws/mynah-ui 2.0.0-beta.11.2 → 2.0.0-beta.12.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.
package/.eslintrc.js ADDED
@@ -0,0 +1,48 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true,
5
+ "node": true
6
+ },
7
+ "extends": [
8
+ "standard-with-typescript"
9
+ ],
10
+ "parser": "@typescript-eslint/parser",
11
+ "parserOptions": {
12
+ "ecmaVersion": "latest",
13
+ "sourceType": "module",
14
+ "project": "./tsconfig.json",
15
+ },
16
+ "plugins": [
17
+ "@typescript-eslint",
18
+ "prettier"
19
+ ],
20
+ "rules": {
21
+ "@typescript-eslint/semi": [
22
+ 2,
23
+ "always"
24
+ ],
25
+ "comma-dangle": [
26
+ 2,
27
+ "only-multiline"
28
+ ],
29
+ "array-bracket-spacing": [
30
+ 2,
31
+ "always"
32
+ ],
33
+ "no-useless-call": "off",
34
+ "@typescript-eslint/member-delimiter-style": [
35
+ "error",
36
+ {
37
+ "multiline": {
38
+ "delimiter": "semi",
39
+ "requireLast": true
40
+ },
41
+ "singleline": {
42
+ "delimiter": "semi",
43
+ "requireLast": false
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ }
@@ -10,12 +10,14 @@ export interface ChatItemCardProps {
10
10
  chatItem: ChatItem;
11
11
  }
12
12
  export declare class ChatItemCard {
13
- private readonly relatedContentWrapper;
14
13
  readonly props: ChatItemCardProps;
15
14
  render: ExtendedHTMLElement;
16
15
  suggestionCardBody: SuggestionCardBody;
17
16
  chatAvatar: ExtendedHTMLElement;
18
17
  constructor(props: ChatItemCardProps);
18
+ private readonly generateCard;
19
+ private readonly getCardClasses;
20
+ private readonly getCardContent;
19
21
  private readonly getChatAvatar;
20
- readonly updateAnswerBody: (body: ExtendedHTMLElement | HTMLElement | string) => void;
22
+ readonly updateCard: (chatItemToUpdate: Partial<ChatItem>) => void;
21
23
  }
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { ExtendedHTMLElement } from '../../helper/dom';
6
+ export interface ChatPromptInputCommandProps {
7
+ command: string;
8
+ onRemoveClick: () => void;
9
+ }
10
+ export declare class ChatPromptInputCommand {
11
+ render: ExtendedHTMLElement;
12
+ private readonly props;
13
+ private readonly promptTextInputCommand;
14
+ constructor(props: ChatPromptInputCommandProps);
15
+ setCommand: (command: string) => void;
16
+ }
@@ -13,16 +13,19 @@ export declare class ChatPromptInput {
13
13
  private readonly promptTextInputWrapper;
14
14
  private readonly promptTextInput;
15
15
  private readonly promptTextInputSizer;
16
+ private readonly promptTextInputCommand;
16
17
  private readonly sendButton;
17
18
  private quickActionCommands;
18
19
  private commandSelector;
19
20
  private commandSelectorOpen;
21
+ private selectedCommand;
20
22
  private inputDisabled;
21
23
  private attachment?;
22
24
  private filteredCommandsList;
23
25
  constructor(props: ChatPromptInputProps);
24
26
  private readonly handleInputKeydown;
25
27
  private readonly getQuickCommandActions;
28
+ private readonly handleCommandSelection;
26
29
  private readonly calculateTextAreaHeight;
27
30
  private readonly resetTextAreaHeight;
28
31
  readonly clearTextArea: () => void;
@@ -3,7 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { ExtendedHTMLElement } from '../../helper/dom';
6
- import { Suggestion } from '../../static';
6
+ import { ChatItem } from '../../static';
7
7
  export interface ChatWrapperProps {
8
8
  onStopChatResponse?: (tabId: string) => void;
9
9
  tabId: string;
@@ -17,8 +17,5 @@ export declare class ChatWrapper {
17
17
  render: ExtendedHTMLElement;
18
18
  constructor(props: ChatWrapperProps);
19
19
  private readonly insertChatItem;
20
- updateLastCharAnswerStream: (updateWith: string | {
21
- title?: string;
22
- content: Suggestion[];
23
- }) => void;
20
+ updateLastChatAnswer: (chatItem: Partial<ChatItem>) => void;
24
21
  }
@@ -2,20 +2,34 @@
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 { ExtendedHTMLElement } from '../../helper/dom';
6
- import { Suggestion } from '../../static';
5
+ import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
6
+ import { ReferenceTrackerInformation, Suggestion } from '../../static';
7
+ export declare const highlightersWithTooltip: {
8
+ start: {
9
+ markupStart: string;
10
+ markupAttirubtes: (markerIndex: string) => string;
11
+ markupEnd: string;
12
+ };
13
+ end: {
14
+ markup: string;
15
+ };
16
+ };
7
17
  export interface SuggestionCardBodyProps {
8
18
  suggestion: Partial<Suggestion>;
19
+ children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
20
+ highlightRangeWithTooltip?: ReferenceTrackerInformation[];
9
21
  showFooterButtons?: boolean;
10
22
  }
11
23
  export declare class SuggestionCardBody {
12
24
  render: ExtendedHTMLElement;
13
25
  cardBody: ExtendedHTMLElement;
14
26
  props: SuggestionCardBodyProps;
15
- private readonly syntaxHighlighterHighlightWithTooltipRangeItems;
27
+ private highlightRangeTooltip;
28
+ private highlightRangeTooltipTimeout;
16
29
  constructor(props: SuggestionCardBodyProps);
17
30
  private readonly processNode;
31
+ private readonly getReferenceTrackerInformationFromElement;
32
+ private readonly showHighlightRangeTooltip;
33
+ private readonly hideHighlightRangeTooltip;
18
34
  private readonly getCardBodyChildren;
19
- readonly updateCardBody: (body: string) => void;
20
- readonly addToCardBody: (elementToAdd: ExtendedHTMLElement | HTMLElement | string) => void;
21
35
  }
@@ -9,7 +9,8 @@ import 'prismjs/components/prism-java';
9
9
  import 'prismjs/components/prism-javascript';
10
10
  import 'prismjs/components/prism-json';
11
11
  import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
12
- import { OnCopiedToClipboardFunction, OnInsertToCursorPositionFunction, ReferenceTrackerInformation } from '../static';
12
+ import 'prismjs/plugins/keep-markup/prism-keep-markup.js';
13
+ import { OnCopiedToClipboardFunction, OnInsertToCursorPositionFunction } from '../static';
13
14
  export declare const highlighters: {
14
15
  start: {
15
16
  markup: string;
@@ -20,16 +21,6 @@ export declare const highlighters: {
20
21
  textReplacement: string;
21
22
  };
22
23
  };
23
- export declare const highlightersWithTooltip: {
24
- start: {
25
- markup: string;
26
- textReplacement: string;
27
- };
28
- end: {
29
- markup: string;
30
- textReplacement: string;
31
- };
32
- };
33
24
  export declare const ellipsis: {
34
25
  start: {
35
26
  markup: string;
@@ -48,20 +39,14 @@ export interface SyntaxHighlighterProps {
48
39
  block?: boolean;
49
40
  startingLineNumber?: number;
50
41
  showCopyOptions?: boolean;
51
- highlightRangeWithTooltip?: ReferenceTrackerInformation[];
52
42
  onCopiedToClipboard?: OnCopiedToClipboardFunction;
53
43
  onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
54
44
  }
55
45
  export declare class SyntaxHighlighter {
56
46
  private readonly onCopiedToClipboard?;
57
47
  private readonly onInsertToCursorPosition?;
58
- private readonly highlightRangeWithTooltip;
59
- private highlightRangeTooltipTimeout;
60
- private highlightRangeTooltip;
61
48
  render: ExtendedHTMLElement;
62
49
  constructor(props: SyntaxHighlighterProps);
63
- private readonly showHighlightRangeTooltip;
64
- private readonly hideHighlightRangeTooltip;
65
50
  private readonly getSelectedCode;
66
51
  private readonly copyToClipboard;
67
52
  }
package/dist/main.d.ts CHANGED
@@ -42,10 +42,7 @@ export declare class MynahUI {
42
42
  updateTab: (tabId: string, tabData: MynahUIDataModel) => void;
43
43
  setChatLoadingState: (tabId: string, isLoading: boolean) => void;
44
44
  addChatItem: (tabId: string, chatItem: ChatItem) => void;
45
- updateLastChatAnswerStream: (tabId: string, updateWith: string | {
46
- title?: string;
47
- content: Suggestion[];
48
- }) => void;
45
+ updateLastChatAnswer: (tabId: string, updateWith: Partial<ChatItem>) => void;
49
46
  updateStore: (tabId: string | '', data: MynahUIDataModel) => string;
50
47
  notify: (props: {
51
48
  duration?: number;