@progress/kendo-angular-conversational-ui 19.3.0-develop.3 → 19.3.0-develop.31

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 (65) hide show
  1. package/ai-prompt/aiprompt.component.d.ts +80 -13
  2. package/ai-prompt/aiprompt.module.d.ts +3 -1
  3. package/ai-prompt/common/aiprompt.service.d.ts +10 -0
  4. package/ai-prompt/common/output-card.component.d.ts +4 -0
  5. package/ai-prompt/localization/messages.d.ts +5 -1
  6. package/ai-prompt/models/ai-prompt-settings.d.ts +60 -0
  7. package/ai-prompt/models/index.d.ts +1 -0
  8. package/ai-prompt/templates/aiprompt-output-body-template.directive.d.ts +24 -0
  9. package/ai-prompt/templates/aiprompt-output-template.directive.d.ts +24 -0
  10. package/ai-prompt/views/output-view.component.d.ts +4 -0
  11. package/ai-prompt/views/prompt-view.component.d.ts +23 -1
  12. package/conversational-ui.module.d.ts +12 -7
  13. package/directives.d.ts +8 -2
  14. package/esm2022/ai-prompt/aiprompt.component.mjs +177 -25
  15. package/esm2022/ai-prompt/aiprompt.module.mjs +3 -1
  16. package/esm2022/ai-prompt/common/aiprompt.service.mjs +35 -0
  17. package/esm2022/ai-prompt/common/output-card.component.mjs +23 -5
  18. package/esm2022/ai-prompt/localization/messages.mjs +7 -1
  19. package/esm2022/ai-prompt/models/ai-prompt-settings.mjs +5 -0
  20. package/esm2022/ai-prompt/templates/aiprompt-output-body-template.directive.mjs +33 -0
  21. package/esm2022/ai-prompt/templates/aiprompt-output-template.directive.mjs +33 -0
  22. package/esm2022/ai-prompt/views/output-view.component.mjs +27 -11
  23. package/esm2022/ai-prompt/views/prompt-view.component.mjs +139 -21
  24. package/esm2022/chat/message-box.component.mjs +1 -1
  25. package/esm2022/conversational-ui.module.mjs +13 -8
  26. package/esm2022/directives.mjs +15 -2
  27. package/esm2022/index.mjs +7 -0
  28. package/esm2022/inline-ai-prompt/inlineaiprompt-content.component.mjs +552 -0
  29. package/esm2022/inline-ai-prompt/inlineaiprompt.component.mjs +342 -0
  30. package/esm2022/inline-ai-prompt/inlineaiprompt.service.mjs +85 -0
  31. package/esm2022/inline-ai-prompt/localization/custom-messages.component.mjs +53 -0
  32. package/esm2022/inline-ai-prompt/localization/localized-messages.directive.mjs +39 -0
  33. package/esm2022/inline-ai-prompt/localization/messages.mjs +35 -0
  34. package/esm2022/inline-ai-prompt/models/command.interface.mjs +5 -0
  35. package/esm2022/inline-ai-prompt/models/index.mjs +5 -0
  36. package/esm2022/inline-ai-prompt/models/inlineaiprompt-popupsettings.mjs +5 -0
  37. package/esm2022/inline-ai-prompt/models/inlineaiprompt-settings.mjs +59 -0
  38. package/esm2022/inline-ai-prompt/models/messages.mjs +8 -0
  39. package/esm2022/inline-ai-prompt/models/output-action-click-event.mjs +5 -0
  40. package/esm2022/inline-ai-prompt/models/output-action.interface.mjs +5 -0
  41. package/esm2022/inline-ai-prompt/models/prompt-output.interface.mjs +5 -0
  42. package/esm2022/inline-ai-prompt/models/prompt-request-event.mjs +5 -0
  43. package/esm2022/inline-ai-prompt/output-template.directive.mjs +38 -0
  44. package/esm2022/inline-ai-prompt/utils.mjs +22 -0
  45. package/esm2022/package-metadata.mjs +2 -2
  46. package/fesm2022/progress-kendo-angular-conversational-ui.mjs +1696 -140
  47. package/index.d.ts +7 -0
  48. package/inline-ai-prompt/inlineaiprompt-content.component.d.ts +82 -0
  49. package/inline-ai-prompt/inlineaiprompt.component.d.ts +150 -0
  50. package/inline-ai-prompt/inlineaiprompt.service.d.ts +41 -0
  51. package/inline-ai-prompt/localization/custom-messages.component.d.ts +27 -0
  52. package/inline-ai-prompt/localization/localized-messages.directive.d.ts +16 -0
  53. package/inline-ai-prompt/localization/messages.d.ts +25 -0
  54. package/inline-ai-prompt/models/command.interface.d.ts +38 -0
  55. package/inline-ai-prompt/models/index.d.ts +12 -0
  56. package/inline-ai-prompt/models/inlineaiprompt-popupsettings.d.ts +10 -0
  57. package/inline-ai-prompt/models/inlineaiprompt-settings.d.ts +66 -0
  58. package/inline-ai-prompt/models/messages.d.ts +21 -0
  59. package/inline-ai-prompt/models/output-action-click-event.d.ts +19 -0
  60. package/inline-ai-prompt/models/output-action.interface.d.ts +52 -0
  61. package/inline-ai-prompt/models/prompt-output.interface.d.ts +25 -0
  62. package/inline-ai-prompt/models/prompt-request-event.d.ts +17 -0
  63. package/inline-ai-prompt/output-template.directive.d.ts +27 -0
  64. package/inline-ai-prompt/utils.d.ts +13 -0
  65. package/package.json +13 -12
