@aws/mynah-ui 4.23.0-beta.8 → 4.23.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
@@ -247,7 +247,9 @@ export interface ChatItemContent {
247
247
  rootFolderTitle?: string;
248
248
  filePaths?: string[];
249
249
  deletedFiles?: string[];
250
- collapsedByDefault?: boolean;
250
+ flatList?: boolean;
251
+ folderIcon?: MynahIcons | MynahIconsType | null;
252
+ collapsed?: boolean;
251
253
  hideFileCount?: boolean;
252
254
  actions?: Record<string, FileNodeAction[]>;
253
255
  details?: Record<string, TreeNodeDetails>;
@@ -304,21 +306,14 @@ export type TextBasedFormItem = BaseFormItem & {
304
306
  patterns: ValidationPattern[];
305
307
  };
306
308
  };
307
- type SelectFormItem = BaseFormItem & {
308
- type: 'select';
309
- options: Array<{
310
- value: string;
311
- label: string;
312
- }>;
313
- };
314
309
  type OtherFormItem = BaseFormItem & {
315
- type: 'stars' | 'radiogroup';
310
+ type: 'select' | 'stars' | 'radiogroup';
316
311
  options?: Array<{
317
312
  value: string;
318
313
  label: string;
319
314
  }>;
320
315
  };
