@aws/mynah-ui 1.4.0 → 2.0.0-beta.2
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/DEVELOPMENT.md +24 -0
- package/README.md +1 -1
- package/dist/components/button.d.ts +1 -0
- package/dist/components/chat-item/chat-item-card.d.ts +28 -0
- package/dist/components/chat-item/chat-item-followup.d.ts +14 -0
- package/dist/components/chat-item/chat-prompt-input.d.ts +27 -0
- package/dist/components/chat-item/chat-wrapper.d.ts +23 -0
- package/dist/components/feedback-form/feedback-form.d.ts +1 -3
- package/dist/components/icon.d.ts +2 -0
- package/dist/components/main-container.d.ts +4 -1
- package/dist/components/navigation-tabs-vertical.d.ts +13 -0
- package/dist/components/notification/notification.d.ts +0 -4
- package/dist/components/overlay/overlay.d.ts +2 -37
- package/dist/components/query-text-short-view.d.ts +10 -0
- package/dist/components/suggestion-card/suggestion-card-body.d.ts +10 -1
- package/dist/components/suggestion-card/suggestion-card-header.d.ts +0 -1
- package/dist/components/suggestion-card/suggestion-card.d.ts +2 -0
- package/dist/components/suggestion-card/suggestion-skeleton.d.ts +5 -0
- package/dist/components/syntax-highlighter.d.ts +1 -0
- package/dist/components/toggle.d.ts +3 -0
- package/dist/helper/date-time.d.ts +2 -2
- package/dist/helper/dom.d.ts +1 -0
- package/dist/helper/events.d.ts +0 -15
- package/dist/helper/find-language.d.ts +1 -11
- package/dist/helper/store.d.ts +0 -35
- package/dist/helper/url.d.ts +1 -0
- package/dist/main.d.ts +20 -36
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +52 -162
- package/dist/translations/en.d.ts +4 -0
- package/dist/translations/i18n.d.ts +4 -0
- package/package.json +4 -2
- package/dist/components/context-item.d.ts +0 -16
- package/dist/components/prioritization-menu.d.ts +0 -18
- package/dist/components/search-block/autocomplete-card.d.ts +0 -20
- package/dist/components/search-block/autocomplete-content.d.ts +0 -32
- package/dist/components/search-block/search-api-help.d.ts +0 -14
- package/dist/components/search-block/search-card-header.d.ts +0 -12
- package/dist/components/search-block/search-card.d.ts +0 -19
- package/dist/components/search-block/search-context.d.ts +0 -30
- package/dist/components/search-block/search-history-card.d.ts +0 -16
- package/dist/components/search-block/search-history-content.d.ts +0 -19
- package/dist/components/search-block/search-input.d.ts +0 -22
- package/dist/components/search-block/search-live-toggle.d.ts +0 -15
- package/dist/components/suggestion-card/suggestion-card-context-wrapper.d.ts +0 -12
package/DEVELOPMENT.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Mynah UI
|
|
2
|
+
This package is the whole UI of AWS Codewhisperer Chat extension UI for Web, VSCode and Intellij IDEs written in typescript without any framework or third-party UI library dependency. Purpose of the separated UI is to handle the interactions and look & feel of the UI from one single source.
|
|
3
|
+
|
|
4
|
+
## How to release
|
|
5
|
+
### Production
|
|
6
|
+
You need to create a new release from your desired branch with a tag which should follow the naming `v*.*` to release a production version to npm. The tag you're creating shouldn't be existed before.
|
|
7
|
+
|
|
8
|
+
### Beta releases
|
|
9
|
+
If you need to release a beta version first you need to specify the version name inside `package.json` which should follow the versioning `2.0.0-beta.1`
|
|
10
|
+
After that you need to create a new release from your desired branch with a tag which should follow the naming `beta*.*` to release a beta version to npm. The tag you're creating shouldn't be existed before.
|
|
11
|
+
|
|
12
|
+
``` console
|
|
13
|
+
please see publish.yml and beta.yml for releasing details.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Security
|
|
18
|
+
|
|
19
|
+
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
This project is licensed under the Apache-2.0 License.
|
|
24
|
+
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mynah UI
|
|
2
2
|
|
|
3
|
-
This package is the whole UI of AWS
|
|
3
|
+
This package is the whole UI of AWS Codewhisperer Chat extension UI for Web, VSCode and Intellij IDEs written in typescript without any framework or third-party UI library dependency. Purpose of the separated UI is to handle the interactions and look & feel of the UI from one single source.
|
|
4
4
|
|
|
5
5
|
## How to install
|
|
6
6
|
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import { ChatItem } from '../../static';
|
|
7
|
+
import { SuggestionCardBody } from '../suggestion-card/suggestion-card-body';
|
|
8
|
+
export interface ChatItemCardProps {
|
|
9
|
+
chatItem: ChatItem;
|
|
10
|
+
onShowAllWebResultsClick?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class ChatItemCard {
|
|
13
|
+
private readonly chatItem;
|
|
14
|
+
private readonly relatedContentWrapper;
|
|
15
|
+
private readonly referencesWrapper;
|
|
16
|
+
private readonly showMoreButtonBlock;
|
|
17
|
+
private relatedContentPreview;
|
|
18
|
+
private relatedContentPreviewTimeout;
|
|
19
|
+
render: ExtendedHTMLElement;
|
|
20
|
+
suggestionCardBody: SuggestionCardBody;
|
|
21
|
+
chatAvatar: ExtendedHTMLElement;
|
|
22
|
+
constructor(props: ChatItemCardProps);
|
|
23
|
+
private readonly checkIsMuted;
|
|
24
|
+
private readonly showLinkPreview;
|
|
25
|
+
private readonly hideLinkPreview;
|
|
26
|
+
private readonly getChatAvatar;
|
|
27
|
+
readonly updateAnswerBody: (body: string) => void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import { ChatItem } from '../../static';
|
|
7
|
+
export interface ChatItemFollowUpProps {
|
|
8
|
+
chatItem: ChatItem;
|
|
9
|
+
}
|
|
10
|
+
export declare class ChatItemFollowUpContainer {
|
|
11
|
+
private readonly chatItem;
|
|
12
|
+
render: ExtendedHTMLElement;
|
|
13
|
+
constructor(props: ChatItemFollowUpProps);
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 CharPromptInputProps {
|
|
7
|
+
onStopChatResponse?: () => void;
|
|
8
|
+
showFeedbackButton?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class ChatPromptInput {
|
|
11
|
+
render: ExtendedHTMLElement;
|
|
12
|
+
private readonly attachmentWrapper;
|
|
13
|
+
private readonly promptTextInputWrapper;
|
|
14
|
+
private readonly promptTextInput;
|
|
15
|
+
private readonly promptTextInputSizer;
|
|
16
|
+
private sendButton;
|
|
17
|
+
private readonly clearButton;
|
|
18
|
+
private readonly loading;
|
|
19
|
+
private readonly onStopChatResponse;
|
|
20
|
+
private attachment?;
|
|
21
|
+
constructor(props?: CharPromptInputProps);
|
|
22
|
+
private readonly getButton;
|
|
23
|
+
private readonly handleInputKeydown;
|
|
24
|
+
private readonly calculateTextAreaHeight;
|
|
25
|
+
private readonly resetTextAreaHeight;
|
|
26
|
+
private readonly triggerSearch;
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 ChatWrapperProps {
|
|
7
|
+
onStopChatResponse?: () => void;
|
|
8
|
+
onShowAllWebResultsClick?: () => void;
|
|
9
|
+
showFeedbackButton?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class ChatWrapper {
|
|
12
|
+
private readonly props?;
|
|
13
|
+
private readonly chatItemsContainer;
|
|
14
|
+
private readonly spinner;
|
|
15
|
+
private readonly promptInput;
|
|
16
|
+
private lastChatItemCard;
|
|
17
|
+
private containerScollState;
|
|
18
|
+
render: ExtendedHTMLElement;
|
|
19
|
+
constructor(props?: ChatWrapperProps);
|
|
20
|
+
private readonly insertChatItem;
|
|
21
|
+
private readonly scrollToStreamingCardBottom;
|
|
22
|
+
removeAllExceptAnswersAndPrompts: () => void;
|
|
23
|
+
}
|
|
@@ -8,14 +8,12 @@ export interface FeedbackFormProps {
|
|
|
8
8
|
initPayload?: FeedbackPayload;
|
|
9
9
|
}
|
|
10
10
|
export declare class FeedbackForm {
|
|
11
|
-
private
|
|
11
|
+
private feedbackFormWrapper;
|
|
12
12
|
private readonly feedbackStars;
|
|
13
13
|
private readonly feedbackComment;
|
|
14
14
|
private feedbackPayload;
|
|
15
|
-
private readonly triggerButton;
|
|
16
15
|
private readonly feedbackSubmitButton;
|
|
17
16
|
readonly feedbackFormContainer: ExtendedHTMLElement;
|
|
18
|
-
readonly feedbackContainer: ExtendedHTMLElement;
|
|
19
17
|
constructor(props?: FeedbackFormProps);
|
|
20
18
|
private readonly onFeedbackSet;
|
|
21
19
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
6
|
export declare enum MynahIcons {
|
|
7
|
+
MYNAH = "mynah",
|
|
7
8
|
MENU = "menu",
|
|
8
9
|
MINUS = "minus",
|
|
9
10
|
SEARCH = "search",
|
|
@@ -15,6 +16,7 @@ export declare enum MynahIcons {
|
|
|
15
16
|
CALENDAR = "calendar",
|
|
16
17
|
MEGAPHONE = "megaphone",
|
|
17
18
|
EYE = "eye",
|
|
19
|
+
ELLIPSIS = "ellipsis",
|
|
18
20
|
OK = "ok",
|
|
19
21
|
UP_CIRCLED = "up-circled",
|
|
20
22
|
UP_OPEN = "up-open",
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
6
|
import { Suggestion } from '../static';
|
|
7
7
|
export interface MainContainerProps {
|
|
8
|
-
|
|
8
|
+
onNavigationTabChange?: (selectedTab: string) => void;
|
|
9
|
+
onCloseButtonClick?: () => void;
|
|
9
10
|
}
|
|
10
11
|
export declare class MainContainer {
|
|
12
|
+
private readonly navTabs;
|
|
11
13
|
private readonly cardsWrapper;
|
|
12
14
|
private readonly skeletonWrapper;
|
|
15
|
+
private readonly mainContainer;
|
|
13
16
|
render: ExtendedHTMLElement;
|
|
14
17
|
constructor(props: MainContainerProps);
|
|
15
18
|
clearCards: () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
import { NavivationTabsProps } from './navigation-tabs';
|
|
7
|
+
export declare class NavivationTabsVertical {
|
|
8
|
+
render: ExtendedHTMLElement;
|
|
9
|
+
private readonly props;
|
|
10
|
+
constructor(props: NavivationTabsProps);
|
|
11
|
+
private readonly setLoading;
|
|
12
|
+
private readonly getTabsRender;
|
|
13
|
+
}
|
|
@@ -20,10 +20,6 @@ export declare class Notification {
|
|
|
20
20
|
private readonly props;
|
|
21
21
|
constructor(props: NotificationProps);
|
|
22
22
|
notify(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Calculates the top according to the previously shown and still visible notifications
|
|
25
|
-
* @returns number
|
|
26
|
-
*/
|
|
27
23
|
private readonly getNextCalculatedTop;
|
|
28
24
|
private readonly getChildren;
|
|
29
25
|
}
|
|
@@ -4,58 +4,22 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { DomBuilderObject, ExtendedHTMLElement } from '../../helper/dom';
|
|
6
6
|
export declare const OVERLAY_MARGIN = 8;
|
|
7
|
-
/**
|
|
8
|
-
* The horizontal creation direction of the overlay
|
|
9
|
-
*/
|
|
10
7
|
export declare enum OverlayHorizontalDirection {
|
|
11
|
-
/**
|
|
12
|
-
* starts from the left edge of the reference element and opens to left
|
|
13
|
-
*/
|
|
14
8
|
TO_LEFT = "horizontal-direction-to-left",
|
|
15
|
-
/**
|
|
16
|
-
* starts from the right edge of the reference element and opens to left
|
|
17
|
-
*/
|
|
18
9
|
END_TO_LEFT = "horizontal-direction-from-end-to-left",
|
|
19
|
-
/**
|
|
20
|
-
* starts from the right edge of the reference element and opens to right
|
|
21
|
-
*/
|
|
22
10
|
TO_RIGHT = "horizontal-direction-to-right",
|
|
23
|
-
/**
|
|
24
|
-
* starts from the left edge of the reference element and opens to right
|
|
25
|
-
*/
|
|
26
11
|
START_TO_RIGHT = "horizontal-direction-from-start-to-right",
|
|
27
|
-
/**
|
|
28
|
-
* starts and opens at the center of the reference element
|
|
29
|
-
*/
|
|
30
12
|
CENTER = "horizontal-direction-at-center"
|
|
31
13
|
}
|
|
32
|
-
/**
|
|
33
|
-
* The vertical creation direction of the overlay
|
|
34
|
-
*/
|
|
35
14
|
export declare enum OverlayVerticalDirection {
|
|
36
|
-
/**
|
|
37
|
-
* starts from the bottom edge of the reference element and opens to bottom
|
|
38
|
-
*/
|
|
39
15
|
TO_BOTTOM = "vertical-direction-to-bottom",
|
|
40
|
-
/**
|
|
41
|
-
* starts from the top edge of the reference element and opens to bottom
|
|
42
|
-
*/
|
|
43
16
|
START_TO_BOTTOM = "vertical-direction-from-start-to-bottom",
|
|
44
|
-
/**
|
|
45
|
-
* starts from the top edge of the reference element and opens to top
|
|
46
|
-
*/
|
|
47
17
|
TO_TOP = "vertical-direction-to-top",
|
|
48
|
-
/**
|
|
49
|
-
* starts from the bottom edge of the reference element and opens to top
|
|
50
|
-
*/
|
|
51
18
|
END_TO_TOP = "vertical-direction-from-end-to-top",
|
|
52
|
-
/**
|
|
53
|
-
* starts and opens at the center of the reference element
|
|
54
|
-
*/
|
|
55
19
|
CENTER = "vertical-direction-at-center"
|
|
56
20
|
}
|
|
57
21
|
export interface OverlayProps {
|
|
58
|
-
referenceElement?:
|
|
22
|
+
referenceElement?: HTMLElement | ExtendedHTMLElement;
|
|
59
23
|
referencePoint?: {
|
|
60
24
|
top: number;
|
|
61
25
|
left: number;
|
|
@@ -65,6 +29,7 @@ export interface OverlayProps {
|
|
|
65
29
|
verticalDirection?: OverlayVerticalDirection;
|
|
66
30
|
dimOutside?: boolean;
|
|
67
31
|
closeOnOutsideClick?: boolean;
|
|
32
|
+
background?: boolean;
|
|
68
33
|
onClose?: () => void;
|
|
69
34
|
}
|
|
70
35
|
export declare class Overlay {
|
|
@@ -0,0 +1,10 @@
|
|
|
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 declare class QueryTextShortView {
|
|
7
|
+
render: ExtendedHTMLElement;
|
|
8
|
+
private readonly textBlock;
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
@@ -5,9 +5,18 @@
|
|
|
5
5
|
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
6
|
import { Suggestion } from '../../static';
|
|
7
7
|
export interface SuggestionCardBodyProps {
|
|
8
|
-
suggestion: Suggestion
|
|
8
|
+
suggestion: Partial<Suggestion>;
|
|
9
|
+
showFooterButtons?: boolean;
|
|
10
|
+
onLinkMouseEnter?: (e: MouseEvent, url: string) => void;
|
|
11
|
+
onLinkMouseLeave?: (e: MouseEvent, url: string) => void;
|
|
9
12
|
}
|
|
10
13
|
export declare class SuggestionCardBody {
|
|
11
14
|
render: ExtendedHTMLElement;
|
|
15
|
+
cardBody: ExtendedHTMLElement;
|
|
16
|
+
matchingLanguage: string;
|
|
17
|
+
props: SuggestionCardBodyProps;
|
|
12
18
|
constructor(props: SuggestionCardBodyProps);
|
|
19
|
+
private readonly processNode;
|
|
20
|
+
private readonly getCardBodyChildren;
|
|
21
|
+
readonly updateCardBody: (body: string) => void;
|
|
13
22
|
}
|
|
@@ -14,6 +14,5 @@ export interface SuggestionCardHeaderProps {
|
|
|
14
14
|
export declare class SuggestionCardHeader {
|
|
15
15
|
render: ExtendedHTMLElement;
|
|
16
16
|
constructor(props: SuggestionCardHeaderProps);
|
|
17
|
-
private readonly getSourceMetaBlockClassName;
|
|
18
17
|
private readonly getSourceMetaBlock;
|
|
19
18
|
}
|
|
@@ -6,6 +6,8 @@ import { ExtendedHTMLElement } from '../../helper/dom';
|
|
|
6
6
|
import { Suggestion } from '../../static';
|
|
7
7
|
export interface SuggestionCardProps {
|
|
8
8
|
suggestion: Suggestion;
|
|
9
|
+
compact?: 'withBody' | true;
|
|
10
|
+
showFooterButtons?: boolean;
|
|
9
11
|
}
|
|
10
12
|
export declare class SuggestionCard {
|
|
11
13
|
private engagementStartTime;
|
|
@@ -35,6 +35,7 @@ export interface SyntaxHighlighterProps {
|
|
|
35
35
|
language?: SupportedCodingLanguagesType;
|
|
36
36
|
keepHighlights?: boolean;
|
|
37
37
|
showLineNumbers?: boolean;
|
|
38
|
+
block?: boolean;
|
|
38
39
|
startingLineNumber?: number;
|
|
39
40
|
showCopyOptions?: boolean;
|
|
40
41
|
onCopiedToClipboard?: OnCopiedToClipboardFunction;
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../helper/dom';
|
|
6
|
+
import { MynahIcons } from './icon';
|
|
6
7
|
export interface ToggleOption {
|
|
7
8
|
label?: ExtendedHTMLElement | string | HTMLElement;
|
|
8
9
|
color?: string;
|
|
10
|
+
icon?: MynahIcons;
|
|
9
11
|
disabled?: boolean;
|
|
10
12
|
selected?: boolean;
|
|
11
13
|
value: string;
|
|
@@ -14,6 +16,7 @@ export interface ToggleOption {
|
|
|
14
16
|
export interface ToggleProps {
|
|
15
17
|
options: ToggleOption[];
|
|
16
18
|
type?: 'switch' | 'tabs';
|
|
19
|
+
direction?: 'horizontal' | 'vertical';
|
|
17
20
|
value?: string | null;
|
|
18
21
|
name: string;
|
|
19
22
|
disabled?: boolean;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
export declare const getTimeDiff: (differenceInMs: number, show?: {
|
|
5
|
+
export declare const getTimeDiff: (differenceInMs: number, show?: 1 | 2 | 3 | 4 | 5 | 6 | {
|
|
6
6
|
years?: boolean | undefined;
|
|
7
7
|
months?: boolean | undefined;
|
|
8
8
|
weeks?: boolean | undefined;
|
|
9
9
|
days?: boolean | undefined;
|
|
10
10
|
hours?: boolean | undefined;
|
|
11
11
|
minutes?: boolean | undefined;
|
|
12
|
-
} |
|
|
12
|
+
} | undefined, separator?: string | undefined) => string;
|
package/dist/helper/dom.d.ts
CHANGED
package/dist/helper/events.d.ts
CHANGED
|
@@ -9,22 +9,7 @@ export declare class MynahUIGlobalEvents {
|
|
|
9
9
|
private readonly listeners;
|
|
10
10
|
private constructor();
|
|
11
11
|
static getInstance: () => MynahUIGlobalEvents;
|
|
12
|
-
/**
|
|
13
|
-
* Subscribe to value changes of a specific item in data store
|
|
14
|
-
* @param eventKey One of the keys in MynahUIDataModel
|
|
15
|
-
* @param handler function will be called with optional data field
|
|
16
|
-
* @returns listenerId which will be necessary to removeListener
|
|
17
|
-
*/
|
|
18
12
|
addListener: (eventKey: MynahEventNames, handler: (data?: any) => void) => string;
|
|
19
|
-
/**
|
|
20
|
-
* Unsubscribe from changes of a specific item in data store
|
|
21
|
-
* @param eventKey One of the keys in MynahUIDataModel
|
|
22
|
-
* @param listenerId listenerId which is returned from addListener function
|
|
23
|
-
*/
|
|
24
13
|
removeListener: (eventKey: MynahEventNames, listenerId: string) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Updates the store and informs the subscribers.
|
|
27
|
-
* @param data A full or partial set of store data model with values.
|
|
28
|
-
*/
|
|
29
14
|
dispatch: (eventKey: MynahEventNames, data?: any) => void;
|
|
30
15
|
}
|
|
@@ -3,15 +3,5 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { Suggestion } from '../static';
|
|
6
|
-
|
|
7
|
-
* Finds the coding language if there is a match witnin the supported languages from context or body or from the title
|
|
8
|
-
* @param suggestion SuggestionType
|
|
9
|
-
* @returns string | undefined
|
|
10
|
-
*/
|
|
11
|
-
export declare const findLanguageFromSuggestion: (suggestion: Suggestion) => string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Finds the coding language if there is a match within the supported languages from the given file name
|
|
14
|
-
* @param fileName string
|
|
15
|
-
* @returns string | undefined
|
|
16
|
-
*/
|
|
6
|
+
export declare const findLanguageFromSuggestion: (suggestion: Partial<Suggestion>) => string | undefined;
|
|
17
7
|
export declare const getLanguageFromFileName: (fileName: string) => string | undefined;
|
package/dist/helper/store.d.ts
CHANGED
|
@@ -14,47 +14,12 @@ export declare class MynahUIDataStore {
|
|
|
14
14
|
private defaults;
|
|
15
15
|
private constructor();
|
|
16
16
|
static getInstance: (initialData?: MynahUIDataModel | undefined) => MynahUIDataStore;
|
|
17
|
-
/**
|
|
18
|
-
* Sets the defaults to use while clearing the store
|
|
19
|
-
* @param defaults partial set of MynahUIDataModel for defaults
|
|
20
|
-
*/
|
|
21
17
|
setDefaults: (defaults: MynahUIDataModel | null) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Get the defaults to use while generating an empty store data
|
|
24
|
-
*/
|
|
25
18
|
getDefaults: () => MynahUIDataModel | null;
|
|
26
|
-
/**
|
|
27
|
-
* Subscribe to value changes of a specific item in data store
|
|
28
|
-
* @param storeKey One of the keys in MynahUIDataModel
|
|
29
|
-
* @param handler function will be called when value of the given key is updated in store with new and old values
|
|
30
|
-
* @returns subscriptionId which needed to unsubscribe
|
|
31
|
-
*/
|
|
32
19
|
subscribe: (storeKey: keyof MynahUIDataModel, handler: (newValue: any, oldValue?: any) => void) => string;
|
|
33
|
-
/**
|
|
34
|
-
* Unsubscribe from changes of a specific item in data store
|
|
35
|
-
* @param storeKey One of the keys in MynahUIDataModel
|
|
36
|
-
* @param subscriptionId subsciptionId which is returned from subscribe function
|
|
37
|
-
*/
|
|
38
20
|
unsubscribe: (storeKey: keyof MynahUIDataModel, subscriptionId: string) => void;
|
|
39
|
-
/**
|
|
40
|
-
* Returns current value of an item in data store
|
|
41
|
-
* @param storeKey One of the keys in MynahUIDataModel
|
|
42
|
-
* @returns value of the given key in data store
|
|
43
|
-
*/
|
|
44
21
|
getValue: (storeKey: keyof MynahUIDataModel) => any;
|
|
45
|
-
/**
|
|
46
|
-
* Returns current value of an item in data store
|
|
47
|
-
* @param storeKey One of the keys in MynahUIDataModel
|
|
48
|
-
* @returns value of the given key in data store
|
|
49
|
-
*/
|
|
50
22
|
getDefaultValue: (storeKey: keyof MynahUIDataModel) => any;
|
|
51
|
-
/**
|
|
52
|
-
* Updates the store and informs the subscribers.
|
|
53
|
-
* @param data A full or partial set of store data model with values.
|
|
54
|
-
*/
|
|
55
23
|
updateStore: (data: MynahUIDataModel, skipSubscribers?: boolean | undefined) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Clears store data and informs all the subscribers
|
|
58
|
-
*/
|
|
59
24
|
resetStore: () => void;
|
|
60
25
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOrigin: (site: string) => string;
|
package/dist/main.d.ts
CHANGED
|
@@ -2,66 +2,50 @@
|
|
|
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 { SuggestionEngagement, Suggestion, SearchPayload,
|
|
5
|
+
import { SuggestionEngagement, Suggestion, SearchPayload, SuggestionEventName, RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemFollowUp, ChatPrompt, MynahMode } from './static';
|
|
6
6
|
import './styles/styles.scss';
|
|
7
|
-
export {
|
|
7
|
+
export { SearchPayloadCodeSelection, FeedbackPayload, RelevancyVoteType, SearchPayload, Suggestion, EngagementType, SuggestionEngagement, SuggestionEventName, MynahUIDataModel, NotificationType, MynahMode, ChatItem, ChatItemFollowUp, ChatItemType, ChatPrompt } from './static';
|
|
8
|
+
export { ToggleOption } from './components/toggle';
|
|
9
|
+
export { MynahIcons } from './components/icon';
|
|
8
10
|
export { transformPayloadData, validateRulesOnPayloadData, PayloadTransformRule, } from './helper/payload-transformer';
|
|
9
11
|
export interface MynahUIProps {
|
|
10
12
|
rootSelector?: string;
|
|
11
13
|
storeData?: MynahUIDataModel;
|
|
12
|
-
onSearch?: ((searchPayload: SearchPayload
|
|
14
|
+
onSearch?: ((searchPayload: SearchPayload) => void) | ((searchPayload: SearchPayload) => MynahUIDataModel);
|
|
15
|
+
onShowMoreWebResultsClick?: () => void;
|
|
13
16
|
onReady?: () => void;
|
|
14
17
|
onClickSuggestionVote?: (suggestion: Suggestion, vote: RelevancyVoteType) => void;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
row: string;
|
|
18
|
-
column?: string;
|
|
19
|
-
};
|
|
20
|
-
end?: {
|
|
21
|
-
row: string;
|
|
22
|
-
column?: string;
|
|
23
|
-
};
|
|
24
|
-
}) => void;
|
|
18
|
+
onClearChat?: () => void;
|
|
19
|
+
onStopChatResponse?: () => void;
|
|
25
20
|
onResetStore?: () => void;
|
|
26
|
-
|
|
21
|
+
onChatPrompt?: (prompt: ChatPrompt) => void;
|
|
22
|
+
onFollowUpClicked?: (followUp: ChatItemFollowUp) => void;
|
|
23
|
+
onSuggestionAttachedToChatPrompt?: (attachment: Suggestion) => void;
|
|
27
24
|
onNavigationTabChange?: (selectedTab: string) => void;
|
|
25
|
+
onSideNavigationTabChange?: (selectedTab: string) => void;
|
|
28
26
|
onSuggestionEngagement?: (engagement: SuggestionEngagement) => void;
|
|
29
27
|
onSuggestionClipboardInteraction?: (suggestionId: string, type?: string, text?: string) => void;
|
|
30
28
|
onSuggestionInteraction?: (eventName: SuggestionEventName, suggestion: Suggestion, mouseEvent?: MouseEvent) => void;
|
|
31
29
|
onSendFeedback?: (feedbackPayload: FeedbackPayload) => void;
|
|
32
|
-
onRequestHistoryRecords?: (filterPayload: SearchHistoryFilters) => void;
|
|
33
|
-
onInputQueryChange?: (input: string) => void;
|
|
34
|
-
onChangeLiveSearchState?: (liveSearchState: LiveSearchState) => void;
|
|
35
|
-
onClickAutocompleteItem?: (text: string, currSelected?: number, suggestionCount?: number) => void;
|
|
36
30
|
}
|
|
37
31
|
export declare class MynahUI {
|
|
38
32
|
private readonly props;
|
|
39
33
|
private readonly wrapper;
|
|
40
|
-
private readonly
|
|
41
|
-
private readonly
|
|
34
|
+
private readonly sideNav;
|
|
35
|
+
private readonly feedbackForm?;
|
|
42
36
|
private readonly mainContainer;
|
|
37
|
+
private readonly chatWrapper;
|
|
43
38
|
private readonly config;
|
|
44
39
|
constructor(props: MynahUIProps);
|
|
40
|
+
private readonly sideNavigationTabChanged;
|
|
45
41
|
private readonly addGlobalListeners;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
42
|
+
addChatAnswer: (answer: ChatItem) => void;
|
|
43
|
+
getLastChatAnswer: () => ChatItem | undefined;
|
|
44
|
+
updateLastChatAnswerStream: (body: string) => void;
|
|
50
45
|
updateStore: (data: MynahUIDataModel) => void;
|
|
51
|
-
|
|
52
|
-
* Sets store defaults to use while clearing the store
|
|
53
|
-
* To clear the defaults, send `null`
|
|
54
|
-
* @param defaults partial set of MynahUIDataModel for defaults
|
|
55
|
-
*/
|
|
46
|
+
getMode: () => MynahMode | undefined;
|
|
56
47
|
setStoreDefaults: (defaults: MynahUIDataModel | null) => void;
|
|
57
|
-
/**
|
|
58
|
-
* Returns the current search payload
|
|
59
|
-
*/
|
|
60
48
|
getSearchPayload: () => SearchPayload;
|
|
61
|
-
/**
|
|
62
|
-
* Simply creates and shows a notification
|
|
63
|
-
* @param props NotificationProps
|
|
64
|
-
*/
|
|
65
49
|
notify: (props: {
|
|
66
50
|
duration?: number;
|
|
67
51
|
type?: NotificationType;
|