@copilotkitnext/angular 0.0.2 → 0.0.5

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 (173) hide show
  1. package/README.md +3 -3
  2. package/dist/README.md +3 -3
  3. package/dist/components/chat/copilot-chat-assistant-message.component.d.ts +10 -10
  4. package/dist/components/chat/copilot-chat-message-view.component.d.ts +42 -42
  5. package/dist/components/chat/copilot-chat-view.component.d.ts +14 -14
  6. package/dist/core/copilotkit.providers.d.ts +1 -1
  7. package/dist/core/copilotkit.service.d.ts +5 -5
  8. package/dist/core/copilotkit.types.d.ts +8 -10
  9. package/dist/directives/copilotkit-frontend-tool.directive.d.ts +1 -1
  10. package/dist/esm2022/components/chat/copilot-chat-assistant-message-buttons.component.mjs +384 -0
  11. package/dist/esm2022/components/chat/copilot-chat-assistant-message-renderer.component.mjs +286 -0
  12. package/dist/esm2022/components/chat/copilot-chat-assistant-message-toolbar.component.mjs +27 -0
  13. package/dist/esm2022/components/chat/copilot-chat-assistant-message.component.mjs +433 -0
  14. package/dist/esm2022/components/chat/copilot-chat-assistant-message.types.mjs +2 -0
  15. package/dist/esm2022/components/chat/copilot-chat-audio-recorder.component.mjs +202 -0
  16. package/dist/esm2022/components/chat/copilot-chat-buttons.component.mjs +321 -0
  17. package/dist/esm2022/components/chat/copilot-chat-input-defaults.mjs +38 -0
  18. package/dist/esm2022/components/chat/copilot-chat-input.component.mjs +666 -0
  19. package/dist/esm2022/components/chat/copilot-chat-input.types.mjs +10 -0
  20. package/dist/esm2022/components/chat/copilot-chat-message-view-cursor.component.mjs +45 -0
  21. package/dist/esm2022/components/chat/copilot-chat-message-view.component.mjs +296 -0
  22. package/dist/esm2022/components/chat/copilot-chat-message-view.types.mjs +2 -0
  23. package/dist/esm2022/components/chat/copilot-chat-textarea.component.mjs +188 -0
  24. package/dist/esm2022/components/chat/copilot-chat-tool-calls-view.component.mjs +216 -0
  25. package/dist/esm2022/components/chat/copilot-chat-toolbar.component.mjs +25 -0
  26. package/dist/esm2022/components/chat/copilot-chat-tools-menu.component.mjs +199 -0
  27. package/dist/esm2022/components/chat/copilot-chat-user-message-branch-navigation.component.mjs +137 -0
  28. package/dist/esm2022/components/chat/copilot-chat-user-message-buttons.component.mjs +207 -0
  29. package/dist/esm2022/components/chat/copilot-chat-user-message-renderer.component.mjs +35 -0
  30. package/dist/esm2022/components/chat/copilot-chat-user-message-toolbar.component.mjs +34 -0
  31. package/dist/esm2022/components/chat/copilot-chat-user-message.component.mjs +341 -0
  32. package/dist/esm2022/components/chat/copilot-chat-user-message.types.mjs +2 -0
  33. package/dist/esm2022/components/chat/copilot-chat-view-disclaimer.component.mjs +52 -0
  34. package/dist/esm2022/components/chat/copilot-chat-view-feather.component.mjs +55 -0
  35. package/dist/esm2022/components/chat/copilot-chat-view-handlers.service.mjs +19 -0
  36. package/dist/esm2022/components/chat/copilot-chat-view-input-container.component.mjs +110 -0
  37. package/dist/esm2022/components/chat/copilot-chat-view-scroll-to-bottom-button.component.mjs +93 -0
  38. package/dist/esm2022/components/chat/copilot-chat-view-scroll-view.component.mjs +443 -0
  39. package/dist/esm2022/components/chat/copilot-chat-view.component.mjs +479 -0
  40. package/dist/esm2022/components/chat/copilot-chat-view.types.mjs +2 -0
  41. package/dist/esm2022/components/chat/copilot-chat.component.mjs +214 -0
  42. package/dist/esm2022/components/copilotkit-tool-render.component.mjs +153 -0
  43. package/dist/esm2022/copilotkitnext-angular.mjs +5 -0
  44. package/dist/esm2022/core/chat-configuration/chat-configuration.providers.mjs +65 -0
  45. package/dist/esm2022/core/chat-configuration/chat-configuration.service.mjs +145 -0
  46. package/dist/esm2022/core/chat-configuration/chat-configuration.types.mjs +26 -0
  47. package/dist/esm2022/core/copilotkit.providers.mjs +34 -0
  48. package/dist/esm2022/core/copilotkit.service.mjs +426 -0
  49. package/dist/esm2022/core/copilotkit.types.mjs +13 -0
  50. package/dist/esm2022/directives/copilotkit-agent-context.directive.mjs +130 -0
  51. package/dist/esm2022/directives/copilotkit-agent.directive.mjs +217 -0
  52. package/dist/esm2022/directives/copilotkit-chat-config.directive.mjs +218 -0
  53. package/dist/esm2022/directives/copilotkit-config.directive.mjs +94 -0
  54. package/dist/esm2022/directives/copilotkit-frontend-tool.directive.mjs +128 -0
  55. package/dist/esm2022/directives/copilotkit-human-in-the-loop.directive.mjs +265 -0
  56. package/dist/esm2022/directives/stick-to-bottom.directive.mjs +181 -0
  57. package/dist/esm2022/index.mjs +70 -0
  58. package/dist/esm2022/lib/directives/tooltip.directive.mjs +211 -0
  59. package/dist/esm2022/lib/slots/copilot-slot.component.mjs +144 -0
  60. package/dist/esm2022/lib/slots/slot.types.mjs +6 -0
  61. package/dist/esm2022/lib/slots/slot.utils.mjs +222 -0
  62. package/dist/esm2022/lib/utils.mjs +10 -0
  63. package/dist/esm2022/services/resize-observer.service.mjs +152 -0
  64. package/dist/esm2022/services/scroll-position.service.mjs +124 -0
  65. package/dist/esm2022/types/frontend-tool.mjs +2 -0
  66. package/dist/esm2022/types/human-in-the-loop.mjs +2 -0
  67. package/dist/esm2022/utils/agent-context.utils.mjs +114 -0
  68. package/dist/esm2022/utils/agent.utils.mjs +204 -0
  69. package/dist/esm2022/utils/chat-config.utils.mjs +186 -0
  70. package/dist/esm2022/utils/copilotkit.utils.mjs +20 -0
  71. package/dist/esm2022/utils/frontend-tool.utils.mjs +224 -0
  72. package/dist/esm2022/utils/human-in-the-loop.utils.mjs +293 -0
  73. package/dist/fesm2022/copilotkitnext-angular.mjs +174 -187
  74. package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -1
  75. package/dist/utils/frontend-tool.utils.d.ts +1 -1
  76. package/package.json +23 -20
  77. package/vitest.config.mts +32 -21
  78. package/.turbo/turbo-build.log +0 -38
  79. package/.turbo/turbo-check-types.log +0 -0
  80. package/.turbo/turbo-test.log +0 -71
  81. package/ng-package.json +0 -19
  82. package/src/components/chat/__tests__/copilot-chat-assistant-message.component.spec.ts +0 -282
  83. package/src/components/chat/__tests__/copilot-chat-input.component.spec.ts +0 -419
  84. package/src/components/chat/__tests__/copilot-chat-message-view.component.spec.ts +0 -372
  85. package/src/components/chat/__tests__/copilot-chat-user-message.component.spec.ts +0 -249
  86. package/src/components/chat/copilot-chat-assistant-message-buttons.component.ts +0 -292
  87. package/src/components/chat/copilot-chat-assistant-message-renderer.component.ts +0 -472
  88. package/src/components/chat/copilot-chat-assistant-message-toolbar.component.ts +0 -29
  89. package/src/components/chat/copilot-chat-assistant-message.component.ts +0 -463
  90. package/src/components/chat/copilot-chat-assistant-message.types.ts +0 -50
  91. package/src/components/chat/copilot-chat-audio-recorder.component.ts +0 -241
  92. package/src/components/chat/copilot-chat-buttons.component.ts +0 -308
  93. package/src/components/chat/copilot-chat-buttons.component.ts.bak +0 -471
  94. package/src/components/chat/copilot-chat-input-defaults.ts +0 -47
  95. package/src/components/chat/copilot-chat-input.component.ts +0 -512
  96. package/src/components/chat/copilot-chat-input.types.ts +0 -148
  97. package/src/components/chat/copilot-chat-message-view-cursor.component.ts +0 -51
  98. package/src/components/chat/copilot-chat-message-view.component.ts +0 -233
  99. package/src/components/chat/copilot-chat-message-view.types.ts +0 -39
  100. package/src/components/chat/copilot-chat-textarea.component.ts +0 -220
  101. package/src/components/chat/copilot-chat-tool-calls-view.component.ts +0 -261
  102. package/src/components/chat/copilot-chat-toolbar.component.ts +0 -35
  103. package/src/components/chat/copilot-chat-tools-menu.component.ts +0 -185
  104. package/src/components/chat/copilot-chat-user-message-branch-navigation.component.ts +0 -121
  105. package/src/components/chat/copilot-chat-user-message-buttons.component.ts +0 -170
  106. package/src/components/chat/copilot-chat-user-message-renderer.component.ts +0 -37
  107. package/src/components/chat/copilot-chat-user-message-toolbar.component.ts +0 -37
  108. package/src/components/chat/copilot-chat-user-message.component.ts +0 -247
  109. package/src/components/chat/copilot-chat-user-message.types.ts +0 -42
  110. package/src/components/chat/copilot-chat-view-disclaimer.component.ts +0 -51
  111. package/src/components/chat/copilot-chat-view-feather.component.ts +0 -47
  112. package/src/components/chat/copilot-chat-view-handlers.service.ts +0 -14
  113. package/src/components/chat/copilot-chat-view-input-container.component.ts +0 -87
  114. package/src/components/chat/copilot-chat-view-scroll-to-bottom-button.component.ts +0 -79
  115. package/src/components/chat/copilot-chat-view-scroll-view.component.ts +0 -322
  116. package/src/components/chat/copilot-chat-view.component.ts +0 -420
  117. package/src/components/chat/copilot-chat-view.types.ts +0 -52
  118. package/src/components/chat/copilot-chat.component.ts +0 -232
  119. package/src/components/copilotkit-tool-render.component.ts +0 -169
  120. package/src/core/__tests__/copilotkit.service.spec.ts +0 -1051
  121. package/src/core/__tests__/copilotkit.service.wildcard.spec.ts +0 -316
  122. package/src/core/chat-configuration/__tests__/chat-configuration.service.spec.ts +0 -287
  123. package/src/core/chat-configuration/chat-configuration.providers.ts +0 -71
  124. package/src/core/chat-configuration/chat-configuration.service.ts +0 -162
  125. package/src/core/chat-configuration/chat-configuration.types.ts +0 -57
  126. package/src/core/copilotkit.providers.ts +0 -59
  127. package/src/core/copilotkit.service.ts +0 -542
  128. package/src/core/copilotkit.types.ts +0 -132
  129. package/src/directives/__tests__/copilotkit-agent-context.directive.spec.ts +0 -384
  130. package/src/directives/__tests__/copilotkit-agent.directive.spec.ts +0 -253
  131. package/src/directives/__tests__/copilotkit-chat-config.directive.spec.ts +0 -385
  132. package/src/directives/__tests__/copilotkit-config.directive.spec.ts +0 -69
  133. package/src/directives/__tests__/copilotkit-frontend-tool-simple.directive.spec.ts +0 -60
  134. package/src/directives/__tests__/copilotkit-frontend-tool.directive.spec.ts +0 -108
  135. package/src/directives/__tests__/copilotkit-human-in-the-loop.directive.spec.ts +0 -452
  136. package/src/directives/copilotkit-agent-context.directive.ts +0 -138
  137. package/src/directives/copilotkit-agent.directive.ts +0 -225
  138. package/src/directives/copilotkit-chat-config.directive.ts +0 -241
  139. package/src/directives/copilotkit-config.directive.ts +0 -81
  140. package/src/directives/copilotkit-frontend-tool.directive.ts +0 -145
  141. package/src/directives/copilotkit-human-in-the-loop.directive.ts +0 -281
  142. package/src/directives/stick-to-bottom.directive.ts +0 -204
  143. package/src/index.ts +0 -105
  144. package/src/lib/directives/tooltip.directive.ts +0 -292
  145. package/src/lib/slots/__tests__/slot.utils.spec.ts +0 -377
  146. package/src/lib/slots/copilot-slot.component.ts +0 -135
  147. package/src/lib/slots/index.ts +0 -3
  148. package/src/lib/slots/slot.types.ts +0 -64
  149. package/src/lib/slots/slot.utils.ts +0 -289
  150. package/src/lib/utils.ts +0 -10
  151. package/src/public-api.ts +0 -1
  152. package/src/services/resize-observer.service.ts +0 -181
  153. package/src/services/scroll-position.service.ts +0 -169
  154. package/src/styles/globals.css +0 -266
  155. package/src/styles/index.css +0 -3
  156. package/src/test-setup.ts +0 -15
  157. package/src/testing/index.ts +0 -3
  158. package/src/testing/testing.utils.ts +0 -248
  159. package/src/types/frontend-tool.ts +0 -44
  160. package/src/types/human-in-the-loop.ts +0 -52
  161. package/src/utils/__tests__/agent.utils.spec.ts +0 -234
  162. package/src/utils/__tests__/chat-config.utils.spec.ts +0 -306
  163. package/src/utils/__tests__/frontend-tool-inject.spec.ts +0 -350
  164. package/src/utils/__tests__/frontend-tool-integration.spec.ts +0 -199
  165. package/src/utils/__tests__/frontend-tool.utils.spec.ts +0 -272
  166. package/src/utils/__tests__/human-in-the-loop.utils.spec.ts +0 -365
  167. package/src/utils/agent-context.utils.ts +0 -133
  168. package/src/utils/agent.utils.ts +0 -239
  169. package/src/utils/chat-config.utils.ts +0 -221
  170. package/src/utils/copilotkit.utils.ts +0 -20
  171. package/src/utils/frontend-tool.utils.ts +0 -266
  172. package/src/utils/human-in-the-loop.utils.ts +0 -359
  173. package/tsconfig.spec.json +0 -12
