@fundamental-ngx/ui5-webcomponents-ai 0.58.0-rc.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.
@@ -0,0 +1,655 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, ChangeDetectorRef, forwardRef, Directive, input, booleanAttribute, output, Injector, runInInjectionContext, effect, ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
3
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
+ import '@ui5/webcomponents-ai/dist/Button.js';
5
+ import '@ui5/webcomponents-ai/dist/ButtonState.js';
6
+ import '@ui5/webcomponents-ai/dist/Input.js';
7
+ import '@ui5/webcomponents-ai/dist/PromptInput.js';
8
+ import '@ui5/webcomponents-ai/dist/TextArea.js';
9
+ import { WebcomponentsThemingProvider } from '@fundamental-ngx/ui5-webcomponents-base/theming';
10
+
11
+ class GenericControlValueAccessor {
12
+ constructor() {
13
+ this.elementRef = inject(ElementRef);
14
+ this.cdr = inject(ChangeDetectorRef);
15
+ this._value = null;
16
+ this._initialized = false;
17
+ this.setDisabledState = (isDisabled) => {
18
+ const element = this.elementRef.nativeElement;
19
+ if (element && this._initialized) {
20
+ element.disabled = isDisabled;
21
+ // Manually trigger change detection for zoneless compatibility
22
+ this.cdr.markForCheck();
23
+ }
24
+ };
25
+ }
26
+ ngAfterViewInit() {
27
+ // Initialize after the UI5 web component is ready
28
+ // Use requestAnimationFrame for zoneless compatibility instead of setTimeout
29
+ requestAnimationFrame(() => {
30
+ this.initializeComponent();
31
+ });
32
+ }
33
+ registerOnChange(fn) {
34
+ this.onChange = fn;
35
+ }
36
+ registerOnTouched(fn) {
37
+ this.onTouched = fn;
38
+ }
39
+ writeValue(val) {
40
+ this._value = val;
41
+ if (this._initialized) {
42
+ this.updateElementValue(val);
43
+ }
44
+ }
45
+ initializeComponent() {
46
+ const element = this.elementRef.nativeElement;
47
+ this._initialized = true;
48
+ // Set up event listeners on the UI5 web component
49
+ if (element && element.addEventListener) {
50
+ element.addEventListener('input', (e) => {
51
+ if (this.onChange) {
52
+ this.onChange(e.target.value);
53
+ // Manually trigger change detection for zoneless compatibility
54
+ this.cdr.markForCheck();
55
+ }
56
+ });
57
+ element.addEventListener('change', (e) => {
58
+ if (this.onChange) {
59
+ this.onChange(e.target.value);
60
+ // Manually trigger change detection for zoneless compatibility
61
+ this.cdr.markForCheck();
62
+ }
63
+ });
64
+ element.addEventListener('focusout', () => {
65
+ if (this.onTouched) {
66
+ this.onTouched();
67
+ // Manually trigger change detection for zoneless compatibility
68
+ this.cdr.markForCheck();
69
+ }
70
+ });
71
+ }
72
+ // Set initial value if we have one pending
73
+ if (this._value !== null) {
74
+ this.updateElementValue(this._value);
75
+ }
76
+ }
77
+ updateElementValue(value) {
78
+ const element = this.elementRef.nativeElement;
79
+ if (element && this._initialized) {
80
+ element.value = value || '';
81
+ // Manually trigger change detection for zoneless compatibility
82
+ this.cdr.markForCheck();
83
+ }
84
+ }
85
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericControlValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
86
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: GenericControlValueAccessor, isStandalone: true, selector: "[noop]", providers: [
87
+ {
88
+ provide: NG_VALUE_ACCESSOR,
89
+ useExisting: forwardRef(() => GenericControlValueAccessor),
90
+ multi: true
91
+ }
92
+ ], ngImport: i0 }); }
93
+ }
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: GenericControlValueAccessor, decorators: [{
95
+ type: Directive,
96
+ args: [{
97
+ selector: '[noop]',
98
+ standalone: true,
99
+ providers: [
100
+ {
101
+ provide: NG_VALUE_ACCESSOR,
102
+ useExisting: forwardRef(() => GenericControlValueAccessor),
103
+ multi: true
104
+ }
105
+ ]
106
+ }]
107
+ }] });
108
+
109
+ class Button {
110
+ constructor() {
111
+ /**
112
+ * Defines the component design.
113
+ */
114
+ this.design = input("Default", ...(ngDevMode ? [{ debugName: "design" }] : []));
115
+ /**
116
+ * Defines whether the component is disabled.
117
+ A disabled component can't be pressed or
118
+ focused, and it is not in the tab chain.
119
+ */
120
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
121
+ /**
122
+ * Defines the current state of the component.
123
+ */
124
+ this.state = input(...(ngDevMode ? [undefined, { debugName: "state" }] : []));
125
+ /**
126
+ * Defines the active state of the arrow button in split mode.
127
+ Set to true when the button is in split mode and a menu with additional options
128
+ is opened by the arrow button. Set back to false when the menu is closed.
129
+ */
130
+ this.arrowButtonPressed = input(false, ...(ngDevMode ? [{ debugName: "arrowButtonPressed", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
131
+ /**
132
+ * Defines the additional accessibility attributes that will be applied to the component.
133
+
134
+ This property allows for fine-tuned control of ARIA attributes for screen reader support.
135
+ It accepts an object with the following optional fields:
136
+
137
+ - **root**: Accessibility attributes that will be applied to the root element.
138
+ - **hasPopup**: Indicates the availability and type of interactive popup element (such as a menu or dialog).
139
+ Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
140
+ - **roleDescription**: Defines a human-readable description for the button's role.
141
+ Accepts any string value.
142
+ - **title**: Specifies a tooltip or description for screen readers.
143
+ Accepts any string value.
144
+ - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or focus the button.
145
+
146
+ - **arrowButton**: Accessibility attributes that will be applied to the arrow (split) button element.
147
+ - **hasPopup**: Indicates the type of popup triggered by the arrow button.
148
+ Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
149
+ - **expanded**: Indicates whether the popup controlled by the arrow button is currently expanded.
150
+ Accepts boolean values: `true` or `false`.
151
+ */
152
+ this.accessibilityAttributes = input({}, ...(ngDevMode ? [{ debugName: "accessibilityAttributes" }] : [])); // className is now passed
153
+ /**
154
+ * Fired when the component is activated either with a
155
+ mouse/tap or by using the Enter or Space key.
156
+ */
157
+ this.ui5Click = output();
158
+ /**
159
+ * Fired when the component is in split mode and after the arrow button
160
+ is activated either by clicking or tapping it or by using the [Arrow Up] / [Arrow Down],
161
+ [Alt] + [Arrow Up]/ [Arrow Down], or [F4] keyboard keys.
162
+ */
163
+ this.ui5ArrowButtonClick = output();
164
+ this.elementRef = inject(ElementRef);
165
+ this.injector = inject(Injector);
166
+ }
167
+ get element() {
168
+ return this.elementRef.nativeElement;
169
+ }
170
+ ngAfterViewInit() {
171
+ const wcElement = this.element;
172
+ const inputsToSync = [
173
+ 'design',
174
+ 'disabled',
175
+ 'state',
176
+ 'arrowButtonPressed',
177
+ 'accessibilityAttributes',
178
+ ];
179
+ // Synchronize inputs (properties)
180
+ for (const inputName of inputsToSync) {
181
+ // Find the corresponding camelCase signal property on the Angular component
182
+ const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
183
+ // Use the Injector to run the effect in the correct context
184
+ if (this[signalName] && typeof this[signalName] === 'function') {
185
+ runInInjectionContext(this.injector, () => {
186
+ effect(() => {
187
+ // Read the signal value
188
+ const value = this[signalName]();
189
+ if (wcElement) {
190
+ // Write the value to the Web Component's property
191
+ wcElement[inputName] = value;
192
+ }
193
+ });
194
+ });
195
+ }
196
+ }
197
+ const outputsToSync = [
198
+ 'ui5Click',
199
+ 'ui5ArrowButtonClick',
200
+ ];
201
+ // Synchronize outputs (events)
202
+ for (const outputName of outputsToSync) {
203
+ // Map Angular output name to UI5 web component event name
204
+ const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);
205
+ // Ensure the output property exists and has an emit function before adding listener
206
+ if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {
207
+ // Cast the listener to the correct type to satisfy TypeScript
208
+ wcElement.addEventListener(eventName, (e) => {
209
+ this[outputName].emit(e);
210
+ });
211
+ }
212
+ }
213
+ }
214
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
215
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Button, isStandalone: true, selector: "ui5-ai-button, [ui5-ai-button]", inputs: { design: { classPropertyName: "design", publicName: "design", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, arrowButtonPressed: { classPropertyName: "arrowButtonPressed", publicName: "arrowButtonPressed", isSignal: true, isRequired: false, transformFunction: null }, accessibilityAttributes: { classPropertyName: "accessibilityAttributes", publicName: "accessibilityAttributes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Click: "ui5Click", ui5ArrowButtonClick: "ui5ArrowButtonClick" }, exportAs: ["ui5Button"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
216
+ }
217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Button, decorators: [{
218
+ type: Component,
219
+ args: [{
220
+ standalone: true,
221
+ selector: 'ui5-ai-button, [ui5-ai-button]',
222
+ template: '<ng-content></ng-content>',
223
+ exportAs: 'ui5Button',
224
+ changeDetection: ChangeDetectionStrategy.OnPush,
225
+ }]
226
+ }] });
227
+
228
+ class ButtonState {
229
+ constructor() {
230
+ /**
231
+ * Defines the name of the button state.
232
+ */
233
+ this.name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : []));
234
+ /**
235
+ * Defines the text of the button in this state.
236
+ */
237
+ this.text = input(...(ngDevMode ? [undefined, { debugName: "text" }] : []));
238
+ /**
239
+ * Defines the icon to be displayed as graphical element within the component before the text.
240
+ The SAP-icons font provides numerous options.
241
+
242
+ **Example:**
243
+
244
+ See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
245
+ */
246
+ this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
247
+ /**
248
+ * Defines the icon to be displayed as graphical element within the component after the text.
249
+ The SAP-icons font provides numerous options.
250
+
251
+ **Example:**
252
+
253
+ See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
254
+ */
255
+ this.endIcon = input(...(ngDevMode ? [undefined, { debugName: "endIcon" }] : []));
256
+ /**
257
+ * Defines if the component is in split button mode.
258
+ */
259
+ this.showArrowButton = input(false, ...(ngDevMode ? [{ debugName: "showArrowButton", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
260
+ this.elementRef = inject(ElementRef);
261
+ this.injector = inject(Injector);
262
+ }
263
+ get element() {
264
+ return this.elementRef.nativeElement;
265
+ }
266
+ ngAfterViewInit() {
267
+ const wcElement = this.element;
268
+ const inputsToSync = [
269
+ 'name',
270
+ 'text',
271
+ 'icon',
272
+ 'endIcon',
273
+ 'showArrowButton',
274
+ ];
275
+ // Synchronize inputs (properties)
276
+ for (const inputName of inputsToSync) {
277
+ // Find the corresponding camelCase signal property on the Angular component
278
+ const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
279
+ // Use the Injector to run the effect in the correct context
280
+ if (this[signalName] && typeof this[signalName] === 'function') {
281
+ runInInjectionContext(this.injector, () => {
282
+ effect(() => {
283
+ // Read the signal value
284
+ const value = this[signalName]();
285
+ if (wcElement) {
286
+ // Write the value to the Web Component's property
287
+ wcElement[inputName] = value;
288
+ }
289
+ });
290
+ });
291
+ }
292
+ }
293
+ }
294
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: ButtonState, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
295
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: ButtonState, isStandalone: true, selector: "ui5-ai-button-state, [ui5-ai-button-state]", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, endIcon: { classPropertyName: "endIcon", publicName: "endIcon", isSignal: true, isRequired: false, transformFunction: null }, showArrowButton: { classPropertyName: "showArrowButton", publicName: "showArrowButton", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["ui5ButtonState"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
296
+ }
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: ButtonState, decorators: [{
298
+ type: Component,
299
+ args: [{
300
+ standalone: true,
301
+ selector: 'ui5-ai-button-state, [ui5-ai-button-state]',
302
+ template: '<ng-content></ng-content>',
303
+ exportAs: 'ui5ButtonState',
304
+ changeDetection: ChangeDetectionStrategy.OnPush,
305
+ }]
306
+ }] });
307
+
308
+ class Input {
309
+ constructor() {
310
+ /**
311
+ * Indicates the index of the currently displayed version.
312
+ */
313
+ this.currentVersion = input(0, ...(ngDevMode ? [{ debugName: "currentVersion" }] : []));
314
+ /**
315
+ * Indicates the total number of result versions available.
316
+
317
+ When not set or set to 0, the versioning will be hidden.
318
+ */
319
+ this.totalVersions = input(0, ...(ngDevMode ? [{ debugName: "totalVersions" }] : []));
320
+ /**
321
+ * Defines whether the AI Writing Assistant is currently loading.
322
+
323
+ When `true`, indicates that an AI action is in progress.
324
+ */
325
+ this.loading = input(false, ...(ngDevMode ? [{ debugName: "loading", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
326
+ /**
327
+ * Fired when the user selects the AI button.
328
+ */
329
+ this.ui5ButtonClick = output();
330
+ /**
331
+ * Fired when an item from the AI actions menu is clicked.
332
+ */
333
+ this.ui5ItemClick = output();
334
+ /**
335
+ * Fired when the user selects the "Stop" button to stop ongoing AI text generation.
336
+ */
337
+ this.ui5StopGeneration = output();
338
+ /**
339
+ * Fired when the user selects the version navigation buttons.
340
+ */
341
+ this.ui5VersionChange = output();
342
+ this.elementRef = inject(ElementRef);
343
+ this.injector = inject(Injector);
344
+ }
345
+ get element() {
346
+ return this.elementRef.nativeElement;
347
+ }
348
+ ngAfterViewInit() {
349
+ const wcElement = this.element;
350
+ const inputsToSync = [
351
+ 'currentVersion',
352
+ 'totalVersions',
353
+ 'loading',
354
+ ];
355
+ // Synchronize inputs (properties)
356
+ for (const inputName of inputsToSync) {
357
+ // Find the corresponding camelCase signal property on the Angular component
358
+ const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
359
+ // Use the Injector to run the effect in the correct context
360
+ if (this[signalName] && typeof this[signalName] === 'function') {
361
+ runInInjectionContext(this.injector, () => {
362
+ effect(() => {
363
+ // Read the signal value
364
+ const value = this[signalName]();
365
+ if (wcElement) {
366
+ // Write the value to the Web Component's property
367
+ wcElement[inputName] = value;
368
+ }
369
+ });
370
+ });
371
+ }
372
+ }
373
+ const outputsToSync = [
374
+ 'ui5ButtonClick',
375
+ 'ui5ItemClick',
376
+ 'ui5StopGeneration',
377
+ 'ui5VersionChange',
378
+ ];
379
+ // Synchronize outputs (events)
380
+ for (const outputName of outputsToSync) {
381
+ // Map Angular output name to UI5 web component event name
382
+ const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);
383
+ // Ensure the output property exists and has an emit function before adding listener
384
+ if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {
385
+ // Cast the listener to the correct type to satisfy TypeScript
386
+ wcElement.addEventListener(eventName, (e) => {
387
+ this[outputName].emit(e);
388
+ });
389
+ }
390
+ }
391
+ }
392
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Input, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
393
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Input, isStandalone: true, selector: "ui5-ai-input, [ui5-ai-input]", inputs: { currentVersion: { classPropertyName: "currentVersion", publicName: "currentVersion", isSignal: true, isRequired: false, transformFunction: null }, totalVersions: { classPropertyName: "totalVersions", publicName: "totalVersions", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5ButtonClick: "ui5ButtonClick", ui5ItemClick: "ui5ItemClick", ui5StopGeneration: "ui5StopGeneration", ui5VersionChange: "ui5VersionChange" }, exportAs: ["ui5Input"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
394
+ }
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Input, decorators: [{
396
+ type: Component,
397
+ args: [{
398
+ standalone: true,
399
+ selector: 'ui5-ai-input, [ui5-ai-input]',
400
+ template: '<ng-content></ng-content>',
401
+ exportAs: 'ui5Input',
402
+ changeDetection: ChangeDetectionStrategy.OnPush,
403
+ }]
404
+ }] });
405
+
406
+ class PromptInput {
407
+ constructor() {
408
+ /**
409
+ * Defines the value of the component.
410
+ */
411
+ this.value = input("", ...(ngDevMode ? [{ debugName: "value" }] : []));
412
+ /**
413
+ * Defines a short hint intended to aid the user with data entry when the
414
+ component has no value.
415
+ */
416
+ this.placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
417
+ /**
418
+ * Defines the label of the input field.
419
+ */
420
+ this.label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
421
+ /**
422
+ * Defines whether the clear icon of the input will be shown.
423
+ */
424
+ this.showClearIcon = input(false, ...(ngDevMode ? [{ debugName: "showClearIcon", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
425
+ /**
426
+ * Determines whether the characters exceeding the maximum allowed character count are visible
427
+ in the component.
428
+
429
+ If set to `false`, the user is not allowed to enter more characters than what is set in the
430
+ `maxlength` property.
431
+ If set to `true` the characters exceeding the `maxlength` value are selected on
432
+ paste and the counter below the component displays their number.
433
+ */
434
+ this.showExceededText = input(false, ...(ngDevMode ? [{ debugName: "showExceededText", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
435
+ /**
436
+ * Defines whether the component is in disabled state.
437
+
438
+ **Note:** A disabled component is completely noninteractive.
439
+ */
440
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
441
+ /**
442
+ * Defines whether the component is read-only.
443
+
444
+ **Note:** A read-only component is not editable,
445
+ but still provides visual feedback upon user interaction.
446
+ */
447
+ this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
448
+ /**
449
+ * Sets the maximum number of characters available in the input field.
450
+ */
451
+ this.maxlength = input(...(ngDevMode ? [undefined, { debugName: "maxlength" }] : []));
452
+ /**
453
+ * Defines the value state of the component.
454
+ */
455
+ this.valueState = input("None", ...(ngDevMode ? [{ debugName: "valueState" }] : []));
456
+ /**
457
+ * Defines whether the component should show suggestions, if such are present.
458
+ */
459
+ this.showSuggestions = input(false, ...(ngDevMode ? [{ debugName: "showSuggestions", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
460
+ /**
461
+ * Fired when the input operation has finished by pressing Enter
462
+ or AI button is clicked.
463
+ */
464
+ this.ui5Submit = output();
465
+ /**
466
+ * Fired when the value of the component changes at each keystroke,
467
+ and when a suggestion item has been selected.
468
+ */
469
+ this.ui5Input = output();
470
+ /**
471
+ * Fired when the input operation has finished by pressing Enter
472
+ or on focusout.
473
+ */
474
+ this.ui5Change = output();
475
+ this.elementRef = inject(ElementRef);
476
+ this.injector = inject(Injector);
477
+ }
478
+ get element() {
479
+ return this.elementRef.nativeElement;
480
+ }
481
+ ngAfterViewInit() {
482
+ const wcElement = this.element;
483
+ const inputsToSync = [
484
+ 'value',
485
+ 'placeholder',
486
+ 'label',
487
+ 'showClearIcon',
488
+ 'showExceededText',
489
+ 'disabled',
490
+ 'readonly',
491
+ 'maxlength',
492
+ 'valueState',
493
+ 'showSuggestions',
494
+ ];
495
+ // Synchronize inputs (properties)
496
+ for (const inputName of inputsToSync) {
497
+ // Find the corresponding camelCase signal property on the Angular component
498
+ const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
499
+ // Use the Injector to run the effect in the correct context
500
+ if (this[signalName] && typeof this[signalName] === 'function') {
501
+ runInInjectionContext(this.injector, () => {
502
+ effect(() => {
503
+ // Read the signal value
504
+ const value = this[signalName]();
505
+ if (wcElement) {
506
+ // Write the value to the Web Component's property
507
+ wcElement[inputName] = value;
508
+ }
509
+ });
510
+ });
511
+ }
512
+ }
513
+ const outputsToSync = [
514
+ 'ui5Submit',
515
+ 'ui5Input',
516
+ 'ui5Change',
517
+ ];
518
+ // Synchronize outputs (events)
519
+ for (const outputName of outputsToSync) {
520
+ // Map Angular output name to UI5 web component event name
521
+ const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);
522
+ // Ensure the output property exists and has an emit function before adding listener
523
+ if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {
524
+ // Cast the listener to the correct type to satisfy TypeScript
525
+ wcElement.addEventListener(eventName, (e) => {
526
+ this[outputName].emit(e);
527
+ });
528
+ }
529
+ }
530
+ }
531
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PromptInput, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
532
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: PromptInput, isStandalone: true, selector: "ui5-ai-prompt-input, [ui5-ai-prompt-input]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, showClearIcon: { classPropertyName: "showClearIcon", publicName: "showClearIcon", isSignal: true, isRequired: false, transformFunction: null }, showExceededText: { classPropertyName: "showExceededText", publicName: "showExceededText", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, valueState: { classPropertyName: "valueState", publicName: "valueState", isSignal: true, isRequired: false, transformFunction: null }, showSuggestions: { classPropertyName: "showSuggestions", publicName: "showSuggestions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Submit: "ui5Submit", ui5Input: "ui5Input", ui5Change: "ui5Change" }, exportAs: ["ui5PromptInput"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
533
+ }
534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PromptInput, decorators: [{
535
+ type: Component,
536
+ args: [{
537
+ standalone: true,
538
+ selector: 'ui5-ai-prompt-input, [ui5-ai-prompt-input]',
539
+ template: '<ng-content></ng-content>',
540
+ exportAs: 'ui5PromptInput',
541
+ changeDetection: ChangeDetectionStrategy.OnPush,
542
+ }]
543
+ }] });
544
+
545
+ class TextArea {
546
+ constructor() {
547
+ /**
548
+ * Defines whether the `ui5-ai-textarea` is currently in a loading(processing) state.
549
+ */
550
+ this.loading = input(false, ...(ngDevMode ? [{ debugName: "loading", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
551
+ /**
552
+ * Defines the prompt description of the current action.
553
+ */
554
+ this.promptDescription = input("", ...(ngDevMode ? [{ debugName: "promptDescription" }] : []));
555
+ /**
556
+ * Indicates the index of the currently displayed version.
557
+ */
558
+ this.currentVersion = input(0, ...(ngDevMode ? [{ debugName: "currentVersion" }] : []));
559
+ /**
560
+ * Indicates the total number of result versions available.
561
+
562
+ Notes:
563
+ Versioning is hidden if the value is `0`
564
+ */
565
+ this.totalVersions = input(0, ...(ngDevMode ? [{ debugName: "totalVersions" }] : [])); // className is now passed
566
+ /**
567
+ * Fired when the user clicks on version navigation buttons.
568
+ */
569
+ this.ui5VersionChange = output();
570
+ /**
571
+ * Fired when the user requests to stop AI text generation.
572
+ */
573
+ this.ui5StopGeneration = output();
574
+ this.elementRef = inject(ElementRef);
575
+ this.injector = inject(Injector);
576
+ }
577
+ get element() {
578
+ return this.elementRef.nativeElement;
579
+ }
580
+ ngAfterViewInit() {
581
+ const wcElement = this.element;
582
+ const inputsToSync = [
583
+ 'loading',
584
+ 'promptDescription',
585
+ 'currentVersion',
586
+ 'totalVersions',
587
+ ];
588
+ // Synchronize inputs (properties)
589
+ for (const inputName of inputsToSync) {
590
+ // Find the corresponding camelCase signal property on the Angular component
591
+ const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
592
+ // Use the Injector to run the effect in the correct context
593
+ if (this[signalName] && typeof this[signalName] === 'function') {
594
+ runInInjectionContext(this.injector, () => {
595
+ effect(() => {
596
+ // Read the signal value
597
+ const value = this[signalName]();
598
+ if (wcElement) {
599
+ // Write the value to the Web Component's property
600
+ wcElement[inputName] = value;
601
+ }
602
+ });
603
+ });
604
+ }
605
+ }
606
+ const outputsToSync = [
607
+ 'ui5VersionChange',
608
+ 'ui5StopGeneration',
609
+ ];
610
+ // Synchronize outputs (events)
611
+ for (const outputName of outputsToSync) {
612
+ // Map Angular output name to UI5 web component event name
613
+ const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);
614
+ // Ensure the output property exists and has an emit function before adding listener
615
+ if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {
616
+ // Cast the listener to the correct type to satisfy TypeScript
617
+ wcElement.addEventListener(eventName, (e) => {
618
+ this[outputName].emit(e);
619
+ });
620
+ }
621
+ }
622
+ }
623
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TextArea, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
624
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: TextArea, isStandalone: true, selector: "ui5-ai-textarea, [ui5-ai-textarea]", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, promptDescription: { classPropertyName: "promptDescription", publicName: "promptDescription", isSignal: true, isRequired: false, transformFunction: null }, currentVersion: { classPropertyName: "currentVersion", publicName: "currentVersion", isSignal: true, isRequired: false, transformFunction: null }, totalVersions: { classPropertyName: "totalVersions", publicName: "totalVersions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5VersionChange: "ui5VersionChange", ui5StopGeneration: "ui5StopGeneration" }, exportAs: ["ui5TextArea"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
625
+ }
626
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TextArea, decorators: [{
627
+ type: Component,
628
+ args: [{
629
+ standalone: true,
630
+ selector: 'ui5-ai-textarea, [ui5-ai-textarea]',
631
+ template: '<ng-content></ng-content>',
632
+ exportAs: 'ui5TextArea',
633
+ changeDetection: ChangeDetectionStrategy.OnPush,
634
+ }]
635
+ }] });
636
+
637
+ class Ui5WebcomponentsAiThemingService extends WebcomponentsThemingProvider {
638
+ constructor() {
639
+ super(() => import('@ui5/webcomponents-ai/dist/generated/json-imports/Themes.js'));
640
+ this.name = 'ui-5-webcomponents--ai-theming-service';
641
+ }
642
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Ui5WebcomponentsAiThemingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
643
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Ui5WebcomponentsAiThemingService, providedIn: 'root' }); }
644
+ }
645
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Ui5WebcomponentsAiThemingService, decorators: [{
646
+ type: Injectable,
647
+ args: [{ providedIn: 'root' }]
648
+ }], ctorParameters: () => [] });
649
+
650
+ /**
651
+ * Generated bundle index. Do not edit.
652
+ */
653
+
654
+ export { Button, ButtonState, GenericControlValueAccessor, Input, PromptInput, TextArea, Ui5WebcomponentsAiThemingService };
655
+ //# sourceMappingURL=fundamental-ngx-ui5-webcomponents-ai.mjs.map