@progress/kendo-angular-conversational-ui 14.4.0-develop.9 → 15.0.0-develop.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.
Files changed (99) hide show
  1. package/NOTICE.txt +146 -593
  2. package/ai-prompt/aiprompt.component.d.ts +120 -0
  3. package/ai-prompt/aiprompt.module.d.ts +25 -0
  4. package/ai-prompt/common/aiprompt.service.d.ts +26 -0
  5. package/ai-prompt/common/output-card.component.d.ts +36 -0
  6. package/ai-prompt/common/toolbar-focusable.directive.d.ts +24 -0
  7. package/ai-prompt/common/toolbar-navigation.service.d.ts +24 -0
  8. package/ai-prompt/localization/custom-messages.component.d.ts +17 -0
  9. package/ai-prompt/localization/localized-messages.directive.d.ts +16 -0
  10. package/ai-prompt/localization/messages.d.ts +49 -0
  11. package/ai-prompt/models/command-execute-event.d.ts +23 -0
  12. package/ai-prompt/models/command.interface.d.ts +30 -0
  13. package/ai-prompt/models/index.d.ts +10 -0
  14. package/ai-prompt/models/output-rating-change-event.d.ts +18 -0
  15. package/ai-prompt/models/prompt-output.interface.d.ts +41 -0
  16. package/ai-prompt/models/prompt-request-event.d.ts +22 -0
  17. package/ai-prompt/models/view-type.d.ts +8 -0
  18. package/ai-prompt/templates/toolbar-actions.template.d.ts +18 -0
  19. package/ai-prompt/utils.d.ts +19 -0
  20. package/ai-prompt/views/base-view.d.ts +46 -0
  21. package/ai-prompt/views/command-view.component.d.ts +23 -0
  22. package/ai-prompt/views/custom-view.component.d.ts +20 -0
  23. package/ai-prompt/views/index.d.ts +8 -0
  24. package/ai-prompt/views/output-view.component.d.ts +22 -0
  25. package/ai-prompt/views/prompt-view.component.d.ts +47 -0
  26. package/{api → chat/api}/execute-action-event.d.ts +1 -1
  27. package/chat/attachment.component.d.ts +1 -1
  28. package/chat/builtin-actions.d.ts +1 -1
  29. package/chat/chat-view.d.ts +1 -1
  30. package/chat/chat.component.d.ts +2 -2
  31. package/chat/chat.module.d.ts +3 -3
  32. package/chat/message-attachments.component.d.ts +1 -1
  33. package/chat/message-box.component.d.ts +2 -2
  34. package/chat/message-list.component.d.ts +1 -1
  35. package/chat/message.component.d.ts +1 -1
  36. package/chat/suggested-actions.component.d.ts +1 -1
  37. package/conversational-ui.module.d.ts +43 -0
  38. package/esm2020/ai-prompt/aiprompt.component.mjs +348 -0
  39. package/esm2020/ai-prompt/aiprompt.module.mjs +79 -0
  40. package/esm2020/ai-prompt/common/aiprompt.service.mjs +38 -0
  41. package/esm2020/ai-prompt/common/output-card.component.mjs +199 -0
  42. package/esm2020/ai-prompt/common/toolbar-focusable.directive.mjs +67 -0
  43. package/esm2020/ai-prompt/common/toolbar-navigation.service.mjs +55 -0
  44. package/esm2020/ai-prompt/localization/custom-messages.component.mjs +41 -0
  45. package/esm2020/ai-prompt/localization/localized-messages.directive.mjs +37 -0
  46. package/esm2020/ai-prompt/localization/messages.mjs +35 -0
  47. package/esm2020/ai-prompt/models/prompt-output.interface.mjs +5 -0
  48. package/esm2020/ai-prompt/models/prompt-request-event.mjs +5 -0
  49. package/esm2020/ai-prompt/models/view-type.mjs +5 -0
  50. package/esm2020/ai-prompt/templates/toolbar-actions.template.mjs +27 -0
  51. package/esm2020/ai-prompt/utils.mjs +26 -0
  52. package/esm2020/ai-prompt/views/base-view.mjs +89 -0
  53. package/esm2020/ai-prompt/views/command-view.component.mjs +82 -0
  54. package/esm2020/ai-prompt/views/custom-view.component.mjs +35 -0
  55. package/esm2020/ai-prompt/views/index.mjs +8 -0
  56. package/esm2020/ai-prompt/views/output-view.component.mjs +66 -0
  57. package/esm2020/ai-prompt/views/prompt-view.component.mjs +146 -0
  58. package/esm2020/chat/api/attachment.interface.mjs +5 -0
  59. package/esm2020/chat/api/message.interface.mjs +5 -0
  60. package/esm2020/chat/api/user.interface.mjs +5 -0
  61. package/esm2020/chat/builtin-actions.mjs +1 -1
  62. package/esm2020/chat/chat.component.mjs +1 -1
  63. package/esm2020/chat/chat.module.mjs +3 -3
  64. package/esm2020/chat/common/models/message-box-options.mjs +5 -0
  65. package/esm2020/chat/message-box.component.mjs +2 -2
  66. package/esm2020/chat/message-list.component.mjs +2 -2
  67. package/esm2020/conversational-ui.module.mjs +50 -0
  68. package/esm2020/index.mjs +10 -2
  69. package/esm2020/package-metadata.mjs +2 -2
  70. package/fesm2015/progress-kendo-angular-conversational-ui.mjs +1411 -149
  71. package/fesm2020/progress-kendo-angular-conversational-ui.mjs +1299 -43
  72. package/index.d.ts +11 -3
  73. package/package.json +10 -7
  74. package/schematics/ngAdd/index.js +4 -2
  75. /package/{api → chat/api}/action.interface.d.ts +0 -0
  76. /package/{api → chat/api}/attachment.interface.d.ts +0 -0
  77. /package/{api → chat/api}/index.d.ts +0 -0
  78. /package/{api → chat/api}/message.interface.d.ts +0 -0
  79. /package/{api → chat/api}/post-message-event.d.ts +0 -0
  80. /package/{api → chat/api}/preventable-event.d.ts +0 -0
  81. /package/{api → chat/api}/user.interface.d.ts +0 -0
  82. /package/{cards → chat/cards}/hero-card.component.d.ts +0 -0
  83. /package/{common → chat/common}/focused-state.directive.d.ts +0 -0
  84. /package/{common → chat/common}/models/message-box-options.d.ts +0 -0
  85. /package/{common → chat/common}/scroll-anchor.directive.d.ts +0 -0
  86. /package/{common → chat/common}/utils.d.ts +0 -0
  87. /package/esm2020/{api/attachment.interface.mjs → ai-prompt/models/command-execute-event.mjs} +0 -0
  88. /package/esm2020/{api/message.interface.mjs → ai-prompt/models/command.interface.mjs} +0 -0
  89. /package/esm2020/{api/user.interface.mjs → ai-prompt/models/index.mjs} +0 -0
  90. /package/esm2020/{common/models/message-box-options.mjs → ai-prompt/models/output-rating-change-event.mjs} +0 -0
  91. /package/esm2020/{api → chat/api}/action.interface.mjs +0 -0
  92. /package/esm2020/{api → chat/api}/execute-action-event.mjs +0 -0
  93. /package/esm2020/{api → chat/api}/index.mjs +0 -0
  94. /package/esm2020/{api → chat/api}/post-message-event.mjs +0 -0
  95. /package/esm2020/{api → chat/api}/preventable-event.mjs +0 -0
  96. /package/esm2020/{cards → chat/cards}/hero-card.component.mjs +0 -0
  97. /package/esm2020/{common → chat/common}/focused-state.directive.mjs +0 -0
  98. /package/esm2020/{common → chat/common}/scroll-anchor.directive.mjs +0 -0
  99. /package/esm2020/{common → chat/common}/utils.mjs +0 -0