@@ -1,471 +0,0 @@
1
- import {
2
- Component,
3
- Input,
4
- Output,
5
- EventEmitter,
6
- signal,
7
- computed,
8
- inject,
9
- ChangeDetectionStrategy,
10
- TemplateRef
11
- } from '@angular/core';
12
- import { CommonModule } from '@angular/common';
13
- import { CopilotChatConfigurationService } from '../../core/chat-configuration/chat-configuration.service';
14
- import type { CopilotChatLabels } from '../../core/chat-configuration/chat-configuration.types';
15
-
16
- /**
17
- * Base button component with common styling
18
- */
19
- @Component({
20
- selector: 'copilot-chat-button-base',
21
- standalone: true,
22
- imports: [CommonModule],
23
- template: `
24
- <button
25
- [type]="type()"
26
- [disabled]="disabled()"
27
- [class]="computedClass()"
28
- (click)="handleClick($event)"
29
- >
30
- <ng-content></ng-content>
31
- </button>
32
- `,
33
- styles: [`
34
- button {
35
- display: inline-flex;
36
- align-items: center;
37
- justify-content: center;
38
- gap: 0.5rem;
39
- white-space: nowrap;
40
- border-radius: 0.375rem;
41
- font-size: 0.875rem;
42
- font-weight: 500;
43
- transition: all 150ms;
44
- outline: none;
45
- border: none;
46
- cursor: pointer;
47
- flex-shrink: 0;
48
- }
49
-
50
- button:disabled {
51
- pointer-events: none;
52
- opacity: 0.5;
53
- }
54
-
55
- button:focus-visible {
56
- outline: 2px solid transparent;
57
- outline-offset: 2px;
58
- box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.5);
59
- }
60
- `]
61
- })
62
- class CopilotChatButtonBase {
63
- @Input() set inputType(val: 'button' | 'submit' | 'reset' | undefined) {
64
- this.type.set(val || 'button');
65
- }
66
- @Input() set inputDisabled(val: boolean | undefined) {
67
- this.disabled.set(val || false);
68
- }
69
- @Input() set inputClass(val: string | undefined) {
70
- this.customClass.set(val);
71
- }
72
-
73
- @Output() click = new EventEmitter<MouseEvent>();
74
-
75
- type = signal<'button' | 'submit' | 'reset'>('button');
76
- disabled = signal<boolean>(false);
77
- customClass = signal<string | undefined>(undefined);
78
-
79
- computedClass = computed(() => {
80
- return this.customClass() || 'button-base';
81
- });
82
-
83
- handleClick(event: MouseEvent): void {
84
- if (!this.disabled()) {
85
- this.click.emit(event);
86
- }
87
- }
88
- }
89
-
90
- /**
91
- * Send button component
92
- */
93
- @Component({
94
- selector: 'copilot-chat-send-button',
95
- standalone: true,
96
- imports: [CommonModule],
97
- changeDetection: ChangeDetectionStrategy.OnPush,
98
- template: `
99
- <div class="send-button-container">
100
- <button
101
- type="button"
102
- [disabled]="disabled()"
103
- [class]="computedClass()"
104
- (click)="handleClick()"
105
- >
106
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
107
- <line x1="12" y1="19" x2="12" y2="5"></line>
108
- <polyline points="5 12 12 5 19 12"></polyline>
109
- </svg>
110
- </button>
111
- </div>
112
- `,
113
- styles: [`
114
- .send-button-container {
115
- margin-right: 10px;
116
- }
117
-
118
- button {
119
- width: 32px;
120
- height: 32px;
121
- border-radius: 50%;
122
- background: black;
123
- color: white;
124
- border: none;
125
- cursor: pointer;
126
- display: flex;
127
- align-items: center;
128
- justify-content: center;
129
- transition: opacity 150ms;
130
- }
131
-
132
- button:hover:not(:disabled) {
133
- opacity: 0.7;
134
- }
135
-
136
- button:disabled {
137
- opacity: 0.5;
138
- cursor: not-allowed;
139
- }
140
-
141
- button:focus {
142
- outline: none;
143
- }
144
-
145
- :host-context(.dark) button {
146
- background: white;
147
- color: black;
148
- }
149
- `]
150
- })
151
- export class CopilotChatSendButtonComponent {
152
- @Input() set inputDisabled(val: boolean | undefined) {
153
- this.disabled.set(val || false);
154
- }
155
- @Input() set inputClass(val: string | undefined) {
156
- this.customClass.set(val);
157
- }
158
-
159
- @Output() click = new EventEmitter<void>();
160
-
161
- disabled = signal<boolean>(false);
162
- customClass = signal<string | undefined>(undefined);
163
-
164
- computedClass = computed(() => {
165
- const baseClasses = 'send-button';
166
- return this.customClass() || baseClasses;
167
- });
168
-
169
- handleClick(): void {
170
- if (!this.disabled()) {
171
- this.click.emit();
172
- }
173
- }
174
- }
175
-
176
- /**
177
- * Toolbar button component with tooltip support
178
- */
179
- @Component({
180
- selector: 'copilot-chat-toolbar-button',
181
- standalone: true,
182
- imports: [CommonModule],
183
- changeDetection: ChangeDetectionStrategy.OnPush,
184
- template: `
185
- <div class="toolbar-button-wrapper" [title]="tooltip()">
186
- <button
187
- type="button"
188
- [disabled]="disabled()"
189
- [class]="computedClass()"
190
- (click)="handleClick()"
191
- >
192
- <ng-content></ng-content>
193
- </button>
194
- </div>
195
- `,
196
- styles: [`
197
- .toolbar-button-wrapper {
198
- position: relative;
199
- display: inline-block;
200
- }
201
-
202
- button {
203
- width: 32px;
204
- height: 32px;
205
- padding: 0;
206
- border-radius: 6px;
207
- background: transparent;
208
- color: rgb(93, 93, 93);
209
- border: none;
210
- cursor: pointer;
211
- display: flex;
212
- align-items: center;
213
- justify-content: center;
214
- transition: all 150ms;
215
- }
216
-
217
- button:hover:not(:disabled) {
218
- background: #E8E8E8;
219
- }
220
-
221
- button:disabled {
222
- opacity: 0.5;
223
- cursor: not-allowed;
224
- }
225
-
226
- :host-context(.dark) button {
227
- color: rgb(243, 243, 243);
228
- }
229
-
230
- :host-context(.dark) button:hover:not(:disabled) {
231
- background: #303030;
232
- }
233
-
234
- button.primary {
235
- background: black;
236
- color: white;
237
- border-radius: 50%;
238
- }
239
-
240
- button.primary:hover:not(:disabled) {
241
- opacity: 0.7;
242
- background: black;
243
- }
244
-
245
- :host-context(.dark) button.primary {
246
- background: white;
247
- color: black;
248
- }
249
- `]
250
- })
251
- export class CopilotChatToolbarButtonComponent {
252
- @Input() set inputDisabled(val: boolean | undefined) {
253
- this.disabled.set(val || false);
254
- }
255
- @Input() set inputClass(val: string | undefined) {
256
- this.customClass.set(val);
257
- }
258
- @Input() set inputTooltip(val: string | undefined) {
259
- this.tooltip.set(val || '');
260
- }
261
- @Input() set inputVariant(val: 'primary' | 'secondary' | undefined) {
262
- this.variant.set(val || 'secondary');
263
- }
264
-
265
- @Output() click = new EventEmitter<void>();
266
-
267
- disabled = signal<boolean>(false);
268
- customClass = signal<string | undefined>(undefined);
269
- tooltip = signal<string>('');
270
- variant = signal<'primary' | 'secondary'>('secondary');
271
-
272
- computedClass = computed(() => {
273
- const variantClass = this.variant() === 'primary' ? 'primary' : 'secondary';
274
- return this.customClass() || `toolbar-button ${variantClass}`;
275
- });
276
-
277
- handleClick(): void {
278
- if (!this.disabled()) {
279
- this.click.emit();
280
- }
281
- }
282
- }
283
-
284
- /**
285
- * Start transcribe button
286
- */
287
- @Component({
288
- selector: 'copilot-chat-start-transcribe-button',
289
- standalone: true,
290
- imports: [CommonModule, CopilotChatToolbarButtonComponent],
291
- changeDetection: ChangeDetectionStrategy.OnPush,
292
- template: `
293
- <copilot-chat-toolbar-button
294
- [inputDisabled]="disabled()"
295
- [inputClass]="customClass() || 'mr-2'"
296
- [inputTooltip]="tooltip()"
297
- (click)="handleClick()"
298
- >
299
- <!-- Microphone Icon -->
300
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
301
- <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path>
302
- <path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>
303
- <line x1="12" y1="19" x2="12" y2="23"></line>
304
- <line x1="8" y1="23" x2="16" y2="23"></line>
305
- </svg>
306
- </copilot-chat-toolbar-button>
307
- `
308
- })
309
- export class CopilotChatStartTranscribeButtonComponent {
310
- @Input() set inputDisabled(val: boolean | undefined) {
311
- this.disabled.set(val || false);
312
- }
313
- @Input() set inputClass(val: string | undefined) {
314
- this.customClass.set(val);
315
- }
316
-
317
- @Output() click = new EventEmitter<void>();
318
-
319
- private chatConfig = inject(CopilotChatConfigurationService, { optional: true });
320
-
321
- disabled = signal<boolean>(false);
322
- customClass = signal<string | undefined>(undefined);
323
-
324
- tooltip = computed(() => {
325
- return this.chatConfig?.labels().chatInputToolbarStartTranscribeButtonLabel || 'Start recording';
326
- });
327
-
328
- handleClick(): void {
329
- this.click.emit();
330
- }
331
- }
332
-
333
- /**
334
- * Cancel transcribe button
335
- */
336
- @Component({
337
- selector: 'copilot-chat-cancel-transcribe-button',
338
- standalone: true,
339
- imports: [CommonModule, CopilotChatToolbarButtonComponent],
340
- changeDetection: ChangeDetectionStrategy.OnPush,
341
- template: `
342
- <copilot-chat-toolbar-button
343
- [inputDisabled]="disabled()"
344
- [inputClass]="customClass() || 'mr-2'"
345
- [inputTooltip]="tooltip()"
346
- (click)="handleClick()"
347
- >
348
- <!-- X Icon -->
349
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
350
- <line x1="18" y1="6" x2="6" y2="18"></line>
351
- <line x1="6" y1="6" x2="18" y2="18"></line>
352
- </svg>
353
- </copilot-chat-toolbar-button>
354
- `
355
- })
356
- export class CopilotChatCancelTranscribeButtonComponent {
357
- @Input() set inputDisabled(val: boolean | undefined) {
358
- this.disabled.set(val || false);
359
- }
360
- @Input() set inputClass(val: string | undefined) {
361
- this.customClass.set(val);
362
- }
363
-
364
- @Output() click = new EventEmitter<void>();
365
-
366
- private chatConfig = inject(CopilotChatConfigurationService, { optional: true });
367
-
368
- disabled = signal<boolean>(false);
369
- customClass = signal<string | undefined>(undefined);
370
-
371
- tooltip = computed(() => {
372
- return this.chatConfig?.labels().chatInputToolbarCancelTranscribeButtonLabel || 'Cancel recording';
373
- });
374
-
375
- handleClick(): void {
376
- this.click.emit();
377
- }
378
- }
379
-
380
- /**
381
- * Finish transcribe button
382
- */
383
- @Component({
384
- selector: 'copilot-chat-finish-transcribe-button',
385
- standalone: true,
386
- imports: [CommonModule, CopilotChatToolbarButtonComponent],
387
- changeDetection: ChangeDetectionStrategy.OnPush,
388
- template: `
389
- <copilot-chat-toolbar-button
390
- [inputDisabled]="disabled()"
391
- [inputClass]="customClass() || 'mr-[10px]'"
392
- [inputTooltip]="tooltip()"
393
- (click)="handleClick()"
394
- >
395
- <!-- Check Icon -->
396
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
397
- <polyline points="20 6 9 17 4 12"></polyline>
398
- </svg>
399
- </copilot-chat-toolbar-button>
400
- `
401
- })
402
- export class CopilotChatFinishTranscribeButtonComponent {
403
- @Input() set inputDisabled(val: boolean | undefined) {
404
- this.disabled.set(val || false);
405
- }
406
- @Input() set inputClass(val: string | undefined) {
407
- this.customClass.set(val);
408
- }
409
-
410
- @Output() click = new EventEmitter<void>();
411
-
412
- private chatConfig = inject(CopilotChatConfigurationService, { optional: true });
413
-
414
- disabled = signal<boolean>(false);
415
- customClass = signal<string | undefined>(undefined);
416
-
417
- tooltip = computed(() => {
418
- return this.chatConfig?.labels().chatInputToolbarFinishTranscribeButtonLabel || 'Finish recording';
419
- });
420
-
421
- handleClick(): void {
422
- this.click.emit();
423
- }
424
- }
425
-
426
- /**
427
- * Add file button
428
- */
429
- @Component({
430
- selector: 'copilot-chat-add-file-button',
431
- standalone: true,
432
- imports: [CommonModule, CopilotChatToolbarButtonComponent],
433
- changeDetection: ChangeDetectionStrategy.OnPush,
434
- template: `
435
- <copilot-chat-toolbar-button
436
- [inputDisabled]="disabled()"
437
- [inputClass]="customClass() || 'ml-2'"
438
- [inputTooltip]="tooltip()"
439
- (click)="handleClick()"
440
- >
441
- <!-- Plus Icon -->
442
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
443
- <line x1="12" y1="5" x2="12" y2="19"></line>
444
- <line x1="5" y1="12" x2="19" y2="12"></line>
445
- </svg>
446
- </copilot-chat-toolbar-button>
447
- `
448
- })
449
- export class CopilotChatAddFileButtonComponent {
450
- @Input() set inputDisabled(val: boolean | undefined) {
451
- this.disabled.set(val || false);
452
- }
453
- @Input() set inputClass(val: string | undefined) {
454
- this.customClass.set(val);
455
- }
456
-
457
- @Output() click = new EventEmitter<void>();
458
-
459
- private chatConfig = inject(CopilotChatConfigurationService, { optional: true });
460
-
461
- disabled = signal<boolean>(false);
462
- customClass = signal<string | undefined>(undefined);
463
-
464
- tooltip = computed(() => {
465
- return this.chatConfig?.labels().chatInputToolbarAddButtonLabel || 'Add file';
466
- });
467
-
468
- handleClick(): void {
469
- this.click.emit();
470
- }
471
- }
@@ -1,47 +0,0 @@
1
- import { CopilotChatTextareaComponent } from "./copilot-chat-textarea.component";
2
- import { CopilotChatAudioRecorderComponent } from "./copilot-chat-audio-recorder.component";
3
- import {
4
- CopilotChatSendButtonComponent,
5
- CopilotChatStartTranscribeButtonComponent,
6
- CopilotChatCancelTranscribeButtonComponent,
7
- CopilotChatFinishTranscribeButtonComponent,
8
- CopilotChatAddFileButtonComponent,
9
- } from "./copilot-chat-buttons.component";
10
- import { CopilotChatToolbarComponent } from "./copilot-chat-toolbar.component";
11
- import { CopilotChatToolsMenuComponent } from "./copilot-chat-tools-menu.component";
12
-
13
- /**
14
- * Default components used by CopilotChatInput.
15
- * These can be imported and reused when creating custom slot implementations.
16
- *
17
- * @example
18
- * ```typescript
19
- * import { CopilotChatInputDefaults } from '@copilotkitnext/angular';
20
- *
21
- * @Component({
22
- * template: `
23
- * <copilot-chat-input [sendButtonSlot]="CustomSendButton">
24
- * </copilot-chat-input>
25
- * `
26
- * })
27
- * export class MyComponent {
28
- * CustomSendButton = class extends CopilotChatInputDefaults.SendButton {
29
- * // Custom implementation
30
- * };
31
- * }
32
- * ```
33
- */
34
- export class CopilotChatInputDefaults {
35
- static readonly TextArea = CopilotChatTextareaComponent;
36
- static readonly AudioRecorder = CopilotChatAudioRecorderComponent;
37
- static readonly SendButton = CopilotChatSendButtonComponent;
38
- static readonly StartTranscribeButton =
39
- CopilotChatStartTranscribeButtonComponent;
40
- static readonly CancelTranscribeButton =
41
- CopilotChatCancelTranscribeButtonComponent;
42
- static readonly FinishTranscribeButton =
43
- CopilotChatFinishTranscribeButtonComponent;
44
- static readonly AddFileButton = CopilotChatAddFileButtonComponent;
45
- static readonly Toolbar = CopilotChatToolbarComponent;
46
- static readonly ToolsMenu = CopilotChatToolsMenuComponent;
47
- }