@aws/mynah-ui 3.2.10 → 3.3.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/.eslintrc.js CHANGED
@@ -18,6 +18,8 @@ module.exports = {
18
18
  "prettier"
19
19
  ],
20
20
  "rules": {
21
+ "no-case-declarations": "off",
22
+ "@typescript-eslint/no-floating-promises": "off",
21
23
  "@typescript-eslint/semi": [
22
24
  2,
23
25
  "always"
package/README.md CHANGED
@@ -1,216 +1,26 @@
1
- <image width="100px" src="./src/components/icon/icons/chat.svg?raw=true" />
2
-
3
1
  # Mynah UI
2
+ ### *A Data & Event Drivent Chat Interface Library for Browsers and Webviews*
4
3
 
5
- 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.
6
-
7
- ## How to install
8
-
9
- ``` console
10
- npm install @aws/mynah-ui
11
- ```
12
-
13
- ## How to use
14
- When you import `@aws/mynah-ui` it provides you the `MynahUI` class to generate a new all-in-one object to create the UI. You can connect to user interaction events through the initial properties have provide to the UI.
15
-
16
- ``` typescript
17
- import { MynahUI } from '@aws/mynah-ui';
18
-
19
- export const createMynahUI = () => {
20
- const mynahUI = new MynahUI({
21
- rootSelector?: string;
22
- defaults?: MynahUITabStoreTab;
23
- tabs?: MynahUITabStoreModel;
24
- config?: ConfigModel;
25
- onShowMoreWebResultsClick?: (tabId: string, messageId: string) => void;
26
- onReady?: () => void;
27
- onVote?: (tabId: string, messageId: string, vote: RelevancyVoteType) => void;
28
- onStopChatResponse?: (tabId: string) => void;
29
- onResetStore?: (tabId: string) => void;
30
- onChatPrompt?: (tabId: string, prompt: ChatPrompt) => void;
31
- onFollowUpClicked?: (tabId: string, messageId: string, followUp: ChatItemFollowUp) => void;
32
- onTabChange?: (tabId: string) => void;
33
- onTabAdd?: (tabId: string) => void;
34
- onTabRemove?: (tabId: string) => void;
35
- onChatItemEngagement?: (tabId: string, messageId: string, engagement: Engagement) => void;
36
- onCopyCodeToClipboard?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[]) => void;
37
- onCodeInsertToCursorPosition?: (tabId: string, messageId: string, code?: string, type?: CodeSelectionType, referenceTrackerInformation?: ReferenceTrackerInformation[]) => void;
38
- onSourceLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent) => void;
39
- onLinkClick?: (tabId: string, messageId: string, link: string, mouseEvent?: MouseEvent) => void;
40
- onSendFeedback?: (tabId: string, feedbackPayload: FeedbackPayload) => void;
41
- onOpenDiff?: (tabId: string, filePath: string, deleted: boolean, messageId?: string) => void;
42
- });
43
- }
44
- ```
45
-
46
- MynahUI also provides some accessible functions to help developer show a notification or more importantly update the UI state data store. When you update the data store, it will automatically rerender the parts that is subscribed to that particular data part.
47
-
48
- ``` typescript
49
- import { MynahUI } from '@aws/mynah-ui';
50
-
51
- export const createMynahUI = () => {
52
- let mynahUI:MynahUI;
53
- ...
54
- }
55
- ```
56
-
57
- In addition to MynahUI class, there are also some exported type definitions that can be handy for function returns or proper usage of arguments.
58
-
59
- ``` typescript
60
- import {
61
- FeedbackPayload,
62
- RelevancyVoteType,
63
- EngagementType,
64
- Engagement,
65
- MynahUIDataModel,
66
- NotificationType,
67
- ChatItem,
68
- ChatItemFollowUp,
69
- ChatItemType,
70
- ChatPrompt,
71
- SourceLink,
72
- MynahIcons
73
- } from '@aws/mynah-ui';
74
- ```
75
-
76
- ## Styles
77
-
78
- Almost all css parameters are connected to [css custom properties](https://www.w3.org/TR/css-variables-1/) to let developer easily adjust desired parameters.
79
- Provide your own styles file after the import of MynahUI.
80
- ``` typescript
81
- import { MynahUI } from '@aws/mynah-ui';
82
- import './custom-style.css';
83
- ```
84
-
85
- You can provide any of the following css custom property values:
86
- ``` css
87
- :root {
88
- --mynah-font-family: ...;
89
- font-size: ...;
90
- font-family: ...;
91
- --mynah-max-width: ...;
92
- --mynah-sizing-base: ...;
93
- --mynah-sizing-half: ...;
94
- --mynah-sizing-1: ...;
95
- --mynah-sizing-2: ...;
96
- --mynah-sizing-3: ...;
97
- --mynah-sizing-4: ...;
98
- --mynah-sizing-5: ...;
99
- --mynah-sizing-6: ...;
100
- --mynah-sizing-7: ...;
101
- --mynah-sizing-8: ...;
102
- --mynah-sizing-9: ...;
103
- --mynah-sizing-10: ...;
104
- --mynah-sizing-11: ...;
105
- --mynah-sizing-12: ...;
106
- --mynah-sizing-13: ...;
107
- --mynah-sizing-14: ...;
108
- --mynah-sizing-15: ...;
109
- --mynah-sizing-16: ...;
110
- --mynah-sizing-17: ...;
111
- --mynah-sizing-18: ...;
112
- --mynah-button-border-width: ...;
113
- --mynah-border-width: ...;
114
-
115
- --mynah-color-text-default: ...;
116
- --mynah-color-text-strong: ...;
117
- --mynah-color-text-weak: ...;
118
- --mynah-color-text-link: ...;
119
- --mynah-color-text-input: ...;
120
-
121
- --mynah-color-bg: ...;
122
- --mynah-color-bg-alt: ...;
123
- --mynah-color-tab-active: ...;
124
- --mynah-color-light: ...;
125
-
126
- --mynah-color-deep: ...;
127
- --mynah-color-deep-reverse: ...;
128
- --mynah-color-border-default: ...;
129
- --mynah-color-input-bg: ...;
130
-
131
- --mynah-color-highlight: ...;
132
- --mynah-color-highlight-text: ...;
133
-
134
- --mynah-color-context-must-contain: ...;
135
- --mynah-color-context-should-contain: ...;
136
- --mynah-color-context-must-not-contain: ...;
137
- --mynah-color-context-reverse: ...;
138
- --mynah-color-context-filter: ...;
139
-
140
- --mynah-color-syntax-bg: ...;
141
- --mynah-color-syntax-variable: ...;
142
- --mynah-color-syntax-function: ...;
143
- --mynah-color-syntax-operator: ...;
144
- --mynah-color-syntax-attr-value: ...;
145
- --mynah-color-syntax-attr: ...;
146
- --mynah-color-syntax-property: ...;
147
- --mynah-color-syntax-comment: ...;
148
- --mynah-color-syntax-code: ...;
149
- --mynah-syntax-code-font-family: ...;
150
- --mynah-syntax-code-font-size: ...;
151
-
152
- --mynah-color-status-info: ...;
153
- --mynah-color-status-success: ...;
154
- --mynah-color-status-warning: ...;
155
- --mynah-color-status-error: ...;
156
-
157
- --mynah-color-button: ...;
158
- --mynah-color-button-reverse: ...;
159
-
160
- --mynah-color-alternate: ...;
161
- --mynah-color-alternate-reverse: ...;
162
-
163
- --mynah-color-code-bg: ...;
164
- --mynah-color-code-text: ...;
165
-
166
- --mynah-color-main: ...;
167
- --mynah-color-main-reverse: ...;
168
-
169
- --mynah-card-bg: ...;
170
-
171
- --mynah-shadow-generic: ...;
172
- --mynah-shadow-card: ...;
173
- --mynah-shadow-card-more: ...;
174
- --mynah-shadow-card-active: ...;
175
- --mynah-shadow-overlay: ...;
176
- --mynah-shadow-feedback-form: ...;
177
-
178
- --mynah-font-size-xxsmall: ...;
179
- --mynah-font-size-xsmall: ...;
180
- --mynah-font-size-small: ...;
181
- --mynah-font-size-medium: ...;
182
- --mynah-font-size-large: ...;
183
- --mynah-font-size-xlarge: ...;
4
+ As you can understand from the title too, **Mynah UI** is a **_data and event_** driven chat interface for browsers and webviews on IDEs or any platform which supports latest web technologies which is also used by Amazon Q for [VSCode](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) and [JetBrains](https://plugins.jetbrains.com/plugin/11349-aws-toolkit--amazon-q-codewhisperer-and-more) comes together with AWS Toolkit extension.
184
5
 
185
- --mynah-card-radius: ...;
186
- --mynah-button-radius: ...;
6
+ Since it is not depending on any framework or a UI library, you can use it inside any web based project without a hassle. Reason behind that decision is to keep it highly configurable for theming to support various use cases. It works standalone, you just need to tell it where to render on the DOMTree.
187
7
 
188
- --mynah-bottom-panel-transition: ...;
189
- --mynah-very-short-transition: ...;
190
- --mynah-short-transition-transform: ...;
191
- --mynah-long-transition: ...;
192
- --mynah-pretty-long-transition: ...;
193
- --mynah-very-long-transition: ...;
194
- --mynah-short-transition: ...;
195
- --mynah-short-transition-rev: ...;
196
- --mynah-short-transition-rev-opacity: ...;
197
- --mynah-short-transition-reflection: ...;
198
- --mynah-short-transition-turbo: ...;
199
- --mynah-short-transition-turbo-bounce: ...;
200
- --mynah-short-transition-bounce: ...;
8
+ Please continue with one of the following guides:
201
9
 
202
- --mynah-mask-image: ...;
203
- --mynah-mask-image-rev: ...;
204
- --mynah-mask-image-main: ...;
205
- --mynah-mask-image-main-rev: ...;
206
- --mynah-mask-image-skeleton: ...;
10
+ ## How to setup, configure and use Mynah UI
11
+ ### [Startup Guide](./docs/STARTUP.md)
12
+ ### [Constructor Properties](./docs/PROPERTIES.md)
13
+ ### [Configuration](./docs/CONFIG.md)
14
+ ### [How to use MynahUI](./docs/USAGE.md)
15
+ ### [Data Model](./docs/DATAMODEL.md)
16
+ ### [Styling Configuration](./docs/STYLING.md)
207
17
 
208
- --mynah-policy-group-filter: ...;
209
- }
210
- ```
18
+ <p align="center">
19
+ <img src="./docs/img/splash.gif" alt="MynahUI" style="max-width:1024px; width:100%;border: 1px solid #e0e0e0;">
20
+ </p>
211
21
 
212
22
  ## Supported browsers
213
- **MynahUI** <em>-because of it's css structure-</em> only supports ever-green browsers including webkit-base WebUI renderers.
23
+ **Mynah UI** <em>-because of it's extensive css structure-</em> only supports ever-green browsers including webkit based WebUI renderers.
214
24
 
215
25
 
216
26
  ## Security
@@ -25,3 +25,70 @@ THE SOFTWARE.
25
25
 
26
26
  ------
27
27
 
28
+ ** marked; version 7.0.3 -- https://github.com/markedjs/marked/
29
+
30
+ MIT LICENSE
31
+
32
+ Copyright (c) 2011-2022 Christopher Jeffrey.
33
+
34
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
35
+
36
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
+
40
+ ------
41
+
42
+ ** escape-html; version 1.0.3 -- https://github.com/component/escape-html/
43
+
44
+ MIT License
45
+
46
+ Copyright (c) 2012-2013 TJ Holowaychuk
47
+ Copyright (c) 2015 Andreas Lubbe
48
+ Copyright (c) 2015 Tiancheng "Timothy" Gu
49
+
50
+ Permission is hereby granted, free of charge, to any person obtaining
51
+ a copy of this software and associated documentation files (the
52
+ 'Software'), to deal in the Software without restriction, including
53
+ without limitation the rights to use, copy, modify, merge, publish,
54
+ distribute, sublicense, and/or sell copies of the Software, and to
55
+ permit persons to whom the Software is furnished to do so, subject to
56
+ the following conditions:
57
+
58
+ The above copyright notice and this permission notice shall be
59
+ included in all copies or substantial portions of the Software.
60
+
61
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
62
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
63
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
64
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
65
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
66
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
67
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
68
+
69
+ ------
70
+
71
+ ** unescape-html; version 1.1.0 -- https://github.com/ForbesLindesay/
72
+
73
+ MIT LICENSE
74
+
75
+ Copyright (c) 2013 Forbes Lindesay
76
+
77
+ Permission is hereby granted, free of charge, to any person obtaining a copy
78
+ of this software and associated documentation files (the "Software"), to deal
79
+ in the Software without restriction, including without limitation the rights
80
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
81
+ copies of the Software, and to permit persons to whom the Software is
82
+ furnished to do so, subject to the following conditions:
83
+
84
+ The above copyright notice and this permission notice shall be included in
85
+ all copies or substantial portions of the Software.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
90
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
91
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
92
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
93
+ THE SOFTWARE.
94
+
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -15,6 +15,7 @@ export declare class MynahUIDataStore {
15
15
  constructor(tabId: string, initialData?: MynahUIDataModel);
16
16
  setDefaults: (defaults: MynahUIDataModel | null) => void;
17
17
  getDefaults: () => MynahUIDataModel | null;
18
+ getStore: () => MynahUIDataModel | null;
18
19
  subscribe: (storeKey: keyof MynahUIDataModel, handler: (newValue: any, oldValue?: any) => void) => string;
19
20
  unsubscribe: (storeKey: keyof MynahUIDataModel, subscriptionId: string) => void;
20
21
  getValue: (storeKey: keyof MynahUIDataModel) => any;
package/dist/main.d.ts CHANGED
@@ -44,6 +44,8 @@ export declare class MynahUI {
44
44
  addChatItem: (tabId: string, chatItem: ChatItem) => void;
45
45
  updateLastChatAnswer: (tabId: string, updateWith: Partial<ChatItem>) => void;
46
46
  updateStore: (tabId: string | '', data: MynahUIDataModel) => string | undefined;
47
+ getSelectedTabId: () => string | undefined;
48
+ getAllTabs: () => MynahUITabStoreModel;
47
49
  notify: (props: {
48
50
  duration?: number;
49
51
  type?: NotificationType;