@@ -0,0 +1,79 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { NgModule } from "@angular/core";
6
+ import { CommonModule } from "@angular/common";
7
+ import { IconsModule } from '@progress/kendo-angular-icons';
8
+ import { ButtonsModule } from "@progress/kendo-angular-buttons";
9
+ import { InputsModule } from '@progress/kendo-angular-inputs';
10
+ import { LayoutModule } from '@progress/kendo-angular-layout';
11
+ import { PromptViewComponent } from "./views/prompt-view.component";
12
+ import { OutputViewComponent } from "./views/output-view.component";
13
+ import { AIPromptComponent } from "./aiprompt.component";
14
+ import { CommandViewComponent } from "./views/command-view.component";
15
+ import { LocalizedMessagesDirective } from "./localization/localized-messages.directive";
16
+ import { AIPromptCustomMessagesComponent } from "./localization/custom-messages.component";
17
+ import { AIPromptOutputCardComponent } from './common/output-card.component';
18
+ import { CustomViewComponent } from './views/custom-view.component';
19
+ import { AIPromptToolbarActionsDirective } from './templates/toolbar-actions.template';
20
+ import { AIPromptToolbarFocusableDirective } from './common/toolbar-focusable.directive';
21
+ import * as i0 from "@angular/core";
22
+ const PUBLIC_DIRECTIVES = [
23
+ AIPromptComponent,
24
+ PromptViewComponent,
25
+ OutputViewComponent,
26
+ CommandViewComponent,
27
+ CustomViewComponent,
28
+ AIPromptCustomMessagesComponent,
29
+ AIPromptToolbarActionsDirective,
30
+ AIPromptToolbarFocusableDirective
31
+ ];
32
+ const PRIVATE_DIRECTIVES = [
33
+ LocalizedMessagesDirective,
34
+ AIPromptOutputCardComponent
35
+ ];
36
+ export class AIPromptModule {
37
+ }
38
+ AIPromptModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
39
+ AIPromptModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, declarations: [AIPromptComponent,
40
+ PromptViewComponent,
41
+ OutputViewComponent,
42
+ CommandViewComponent,
43
+ CustomViewComponent,
44
+ AIPromptCustomMessagesComponent,
45
+ AIPromptToolbarActionsDirective,
46
+ AIPromptToolbarFocusableDirective, LocalizedMessagesDirective,
47
+ AIPromptOutputCardComponent], imports: [CommonModule,
48
+ ButtonsModule,
49
+ IconsModule,
50
+ InputsModule,
51
+ LayoutModule], exports: [AIPromptComponent,
52
+ PromptViewComponent,
53
+ OutputViewComponent,
54
+ CommandViewComponent,
55
+ CustomViewComponent,
56
+ AIPromptCustomMessagesComponent,
57
+ AIPromptToolbarActionsDirective,
58
+ AIPromptToolbarFocusableDirective] });
59
+ AIPromptModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, imports: [[
60
+ CommonModule,
61
+ ButtonsModule,
62
+ IconsModule,
63
+ InputsModule,
64
+ LayoutModule
65
+ ]] });
66
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptModule, decorators: [{
67
+ type: NgModule,
68
+ args: [{
69
+ declarations: [...PUBLIC_DIRECTIVES, ...PRIVATE_DIRECTIVES],
70
+ exports: [...PUBLIC_DIRECTIVES],
71
+ imports: [
72
+ CommonModule,
73
+ ButtonsModule,
74
+ IconsModule,
75
+ InputsModule,
76
+ LayoutModule
77
+ ]
78
+ }]
79
+ }] });
@@ -0,0 +1,38 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Injectable } from '@angular/core';
6
+ import { Subject } from 'rxjs';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * @hidden
10
+ */
11
+ export class AIPromptService {
12
+ constructor() {
13
+ this.promptValue = '';
14
+ this.showOutputRating = false;
15
+ this.requestEvent = new Subject();
16
+ this.executeEvent = new Subject();
17
+ this.outputCopyEvent = new Subject();
18
+ this.outputRatingChangeEvent = new Subject();
19
+ }
20
+ getFlattenPromptCommands(commands = this.promptCommands) {
21
+ let newArr = [];
22
+ commands.forEach(c => {
23
+ if (c.hasOwnProperty('children')) {
24
+ const childrenArr = c.children;
25
+ newArr = newArr.concat(childrenArr);
26
+ if (childrenArr.length > 0) {
27
+ this.getFlattenPromptCommands(childrenArr);
28
+ }
29
+ }
30
+ });
31
+ return newArr.concat(this.promptCommands);
32
+ }
33
+ }
34
+ AIPromptService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
35
+ AIPromptService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptService });
36
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptService, decorators: [{
37
+ type: Injectable
38
+ }] });
@@ -0,0 +1,199 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, HostBinding, Input } from '@angular/core';
6
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
+ import { guid, isPresent } from '@progress/kendo-angular-common';
8
+ import { arrowRotateCwIcon, copyIcon, thumbDownIcon, thumbDownOutlineIcon, thumbUpIcon, thumbUpOutlineIcon } from '@progress/kendo-svg-icons';
9
+ import { AIPromptService } from './aiprompt.service';
10
+ import * as i0 from "@angular/core";
11
+ import * as i1 from "@progress/kendo-angular-l10n";
12
+ import * as i2 from "./aiprompt.service";
13
+ import * as i3 from "@progress/kendo-angular-buttons";
14
+ import * as i4 from "@angular/common";
15
+ /**
16
+ * @hidden
17
+ */
18
+ export class AIPromptOutputCardComponent {
19
+ constructor(localization, service) {
20
+ this.localization = localization;
21
+ this.service = service;
22
+ this.hostClass = true;
23
+ this.listItemRole = 'listitem';
24
+ this.tabIndex = 0;
25
+ this.ariaKeyShortcuts = 'Enter';
26
+ this.copyIcon = copyIcon;
27
+ this.retryIcon = arrowRotateCwIcon;
28
+ this.positiveRatingIcon = thumbUpOutlineIcon;
29
+ this.negativeRatingIcon = thumbDownOutlineIcon;
30
+ this.titleId = `k-output-card-${guid()}`;
31
+ }
32
+ get ariaDescribedBy() {
33
+ return this.titleId;
34
+ }
35
+ messageFor(text) {
36
+ return this.localization.get(text);
37
+ }
38
+ get showRating() {
39
+ return this.service.showOutputRating;
40
+ }
41
+ get outputTitle() {
42
+ if (isPresent(this.promptOutput.title)) {
43
+ return this.promptOutput.title;
44
+ }
45
+ else {
46
+ const titleMessage = this.promptOutput.isRetry ? 'outputRetryTitle' : 'outputTitle';
47
+ return this.messageFor(titleMessage);
48
+ }
49
+ }
50
+ handleRetry() {
51
+ if (this.promptOutput.commandId) {
52
+ const eventArgs = {
53
+ command: this.service.getFlattenPromptCommands().find(c => c.id === this.promptOutput.commandId),
54
+ sender: this.service.aiPrompt,
55
+ isRetry: true
56
+ };
57
+ this.service.executeEvent.next(eventArgs);
58
+ }
59
+ else {
60
+ const eventArgs = {
61
+ prompt: this.promptOutput.prompt,
62
+ sender: this.service.aiPrompt,
63
+ isRetry: true
64
+ };
65
+ this.service.requestEvent.next(eventArgs);
66
+ }
67
+ }
68
+ handleCopy() {
69
+ navigator.clipboard.writeText(this.promptOutput.output);
70
+ this.service.outputCopyEvent.next(this.promptOutput);
71
+ }
72
+ handleRating(ratingType) {
73
+ const eventArgs = {
74
+ promptOutput: this.promptOutput,
75
+ rating: ratingType
76
+ };
77
+ this.service.outputRatingChangeEvent.next(eventArgs);
78
+ if (ratingType === 'positive') {
79
+ this.positiveRatingIcon = thumbUpIcon;
80
+ this.negativeRatingIcon = thumbDownOutlineIcon;
81
+ }
82
+ else {
83
+ this.negativeRatingIcon = thumbDownIcon;
84
+ this.positiveRatingIcon = thumbUpOutlineIcon;
85
+ }
86
+ }
87
+ }
88
+ AIPromptOutputCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptOutputCardComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
89
+ AIPromptOutputCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: { promptOutput: "promptOutput" }, host: { properties: { "class.k-card": "this.hostClass", "attr.role": "this.listItemRole", "attr.tabindex": "this.tabIndex", "attr.aria-describedby": "this.ariaDescribedBy", "attr.aria-keyshortcuts": "this.ariaKeyShortcuts" } }, ngImport: i0, template: `
90
+ <div class="k-card-header">
91
+ <div
92
+ class="k-card-title"
93
+ [attr.id]="titleId">{{outputTitle}}
94
+ </div>
95
+ <div class="k-card-subtitle">{{promptOutput.prompt}}</div>
96
+ </div>
97
+ <div class="k-card-body">
98
+ <p>{{promptOutput.output}}</p>
99
+ </div>
100
+ <div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
101
+ <button kendoButton
102
+ fillMode="flat"
103
+ themeColor="primary"
104
+ rounded="full"
105
+ icon="copy"
106
+ [svgIcon]="copyIcon"
107
+ (click)="handleCopy()"
108
+ >{{messageFor('copyOutput')}}</button>
109
+ <button kendoButton
110
+ fillMode="flat"
111
+ rounded="full"
112
+ icon="arrow-rotate-cw"
113
+ [svgIcon]="retryIcon"
114
+ (click)="handleRetry()"
115
+ >{{messageFor('retryGeneration')}}</button>
116
+ <ng-container *ngIf="showRating">
117
+ <span class="k-spacer"></span>
118
+ <button kendoButton
119
+ fillMode="flat"
120
+ icon="thumb-up-outline"
121
+ [svgIcon]="positiveRatingIcon"
122
+ (click)="handleRating('positive')">
123
+ </button>
124
+ <button kendoButton
125
+ fillMode="flat"
126
+ icon="thumb-down-outline"
127
+ [svgIcon]="negativeRatingIcon"
128
+ (click)="handleRating('negative')">
129
+ </button>
130
+ </ng-container>
131
+ </div>
132
+ `, isInline: true, components: [{ type: i3.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptOutputCardComponent, decorators: [{
134
+ type: Component,
135
+ args: [{
136
+ selector: '[kendoAIPromptOutputCard]',
137
+ template: `
138
+ <div class="k-card-header">
139
+ <div
140
+ class="k-card-title"
141
+ [attr.id]="titleId">{{outputTitle}}
142
+ </div>
143
+ <div class="k-card-subtitle">{{promptOutput.prompt}}</div>
144
+ </div>
145
+ <div class="k-card-body">
146
+ <p>{{promptOutput.output}}</p>
147
+ </div>
148
+ <div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
149
+ <button kendoButton
150
+ fillMode="flat"
151
+ themeColor="primary"
152
+ rounded="full"
153
+ icon="copy"
154
+ [svgIcon]="copyIcon"
155
+ (click)="handleCopy()"
156
+ >{{messageFor('copyOutput')}}</button>
157
+ <button kendoButton
158
+ fillMode="flat"
159
+ rounded="full"
160
+ icon="arrow-rotate-cw"
161
+ [svgIcon]="retryIcon"
162
+ (click)="handleRetry()"
163
+ >{{messageFor('retryGeneration')}}</button>
164
+ <ng-container *ngIf="showRating">
165
+ <span class="k-spacer"></span>
166
+ <button kendoButton
167
+ fillMode="flat"
168
+ icon="thumb-up-outline"
169
+ [svgIcon]="positiveRatingIcon"
170
+ (click)="handleRating('positive')">
171
+ </button>
172
+ <button kendoButton
173
+ fillMode="flat"
174
+ icon="thumb-down-outline"
175
+ [svgIcon]="negativeRatingIcon"
176
+ (click)="handleRating('negative')">
177
+ </button>
178
+ </ng-container>
179
+ </div>
180
+ `
181
+ }]
182
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AIPromptService }]; }, propDecorators: { hostClass: [{
183
+ type: HostBinding,
184
+ args: ['class.k-card']
185
+ }], listItemRole: [{
186
+ type: HostBinding,
187
+ args: ['attr.role']
188
+ }], tabIndex: [{
189
+ type: HostBinding,
190
+ args: ['attr.tabindex']
191
+ }], ariaDescribedBy: [{
192
+ type: HostBinding,
193
+ args: ['attr.aria-describedby']
194
+ }], ariaKeyShortcuts: [{
195
+ type: HostBinding,
196
+ args: ['attr.aria-keyshortcuts']
197
+ }], promptOutput: [{
198
+ type: Input
199
+ }] } });
@@ -0,0 +1,67 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, ElementRef, Renderer2 } from '@angular/core';
6
+ import { ToolbarNavigationService } from './toolbar-navigation.service';
7
+ import { Keys, focusableSelector } from '@progress/kendo-angular-common';
8
+ import * as i0 from "@angular/core";
9
+ import * as i1 from "./toolbar-navigation.service";
10
+ /**
11
+ * @hidden
12
+ */
13
+ export class AIPromptToolbarFocusableDirective {
14
+ constructor(host, navigationService, renderer) {
15
+ this.host = host;
16
+ this.navigationService = navigationService;
17
+ this.renderer = renderer;
18
+ this.keyDownHandler = (e) => {
19
+ const targetsSelf = e.target === this.element;
20
+ const isLeftArrow = e.keyCode === Keys.ArrowLeft;
21
+ const isRightArrow = e.keyCode === Keys.ArrowRight;
22
+ const isArrow = isLeftArrow || isRightArrow;
23
+ if (!targetsSelf || !isArrow) {
24
+ return;
25
+ }
26
+ this.renderer.setAttribute(this.element, 'tabindex', '-1');
27
+ this.element.querySelectorAll(focusableSelector).forEach(el => {
28
+ this.renderer.setAttribute(el, 'tabindex', '-1');
29
+ });
30
+ if (isRightArrow) {
31
+ this.navigationService.move('right');
32
+ }
33
+ else if (isLeftArrow) {
34
+ this.navigationService.move('left');
35
+ }
36
+ };
37
+ this.clickHandler = () => {
38
+ this.navigationService.setActiveIndex(this);
39
+ };
40
+ navigationService.register(this);
41
+ }
42
+ get element() {
43
+ return this.host.nativeElement;
44
+ }
45
+ ngAfterViewInit() {
46
+ this.renderer.setAttribute(this.element, 'tabindex', this.navigationService.isActive(this) ? '0' : '-1');
47
+ this.element.addEventListener('keydown', this.keyDownHandler, { capture: true });
48
+ this.element.addEventListener('click', this.clickHandler, { capture: true });
49
+ }
50
+ ngOnDestroy() {
51
+ this.navigationService.unregister(this);
52
+ this.element.removeEventListener('keydown', this.keyDownHandler, { capture: true });
53
+ this.element.removeEventListener('click', this.clickHandler, { capture: true });
54
+ }
55
+ activate() {
56
+ this.renderer.setAttribute(this.element, 'tabindex', '0');
57
+ this.element.focus();
58
+ }
59
+ }
60
+ AIPromptToolbarFocusableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarFocusableDirective, deps: [{ token: i0.ElementRef }, { token: i1.ToolbarNavigationService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
61
+ AIPromptToolbarFocusableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]", ngImport: i0 });
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarFocusableDirective, decorators: [{
63
+ type: Directive,
64
+ args: [{
65
+ selector: '[kendoAIPromptToolbarFocusable]'
66
+ }]
67
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ToolbarNavigationService }, { type: i0.Renderer2 }]; } });
@@ -0,0 +1,55 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Injectable } from '@angular/core';
6
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
+ import * as i0 from "@angular/core";
8
+ import * as i1 from "@progress/kendo-angular-l10n";
9
+ /**
10
+ * @hidden
11
+ */
12
+ export class ToolbarNavigationService {
13
+ constructor(localizationService) {
14
+ this.localizationService = localizationService;
15
+ this.focusableElements = [];
16
+ this.currentFocusedIndex = 0;
17
+ }
18
+ register(tool) {
19
+ if (!this.focusableElements.some(el => el === tool)) {
20
+ this.focusableElements.push(tool);
21
+ }
22
+ }
23
+ unregister(tool) {
24
+ this.currentFocusedIndex = 0;
25
+ this.focusableElements = this.focusableElements.filter(el => el !== tool);
26
+ }
27
+ isActive(focusable) {
28
+ return this.focusableElements[this.currentFocusedIndex] === focusable;
29
+ }
30
+ setActiveIndex(tool) {
31
+ this.currentFocusedIndex = Math.max(this.focusableElements.indexOf(tool), 0);
32
+ }
33
+ move(direction) {
34
+ let delta = direction === 'right' ? 1 : -1;
35
+ if (this.localizationService.rtl) {
36
+ delta = -delta;
37
+ }
38
+ this.currentFocusedIndex += delta;
39
+ if (this.currentFocusedIndex < 0) {
40
+ this.currentFocusedIndex = this.focusableElements.length - 1;
41
+ }
42
+ else if (this.currentFocusedIndex >= this.focusableElements.length) {
43
+ this.currentFocusedIndex = 0;
44
+ }
45
+ this.focusableElements[this.currentFocusedIndex].activate();
46
+ }
47
+ focusFirst() {
48
+ this.focusableElements[this.currentFocusedIndex].activate();
49
+ }
50
+ }
51
+ ToolbarNavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });
52
+ ToolbarNavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ToolbarNavigationService, decorators: [{
54
+ type: Injectable
55
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
@@ -0,0 +1,41 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, forwardRef } from '@angular/core';
6
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
+ import { Messages } from './messages';
8
+ import * as i0 from "@angular/core";
9
+ import * as i1 from "@progress/kendo-angular-l10n";
10
+ /**
11
+ * Custom component messages override default component messages.
12
+ */
13
+ export class AIPromptCustomMessagesComponent extends Messages {
14
+ constructor(service) {
15
+ super();
16
+ this.service = service;
17
+ }
18
+ get override() {
19
+ return true;
20
+ }
21
+ }
22
+ AIPromptCustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptCustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
23
+ AIPromptCustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptCustomMessagesComponent, selector: "kendo-aiprompt-messages", providers: [
24
+ {
25
+ provide: Messages,
26
+ useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
27
+ }
28
+ ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptCustomMessagesComponent, decorators: [{
30
+ type: Component,
31
+ args: [{
32
+ providers: [
33
+ {
34
+ provide: Messages,
35
+ useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
36
+ }
37
+ ],
38
+ selector: 'kendo-aiprompt-messages',
39
+ template: ``
40
+ }]
41
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
@@ -0,0 +1,37 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, forwardRef } from '@angular/core';
6
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
+ import { Messages } from './messages';
8
+ import * as i0 from "@angular/core";
9
+ import * as i1 from "@progress/kendo-angular-l10n";
10
+ /**
11
+ * @hidden
12
+ */
13
+ export class LocalizedMessagesDirective extends Messages {
14
+ constructor(service) {
15
+ super();
16
+ this.service = service;
17
+ }
18
+ }
19
+ LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
20
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]", providers: [
21
+ {
22
+ provide: Messages,
23
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
24
+ }
25
+ ], usesInheritance: true, ngImport: i0 });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
27
+ type: Directive,
28
+ args: [{
29
+ providers: [
30
+ {
31
+ provide: Messages,
32
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
33
+ }
34
+ ],
35
+ selector: '[kendoAIPromptLocalizedMessages]'
36
+ }]
37
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
@@ -0,0 +1,35 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, Input } from '@angular/core';
6
+ import { ComponentMessages } from '@progress/kendo-angular-l10n';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * @hidden
10
+ */
11
+ export class Messages extends ComponentMessages {
12
+ }
13
+ Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
14
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { promptView: "promptView", outputView: "outputView", generateOutput: "generateOutput", promptPlaceholder: "promptPlaceholder", copyOutput: "copyOutput", retryGeneration: "retryGeneration", outputTitle: "outputTitle", outputRetryTitle: "outputRetryTitle", promptSuggestions: "promptSuggestions" }, usesInheritance: true, ngImport: i0 });
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
16
+ type: Directive
17
+ }], propDecorators: { promptView: [{
18
+ type: Input
19
+ }], outputView: [{
20
+ type: Input
21
+ }], generateOutput: [{
22
+ type: Input
23
+ }], promptPlaceholder: [{
24
+ type: Input
25
+ }], copyOutput: [{
26
+ type: Input
27
+ }], retryGeneration: [{
28
+ type: Input
29
+ }], outputTitle: [{
30
+ type: Input
31
+ }], outputRetryTitle: [{
32
+ type: Input
33
+ }], promptSuggestions: [{
34
+ type: Input
35
+ }] } });
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ export {};
@@ -0,0 +1,27 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, Optional, TemplateRef } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Represents a template that allows you to define additional ToolBar actions.
9
+ * The actions will be rendered right after all views' ToolBar buttons.
10
+ * To define the template, nest an `<ng-template>` tag
11
+ * with the `kendoAIPromptToolbarActionsTemplate` directive inside the `<kendo-aiprompt>` tag.
12
+ */
13
+ export class AIPromptToolbarActionsDirective {
14
+ constructor(templateRef) {
15
+ this.templateRef = templateRef;
16
+ }
17
+ }
18
+ AIPromptToolbarActionsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarActionsDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
19
+ AIPromptToolbarActionsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: AIPromptToolbarActionsDirective, selector: "[kendoAIPromptToolbarActionsTemplate]", ngImport: i0 });
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AIPromptToolbarActionsDirective, decorators: [{
21
+ type: Directive,
22
+ args: [{
23
+ selector: '[kendoAIPromptToolbarActionsTemplate]'
24
+ }]
25
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
26
+ type: Optional
27
+ }] }]; } });
@@ -0,0 +1,26 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { InjectionToken } from "@angular/core";
6
+ import { commentIcon, moreHorizontalIcon, sparklesIcon } from "@progress/kendo-svg-icons";
7
+ /**
8
+ * @hidden
9
+ */
10
+ export const MY_TOKEN = new InjectionToken('COMMAND_TOKEN');
11
+ /**
12
+ * @hidden
13
+ */
14
+ export const DEFAULT_SVG_ICONS = {
15
+ prompt: sparklesIcon,
16
+ output: commentIcon,
17
+ command: moreHorizontalIcon
18
+ };
19
+ /**
20
+ * @hidden
21
+ */
22
+ export const DEFAULT_ICONS = {
23
+ prompt: 'sparkles',
24
+ output: 'comment',
25
+ command: 'more-horizontal'
26
+ };