321
- export type ChatItemFormItem = TextBasedFormItem | SelectFormItem | OtherFormItem;
316
+ export type ChatItemFormItem = TextBasedFormItem | OtherFormItem;
322
317
  export interface ChatPrompt {
323
318
  prompt?: string;
324
319
  escapedPrompt?: string;
package/docs/DATAMODEL.md CHANGED
@@ -312,32 +312,127 @@ const mynahUI = new MynahUI({
312
312
  });
313
313
 
314
314
  mynahUI.updateStore('tab-1', {
315
- contextCommands: [
315
+ contextCommands: [
316
316
  {
317
- groupName: 'Mention code',
318
- commands:[
317
+ commands: [
319
318
  {
320
- command: '@ws',
321
- description: '(BETA) Reference all code in workspace.'
319
+ command: 'workspace',
320
+ icon: MynahIcons.ASTERISK,
321
+ placeholder: 'Yes, you selected workspace :P',
322
+ description: 'Reference all code in workspace.'
322
323
  },
323
324
  {
324
- command: '@folder',
325
- placeholder: 'mention a specific folder',
325
+ command: 'folder',
326
+ icon: MynahIcons.FOLDER,
327
+ children: [
328
+ {
329
+ groupName: 'Folders',
330
+ commands: [
331
+ {
332
+ command: 'src',
333
+ icon: MynahIcons.FOLDER,
334
+ children: [
335
+ {
336
+ groupName: 'src/',
337
+ commands: [
338
+ {
339
+ command: 'index.ts',
340
+ icon: MynahIcons.FILE,
341
+ }
342
+ ]
343
+ }
344
+ ]
345
+ },
346
+ {
347
+ command: 'main',
348
+ description: './src/',
349
+ icon: MynahIcons.FOLDER,
350
+ },
351
+ {
352
+ command: 'src',
353
+ description: './example/',
354
+ icon: MynahIcons.FOLDER,
355
+ }
356
+ ]
357
+ }
358
+ ],
359
+ placeholder: 'Mention a specific folder',
326
360
  description: 'All files within a specific folder'
327
361
  },
328
362
  {
329
- command: '@file',
330
- placeholder: 'mention a specific file',
363
+ command: 'file',
364
+ icon: MynahIcons.FILE,
365
+ children: [
366
+ {
367
+ groupName: 'Files',
368
+ commands: [
369
+ {
370
+ command: 'monarch.ts',
371
+ description: './src/',
372
+ icon: MynahIcons.FILE,
373
+ },
374
+ {
375
+ command: '_dark.scss',
376
+ description: './src/styles/',
377
+ icon: MynahIcons.FILE,
378
+ }
379
+ ]
380
+ }
381
+ ],
382
+ placeholder: 'Mention a specific file',
331
383
  description: 'Reference a specific file'
332
384
  },
333
385
  {
334
- command: '@code',
335
- placeholder: 'mention a specific file/folder, or leave blank for full project',
386
+ command: 'symbols',
387
+ icon: MynahIcons.CODE_BLOCK,
388
+ children: [
389
+ {
390
+ groupName: 'Symbols',
391
+ commands: [
392
+ {
393
+ command: 'DomBuilder',
394
+ icon: MynahIcons.CODE_BLOCK,
395
+ description: 'The DomGeneration function in dom.ts file'
396
+ }
397
+ ]
398
+ }
399
+ ],
400
+ placeholder: 'Select a symbol',
336
401
  description: 'After that mention a specific file/folder, or leave blank for full project'
337
402
  },
338
403
  {
339
- command: '@gitlab',
340
- description: 'Ask about data in gitlab account'
404
+ command: 'prompts',
405
+ icon: MynahIcons.CHAT,
406
+ description: 'Saved prompts, to reuse them in your current prompt',
407
+ children: [
408
+ {
409
+ groupName: 'Prompts',
410
+ actions: [
411
+ {
412
+ id: 'add-new-prompt',
413
+ icon: 'plus',
414
+ text: 'Add',
415
+ description: 'Add new prompt'
416
+ }
417
+ ],
418
+ commands: [
419
+ {
420
+ command: 'python_expert',
421
+ icon: MynahIcons.CHAT,
422
+ description: 'Expert on python stuff'
423
+ },
424
+ {
425
+ command: 'javascript_expert',
426
+ icon: MynahIcons.CHAT,
427
+ description: 'Expert on Javascript and typescript'
428
+ },
429
+ {
430
+ command: 'Add Prompt',
431
+ icon: MynahIcons.PLUS,
432
+ }
433
+ ]
434
+ }
435
+ ]
341
436
  }
342
437
  ]
343
438
  }
@@ -349,7 +444,25 @@ mynahUI.updateStore('tab-1', {
349
444
  <img src="./img/data-model/tabStore/contextCommands.png" alt="contextCommands" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
350
445
  </p>
351
446
 
352
- To see which context is used, check the incoming array in the prompt object comes with the `onChatPrompt` event.
447
+ When hovered, context items will display a tooltip with the same information provided in the context menu list:
448
+
449
+ <p align="center">
450
+ <img src="./img/data-model/tabStore/contextItem.png" alt="contextItem" style="max-width:140px; width:100%;border: 1px solid #e0e0e0;">
451
+ </p>
452
+
453
+ Groups can have as many children as you'd like, which allows for a tree-like structure. Items with children will display a right-arrow icon when hovered / focused:
454
+
455
+ <p align="center">
456
+ <img src="./img/data-model/tabStore/hoveredContextItem.png" alt="hoveredContextItem" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
457
+ </p>
458
+
459
+ Groups can have actions (see `add-new-prompt` action in the example code block above), which adds an action button on the top right:
460
+
461
+ <p align="center">
462
+ <img src="./img/data-model/tabStore/groupAction.png" alt="groupAction" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
463
+ </p>
464
+
465
+ To see which context is used, check the incoming string array in the prompt object comes with the `onChatPrompt` event.
353
466
 
354
467
  ```typescript
355
468
  const mynahUI = new MynahUI({
@@ -885,7 +998,9 @@ interface ChatItemContent {
885
998
  rootFolderTitle?: string;
886
999
  filePaths?: string[];
887
1000
  deletedFiles?: string[];
888
- collapsedByDefault?: boolean;
1001
+ flatList?: boolean;
1002
+ folderIcon?: MynahIcons | MynahIconsType | null;
1003
+ collapsed?: boolean;
889
1004
  hideFileCount?: boolean;
890
1005
  actions?: Record<string, FileNodeAction[]>;
891
1006
  details?: Record<string, TreeNodeDetails>;
@@ -1772,8 +1887,10 @@ mynahUI.addChatItem(tabId, {
1772
1887
  deletedFiles: ['src/devfile.yaml'],
1773
1888
  // fileTreeTitle: "Custom file tree card title";
1774
1889
  // rootFolderTitle: "Custom root folder title";
1775
- // collapsedByDefault: true // Collapse the root folder by default
1890
+ // collapsed: true // Collapse the root folder by default
1776
1891
  // hideFileCount: true // Hide the file counter next to folders
1892
+ // flatList: true // Enable to generate a flat list with one parent folder and no sub folders
1893
+ // folderIcon: 'folder' // Specify a custom icon for folders
1777
1894
  actions: {
1778
1895
  'src/App.tsx': [
1779
1896
  {
@@ -1818,6 +1935,8 @@ mynahUI.addChatItem(tabId, {
1818
1935
 
1819
1936
  **NOTE 3:** In case you want to show one single file (or folder by giving it a folder icon) and not make it clickable, use the `details` section with the file name and set the `clickable` to `false`.
1820
1937
 
1938
+ **NOTE 4:** In case you want a flat list, where all subfolders are not rendered but just all the files, you can pass `true` to the `flatList` prop.
1939
+
1821
1940
  <p align="center">
1822
1941
  <img src="./img/data-model/chatItems/codeResult.png" alt="mainTitle" style="max-width:500px; width:100%;border: 1px solid #e0e0e0;">
1823
1942
  </p>
@@ -2077,6 +2196,11 @@ interface ChatItemFormItem {
2077
2196
  mandatory?: boolean; // If it is set to true, buttons in the same card with waitMandatoryFormItems set to true will wait them to be filled
2078
2197
  title?: string; // Label of the input
2079
2198
  description?: string; // The description, showing under the input field itself
2199
+ validationPatterns?: {
2200
+ operator?: 'and' | 'or';
2201
+ genericValidationErrorMessage?: string;
2202
+ patterns: ValidationPattern[];
2203
+ };
2080
2204
  placeholder?: string; // Placeholder for input, but only applicable to textarea, textinput and numericinput
2081
2205
  value?: string; // Initial value of the item. All types of form items will get and return string values, conversion of the value type is up to you
2082
2206
  checkModifierEnterKeyPress?: boolean; // Only applicable to textual inputs: whether the onFormModifierEnterPress event can be triggered from this input field
@@ -2089,6 +2213,8 @@ interface ChatItemFormItem {
2089
2213
 
2090
2214
  Since you can give unlimited form items with several different types, it might be good to know that some attributes are only applicable to some types. Like `options` attribute is only getting used by `select` and `radiogroup` items. Or `placeholder` is only getting used by `textarea`, `textinput` and `numericinput`.
2091
2215
 
2216
+ `validationPattenrs` works only for textual inputs. You can define one or more validation regex patterns, use an operator between them as `AND` or `OR`. You can show individual error messages for each validation or use one generic message if the combined validation fails (Might be useful for `OR` operator).
2217
+
2092
2218
  **Another thing which might be interesting** is to know that if you set the `select` or the `radiogroup` mandatory, they'll be rendered as the first item's of them selected if you don't provide an initial value. And you cannot deselet a radio item in any case. For select, if it is mandatory there won't be the option `Please select...`
2093
2219
 
2094
2220
 
@@ -528,7 +528,7 @@ This event will be fired whenever a user selects an item from the context (`@`)
528
528
  ```typescript
529
529
  ...
530
530
  onContextSelected(contextItem: QuickActionCommand) {
531
- if (contextItem.command === 'add_prompt') {
531
+ if (contextItem.command === 'Add Prompt') {
532
532
  Log('Custom context action triggered for adding a prompt!')
533
533
  return false;
534
534
  }
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.23.0-beta.8",
4
+ "version": "4.23.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",
@@ -0,0 +1,9 @@
1
+ <html theme="base-light">
2
+ <head>
3
+ <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1" />
4
+ <script defer src="main.js"></script></head>
5
+
6
+ <body>
7
+ <div id="mynah-ui-wrapper"></div>
8
+ </body>
9
+ </html>