@aws/mynah-ui 4.23.0-beta.9 → 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
@@ -248,6 +248,7 @@ export interface ChatItemContent {
248
248
  filePaths?: string[];
249
249
  deletedFiles?: string[];
250
250
  flatList?: boolean;
251
+ folderIcon?: MynahIcons | MynahIconsType | null;
251
252
  collapsed?: boolean;
252
253
  hideFileCount?: boolean;
253
254
  actions?: Record<string, FileNodeAction[]>;
@@ -305,21 +306,14 @@ export type TextBasedFormItem = BaseFormItem & {
305
306
  patterns: ValidationPattern[];
306
307
  };
307
308
  };
308
- type SelectFormItem = BaseFormItem & {
309
- type: 'select';
310
- options: Array<{
311
- value: string;
312
- label: string;
313
- }>;
314
- };
315
309
  type OtherFormItem = BaseFormItem & {
316
- type: 'stars' | 'radiogroup';
310
+ type: 'select' | 'stars' | 'radiogroup';
317
311
  options?: Array<{
318
312
  value: string;
319
313
  label: string;
320
314
  }>;
321
315
  };
322
- export type ChatItemFormItem = TextBasedFormItem | SelectFormItem | OtherFormItem;
316
+ export type ChatItemFormItem = TextBasedFormItem | OtherFormItem;
323
317
  export interface ChatPrompt {
324
318
  prompt?: string;
325
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({
@@ -886,6 +999,7 @@ interface ChatItemContent {
886
999
  filePaths?: string[];
887
1000
  deletedFiles?: string[];
888
1001
  flatList?: boolean;
1002
+ folderIcon?: MynahIcons | MynahIconsType | null;
889
1003
  collapsed?: boolean;
890
1004
  hideFileCount?: boolean;
891
1005
  actions?: Record<string, FileNodeAction[]>;
@@ -1776,6 +1890,7 @@ mynahUI.addChatItem(tabId, {
1776
1890
  // collapsed: true // Collapse the root folder by default
1777
1891
  // hideFileCount: true // Hide the file counter next to folders
1778
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
1779
1894
  actions: {
1780
1895
  'src/App.tsx': [
1781
1896
  {
@@ -2081,6 +2196,11 @@ interface ChatItemFormItem {
2081
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
2082
2197
  title?: string; // Label of the input
2083
2198
  description?: string; // The description, showing under the input field itself
2199
+ validationPatterns?: {
2200
+ operator?: 'and' | 'or';
2201
+ genericValidationErrorMessage?: string;
2202
+ patterns: ValidationPattern[];
2203
+ };
2084
2204
  placeholder?: string; // Placeholder for input, but only applicable to textarea, textinput and numericinput
2085
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
2086
2206
  checkModifierEnterKeyPress?: boolean; // Only applicable to textual inputs: whether the onFormModifierEnterPress event can be triggered from this input field
@@ -2093,6 +2213,8 @@ interface ChatItemFormItem {
2093
2213
 
2094
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`.
2095
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
+
2096
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...`
2097
2219
 
2098
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.9",
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>