@aws/mynah-ui 2.0.0-beta.1 → 2.0.0-beta.3
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/chat-item/chat-prompt-input.d.ts +3 -6
- package/dist/components/chat-item/chat-wrapper.d.ts +1 -1
- package/dist/components/notification/notification.d.ts +0 -4
- package/dist/components/overlay/overlay.d.ts +1 -37
- package/dist/components/syntax-highlighter.d.ts +4 -1
- package/dist/helper/date-time.d.ts +2 -2
- package/dist/helper/events.d.ts +0 -15
- package/dist/helper/find-language.d.ts +0 -10
- package/dist/helper/store.d.ts +0 -35
- package/dist/main.d.ts +5 -43
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/static.d.ts +8 -164
- package/package.json +1 -1
- 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 -11
- 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
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ExtendedHTMLElement } from '../../helper/dom';
|
|
6
6
|
export interface CharPromptInputProps {
|
|
7
|
-
onStopChatResponse?: () => void;
|
|
8
7
|
showFeedbackButton?: boolean;
|
|
9
8
|
}
|
|
10
9
|
export declare class ChatPromptInput {
|
|
@@ -13,15 +12,13 @@ export declare class ChatPromptInput {
|
|
|
13
12
|
private readonly promptTextInputWrapper;
|
|
14
13
|
private readonly promptTextInput;
|
|
15
14
|
private readonly promptTextInputSizer;
|
|
16
|
-
private sendButton;
|
|
15
|
+
private readonly sendButton;
|
|
17
16
|
private readonly clearButton;
|
|
18
|
-
private
|
|
19
|
-
private readonly onStopChatResponse;
|
|
17
|
+
private loading;
|
|
20
18
|
private attachment?;
|
|
21
19
|
constructor(props?: CharPromptInputProps);
|
|
22
|
-
private readonly getButton;
|
|
23
20
|
private readonly handleInputKeydown;
|
|
24
21
|
private readonly calculateTextAreaHeight;
|
|
25
22
|
private readonly resetTextAreaHeight;
|
|
26
|
-
private readonly
|
|
23
|
+
private readonly sendPrompt;
|
|
27
24
|
}
|
|
@@ -11,7 +11,7 @@ export interface ChatWrapperProps {
|
|
|
11
11
|
export declare class ChatWrapper {
|
|
12
12
|
private readonly props?;
|
|
13
13
|
private readonly chatItemsContainer;
|
|
14
|
-
private readonly
|
|
14
|
+
private readonly intermediateBlockContainer;
|
|
15
15
|
private readonly promptInput;
|
|
16
16
|
private lastChatItemCard;
|
|
17
17
|
private containerScollState;
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ 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, SupportedCodingLanguagesType } from '../static';
|
|
12
|
+
import { OnCopiedToClipboardFunction, OnInsertToCursorPositionFunction, SupportedCodingLanguagesType } from '../static';
|
|
13
13
|
export declare const highlighters: {
|
|
14
14
|
start: {
|
|
15
15
|
markup: string;
|
|
@@ -39,11 +39,14 @@ export interface SyntaxHighlighterProps {
|
|
|
39
39
|
startingLineNumber?: number;
|
|
40
40
|
showCopyOptions?: boolean;
|
|
41
41
|
onCopiedToClipboard?: OnCopiedToClipboardFunction;
|
|
42
|
+
onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
|
|
42
43
|
}
|
|
43
44
|
export declare class SyntaxHighlighter {
|
|
44
45
|
private readonly code;
|
|
45
46
|
private readonly onCopiedToClipboard?;
|
|
47
|
+
private readonly onInsertToCursorPosition?;
|
|
46
48
|
render: ExtendedHTMLElement;
|
|
47
49
|
constructor(props: SyntaxHighlighterProps);
|
|
50
|
+
private readonly getSelectedCode;
|
|
48
51
|
private readonly copyToClipboard;
|
|
49
52
|
}
|
|
@@ -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?: 1 | {
|
|
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/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
6
|
export declare const findLanguageFromSuggestion: (suggestion: Partial<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
|
-
*/
|
|
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
|
}
|
package/dist/main.d.ts
CHANGED
|
@@ -2,46 +2,32 @@
|
|
|
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
8
|
export { ToggleOption } from './components/toggle';
|
|
9
9
|
export { MynahIcons } from './components/icon';
|
|
10
10
|
export { transformPayloadData, validateRulesOnPayloadData, PayloadTransformRule, } from './helper/payload-transformer';
|
|
11
11
|
export interface MynahUIProps {
|
|
12
12
|
rootSelector?: string;
|
|
13
13
|
storeData?: MynahUIDataModel;
|
|
14
|
-
onSearch?: ((searchPayload: SearchPayload
|
|
14
|
+
onSearch?: ((searchPayload: SearchPayload) => void) | ((searchPayload: SearchPayload) => MynahUIDataModel);
|
|
15
15
|
onShowMoreWebResultsClick?: () => void;
|
|
16
16
|
onReady?: () => void;
|
|
17
17
|
onClickSuggestionVote?: (suggestion: Suggestion, vote: RelevancyVoteType) => void;
|
|
18
|
-
onClickCodeDetails?: (code: string, fileName?: string, range?: {
|
|
19
|
-
start: {
|
|
20
|
-
row: string;
|
|
21
|
-
column?: string;
|
|
22
|
-
};
|
|
23
|
-
end?: {
|
|
24
|
-
row: string;
|
|
25
|
-
column?: string;
|
|
26
|
-
};
|
|
27
|
-
}) => void;
|
|
28
18
|
onClearChat?: () => void;
|
|
29
19
|
onStopChatResponse?: () => void;
|
|
30
20
|
onResetStore?: () => void;
|
|
31
|
-
onChangeContext?: (changeType: ContextChangeType, queryContext: ContextType) => void;
|
|
32
21
|
onChatPrompt?: (prompt: ChatPrompt) => void;
|
|
33
22
|
onFollowUpClicked?: (followUp: ChatItemFollowUp) => void;
|
|
34
23
|
onSuggestionAttachedToChatPrompt?: (attachment: Suggestion) => void;
|
|
35
24
|
onNavigationTabChange?: (selectedTab: string) => void;
|
|
36
25
|
onSideNavigationTabChange?: (selectedTab: string) => void;
|
|
37
26
|
onSuggestionEngagement?: (engagement: SuggestionEngagement) => void;
|
|
38
|
-
|
|
27
|
+
onCopyCodeToClipboard?: (code?: string, type?: 'selection' | 'block') => void;
|
|
28
|
+
onCodeInsertToCursorPosition?: (code?: string, type?: 'selection' | 'block') => void;
|
|
39
29
|
onSuggestionInteraction?: (eventName: SuggestionEventName, suggestion: Suggestion, mouseEvent?: MouseEvent) => void;
|
|
40
30
|
onSendFeedback?: (feedbackPayload: FeedbackPayload) => void;
|
|
41
|
-
onRequestHistoryRecords?: (filterPayload: SearchHistoryFilters) => void;
|
|
42
|
-
onInputQueryChange?: (input: string) => void;
|
|
43
|
-
onChangeLiveSearchState?: (liveSearchState: LiveSearchState) => void;
|
|
44
|
-
onClickAutocompleteItem?: (text: string, currSelected?: number, suggestionCount?: number) => void;
|
|
45
31
|
}
|
|
46
32
|
export declare class MynahUI {
|
|
47
33
|
private readonly props;
|
|
@@ -54,37 +40,13 @@ export declare class MynahUI {
|
|
|
54
40
|
constructor(props: MynahUIProps);
|
|
55
41
|
private readonly sideNavigationTabChanged;
|
|
56
42
|
private readonly addGlobalListeners;
|
|
57
|
-
/**
|
|
58
|
-
* Adds a new answer on the chat window
|
|
59
|
-
* @param anwer An ChatItem object.
|
|
60
|
-
*/
|
|
61
43
|
addChatAnswer: (answer: ChatItem) => void;
|
|
62
44
|
getLastChatAnswer: () => ChatItem | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Updates the body of the last ChatItemType.ANSWER_STREAM chat item
|
|
65
|
-
* @param body new body stream as string.
|
|
66
|
-
*/
|
|
67
45
|
updateLastChatAnswerStream: (body: string) => void;
|
|
68
|
-
/**
|
|
69
|
-
* Updates only the UI with the given data.
|
|
70
|
-
* @param data A full or partial set of data with values.
|
|
71
|
-
*/
|
|
72
46
|
updateStore: (data: MynahUIDataModel) => void;
|
|
73
47
|
getMode: () => MynahMode | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* Sets store defaults to use while clearing the store
|
|
76
|
-
* To clear the defaults, send `null`
|
|
77
|
-
* @param defaults partial set of MynahUIDataModel for defaults
|
|
78
|
-
*/
|
|
79
48
|
setStoreDefaults: (defaults: MynahUIDataModel | null) => void;
|
|
80
|
-
/**
|
|
81
|
-
* Returns the current search payload
|
|
82
|
-
*/
|
|
83
49
|
getSearchPayload: () => SearchPayload;
|
|
84
|
-
/**
|
|
85
|
-
* Simply creates and shows a notification
|
|
86
|
-
* @param props NotificationProps
|
|
87
|
-
*/
|
|
88
50
|
notify: (props: {
|
|
89
51
|
duration?: number;
|
|
90
52
|
type?: NotificationType;
|