@aws/mynah-ui 4.14.0 → 4.15.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/dist/static.d.ts CHANGED
@@ -103,6 +103,7 @@ export interface MynahUITabStoreModel {
103
103
  export declare enum MynahEventNames {
104
104
  RESET_STORE = "resetStore",
105
105
  FEEDBACK_SET = "feedbackSet",
106
+ ROOT_FOCUS = "rootFocusStateChange",
106
107
  CARD_VOTE = "cardVote",
107
108
  SOURCE_LINK_CLICK = "sourceLinkClick",
108
109
  INFO_LINK_CLICK = "infoLinkClick",
@@ -219,7 +220,7 @@ export interface ChatItemAction extends ChatPrompt {
219
220
  pillText: string;
220
221
  disabled?: boolean;
221
222
  description?: string;
222
- status?: 'info' | 'success' | 'warning' | 'error';
223
+ status?: 'primary' | 'info' | 'success' | 'warning' | 'error';
223
224
  icon?: MynahIcons;
224
225
  }
225
226
  export interface ChatItemButton {
@@ -229,7 +230,7 @@ export interface ChatItemButton {
229
230
  id: string;
230
231
  disabled?: boolean;
231
232
  description?: string;
232
- status?: 'info' | 'success' | 'warning' | 'error';
233
+ status?: 'primary' | 'info' | 'success' | 'warning' | 'error';
233
234
  icon?: MynahIcons;
234
235
  }
235
236
  export interface TabBarAction {
package/docs/DATAMODEL.md CHANGED
@@ -269,7 +269,7 @@ const mynahUI = new MynahUI({
269
269
  mynahUI.updateStore('tab-1', {
270
270
  contextCommands: [
271
271
  {
272
- groupName: 'Metion code',
272
+ groupName: 'Mention code',
273
273
  commands:[
274
274
  {
275
275
  command: '@ws',
@@ -2134,7 +2134,7 @@ mynahUI.notify({
2134
2134
  ---
2135
2135
 
2136
2136
  ## ChatPrompt
2137
- This is the object model which will be send along with the `onChatPrompt` event.
2137
+ This is the object model which will be sent along with the `onChatPrompt` event.
2138
2138
 
2139
2139
  ```typescript
2140
2140
  export interface ChatPrompt {
@@ -11,6 +11,7 @@ export interface MynahUIProps {
11
11
  messageId: string,
12
12
  eventId?: string) => void;
13
13
  onReady?: () => void;
14
+ onFocusStateChanged?: (focusState: boolean) => void;
14
15
  onVote?: (
15
16
  tabId: string,
16
17
  messageId: string,
@@ -58,6 +59,17 @@ export interface MynahUIProps {
58
59
  tabId: string,
59
60
  messageId: string,
60
61
  engagement: Engagement) => void;
62
+ onCodeBlockActionClicked?: (
63
+ tabId: string,
64
+ messageId: string,
65
+ actionId: string,
66
+ data?: string,
67
+ code?: string,
68
+ type?: CodeSelectionType,
69
+ referenceTrackerInformation?: ReferenceTrackerInformation[],
70
+ eventId?: string,
71
+ codeBlockIndex?: number,
72
+ totalCodeBlocks?: number,) => void;
61
73
  onCopyCodeToClipboard?: (
62
74
  tabId: string,
63
75
  messageId: string,
@@ -66,7 +78,8 @@ export interface MynahUIProps {
66
78
  referenceTrackerInformation?: ReferenceTrackerInformation[],
67
79
  eventId?: string,
68
80
  codeBlockIndex?: number,
69
- totalCodeBlocks?: number) => void;
81
+ totalCodeBlocks?: number,
82
+ data?: string,) => void;
70
83
  onCodeInsertToCursorPosition?: (
71
84
  tabId: string,
72
85
  messageId: string,
@@ -75,7 +88,8 @@ export interface MynahUIProps {
75
88
  referenceTrackerInformation?: ReferenceTrackerInformation[],
76
89
  eventId?: string,
77
90
  codeBlockIndex?: number,
78
- totalCodeBlocks?: number) => void;
91
+ totalCodeBlocks?: number,
92
+ data?: string,) => void;
79
93
  onSourceLinkClick?: (
80
94
  tabId: string,
81
95
  messageId: string,
@@ -286,6 +300,20 @@ onReady: () => {
286
300
 
287
301
  ---
288
302
 
303
+ ### `onFocusStateChanged`
304
+
305
+ This event will be fired whenever user targets to MynahUI or wents away.
306
+
307
+ ```typescript
308
+ ...
309
+ onFocusStateChanged: (focusState: boolean) => {
310
+ console.log(`MynahUI is ${focusState ? 'focused' : 'not focused'}.`);
311
+ };
312
+ ...
313
+ ```
314
+
315
+ ---
316
+
289
317
  ### `onVote`
290
318
 
291
319
  This event will be fired when end user clicks one of the thumbs up or down buttons to vote the answer. It will pass the arguments `tabId`, `messageId` and the `vote`.
@@ -554,6 +582,45 @@ onChatItemEngagement?: (
554
582
  ```
555
583
  ---
556
584
 
585
+ ### `onCodeBlockActionClicked`
586
+
587
+ This event will be fired when user clicks one of the buttons from custom added `codeBlockActions` button on the footer of a code block. It will pass `tabId`, `actionId`, `data`, `messageId`, `code` for the copied code to theclipboard as a text, `type` for the type of the code copied (block or selection) and the `referenceTrackerInformation` if the copied code block contains some code reference as the arguments. Finally after the `eventId` attribute, you can get the index of the code block inside that message with `codeBlockIndex` together with total number of code blocks again inside that message with `totalCodeBlocks`.
588
+
589
+ **Note:** even though the `referenceTrackerInformation` comes to the message with `codeReference` attribute with the index position depending on the whole content of the body of the message, the return of it as an attribute from this event gives the indexes according to position inside that code block.
590
+
591
+ _Please refer to the [data model](./DATAMODEL.md#codeblockactions) to learn more about the `codeBlockActions`._
592
+ _Please refer to the [data model](./DATAMODEL.md#codereference) to learn more about the `ReferenceTrackerInformation` object type._
593
+
594
+
595
+ <p align="center">
596
+ <img src="./img/data-model/chatItems/codeBlockActions.png" alt="onCodeBlockActionClicked" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
597
+ </p>
598
+
599
+ ```typescript
600
+ ...
601
+ onCodeBlockActionClicked: (
602
+ tabId,
603
+ messageId,
604
+ actionId,
605
+ data,
606
+ code,
607
+ type,
608
+ referenceTrackerInformation,
609
+ eventId,
610
+ codeBlockIndex,
611
+ totalCodeBlocks) => {
612
+ Log(`Code action <b>${actionId}</b> clicked on tab <b>${tabId}</b> inside message <b>${messageId}</b><br/>
613
+ type: <b>${type ?? 'unknown'}</b><br/>
614
+ data: <b>${JSON.stringify(data ?? {})}</b><br/>
615
+ code: <b>${escapeHTML(code ?? '')}</b><br/>
616
+ referenceTracker: <b>${referenceTrackerInformation?.map(rt => rt.information).join('<br/>') ?? ''}</b><br/>
617
+ codeBlockIndex: <b>${(codeBlockIndex ?? 0) + 1}</b> of ${totalCodeBlocks}
618
+ `);
619
+ },
620
+ ...
621
+ ```
622
+ ---
623
+
557
624
  ### `onCopyCodeToClipboard`
558
625
 
559
626
  This event will be fired when user clicks the copy button on the footer of a code block or selects some text inside a code block and triggers keyboard shortcuts for copying. It will pass `tabId`, `messageId`, `code` for the copied code to theclipboard as a text, `type` for the type of the code copied (block or selection) and the `referenceTrackerInformation` if the copied code block contains some code reference as the arguments. Finally after the `eventId` attribute, you can get the index of the code block inside that message with `codeBlockIndex` together with total number of code blocks again inside that message with `totalCodeBlocks`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws/mynah-ui",
3
3
  "displayName": "AWS Mynah UI",
4
- "version": "4.14.0",
4
+ "version": "4.15.0",
5
5
  "description": "AWS Toolkit VSCode and Intellij IDE Extension Mynah UI",
6
6
  "publisher": "Amazon Web Services",
7
7
  "license": "Apache License 2.0",