@@ -0,0 +1,552 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 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, ElementRef, EventEmitter, HostBinding, HostListener, Input, NgZone, Output, Renderer2, ViewChild, ViewContainerRef, Optional, SkipSelf, inject, TemplateRef } from '@angular/core';
6
+ import { NgIf, NgClass, NgTemplateOutlet, NgFor } from '@angular/common';
7
+ import { Subscription } from 'rxjs';
8
+ import { menuIcon, paperPlaneIcon, stopSmIcon, copyIcon, cancelOutlineIcon, arrowRotateCwIcon } from '@progress/kendo-svg-icons';
9
+ import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
10
+ import { validatePackage } from '@progress/kendo-licensing';
11
+ import { KENDO_BUTTONS } from '@progress/kendo-angular-buttons';
12
+ import { packageMetadata } from '../package-metadata';
13
+ import { TextAreaComponent, KENDO_TEXTAREA } from '@progress/kendo-angular-inputs';
14
+ import { ContextMenuComponent, KENDO_CONTEXTMENU } from '@progress/kendo-angular-menu';
15
+ import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
16
+ import { isDocumentAvailable, isPresent } from '@progress/kendo-angular-common';
17
+ import { calculateMeasurement } from './utils';
18
+ import { KENDO_CARD } from '@progress/kendo-angular-layout';
19
+ import * as i0 from "@angular/core";
20
+ import * as i1 from "@progress/kendo-angular-l10n";
21
+ import * as i2 from "@progress/kendo-angular-buttons";
22
+ import * as i3 from "@progress/kendo-angular-inputs";
23
+ import * as i4 from "@progress/kendo-angular-menu";
24
+ import * as i5 from "@progress/kendo-angular-layout";
25
+ const TEXTAREA_MAX_ROWS = 5;
26
+ const TEXTAREA_INITIAL_ROWS = 1;
27
+ /**
28
+ * @hidden
29
+ */
30
+ export class InlineAIPromptContentComponent {
31
+ ngZone;
32
+ renderer;
33
+ element;
34
+ localization;
35
+ className = true;
36
+ get dirAttr() {
37
+ return this.direction;
38
+ }
39
+ get maxHeightStyle() {
40
+ return this.calculateMeasurement(this.maxHeight);
41
+ }
42
+ get widthStyle() {
43
+ return this.calculateMeasurement(this.width);
44
+ }
45
+ popupElement;
46
+ promptValue;
47
+ placeholder;
48
+ promptOutput;
49
+ enableSpeechToText = true;
50
+ streaming = false;
51
+ width = 550;
52
+ maxHeight;
53
+ appendTo;
54
+ defaultOutputActions = [{
55
+ name: 'copy',
56
+ type: 'button',
57
+ icon: 'copy',
58
+ svgIcon: copyIcon,
59
+ text: 'Copy',
60
+ fillMode: 'flat',
61
+ themeColor: 'primary',
62
+ rounded: 'medium',
63
+ },
64
+ {
65
+ name: 'retry',
66
+ type: 'button',
67
+ icon: 'arrow-rotate-cw',
68
+ svgIcon: arrowRotateCwIcon,
69
+ text: 'Retry',
70
+ fillMode: 'flat',
71
+ themeColor: 'primary',
72
+ rounded: 'medium',
73
+ },
74
+ {
75
+ name: 'discard',
76
+ type: 'button',
77
+ icon: 'cancel-outline',
78
+ svgIcon: cancelOutlineIcon,
79
+ text: 'Discard',
80
+ fillMode: 'flat',
81
+ themeColor: 'base',
82
+ rounded: 'medium',
83
+ }
84
+ ];
85
+ set outputActions(actions) {
86
+ this._outputActions = this.mergeWithDefaultActions(actions);
87
+ }
88
+ get outputActions() {
89
+ return this._outputActions;
90
+ }
91
+ set promptCommands(commands) {
92
+ this._promptCommands = commands || [];
93
+ this.commandMenuItems = this.transformCommands(commands || []);
94
+ }
95
+ get promptCommands() {
96
+ return this._promptCommands;
97
+ }
98
+ outputTemplate;
99
+ promptRequest = new EventEmitter();
100
+ commandExecute = new EventEmitter();
101
+ outputActionClick = new EventEmitter();
102
+ promptRequestCancel = new EventEmitter();
103
+ close = new EventEmitter();
104
+ promptValueChange = new EventEmitter();
105
+ onEscapeKey(event) {
106
+ if (event.key === 'Escape') {
107
+ if (this.streaming) {
108
+ event.stopPropagation();
109
+ this.promptRequestCancel.emit();
110
+ }
111
+ else {
112
+ this.close.emit();
113
+ }
114
+ }
115
+ }
116
+ textArea;
117
+ contextMenu;
118
+ calculateMeasurement = calculateMeasurement;
119
+ commandMenuIcon = menuIcon;
120
+ sendIcon = paperPlaneIcon;
121
+ stopGenerationIcon = stopSmIcon;
122
+ isListening = false;
123
+ commandMenuItems = [];
124
+ messages = {};
125
+ maxRows = TEXTAREA_MAX_ROWS;
126
+ initialRows = TEXTAREA_INITIAL_ROWS;
127
+ _outputActions = this.defaultOutputActions;
128
+ _promptCommands = [];
129
+ direction;
130
+ localizationSubs = new Subscription();
131
+ subs = new Subscription();
132
+ constructor(ngZone, renderer, element, localization) {
133
+ this.ngZone = ngZone;
134
+ this.renderer = renderer;
135
+ this.element = element;
136
+ this.localization = localization;
137
+ validatePackage(packageMetadata);
138
+ if (!this.localization) {
139
+ this.localization = inject(LocalizationService);
140
+ }
141
+ this.direction = this.localization?.rtl ? 'rtl' : 'ltr';
142
+ this.localizationSubs.add(this.localization.changes.subscribe(({ rtl }) => {
143
+ this.direction = rtl ? 'rtl' : 'ltr';
144
+ }));
145
+ }
146
+ ngAfterViewInit() {
147
+ this.ngZone.runOutsideAngular(() => {
148
+ if (!isDocumentAvailable()) {
149
+ return;
150
+ }
151
+ // add a delay to avoid catching the same click event that triggered the component opening
152
+ setTimeout(() => {
153
+ this.subs.add(this.renderer.listen('document', 'click', (e) => {
154
+ this.outsideClickClose(e);
155
+ }));
156
+ });
157
+ });
158
+ }
159
+ ngOnDestroy() {
160
+ this.subs.unsubscribe();
161
+ this.localizationSubs.unsubscribe();
162
+ this.contextMenu?.hide();
163
+ }
164
+ focus() {
165
+ if (this.textArea) {
166
+ this.textArea.focus();
167
+ }
168
+ }
169
+ onActionClick(event) {
170
+ const eventArgs = {
171
+ action: event,
172
+ output: this.promptOutput,
173
+ };
174
+ this.outputActionClick.emit(eventArgs);
175
+ this.handleDefaultActions(event);
176
+ }
177
+ handleDefaultActions(event) {
178
+ switch (event.name) {
179
+ case 'copy':
180
+ navigator.clipboard.writeText(this.promptOutput.output);
181
+ break;
182
+ case 'retry':
183
+ this.promptRequest.emit({
184
+ prompt: this.promptOutput?.prompt,
185
+ isRetry: true
186
+ });
187
+ break;
188
+ case 'discard':
189
+ this.close.emit();
190
+ break;
191
+ }
192
+ }
193
+ handleSpeechResult(event) {
194
+ if (event.alternatives && event.alternatives.length > 0) {
195
+ if (!isPresent(this.promptValue)) {
196
+ this.promptValue = '';
197
+ }
198
+ this.promptValue += event.alternatives[0].transcript + ' ';
199
+ }
200
+ }
201
+ onClick(action) {
202
+ this.commandExecute.next(action);
203
+ }
204
+ handlePromptValueChange(value) {
205
+ this.promptValue = value;
206
+ this.promptValueChange.emit(value);
207
+ }
208
+ handleTextAreaKeydown(event) {
209
+ if (event.key === 'Enter' && !event.shiftKey && !this.streaming) {
210
+ event.preventDefault();
211
+ this.handlePromptRequest();
212
+ }
213
+ }
214
+ onCommandButtonClick(event) {
215
+ event.preventDefault();
216
+ event.stopPropagation();
217
+ if (this.contextMenu) {
218
+ this.contextMenu.show(this.popupElement);
219
+ }
220
+ }
221
+ onCommandClick(event) {
222
+ // avoid triggering the document click listener to keep the popup open
223
+ if (event.originalEvent) {
224
+ event.originalEvent.stopPropagation();
225
+ event.originalEvent.preventDefault();
226
+ }
227
+ const eventArgs = {
228
+ ...event.item.originalCommand
229
+ };
230
+ this.commandExecute.emit(eventArgs);
231
+ }
232
+ messageFor(text) {
233
+ if (this.messages?.[text]) {
234
+ return this.messages[text];
235
+ }
236
+ return this.localization?.get(text);
237
+ }
238
+ handlePromptRequest() {
239
+ if (this.streaming) {
240
+ this.promptRequestCancel.emit();
241
+ return;
242
+ }
243
+ if (!this.promptValue) {
244
+ return;
245
+ }
246
+ const eventArgs = {
247
+ prompt: this.promptValue
248
+ };
249
+ this.promptRequest.emit(eventArgs);
250
+ }
251
+ mergeWithDefaultActions(userActions) {
252
+ if (!userActions || userActions.length === 0) {
253
+ return [];
254
+ }
255
+ return userActions.map(userAction => {
256
+ const defaultAction = this.defaultOutputActions.find(action => action.name === userAction?.name);
257
+ if (defaultAction) {
258
+ return { ...defaultAction, ...userAction };
259
+ }
260
+ return userAction;
261
+ });
262
+ }
263
+ transformCommands = (commands) => commands.map(command => ({
264
+ text: command.text,
265
+ icon: command.icon,
266
+ svgIcon: command.svgIcon,
267
+ disabled: command.disabled,
268
+ originalCommand: command,
269
+ items: command.children ? this.transformCommands(command.children) : undefined
270
+ }));
271
+ outsideClickClose(e) {
272
+ if (!this.element.nativeElement.contains(e.target)) {
273
+ this.ngZone.run(() => {
274
+ this.close.emit();
275
+ });
276
+ }
277
+ }
278
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.LocalizationService, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });
279
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptContentComponent, isStandalone: true, selector: "kendo-inlineaiprompt-content", inputs: { popupElement: "popupElement", promptValue: "promptValue", placeholder: "placeholder", promptOutput: "promptOutput", enableSpeechToText: "enableSpeechToText", streaming: "streaming", width: "width", maxHeight: "maxHeight", appendTo: "appendTo", outputActions: "outputActions", promptCommands: "promptCommands", outputTemplate: "outputTemplate" }, outputs: { promptRequest: "promptRequest", commandExecute: "commandExecute", outputActionClick: "outputActionClick", promptRequestCancel: "promptRequestCancel", close: "close", promptValueChange: "promptValueChange" }, host: { listeners: { "keydown": "onEscapeKey($event)" }, properties: { "class.k-prompt": "this.className", "attr.dir": "this.dirAttr", "style.max-height": "this.maxHeightStyle", "style.width": "this.widthStyle" } }, providers: [
280
+ LocalizationService,
281
+ {
282
+ provide: L10N_PREFIX,
283
+ useValue: 'kendo.inlineaiprompt',
284
+ },
285
+ ], viewQueries: [{ propertyName: "textArea", first: true, predicate: TextAreaComponent, descendants: true }, { propertyName: "contextMenu", first: true, predicate: ["kendoContextMenu"], descendants: true }], exportAs: ["kendoInlineAIPromptContent"], ngImport: i0, template: `
286
+ <ng-container kendoInlineAIPromptLocalizedMessages
287
+ i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
288
+ commandsButtonTitle="Command Menu"
289
+ i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
290
+ generateButtonTitle="Generate"
291
+ i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
292
+ speechToTextButtonTitle="Speech to Text"
293
+ >
294
+ </ng-container>
295
+ <div class="k-prompt-content">
296
+ <div class="k-prompt-view">
297
+ <kendo-card *ngIf="promptOutput" width="100%">
298
+ <kendo-card-body>
299
+ <ng-container
300
+ *ngIf="outputTemplate"
301
+ [ngTemplateOutlet]="outputTemplate"
302
+ [ngTemplateOutletContext]="{ $implicit: promptOutput }"
303
+ >
304
+ </ng-container>
305
+ <ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
306
+ </kendo-card-body>
307
+ <kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
308
+ <ng-container *ngFor="let action of outputActions">
309
+ <button kendoButton *ngIf="action.type === 'button'"
310
+ [attr.title]="action?.title"
311
+ [fillMode]="action?.fillMode"
312
+ [themeColor]="action?.themeColor"
313
+ [rounded]="action?.rounded"
314
+ [icon]="action?.icon"
315
+ [svgIcon]="action?.svgIcon"
316
+ (click)="onActionClick(action)"
317
+ >{{action?.text}}</button>
318
+ <div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
319
+ </ng-container>
320
+ </kendo-card-actions>
321
+ </kendo-card>
322
+ <kendo-textarea
323
+ [value]="promptValue ? promptValue : null"
324
+ (valueChange)="handlePromptValueChange($event)"
325
+ [rows]="initialRows"
326
+ resizable="auto"
327
+ flow="horizontal"
328
+ [placeholder]="placeholder"
329
+ [showPrefixSeparator]="true"
330
+ [selectOnFocus]="true"
331
+ [maxResizableRows]="maxRows"
332
+ (keydown)="handleTextAreaKeydown($event)"
333
+ >
334
+ <kendo-textarea-prefix>
335
+ <button
336
+ kendoButton
337
+ #commandMenuButton
338
+ *ngIf="promptCommands && promptCommands.length > 0"
339
+ [attr.title]="messageFor('commandsButtonTitle')"
340
+ fillMode="flat"
341
+ icon="menu"
342
+ [svgIcon]="commandMenuIcon"
343
+ (click)="onCommandButtonClick($event)"
344
+ ></button>
345
+ <button
346
+ kendoSpeechToTextButton
347
+ *ngIf="enableSpeechToText"
348
+ [attr.title]="messageFor('speechToTextButtonTitle')"
349
+ fillMode="flat"
350
+ (result)="handleSpeechResult($event)"
351
+ (start)="isListening = true"
352
+ (end)="isListening = false"
353
+ ></button>
354
+ </kendo-textarea-prefix>
355
+ <kendo-textarea-suffix>
356
+ <button
357
+ kendoButton
358
+ [attr.title]="messageFor('generateButtonTitle')"
359
+ fillMode="flat"
360
+ class="k-prompt-send"
361
+ [ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
362
+ (click)="handlePromptRequest()"
363
+ [disabled]="!streaming && (!promptValue?.trim() || isListening)"
364
+ [svgIcon]="streaming ? stopGenerationIcon : sendIcon"
365
+ [icon]="streaming ? 'stop-sm' : 'paper-plane'"
366
+ ></button>
367
+ </kendo-textarea-suffix>
368
+ </kendo-textarea>
369
+ </div>
370
+ </div>
371
+ <kendo-contextmenu
372
+ #kendoContextMenu
373
+ [alignToAnchor]="true"
374
+ [items]="commandMenuItems"
375
+ [appendTo]="appendTo"
376
+ class="k-hidden"
377
+ (select)="onCommandClick($event)">
378
+ </kendo-contextmenu>
379
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoInlineAIPromptLocalizedMessages]" }, { kind: "component", type: i2.ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "component", type: i2.SpeechToTextButtonComponent, selector: "button[kendoSpeechToTextButton]", inputs: ["disabled", "size", "rounded", "fillMode", "themeColor", "integrationMode", "lang", "continuous", "interimResults", "maxAlternatives"], outputs: ["start", "end", "result", "error", "click"], exportAs: ["kendoSpeechToTextButton"] }, { kind: "component", type: i3.TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: i3.TextAreaPrefixComponent, selector: "kendo-textarea-prefix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaPrefix"] }, { kind: "component", type: i3.TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }, { kind: "component", type: i4.ContextMenuComponent, selector: "kendo-contextmenu", inputs: ["showOn", "target", "filter", "alignToAnchor", "vertical", "popupAnimate", "popupAlign", "anchorAlign", "collision", "appendTo", "ariaLabel"], outputs: ["popupOpen", "popupClose", "select", "open", "close"], exportAs: ["kendoContextMenu"] }, { kind: "component", type: i5.CardComponent, selector: "kendo-card", inputs: ["orientation", "width"] }, { kind: "component", type: i5.CardActionsComponent, selector: "kendo-card-actions", inputs: ["orientation", "layout", "actions"], outputs: ["action"] }, { kind: "component", type: i5.CardBodyComponent, selector: "kendo-card-body" }] });
380
+ }
381
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, decorators: [{
382
+ type: Component,
383
+ args: [{
384
+ exportAs: 'kendoInlineAIPromptContent',
385
+ selector: 'kendo-inlineaiprompt-content',
386
+ providers: [
387
+ LocalizationService,
388
+ {
389
+ provide: L10N_PREFIX,
390
+ useValue: 'kendo.inlineaiprompt',
391
+ },
392
+ ],
393
+ template: `
394
+ <ng-container kendoInlineAIPromptLocalizedMessages
395
+ i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
396
+ commandsButtonTitle="Command Menu"
397
+ i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
398
+ generateButtonTitle="Generate"
399
+ i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
400
+ speechToTextButtonTitle="Speech to Text"
401
+ >
402
+ </ng-container>
403
+ <div class="k-prompt-content">
404
+ <div class="k-prompt-view">
405
+ <kendo-card *ngIf="promptOutput" width="100%">
406
+ <kendo-card-body>
407
+ <ng-container
408
+ *ngIf="outputTemplate"
409
+ [ngTemplateOutlet]="outputTemplate"
410
+ [ngTemplateOutletContext]="{ $implicit: promptOutput }"
411
+ >
412
+ </ng-container>
413
+ <ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
414
+ </kendo-card-body>
415
+ <kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
416
+ <ng-container *ngFor="let action of outputActions">
417
+ <button kendoButton *ngIf="action.type === 'button'"
418
+ [attr.title]="action?.title"
419
+ [fillMode]="action?.fillMode"
420
+ [themeColor]="action?.themeColor"
421
+ [rounded]="action?.rounded"
422
+ [icon]="action?.icon"
423
+ [svgIcon]="action?.svgIcon"
424
+ (click)="onActionClick(action)"
425
+ >{{action?.text}}</button>
426
+ <div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
427
+ </ng-container>
428
+ </kendo-card-actions>
429
+ </kendo-card>
430
+ <kendo-textarea
431
+ [value]="promptValue ? promptValue : null"
432
+ (valueChange)="handlePromptValueChange($event)"
433
+ [rows]="initialRows"
434
+ resizable="auto"
435
+ flow="horizontal"
436
+ [placeholder]="placeholder"
437
+ [showPrefixSeparator]="true"
438
+ [selectOnFocus]="true"
439
+ [maxResizableRows]="maxRows"
440
+ (keydown)="handleTextAreaKeydown($event)"
441
+ >
442
+ <kendo-textarea-prefix>
443
+ <button
444
+ kendoButton
445
+ #commandMenuButton
446
+ *ngIf="promptCommands && promptCommands.length > 0"
447
+ [attr.title]="messageFor('commandsButtonTitle')"
448
+ fillMode="flat"
449
+ icon="menu"
450
+ [svgIcon]="commandMenuIcon"
451
+ (click)="onCommandButtonClick($event)"
452
+ ></button>
453
+ <button
454
+ kendoSpeechToTextButton
455
+ *ngIf="enableSpeechToText"
456
+ [attr.title]="messageFor('speechToTextButtonTitle')"
457
+ fillMode="flat"
458
+ (result)="handleSpeechResult($event)"
459
+ (start)="isListening = true"
460
+ (end)="isListening = false"
461
+ ></button>
462
+ </kendo-textarea-prefix>
463
+ <kendo-textarea-suffix>
464
+ <button
465
+ kendoButton
466
+ [attr.title]="messageFor('generateButtonTitle')"
467
+ fillMode="flat"
468
+ class="k-prompt-send"
469
+ [ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
470
+ (click)="handlePromptRequest()"
471
+ [disabled]="!streaming && (!promptValue?.trim() || isListening)"
472
+ [svgIcon]="streaming ? stopGenerationIcon : sendIcon"
473
+ [icon]="streaming ? 'stop-sm' : 'paper-plane'"
474
+ ></button>
475
+ </kendo-textarea-suffix>
476
+ </kendo-textarea>
477
+ </div>
478
+ </div>
479
+ <kendo-contextmenu
480
+ #kendoContextMenu
481
+ [alignToAnchor]="true"
482
+ [items]="commandMenuItems"
483
+ [appendTo]="appendTo"
484
+ class="k-hidden"
485
+ (select)="onCommandClick($event)">
486
+ </kendo-contextmenu>
487
+ `,
488
+ standalone: true,
489
+ imports: [NgClass, NgIf, NgFor, NgTemplateOutlet, LocalizedMessagesDirective, KENDO_BUTTONS, KENDO_TEXTAREA, KENDO_CONTEXTMENU, KENDO_CARD],
490
+ }]
491
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.LocalizationService, decorators: [{
492
+ type: Optional
493
+ }, {
494
+ type: SkipSelf
495
+ }] }]; }, propDecorators: { className: [{
496
+ type: HostBinding,
497
+ args: ['class.k-prompt']
498
+ }], dirAttr: [{
499
+ type: HostBinding,
500
+ args: ['attr.dir']
501
+ }], maxHeightStyle: [{
502
+ type: HostBinding,
503
+ args: ['style.max-height']
504
+ }], widthStyle: [{
505
+ type: HostBinding,
506
+ args: ['style.width']
507
+ }], popupElement: [{
508
+ type: Input
509
+ }], promptValue: [{
510
+ type: Input
511
+ }], placeholder: [{
512
+ type: Input
513
+ }], promptOutput: [{
514
+ type: Input
515
+ }], enableSpeechToText: [{
516
+ type: Input
517
+ }], streaming: [{
518
+ type: Input
519
+ }], width: [{
520
+ type: Input
521
+ }], maxHeight: [{
522
+ type: Input
523
+ }], appendTo: [{
524
+ type: Input
525
+ }], outputActions: [{
526
+ type: Input
527
+ }], promptCommands: [{
528
+ type: Input
529
+ }], outputTemplate: [{
530
+ type: Input
531
+ }], promptRequest: [{
532
+ type: Output
533
+ }], commandExecute: [{
534
+ type: Output
535
+ }], outputActionClick: [{
536
+ type: Output
537
+ }], promptRequestCancel: [{
538
+ type: Output
539
+ }], close: [{
540
+ type: Output
541
+ }], promptValueChange: [{
542
+ type: Output
543
+ }], onEscapeKey: [{
544
+ type: HostListener,
545
+ args: ['keydown', ['$event']]
546
+ }], textArea: [{
547
+ type: ViewChild,
548
+ args: [TextAreaComponent]
549
+ }], contextMenu: [{
550
+ type: ViewChild,
551
+ args: ['kendoContextMenu']
552
+ }] } });